BitPattern<T> class abstract

Represents the result of calling BitPatternBuilder.build.

A implementation (typically) has all of the information available to start matching and extracting variables from inputs, and various different implementations are possible.

The default implementation is a pre-computed interpreter.

A BitPattern is Comparable, e.g. it can be sorted in terms of specificity (greatest to least), in order to make it easier to iterate through a List<ComputedBitPattern> and check for matches:

void example(List<ComputedBitPattern> patterns, int bits) {
  for (final pattern in patterns..sort()) {
    if (pattern.matches(bits)) {
      // ...
    }
  }
}

NOTE: You can only compare BitPatterns of the same type!

Implemented types

Constructors

BitPattern()

Properties

hashCode int
The hash code for this object.
no setterinherited
names List<String?>
A list of named variables (to use in conjunction with capture).
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

capture(int input) → T
Returns an element T iff it matches, otherwise null.
compareTo(BitPattern<T> other) int
Compares this object to another object.
inherited
matches(int input) bool
Returns true iff input bits matches this pattern.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited