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

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

public class SequenceBlock
extends java.lang.Object
implements ISequence

The configuration of a block to parse. TODO COMMENT


Constructor Summary
SequenceBlock(Sequence beginHeader, Sequence endHeaderBody, Sequence specHeader, boolean recursiveHeader, SequenceBlock[] inhibsHeader)
          Constructor.
SequenceBlock(Sequence beginHeader, Sequence endHeaderOnly, Sequence endHeaderBody, SequenceBlock[] inhibsHeader, Sequence endBody, Sequence specBody, SequenceBlock[] inhibsBody)
          Constructor.
 
Method Summary
 Sequence getEndHeaderBody()
          Gets the sequence for the ending of the header and the body.
 Sequence getEndHeaderOnly()
          Gets the sequence for the ending of the header.
 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...
 Region searchBeginHeader(java.lang.StringBuffer buffer, int posBegin, int posEnd)
          To find the beginning of the header.
 Region searchEndBodyAtBeginHeader(java.lang.StringBuffer buffer, Region indexOfBeginHeaderFound, int posEnd)
          To find the ending of the body.
 Region searchEndBodyAtEndHeader(java.lang.StringBuffer buffer, Region indexOfEndHeaderFound, int posEnd)
          To find the ending of the body.
 Region searchEndHeaderAtBeginHeader(java.lang.StringBuffer buffer, Region indexOfBeginHeaderFound, int posEnd)
          To find the ending of the header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SequenceBlock

public SequenceBlock(Sequence beginHeader,
                     Sequence endHeaderBody,
                     Sequence specHeader,
                     boolean recursiveHeader,
                     SequenceBlock[] inhibsHeader)
Constructor.

It uses only the header settings.

Parameters:
beginHeader - the sequence for the beginning of the header
endHeaderBody - the sequence for the ending of the header and the body
specHeader - is the escape sequence for the header
recursiveHeader - indicates if the header block can contain itself
inhibsHeader - the blocks to be ignored when We search the sequence for the ending of the header

SequenceBlock

public SequenceBlock(Sequence beginHeader,
                     Sequence endHeaderOnly,
                     Sequence endHeaderBody,
                     SequenceBlock[] inhibsHeader,
                     Sequence endBody,
                     Sequence specBody,
                     SequenceBlock[] inhibsBody)
Constructor. It uses the header and the body settings.

Parameters:
beginHeader - the sequence for the beginning of the header
endHeaderOnly - the sequence for the ending of the header
endHeaderBody - the sequence for the ending of the header and the body
inhibsHeader - the blocks to be ignored when We search the sequence for the ending of the header
endBody - the sequence for the ending of the body
specBody - is the escape sequence for the body
inhibsBody - the blocks to be ignored when We search the sequence for the ending of the block
Method Detail

getEndHeaderOnly

public Sequence getEndHeaderOnly()
Gets the sequence for the ending of the header.

Returns:
the sequence for the ending of the header

getEndHeaderBody

public Sequence getEndHeaderBody()
Gets the sequence for the ending of the header and the body.

Returns:
the sequence for the ending of the header and the body

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[])

searchBeginHeader

public Region searchBeginHeader(java.lang.StringBuffer buffer,
                                int posBegin,
                                int posEnd)
To find the beginning of the header.

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

searchEndBodyAtBeginHeader

public Region searchEndBodyAtBeginHeader(java.lang.StringBuffer buffer,
                                         Region indexOfBeginHeaderFound,
                                         int posEnd)
To find the ending of the body. The beginning of the header is given.

Parameters:
buffer - is the buffer
indexOfBeginHeaderFound - is the beginning index of the header
posEnd - is the ending index
Returns:
the index of the end of the body, Region.NOT_FOUND if the sequence doesn't exist between posBegin and posEnd

searchEndHeaderAtBeginHeader

public Region searchEndHeaderAtBeginHeader(java.lang.StringBuffer buffer,
                                           Region indexOfBeginHeaderFound,
                                           int posEnd)
To find the ending of the header. The beginning of the header is given.

Parameters:
buffer - is the buffer
indexOfBeginHeaderFound - is the beginning index of the header
posEnd - is the ending index
Returns:
the index of the end of the header, Region.NOT_FOUND if the sequence doesn't exist between posBegin and posEnd

searchEndBodyAtEndHeader

public Region searchEndBodyAtEndHeader(java.lang.StringBuffer buffer,
                                       Region indexOfEndHeaderFound,
                                       int posEnd)
To find the ending of the body. The ending of the header is given.

Parameters:
buffer - is the buffer
indexOfEndHeaderFound - is the ending index of the header
posEnd - is the ending index
Returns:
the index of the end of the body, Region.NOT_FOUND if the sequence doesn't exist between posBegin and posEnd

Copyright 2008 Obeo
All Rights Reserved.