nz.ac.waikato.mcennis.rat.graph.actor
Class BasicUser

java.lang.Object
  extended by nz.ac.waikato.mcennis.rat.graph.model.ModelShell
      extended by nz.ac.waikato.mcennis.rat.graph.actor.BasicUser
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable, Actor, Model, ParsedObject

public class BasicUser
extends ModelShell
implements Actor

See Also:
Serialized Form

Field Summary
 
Fields inherited from class nz.ac.waikato.mcennis.rat.graph.model.ModelShell
listener
 
Constructor Summary
BasicUser(java.lang.String ID)
          Creates a new instance of BasicUser
 
Method Summary
 void add(Property prop)
          Add the given property to this user.
protected  int compareProperties(Actor right)
          Compare properties of this actor with the given actor.
 int compareTo(java.lang.Object o)
          Throws ClassCastException when the parameter is not an Actor.
 boolean equals(java.lang.Object obj)
          implements equals in terms of CompareTo
 java.lang.String getID()
          Return the id (unique within its type)
 java.lang.String getMode()
          Returns the type (mode) of this actor
 java.util.List<Property> getProperty()
          Return an array of all properties associated with this actor.
 Property getProperty(java.lang.String ID)
          Return the property with the given value.
 int hashCode()
           
 void init(Properties properties)
           
 Actor prototype()
          Return a copy of this Actor that is equal by compareTo()
 void removeProperty(java.lang.String ID)
          Remove a given property from this actor
 void setID(java.lang.String id)
          Sets an id unique (which must be its type).
 void setMode(java.lang.String type)
          Set the type (mode) of this actor.
 java.lang.String toString()
           
 
Methods inherited from class nz.ac.waikato.mcennis.rat.graph.model.ModelShell
addListener, fireChange
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicUser

public BasicUser(java.lang.String ID)
Creates a new instance of BasicUser

Method Detail

getID

public java.lang.String getID()
Description copied from interface: Actor
Return the id (unique within its type)

Specified by:
getID in interface Actor
Returns:
ID of this actor

getProperty

public java.util.List<Property> getProperty()
Description copied from interface: Actor
Return an array of all properties associated with this actor. Returns null if no properties are attached.

Specified by:
getProperty in interface Actor
Returns:
array of properties

getProperty

public Property getProperty(java.lang.String ID)
Description copied from interface: Actor
Return the property with the given value. Returns null if no properties are attached.

Specified by:
getProperty in interface Actor
Parameters:
ID - key-name for the property.
Returns:
Property object having this key or null

removeProperty

public void removeProperty(java.lang.String ID)
Description copied from interface: Actor
Remove a given property from this actor

Specified by:
removeProperty in interface Actor
Parameters:
ID - key-name of property to remove.

add

public void add(Property prop)
Description copied from interface: Actor
Add the given property to this user. If a property with this name already exists, it is replaced by this property.

Specified by:
add in interface Actor
Parameters:
prop - property to be added

setMode

public void setMode(java.lang.String type)
Description copied from interface: Actor
Set the type (mode) of this actor. User ID's must be unique within a type.

Specified by:
setMode in interface Actor
Parameters:
type - new type (mode) of this actor

getMode

public java.lang.String getMode()
Description copied from interface: Actor
Returns the type (mode) of this actor

Specified by:
getMode in interface Actor
Returns:
type (mode) of this actor

compareTo

public int compareTo(java.lang.Object o)
Throws ClassCastException when the parameter is not an Actor. Comparisons are:
  1. String compareTo on type (mode)
  2. String compareTo on ID
  3. Property comparison: return compareTo on the first pair of properties that do not return 0
  4. Page comparison: return compareTo on the first pair of pages that do not return 0
  5. return 0

Specified by:
compareTo in interface java.lang.Comparable

compareProperties

protected int compareProperties(Actor right)
Compare properties of this actor with the given actor. Sort the property arrays and compare sequentially, returning the first non-zero value or returning zero if all properties are equal.

Parameters:
right - actor to be compared against
Returns:
compareTo over all properties

equals

public boolean equals(java.lang.Object obj)
implements equals in terms of CompareTo

Specified by:
equals in interface Actor
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

setID

public void setID(java.lang.String id)
Description copied from interface: Actor
Sets an id unique (which must be its type).

Specified by:
setID in interface Actor
Parameters:
id - ID this actor should be set to

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

prototype

public Actor prototype()
Description copied from interface: Actor
Return a copy of this Actor that is equal by compareTo()

Specified by:
prototype in interface Actor
Returns:
new duplicate Actor

init

public void init(Properties properties)
Specified by:
init in interface Actor

Get Relational Analysis Toolkit at SourceForge.net. Fast, secure and Free Open Source software downloads