BitPatternGroup<T, V extends BitPattern<T>> class

Allows matching integer values against a collection of BitPatterns.

A BitPatternGroup is a collection of BitPatterns which may match a given set of bits (represented as an int). Unlike a BitPattern, a BitPatternGroup matches a BitPattern, which in turn can then capture bits:

void example(List<BitPattern<List<int>> patterns, int value) {
  final group = BitPatternGroup.from(patterns);
  final match = group.match(value);

  // Prints out the captured bits.
  print(match.capture(value));
}

This utility is useful for creating decoders (for example, for emulators).

Annotations
  • @sealed

Constructors

BitPatternGroup(List<BitPattern<T>> patterns)
Creates a BitPatternGroup <T, V> from the provided patterns.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

match(int bits) BitPattern<T>?
Returns which BitPattern is capable of decoding the provided bits.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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