Class ExternalDataType

java.lang.Object
com.semedy.reasoner.api.symboltable.ExternalDataType
Direct Known Subclasses:
Calendar, Duration, ExercisesURI, ExercisesURI, GeoCircle, GeoLineString, GeoPoint, GeoPolygon, GeoRectangle, InternalCode, JsonIdentifier, PlainLiteral, PlainLiteral, URI

public abstract class ExternalDataType extends Object
Additional data types may be defined and added.
Syntactically these data types look as following:
_'<value<' For instance the URI type is defined as an external data type a fact may look like p(_"http://a.b.c").
Calendar and Duration are internally also defined in that way
Author:
juergen
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    createValue(ByteBuffer buf, int pos)
    Create an instance from the byte representation.
    abstract Object
    directDecode(long code)
    Decode the code (if possible)
    The encoding of the standard types looks as following:
    _direct = 1L << 63; indicates that the code is direct encoded
    _shortstring = 1L << 62; bit 62 must not be used for another encoding
    _inttype = 2L << 59
    _floattype = 3L << 59
    _booleantype = 4L << 59
    abstract long
    Encode the value of this as a long (if possible) delivers 0 if it is not possible
    boolean
     
    byte[]
    Create a byte representation
    Used in symbol table to write this byte representation to file
    abstract byte
    return unique id of external data type (50..100)
    byte[]
    Create a byte representation of the key used in symbol table
    abstract String
    Returns a string representation of value.
    abstract Object
    return the value
    int
     
    parse value of data type out of String
    return the "external" String representation which starts with an underscore

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ExternalDataType

      public ExternalDataType()
  • Method Details

    • getId

      public abstract byte getId()
      return unique id of external data type (50..100)
      Returns:
      unique id of external data type
    • parse

      public abstract ExternalDataType parse(String s)
      parse value of data type out of String
      Parameters:
      s -
      Returns:
    • getString

      public abstract String getString()
      Returns a string representation of value.
      This string representation must be parseable by "parse"
    • directEncode

      public abstract long directEncode() throws DatatypeConfigurationException
      Encode the value of this as a long (if possible) delivers 0 if it is not possible
      Returns:
      Throws:
      DatatypeConfigurationException
    • directDecode

      public abstract Object directDecode(long code) throws DatatypeConfigurationException
      Decode the code (if possible)
      The encoding of the standard types looks as following:
      _direct = 1L << 63; indicates that the code is direct encoded
      _shortstring = 1L << 62; bit 62 must not be used for another encoding
      _inttype = 2L << 59
      _floattype = 3L << 59
      _booleantype = 4L << 59
      Parameters:
      code -
      Throws:
      DatatypeConfigurationException
    • toString

      public String toString()
      return the "external" String representation which starts with an underscore
      Overrides:
      toString in class Object
    • getValue

      public abstract Object getValue()
      return the value
      Returns:
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

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

      public byte[] getBytes()
      Create a byte representation
      Used in symbol table to write this byte representation to file
      Returns:
    • getKey

      public byte[] getKey()
      Create a byte representation of the key used in symbol table
      Returns:
      byte representation
    • createValue

      public ExternalDataType createValue(ByteBuffer buf, int pos)
      Create an instance from the byte representation.
      Used in symbol table to recreate the object.
      Parameters:
      buf -
      pos -
      Returns:
      external data type