org.pandora.self
Class SelfCompiler

java.lang.Object
  extended by org.pandora.self.SelfCompiler

public class SelfCompiler
extends java.lang.Object

Utility class for printing the Self programming model. Self is the language that Pandora programs herself in.


Field Summary
static java.lang.String AND
           
static java.lang.String APPEND
           
static java.lang.String AS
           
static java.lang.String ASSIGN
           
static java.lang.String ASSOCIATE
           
static java.lang.String ASSOCIATED
           
static java.lang.String BY
           
static java.lang.String CALL
           
static java.lang.String CASE
           
static java.lang.String DISSOCIATE
           
static java.lang.String DO
           
static java.lang.String EACH
           
static java.lang.String ELSE
           
static java.lang.String EQUATION
           
static java.lang.String EXCLUDE
           
static java.lang.String FOR
           
static java.lang.String FORMULA
           
static java.lang.String FROM
           
static java.lang.String GET
           
static java.lang.String GOTO
           
static java.lang.String IF
           
static java.lang.String IS
           
static java.lang.String NEW
           
static java.lang.String NOT
           
static java.lang.String OF
           
static java.lang.String ON
           
static java.util.List<java.lang.String> OPERATORS
           
static java.lang.String QUOTIENT
           
static java.lang.String RELATED
           
static java.lang.String RELATION
           
static java.lang.String RETURN
           
static java.lang.String SET
           
static java.lang.String STATE
           
static java.lang.String THEN
           
static java.lang.String TO
           
static java.util.List<java.lang.String> TYPES
           
static java.lang.String VAR
           
static java.lang.String VARIABLE
           
static java.lang.String VERTEX
           
static java.lang.String WITH
           
 
Constructor Summary
SelfCompiler()
           
 
Method Summary
 java.util.List<java.lang.String> getComments(TextStream stream)
           
static SelfCompiler getCompiler()
           
 Vertex parseCase(TextStream stream, java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements, Network network)
          Parse the IF condition.
 Vertex parseElement(TextStream stream, java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements, Network network)
          Parse the reference to either a state, variable, equation, or raw data.
 Vertex parseEquation(TextStream stream, java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements, Network network)
          Parse the equation.
 Vertex parseFormula(TextStream stream, java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements, Network network)
          Parse the equation.
 Vertex parseOperator(Vertex equation, TextStream stream, java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements, Network network)
          Parse the operator.
 Vertex parseState(TextStream stream, java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements, Network network)
          Parse the state and any referenced states or variables.
 Vertex parseStateMachine(java.io.File file, Network network)
          Get the contents of the URL to a .self file and parse it.
 Vertex parseStateMachine(java.io.InputStream stream, Network network, int maxSize)
          Get the contents of the stream to a .self file and parse it.
 Vertex parseStateMachine(java.lang.String code, Network network)
          Parse the code into a vertex state machine defined in the network.
 Vertex parseStateMachine(java.net.URL url, Network network)
          Get the contents of the URL to a .self file and parse it.
 Vertex parseVariable(TextStream stream, java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements, Network network)
          Parse the variable.
static void setCompiler(SelfCompiler compiler)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IF

public static final java.lang.String IF
See Also:
Constant Field Values

CASE

public static final java.lang.String CASE
See Also:
Constant Field Values

CALL

public static final java.lang.String CALL
See Also:
Constant Field Values

FOR

public static final java.lang.String FOR
See Also:
Constant Field Values

EACH

public static final java.lang.String EACH
See Also:
Constant Field Values

ASSIGN

public static final java.lang.String ASSIGN
See Also:
Constant Field Values

TO

public static final java.lang.String TO
See Also:
Constant Field Values

ON

public static final java.lang.String ON
See Also:
Constant Field Values

WITH

public static final java.lang.String WITH
See Also:
Constant Field Values

BY

public static final java.lang.String BY
See Also:
Constant Field Values

OF

public static final java.lang.String OF
See Also:
Constant Field Values

AS

public static final java.lang.String AS
See Also:
Constant Field Values

AND

public static final java.lang.String AND
See Also:
Constant Field Values

GET

public static final java.lang.String GET
See Also:
Constant Field Values

SET

public static final java.lang.String SET
See Also:
Constant Field Values

EXCLUDE

public static final java.lang.String EXCLUDE
See Also:
Constant Field Values

IS

public static final java.lang.String IS
See Also:
Constant Field Values

RELATED

public static final java.lang.String RELATED
See Also:
Constant Field Values

RELATION

public static final java.lang.String RELATION
See Also:
Constant Field Values

ASSOCIATE

public static final java.lang.String ASSOCIATE
See Also:
Constant Field Values

DISSOCIATE

public static final java.lang.String DISSOCIATE
See Also:
Constant Field Values

DO

public static final java.lang.String DO
See Also:
Constant Field Values

NEW

public static final java.lang.String NEW
See Also:
Constant Field Values

APPEND

public static final java.lang.String APPEND
See Also:
Constant Field Values

NOT

public static final java.lang.String NOT
See Also:
Constant Field Values

GOTO

public static final java.lang.String GOTO
See Also:
Constant Field Values

RETURN

public static final java.lang.String RETURN
See Also:
Constant Field Values

QUOTIENT

public static final java.lang.String QUOTIENT
See Also:
Constant Field Values

FROM

public static final java.lang.String FROM
See Also:
Constant Field Values

ASSOCIATED

public static final java.lang.String ASSOCIATED
See Also:
Constant Field Values

THEN

public static final java.lang.String THEN
See Also:
Constant Field Values

ELSE

public static final java.lang.String ELSE
See Also:
Constant Field Values

OPERATORS

public static java.util.List<java.lang.String> OPERATORS

VARIABLE

public static final java.lang.String VARIABLE
See Also:
Constant Field Values

VERTEX

public static final java.lang.String VERTEX
See Also:
Constant Field Values

VAR

public static final java.lang.String VAR
See Also:
Constant Field Values

STATE

public static final java.lang.String STATE
See Also:
Constant Field Values

EQUATION

public static final java.lang.String EQUATION
See Also:
Constant Field Values

FORMULA

public static final java.lang.String FORMULA
See Also:
Constant Field Values

TYPES

public static java.util.List<java.lang.String> TYPES
Constructor Detail

SelfCompiler

public SelfCompiler()
Method Detail

getCompiler

public static SelfCompiler getCompiler()

setCompiler

public static void setCompiler(SelfCompiler compiler)

parseStateMachine

public Vertex parseStateMachine(java.lang.String code,
                                Network network)
Parse the code into a vertex state machine defined in the network.


parseStateMachine

public Vertex parseStateMachine(java.net.URL url,
                                Network network)
Get the contents of the URL to a .self file and parse it.


parseStateMachine

public Vertex parseStateMachine(java.io.File file,
                                Network network)
Get the contents of the URL to a .self file and parse it.


parseStateMachine

public Vertex parseStateMachine(java.io.InputStream stream,
                                Network network,
                                int maxSize)
Get the contents of the stream to a .self file and parse it.


getComments

public java.util.List<java.lang.String> getComments(TextStream stream)

parseState

public Vertex parseState(TextStream stream,
                         java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements,
                         Network network)
Parse the state and any referenced states or variables.


parseElement

public Vertex parseElement(TextStream stream,
                           java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements,
                           Network network)
Parse the reference to either a state, variable, equation, or raw data. One of, STATE:1234("name"), VARIABLE:1234("name"), EQUATION:1234("name"), 1234, "string", DATE("1972,01,01"), ...


parseVariable

public Vertex parseVariable(TextStream stream,
                            java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements,
                            Network network)
Parse the variable.


parseEquation

public Vertex parseEquation(TextStream stream,
                            java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements,
                            Network network)
Parse the equation.


parseFormula

public Vertex parseFormula(TextStream stream,
                           java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements,
                           Network network)
Parse the equation.


parseOperator

public Vertex parseOperator(Vertex equation,
                            TextStream stream,
                            java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements,
                            Network network)
Parse the operator.


parseCase

public Vertex parseCase(TextStream stream,
                        java.util.Map<java.lang.String,java.util.Map<java.lang.String,Vertex>> elements,
                        Network network)
Parse the IF condition.