|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.hierarchic.incremental.AbstractPortConstraintOptimizer y.layout.hierarchic.incremental.PCListOptimizer
public class PCListOptimizer
This class is an implementation of the PortConstraintOptimizer
interface that tries to assign the edges of
the graph to ports
considering the specified PortCandidate
s.
Instances of this class can be set using property
HierarchicLayouter.setPortConstraintOptimizer(PortConstraintOptimizer)
.
This implementation will query for DataProvider
s registered with the graph with keys
PortCandidate.SOURCE_PCLIST_DPKEY
, PortCandidate.TARGET_PCLIST_DPKEY
and PortCandidateSet.NODE_DP_KEY
.
It will try to assign each edge one of the matching PortCandidate
s without
introducing too many crossings and without violating the cost
or
capacity
constraints.
PortCandidate.getCost()
,
PortCandidateSet.getEntries()
,
PortCandidateSet.getConnectionCount()
Nested Class Summary |
---|
Nested classes/interfaces inherited from class y.layout.hierarchic.incremental.AbstractPortConstraintOptimizer |
---|
AbstractPortConstraintOptimizer.SameLayerData |
Constructor Summary | |
---|---|
PCListOptimizer()
Creates a new instance of PCListOptimizer with the default settings. |
Method Summary | |
---|---|
double |
getBackloopPenalty()
Returns the penalty cost associated with each back-loop. |
double |
getCrossingPenalty()
Returns the penalty cost associated with a crossing that would occur if a given combination of PortCandidate s
would be chosen. |
double |
getOverUsagePenalty()
Returns the penalty cost associated with each edge being assigned to a port which has already reached its capacity . |
protected DataProvider |
getPortCandidateSetDataProvider(LayoutGraph graph)
Returns the data provider that provides the port candidate sets for nodes. |
protected AbstractPortConstraintOptimizer.SameLayerData |
insertSameLayerStructures(LayoutGraph graph,
Layers layers,
LayoutDataProvider ldp,
ItemFactory itemFactory)
Inserts a same-layer edge structure for each same-layer edge of the original graph. |
boolean |
isDeterministic()
Returns whether or not this implementation uses a deterministic algorithm to assign the PortCandidate s. |
void |
optimizeAfterLayering(LayoutGraph graph,
Layers layers,
LayoutDataProvider ldp,
ItemFactory itemFactory)
Assigns new temporary port constraints after the nodes have been assigned to layers. |
void |
optimizeAfterSequencing(LayoutGraph graph,
Layers layers,
LayoutDataProvider ldp,
ItemFactory itemFactory)
Assigns new temporary port constraints after the order of the nodes in each layer has been determined. |
protected void |
optimizeAfterSequencing(Node node,
java.util.Comparator inEdgeOrder,
java.util.Comparator outEdgeOrder,
LayoutGraph graph,
LayoutDataProvider ldp,
ItemFactory itemFactory)
Assigns new temporary port constraints to a given node of the graph after the order of the nodes in each layer has been determined. |
void |
setBackloopPenalty(double backloopPenalty)
Specifies the penalty cost associated with each back-loop. |
void |
setCrossingPenalty(double crossingPenalty)
Specifies the penalty cost associated with a crossing that would occur if a given combination of PortCandidate s
would be chosen. |
void |
setDeterministic(boolean deterministic)
Specifies whether this implementation should use a deterministic algorithm to assign the PortCandidate s. |
void |
setOverUsagePenalty(double overUsagePenalty)
Specifies the penalty cost associated with each edge being assigned to a port which has already reached its capacity . |
Methods inherited from class y.layout.hierarchic.incremental.AbstractPortConstraintOptimizer |
---|
getLayoutOrientation, getMirrorMask, optimizeAfterSequencing, removeSameLayerStructures, setLayoutOrientation, setMirrorMask |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PCListOptimizer()
PCListOptimizer
with the default settings.
Method Detail |
---|
public boolean isDeterministic()
PortCandidate
s.
true
if a deterministic algorithm should be applied, false
otherwisesetDeterministic(boolean)
public void setDeterministic(boolean deterministic)
PortCandidate
s.
deterministic
- true
if a deterministic algorithm should be applied, false
otherwisepublic double getBackloopPenalty()
Values should be non-negative.
setBackloopPenalty(double)
public void setBackloopPenalty(double backloopPenalty)
Values should be non-negative.
backloopPenalty
- the penalty for a back-loop
java.lang.IllegalArgumentException
- if the penalty cost is negativepublic double getCrossingPenalty()
PortCandidate
s
would be chosen.
Values should be non-negative.
setCrossingPenalty(double)
public void setCrossingPenalty(double crossingPenalty)
PortCandidate
s
would be chosen.
Values should be non-negative.
crossingPenalty
- the penalty for a produced edge ctossing
java.lang.IllegalArgumentException
- if the crossing penalty is negativepublic double getOverUsagePenalty()
capacity
.
Values should be non-negative.
PortCandidate
ssetOverUsagePenalty(double)
,
PortCandidateSet.Entry.getConnections()
public void setOverUsagePenalty(double overUsagePenalty)
capacity
.
Values should be non-negative.
overUsagePenalty
- the penalty for over-saturated PortCandidate
s
java.lang.IllegalArgumentException
- if the penalty cost is negativePortCandidateSet.Entry.getConnections()
public void optimizeAfterLayering(LayoutGraph graph, Layers layers, LayoutDataProvider ldp, ItemFactory itemFactory)
AbstractPortConstraintOptimizer
More precisely, it is called after the layering information has been determined. In this phase, it is possible to create back-loops by assigning incoming edges to the south (i.e. bottom) side or outgoing edges to the north (i.e. top) side, respectively.
optimizeAfterLayering
in interface PortConstraintOptimizer
optimizeAfterLayering
in class AbstractPortConstraintOptimizer
graph
- the input graphlayers
- the given Layers
instance holding the layering informationldp
- the LayoutDataProvider
implementation which provides access to the NodeData
and
EdgeData
instancesitemFactory
- the factory
that sets the temporary port constraintsItemFactory.setTemporaryPortConstraint(y.base.Edge, boolean, y.layout.PortConstraint)
protected AbstractPortConstraintOptimizer.SameLayerData insertSameLayerStructures(LayoutGraph graph, Layers layers, LayoutDataProvider ldp, ItemFactory itemFactory)
AbstractPortConstraintOptimizer
insertSameLayerStructures
in class AbstractPortConstraintOptimizer
graph
- the input graphlayers
- the given Layers
instance holding the layering informationldp
- the LayoutDataProvider
implementation which provides access to the NodeData
and
EdgeData
instancesitemFactory
- the factory
that sets the temporary port constraintsItemFactory.setTemporaryPortConstraint(y.base.Edge, boolean, y.layout.PortConstraint)
protected DataProvider getPortCandidateSetDataProvider(LayoutGraph graph)
graph
- The graph that stores the data providerpublic void optimizeAfterSequencing(LayoutGraph graph, Layers layers, LayoutDataProvider ldp, ItemFactory itemFactory)
AbstractPortConstraintOptimizer
More precisely, it is called after the sequence of the nodes has been determined. It
inserts the same-layer structures
, invokes
the hook
in which the custom port assignment should be done, and finally
restores the original state
of the layout graph by removing the temporary edges.
optimizeAfterSequencing
in interface PortConstraintOptimizer
optimizeAfterSequencing
in class AbstractPortConstraintOptimizer
graph
- the input graphlayers
- the given Layers
instance holding the layering informationldp
- the LayoutDataProvider
implementation which provides access to the NodeData
and
EdgeData
instancesitemFactory
- the factory
that sets the temporary port constraintsAbstractPortConstraintOptimizer.insertSameLayerStructures(LayoutGraph, Layers, LayoutDataProvider, ItemFactory)
,
AbstractPortConstraintOptimizer.optimizeAfterSequencing(y.layout.LayoutGraph, Layers, LayoutDataProvider, ItemFactory)
,
AbstractPortConstraintOptimizer.removeSameLayerStructures(y.layout.hierarchic.incremental.AbstractPortConstraintOptimizer.SameLayerData, y.layout.LayoutGraph, y.layout.hierarchic.incremental.LayoutDataProvider, y.layout.hierarchic.incremental.ItemFactory)
protected void optimizeAfterSequencing(Node node, java.util.Comparator inEdgeOrder, java.util.Comparator outEdgeOrder, LayoutGraph graph, LayoutDataProvider ldp, ItemFactory itemFactory)
AbstractPortConstraintOptimizer
More precisely, it is called after the sequence of the nodes has been determined.
Incoming and outgoing edges are sorted using Comparators.PartialOrder
instances which define the preferred ordering of the incoming
and outgoing edges from left to right. To sort collections according to a Comparators.PartialOrder
instance, an
appropriate method like Comparators.sort(java.util.List, java.util.Comparator)
or YList.sort(java.util.Comparator)
must be used.
optimizeAfterSequencing
in class AbstractPortConstraintOptimizer
node
- the original node to set temporary port constraintsinEdgeOrder
- a given Comparators.PartialOrder
instance for incoming edgesoutEdgeOrder
- a given Comparators.PartialOrder
instance for outgoing edgesgraph
- the input graphldp
- the LayoutDataProvider
implementation which provides access to the NodeData
and
EdgeData
instancesitemFactory
- the factory
that sets the temporary port constraintsAbstractPortConstraintOptimizer.optimizeAfterSequencing(y.layout.LayoutGraph, Layers, LayoutDataProvider, ItemFactory)
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |