Class STNUEdgeInt

All Implemented Interfaces:
Component, Edge, STNEdge, STNUEdge, Serializable, Comparable<Object>

public class STNUEdgeInt extends STNEdgeInt implements STNUEdge
Implements STNUEdge interface using signed integer values.
Version:
$Rev: 906 $
Author:
posenato
See Also:
  • Field Details

    • serialVersionUID

      public static final long serialVersionUID
      Serial number
      See Also:
    • labeledValue

      int labeledValue
      The labeled value associated to the edge when it is a contingent link or a wait constraint. Its value is Constants.INT_NULL when this edge is an ordinary one.
    • caseLabel

      The 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

      public STNUEdgeInt(Edge e)
      Parameters:
      e - a Edge object.
    • STNUEdgeInt

      public STNUEdgeInt(String n)
      Parameters:
      n - a String object.
    • STNUEdgeInt

      public STNUEdgeInt(String n, int v)
      Parameters:
      n - a String object.
      v - the weight of the edge
  • Method Details

    • clear

      public void clear()
      Description copied from interface: Component
      Clear all component but name.
      Specified by:
      clear in interface Component
      Overrides:
      clear in class STNEdgeInt
    • getCaseLabel

      public STNUEdge.CaseLabel getCaseLabel()
      Specified by:
      getCaseLabel in interface STNUEdge
      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 interface STNUEdge
      Returns:
      the labeled weight if it is a contingent edge or a wait, Constants.INT_NULL otherwise.
    • hasSameValues

      public boolean hasSameValues(Edge e)
      Specified by:
      hasSameValues in interface Edge
      Overrides:
      hasSameValues in class STNEdgeInt
      Parameters:
      e - the other edge
      Returns:
      true if it has the same values.
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Edge
      Overrides:
      isEmpty in class STNEdgeInt
      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 interface Edge
      Overrides:
      isSTNEdge in class STNEdgeInt
      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 interface Edge
      Overrides:
      isSTNUEdge in class AbstractEdge
      Returns:
      true if the edge is STNU edge
    • newInstance

      public STNUEdgeInt newInstance()
      Description copied from interface: Edge
      Factory
      Specified by:
      newInstance in interface Edge
      Overrides:
      newInstance in class STNEdgeInt
      Returns:
      an object of type Edge.
    • newInstance

      public STNUEdgeInt newInstance(Edge edge)
      Description copied from interface: Edge
      Any super-interfaces/implementing classes should assure that such method has edge as argument!
      Specified by:
      newInstance in interface Edge
      Overrides:
      newInstance in class STNEdgeInt
      Parameters:
      edge - an object to clone.
      Returns:
      an object of type Edge.
    • newInstance

      public STNUEdgeInt newInstance(String name1)
      Description copied from interface: Edge
      Factory
      Specified by:
      newInstance in interface Edge
      Overrides:
      newInstance in class STNEdgeInt
      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 interface STNUEdge
      Returns:
      the old labeled value.
    • setLabeledValue

      public int setLabeledValue(ALabelAlphabet.ALetter nodeALetter, int w, boolean upperCase)
      Description copied from interface: STNUEdge
      Sets the labeled weight to w of a Edge.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 interface STNUEdge
      Parameters:
      nodeALetter - the name of the contingent node as ALetter.
      w - the new weight value
      upperCase - 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 interface STNEdge
      Overrides:
      updateValue in class STNEdgeInt
      Parameters:
      v - the new weight value
      Returns:
      true if the update occurred, false otherwise;
    • takeIn

      public void takeIn(Edge e)
      Description copied from interface: Edge
      A copy by reference of internal structure of edge e.
      Specified by:
      takeIn in interface Edge
      Overrides:
      takeIn in class STNEdgeInt
      Parameters:
      e - edge to clone. If null, it does nothing.
    • toString

      @Nonnull public String toString()
      Description copied from class: AbstractComponent
      Return a string representation of labeled values.
      Specified by:
      toString in interface Component
      Overrides:
      toString in class STNEdgeInt
      Returns:
      string representation of the edge