Package dev.roanh.gmark.core.graph
Class Predicate
java.lang.Object
dev.roanh.gmark.core.graph.Predicate
- All Implemented Interfaces:
OutputXML
,IDable
,Comparable<Predicate>
Class describing predicates applied to graph
edges, also called symbols. These predicates
can also represent following an edge in its
inverse direction from target to source.
-
Field Summary
Modifier and TypeFieldDescriptionprivate String
The textual alias name of this predicate.private int
The unique ID of this predicate.private Predicate
The inverse predicate object ornull
.private boolean
True if this predicate represents the inverse of the original predicate, meaning it specifies that a directed edge should be followed in the reverse direction.private Double
Fraction of all edges in the graph that have this symbol. -
Constructor Summary
ModifierConstructorDescriptionConstructs a new predicate with the given ID and alias.Constructs a new predicate with the given ID and alias and graph proportion.private
Constructs an inverse predicate for the given predicate. -
Method Summary
Modifier and TypeMethodDescriptionint
boolean
getAlias()
Gets the textual representation for this symbol.int
getID()
Gets the unique ID for this object.Gets the inverse predicate for this predicate.int
hashCode()
boolean
True if this predicate represents the inverted form of the symbol (going from target to source).toString()
void
writeXML
(IndentWriter writer) Writes this object as XML to the given writer.
-
Field Details
-
id
private int idThe unique ID of this predicate. This ID uniquely identifies this predicate among all predicates. Note that the inverse predicate has the same ID. -
alias
The textual alias name of this predicate. -
proportion
Fraction of all edges in the graph that have this symbol. Will benull
if this is not specified. -
isInverse
private boolean isInverseTrue if this predicate represents the inverse of the original predicate, meaning it specifies that a directed edge should be followed in the reverse direction. -
inverse
The inverse predicate object ornull
.
-
-
Constructor Details
-
Predicate
Constructs a new predicate with the given ID and alias.- Parameters:
id
- The ID of this predicate.alias
- The alias of this predicate.
-
Predicate
Constructs a new predicate with the given ID and alias and graph proportion.- Parameters:
id
- The ID of this predicate.alias
- The alias of this predicate.proportion
- The fraction of all edges in the graph that have this symbol. Can be set tonull
to leave this unspecified.
-
Predicate
Constructs an inverse predicate for the given predicate.- Parameters:
predicate
- The predicate to invert.
-
-
Method Details
-
isInverse
public boolean isInverse()True if this predicate represents the inverted form of the symbol (going from target to source).- Returns:
- True if this is an inverse predicate.
-
getAlias
Gets the textual representation for this symbol. If this predicate is inverted then this will include a super script minus character at the end.- Returns:
- The predicate alias.
-
getInverse
Gets the inverse predicate for this predicate. The inverse predicate basically indicates traversing an edge with the predicate in the reverse direction from target to source and is indicated by a super script minus after the predicate symbol.- Returns:
- The inverse of this predicate.
-
getID
public int getID()Gets the unique ID for this object. This ID uniquely identifies all objects of this type.Uniquely identifies this predicate among all predicates. Note that the inverse predicate has the same ID.
-
toString
-
equals
-
hashCode
public int hashCode() -
writeXML
Description copied from interface:OutputXML
Writes this object as XML to the given writer. -
compareTo
- Specified by:
compareTo
in interfaceComparable<Predicate>
-