org.eclipse.mtl.parser.cst.utils
Class Sequence

java.lang.Object
  extended by org.eclipse.mtl.parser.cst.utils.Sequence
All Implemented Interfaces:
ISequence

public class Sequence
extends java.lang.Object
implements ISequence

The configuration of a sequence to parse.


Constructor Summary
Sequence(java.lang.String token)
          Constructor.
Sequence(java.lang.String[] tokens)
          Constructor.
Sequence(java.lang.String token1, java.lang.String token2)
          Constructor.
Sequence(java.lang.String token1, java.lang.String token2, java.lang.String token3)
          Constructor.
Sequence(java.lang.String token1, java.lang.String token2, java.lang.String token3, java.lang.String token4)
          Constructor.
 
Method Summary
 Region search(java.lang.StringBuffer buffer)
          To find the first offset of this sequence in the given buffer.
 Region search(java.lang.StringBuffer buffer, int posBegin, int posEnd)
          To find the first offset of this sequence in the given buffer.
 Region search(java.lang.StringBuffer buffer, int posBegin, int posEnd, Sequence spec, SequenceBlock[] inhibs)
          To find the first offset of this sequence in the given buffer, ignoring other sequences...
 java.util.List<Region> split(java.lang.StringBuffer buffer, int posBegin, int posEnd, boolean keepSeparator, Sequence spec, SequenceBlock[] inhibs)
          This sequence is used to split the buffer between the given positions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sequence

public Sequence(java.lang.String token)
Constructor.

Parameters:
token - is the single token of the sequence

Sequence

public Sequence(java.lang.String token1,
                java.lang.String token2)
Constructor.

Parameters:
token1 - is the first token of the sequence
token2 - is the second token of the sequence

Sequence

public Sequence(java.lang.String token1,
                java.lang.String token2,
                java.lang.String token3)
Constructor.

Parameters:
token1 - is the first token of the sequence
token2 - is the second token of the sequence
token3 - is the third token of the sequence

Sequence

public Sequence(java.lang.String token1,
                java.lang.String token2,
                java.lang.String token3,
                java.lang.String token4)
Constructor.

Parameters:
token1 - is the first token of the sequence
token2 - is the second token of the sequence
token3 - is the third token of the sequence
token4 - is the forth token of the sequence

Sequence

public Sequence(java.lang.String[] tokens)
Constructor.

Parameters:
tokens - are the tokens of the sequence
Method Detail

search

public Region search(java.lang.StringBuffer buffer)
To find the first offset of this sequence in the given buffer.

Parameters:
buffer - is the buffer
Returns:
the index of the first offset, Region.NOT_FOUND if the sequence doesn't exist

search

public Region search(java.lang.StringBuffer buffer,
                     int posBegin,
                     int posEnd)
To find the first offset of this sequence in the given buffer.

Specified by:
search in interface ISequence
Parameters:
buffer - is the buffer
posBegin - is the beginning index
posEnd - is the ending index
Returns:
the index of the first offset, Region.NOT_FOUND if the sequence doesn't exist between posBegin and posEnd
See Also:
ISequence.search(java.lang.StringBuffer, int, int)

search

public Region search(java.lang.StringBuffer buffer,
                     int posBegin,
                     int posEnd,
                     Sequence spec,
                     SequenceBlock[] inhibs)
To find the first offset of this sequence in the given buffer, ignoring other sequences...

Specified by:
search in interface ISequence
Parameters:
buffer - is the buffer
posBegin - is the beginning index
posEnd - is the ending index
spec - is a specific sequence to ignore
inhibs - are some blocks to ignore
Returns:
the index of the first offset, Region.NOT_FOUND if the sequence doesn't exist between posBegin and posEnd
See Also:
ISequence.search(java.lang.StringBuffer, int, int, org.eclipse.mtl.parser.cst.utils.Sequence, org.eclipse.mtl.parser.cst.utils.SequenceBlock[])

split

public java.util.List<Region> split(java.lang.StringBuffer buffer,
                                    int posBegin,
                                    int posEnd,
                                    boolean keepSeparator,
                                    Sequence spec,
                                    SequenceBlock[] inhibs)
This sequence is used to split the buffer between the given positions. It returns the positions of the different parts. The positions of the separators can be kept.

Parameters:
buffer - is the buffer
posBegin - is the beginning index
posEnd - is the ending index
keepSeparator - indicates if the positions of the separators are kept
spec - is the escape character
inhibs - are the ignored blocks
Returns:
the positions of the different parts

Copyright 2008 Obeo
All Rights Reserved.