belka
Class SelectExpression

java.lang.Object
  extended by belka.SelectExpression

public class SelectExpression
extends Object

Object of this class represents an expression stating set of atoms. Object represents only part of the expression not including boolean logic. The boolean logic is implement by linking with next object and by knowing boolean operation 'and' or 'or' applied to sum values returned by current and next expressions.

For example expression:

val28 and *.CA

will be represented inside of the program by two objects of this class linked by boolean operation 'and'

obj1--and-->obj2

Author:
Alexej Abyzov

Constructor Summary
SelectExpression(boolean notExpr)
          Object constructor
SelectExpression(SelectExpression subExpression, boolean notExpr)
          Object constructor
SelectExpression(String molName, String chainIds, String assemblyName, String assemblyNum, String atomName, boolean notExpr)
          Object constructor
 
Method Summary
 boolean assemblyMaySatisfy(Assembly assembly)
          Returns true if any atom in assembly may satisfy the expression, false otherwise.
 boolean atomMaySatisfy(Atom atom)
          Returns true if the atom may satisfy the expression, false otherwise.
 boolean chainMaySatisfy(Chain chain)
          Returns true if any atom in chain may satisfy the expression, false otherwise.
 boolean isAndBoolean()
          Returns true if boolean operation with next expression is 'and', false otherwise.
 boolean isOrBoolean()
          Returns true if boolean operation with next expression is 'or', false otherwise.
 boolean moleculeMaySatisfy(Molecule mol)
          Returns true if any atom in molecule may satisfy the expression, false otherwise.
 SelectExpression next()
          Returns next expression.
 int numChainsSpecified()
          The function returns the number of chains specified in selection.
 boolean satisfy(Molecule mol, Chain chain, Assembly assembly, Atom atom)
          Checks if specified atom from specified assembly from specified chain from specified molecule satisfies the selection.
 void setAssemblyAttribute(int assemblyAtt)
          Sets assembly attribute.
 void setAtomAttribute(int atomAtt)
          Sets atom attribute.
 boolean setNextAnd(SelectExpression expr)
          Sets next expression and boolean operation 'and' with it.
 boolean setNextOr(SelectExpression expr)
          Sets next expression and boolean operation 'or' with it.
 boolean specifiesChain(Chain chain)
          Checks if given chain is explicitly specified in selection.
 boolean specifiesChainAs(Chain chain, int index)
          Checks if given chain is explicitly specified in selection in specific order.
 boolean specifiesMolecule(Molecule mol)
          Checks if given molecule is explicitly specified in selection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectExpression

public SelectExpression(boolean notExpr)
Object constructor

Parameters:
notExpr - flag for indicating that expression must be reversed.

SelectExpression

public SelectExpression(String molName,
                        String chainIds,
                        String assemblyName,
                        String assemblyNum,
                        String atomName,
                        boolean notExpr)
Object constructor

Parameters:
molName - molecule name. Ignored in selection if null.
chainIds - chain identifie. Ignored in selection if null or length is not one.
assemblyName - assembly name. Ignored in selection if null.
assemblyNum - assembly number. Ignored in selection if not number.
atomName - atom name. Ignored in selection if null.
notExpr - flag for indicating that expression must be reversed.

SelectExpression

public SelectExpression(SelectExpression subExpression,
                        boolean notExpr)
Object constructor

Parameters:
subExpression - sub-expression, i.e. (...) or 1-20.
notExpr - flag to indicate that expression must be reversed.
Method Detail

setAssemblyAttribute

public void setAssemblyAttribute(int assemblyAtt)
Sets assembly attribute.

Parameters:
assemblyAtt - assembly attribute.

setAtomAttribute

public void setAtomAttribute(int atomAtt)
Sets atom attribute.

Parameters:
atomAtt - atom attribute.

isOrBoolean

public boolean isOrBoolean()
Returns true if boolean operation with next expression is 'or', false otherwise.

Returns:
true if boolean operation with next expression is 'or', false otherwise.

isAndBoolean

public boolean isAndBoolean()
Returns true if boolean operation with next expression is 'and', false otherwise.

Returns:
true if boolean operation with next expression is 'and', false otherwise.

next

public SelectExpression next()
Returns next expression.

Returns:
next expression.

setNextOr

public boolean setNextOr(SelectExpression expr)
Sets next expression and boolean operation 'or' with it.

Parameters:
expr - expression to set.
Returns:
true if the expression was set, false if expressin is null or if current expression already has next expression.

setNextAnd

public boolean setNextAnd(SelectExpression expr)
Sets next expression and boolean operation 'and' with it.

Parameters:
expr - expression to set.
Returns:
true if the expression was set, false if expressin is null or if current expression already has next expression.

moleculeMaySatisfy

public boolean moleculeMaySatisfy(Molecule mol)
Returns true if any atom in molecule may satisfy the expression, false otherwise. All the boolean values from linked expressions are summed. Decision is made based on select specification for molecule only, no chains, assamblies, and atoms are checked. The funcion is fast.

Parameters:
mol - molecule to check.
Returns:
true if any atom in molecule may satisfy the expression, false otherwise.

chainMaySatisfy

public boolean chainMaySatisfy(Chain chain)
Returns true if any atom in chain may satisfy the expression, false otherwise. All the boolean values from linked expressions are summed. Decision is made based on select specification for chain only, no molecules, assamblies, and atoms are checked. The funcion is fast.

Parameters:
chain - chain to check.
Returns:
true if any atom in chain may satisfy the expression, false otherwise.

assemblyMaySatisfy

public boolean assemblyMaySatisfy(Assembly assembly)
Returns true if any atom in assembly may satisfy the expression, false otherwise. All the boolean values from linked expressions are summed. Decision is made based on select specification for assembly only, no molecules, chains and atoms are checked. The funcion is fast.

Parameters:
assembly - assembly to check.
Returns:
true if any atom in assembly may satisfy the expression, false otherwise.

atomMaySatisfy

public boolean atomMaySatisfy(Atom atom)
Returns true if the atom may satisfy the expression, false otherwise. All the boolean values from linked expressions are summed. Decision is made based on select specification for atom, no molecules, chains, and assemblys are checked. The funcion is fast.

Parameters:
atom - atom to check.
Returns:
true if the atom may satisfy the expression, false otherwise.

satisfy

public boolean satisfy(Molecule mol,
                       Chain chain,
                       Assembly assembly,
                       Atom atom)
Checks if specified atom from specified assembly from specified chain from specified molecule satisfies the selection. All the boolean values from linked expressions are summed. It's responsibility of the calling function to make sure that input atom belongs to input assembly that belongs to input chain that belongs to input molecule.

Parameters:
mol - molecule to check.
chain - chain to check.
assembly - assembly to check.
atom - atom to check.
Returns:
true or false value.

specifiesMolecule

public boolean specifiesMolecule(Molecule mol)
Checks if given molecule is explicitly specified in selection.

Parameters:
mol - molecule to check.
Returns:
true or false value.

numChainsSpecified

public int numChainsSpecified()
The function returns the number of chains specified in selection.

Returns:
the number of chains specified in selection.

specifiesChain

public boolean specifiesChain(Chain chain)
Checks if given chain is explicitly specified in selection.

Parameters:
chain - chain to check.
Returns:
true or false value.

specifiesChainAs

public boolean specifiesChainAs(Chain chain,
                                int index)
Checks if given chain is explicitly specified in selection in specific order.

Parameters:
chain - chain to check.
index - chain index in selection.
Returns:
true or false value.