etomica.nbr
Class CriterionAdapter

java.lang.Object
  extended by etomica.nbr.CriterionAdapter
All Implemented Interfaces:
NeighborCriterion, Serializable
Direct Known Subclasses:
CriterionBondedSimple, CriterionInterMolecular, CriterionMolecular, CriterionType, CriterionTypePair, CriterionTypesCombination, CriterionTypesMulti

public abstract class CriterionAdapter
extends Object
implements NeighborCriterion, Serializable

Wraps another criterion while adding additional criteria to the acceptance decision. Used to introduce criteria related to the species, molecule, and other identifiers of the pair. Does not normally consider atom positions, but defers this to the wrapped iterator. Consequently the methods needUpdate, unsafe, and others that related to the atom configurations are simply passed on to the wrapped criterion.

See Also:
Serialized Form

Field Summary
protected  NeighborCriterion subCriterion
           
 
Constructor Summary
CriterionAdapter(NeighborCriterion criterion)
          Constructs criterion that wraps the given criterion.
 
Method Summary
abstract  boolean accept(IAtomList pair)
          Implementation of this method should introduce new criterion and return true if pair meets this criterion and that of the wrapped NeighborCriterion.
 NeighborCriterion getWrappedCriterion()
          Returns the criterion wrapped by this adapter
 boolean needUpdate(IAtom atom)
          Indicates whether the neighbor list for the given atom should be updated, according to the wrapped criterion.
 void reset(IAtom atom)
          Indicates to wrapped criterion that given atom's neighbor list has just been updated, and that properties (e.g., record of atom's position) used by needUpdate and unsafe() methods should be reset.
 void setBox(IBox box)
          Specifies to the wrapped criterion the box where the criterion is being applied.
 boolean unsafe()
          Indicates whether the atom has changed (e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

subCriterion

protected final NeighborCriterion subCriterion
Constructor Detail

CriterionAdapter

public CriterionAdapter(NeighborCriterion criterion)
Constructs criterion that wraps the given criterion.

Parameters:
criterion -
Method Detail

getWrappedCriterion

public final NeighborCriterion getWrappedCriterion()
Returns the criterion wrapped by this adapter


accept

public abstract boolean accept(IAtomList pair)
Implementation of this method should introduce new criterion and return true if pair meets this criterion and that of the wrapped NeighborCriterion.

Specified by:
accept in interface NeighborCriterion

needUpdate

public boolean needUpdate(IAtom atom)
Indicates whether the neighbor list for the given atom should be updated, according to the wrapped criterion.

Specified by:
needUpdate in interface NeighborCriterion
Returns:
true if the atom's list should be updated.

setBox

public void setBox(IBox box)
Specifies to the wrapped criterion the box where the criterion is being applied. Sometimes needed if the criterion depends on features of the box, such as the volume.

Specified by:
setBox in interface NeighborCriterion

unsafe

public boolean unsafe()
Indicates whether the atom has changed (e.g. moved) by an amount that might have caused its wrapped-criterion neighbor list to be invalid. If this method returns true, a neighbor list failure may have introduced errors in the calculation.

Specified by:
unsafe in interface NeighborCriterion

reset

public void reset(IAtom atom)
Indicates to wrapped criterion that given atom's neighbor list has just been updated, and that properties (e.g., record of atom's position) used by needUpdate and unsafe() methods should be reset.

Specified by:
reset in interface NeighborCriterion