Class ValueFactory

java.lang.Object
net.ssehub.easy.varModel.model.values.ValueFactory

public class ValueFactory extends Object
The ValueFactory provides easy access to the Values. Object values passed in must match the value instance to be created for the specified data types. Object values may be
  • constants, such as integer values, doubles, strings
  • instances of Value
  • instances of ConstraintSyntaxTree denoting entire expressions
  • object arrays for
    • container: just containing the values
    • compounds: containing name-value pairs (first entry name, second value) denoting the values for individual slots. A special value is CompoundValue.SPECIAL_SLOT_NAME_TYPE where the value contains an object of IDatatype denoting the actual type of the compound in case of refined compounds).
Author:
lueder, Holger Eichelberger, El-Sharkawy
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static interface 
    Private interface for calling the constructor of the right value type.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Object[]
     
    private static Map<Class<? extends IDatatype>,ValueFactory.IValueCreator>
    This map values associated to the origin datatype.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Prevent external initialization, allow subclassing.
  • Method Summary

    Modifier and Type
    Method
    Description
    private static void
    This method assigns the constructor for BooleanValues to the IDatatype BooleanType.
    private static void
    This method assigns the constructor for CompoundValues to the IDatatype Compound.
    private static void
    This method assigns the constructor for ConstraintValues to the IDatatype BooleanType.
    private static void
    This method assigns the constructor for ContainerValue to the IDatatype Compound.
    private static void
    This method assigns the constructor for DerivedDatatypeValues to the IDatatype DerivedDatatype.
    private static void
    This method assigns the constructor for EnumValues to the IDatatype Enum and OrderedEnum.
    private static void
    This method assigns the constructor for IntValues to the IDatatype IntegerType.
    private static void
    This method assigns the constructor for MetaTypeValue to the IDatatype MetaType.
    private static void
    This method assigns the constructor for RealValues to the IDatatype RealType.
    private static void
    This method assigns the constructor for ReferenceValue to the IDatatype Reference.
    private static void
    This method assigns the constructor for StringValues to the IDatatype StringType.
    private static void
    This method assigns the constructor for VersionValue to the IDatatype VersionType.
    static Value
    createValue(IDatatype type, Object... value)
    Creates and returns a Value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • ValueFactory

      private ValueFactory()
      Prevent external initialization, allow subclassing.
  • Method Details

    • assignStringValue

      private static void assignStringValue()
      This method assigns the constructor for StringValues to the IDatatype StringType.
    • assignIntegerValue

      private static void assignIntegerValue()
      This method assigns the constructor for IntValues to the IDatatype IntegerType.
    • assignRealValue

      private static void assignRealValue()
      This method assigns the constructor for RealValues to the IDatatype RealType.
    • assignDerivedDatypeValue

      private static void assignDerivedDatypeValue()
      This method assigns the constructor for DerivedDatatypeValues to the IDatatype DerivedDatatype. Since there do not exist any DerivedDatatypeValues, this method calls the createValue(IDatatype, Object...) for the basis datatype of the DerivedDatatype.
    • assignMetaTypeValue

      private static void assignMetaTypeValue()
      This method assigns the constructor for MetaTypeValue to the IDatatype MetaType.
    • assignVersionTypeValue

      private static void assignVersionTypeValue()
      This method assigns the constructor for VersionValue to the IDatatype VersionType.
    • assignBooleanValue

      private static void assignBooleanValue()
      This method assigns the constructor for BooleanValues to the IDatatype BooleanType.
    • assignConstraintValue

      private static void assignConstraintValue()
      This method assigns the constructor for ConstraintValues to the IDatatype BooleanType.
    • assignEnumValue

      private static void assignEnumValue()
      This method assigns the constructor for EnumValues to the IDatatype Enum and OrderedEnum.
    • assignCompoundValue

      private static void assignCompoundValue()
      This method assigns the constructor for CompoundValues to the IDatatype Compound.
    • assignContainerValue

      private static void assignContainerValue()
      This method assigns the constructor for ContainerValue to the IDatatype Compound.
    • assignReferenceValue

      private static void assignReferenceValue()
      This method assigns the constructor for ReferenceValue to the IDatatype Reference.
    • createValue

      public static Value createValue(IDatatype type, Object... value) throws ValueDoesNotMatchTypeException
      Creates and returns a Value.
      Parameters:
      type - The IDatatype of the value
      value - the string formatted value(s)
      Returns:
      A suitable value related to the given IDatatype or null if no suitable Value exists, but should not occur.
      Throws:
      ValueDoesNotMatchTypeException - in case of value cannot be converted to type