org.inria.ns.reflex.util
Interface ObjectConstraint

All Superinterfaces:
Constraint

public interface ObjectConstraint
extends Constraint

A constraint used by scanners to read specific objects under conditions.

Author:
Philippe Poulard

Method Summary
 boolean stopCondition(int sourceIndex, UserData userData, Scanner scanner)
          Evaluate the stop condition from the given parameters.
 

Method Detail

stopCondition

boolean stopCondition(int sourceIndex,
                      UserData userData,
                      Scanner scanner)
                      throws IOException
Evaluate the stop condition from the given parameters.

This condition is evaluated by the scanner to check if it has to append characters to the current buffer.

Parameters:
sourceIndex - The number of characters read so far ; might be useful in certain stop conditions.
userData - Any useful data for building the target object. It is initialized to be empty by the scanner, and it can be updated by this method as one goes along. When the stop condition is realized, this method have to set the definitive target object that will be returned by the scanner (that can be null). Before the stop condition is realized, any intermediate value can be stored within.
scanner - The scanner that reads the input. According to the parsing strategy, if the sequence of characters involved in the stop condition (if any) don't have to be consumed, the relevant methods of the scanner should be involved.
Returns:
true to indicate that the current scan must stop, false if more characters have to be read.
Throws:
IOException - When the scanner cause an error.