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
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
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
-
Method Summary
Modifier and TypeMethodDescriptioncreateValue
(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 << 59abstract long
Encode the value of this as a long (if possible) delivers 0 if it is not possibleboolean
byte[]
getBytes()
Create a byte representation
Used in symbol table to write this byte representation to fileabstract byte
getId()
return unique id of external data type (50..100)byte[]
getKey()
Create a byte representation of the key used in symbol tableabstract String
Returns a string representation of value.abstract Object
getValue()
return the valueint
hashCode()
abstract ExternalDataType
parse value of data type out of StringtoString()
return the "external" String representation which starts with an underscore
-
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
parse value of data type out of String- Parameters:
s
-- Returns:
-
getString
Returns a string representation of value.
This string representation must be parseable by "parse" -
directEncode
Encode the value of this as a long (if possible) delivers 0 if it is not possible- Returns:
- Throws:
DatatypeConfigurationException
-
directDecode
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
return the "external" String representation which starts with an underscore -
getValue
return the value- Returns:
-
equals
-
hashCode
public int hashCode() -
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
Create an instance from the byte representation.
Used in symbol table to recreate the object.- Parameters:
buf
-pos
-- Returns:
- external data type
-