public class

Difference

extends Parser<T>
java.lang.Object
   ↳ com.google.gdata.util.parser.Parser<T>
     ↳ com.google.gdata.util.parser.Difference<T>

Class Overview

The Difference parser matches the prefix of the parse buffer if the left parser matches and the right parser does not. The following is a complicated way of constructing a parser which matches a digit: Parser p = Parser.difference(Chset.ALNUM, Chset.ALPHA); p.parse("0") -> matches "0" p.parse("a") -> no match

See Also

Summary

[Expand]
Inherited Constants
From class com.google.gdata.util.parser.Parser
Fields
private Parser<? super T> left
private Parser<? super T> right
Public Constructors
Difference(Parser<? super T> left, Parser<? super T> right)
Class constructor.
Public Methods
int parse(char[] buf, int start, int end, T data)
Matches the prefix of the buffer (buf[start,end)) being parsed if, and only if, the left sub-parser matches the incoming state of the buffer and the right sub-parser does not match the incoming state of the parse buffer.
[Expand]
Inherited Methods
From class com.google.gdata.util.parser.Parser
From class java.lang.Object

Fields

private Parser<? super T> left

private Parser<? super T> right

Public Constructors

public Difference (Parser<? super T> left, Parser<? super T> right)

Class constructor.

Parameters
left The Parser that must match against the parse buffer.
right The Parser that must not match against the parse buffer.

Public Methods

public int parse (char[] buf, int start, int end, T data)

Matches the prefix of the buffer (buf[start,end)) being parsed if, and only if, the left sub-parser matches the incoming state of the buffer and the right sub-parser does not match the incoming state of the parse buffer. It does not make much sense to specify a right sub-parser that matches the empty string as doing so will cause this function to always return NO_MATCH.

Parameters
buf The character array to match against.
start The start offset of data within the character array to match against.
end The end offset of data within the character array to match against.
data User defined object that is passed to Callback.handle when an Action fires.
See Also