Documentation
¶
Index ¶
- func AtMost(n int, ids ...deppy.Identifier) deppy.Constraint
- func Conflict(id deppy.Identifier) deppy.Constraint
- func Dependency(ids ...deppy.Identifier) deppy.Constraint
- func Mandatory() deppy.Constraint
- func Not() deppy.Constraint
- func Or(identifier deppy.Identifier, isSubjectNegated bool, isOperandNegated bool) deppy.Constraint
- func Prohibited() deppy.Constraint
- type AtMostConstraint
- type ConflictConstraint
- type DependencyConstraint
- type MandatoryConstraint
- type OrConstraint
- type ProhibitedConstraint
- type UserFriendlyConstraint
- type UserFriendlyConstraintMessageFormatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AtMost ¶
func AtMost(n int, ids ...deppy.Identifier) deppy.Constraint
AtMost returns a Constraint that forbids solutions that contain more than n of the Variables identified by the given Identifiers.
func Conflict ¶
func Conflict(id deppy.Identifier) deppy.Constraint
Conflict returns a Constraint that will permit solutions containing either the constrained Variable, the Variable identified by the given Identifier, OrConstraint neither, but not both.
func Dependency ¶
func Dependency(ids ...deppy.Identifier) deppy.Constraint
Dependency returns a Constraint that will only permit solutions containing a given Variable on the condition that at least one of the Variables identified by the given Identifiers also appears in the solution. Identifiers appearing earlier in the argument list have higher preference than those appearing later.
func Mandatory ¶
func Mandatory() deppy.Constraint
Mandatory returns a Constraint that will permit only solutions that contain a particular Variable.
func Not ¶
func Not() deppy.Constraint
func Or ¶
func Or(identifier deppy.Identifier, isSubjectNegated bool, isOperandNegated bool) deppy.Constraint
Or returns a constraints in the form subject OR identifier if isSubjectNegated = true, ~subject OR identifier if isOperandNegated = true, subject OR ~identifier if both are true: ~subject OR ~identifier
func Prohibited ¶
func Prohibited() deppy.Constraint
Prohibited returns a Constraint that will reject any solution that contains a particular Variable. Callers may also decide to omit an Variable from input to Solve rather than Apply such a Constraint.
Types ¶
type AtMostConstraint ¶
type AtMostConstraint struct {
IDs []deppy.Identifier
N int
}
func (*AtMostConstraint) Anchor ¶
func (constraint *AtMostConstraint) Anchor() bool
func (*AtMostConstraint) Apply ¶
func (constraint *AtMostConstraint) Apply(lm deppy.LitMapping, _ deppy.Identifier) z.Lit
func (*AtMostConstraint) Order ¶
func (constraint *AtMostConstraint) Order() []deppy.Identifier
func (*AtMostConstraint) String ¶
func (constraint *AtMostConstraint) String(subject deppy.Identifier) string
type ConflictConstraint ¶
type ConflictConstraint struct {
ConflictingID deppy.Identifier
}
func (*ConflictConstraint) Anchor ¶
func (constraint *ConflictConstraint) Anchor() bool
func (*ConflictConstraint) Apply ¶
func (constraint *ConflictConstraint) Apply(lm deppy.LitMapping, subject deppy.Identifier) z.Lit
func (*ConflictConstraint) Order ¶
func (constraint *ConflictConstraint) Order() []deppy.Identifier
func (*ConflictConstraint) String ¶
func (constraint *ConflictConstraint) String(subject deppy.Identifier) string
type DependencyConstraint ¶
type DependencyConstraint struct {
DependencyIDs []deppy.Identifier
}
func (*DependencyConstraint) Anchor ¶
func (constraint *DependencyConstraint) Anchor() bool
func (*DependencyConstraint) Apply ¶
func (constraint *DependencyConstraint) Apply(lm deppy.LitMapping, subject deppy.Identifier) z.Lit
func (*DependencyConstraint) Order ¶
func (constraint *DependencyConstraint) Order() []deppy.Identifier
func (*DependencyConstraint) String ¶
func (constraint *DependencyConstraint) String(subject deppy.Identifier) string
type MandatoryConstraint ¶
type MandatoryConstraint struct{}
func (*MandatoryConstraint) Anchor ¶
func (constraint *MandatoryConstraint) Anchor() bool
func (*MandatoryConstraint) Apply ¶
func (constraint *MandatoryConstraint) Apply(lm deppy.LitMapping, subject deppy.Identifier) z.Lit
func (*MandatoryConstraint) Order ¶
func (constraint *MandatoryConstraint) Order() []deppy.Identifier
func (*MandatoryConstraint) String ¶
func (constraint *MandatoryConstraint) String(subject deppy.Identifier) string
type OrConstraint ¶
type OrConstraint struct {
Operand deppy.Identifier
IsSubjectNegated bool
IsOperandNegated bool
}
func (*OrConstraint) Anchor ¶
func (constraint *OrConstraint) Anchor() bool
func (*OrConstraint) Apply ¶
func (constraint *OrConstraint) Apply(lm deppy.LitMapping, subject deppy.Identifier) z.Lit
func (*OrConstraint) Order ¶
func (constraint *OrConstraint) Order() []deppy.Identifier
func (*OrConstraint) String ¶
func (constraint *OrConstraint) String(subject deppy.Identifier) string
type ProhibitedConstraint ¶
type ProhibitedConstraint struct{}
func (*ProhibitedConstraint) Anchor ¶
func (constraint *ProhibitedConstraint) Anchor() bool
func (*ProhibitedConstraint) Apply ¶
func (constraint *ProhibitedConstraint) Apply(lm deppy.LitMapping, subject deppy.Identifier) z.Lit
func (*ProhibitedConstraint) Order ¶
func (constraint *ProhibitedConstraint) Order() []deppy.Identifier
func (*ProhibitedConstraint) String ¶
func (constraint *ProhibitedConstraint) String(subject deppy.Identifier) string
type UserFriendlyConstraint ¶
type UserFriendlyConstraint struct {
deppy.Constraint
// contains filtered or unexported fields
}
func NewUserFriendlyConstraint ¶
func NewUserFriendlyConstraint(constraint deppy.Constraint, messageFormatter UserFriendlyConstraintMessageFormatter) *UserFriendlyConstraint
func (*UserFriendlyConstraint) String ¶
func (constraint *UserFriendlyConstraint) String(subject deppy.Identifier) string
type UserFriendlyConstraintMessageFormatter ¶
type UserFriendlyConstraintMessageFormatter func(constraint deppy.Constraint, subject deppy.Identifier) string