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<Object>
Implements
STNUEdge
interface using signed integer values.- Version:
- $Rev: 906 $
- Author:
- posenato
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface it.univr.di.cstnu.graph.Edge
Edge.ConstraintType
Nested classes/interfaces inherited from interface it.univr.di.cstnu.graph.STNUEdge
STNUEdge.CaseLabel
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) STNUEdge.CaseLabel
The upper/lower case label.(package private) int
The labeled value associated to the edge when it is a contingent link or a wait constraint.static final long
Serial numberFields inherited from class it.univr.di.cstnu.graph.STNEdgeInt
value
Fields inherited from class it.univr.di.cstnu.graph.AbstractEdge
constraintType
Fields 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 TypeMethodDescriptionvoid
clear()
Clear all component but name.int
boolean
boolean
isEmpty()
boolean
This method is inappropriate here, but it helps to speed up the code.boolean
This method is inappropriate here, but it helps to speed up the code.FactorynewInstance
(Edge edge) Any super-interfaces/implementing classes should assure that such method has edge as argument!newInstance
(String name1) Factoryint
Removes the labeled value and make the edges an ordinary constraint if it was contingent.int
setLabeledValue
(ALabelAlphabet.ALetter nodeALetter, int w, boolean upperCase) Sets the labeled weight to w of aEdge.ConstraintType.contingent
edge.void
A copy by reference of internal structure of edge e.toString()
Return a string representation of labeled values.boolean
updateValue
(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, size
Methods inherited from class it.univr.di.cstnu.graph.AbstractEdge
getConstraintType, isCSTNEdge, isCSTNPSUEdge, isCSTNUEdge, isOSTNUEdge, setConstraintType, setName
Methods inherited from class it.univr.di.cstnu.graph.AbstractComponent
addObserver, compareTo, equals, equalsByName, getName, hashCode, inNegativeCycle, removeObserver, setInNegativeCycle, takeIn
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface it.univr.di.cstnu.graph.Component
equals, equalsByName, getName, hashCode, inNegativeCycle, setInNegativeCycle, setName
Methods inherited from interface it.univr.di.cstnu.graph.Edge
getConstraintType, isContingentEdge, isCSTNEdge, isCSTNPSUEdge, isCSTNUEdge, isOSTNUEdge, isRequirementEdge, setConstraintType, size
Methods 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 to the edge when it is a contingent link or a wait constraint. Its value isConstants.INT_NULL
when this edge is an ordinary one. -
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:Component
Clear all component but name.- Specified by:
clear
in interfaceComponent
- Overrides:
clear
in classSTNEdgeInt
-
getCaseLabel
- Specified by:
getCaseLabel
in interfaceSTNUEdge
- Returns:
- the node case label associated to this edge when it is a contingent or a wait one, null otherwise.
-
getLabeledValue
public int getLabeledValue()- Specified by:
getLabeledValue
in interfaceSTNUEdge
- Returns:
- the labeled weight if it is a contingent edge or a wait,
Constants.INT_NULL
otherwise.
-
hasSameValues
- Specified by:
hasSameValues
in interfaceEdge
- Overrides:
hasSameValues
in classSTNEdgeInt
- Parameters:
e
- the other edge- Returns:
- true if it has the same values.
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceEdge
- Overrides:
isEmpty
in classSTNEdgeInt
- Returns:
- true if it does not contain any values
-
isSTNEdge
public boolean isSTNEdge()Description copied from interface:Edge
This method is inappropriate here, but it helps to speed up the code.- Specified by:
isSTNEdge
in interfaceEdge
- Overrides:
isSTNEdge
in classSTNEdgeInt
- Returns:
- true if the edge is STN edge
-
isSTNUEdge
public boolean isSTNUEdge()Description copied from interface:Edge
This method is inappropriate here, but it helps to speed up the code.- Specified by:
isSTNUEdge
in interfaceEdge
- Overrides:
isSTNUEdge
in classAbstractEdge
- Returns:
- true if the edge is STNU edge
-
newInstance
Description copied from interface:Edge
Factory- Specified by:
newInstance
in interfaceEdge
- Overrides:
newInstance
in classSTNEdgeInt
- Returns:
- an object of type Edge.
-
newInstance
Description copied from interface:Edge
Any super-interfaces/implementing classes should assure that such method has edge as argument!- Specified by:
newInstance
in interfaceEdge
- Overrides:
newInstance
in classSTNEdgeInt
- Parameters:
edge
- an object to clone.- Returns:
- an object of type Edge.
-
newInstance
Description copied from interface:Edge
Factory- Specified by:
newInstance
in interfaceEdge
- Overrides:
newInstance
in classSTNEdgeInt
- Parameters:
name1
- of the edge- Returns:
- an object of type Edge.
-
resetLabeledValue
public int resetLabeledValue()Removes the labeled value and make the edges an ordinary constraint if it was contingent.- Specified by:
resetLabeledValue
in interfaceSTNUEdge
- Returns:
- the old labeled value.
-
setLabeledValue
Description copied from interface:STNUEdge
Sets the labeled weight to w of aEdge.ConstraintType.contingent
edge. 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:
setLabeledValue
in 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 case of lower-case edge, w must be positive.- Returns:
- the old weight associated to 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:
updateValue
in interfaceSTNEdge
- Overrides:
updateValue
in classSTNEdgeInt
- Parameters:
v
- the new weight value- Returns:
- true if the update occurred, false otherwise;
-
takeIn
-
toString
Description copied from class:AbstractComponent
Return a string representation of labeled values.- Specified by:
toString
in interfaceComponent
- Overrides:
toString
in classSTNEdgeInt
- Returns:
- string representation of the edge
-