requirementlogic

package
v0.0.0-...-64dd8ac Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BitsetSolutionIterator

type BitsetSolutionIterator struct {
	// contains filtered or unexported fields
}

BitsetSolutionIterator implements SolutionIterator using a bitset. Iterates through subsets of descriptor IDs in an order that reaches all subsets of the first k input descriptors before adding descriptor k+1.

func NewBitsetIterator

func NewBitsetIterator(req *RequirementLogic, descs []string) *BitsetSolutionIterator

NewBitsetIterator returns a BitsetSolutionIterator instantiated to iterate solutions to req using descriptor IDs in descs.

func (*BitsetSolutionIterator) Next

func (b *BitsetSolutionIterator) Next(excludeIDs []string) []string

Next returns the next valid solution to b's RequirementLogic, or nil if iteration is complete.

type DescriptorIDSet

type DescriptorIDSet = StringSet

DescriptorIDSet is a set of InputDescriptor IDs.

type RequirementLogic

type RequirementLogic struct {
	InputDescriptorIDs []string
	Nested             []*RequirementLogic
	Count              int
	Min                int
	Max                int
}

RequirementLogic is a datatype for processing nested submission requirement logic.

func (*RequirementLogic) GetAllDescriptors

func (r *RequirementLogic) GetAllDescriptors() DescriptorIDSet

GetAllDescriptors returns the IDs of all InputDescriptors referenced in this RequirementLogic or its children.

func (*RequirementLogic) IsSatisfiedBy

func (r *RequirementLogic) IsSatisfiedBy(descs DescriptorIDSet) bool

IsSatisfiedBy returns whether the given requirement logic is satisfied by the given set of descriptors.

func (*RequirementLogic) Iterator

func (r *RequirementLogic) Iterator(descriptors []string) SolutionIterator

Iterator returns a SolutionIterator that iterates through all solutions to req, using the given descriptor IDs.

type SolutionIterator

type SolutionIterator interface {
	// Next returns a list of input descriptor IDs, denoting a set of input
	// descriptors that should satisfy the RequirementLogic this SolutionIterator
	// was created for.
	//
	// Parameter exclude: a list of input descriptors that should be excluded from
	// future iterations (for example, if they were evaluated and no credentials
	// were found to satisfy them).
	Next(exclude []string) []string
}

SolutionIterator iterates through solutions to a RequirementLogic. Each solution is a list of Input Descriptor IDs, that should satisfy the RequirementLogic from which the SolutionIterator has been created.

type SolutionSet

type SolutionSet map[string]DescriptorIDSet

SolutionSet holds sets of InputDescriptor ID. Each set is a combination of InputDescriptorIDs that satisfy the count rules of the SubmissionRequirement that this result was derived from.

type StringSet

type StringSet map[string]struct{}

StringSet implements a set of strings.

func InitFromSlice

func InitFromSlice(values []string) StringSet

InitFromSlice creates a new StringSet containing all the given values.

func MergeAll

func MergeAll(sets ...StringSet) StringSet

MergeAll returns the union of the given StringSet parameters as a new StringSet.

func (StringSet) Add

func (s StringSet) Add(value string)

Add adds value to s.

func (StringSet) Has

func (s StringSet) Has(value string) bool

Has returns whether s contains value.

func (StringSet) Len

func (s StringSet) Len() int

Len returns the size of s.

func (StringSet) ToString

func (s StringSet) ToString() string

ToString creates a string representation of s, guaranteed to be identical for two StringSets containing the same strings.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL