org.kefirsf.bb.proc
Class ProcCode

java.lang.Object
  extended by org.kefirsf.bb.proc.ProcCode
All Implemented Interfaces:
Comparable<ProcCode>

public class ProcCode
extends Object
implements Comparable<ProcCode>

The bbcode class

Author:
Kefir

Constructor Summary
ProcCode(ProcPattern pattern, ProcTemplate template, String name, int priority)
          Create the bb-code with priority
 
Method Summary
 int compareTo(ProcCode code)
          Compare by priorities
 boolean equals(Object o)
           
 String getName()
          Get code name
 int hashCode()
           
 boolean process(Context context)
          Parse bb-code

Before invocation suspicious method must be call

 boolean startsWithConstant()
           
 boolean suspicious(Source source)
          Check if next sequence can be parsed with this code.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProcCode

public ProcCode(ProcPattern pattern,
                ProcTemplate template,
                String name,
                int priority)
Create the bb-code with priority

Parameters:
pattern - pattern to parse the source text
template - template to build target text
name - name of code
priority - priority. If priority higher then code be checking early.
Method Detail

process

public boolean process(Context context)
                throws IOException,
                       org.kefirsf.bb.proc.NestingException
Parse bb-code

Before invocation suspicious method must be call

Parameters:
context - the bb-processing context
Returns:
true - if parse source false - if can't parse code
Throws:
IOException - if can't append to target
NestingException - if nesting is too big.

suspicious

public boolean suspicious(Source source)
Check if next sequence can be parsed with this code. It's most called method in this project.

Parameters:
source - text source
Returns:
true - if next sequence can be parsed with this code; false - only if next sequence can't be parsed with this code.

compareTo

public int compareTo(ProcCode code)
Compare by priorities

Specified by:
compareTo in interface Comparable<ProcCode>

getName

public String getName()
Get code name

Returns:
code name

startsWithConstant

public boolean startsWithConstant()

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2013. All Rights Reserved.