java.lang.Object
net.ssehub.easy.varModel.model.values.Value
Direct Known Subclasses:
BasisDatatypeValue, EnumValue, ListWrapperValue, MetaTypeValue, NullValue, ReferenceValue, StructuredValue

public abstract class Value extends Object
Basis value class.
Author:
Marcel Lueder, El-Sharkawy, Holger Eichelberger
  • Field Details

    • LOGGER

      private static final net.ssehub.easy.basics.logger.EASyLoggerFactory.EASyLogger LOGGER
    • origin

      private IDatatype origin
  • Constructor Details

    • Value

      Value()
      Constructor for serialization.
    • Value

      protected Value(IDatatype origin)
      Constructor.
      Parameters:
      origin - the origin datatype.
  • Method Details

    • getValue

      public abstract Object getValue()
      Abstract getValue method. The result of this method must comply to the input conventions of ValueFactory and the constructor of the respective implementing class.
      Returns:
      the Value of the Datatype
    • accept

      public abstract void accept(IValueVisitor visitor)
      Abstract accept method.
      Parameters:
      visitor - The visitor
    • setValue

      public abstract void setValue(Object value) throws ValueDoesNotMatchTypeException
      Abstract setValue-method.
      Parameters:
      value - the value to set.
      Throws:
      ValueDoesNotMatchTypeException - if the given value does not match this type
    • getType

      public IDatatype getType()
      Returns the Datatype of this Value. The datatype should match to the type of this value.
      Returns:
      Related datatype of this value.
    • isConfigured

      public abstract boolean isConfigured()
      Abstract Method to check whether a value is configured.
      Returns:
      true = it is configured / false = it is not
    • stringValueOf

      protected String stringValueOf(Object object)
      Converts a object value to a string.
      Parameters:
      object - the object to convert
      Returns:
      the converted object
    • clone

      public Value clone()
      Clones the this value.
      Overrides:
      clone in class Object
      Returns:
      the clone of the value
    • getContainedType

      public IDatatype getContainedType()
      Returns the data type explicitly contained in this value. This is typically a meta value, i.e. a type expression.
      Returns:
      the contained type or null if there is none
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equalsPartially

      public abstract boolean equalsPartially(Value value)
      Returns whether the provided value is partially equal to this value, i.e., whether the nested elements of value (if they exist) have the same contents as in this value. Other values of this value are not considered. The check is transitive on nested elements. Please consider that this method is not symmetric as opposed to equals. This method is important to cope with default values.
      Parameters:
      value - the value to be checked for partial equality.
      Returns:
      true if value is partially equal to this, false else
    • equalsPartially

      public static boolean equalsPartially(Value v1, Value v2)
      Returns whether v1 and v2 are equalsPartially(Value) partially equal considering the case that v1 may be null.
      Parameters:
      v1 - the first value (may be null)
      v2 - the second value (may be null)
      Returns:
      true if v1 and v2 are considered to be partially equal, false else, i.e., whether v2 is a partial value of v1
    • equals

      public static boolean equals(Value v1, Value v2)
      Returns whether v1 and v2 are equals(Value) equal considering the case that v1 may be null.
      Parameters:
      v1 - the first value (may be null)
      v2 - the second value (may be null)
      Returns:
      true if v1 and v2 are considered to be equal, false else, i.e., whether v2 is the same value as v1
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • setValueParent

      public void setValueParent(IValueParent parent)
      Changes the value parent.
      Parameters:
      parent - the parent
    • getValueParent

      public IValueParent getValueParent()
      Returns the value parent.
      Returns:
      the parent (may be null for none)