agentland.drug
Class Tuple
java.lang.Object
|
+--agentland.drug.Tuple
- public class Tuple
- extends Object
Field Summary |
protected Vector |
elements
|
protected AgentID |
owner
Here we have a class intended for use by the new and improved drug dealing system. |
owner
protected AgentID owner
- Here we have a class intended for use by the new and improved drug dealing system.
A tuple consists of an owner (the agentID of a dealer the tuple represents drugs
for), and one or more elements that are either drugs or other tuples.
elements
protected Vector elements
Tuple
public Tuple()
Tuple
public Tuple(AgentID owner)
Tuple
public Tuple(Vector elements)
Tuple
public Tuple(AgentID owner,
Vector elements)
Tuple
public Tuple(AgentID owner,
Vector elements,
float weight)
setOwner
public void setOwner(AgentID newOwner)
addElement
public void addElement(Object element)
throws ClassCastException
removeElement
public void removeElement(Object element)
setWeight
public void setWeight(float weight)
owner
public AgentID owner()
elements
public Iterator elements()
weight
public float weight()
add
public Tuple add(Tuple otherTuple)
flatten
public Vector flatten()
equals
public boolean equals(Object o)
- Decides if some other object is equal to this. For two Tuples to be
equivalent, they need to have the same contents, not neccessarily the
same owner or weight.
- Overrides:
- equals in class Object