nz.ac.waikato.mcennis.rat.graph
Class UserList

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

public class UserList
extends ModelShell
implements Graph

Aquires a list of all actors that have been seen. All other operations are no-ops. FIXME: Specific to "User" actor type (mode).

See Also:
Serialized Form

Field Summary
static long serialVersionUID
           
 
Fields inherited from class nz.ac.waikato.mcennis.rat.graph.model.ModelShell
listener
 
Constructor Summary
UserList()
          Creates a new instance of UserList
 
Method Summary
 void add(Actor u)
          Add a user to the graph.
 void add(Graph g)
          Add a graph (g) to the graph.
 void add(Link link)
          Adds a userlink to the graph.
 void add(PathSet pathSet)
          Add a PathSet to this graph.
 void add(Property prop)
          Add a property to this graph.
 void addChild(Graph g)
          Set the given graph to be a child of the current graph.
 void anonymize()
          Replaces all actor IDs with an anonymous numeric ID.
 void close()
          Close database connections or write to file.
 void commit()
          Commit the contents to database or storage.
 int compareTo(java.lang.Object o)
           
 java.util.List<Actor> getActor()
          Retrieve an array of all actors of all types.
 java.util.List<Actor> getActor(java.lang.String type)
          Retrieve an array of all actors of a given type.
 Actor getActor(java.lang.String type, java.lang.String ID)
          Retrieve the users that has the given ID.
 int getActorCount(java.lang.String mode)
          Returns the number of actors of the given type
 java.util.Iterator<Actor> getActorIterator()
           
 java.util.Iterator<Actor> getActorIterator(java.lang.String type)
          Create a read only iterator over all actors.
 java.util.List<java.lang.String> getActorTypes()
          List all types - returns null if no actors exist.
 java.util.List<Graph> getChildren()
          Returns the children graphs of this object or null if none exist
 Graph getChildren(java.lang.String id)
          Returns the children graph with the given id or null if there is not a child with that name.
 java.util.Iterator<Graph> getChildrenIterator()
           
 java.lang.String getID()
          Return the ID associated with this Graph
 java.util.List<Link> getLink()
          Return all user to user links in this graph in an array.
 java.util.List<Link> getLink(java.lang.String type)
          Retrieve an array of all userlinks of the given type from this graph or null if no such links are in this graph.
 java.util.List<Link> getLink(java.lang.String type, Actor sourceActor, Actor destActor)
          Returns all links of the given type (relation) type going from actor sourceActor to actor destActor or null.
 java.util.Iterator<Link> getLinkByDesinationIterator(java.lang.String type, Actor destActor)
           
 java.util.List<Link> getLinkByDestination(java.lang.String type, Actor destActor)
          Returns all links (edges, arcs) of type (relation) type that point to the given actor.
 java.util.List<Link> getLinkBySource(java.lang.String type, Actor sourceActor)
          Returns all links (edges, arcs) of type (relation) type that go from the given actor to any destination.
 java.util.Iterator<Link> getLinkBySourceIterator(java.lang.String type, Actor sourceActor)
           
 java.util.Iterator<Link> getLinkIterator()
           
 java.util.Iterator<Link> getLinkIterator(java.lang.String type)
           
 java.util.Iterator<Link> getLinkIterator(java.lang.String type, Actor sourceActor, Actor destActor)
           
 java.util.List<java.lang.String> getLinkTypes()
          Returns all link types currently in this graph or null if no links are present.
 Properties getParameter()
          Obtain a computer-readable description of the parameters and options this graph supports
 Parameter getParameter(java.lang.String name)
           
 Graph getParent()
          Returns the parent graph of this object or null if this is a root graph
 java.util.List<PathSet> getPathSet()
          Return all PathSets associated with this graph.
 PathSet getPathSet(java.lang.String id)
          Return the named PathSet.
 java.util.Iterator<PathSet> getPathSetIterator()
           
 java.util.List<Property> getProperty()
          Returns an array of all properties associated with this object or null if none exist
 Property getProperty(java.lang.String type)
          Return a property named by the given string or null if no property by this name exists
 java.util.Iterator<Property> getPropertyIterator()
           
 void init(Properties props)
          Set the parameters of this graph from the following property object.
 Graph prototype()
           
 void remove(Actor u)
          Identifies the given user and removes it and all links involving it from the graph.
 void remove(Link ul)
          remove all user links with the same type, user ID, and artist ID from the graph
 void removeProperty(java.lang.String ID)
           
 void setID(java.lang.String id)
          Set this graph's ID to this value.
 
Methods inherited from class nz.ac.waikato.mcennis.rat.graph.model.ModelShell
addListener, fireChange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface nz.ac.waikato.mcennis.rat.graph.model.Model
addListener
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

UserList

public UserList()
Creates a new instance of UserList

Method Detail

getActor

public java.util.List<Actor> getActor()
Description copied from interface: Graph
Retrieve an array of all actors of all types. Returns null if no actors are in the graph.

Specified by:
getActor in interface Graph
Returns:
array of all users in the graph

getActor

public Actor getActor(java.lang.String type,
                      java.lang.String ID)
Description copied from interface: Graph
Retrieve the users that has the given ID. Returns null if no user is in the graph with that ID.

Specified by:
getActor in interface Graph
ID - ID string identifying an user
Returns:
user object who has this ID or null if it is not present

add

public void add(Actor u)
Description copied from interface: Graph
Add a user to the graph. This replaces the user if a user with the same ID already exists.

Specified by:
add in interface Graph
Parameters:
u - user to be included in the graph.

add

public void add(Link link)
Description copied from interface: Graph
Adds a userlink to the graph. There is no limit on the number of links between users or even with the same type, source user, and destination user.

Specified by:
add in interface Graph
Parameters:
link - description of a named link between two users

getLink

public java.util.List<Link> getLink()
Description copied from interface: Graph
Return all user to user links in this graph in an array. Returns null if no such user link exists.

Specified by:
getLink in interface Graph
Returns:
array of all userlinks or null

getLink

public java.util.List<Link> getLink(java.lang.String type)
Description copied from interface: Graph
Retrieve an array of all userlinks of the given type from this graph or null if no such links are in this graph.

Specified by:
getLink in interface Graph
Returns:
array of all user links of a given type or null

remove

public void remove(Actor u)
Description copied from interface: Graph
Identifies the given user and removes it and all links involving it from the graph.

Specified by:
remove in interface Graph
Parameters:
u - user to be removed from the graph.

remove

public void remove(Link ul)
Description copied from interface: Graph
remove all user links with the same type, user ID, and artist ID from the graph

Specified by:
remove in interface Graph
Parameters:
ul - link to be removed from the graph.

add

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

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

getProperty

public java.util.List<Property> getProperty()
Description copied from interface: Graph
Returns an array of all properties associated with this object or null if none exist

Specified by:
getProperty in interface Graph
Returns:
Array of properties

getProperty

public Property getProperty(java.lang.String type)
Description copied from interface: Graph
Return a property named by the given string or null if no property by this name exists

Specified by:
getProperty in interface Graph
Parameters:
type - property's name
Returns:
Given property

getActor

public java.util.List<Actor> getActor(java.lang.String type)
Description copied from interface: Graph
Retrieve an array of all actors of a given type. Returns null if there are no actors of that type in the graph.

Specified by:
getActor in interface Graph
Parameters:
type - class of actor to return
Returns:
array of actors of the given type

getPathSet

public java.util.List<PathSet> getPathSet()
Description copied from interface: Graph
Return all PathSets associated with this graph. Null if no PathSets are in the current graph.

Specified by:
getPathSet in interface Graph
Returns:
Array of PathSets

getPathSet

public PathSet getPathSet(java.lang.String id)
Description copied from interface: Graph
Return the named PathSet. Returns null if no PathSet of the given ID exists.

Specified by:
getPathSet in interface Graph
Parameters:
id - ID of the PathSet to return
Returns:
PathSet specified by this ID

add

public void add(PathSet pathSet)
Description copied from interface: Graph
Add a PathSet to this graph. If another PathSet of the same ID exists, it will be overwritten.

Specified by:
add in interface Graph
Parameters:
pathSet - PathSet to be added to this graph

getLinkTypes

public java.util.List<java.lang.String> getLinkTypes()
Description copied from interface: Graph
Returns all link types currently in this graph or null if no links are present.

Specified by:
getLinkTypes in interface Graph
Returns:
array of link types

getLinkBySource

public java.util.List<Link> getLinkBySource(java.lang.String type,
                                            Actor sourceActor)
Description copied from interface: Graph
Returns all links (edges, arcs) of type (relation) type that go from the given actor to any destination. Returns null if no such links exist.

Specified by:
getLinkBySource in interface Graph
Parameters:
type - type (relation) of link to return
sourceActor - starting point of the link
Returns:
Array of links or null

getLinkByDestination

public java.util.List<Link> getLinkByDestination(java.lang.String type,
                                                 Actor destActor)
Description copied from interface: Graph
Returns all links (edges, arcs) of type (relation) type that point to the given actor. Returns null if no such links exist

Specified by:
getLinkByDestination in interface Graph
Parameters:
type - type (relation) of link to return
destActor - actor pointed to by links
Returns:
Array of links or null

getLink

public java.util.List<Link> getLink(java.lang.String type,
                                    Actor sourceActor,
                                    Actor destActor)
Description copied from interface: Graph
Returns all links of the given type (relation) type going from actor sourceActor to actor destActor or null. This is typically 1 link or null, but the spec does not forbid multiple links of the same type (relation) between two actors.

Specified by:
getLink in interface Graph
Parameters:
type - type (relation) of the link to return
sourceActor - starting point of the link
destActor - actor pointed to by links
Returns:
Array of links or null

getActorTypes

public java.util.List<java.lang.String> getActorTypes()
Description copied from interface: Graph
List all types - returns null if no actors exist.

Specified by:
getActorTypes in interface Graph
Returns:
array of all type names in this graph

getActorIterator

public java.util.Iterator<Actor> getActorIterator(java.lang.String type)
Description copied from interface: Graph
Create a read only iterator over all actors.

Specified by:
getActorIterator in interface Graph
Parameters:
type - type (mode) of actor to return
Returns:
iterator over all actors of the given type

setID

public void setID(java.lang.String id)
Description copied from interface: Graph
Set this graph's ID to this value. Graph ID's must be unique.

Specified by:
setID in interface Graph
Parameters:
id - graph ID

getID

public java.lang.String getID()
Description copied from interface: Graph
Return the ID associated with this Graph

Specified by:
getID in interface Graph
Returns:
ID

commit

public void commit()
Description copied from interface: Graph
Commit the contents to database or storage. This is a null operation for memory only objects. (Delaying committing changes to be in batches can result in a massive decrease in execution time.)

Specified by:
commit in interface Graph

add

public void add(Graph g)
Description copied from interface: Graph
Add a graph (g) to the graph. Will be changed to be a graph helper - deprecated by addChild(Graph g)

Specified by:
add in interface Graph
Parameters:
g - graph to be added

close

public void close()
Description copied from interface: Graph
Close database connections or write to file. Operations on a graph after close are undefined.

Specified by:
close in interface Graph

anonymize

public void anonymize()
Description copied from interface: Graph
Replaces all actor IDs with an anonymous numeric ID.

Specified by:
anonymize in interface Graph

getParent

public Graph getParent()
Description copied from interface: Graph
Returns the parent graph of this object or null if this is a root graph

Specified by:
getParent in interface Graph
Returns:
parent graph

getChildren

public java.util.List<Graph> getChildren()
Description copied from interface: Graph
Returns the children graphs of this object or null if none exist

Specified by:
getChildren in interface Graph
Returns:
Array of graphs that are children of this graph

getChildren

public Graph getChildren(java.lang.String id)
Description copied from interface: Graph
Returns the children graph with the given id or null if there is not a child with that name.

Specified by:
getChildren in interface Graph
Parameters:
id - ID of the graph to return
Returns:
Graph with the given ID

addChild

public void addChild(Graph g)
Description copied from interface: Graph
Set the given graph to be a child of the current graph. NOTE: this does not verify that all actors and links only reference actors or links in the parent - this is the responsibility of the caller.

Specified by:
addChild in interface Graph
Parameters:
g - Child Graph

getParameter

public Properties getParameter()
Description copied from interface: Graph
Obtain a computer-readable description of the parameters and options this graph supports

Specified by:
getParameter in interface Graph
Returns:
Description of all parameters this graph object supports.

init

public void init(Properties props)
Description copied from interface: Graph
Set the parameters of this graph from the following property object.

Specified by:
init in interface Graph
Parameters:
props - properties to be set

getActorCount

public int getActorCount(java.lang.String mode)
Description copied from interface: Graph
Returns the number of actors of the given type

Specified by:
getActorCount in interface Graph
Parameters:
mode - type of actor to query
Returns:
int number of actors of the given type

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

prototype

public Graph prototype()
Specified by:
prototype in interface Graph

getActorIterator

public java.util.Iterator<Actor> getActorIterator()
Specified by:
getActorIterator in interface Graph

getLinkIterator

public java.util.Iterator<Link> getLinkIterator()
Specified by:
getLinkIterator in interface Graph

getLinkIterator

public java.util.Iterator<Link> getLinkIterator(java.lang.String type)
Specified by:
getLinkIterator in interface Graph

getLinkBySourceIterator

public java.util.Iterator<Link> getLinkBySourceIterator(java.lang.String type,
                                                        Actor sourceActor)
Specified by:
getLinkBySourceIterator in interface Graph

getLinkByDesinationIterator

public java.util.Iterator<Link> getLinkByDesinationIterator(java.lang.String type,
                                                            Actor destActor)
Specified by:
getLinkByDesinationIterator in interface Graph

getLinkIterator

public java.util.Iterator<Link> getLinkIterator(java.lang.String type,
                                                Actor sourceActor,
                                                Actor destActor)
Specified by:
getLinkIterator in interface Graph

getPropertyIterator

public java.util.Iterator<Property> getPropertyIterator()
Specified by:
getPropertyIterator in interface Graph

getPathSetIterator

public java.util.Iterator<PathSet> getPathSetIterator()
Specified by:
getPathSetIterator in interface Graph

getChildrenIterator

public java.util.Iterator<Graph> getChildrenIterator()
Specified by:
getChildrenIterator in interface Graph

getParameter

public Parameter getParameter(java.lang.String name)
Specified by:
getParameter in interface Graph

removeProperty

public void removeProperty(java.lang.String ID)
Specified by:
removeProperty in interface Graph

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