agentland.resource
Class ResourceBunch
java.lang.Object
|
+--agentland.resource.ResourceBunch
- public class ResourceBunch
- extends Object
- implements Serializable
A collection of resources put in a hashtable format.
This is what is returned by a resource call--it is all
the various things (agents mainly) nabbed on behalf of
the call, and any extra info needed.
- See Also:
- Serialized Form
need
protected Need need
ResourceBunch
public ResourceBunch()
- An empty bundle.
ResourceBunch
public ResourceBunch(Resource res)
- This is the most basic form of bundle, it holds a single
resource.
getResources
public Collection getResources()
- Returns:
- all resources in bundle.
size
public int size()
getOnlyResource
public Resource getOnlyResource()
- Returns:
- the resources in bundle. If more than one, throw
runtime exception.
getResource
public Resource getResource(String name)
- Gives you the resource of a given name
- Parameters:
name
- name of the resource
addResource
public void addResource(Resource res)
merge
public void merge(ResourceBunch rb)
setTiedTos
public void setTiedTos(Vector v)
getTiedTos
public Vector getTiedTos()
getTiedTo
public String getTiedTo()
- Just a shortcut -- returns the first tied to in the tied to
list
get
public Object get(Object o)
getAgent
public Agent getAgent(Resource res)
getAgent
public Agent getAgent(String res)
getOnlyAgent
public Agent getOnlyAgent()
getNeed
public Need getNeed()
- Get the value of need.
- Returns:
- Value of need.
setNeed
public void setNeed(Need v)
- Set the value of need.
- Parameters:
v
- Value to assign to need.
toString
public String toString()
- Overrides:
- toString in class Object
dump
public void dump(PrintStream ps)
fixUp
public void fixUp(AgentAgent pop)
- This goes through and changes any AgentIDs to Agents, so things
like getOnlyAgent and whatnot don't cause class cast exceptions
by finding AgentIDs
When a managed agent, you should not need to make this call. Managed
Agent does it for you.
Resources marked as abstract do not get fixed up.