Package dev.roanh.cpqindex
Class Pair
java.lang.Object
dev.roanh.cpqindex.Pair
- All Implemented Interfaces:
Comparable<Pair>
Represents a pair of two vertices, also referred to as a
path or an st-pair.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionPair
(int src, int trg) Constructs a new pair with the given source and target vertex.Pair
(DataInputStream in) Reads a pair from the given input stream. -
Method Summary
Modifier and TypeMethodDescriptionint
boolean
int
Get the source vertex of this pair.int
Gets the target vertex of this pair.int
hashCode()
boolean
isLoop()
Checks if this pair represents a loop, that is, if the source and target vertex are equivalent.toString()
void
write
(DataOutputStream out) Write a pair to the given input stream.
-
Field Details
-
src
private final int srcThe source vertex. -
trg
private final int trgThe target vertex.
-
-
Constructor Details
-
Pair
public Pair(int src, int trg) Constructs a new pair with the given source and target vertex.- Parameters:
src
- The source vertex.trg
- The target vertex.
-
Pair
Reads a pair from the given input stream.- Parameters:
in
- The stream to read from.- Throws:
IOException
- When an IOException occurs.
-
-
Method Details
-
write
Write a pair to the given input stream.- Parameters:
out
- The stream to write from.- Throws:
IOException
- When an IOException occurs.
-
getSource
public int getSource()Get the source vertex of this pair.- Returns:
- The source vertex of this pair.
-
getTarget
public int getTarget()Gets the target vertex of this pair.- Returns:
- The target vertex of thsi pair.
-
isLoop
public boolean isLoop()Checks if this pair represents a loop, that is, if the source and target vertex are equivalent.- Returns:
- True if this pair represents a loop.
-
equals
-
hashCode
public int hashCode() -
toString
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Pair>
-