AssociativeModel constructor

AssociativeModel(
  1. AssociativeMemoryRequest configuration, {
  2. AssociativeModelMatcher? matcher,
})

Creates an initially invalid associative memory.

Implementation

AssociativeModel(this.configuration, {this.matcher}) {
  configuration.validate();
  if (configuration.lookupUpdatePolicy ==
      AssociativeLookupUpdatePolicy.undefined) {
    throw UnsupportedError('An undefined lookup/update policy cannot be '
        'used as a deterministic software model.');
  }

  if ((configuration.matchMode == AssociativeMatchMode.contextQualified) !=
      (matcher != null)) {
    throw ArgumentError('Context-qualified matching requires exactly one '
        'explicit matcher.');
  }
  _storage = SparseMemoryStorage(
      addrWidth: configuration.indexWidth,
      dataWidth: configuration.keyWidth + 1);
}