org.kefirsf.bb.proc
Class Source

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

public class Source
extends Object

Класс источник для парсинга BB-кодов

Author:
Kefir

Constructor Summary
Source(CharSequence text)
          Create source class.
 
Method Summary
 int find(PatternConstant constant)
          Find constant in source text.
 int getLength()
          Return length of source text
 int getOffset()
          Return current offset.
 boolean hasNext()
          Есть ли еще что-то в строке?
 void incOffset()
          Increment offset.
 void incOffset(int increment)
          Increment offset.
 char next()
          Return next character and increment offset.
 boolean nextIs(PatternConstant constant)
          Test id next sequence the constant?
 boolean nextMayBeConstant()
          Check if the current sub sequence can be constant.
 void setConstantSet(Set<PatternConstant> constantSet)
          Set constant set from configuration.
 void setOffset(int offset)
          Set offset.
 CharSequence sub(int end)
          Получает строку от текущего смещения до значения end
 CharSequence subToEnd()
          Get String from offset to end.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Source

public Source(CharSequence text)
Create source class.

Parameters:
text - source text.
Method Detail

nextMayBeConstant

public boolean nextMayBeConstant()
Check if the current sub sequence can be constant.


setConstantSet

public void setConstantSet(Set<PatternConstant> constantSet)
Set constant set from configuration. For fast search.


nextIs

public boolean nextIs(PatternConstant constant)
Test id next sequence the constant?

Parameters:
constant - constant pattern element
Returns:
true if next sub sequence is constant.

find

public int find(PatternConstant constant)
Find constant in source text.

Parameters:
constant - constant pattern element
Returns:
index of constant of negative if don't find.

next

public char next()
Return next character and increment offset.

Returns:
character.

getOffset

public int getOffset()
Return current offset.

Returns:
offset from begin.

incOffset

public void incOffset()
Increment offset.


incOffset

public void incOffset(int increment)
Increment offset.

Parameters:
increment - increment size.

setOffset

public void setOffset(int offset)
Set offset.

Parameters:
offset - new offset value.

hasNext

public boolean hasNext()
Есть ли еще что-то в строке?

Returns:
true - если есть false если достигнут конец строки

getLength

public int getLength()
Return length of source text

Returns:
length of source text

sub

public CharSequence sub(int end)
Получает строку от текущего смещения до значения end

Parameters:
end - последний индекс
Returns:
подстрока

subToEnd

public CharSequence subToEnd()
Get String from offset to end.

Returns:
char sequence

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.