jade.onto
Class Frame

java.lang.Object
  |
  +--jade.onto.Frame

public class Frame
extends java.lang.Object

Representation of an ontological entity as a set of untyped slots. This class can hold different slots, keeping track both their unique name and their position.

Author:
Giovanni Rimassa - Universita` di Parma

Field Summary
static java.lang.String UNNAMEDPREFIX
          This string is the prefix of all the unnamed slots of a Frame
 
Constructor Summary
Frame(java.lang.String name)
          Creates a new frame with the given name.
 
Method Summary
 java.lang.String getName()
          Reads the name of this frame.
 java.lang.Object getSlot(int position)
          Retrieves an unnamed slot from this frame, by position.
 java.lang.Object getSlot(java.lang.String name)
          Retrieves a named slot from this frame, by name.
 java.lang.String getSlotName(int position)
           
 void putSlot(java.lang.Object value)
          Adds an unnamed slot to this frame.
 void putSlot(java.lang.String name, java.lang.Object value)
          Adds a named slot to this frame.
 int size()
           
 java.lang.String toString()
          it is here just for debugging purposes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNNAMEDPREFIX

public static java.lang.String UNNAMEDPREFIX
This string is the prefix of all the unnamed slots of a Frame
Constructor Detail

Frame

public Frame(java.lang.String name)
Creates a new frame with the given name.
Parameters:
name - The name of this frame.
Method Detail

getName

public java.lang.String getName()
Reads the name of this frame.
Returns:
The name of this frame, as was set by the constructor.

putSlot

public void putSlot(java.lang.String name,
                    java.lang.Object value)
Adds a named slot to this frame.
Parameters:
name - The unique name of the new slot
value - A Java object that will be associated with the given name.

putSlot

public void putSlot(java.lang.Object value)
Adds an unnamed slot to this frame. Its position is determined by the number of slots of this frame at the time of the call. The given Java object is put at the end of the slot sequence. A dummy name is set for this slot with the prefix UNNAMEDPREFIX.
Parameters:
value - A Java object that will be associated with the given position.

getSlot

public java.lang.Object getSlot(java.lang.String name)
                         throws OntologyException
Retrieves a named slot from this frame, by name.
Parameters:
name - The name of the desired slot.
Returns:
The value of that slot
Throws:
OntologyException - If no suitable slot exists.

getSlot

public java.lang.Object getSlot(int position)
                         throws OntologyException
Retrieves an unnamed slot from this frame, by position.
Parameters:
position - The position of the desired slot.
Returns:
The value of that slot
Throws:
OntologyException - If no suitable slot exists.

size

public int size()
Returns:
the number of slots in this Frame.

getSlotName

public java.lang.String getSlotName(int position)
                             throws OntologyException
Returns:
The name of the slot at the indicated position
Throws:
OntologyException - If no suitable slot exists.

toString

public java.lang.String toString()
it is here just for debugging purposes
Overrides:
toString in class java.lang.Object