org.pandora.knowledge
Class BasicRelationship

java.lang.Object
  extended by org.pandora.knowledge.BasicRelationship
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Relationship>, Relationship

public class BasicRelationship
extends java.lang.Object
implements Relationship, java.lang.Comparable<Relationship>, java.io.Serializable

Meta reference. Basic implementation to allow subclasses to avoid defining some of the basic stuff.

See Also:
Serialized Form

Constructor Summary
BasicRelationship()
           
BasicRelationship(Vertex source, Vertex type, Vertex target)
           
 
Method Summary
 int compareTo(Relationship another)
          Compare the relationships by index, to allow sorting.
 void decrementConsciousnessLevel()
          Decrease the vertices's level of consciousness.
 void decrementConsciousnessLevel(int amount)
          Decrease the vertices's level of consciousness by the amount.
 boolean equals(java.lang.Object another)
           
 int getAccessCount()
          Return the number of times the vertex has been accessed.
 java.util.Calendar getAccessDate()
          Return the date the vertex was last accessed.
 int getConsciousnessLevel()
          Return the vertices's level of consciousness.
 float getCorrectness()
          Return the fuzzy value of the certainty of the relationship's correctness.
 java.util.Calendar getCreationDate()
          Return the date the vertex was created.
 java.lang.Number getId()
           
 int getIndex()
          Return the index of the relationships in the source's relationships of that type.
 Vertex getSource()
           
 Vertex getTarget()
           
 Vertex getType()
           
 int hashCode()
           
 boolean hasIndex()
          Return if the relationship has an index (preset order).
 void incrementAccessCount()
          Record that the vertex was accessed, update the access time and increment the access count.
 void incrementConsciousnessLevel()
          Increase the vertices's level of consciousness.
 void incrementConsciousnessLevel(int amount)
          Increase the vertices's level of consciousness by the amount.
 boolean isInverse()
          Return if the relationship is inverse, i.e.
 boolean isPinned()
          Return if the vertex is pinned to memory, and will not be forgotten.
 void setAccessCount(int accessCount)
          Set the number of times the vertex has been accessed.
 void setAccessDate(java.util.Calendar accessDate)
          Set the date the vertex was last accessed.
 void setAccessDate(java.util.Date accessDate)
          Set the date the vertex was last accessed.
 void setConsciousnessLevel(int consciousnessLevel)
          Set the vertices's level of consciousness.
 void setCorrectness(float correctness)
          Set the fuzzy value of the certainty of the relationship's correctness.
 void setCreationDate(java.util.Calendar creationDate)
          Set the date the vertex was created.
 void setCreationDate(java.util.Date creationDate)
          Set the date the vertex was created.
 void setId(java.lang.Number id)
          Set the relationship id.
 void setIndex(int index)
          Set the index of the relationships in the source's relationships of that type.
 void setPinned(boolean pinned)
          Set if the vertex should be pinned to memory.
 void setSource(Vertex source)
           
 void setTarget(Vertex target)
           
 void setType(Vertex type)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicRelationship

public BasicRelationship()

BasicRelationship

public BasicRelationship(Vertex source,
                         Vertex type,
                         Vertex target)
Method Detail

getId

public java.lang.Number getId()

setId

public void setId(java.lang.Number id)
Set the relationship id. The id can only be set when loading or creating a relationship.


equals

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

compareTo

public int compareTo(Relationship another)
Compare the relationships by index, to allow sorting.

Specified by:
compareTo in interface java.lang.Comparable<Relationship>

getCorrectness

public float getCorrectness()
Return the fuzzy value of the certainty of the relationship's correctness. Values are between 0 and 1.

Specified by:
getCorrectness in interface Relationship

setCorrectness

public void setCorrectness(float correctness)
Set the fuzzy value of the certainty of the relationship's correctness. Values are between 0 and 1.

Specified by:
setCorrectness in interface Relationship

isInverse

public boolean isInverse()
Return if the relationship is inverse, i.e. know to not exist.

Specified by:
isInverse in interface Relationship

getIndex

public int getIndex()
Return the index of the relationships in the source's relationships of that type.

Specified by:
getIndex in interface Relationship

setIndex

public void setIndex(int index)
Set the index of the relationships in the source's relationships of that type.

Specified by:
setIndex in interface Relationship

hasIndex

public boolean hasIndex()
Return if the relationship has an index (preset order).

Specified by:
hasIndex in interface Relationship

getType

public Vertex getType()
Specified by:
getType in interface Relationship

getSource

public Vertex getSource()
Specified by:
getSource in interface Relationship

getTarget

public Vertex getTarget()
Specified by:
getTarget in interface Relationship

hashCode

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

setSource

public void setSource(Vertex source)
Specified by:
setSource in interface Relationship

setTarget

public void setTarget(Vertex target)
Specified by:
setTarget in interface Relationship

setType

public void setType(Vertex type)
Specified by:
setType in interface Relationship

isPinned

public boolean isPinned()
Return if the vertex is pinned to memory, and will not be forgotten.

Specified by:
isPinned in interface Relationship

setPinned

public void setPinned(boolean pinned)
Set if the vertex should be pinned to memory. Pinned vertices will not be forgotten.

Specified by:
setPinned in interface Relationship

getCreationDate

public java.util.Calendar getCreationDate()
Return the date the vertex was created.

Specified by:
getCreationDate in interface Relationship

setCreationDate

public void setCreationDate(java.util.Calendar creationDate)
Set the date the vertex was created.

Specified by:
setCreationDate in interface Relationship

setCreationDate

public void setCreationDate(java.util.Date creationDate)
Set the date the vertex was created.

Specified by:
setCreationDate in interface Relationship

getAccessDate

public java.util.Calendar getAccessDate()
Return the date the vertex was last accessed.

Specified by:
getAccessDate in interface Relationship

setAccessDate

public void setAccessDate(java.util.Calendar accessDate)
Set the date the vertex was last accessed. Access is considered moving from long term to short term memory.

Specified by:
setAccessDate in interface Relationship

setAccessDate

public void setAccessDate(java.util.Date accessDate)
Set the date the vertex was last accessed. Access is considered moving from long term to short term memory.

Specified by:
setAccessDate in interface Relationship

getAccessCount

public int getAccessCount()
Return the number of times the vertex has been accessed. Access is considered moving from long term to short term memory.

Specified by:
getAccessCount in interface Relationship

setAccessCount

public void setAccessCount(int accessCount)
Set the number of times the vertex has been accessed.

Specified by:
setAccessCount in interface Relationship

incrementAccessCount

public void incrementAccessCount()
Record that the vertex was accessed, update the access time and increment the access count.

Specified by:
incrementAccessCount in interface Relationship

incrementConsciousnessLevel

public void incrementConsciousnessLevel()
Increase the vertices's level of consciousness.

Specified by:
incrementConsciousnessLevel in interface Relationship

decrementConsciousnessLevel

public void decrementConsciousnessLevel()
Decrease the vertices's level of consciousness.

Specified by:
decrementConsciousnessLevel in interface Relationship

decrementConsciousnessLevel

public void decrementConsciousnessLevel(int amount)
Decrease the vertices's level of consciousness by the amount.

Specified by:
decrementConsciousnessLevel in interface Relationship

incrementConsciousnessLevel

public void incrementConsciousnessLevel(int amount)
Increase the vertices's level of consciousness by the amount.

Specified by:
incrementConsciousnessLevel in interface Relationship

getConsciousnessLevel

public int getConsciousnessLevel()
Return the vertices's level of consciousness.

Specified by:
getConsciousnessLevel in interface Relationship

setConsciousnessLevel

public void setConsciousnessLevel(int consciousnessLevel)
Set the vertices's level of consciousness.

Specified by:
setConsciousnessLevel in interface Relationship

toString

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