org.gcn.plinguacore.parser.input
Class InputParser

java.lang.Object
  extended by org.gcn.plinguacore.parser.input.InputParser
All Implemented Interfaces:
IParser
Direct Known Subclasses:
PlinguaInputParser, XMLCellLikeInputParser

public abstract class InputParser
extends java.lang.Object
implements IParser

This class provides the common functionality for all input parsers

Author:
Research Group on Natural Computing (http://www.gcn.us.es)

Constructor Summary
InputParser()
          Creates a new InputParser instance
 
Method Summary
 java.io.PrintStream getErrorChannel()
          Gets the errors channel
 java.io.PrintStream getInfoChannel()
          Gets the PrintStream instance to write information
 java.io.PrintStream getMsgChannel()
          Gets the PrintStream instance to write messages
 java.util.Map<java.lang.String,java.util.Set<InputParserMsg>> getReport()
          Gets the report map of the last parsing
 int getVerbosityLevel()
          Gets the verbosity level
 java.io.PrintStream getWarningChannel()
          Gets the PrintStream instance to write warnings
 boolean hasErrors()
          Returns if the parsing process detected any error
 Psystem parse(java.io.InputStream stream)
          Parses an InputStream instance and generates a new P system without any file routes
 Psystem parse(java.io.InputStream stream, java.lang.String[] fileRoutes)
          Parses an InputStream instance and generates a new P system
 Psystem parse(java.io.StringReader reader)
          Parses an StringReader instance and generates a new P system without any file routes
 Psystem parse(java.io.StringReader reader, java.lang.String[] fileRoutes)
          Parses a StringReader instance and generates a new P system without any file routes
 void setErrorChannel(java.io.PrintStream errorChannel)
          Sets the PrintStream instance to write errors
 void setInfoChannel(java.io.PrintStream infoChannel)
          Sets the PrintStream to write information
 void setMsgChannel(java.io.PrintStream msgChannel)
          Sets the PrintStream instance to write messages
 void setVerbosityLevel(int verbosityLevel)
          Sets the verbosity level (usually between 0-5)
 void setWarningChannel(java.io.PrintStream warningChannel)
          Sets the PrintStream instance to write warnings
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputParser

public InputParser()
Creates a new InputParser instance

Method Detail

getErrorChannel

public java.io.PrintStream getErrorChannel()
Gets the errors channel

Returns:
the PrintStream instance to write errors

setErrorChannel

public void setErrorChannel(java.io.PrintStream errorChannel)
Sets the PrintStream instance to write errors

Parameters:
errorChannel - the PrintStream instance to write errors

getInfoChannel

public java.io.PrintStream getInfoChannel()
Gets the PrintStream instance to write information

Returns:
the PrintStream instance to write information

setInfoChannel

public void setInfoChannel(java.io.PrintStream infoChannel)
Sets the PrintStream to write information

Parameters:
infoChannel - the PrintStream instance to write information

getWarningChannel

public java.io.PrintStream getWarningChannel()
Gets the PrintStream instance to write warnings

Returns:
The PrintStream instance to write warnings

setWarningChannel

public void setWarningChannel(java.io.PrintStream warningChannel)
Sets the PrintStream instance to write warnings

Parameters:
warningChannel - the PrintStream instance to write warnings

getVerbosityLevel

public int getVerbosityLevel()
Gets the verbosity level

Returns:
the verbosity level (usually between 0-5)

setVerbosityLevel

public void setVerbosityLevel(int verbosityLevel)
Sets the verbosity level (usually between 0-5)

Parameters:
verbosityLevel - the verbosity level

getMsgChannel

public java.io.PrintStream getMsgChannel()
Gets the PrintStream instance to write messages

Returns:
The PrintStream instance to write messages

setMsgChannel

public void setMsgChannel(java.io.PrintStream msgChannel)
Sets the PrintStream instance to write messages

Parameters:
msgChannel - the PrintStream instance to write messages

parse

public final Psystem parse(java.io.InputStream stream,
                           java.lang.String[] fileRoutes)
                    throws PlinguaCoreException
Parses an InputStream instance and generates a new P system

Parameters:
stream - the stream to be parsed
fileRoutes - an array containing all file routes for each file which compose the stream
Returns:
a new P system or null if it has errors
Throws:
PlinguaCoreException - if the parsing couldn't be committed

parse

public final Psystem parse(java.io.InputStream stream)
                    throws PlinguaCoreException
Parses an InputStream instance and generates a new P system without any file routes

Parameters:
stream - the stream to be parsed
Returns:
a new P system or null if it has errors
Throws:
PlinguaCoreException - if the parsing couldn't be committed

parse

public Psystem parse(java.io.StringReader reader,
                     java.lang.String[] fileRoutes)
              throws PlinguaCoreException
Parses a StringReader instance and generates a new P system without any file routes

Parameters:
reader - the StringReader instance to be parsed
fileRoutes - an array containing all file routes for each file which compose the stream
Returns:
a new P system or null if it has errors
Throws:
PlinguaCoreException - if the parsing couldn't be committed

parse

public final Psystem parse(java.io.StringReader reader)
                    throws PlinguaCoreException
Parses an StringReader instance and generates a new P system without any file routes

Parameters:
reader - the StringReader instance to be parsed
Returns:
a new P system or null if it has errors
Throws:
PlinguaCoreException - if the parsing couldn't be committed

hasErrors

public boolean hasErrors()
Returns if the parsing process detected any error

Returns:
true if the parsing process detected any error, false otherwise

getReport

public java.util.Map<java.lang.String,java.util.Set<InputParserMsg>> getReport()
Gets the report map of the last parsing

Returns:
the report map of the last parsing