All Implemented Interfaces:
Constraint
Direct Known Subclasses:
AND, MultiPathConstraint, XOR

public class OR extends ConstraintAdapter
Logical OR of several constraints. Each constraint should have the same variable size and should be able to process same variables at the same order. Constraints should be all generative or all non-generative, and they cannot mix.
Author:
Ozgun Babur
  • Constructor Details

    • OR

      public OR(MappedConst... con)
      Constructor with the array of mapped constraints.
      Parameters:
      con - wrapped constraints
  • Method Details

    • satisfies

      public boolean satisfies(Match match, int... ind)
      Checks if any of the wrapped constraints satisfy.
      Specified by:
      satisfies in interface Constraint
      Overrides:
      satisfies in class ConstraintAdapter
      Parameters:
      match - current pattern match
      ind - mapped indices
      Returns:
      true if any of the wrapped constraints satisfy
    • canGenerate

      public boolean canGenerate()
      Can generate only if all of the wrapped constraints are generative.
      Specified by:
      canGenerate in interface Constraint
      Overrides:
      canGenerate in class ConstraintAdapter
      Returns:
      true if none of the wrapped constraints are non-generative
    • getVariableSize

      public int getVariableSize()
      Checks the inner mapping of the wrapped constraints and figures the size.
      Specified by:
      getVariableSize in interface Constraint
      Overrides:
      getVariableSize in class ConstraintAdapter
      Returns:
      the size
    • max

      protected int max(int[] v)
      Gets the max value.
      Parameters:
      v - array to check
      Returns:
      max value
    • generate

      public Collection<BioPAXElement> generate(Match match, int... ind)
      Gets the intersection of the generated values of wrapped constraints.
      Specified by:
      generate in interface Constraint
      Overrides:
      generate in class ConstraintAdapter
      Parameters:
      match - current pattern match
      ind - mapped indices
      Returns:
      intersection of the generated values of wrapped constraints