Package repast.simphony.util.collections
Class DelegatedIterable<AGENT_TYPE>
java.lang.Object
repast.simphony.util.collections.DelegatedIterable<AGENT_TYPE>
- All Implemented Interfaces:
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()
- Version:
- $Revision: 1.1 $ $Date: 2005/12/21 22:25:35 $
- Author:
- Jerry Vos
-
Constructor Summary
ConstructorDescriptionDelegatedIterable
(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()]. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks if the object is a DelegatedIterable and its method and object to call on are equalint
hashCode()
Returns a hash code based on the object the method is to be called on and the method to call.iterator()
Fetches the result of calling the specified method on the specified object.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
DelegatedIterable
Constructs this with the object to call the method on as toCallOn and the method to call as methodToCall [toCallOn.methodToCall()].- Parameters:
toCallOn
- the object to call the specified method onmethodToCall
- the method to call on the object (must return Iterableand take no arguments)
-
-
Method Details
-
iterator
Fetches the result of calling the specified method on the specified object.- Specified by:
iterator
in interfaceIterable<AGENT_TYPE>
- Returns:
- 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. -
equals
Checks if the object is a DelegatedIterable and its method and object to call on are equal
-