uk.ac.rdg.resc.jstyx.infernogrid
Class Sexpression

java.lang.Object
  extended by uk.ac.rdg.resc.jstyx.infernogrid.Sexpression

public class Sexpression
extends java.lang.Object

Simple representation of an S-expression. S-expressions contain atoms and other S-expressions. So the S-expression (a (b c)) contains the atom a and the S-expression (b c)

Author:
Jon Blower $Revision: 354 $ $Date: 2005-08-10 19:34:28 +0100 (Wed, 10 Aug 2005) $ $Log$ Revision 1.2 2005/08/10 18:34:28 jonblower Implemented working S-expression parser Revision 1.1 2005/08/08 07:43:03 jonblower Initial import

Constructor Summary
Sexpression()
          Creates a new instance of Sexpression
 
Method Summary
 void add(java.lang.Object token)
          Adds a token (an atom or another Sexpression) to this Sexpression
 int getSize()
           
 java.lang.Object getToken(int i)
           
 java.lang.String toString()
          Recursive method to display the contents of this Sexpression
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Sexpression

public Sexpression()
Creates a new instance of Sexpression

Method Detail

add

public void add(java.lang.Object token)
Adds a token (an atom or another Sexpression) to this Sexpression


getSize

public int getSize()
Returns:
the number of tokens (atoms and Sexpressions) contained in this Sexpression

getToken

public java.lang.Object getToken(int i)
Returns:
the token (atom or Sexpression) at the given index within this Sexpression. If the type of the returned object is String, the token is an atom (string literal). If the type is a Sexpression (the only other option), the token is a nested Sexpression
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the given index is out of range

toString

public java.lang.String toString()
Recursive method to display the contents of this Sexpression

Overrides:
toString in class java.lang.Object


Copyright © 2004-2006 Reading e-Science Centre. All Rights Reserved.