jade.lang.sl
Class SL0Codec

java.lang.Object
  |
  +--jade.lang.sl.SL0Codec

public class SL0Codec
extends java.lang.Object
implements Codec

The codec class for the SL0 language. This class implements the Codec interface and allows converting back and forth between strings and frames, according to the SL0 grammar.

WARNING: When creating the Ontology, notice that this SL0Parser returns a Java object of type Long everytime it parses an integer, and it returns a Java object of type Double everytime it parses a float. Therefore, the slots of the frames in the ontology must be of type, respectively, Ontology.LONG_TYPE and Ontology.DOUBLE_TYPE, otherwise you get an IllegalArgumentException.

Notice also that the following convention is needed for all the frames representing actions: the name of the frame must be NAME_OF_ACTION_FRAME, and the name of the two slots representing actor and the action term must be, respectively, NAME_OF_ACTOR_SLOT and NAME_OF_ACTION_SLOT.

Author:
Giovanni Rimassa - Universita` di Parma

Field Summary
static java.lang.String NAME
          A symbolic constant, containing the name of this language.
static java.lang.String NAME_OF_ACTION_FRAME
          Symbolic constant identifying a frame representing an action
static java.lang.String NAME_OF_ACTION_SLOT
          Symbolic constant identifying a slot representing an action
static java.lang.String NAME_OF_ACTOR_SLOT
          Symbolic constant identifying a slot representing an actor
 
Constructor Summary
SL0Codec()
           
 
Method Summary
 java.util.List decode(java.lang.String s, Ontology o)
           
 java.lang.String encode(java.util.List v, Ontology o)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final java.lang.String NAME
A symbolic constant, containing the name of this language.

NAME_OF_ACTION_FRAME

public static java.lang.String NAME_OF_ACTION_FRAME
Symbolic constant identifying a frame representing an action

NAME_OF_ACTOR_SLOT

public static java.lang.String NAME_OF_ACTOR_SLOT
Symbolic constant identifying a slot representing an actor

NAME_OF_ACTION_SLOT

public static java.lang.String NAME_OF_ACTION_SLOT
Symbolic constant identifying a slot representing an action
Constructor Detail

SL0Codec

public SL0Codec()
Method Detail

encode

public java.lang.String encode(java.util.List v,
                               Ontology o)
Specified by:
encode in interface Codec

decode

public java.util.List decode(java.lang.String s,
                             Ontology o)
                      throws Codec.CodecException
Specified by:
decode in interface Codec