org.pandora.self
Class SelfDecompiler

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

public class SelfDecompiler
extends java.lang.Object

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


Field Summary
static long TIMEOUT
           
 
Constructor Summary
SelfDecompiler()
           
 
Method Summary
 java.lang.String decompileStateMachine(Vertex state, Network network)
          Print the Self code for the state machine.
static SelfDecompiler getDecompiler()
           
 boolean getPrintIds()
           
 void printArguments(Vertex equation, Primitive type, java.lang.String[] tokens, boolean reverse, boolean newLine, java.io.Writer writer, java.lang.String indent, java.util.List<Vertex> variables, java.util.List<Vertex> equations, java.util.Set<Vertex> elements, Network network)
          Print the operation arguments.
 void printCase(Vertex equation, java.io.Writer writer, java.lang.String indent, java.util.Set<Vertex> elements, java.util.List<Vertex> newVariables, java.util.List<Vertex> newStates, Network network)
          Print the IF condition and any variables and states that it references.
 boolean printComments(Vertex element, java.io.Writer writer, java.lang.String indent, Network network)
          Print comments
 void printElement(Vertex vertex, java.io.Writer writer, java.lang.String indent, java.util.List<Vertex> equations, java.util.List<Vertex> variables, java.util.Set<Vertex> elements, Network network)
          Print the vertex, either a state, variable, equation, or raw data.
 void printEquation(Vertex equation, java.io.Writer writer, java.lang.String indent, java.util.Set<Vertex> elements, Network network)
          Print the equation and any equations it references that have not been printed.
 void printFormula(Vertex formula, java.io.Writer writer, java.lang.String indent, java.util.List<Vertex> equations, java.util.List<Vertex> variables, java.util.Set<Vertex> elements, Network network)
          Print the variable and any variables it references that have not been printed.
 void printGoto(Vertex equation, java.io.Writer writer, java.lang.String indent, java.util.Set<Vertex> elements, Network network, long start, long timeout)
          Print the GOTO condition and any variables and states that it references.
 void printOperator(Vertex equation, java.io.Writer writer, java.lang.String indent, java.util.List<Vertex> equations, java.util.List<Vertex> variables, java.util.Set<Vertex> elements, Network network)
          Print the equation and any equations it references that have not been printed.
 void printState(Vertex state, java.io.Writer writer, java.lang.String indent, java.util.Set<Vertex> elements, Network network, long start, long timeout)
          Print the state and any referenced states or variables that have not yet been printed.
 void printStateMachine(Vertex state, java.io.Writer writer, Network network, long start, long timeout)
          Print the Self code for the state machine.
 void printVariable(Vertex variable, java.io.Writer writer, java.lang.String indent, java.util.Set<Vertex> elements, Network network)
          Print the variable and any variables it references that have not been printed.
static void setDecompiler(SelfDecompiler compiler)
           
 void setPrintIds(boolean printIds)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TIMEOUT

public static long TIMEOUT
Constructor Detail

SelfDecompiler

public SelfDecompiler()
Method Detail

getDecompiler

public static SelfDecompiler getDecompiler()

setDecompiler

public static void setDecompiler(SelfDecompiler compiler)

decompileStateMachine

public java.lang.String decompileStateMachine(Vertex state,
                                              Network network)
Print the Self code for the state machine.


printStateMachine

public void printStateMachine(Vertex state,
                              java.io.Writer writer,
                              Network network,
                              long start,
                              long timeout)
Print the Self code for the state machine.


printComments

public boolean printComments(Vertex element,
                             java.io.Writer writer,
                             java.lang.String indent,
                             Network network)
                      throws java.io.IOException
Print comments

Throws:
java.io.IOException

printState

public void printState(Vertex state,
                       java.io.Writer writer,
                       java.lang.String indent,
                       java.util.Set<Vertex> elements,
                       Network network,
                       long start,
                       long timeout)
                throws java.io.IOException
Print the state and any referenced states or variables that have not yet been printed.

Throws:
java.io.IOException

printElement

public void printElement(Vertex vertex,
                         java.io.Writer writer,
                         java.lang.String indent,
                         java.util.List<Vertex> equations,
                         java.util.List<Vertex> variables,
                         java.util.Set<Vertex> elements,
                         Network network)
                  throws java.io.IOException
Print the vertex, either a state, variable, equation, or raw data.

Throws:
java.io.IOException

printFormula

public void printFormula(Vertex formula,
                         java.io.Writer writer,
                         java.lang.String indent,
                         java.util.List<Vertex> equations,
                         java.util.List<Vertex> variables,
                         java.util.Set<Vertex> elements,
                         Network network)
                  throws java.io.IOException
Print the variable and any variables it references that have not been printed.

Throws:
java.io.IOException

printVariable

public void printVariable(Vertex variable,
                          java.io.Writer writer,
                          java.lang.String indent,
                          java.util.Set<Vertex> elements,
                          Network network)
                   throws java.io.IOException
Print the variable and any variables it references that have not been printed.

Throws:
java.io.IOException

printArguments

public void printArguments(Vertex equation,
                           Primitive type,
                           java.lang.String[] tokens,
                           boolean reverse,
                           boolean newLine,
                           java.io.Writer writer,
                           java.lang.String indent,
                           java.util.List<Vertex> variables,
                           java.util.List<Vertex> equations,
                           java.util.Set<Vertex> elements,
                           Network network)
                    throws java.io.IOException
Print the operation arguments.

Throws:
java.io.IOException

printEquation

public void printEquation(Vertex equation,
                          java.io.Writer writer,
                          java.lang.String indent,
                          java.util.Set<Vertex> elements,
                          Network network)
                   throws java.io.IOException
Print the equation and any equations it references that have not been printed.

Throws:
java.io.IOException

printOperator

public void printOperator(Vertex equation,
                          java.io.Writer writer,
                          java.lang.String indent,
                          java.util.List<Vertex> equations,
                          java.util.List<Vertex> variables,
                          java.util.Set<Vertex> elements,
                          Network network)
                   throws java.io.IOException
Print the equation and any equations it references that have not been printed.

Throws:
java.io.IOException

printCase

public void printCase(Vertex equation,
                      java.io.Writer writer,
                      java.lang.String indent,
                      java.util.Set<Vertex> elements,
                      java.util.List<Vertex> newVariables,
                      java.util.List<Vertex> newStates,
                      Network network)
               throws java.io.IOException
Print the IF condition and any variables and states that it references.

Throws:
java.io.IOException

printGoto

public void printGoto(Vertex equation,
                      java.io.Writer writer,
                      java.lang.String indent,
                      java.util.Set<Vertex> elements,
                      Network network,
                      long start,
                      long timeout)
               throws java.io.IOException
Print the GOTO condition and any variables and states that it references.

Throws:
java.io.IOException

getPrintIds

public boolean getPrintIds()

setPrintIds

public void setPrintIds(boolean printIds)