Class CachingIntervalSet
java.lang.Object
org.antlr.v4.runtime.misc.IntervalSet
io.github.douira.glsl_transformer.print.CachingIntervalSet
- All Implemented Interfaces:
IntSet
The caching interval set is a regular interval set
IntervalSet but the @link
org.antlr.v4.runtime.misc.IntervalSet#contains(int)} method does caching of
queries. Repeatedly requesting the same query is a common operation and
therefore caching it like this can be helpful.-
Field Summary
Fields inherited from class org.antlr.v4.runtime.misc.IntervalSet
COMPLETE_CHAR_SET, EMPTY_SET, intervals, readonly -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidMakes this method accessible and add cache invalidation.voidclear()Add cache invalidation.booleancontains(int el)Copied from ANTLR'sIntervalSet.contains(int)but with an addition of caching.booleantokenNotOmitted(Token token)Checks if the given token is covered by this set if it's being used as an omission set.Methods inherited from class org.antlr.v4.runtime.misc.IntervalSet
add, add, addAll, and, complement, complement, elementName, elementName, equals, get, getIntervals, getMaxElement, getMinElement, hashCode, isNil, isReadonly, of, of, or, or, remove, setReadonly, size, subtract, subtract, toArray, toIntegerList, toList, toSet, toString, toString, toString, toString
-
Constructor Details
-
CachingIntervalSet
public CachingIntervalSet()
-
-
Method Details
-
contains
public boolean contains(int el)Copied from ANTLR'sIntervalSet.contains(int)but with an addition of caching. The cache size is 1. This method will test the cached interval if it hasn't been invalidated since.- Specified by:
containsin interfaceIntSet- Overrides:
containsin classIntervalSet
-
clear
public void clear()Add cache invalidation.- Overrides:
clearin classIntervalSet
-
add
Makes this method accessible and add cache invalidation.- Overrides:
addin classIntervalSet
-
tokenNotOmitted
Checks if the given token is covered by this set if it's being used as an omission set. Tokens that are included in one of this interval set's sets and aren't hidden are not printed.- Parameters:
token- The token to check- Returns:
trueif the token should be printed
-