Top Fields Constructors Methods
com.sun.javafx.css.parser

public final Class TokenStream

extends Object
Class Inheritance
Imports
java.util.List, java.util.function.Predicate

Field Summary

Modifier and TypeField and Description
private int
private Token
private final int
private final List<Token>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Token

Returns:

the token, or null if there are no tokens left in the stream
consume
()

Consumes and returns the next token in the token stream.

public Token

Returns:

the token, or null if there are no tokens left in the stream, or if the next token didn't satisfy the predicate
consumeIf
(Predicate<Token>
the predicate
predicate
)

Consumes and returns the next token in the token stream if it satisfies the specified predicate.

public Token

Returns:

the token, or null if no token was consumed
current
()

Returns the last token that was consumed from the stream.

public final boolean

Returns:

true if the tokens satisfy the predicates
matches
(Predicate<Token>...
the predicates
predicates
)

Returns whether the next tokens in the stream satisfy the specified predicates.

public Token

Returns:

the token, or null if there are no tokens left in the stream
peek
()

Returns the next token in the stream, but does not consume it.

public void
reconsume()

Pushes the current token back onto the front of the token stream, so that the next time a token is read from the stream, the current token will be reconsumed.

public int

Returns:

the number of tokens in the stream
size
()

Returns the number of tokens in the stream.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

currentIndexback to summary
private int currentIndex
currentItemback to summary
private Token currentItem
sizeback to summary
private final int size
sourceback to summary
private final List<Token> source

Constructor Detail

TokenStreamback to summary
public TokenStream(List<Token> source)

Method Detail

consumeback to summary
public Token consume()

Consumes and returns the next token in the token stream.

Returns:Token

the token, or null if there are no tokens left in the stream

consumeIfback to summary
public Token consumeIf(Predicate<Token> predicate)

Consumes and returns the next token in the token stream if it satisfies the specified predicate.

Parameters
predicate:Predicate<Token>

the predicate

Returns:Token

the token, or null if there are no tokens left in the stream, or if the next token didn't satisfy the predicate

currentback to summary
public Token current()

Returns the last token that was consumed from the stream.

Returns:Token

the token, or null if no token was consumed

matchesback to summary
public final boolean matches(Predicate<Token>... predicates)

Returns whether the next tokens in the stream satisfy the specified predicates.

Parameters
predicates:Predicate<Token>[]

the predicates

Returns:boolean

true if the tokens satisfy the predicates

Annotations
@SafeVarargs
peekback to summary
public Token peek()

Returns the next token in the stream, but does not consume it.

Returns:Token

the token, or null if there are no tokens left in the stream

reconsumeback to summary
public void reconsume()

Pushes the current token back onto the front of the token stream, so that the next time a token is read from the stream, the current token will be reconsumed.

sizeback to summary
public int size()

Returns the number of tokens in the stream.

Returns:int

the number of tokens in the stream