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.
 
Constructor Summary
Tuple()
           
Tuple(AgentID owner)
           
Tuple(AgentID owner, Vector elements)
           
Tuple(AgentID owner, Vector elements, float weight)
           
Tuple(Vector elements)
           
 
Method Summary
 Tuple add(Tuple otherTuple)
           
 void addElement(Object element)
           
 Iterator elements()
           
 boolean equals(Object o)
          Decides if some other object is equal to this.
 Vector flatten()
           
 AgentID owner()
           
 void removeElement(Object element)
           
 void setOwner(AgentID newOwner)
           
 void setWeight(float weight)
           
 float weight()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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
Constructor Detail

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)
Method Detail

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