Package it.univr.di.cstnu.graph
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: 993 $
- Author:
- posenato
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface it.univr.di.cstnu.graph.Edge
Edge.ConstraintTypeNested classes/interfaces inherited from interface it.univr.di.cstnu.graph.STNEdge
STNEdge.EdgeValue<E extends STNEdge>Nested classes/interfaces inherited from interface it.univr.di.cstnu.graph.STNUEdge
STNUEdge.CaseLabel -
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 it.univr.di.cstnu.graph.STNEdgeInt
valueFields inherited from class it.univr.di.cstnu.graph.AbstractEdge
constraintTypeFields inherited from class it.univr.di.cstnu.graph.AbstractComponent
name, pcs -
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) FactoryintRemoves the labeled value and makes the edges an ordinary constraint if it was contingent.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.toString()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 it.univr.di.cstnu.graph.STNEdgeInt
getValue, setValue, sizeMethods inherited from class it.univr.di.cstnu.graph.AbstractEdge
getConstraintType, isCSTNEdge, isCSTNPSUEdge, isCSTNUEdge, isOSTNUEdge, setConstraintType, setNameMethods inherited from class it.univr.di.cstnu.graph.AbstractComponent
addObserver, compareTo, equals, equalsByName, getName, hashCode, inNegativeCycle, removeObserver, setInNegativeCycle, takeInMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface it.univr.di.cstnu.graph.Component
equals, equalsByName, getName, hashCode, inNegativeCycle, setInNegativeCycle, setNameMethods inherited from interface it.univr.di.cstnu.graph.Edge
getConstraintType, isContingentEdge, isCSTNEdge, isCSTNPSUEdge, isCSTNUEdge, isOSTNUEdge, isRequirementEdge, setConstraintType, sizeMethods inherited from interface it.univr.di.cstnu.graph.STNUEdge
getLabeledValueFormatted, isLowerCase, isOrdinaryEdge, isUpperCase, isWait, setLabeledValue, updateWait
-
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
-
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 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.
-
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;
-
takeIn
Description copied from interface:EdgeA copy by reference of the internal structure of edge e.- Specified by:
takeInin interfaceEdge- Overrides:
takeInin classSTNEdgeInt- Parameters:
e- edge to clone. If null, it does nothing.
-
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
-