public class SLCodec extends StringCodec
Codec
interface and allows converting
back and forth between strings and frames, according to the SL
grammar.
By default the class implements full SL grammar, otherwise the proper
value must be used in the constructor.Codec.CodecException
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PRESERVE_JAVA_TYPES |
UNNAMEDPREFIX
Constructor and Description |
---|
SLCodec()
Construct a Codec object for the full SL-language (FIPA-SL).
|
SLCodec(boolean preserveJavaTypes)
Create an SLCodec for the full SL-language (FIPA-SL) specifying whether or not java primitive types
(long, int, float, double) must be preserved.
|
SLCodec(int slType)
Construct a Codec object for the given profile of SL-language.
|
SLCodec(int slType,
boolean preserveJavaTypes)
Create an SLCodec for the given profile of SL-language specifying whether or not java primitive types
(long, int, float, double) must be preserved.
|
Modifier and Type | Method and Description |
---|---|
AbsContentElement |
decode(Ontology ontology,
java.lang.String content)
Decodes the content to an abstract description.
|
AbsContentElement |
decode(java.lang.String content)
Decodes the content to an abstract description.
|
AbsPredicate |
decodeFormula(Ontology ontology,
java.lang.String formula)
Decodes the content to an abstract description, where the content is known to be a Well-formed Formula
|
AbsTerm |
decodeTerm(Ontology ontology,
java.lang.String term)
Decodes the content to an abstract description, where the content is known to be a Term.
|
java.lang.String |
encode(AbsContentElement content)
Encodes a content into a String.
|
java.lang.String |
encode(Ontology ontology,
AbsContentElement content)
Encodes a content into a String.
|
java.lang.String |
encodeFormula(Ontology ontology,
AbsPredicate formula)
Encodes the content into a String, where the content is known to be a Well-formed Formula
|
java.lang.String |
encodeTerm(Ontology ontology,
AbsTerm term)
Encodes the content into a String, where the content is known to be a Term.
|
Ontology |
getInnerOntology() |
boolean |
getPreserveJavaTypes() |
static void |
main(java.lang.String[] args) |
protected java.lang.Object |
readResolve()
Restore parser after deserialization.
|
public static final java.lang.String PRESERVE_JAVA_TYPES
public SLCodec()
public SLCodec(boolean preserveJavaTypes)
preserveJavaTypes
- Indicates whether or not java primitive types must be preservedpublic SLCodec(int slType)
slType
- specify 0 for FIPA-SL0, 1 for FIPA-SL1, 2 for FIPA-SL2, any other value can be used for full FIPA-SLpublic SLCodec(int slType, boolean preserveJavaTypes)
slType
- specify 0 for FIPA-SL0, 1 for FIPA-SL1, 2 for FIPA-SL2, any other value can be used for full FIPA-SLpreserveJavaTypes
- Indicates whether or not java primitive types must be preservedpublic boolean getPreserveJavaTypes()
public java.lang.String encode(AbsContentElement content) throws Codec.CodecException
encode
in class StringCodec
content
- the content as an abstract descriptor.CodecException
Codec.CodecException
public java.lang.String encode(Ontology ontology, AbsContentElement content) throws Codec.CodecException
encode
in class StringCodec
ontology
- the ontologycontent
- the content as an abstract descriptor.CodecException
Codec.CodecException
public AbsContentElement decode(java.lang.String content) throws Codec.CodecException
decode
in class StringCodec
content
- the content as a String.CodecException
Codec.CodecException
public AbsContentElement decode(Ontology ontology, java.lang.String content) throws Codec.CodecException
decode
in class StringCodec
ontology
- the ontology.content
- the content as a String.CodecException
Codec.CodecException
public AbsTerm decodeTerm(Ontology ontology, java.lang.String term) throws Codec.CodecException
ontology
- the ontology.cterm
- the term as a String.CodecException
Codec.CodecException
public java.lang.String encodeTerm(Ontology ontology, AbsTerm term) throws Codec.CodecException
ontology
- the ontology.term
- the termt as an abstract descriptorCodecException
Codec.CodecException
public AbsPredicate decodeFormula(Ontology ontology, java.lang.String formula) throws Codec.CodecException
ontology
- the ontology.formula
- the content as a String.CodecException
Codec.CodecException
public java.lang.String encodeFormula(Ontology ontology, AbsPredicate formula) throws Codec.CodecException
ontology
- the ontology.formula
- the formula as an abstract descriptorCodecException
Codec.CodecException
public static void main(java.lang.String[] args)
public Ontology getInnerOntology()
getInnerOntology
in class Codec
protected java.lang.Object readResolve() throws java.io.ObjectStreamException
java.io.ObjectStreamException