## org.biojava.bio
Class CollectionConstraint.Or

    java.lang.Object
      org.biojava.bio.CollectionConstraint.Or

All Implemented Interfaces:
  CollectionConstraint

Enclosing class:
  CollectionConstraint

public static class CollectionConstraint.Or
extends java.lang.Object
implements CollectionConstraint

A collection constraint that accepts items iff they are accepted by either child constraints. This effectively matches the union of the items matched by the two constraints.

Author:
  Matthew Pocock, Thomas Down
For advanced users:
  Use this to combine multiple constraints. You can make one or both of the children Or instances if you need a wider union.

Nested Class Summary

Nested classes inherited from class org.biojava.bio.CollectionConstraint
`CollectionConstraint.AllValuesIn, CollectionConstraint.And, CollectionConstraint.Contains, CollectionConstraint.Or`

Field Summary

Fields inherited from interface org.biojava.bio.CollectionConstraint
`ANY, EMPTY, NONE`

Constructor Summary
`CollectionConstraint.Or(CollectionConstraint c1, CollectionConstraint c2)` Create a new `Or` from two child constraints.

Method Summary
`boolean` `accept(java.lang.Object object)` `accept` returns true if the value fulfills the constraint.
`CollectionConstraint` `getChild1()` Get the first child CollectionConstraint.
`CollectionConstraint` `getChild2()` Get the seccond child CollectionConstraint.
`boolean` `subConstraintOf(CollectionConstraint pc)` `subConstraintOf` returns true if the constraint is a sub-constraint.
`java.lang.String` `toString()`
`boolean` `validateAddValue(java.util.Collection oldcoll, java.lang.Object newvalue)` Return `true` iff the Collection formed by adding `newValue` to `current` would be accepted by this constraint.
`boolean` `validateRemoveValue(java.util.Collection oldcoll, java.lang.Object victim)` Return `true` iff the Collection formed by removing `newValue` from `current` would be accepted by this constraint.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### CollectionConstraint.Or

    public CollectionConstraint.Or(CollectionConstraint c1,
                                   CollectionConstraint c2)

  Create a new `Or` from two child constraints.

Parameters:
  `c1` - the first child
  `c2` - the seccond child
For general use:

Method Detail

### getChild1

    public CollectionConstraint getChild1()

  Get the first child CollectionConstraint.

  Returns:
    the first child CollectionConstraint
  For advanced users:
    Introspect this constraint

### getChild2

    public CollectionConstraint getChild2()

  Get the seccond child CollectionConstraint.

  Returns:
    the seccond child CollectionConstraint
  For advanced users:
    Introspect this constraint

### accept

    public boolean accept(java.lang.Object object)

  Description copied from interface: `CollectionConstraint`
  `accept` returns true if the value fulfills the constraint.

  Specified by:
    `accept` in interface `CollectionConstraint`

### subConstraintOf

    public boolean subConstraintOf(CollectionConstraint pc)

  Description copied from interface: `CollectionConstraint`

  `subConstraintOf` returns true if the constraint is a sub-constraint.

  A pair of constraints super and sub are in a superConstraint/subConstraint relationship if every object accepted by sub is also accepted by super. To put it another way, if instanceOf was used as a set-membership indicator function over some set of objects, then the set produced by super would be a superset of that produced by sub.

  It is not expected that constraints will neccesarily maintain references to super/sub types. It will be more usual to infer this relationship by introspecting the constraints themselves. For example, `CollectionConstraint.ByClass` will infer subConstraintOf by looking at the possible class of all items matching subConstraint.

  Specified by:
    `subConstraintOf` in interface `CollectionConstraint`
  Parameters:
    `pc` - a `CollectionConstraint` to check.
  Returns:
    a `boolean`.

### validateAddValue

    public boolean validateAddValue(java.util.Collection oldcoll,
                                    java.lang.Object newvalue)

  Description copied from interface: `CollectionConstraint`
  Return `true` iff the Collection formed by adding `newValue` to `current` would be accepted by this constraint.

  Specified by:
    `validateAddValue` in interface `CollectionConstraint`

### validateRemoveValue

    public boolean validateRemoveValue(java.util.Collection oldcoll,
                                       java.lang.Object victim)

  Description copied from interface: `CollectionConstraint`
  Return `true` iff the Collection formed by removing `newValue` from `current` would be accepted by this constraint.

  Specified by:
    `validateRemoveValue` in interface `CollectionConstraint`

### toString

    public java.lang.String toString()