lib
Class LispBlob

java.lang.Object
  extended by lib.LispBlob

public class LispBlob
extends java.lang.Object

Provides simple API for dealing with lisp code in a string and enables us to readily break the lists down into items.

Version:
1.0
Author:
CobaltSoftware (abode.devteam@cobaltsoftware.net)

Field Summary
private  java.util.ArrayList alChildren
           
private static boolean DEBUG_PARSER
           
private  java.lang.String strText
           
 
Constructor Summary
LispBlob(java.lang.String lispString)
          Initialize a lisp blob from a given string, so we can process the list and/or it's children.
 
Method Summary
private  void clearDOM()
          Clear the DOM ready for a re-parsing
 java.util.Iterator getIterator()
          Get an iterator over our children
 java.lang.String getText()
          Get the text this blob is comprised of
 boolean hasChildren()
          Does this blob have list items?
 boolean isList()
          Is this instance a list?
 void setText(java.lang.String strNewText)
          Set the text this blob is comprised of.
static java.lang.String stripComments(java.lang.String lisp)
          Remove the comments from a lisp string.
static java.lang.String stripWhiteSpace(java.lang.String lisp)
          Remove redundant whitespace from a lisp string.
 java.util.ArrayList toList()
          Convert this list to an arraylist
private  void updateDOM()
          Update the child lists or the node text for this lisp string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG_PARSER

private static boolean DEBUG_PARSER

strText

private java.lang.String strText

alChildren

private java.util.ArrayList alChildren
Constructor Detail

LispBlob

public LispBlob(java.lang.String lispString)
Initialize a lisp blob from a given string, so we can process the list and/or it's children.

Parameters:
lispString - Lisp code in string form
Method Detail

getIterator

public java.util.Iterator getIterator()
Get an iterator over our children

Returns:
Iterator over children

isList

public boolean isList()
Is this instance a list?

Returns:
True if this lisp blob is a list

getText

public java.lang.String getText()
Get the text this blob is comprised of


setText

public void setText(java.lang.String strNewText)
Set the text this blob is comprised of.

Parameters:
strNewText -

hasChildren

public boolean hasChildren()
Does this blob have list items?


clearDOM

private void clearDOM()
Clear the DOM ready for a re-parsing


updateDOM

private void updateDOM()
Update the child lists or the node text for this lisp string


stripComments

public static java.lang.String stripComments(java.lang.String lisp)
Remove the comments from a lisp string. May have problems with strings, but you really shouldn't be putting such things into an AI definition file anyway.


stripWhiteSpace

public static java.lang.String stripWhiteSpace(java.lang.String lisp)
Remove redundant whitespace from a lisp string. This can make it a lot easier to parse things. You must remove all comments before performing this action, otherwise behaviour may be undefined.


toList

public java.util.ArrayList toList()
Convert this list to an arraylist