Search this API

y.layout.router.polyline
Class PenaltySettings

java.lang.Object
  extended by y.layout.router.polyline.PenaltySettings

public class PenaltySettings
extends Object

Provides the cost penalties that are applied for violating restrictions during a path search.

The PathSearch calculates the 'shortest' path from a source to a target at which 'shortest' path means the path with the lowest costs. Costs results from violations of restrictions that are defined by the different PathSearchExtensions. This class defines penalties for the various violations. The path search can be adapted to specific needs by varying these penalties. In order to avoid a certain violation, the appropriate penalty must be increased.


Constructor Summary
protected PenaltySettings()
          Creates a new instance.
 
Method Summary
 PenaltySettings createCopy()
          Creates a copy of this instance.
 int getBendPenalty()
          Returns the penalty for an edge bend.
 int getBendsInNodeToEdgeDistancePenalty()
          Returns the penalty for an edge bend being closer to the border of the source node, the target node or one of their ancestor group nodes then the minimal node to edge distance.
 int getEdgeCrossingPenalty()
          Returns the penalty for a crossing of two edges.
 int getEdgeLabelCrossingPenalty()
          Returns the penalty that an edge crosses a label of an edge that is not routed.
 int getGroupNodeCrossingPenalty()
          Returns the penalty that an edge crosses a group node.
 int getInvalidEdgeGroupingPenalty()
          Returns the penalty for an edge that is not grouped at source or target side.
 int getMinimalEdgeToEdgeDistancePenalty()
          Returns the penalty for violation the minimal distance between any two edges.
 int getMinimalFirstLastSegmentLengthPenalty()
          Returns the penalty for violation the minimal length of the first and last segment of an edge.
 int getMinimalGroupNodeToEdgeDistancePenalty()
          Returns the penalty for violation the minimal distance between any edge and any group node side.
 int getMinimalNodeCornerDistancePenalty()
          Returns the penalty for violation the minimal distance the edge shall keep from node corners when entering or leaving the node.
 int getMinimalNodeToEdgeDistancePenalty()
          Returns the penalty for violation the minimal distance between any edge and any non-group node side.
 int getMonotonyViolationPenalty()
          Returns the penalty for violation the monotonic path restrictions of an edge.
 int getNodeCrossingPenalty()
          Returns the penalty that an edge crosses a non-group node.
 int getNodeLabelCrossingPenalty()
          Returns the penalty that an edge crosses a node label.
 int getPartitionGridCellReentrancePenalty()
          Returns the penalty for leaving and reentering an edge in the same partition grid cell.
 int getPortViolationPenalty()
          Returns the penalty if an edge does not comply with its PortCandidates or PortConstraints.
protected  PenaltySettings newInstance()
          Factory method, which is used by createCopy().
 void setBendPenalty(int penalty)
          Sets the penalty for an edge bend.
 void setBendsInNodeToEdgeDistancePenalty(int penalty)
          Sets the penalty for an edge bend being closer to the border of the source node, the target node or one of their ancestor group nodes then the minimal node to edge distance.
 void setEdgeCrossingPenalty(int penalty)
          Sets the penalty for a crossing of two edges.
 void setEdgeLabelCrossingPenalty(int penalty)
          Sets the penalty that an edge crosses a label of an edge that is not routed.
 void setGroupNodeCrossingPenalty(int penalty)
          Sets the penalty that an edge crosses a group node.
 void setInvalidEdgeGroupingPenalty(int penalty)
          Sets the penalty for an edge that is not grouped at source or target side.
 void setMinimalEdgeToEdgeDistancePenalty(int penalty)
          Sets the penalty for violation the minimal distance between any two edges.
 void setMinimalFirstLastSegmentLengthPenalty(int penalty)
          Sets the penalty for violation the minimal length of the first and last segment of an edge.
 void setMinimalGroupNodeToEdgeDistancePenalty(int penalty)
          Sets the penalty for violation the minimal distance between any edge and any group node side.
 void setMinimalNodeCornerDistancePenalty(int penalty)
          Sets the penalty for violation the minimal distance the edge shall keep from node corners when entering or leaving the node.
 void setMinimalNodeToEdgeDistancePenalty(int penalty)
          Sets the penalty for violation the minimal distance between any edge and any non-group node side.
 void setMonotonyViolationPenalty(int penalty)
          Sets the penalty for violation the monotonic path restrictions of an edge.
 void setNodeCrossingPenalty(int penalty)
          Sets the penalty that an edge crosses a non-group node.
 void setNodeLabelCrossingPenalty(int penalty)
          Sets the penalty that an edge crosses a node label.
 void setPartitionGridCellReentrancePenalty(int penalty)
          Sets the penalty for leaving and reentering an edge in the same partition grid cell.
 void setPortViolationPenalty(int penalty)
          Sets the penalty if an edge does not comply with its PortCandidates or PortConstraints.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PenaltySettings

protected PenaltySettings()
Creates a new instance.

Method Detail

getBendPenalty

public int getBendPenalty()
Returns the penalty for an edge bend.

Returns:
the penalty

setBendPenalty

public void setBendPenalty(int penalty)
Sets the penalty for an edge bend. By default this value is set to 3. The value must be >= 0, otherwise the default value will be assigned.

Parameters:
penalty - the penalty

getEdgeCrossingPenalty

public int getEdgeCrossingPenalty()
Returns the penalty for a crossing of two edges.

Returns:
the penalty

setEdgeCrossingPenalty

public void setEdgeCrossingPenalty(int penalty)
Sets the penalty for a crossing of two edges. By default this value is set to 1. The value must be >= 0, otherwise the default value will be assigned.

Parameters:
penalty - the penalty

getNodeCrossingPenalty

public int getNodeCrossingPenalty()
Returns the penalty that an edge crosses a non-group node.

Returns:
the penalty

setNodeCrossingPenalty

public void setNodeCrossingPenalty(int penalty)
Sets the penalty that an edge crosses a non-group node. By default this value is set to 30. The value must be >= 0, otherwise the default value will be assigned.

Parameters:
penalty - the penalty

getGroupNodeCrossingPenalty

public int getGroupNodeCrossingPenalty()
Returns the penalty that an edge crosses a group node.

Returns:
the penalty

setGroupNodeCrossingPenalty

public void setGroupNodeCrossingPenalty(int penalty)
Sets the penalty that an edge crosses a group node. By default this value is set to 20. The value must be >= 0, otherwise the default value will be assigned.

Parameters:
penalty - the penalty

getNodeLabelCrossingPenalty

public int getNodeLabelCrossingPenalty()
Returns the penalty that an edge crosses a node label. Use EdgeRouter.setConsiderNodeLabelsEnabled(boolean) to set whether node labels should be considered when routing the edges.

Returns:
the penalty
See Also:
EdgeRouter.setConsiderNodeLabelsEnabled(boolean)

setNodeLabelCrossingPenalty

public void setNodeLabelCrossingPenalty(int penalty)
Sets the penalty that an edge crosses a node label. Use EdgeRouter.setConsiderNodeLabelsEnabled(boolean) to set whether node labels should be considered when routing the edges. By default this value is set to 13. The value must be >= 0, otherwise the default value will be assigned.

Parameters:
penalty - the penalty
See Also:
EdgeRouter.setConsiderNodeLabelsEnabled(boolean)

getEdgeLabelCrossingPenalty

public int getEdgeLabelCrossingPenalty()
Returns the penalty that an edge crosses a label of an edge that is not routed. Use EdgeRouter.setConsiderEdgeLabelsEnabled(boolean) to set whether edge labels should be considered when routing the edges.

Returns:
the penalty
See Also:
EdgeRouter.setConsiderEdgeLabelsEnabled(boolean)

setEdgeLabelCrossingPenalty

public void setEdgeLabelCrossingPenalty(int penalty)
Sets the penalty that an edge crosses a label of an edge that is not routed. Use EdgeRouter.setConsiderEdgeLabelsEnabled(boolean) to set whether edge labels should be considered when routing the edges. By default this value is set to 13. The value must be >= 0, otherwise the default value will be assigned.

Parameters:
penalty - the penalty
See Also:
EdgeRouter.setConsiderNodeLabelsEnabled(boolean)

getMinimalNodeToEdgeDistancePenalty

public int getMinimalNodeToEdgeDistancePenalty()
Returns the penalty for violation the minimal distance between any edge and any non-group node side. Use EdgeRouter.setMinimalNodeToEdgeDistance(double) to set the minimal distance.

Returns:
the penalty
See Also:
EdgeRouter.setMinimalNodeToEdgeDistance(double)

setMinimalNodeToEdgeDistancePenalty

public void setMinimalNodeToEdgeDistancePenalty(int penalty)
Sets the penalty for violation the minimal distance between any edge and any non-group node side. Use EdgeRouter.setMinimalNodeToEdgeDistance(double) to set the minimal distance. By default this value is set to 7. The value must be >= 0, otherwise the default value will be assigned.

Parameters:
penalty - the penalty
See Also:
EdgeRouter.setMinimalNodeToEdgeDistance(double)

getMinimalGroupNodeToEdgeDistancePenalty

public int getMinimalGroupNodeToEdgeDistancePenalty()
Returns the penalty for violation the minimal distance between any edge and any group node side. Use EdgeRouter.setMinimalNodeToEdgeDistance(double) to set the minimal distance.

Returns:
the penalty
See Also:
EdgeRouter.setMinimalNodeToEdgeDistance(double)

setMinimalGroupNodeToEdgeDistancePenalty

public void setMinimalGroupNodeToEdgeDistancePenalty(int penalty)
Sets the penalty for violation the minimal distance between any edge and any group node side. Use EdgeRouter.setMinimalNodeToEdgeDistance(double) to set the minimal distance. By default this value is set to 7. The value must be >= 0, otherwise the default value will be assigned.

Parameters:
penalty - the penalty
See Also:
EdgeRouter.setMinimalNodeToEdgeDistance(double)

getMinimalEdgeToEdgeDistancePenalty

public int getMinimalEdgeToEdgeDistancePenalty()
Returns the penalty for violation the minimal distance between any two edges. Use EdgeLayoutDescriptor.setMinimalEdgeToEdgeDistance(double) to set the minimal distance for a certain edge to any other edge.

Returns:
the penalty
See Also:
EdgeLayoutDescriptor.setMinimalEdgeToEdgeDistance(double)

setMinimalEdgeToEdgeDistancePenalty

public void setMinimalEdgeToEdgeDistancePenalty(int penalty)
Sets the penalty for violation the minimal distance between any two edges. Use EdgeLayoutDescriptor.setMinimalEdgeToEdgeDistance(double) to set the minimal distance for a certain edge to any other edge. By default this value is set to 5. The value must be >= 0, otherwise the default value will be assigned.

Parameters:
penalty - the penalty
See Also:
EdgeLayoutDescriptor.setMinimalEdgeToEdgeDistance(double)

getMinimalNodeCornerDistancePenalty

public int getMinimalNodeCornerDistancePenalty()
Returns the penalty for violation the minimal distance the edge shall keep from node corners when entering or leaving the node. Use EdgeLayoutDescriptor.setMinimalNodeCornerDistance(double) to set the minimal distance for a certain edge.

Returns:
the penalty
See Also:
EdgeLayoutDescriptor.setMinimalNodeCornerDistance(double)

setMinimalNodeCornerDistancePenalty

public void setMinimalNodeCornerDistancePenalty(int penalty)
Sets the penalty for violation the minimal distance the edge shall keep from node corners when entering or leaving the node. Use EdgeLayoutDescriptor.setMinimalNodeCornerDistance(double) to set the minimal distance for a certain edge. By default this value is set to 6. The value must be >= 0, otherwise the default value will be assigned.

Parameters:
penalty - the penalty
See Also:
EdgeLayoutDescriptor.setMinimalNodeCornerDistance(double)

getMinimalFirstLastSegmentLengthPenalty

public int getMinimalFirstLastSegmentLengthPenalty()
Returns the penalty for violation the minimal length of the first and last segment of an edge. Use EdgeLayoutDescriptor.setMinimalFirstSegmentLength(double) to set the minimal length of the first segment and EdgeLayoutDescriptor.setMinimalLastSegmentLength(double) to set the minimal length of the last segment of a certain edge.

Returns:
the penalty
See Also:
EdgeLayoutDescriptor.setMinimalFirstSegmentLength(double), EdgeLayoutDescriptor.setMinimalLastSegmentLength(double)

setMinimalFirstLastSegmentLengthPenalty

public void setMinimalFirstLastSegmentLengthPenalty(int penalty)
Sets the penalty for violation the minimal length of the first and last segment of an edge. Use EdgeLayoutDescriptor.setMinimalFirstSegmentLength(double) to set the minimal length of the first segment and EdgeLayoutDescriptor.setMinimalLastSegmentLength(double) to set the minimal length of the last segment of a certain edge. By default this value is set to 8. The value must be >= 0, otherwise the default value will be assigned.

Parameters:
penalty - the penalty
See Also:
EdgeLayoutDescriptor.setMinimalFirstSegmentLength(double), EdgeLayoutDescriptor.setMinimalLastSegmentLength(double)

getBendsInNodeToEdgeDistancePenalty

public int getBendsInNodeToEdgeDistancePenalty()
Returns the penalty for an edge bend being closer to the border of the source node, the target node or one of their ancestor group nodes then the minimal node to edge distance.

Returns:
the penalty
See Also:
EdgeRouter.setMinimalNodeToEdgeDistance(double)

setBendsInNodeToEdgeDistancePenalty

public void setBendsInNodeToEdgeDistancePenalty(int penalty)
Sets the penalty for an edge bend being closer to the border of the source node, the target node or one of their ancestor group nodes then the minimal node to edge distance. By default this value is set to 6. The value must be >= 0, otherwise the default value will be assigned.

Parameters:
penalty - the penalty
See Also:
EdgeRouter.setMinimalNodeToEdgeDistance(double)

getMonotonyViolationPenalty

public int getMonotonyViolationPenalty()
Returns the penalty for violation the monotonic path restrictions of an edge. Use EdgeLayoutDescriptor.setMonotonicPathRestriction(byte) to set the monotonic path restrictions of a certain edge.

Returns:
the penalty
See Also:
EdgeLayoutDescriptor.setMonotonicPathRestriction(byte)

setMonotonyViolationPenalty

public void setMonotonyViolationPenalty(int penalty)
Sets the penalty for violation the monotonic path restrictions of an edge. Use EdgeLayoutDescriptor.setMonotonicPathRestriction(byte) to set the monotonic path restrictions of a certain edge. By default this value is set to 14. The value must be >= 0, otherwise the default value will be assigned.

Parameters:
penalty - the penalty
See Also:
EdgeLayoutDescriptor.setMonotonicPathRestriction(byte)

getPartitionGridCellReentrancePenalty

public int getPartitionGridCellReentrancePenalty()
Returns the penalty for leaving and reentering an edge in the same partition grid cell.

Returns:
the penalty

setPartitionGridCellReentrancePenalty

public void setPartitionGridCellReentrancePenalty(int penalty)
Sets the penalty for leaving and reentering an edge in the same partition grid cell. By default this value is set to 7. The value must be >= 0, otherwise the default value will be assigned.

Parameters:
penalty - the penalty

getPortViolationPenalty

public int getPortViolationPenalty()
Returns the penalty if an edge does not comply with its PortCandidates or PortConstraints.

Returns:
the penalty
See Also:
PortCandidate, PortConstraint

setPortViolationPenalty

public void setPortViolationPenalty(int penalty)
Sets the penalty if an edge does not comply with its PortCandidates or PortConstraints. By default this value is set to 115. The value must be >= 0, otherwise the default value will be assigned.

Parameters:
penalty - the penalty
See Also:
PortCandidate, PortConstraint

getInvalidEdgeGroupingPenalty

public int getInvalidEdgeGroupingPenalty()
Returns the penalty for an edge that is not grouped at source or target side. Grouped edges have the same source or target group id assigned in the data provider registered at the graph with the PortConstraintKeys.SOURCE_GROUPID_KEY or PortConstraintKeys.TARGET_GROUPID_KEY key.

Returns:
the penalty
See Also:
PortConstraintKeys.SOURCE_GROUPID_KEY, PortConstraintKeys.TARGET_GROUPID_KEY

setInvalidEdgeGroupingPenalty

public void setInvalidEdgeGroupingPenalty(int penalty)
Sets the penalty for an edge that is not grouped at source or target side. Grouped edges have the same source or target group id assigned in the data provider registered at the graph with the PortConstraintKeys.SOURCE_GROUPID_KEY or PortConstraintKeys.TARGET_GROUPID_KEY key. By default this value is set to 25. The value must be >= 0, otherwise the default value will be assigned.

Parameters:
penalty - the penalty
See Also:
PortConstraintKeys.SOURCE_GROUPID_KEY, PortConstraintKeys.TARGET_GROUPID_KEY

createCopy

public PenaltySettings createCopy()
Creates a copy of this instance. Uses newInstance() to get a new instance.

Returns:
a copy of this instance

newInstance

protected PenaltySettings newInstance()
Factory method, which is used by createCopy(). Subclasses can override this method in order to return a more specialized version.

Returns:
a specialized PenaltySettings

© Copyright 2000-2013,
yWorks GmbH.
All rights reserved.