Class DelegatedIterable<AGENT_TYPE>

  • All Implemented Interfaces:

    public class DelegatedIterable<AGENT_TYPE>
    extends Object
    implements Iterable<AGENT_TYPE>
    An iterable that retrieves the iterator when needed based on a method call. You specify the method to call and the object to call it on and it returns the result of the method call from iterator()
    $Revision: 1.1 $ $Date: 2005/12/21 22:25:35 $
    Jerry Vos
    • Constructor Detail

      • DelegatedIterable

        public DelegatedIterable​(Object toCallOn,
                                 Method methodToCall)
        Constructs this with the object to call the method on as toCallOn and the method to call as methodToCall [toCallOn.methodToCall()].
        toCallOn - the object to call the specified method on
        methodToCall - the method to call on the object (must return Iterable and take no arguments)
    • Method Detail

      • iterator

        public Iterator<AGENT_TYPE> iterator()
        Fetches the result of calling the specified method on the specified object.
        Specified by:
        iterator in interface Iterable<AGENT_TYPE>
        the return value of toCallOn.methodToCall()
      • hashCode

        public int hashCode()
        Returns a hash code based on the object the method is to be called on and the method to call.
        hashCode in class Object
        toCallOn.hashCode() ^ methodToCall.hashCode()
      • equals

        public boolean equals​(Object obj)
        Checks if the object is a DelegatedIterable and its method and object to call on are equal
        equals in class Object
        if the objects share an equal method and method invocation target