org.kefirsf.bb.proc
Class Context

java.lang.Object
  extended by org.kefirsf.bb.proc.Context

public class Context
extends Object

The bb-processing context

Author:
Kefir

Constructor Summary
Context()
          Default constructor
Context(Context parent)
          Constructor of child-context
 
Method Summary
 void addBadTag(int offset)
          Add the bag tag position
 boolean checkBadTag(int offset)
          Check the bag tag
 void checkNesting()
          Check nesting.
 Object getAttribute(String name)
          Get the context attribute.
 Object getLocalAttribute(String name)
          Return attribute from this context, not parent
 ProcScope getScope()
           
 Source getSource()
           
 Appendable getTarget()
           
 ProcPatternElement getTerminator()
          get Text terminator,this mark stop text processing
 boolean hasNextAdjustedForTerminator()
          Check has chars in source before terminator or not
 void mergeWithParent()
          Put all local attributes to parent context
 void setAttribute(String name, Object value)
          Add or set context attribute
 void setNestingLimit(int nestingLimit)
          Set nesting limit for this context.
 void setScope(ProcScope scope)
          Set list of codes in current context
 void setSource(Source source)
           
 void setTarget(Appendable target)
           
 void setTerminator(ProcPatternElement terminator)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Context

public Context()
Default constructor


Context

public Context(Context parent)
Constructor of child-context

Parameters:
parent - parent context
Method Detail

addBadTag

public void addBadTag(int offset)
Add the bag tag position

Parameters:
offset - offset of bad tag in source

checkBadTag

public boolean checkBadTag(int offset)
Check the bag tag

Parameters:
offset - offset of tag
Returns:
true if at this ofsset tag is bad

hasNextAdjustedForTerminator

public boolean hasNextAdjustedForTerminator()
Check has chars in source before terminator or not

Returns:
true if chars exists false if chars canceled

mergeWithParent

public void mergeWithParent()
Put all local attributes to parent context


setAttribute

public void setAttribute(String name,
                         Object value)
Add or set context attribute

Parameters:
name - attribute name
value - attribute value

getAttribute

public Object getAttribute(String name)
Get the context attribute. If attribute not exists in current context, then context search the sttribute in parent context

Parameters:
name - attribute name
Returns:
attribute value

getLocalAttribute

public Object getLocalAttribute(String name)
Return attribute from this context, not parent

Parameters:
name - attribute name
Returns:
attribute value

setScope

public void setScope(ProcScope scope)
Set list of codes in current context

Parameters:
scope - code scope

getSource

public Source getSource()

setSource

public void setSource(Source source)

getTarget

public Appendable getTarget()

setTarget

public void setTarget(Appendable target)

getTerminator

public ProcPatternElement getTerminator()
get Text terminator,this mark stop text processing

Returns:
terminator

setTerminator

public void setTerminator(ProcPatternElement terminator)
Parameters:
terminator - Text terminator,this mark stop text processing

getScope

public ProcScope getScope()

setNestingLimit

public void setNestingLimit(int nestingLimit)
Set nesting limit for this context.

Parameters:
nestingLimit - nesting limit

checkNesting

public void checkNesting()
                  throws org.kefirsf.bb.proc.NestingException
Check nesting.

Throws:
NestingException - if nesting limit less than 0.


Copyright © 2013. All Rights Reserved.