nz.ac.waikato.mcennis.rat.graph.link
Class BasicUserLink

java.lang.Object
  extended by nz.ac.waikato.mcennis.rat.graph.model.ModelShell
      extended by nz.ac.waikato.mcennis.rat.graph.link.BasicUserLink
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable, Link, Model

public class BasicUserLink
extends ModelShell
implements Link

Class providing a base implementation of the Link Interface

See Also:
Serialized Form

Field Summary
static long serialVersionUID
           
 
Fields inherited from class nz.ac.waikato.mcennis.rat.graph.model.ModelShell
listener
 
Fields inherited from interface nz.ac.waikato.mcennis.rat.graph.link.Link
ALL, DESTINATION, SOURCE, STRENGTH, TYPE
 
Constructor Summary
BasicUserLink()
          Creates a generic link with no source, destination, and a strength of -1.0.
BasicUserLink(Actor source, double strength, Actor destination)
          Creates a new instance of BasicLink in a self-consistent state
 
Method Summary
 void add(Property prop)
          Add the given property to this link
 int compareTo(java.lang.Object o)
           
 boolean equals(java.lang.Object obj)
           
 Actor getDestination()
          Returns the actor where the link (edge, arc) terminates.
 Property[] getProperty()
          Return all properties associated with this link.
 Property getProperty(java.lang.String id)
          Get the property with the given name.
 Actor getSource()
          Returns the actor from which the link (edge, arc) begins.
 double getStrength()
          return the strength of this link.
 java.lang.String getType()
          Returns the type (relation) of the link.
 void set(Actor l, double strength, Actor r)
          sets all aspects of the link at once
 void set(double str)
          Sets the strength that this link has.
 void setDestination(Actor u)
          Sets the destination of this link.
 void setSource(Actor u)
          Sets the source of this link.
 void setType(java.lang.String t)
          Sets the type (relation) of the link.
 
Methods inherited from class nz.ac.waikato.mcennis.rat.graph.model.ModelShell
addListener, fireChange
 
Methods inherited from class java.lang.Object
clone, 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

BasicUserLink

public BasicUserLink()
Creates a generic link with no source, destination, and a strength of -1.0. Note that this state is invalid and must be altered before it can be used.


BasicUserLink

public BasicUserLink(Actor source,
                     double strength,
                     Actor destination)
Creates a new instance of BasicLink in a self-consistent state

Parameters:
source - source actor - may not be null
strength - link strength
destination - destination actor - may not be null
Method Detail

getStrength

public double getStrength()
Description copied from interface: Link
return the strength of this link. This can be positive or negative or non-numeric values such as NaN, -Infinity, or Inifinity for links where only the existance of the link is important.

Specified by:
getStrength in interface Link
Returns:
strength of the link

getSource

public Actor getSource()
Description copied from interface: Link
Returns the actor from which the link (edge, arc) begins.

Specified by:
getSource in interface Link
Returns:
source actor

getDestination

public Actor getDestination()
Description copied from interface: Link
Returns the actor where the link (edge, arc) terminates.

Specified by:
getDestination in interface Link
Returns:
destination actor

set

public void set(Actor l,
                double strength,
                Actor r)
Description copied from interface: Link
sets all aspects of the link at once

Specified by:
set in interface Link
Parameters:
l - source actor
strength - strength of this length
r - destination actor

getType

public java.lang.String getType()
Description copied from interface: Link
Returns the type (relation) of the link.

Specified by:
getType in interface Link
Returns:
typer (relation) of this link.

setType

public void setType(java.lang.String t)
Description copied from interface: Link
Sets the type (relation) of the link.

Specified by:
setType in interface Link
Parameters:
t - string describing the type

setSource

public void setSource(Actor u)
Description copied from interface: Link
Sets the source of this link. This may not be null.

Specified by:
setSource in interface Link
Parameters:
u - actor source

setDestination

public void setDestination(Actor u)
Description copied from interface: Link
Sets the destination of this link. This may not be null.

Specified by:
setDestination in interface Link
Parameters:
u - destination actor.

set

public void set(double str)
Description copied from interface: Link
Sets the strength that this link has. This may be a non-numeric value.

Specified by:
set in interface Link
Parameters:
str - sterngth of this link.

compareTo

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

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

add

public void add(Property prop)
Description copied from interface: Link
Add the given property to this link

Specified by:
add in interface Link

getProperty

public Property getProperty(java.lang.String id)
Description copied from interface: Link
Get the property with the given name. Returns null if no property with that id exists.

Specified by:
getProperty in interface Link
Parameters:
id - id of the property to be returned
Returns:
property with the given id

getProperty

public Property[] getProperty()
Description copied from interface: Link
Return all properties associated with this link. Returns null if no properties are associated with this link.

Specified by:
getProperty in interface Link
Returns:
array of properties associated with this object.