pobs
Class PMatch

java.lang.Object
  extended bypobs.PMatch

public class PMatch
extends java.lang.Object

Immutable class which contains information on success/failure and the length/point-of-failure of a parse.

Author:
Martijn W. van der Lee

Field Summary
static PMatch FALSE
          Convenient constant for single character parsers.
static PMatch TRUE
          Convenient constant for single character parsers.
 
Constructor Summary
PMatch(boolean match, long length)
          Sole constructor.
 
Method Summary
 long getLength()
          Returns the length of the successfull match or the length of the input which could be matched in case of failure.
 boolean isMatch()
          Check whether the match was successful.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRUE

public static final PMatch TRUE
Convenient constant for single character parsers.


FALSE

public static final PMatch FALSE
Convenient constant for single character parsers.

Constructor Detail

PMatch

public PMatch(boolean match,
              long length)
Sole constructor.

Parameters:
match - specifies whether the match is succesful or failed
length - the length of either the success or exact point of failure. In case of a failure, the length needs not be the exact point but doing so will allow the client code to know exactly where a parser failed. POBS' own parsers are all guarenteed to return the exact point of failure.
Method Detail

getLength

public long getLength()
Returns the length of the successfull match or the length of the input which could be matched in case of failure.

Returns:
length of the match or failure

isMatch

public boolean isMatch()
Check whether the match was successful.

Returns:
true only when entire match successful