Class AbsPrimitive

    • Constructor Detail

      • AbsPrimitive

        public AbsPrimitive​(String typeName)
        Construct an Abstract descriptor to hold a primitive of the proper type (e.g. String, int, boolean...).
        Parameters:
        typeName - The name of the type of the primitive held by this abstract descriptor.
    • Method Detail

      • wrap

        public static AbsPrimitive wrap​(String value)
        Create an AbsPrimitive of type BasicOntology.STRING containing a given String value.
      • wrap

        public static AbsPrimitive wrap​(boolean value)
        Create an AbsPrimitive of type BasicOntology.BOOLEAN containing a given boolean value.
      • wrap

        public static AbsPrimitive wrap​(int value)
        Create an AbsPrimitive of type BasicOntology.INTEGER containing a given int value.
      • wrap

        public static AbsPrimitive wrap​(long value)
        Create an AbsPrimitive of type BasicOntology.INTEGER containing a given long value.
      • wrap

        public static AbsPrimitive wrap​(float value)
        Create an AbsPrimitive of type BasicOntology.FLOAT containing a given float value.
      • wrap

        public static AbsPrimitive wrap​(double value)
        Create an AbsPrimitive of type BasicOntology.FLOAT containing a given double value.
      • wrap

        public static AbsPrimitive wrap​(Date value)
        Create an AbsPrimitive of type BasicOntology.DATE containing a given Date value.
      • wrap

        public static AbsPrimitive wrap​(byte[] value)
        Create an AbsPrimitive of type BasicOntology.BYTE_SEQUENCE containing a given byte[] value.
      • set

        public void set​(String value)
        Set the value of this AbsPrimitive to the given String.
        Parameters:
        value - The new value
        Throws:
        IllegalArgumentException - If the type of this AbsPrimitive is not BasicOntology.STRING
      • set

        public void set​(boolean value)
        Set the value of this AbsPrimitive to the given boolean value.
        Parameters:
        value - The new value
        Throws:
        IllegalArgumentException - If the type of this AbsPrimitive is not BasicOntology.BOOLEAN
      • set

        public void set​(int value)
        Set the value of this AbsPrimitive to the given int value.
        Parameters:
        value - The new value
        Throws:
        IllegalArgumentException - If the type of this AbsPrimitive is not BasicOntology.INTEGER
      • set

        public void set​(long value)
        Set the value of this AbsPrimitive to the given long value.
        Parameters:
        value - The new value
        Throws:
        IllegalArgumentException - If the type of this AbsPrimitive is not BasicOntology.INTEGER
      • set

        public void set​(float value)
        Set the value of this AbsPrimitive to the given float value.
        Parameters:
        value - The new value
        Throws:
        IllegalArgumentException - If the type of this AbsPrimitive is not BasicOntology.FLOAT
      • set

        public void set​(double value)
        Set the value of this AbsPrimitive to the given double value.
        Parameters:
        value - The new value
        Throws:
        IllegalArgumentException - If the type of this AbsPrimitive is not BasicOntology.FLOAT
      • set

        public void set​(Date value)
        Set the value of this AbsPrimitive to the given Date value.
        Parameters:
        value - The new value
        Throws:
        IllegalArgumentException - If the type of this AbsPrimitive is not BasicOntology.DATE
      • set

        public void set​(byte[] value)
        Set the value of this AbsPrimitive to the given byte[] value.
        Parameters:
        value - The new value
        Throws:
        IllegalArgumentException - If the type of this AbsPrimitive is not BasicOntology.BYTE_SEQUENCE
      • getString

        public String getString()
        Returns:
        the value of this AbsPrimitive as a String.
        Throws:
        ClassCastException - If the type of this AbsPrimitive is not BasicOntology.STRING
      • getBoolean

        public boolean getBoolean()
        Returns:
        the value of this AbsPrimitive as a boolean.
        Throws:
        ClassCastException - If the type of this AbsPrimitive is not BasicOntology.BOOLEAN
      • getInteger

        public int getInteger()
        Returns:
        the value of this AbsPrimitive as an int.
        Throws:
        ClassCastException - If the type of this AbsPrimitive is not BasicOntology.INTEGER
      • getLong

        public long getLong()
        Returns:
        the value of this AbsPrimitive as a long.
        Throws:
        ClassCastException - If the type of this AbsPrimitive is not BasicOntology.INTEGER
      • getFloat

        public float getFloat()
        Returns:
        the value of this AbsPrimitive as a float.
        Throws:
        ClassCastException - If the type of this AbsPrimitive is not BasicOntology.FLOAT
      • getDouble

        public double getDouble()
        Returns:
        the value of this AbsPrimitive as a double.
        Throws:
        ClassCastException - If the type of this AbsPrimitive is not BasicOntology.FLOAT
      • getDate

        public Date getDate()
        Returns:
        the value of this AbsPrimitive as a Date.
        Throws:
        ClassCastException - If the type of this AbsPrimitive is not BasicOntology.DATE
      • getByteSequence

        public byte[] getByteSequence()
        Returns:
        the value of this AbsPrimitive as a byte[].
        Throws:
        ClassCastException - If the type of this AbsPrimitive is not BasicOntology.BYTE_SEQUENCE
      • getObject

        public Object getObject()
        Returns:
        the value of this AbsPrimitive as an Object. If the type of this AbsPrimitive is BasicOntology.BOOLEAN BasicOntology.INTEGER or BasicOntology.FLOAT a Boolean, Integer or Float object is returned.
      • getAbsObject

        public AbsObject getAbsObject​(String name)
        Makes no sense in the case of an AbsPrimitive that has no attribute --> Just return null
        Specified by:
        getAbsObject in interface AbsObject
        Parameters:
        name - The name of the attribute.
        Returns:
        value The value of the attribute.
      • getNames

        public String[] getNames()
        Makes no sense in the case of an AbsPrimitive that has no attribute --> Just return null
        Specified by:
        getNames in interface AbsObject
        Returns:
        the name of all attributes.
      • isGrounded

        public boolean isGrounded()
        Tests if this AbsPrimitive is grounded. It always returns true
        Specified by:
        isGrounded in interface AbsObject
        Returns:
        true if the object is grounded.
      • getCount

        public int getCount()
        Makes no sense in the case of an AbsPrimitive that has no attribute --> Just return 0
        Specified by:
        getCount in interface AbsObject
        Returns:
        the number of attributes.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object