|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnz.ac.waikato.mcennis.rat.graph.model.ModelShell
nz.ac.waikato.mcennis.rat.graph.link.DBLink
public class DBLink
Class that implemnts a link backed by a DerbyDB database. Fixes problems of inconsistencies between the database and the in-memory data when using BasicUserLink class.
Field Summary |
---|
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, RELATION, SOURCE, STRENGTH |
Constructor Summary | |
---|---|
DBLink()
Creates a new instance of DerbyActor |
Method Summary | |
---|---|
void |
add(Property prop)
Add the given property to this link |
protected int |
compareProperties(Link right)
Compare properties of this actor with the given actor. |
int |
compareTo(java.lang.Object o)
Throws ClassCastException when the parameter is not an Link. |
protected int |
getActorID(Actor u)
Get thye numerical ID that uniquely describes this Actor in the database |
Actor |
getDestination()
Returns the actor where the link (edge, arc) terminates. |
java.util.List<Property> |
getProperty()
Return all properties associated with this link. |
Property |
getProperty(java.lang.String ID)
Get the property with the given name. |
java.lang.String |
getRelation()
Returns the type (relation) of the link. |
Actor |
getSource()
Returns the actor from which the link (edge, arc) begins. |
double |
getStrength()
return the strength of this link. |
static void |
init()
static initialization method that sets up the global connection objects. |
void |
init(Properties properties)
|
static boolean |
isInitialized()
Has this object been Initialized yet. |
DBLink |
prototype()
|
void |
publishChange(Model m,
int type,
int argument)
Saves to database the changes in a property. |
void |
removeProperty(java.lang.String ID)
|
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. |
static void |
setDatabase(java.lang.String db)
Set which database to access |
void |
setDestination(Actor u)
Sets the destination of this link. |
static void |
setDirectory(java.lang.String dir)
Set the location of the Derby database directory |
void |
setRelation(java.lang.String type)
Sets the type (relation) of the link. |
void |
setSource(Actor u)
Sets the source of this link. |
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 |
Constructor Detail |
---|
public DBLink()
Method Detail |
---|
public static void init()
public static boolean isInitialized()
public java.util.List<Property> getProperty()
Link
getProperty
in interface Link
public Property getProperty(java.lang.String ID)
Link
getProperty
in interface Link
ID
- id of the property to be returned
public void removeProperty(java.lang.String ID)
removeProperty
in interface Link
public void add(Property prop)
Link
add
in interface Link
public void setRelation(java.lang.String type)
Link
setRelation
in interface Link
type
- string describing the typepublic java.lang.String getRelation()
Link
getRelation
in interface Link
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
protected int compareProperties(Link right)
right
- actor to be compared against
public static void setDirectory(java.lang.String dir)
dir
- directory where thye datbases are storedpublic static void setDatabase(java.lang.String db)
db
- name of the datbase to openpublic void publishChange(Model m, int type, int argument)
publishChange
in interface Listener
m
- Property that changedtype
- currently only 0 (Changed) is firedpublic double getStrength()
Link
getStrength
in interface Link
public Actor getSource()
Link
getSource
in interface Link
public Actor getDestination()
Link
getDestination
in interface Link
public void set(Actor l, double strength, Actor r)
Link
set
in interface Link
l
- source actorstrength
- strength of this lengthr
- destination actorpublic void setSource(Actor u)
Link
setSource
in interface Link
u
- actor sourcepublic void setDestination(Actor u)
Link
setDestination
in interface Link
u
- destination actor.public void set(double str)
Link
set
in interface Link
str
- sterngth of this link.protected int getActorID(Actor u)
public DBLink prototype()
prototype
in interface Link
public void init(Properties properties)
init
in interface Link
|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |