Class STNUEdgeInt
java.lang.Object
it.univr.di.cstnu.graph.AbstractComponent
it.univr.di.cstnu.graph.AbstractEdge
it.univr.di.cstnu.graph.STNEdgeInt
it.univr.di.cstnu.graph.STNUEdgeInt
- All Implemented Interfaces:
Component, Edge, STNEdge, STNUEdge, Serializable, Comparable<Component>
Implements
STNUEdge interface using signed integer values.- Version:
- $Rev: 1153 $
- Author:
- posenato
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface Edge
Edge.ConstraintTypeNested classes/interfaces inherited from interface STNEdge
STNEdge.EdgeValue<E>Modifier and TypeInterfaceDescriptionstatic interfaceSTNEdge.EdgeValue<E extends STNEdge>Functional interface to retrieve the edge value of interest.Nested classes/interfaces inherited from interface STNUEdge
STNUEdge.CaseLabelModifier and TypeInterfaceDescriptionstatic classA lower/upper-case label is represented as a pair: (node-name, flag). -
Field Summary
FieldsModifier and TypeFieldDescription(package private) STNUEdge.CaseLabelThe upper/lower case label.(package private) intThe labeled value associated with the edge when it is a contingent link or a wait constraint.static final longSerial numberFields inherited from class STNEdgeInt
valueFields inherited from class AbstractEdge
constraintTypeFields inherited from class AbstractComponent
name, pcsModifier and TypeFieldDescription(package private) StringPossible name(package private) PropertyChangeSupportSince Java 9, Observable has no longer been supported. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for STNUEdgeInt.STNUEdgeInt(Edge e) STNUEdgeInt(String n, int v) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear all components but the name.intbooleanbooleanisEmpty()booleanThis method is inappropriate here, but it helps to speed up the code.booleanThis method is inappropriate here, but it helps to speed up the code.FactorynewInstance(Edge edge) Any super-interfaces/implementing classes should ensure that such a method has the edge as an argument!newInstance(String name1) Factoryfinal intRemoves the labeled value and makes the edges an ordinary constraint if it was contingent.final intsetLabeledValue(ALabelAlphabet.ALetter nodeALetter, int w, boolean upperCase) Sets the labeled weight to w of aEdge.ConstraintType.contingentedge.voidA copy by reference of the internal structure of edge e.final StringtoString()Return a string representation of labeled values.booleanupdateValue(int v) If the edge is not a wait, it sets the ordinary value if v is smaller than the current one.Methods inherited from class STNEdgeInt
getValue, setValue, sizeMethods inherited from class AbstractEdge
getConstraintType, getRoute, isCSTNEdge, isCSTNPSUEdge, isCSTNUEdge, isOSTNUEdge, setConstraintType, setName, setRouteModifier and TypeMethodDescriptionfinal Edge.ConstraintTypefinal EdgeRoutegetRoute()booleanThis method is inappropriate here, but it helps to speed up the code.booleanThis method is inappropriate here, but it helps to speed up the code.booleanThis method is inappropriate here, but it helps to speed up the code.booleanThis method is inappropriate here, but it helps to speed up the code.final voidfinal StringSets the name of the edge.final voidSets the explicit routing of this edge, ornullto return the edge to automatic.Methods inherited from class AbstractComponent
addObserver, compareTo, equals, equalsByName, getName, hashCode, inNegativeCycle, isNameManagedByGraph, markNameManagedByGraph, removeObserver, renameInternal, setInNegativeCycle, takeInModifier and TypeMethodDescriptionfinal voidaddObserver(String propertyName, PropertyChangeListener l) An observer for the property.final intImplements the natural order of the component names.booleanDeprecated.final booleanA component is assumed to be equal to another if it has the same name.final StringgetName()final inthashCode()final boolean(package private) final boolean(package private) final voidfinal voidremoveObserver(String propertyName, PropertyChangeListener listener) Removes a specific listener(package private) final voidrenameInternal(String newName) Sets the name without validation or notification.final voidsetInNegativeCycle(boolean isInNegativeCycle) Sets true if the edge is in a negative cyclefinal voidMethods inherited from interface Edge
isContingentEdge, isRequirementEdgeModifier and TypeMethodDescriptiondefault booleandefault booleanMethods inherited from interface STNUEdge
getLabeledValueFormatted, isLowerCase, isOrdinaryEdge, isUpperCase, isWait, setLabeledValue, setWait, updateWaitModifier and TypeMethodDescriptiondefault StringRepresentation of the labeled value as a string.default booleandefault booleandefault booleandefault booleanisWait()default booleansetLabeledValue(String labeledValueAsString) Parses an upper/case labeled value to determine the new value for this edge.default booleansetWait(ALabelAlphabet.ALetter C, int w) Sets this edge to be the waitC:w.default booleanupdateWait(int waitValue, ALabelAlphabet.ALetter C) If the edge is a wait, it sets the wait value if v is smaller than the current wait value.
-
Field Details
-
serialVersionUID
public static final long serialVersionUIDSerial number- See Also:
-
labeledValue
int labeledValueThe labeled value associated with the edge when it is a contingent link or a wait constraint. Its value isConstants.INT_NULLwhen this edge is ordinary. -
caseLabel
STNUEdge.CaseLabel caseLabelThe upper/lower case label.The first component is the node label; the second specifies the nature: true for upper-case, false for lower-case.
-
-
Constructor Details
-
STNUEdgeInt
public STNUEdgeInt()Constructor for STNUEdgeInt. -
STNUEdgeInt
-
STNUEdgeInt
-
STNUEdgeInt
-
-
Method Details
-
clear
public void clear()Description copied from interface:ComponentClear all components but the name.- Specified by:
clearin interfaceComponent- Overrides:
clearin classSTNEdgeInt
-
getCaseLabel
- Specified by:
getCaseLabelin interfaceSTNUEdge- Returns:
- the node case label associated with this edge when it is a contingent or a wait one, null otherwise.
-
getLabeledValue
public int getLabeledValue()- Specified by:
getLabeledValuein interfaceSTNUEdge- Returns:
- the labeled weight if it is a contingent edge or a wait,
Constants.INT_NULLotherwise.
-
hasSameValues
- Specified by:
hasSameValuesin interfaceEdge- Overrides:
hasSameValuesin classSTNEdgeInt- Parameters:
e- the other edge- Returns:
- true if it has the same values.
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceEdge- Overrides:
isEmptyin classSTNEdgeInt- Returns:
- true if it does not contain any values
-
isSTNEdge
public boolean isSTNEdge()Description copied from interface:EdgeThis method is inappropriate here, but it helps to speed up the code.- Specified by:
isSTNEdgein interfaceEdge- Overrides:
isSTNEdgein classSTNEdgeInt- Returns:
- true if the edge is an STN edge
-
isSTNUEdge
public boolean isSTNUEdge()Description copied from interface:EdgeThis method is inappropriate here, but it helps to speed up the code.- Specified by:
isSTNUEdgein interfaceEdge- Overrides:
isSTNUEdgein classAbstractEdge- Returns:
- true if the edge is an STNU edge
-
newInstance
Description copied from interface:EdgeFactory- Specified by:
newInstancein interfaceEdge- Overrides:
newInstancein classSTNEdgeInt- Returns:
- an object of type Edge.
-
newInstance
Description copied from interface:EdgeAny super-interfaces/implementing classes should ensure that such a method has the edge as an argument!- Specified by:
newInstancein interfaceEdge- Overrides:
newInstancein classSTNEdgeInt- Parameters:
edge- an object to clone.- Returns:
- an object of type Edge.
-
newInstance
Description copied from interface:EdgeFactory- Specified by:
newInstancein interfaceEdge- Overrides:
newInstancein classSTNEdgeInt- Parameters:
name1- of the edge- Returns:
- an object of type Edge.
-
resetLabeledValue
public final int resetLabeledValue()Removes the labeled value and makes the edges an ordinary constraint if it was contingent.- Specified by:
resetLabeledValuein interfaceSTNUEdge- Returns:
- the old labeled value.
-
setLabeledValue
Description copied from interface:STNUEdgeSets the labeled weight to w of aEdge.ConstraintType.contingentedge. If nodeLabel == null or w =Constants.INT_NULL, the possible labeled value is removed.If a wait must be set, use
STNUEdge.updateWait(int, ALetter).- Specified by:
setLabeledValuein interfaceSTNUEdge- Parameters:
nodeALetter- the name of the contingent node as ALetter.w- the new weight valueupperCase- true if the edge is an upper-case edge, false it is a lower-case edge. In the case of lower-case edge, w must be positive.- Returns:
- the old weight associated with the edge. If the weight was not set, it returns
Constants.INT_NULL.
-
takeIn
-
toString
Description copied from class:AbstractComponentReturn a string representation of labeled values.- Specified by:
toStringin interfaceComponent- Overrides:
toStringin classSTNEdgeInt- Returns:
- string representation of the edge
-
updateValue
public boolean updateValue(int v) If the edge is not a wait, it sets the ordinary value if v is smaller than the current one. If the edge is a wait, it sets the ordinary value if v is negative. Moreover, if v is smaller (i.e., stronger) than the wait value, the wait is removed.- Specified by:
updateValuein interfaceSTNEdge- Overrides:
updateValuein classSTNEdgeInt- Parameters:
v- the new weight value- Returns:
- true if the update occurred, false otherwise;
-