absurdist
Class Relation

java.lang.Object
  extended byabsurdist.Relation
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
RelationLink

public class Relation
extends java.lang.Object
implements java.io.Serializable

Class Relation Specifies the data structure for a relation, which contains its involved concepts and some features.

See Also:
Serialized Form

Field Summary
 java.util.Vector concepts
          Concepts involved in this relation.
 RelationModel model
          Relation model of this relation.
 double weight
          Strength measurement of this relation ( 0 < weight (quantitative) <= 1 ).
 
Constructor Summary
Relation()
          Creates an empty relation.
Relation(Relation relation)
          Creates a copy of a relation sharing the same concepts.
Relation(Relation relation, Concept c1, Concept c2)
          Creates a copy of a relation, using the specified concepts.
Relation(Relation relation, Concept c1, Concept c2, double noise)
          Creates a copy of a relation, using the specified concepts, with some noise.
Relation(RelationModel model, Concept c1, Concept c2)
          Creates a relation of the specified model with default weight between two concepts.
Relation(RelationModel model, Concept c1, Concept c2, boolean weighted)
          Creates a relation of the specified model with random weight if weighted between two concepts.
Relation(RelationModel model, Concept c1, Concept c2, double weight)
          Creates a relation with full features between two concepts.
 
Method Summary
 void addNoise(double noise)
          Adds some noise to the relation's weight.
 int compareTo(Relation relation)
          Compares the lexicographical order of this relation and the specified one, according to their label.
 double difWeight(Relation relation)
          Return the difference between the weight of this relation and the specified one.
 Concept getConcept1()
          Returns the 1st concept in the relation.
 Concept getConcept2()
          Returns the 2nd concept in the relation.
 java.lang.String getLabel()
          Returns the label of the relation.
 boolean isDirected()
          Checks whether this relation is directed.
 boolean isWeighted()
          Checks whether this relation is weighted.
 java.lang.String toString()
          Returns a string representation of this relation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

model

public RelationModel model
Relation model of this relation.


concepts

public java.util.Vector concepts
Concepts involved in this relation.


weight

public double weight
Strength measurement of this relation ( 0 < weight (quantitative) <= 1 ).

Constructor Detail

Relation

public Relation()
Creates an empty relation.


Relation

public Relation(RelationModel model,
                Concept c1,
                Concept c2)
Creates a relation of the specified model with default weight between two concepts.


Relation

public Relation(RelationModel model,
                Concept c1,
                Concept c2,
                boolean weighted)
Creates a relation of the specified model with random weight if weighted between two concepts.


Relation

public Relation(RelationModel model,
                Concept c1,
                Concept c2,
                double weight)
Creates a relation with full features between two concepts.


Relation

public Relation(Relation relation)
Creates a copy of a relation sharing the same concepts.


Relation

public Relation(Relation relation,
                Concept c1,
                Concept c2)
Creates a copy of a relation, using the specified concepts.


Relation

public Relation(Relation relation,
                Concept c1,
                Concept c2,
                double noise)
Creates a copy of a relation, using the specified concepts, with some noise.

Method Detail

addNoise

public void addNoise(double noise)
Adds some noise to the relation's weight.


getConcept1

public Concept getConcept1()
Returns the 1st concept in the relation.


getConcept2

public Concept getConcept2()
Returns the 2nd concept in the relation.


getLabel

public java.lang.String getLabel()
Returns the label of the relation.


isDirected

public boolean isDirected()
Checks whether this relation is directed.


isWeighted

public boolean isWeighted()
Checks whether this relation is weighted.


compareTo

public int compareTo(Relation relation)
Compares the lexicographical order of this relation and the specified one, according to their label.


difWeight

public double difWeight(Relation relation)
Return the difference between the weight of this relation and the specified one.


toString

public java.lang.String toString()
Returns a string representation of this relation.