org.jungrapht.visualization.layout.algorithms.eiglsperger.Segment Maven / Gradle / Ivy
The newest version!
package org.jungrapht.visualization.layout.algorithms.eiglsperger;
import org.jungrapht.visualization.layout.util.synthetics.Synthetic;
/**
* A Segment<V> is a vertex in the sparse compaction graph and contains a {@code PVertex}
* (top) and {@code QVertex} (bottom).
* The {@code PVertex} is a {@code SyntheticSugiyamaVertex} that is the target of a synthetic edge
* from a real vertex source.
* The {@code QVertex} is a {@code SyntheticSugiyamaVertex} that is the source of a synthetic edge
* to a real vertex target.
* There is also {@code SegmentEdge} connecting the {@code PVertex} and {@code QVertex}.
* The SegmentEdge is added to the Graph<SugiyamaVertex<V>, SugiyamaEdge<V, E>>
* while the Segment<V> is added to the sparse compaction graph as a Vertex.
*
* @param
*/
class Segment extends SyntheticLV implements Synthetic {
public static Segment of(PVertex pVertex, QVertex qVertex) {
return new Segment<>(pVertex, qVertex);
}
/** */
protected final PVertex pVertex;
protected final QVertex qVertex;
int index;
int pVertexRank;
int qVertexRank;
String rangeString;
protected Segment(PVertex pVertex, QVertex qVertex) {
super();
this.pVertex = pVertex;
this.pVertexRank = pVertex.getRank();
this.qVertex = qVertex;
this.qVertexRank = qVertex.getRank();
rangeString = pVertexRank + "-to-" + qVertexRank;
}
@Override
public int getIndex() {
return index;
}
@Override
public void setIndex(int index) {
this.index = index;
}
public void initialize() {}
@Override
public boolean equals(Object o) {
return this == o;
}
@Override
public int hashCode() {
return System.identityHashCode(this);
}
@Override
public String toString() {
return "Segment{" + rangeString + "}";
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy