org.xmloperator.lambda.tree.serialize
Class PrefixedSerializer

java.lang.Object
  |
  +--org.xmloperator.lambda.tree.serialize.PrefixedSerializer
All Implemented Interfaces:
Serializer

public class PrefixedSerializer
extends java.lang.Object
implements Serializer

Prefixed Expression serializer designed for storage purpose but also convenient for a human reader.

--- Term syntax (API style)

 Term ::= Leaf | EndOfScope | Abstraction | Application
 Leaf ::= 'v'
 EndOfScope ::= 'e' Term
 Abstraction ::= 'a' Term
 Application ::= 'c' Term Term
 


Field Summary
static java.lang.String STYLE_API
           
static java.lang.String STYLE_SCOPE
           
 
Constructor Summary
PrefixedSerializer()
           
PrefixedSerializer(java.lang.String style)
           
 
Method Summary
static void main(java.lang.String[] args)
           
 Term readTerm(java.io.Reader reader, TermFactory termFactory)
          Produces a Term from a previous serialization.
static boolean test(java.io.PrintStream out, boolean isVerbose)
          Serializes in and out some terms.
 void underlineRedex(java.io.PrintWriter out, Term rootTerm, Application underlinedRedex)
          Writes a string value that underline a redex.
 void underlineTerm(java.io.PrintWriter out, Term rootTerm, Term underlinedTerm)
          Writes a string value that underline a sub-Term.
 void writeTerm(java.io.PrintWriter out, Term rootTerm)
          Writes a Term.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STYLE_API

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

STYLE_SCOPE

public static final java.lang.String STYLE_SCOPE
See Also:
Constant Field Values
Constructor Detail

PrefixedSerializer

public PrefixedSerializer()

PrefixedSerializer

public PrefixedSerializer(java.lang.String style)
Method Detail

main

public static void main(java.lang.String[] args)

test

public static boolean test(java.io.PrintStream out,
                           boolean isVerbose)
Serializes in and out some terms.

Parameters:
out - the PrintStream to print results. May be null.
isVerbose - if true then all tests have to be displayed.
Returns:
true if all is Ok.

writeTerm

public void writeTerm(java.io.PrintWriter out,
                      Term rootTerm)
Description copied from interface: Serializer
Writes a Term.

Specified by:
writeTerm in interface Serializer
Parameters:
out - a PrintWriter.
rootTerm - a Term to write out.

underlineTerm

public void underlineTerm(java.io.PrintWriter out,
                          Term rootTerm,
                          Term underlinedTerm)
Description copied from interface: Serializer
Writes a string value that underline a sub-Term.

Specified by:
underlineTerm in interface Serializer
Parameters:
out - a PrintWriter.
rootTerm - a Term.
underlinedTerm - a sub-Term to underline.

underlineRedex

public void underlineRedex(java.io.PrintWriter out,
                           Term rootTerm,
                           Application underlinedRedex)
Description copied from interface: Serializer
Writes a string value that underline a redex.

Specified by:
underlineRedex in interface Serializer
Parameters:
out - a PrintWriter.
rootTerm - a Term.
underlinedRedex - a redex to underline.

readTerm

public Term readTerm(java.io.Reader reader,
                     TermFactory termFactory)
              throws java.io.IOException
Description copied from interface: Serializer
Produces a Term from a previous serialization.

Specified by:
readTerm in interface Serializer
Parameters:
reader - a Reader.
termFactory - the factory for building the Term.
Returns:
the created Term.
java.io.IOException