lib
Class DotLapReader

java.lang.Object
  extended by lib.DotLapReader
All Implemented Interfaces:
ILAPReader

public class DotLapReader
extends java.lang.Object
implements ILAPReader

The DotLapReader reads in lisp-formatted .lap files and then produces a completed LearnableActionPattern object representing the contents of the file.

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

Constructor Summary
DotLapReader()
           
 
Method Summary
 boolean canRead(java.lang.String strFileName)
          Is the specified file readable to this class?
 java.lang.String getFileContents(java.lang.String strFileName)
          Read the contents of a text file
 LearnableActionPattern load(java.lang.String strFileName)
          Load the specified file and get an action pattern
private  ActionElement parseActionElement(LispBlob blob)
          Parse an action element from a blob of lisp
private  java.util.ArrayList parseActionElementList(LispBlob blob)
          Parse a list of action elements
private  ActionPattern parseActionPattern(java.util.ArrayList elements)
          Parse an arraylist of elements that represents an action pattern
private  Competence parseCompetence(java.util.ArrayList elements)
          Parse a competence block
private  CompetenceElement parseCompetenceElement(LispBlob blob)
          Parse a competence element
private  Documentation parseDocumentation(java.util.ArrayList elements)
          Parse documentation
private  DriveCollection parseDriveCollection(java.util.ArrayList elements, boolean realTime)
          Parse a DC or (R) DC block
private  DriveElement parseDriveElement(LispBlob blob)
          Parse a single drive element
private  java.lang.Object parseElement(LispBlob block)
          Parse a construct from the file
private  java.util.ArrayList parseGoal(LispBlob blob)
          Parse a goal block - This is essentially an actionelement list with a bit of wrapping
private  TimeUnit parseTimeUnit(LispBlob blob)
          Parse a unit of time from a lisp blob
private  java.util.ArrayList parseTrigger(LispBlob blob)
          Parse a trigger block
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DotLapReader

public DotLapReader()
Method Detail

canRead

public boolean canRead(java.lang.String strFileName)
Is the specified file readable to this class?

Specified by:
canRead in interface ILAPReader
Parameters:
fileName - Path to the file to read
Returns:
True if readable, false if not

getFileContents

public java.lang.String getFileContents(java.lang.String strFileName)
Read the contents of a text file

Parameters:
strFile - File to load
Returns:
Contents of file

load

public LearnableActionPattern load(java.lang.String strFileName)
                            throws java.io.FileNotFoundException,
                                   java.io.IOException,
                                   java.lang.Exception
Load the specified file and get an action pattern

Specified by:
load in interface ILAPReader
Parameters:
fileName - File to load
Returns:
Loaded file in the form of an object model
Throws:
java.io.FileNotFoundException
java.io.IOException
java.lang.Exception

parseElement

private java.lang.Object parseElement(LispBlob block)
                               throws java.lang.Exception
Parse a construct from the file

Throws:
java.lang.Exception

parseDocumentation

private Documentation parseDocumentation(java.util.ArrayList elements)
Parse documentation

Parameters:
elements - Arraylist containg documentation elements
Returns:
Documentation construct

parseDriveCollection

private DriveCollection parseDriveCollection(java.util.ArrayList elements,
                                             boolean realTime)
                                      throws java.lang.Exception
Parse a DC or (R) DC block

Throws:
java.lang.Exception

parseDriveElement

private DriveElement parseDriveElement(LispBlob blob)
                                throws java.lang.Exception
Parse a single drive element

Throws:
java.lang.Exception

parseCompetence

private Competence parseCompetence(java.util.ArrayList elements)
                            throws java.lang.Exception
Parse a competence block

Throws:
java.lang.Exception

parseCompetenceElement

private CompetenceElement parseCompetenceElement(LispBlob blob)
                                          throws java.lang.Exception
Parse a competence element

Throws:
java.lang.Exception

parseTrigger

private java.util.ArrayList parseTrigger(LispBlob blob)
                                  throws java.lang.Exception
Parse a trigger block

Throws:
java.lang.Exception

parseGoal

private java.util.ArrayList parseGoal(LispBlob blob)
                               throws java.lang.Exception
Parse a goal block - This is essentially an actionelement list with a bit of wrapping

Throws:
java.lang.Exception

parseActionPattern

private ActionPattern parseActionPattern(java.util.ArrayList elements)
                                  throws java.lang.Exception
Parse an arraylist of elements that represents an action pattern

Throws:
java.lang.Exception

parseActionElementList

private java.util.ArrayList parseActionElementList(LispBlob blob)
                                            throws java.lang.Exception
Parse a list of action elements

Throws:
java.lang.Exception

parseActionElement

private ActionElement parseActionElement(LispBlob blob)
                                  throws java.lang.Exception
Parse an action element from a blob of lisp

Throws:
java.lang.Exception

parseTimeUnit

private TimeUnit parseTimeUnit(LispBlob blob)
                        throws java.lang.Exception
Parse a unit of time from a lisp blob

Throws:
java.lang.Exception