jade.content.lang.sl
Class SLCodec

java.lang.Object
  |
  +--jade.content.lang.Codec
        |
        +--jade.content.lang.StringCodec
              |
              +--jade.content.lang.sl.SLCodec
All Implemented Interfaces:
Serializable, java.io.Serializable

public class SLCodec
extends StringCodec

The codec class for the FIPA-SLn languages. This class implements the 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.

Version:
$Date: 2005-10-28 14:19:31 +0200 (ven, 28 ott 2005) $ $Revision: 5805 $
Author:
Fabio Bellifemine - TILAB, Nicolas Lhuillier - Motorola (added support for byte[] primitive)
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class jade.content.lang.Codec
Codec.CodecException
 
Field Summary
 
Fields inherited from class jade.content.lang.Codec
UNNAMEDPREFIX
 
Constructor Summary
SLCodec()
          Construct a Codec object for the full SL-language (FIPA-SL).
SLCodec(int slType)
          Construct a Codec object for the given profile of SL-language.
 
Method Summary
 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()
           
static void main(java.lang.String[] args)
           
protected  java.lang.Object readResolve()
          Restore parser after deserialization.
 
Methods inherited from class jade.content.lang.Codec
getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SLCodec

public SLCodec()
Construct a Codec object for the full SL-language (FIPA-SL).


SLCodec

public SLCodec(int slType)
Construct a Codec object for the given profile of SL-language.

Parameters:
slType - specify 0 for FIPA-SL0, 1 for FIPA-SL1, 2 for FIPA-SL2, any other value can be used for full FIPA-SL
Method Detail

encode

public java.lang.String encode(AbsContentElement content)
                        throws Codec.CodecException
Encodes a content into a String.

Specified by:
encode in class StringCodec
Parameters:
content - the content as an abstract descriptor.
Returns:
the content as a String.
Throws:
CodecException
Codec.CodecException

encode

public java.lang.String encode(Ontology ontology,
                               AbsContentElement content)
                        throws Codec.CodecException
Encodes a content into a String.

Specified by:
encode in class StringCodec
Parameters:
ontology - the ontology
content - the content as an abstract descriptor.
Returns:
the content as a String.
Throws:
CodecException
Codec.CodecException

decode

public AbsContentElement decode(java.lang.String content)
                         throws Codec.CodecException
Decodes the content to an abstract description.

Specified by:
decode in class StringCodec
Parameters:
content - the content as a String.
Returns:
the content as an abstract description.
Throws:
CodecException
Codec.CodecException

decode

public AbsContentElement decode(Ontology ontology,
                                java.lang.String content)
                         throws Codec.CodecException
Decodes the content to an abstract description.

Specified by:
decode in class StringCodec
Parameters:
ontology - the ontology.
content - the content as a String.
Returns:
the content as an abstract description.
Throws:
CodecException
Codec.CodecException

decodeTerm

public AbsTerm decodeTerm(Ontology ontology,
                          java.lang.String term)
                   throws Codec.CodecException
Decodes the content to an abstract description, where the content is known to be a Term.

Parameters:
ontology - the ontology.
Returns:
the content as an abstract description.
Throws:
CodecException
Codec.CodecException
Since:
JADE 3.4

encodeTerm

public java.lang.String encodeTerm(Ontology ontology,
                                   AbsTerm term)
                            throws Codec.CodecException
Encodes the content into a String, where the content is known to be a Term.

Parameters:
ontology - the ontology.
term - the termt as an abstract descriptor
Returns:
the content as a String
Throws:
CodecException
Codec.CodecException
Since:
JADE 3.4

decodeFormula

public AbsPredicate decodeFormula(Ontology ontology,
                                  java.lang.String formula)
                           throws Codec.CodecException
Decodes the content to an abstract description, where the content is known to be a Well-formed Formula

Parameters:
ontology - the ontology.
formula - the content as a String.
Returns:
the content as an abstract description.
Throws:
CodecException
Codec.CodecException
Since:
JADE 3.4

encodeFormula

public java.lang.String encodeFormula(Ontology ontology,
                                      AbsPredicate formula)
                               throws Codec.CodecException
Encodes the content into a String, where the content is known to be a Well-formed Formula

Parameters:
ontology - the ontology.
formula - the formula as an abstract descriptor
Returns:
the content as a String
Throws:
CodecException
Codec.CodecException
Since:
JADE 3.4

main

public static void main(java.lang.String[] args)

getInnerOntology

public Ontology getInnerOntology()
Overrides:
getInnerOntology in class Codec
Returns:
the ontology containing the schemas of the operator defined in this language

readResolve

protected java.lang.Object readResolve()
                                throws java.io.ObjectStreamException
Restore parser after deserialization.
The readResolve method is called when ObjectInputStream has read an object from the stream and is preparing to return it to the caller.
The readResolve method is not invoked on the object until the object is fully constructed.

java.io.ObjectStreamException


JADE