org.proteinshader.structure.visitor
Class Visitor

java.lang.Object
  extended by org.proteinshader.structure.visitor.Visitor
Direct Known Subclasses:
AminoAcidLabelVisitor, BondDestroyerVisitor, BondGeneratorVisitor, BoundsVisitor, FrenetFrameGeneratorVisitor, LoopGeneratorVisitor, ModifierVisitor, SFWriterVisitor, VisibilityVisitor

public class Visitor
extends Object

This self-propelled Visitor knows how to traverse the hierarchy of data objects contained by a Structure.

The default mode is to visit all Atoms of all Residues (AminoAcids, Heterogens, and Water) held by a Chain, but not to visit any Regions (Helices or BetaStrands). Calling clear() will restore this default mode.

The setMode( RegionMode ) method can be used to change the traversal mode to visit regions of secondary structure:

RegionMode.LOOPS
RegionMode.HELICES
RegionMode.BETA_STRANDS
RegionMode.ALL_REGIONS
RegionMode.NO_REGIONS.


If the traversal is set to visit any Regions, setVisitSegments(boolean) will determine whether any Segments are visited (the default is false).

The setMode( ResidueMode ) method can be used to restrict the traversal to only certain Residue types:

ResidueMode.ALL
ResidueMode.AMINO_ACIDS
ResidueMode.AA_AND_HETEROGENS,
ResidueMode.AA_AND_WATERS
ResidueMode.HETEROGENS
ResidueMode.WATERS
ResidueMode.HET_AND_WATERS
ResidueMode.NONE


The setMode( AAPortionMode ) method can be used to restrict the traversal to only a portion of each AminoAcid visited. The AAPortionMode will have no effect if the ResidueMode is set to visit only Heterogens and/or Waters.

AAPortionMode.ENTIRE_AA
AAPortionMode.BACKBONE
AAPortionMode.SIDE_CHAIN
AAPortionMode.N
AAPortionMode.CA
AAPortionMode.C
AAPortionMode.O
AAPortionMode.OXT
AAPortionMode.HA_OR_1HA
AAPortionMode.H_OR_HN


The setMode() method will also accept argument of type AminoAcidEnum, AtomEnum, and String (for an AtomID) to further restrict which Atoms are visited. The default value for any of these restrictions is null, and calling clear() will reset all of them to null.


Constructor Summary
Visitor()
          No-arg constuctor sets ResidueMode.ALL, RegionMode.NO_REGIONS, AAPortionMode to ENTIRE_AA, restrictions (AminoAcid type, Atom type, and Atom ID) to null, and debug to false.
 
Method Summary
 void clear()
          Resets Visitor to default of ResidueMode.ALL, RegionMode.NO_REGIONS, AAPortionMode.ENTIRE_AA, and restrictions (AminoAcid type, Atom type, and Atom ID) to null.
 void includeAAHetAndWater(boolean includeAminoAcids, boolean includeHeterogens, boolean includeWaters)
          Sets the mode to include or exclude AminoAcids, Heterogens, and Waters.
 void setDebug(boolean debug)
          Sets debug to true or false.
 void setMode(AAPortionMode aaPortionMode)
          Sets the traversal mode with regard to what portion of each AminoAcid should be visited: ENTIRE_AA, BACKBONE, SIDE_CHAIN, N, CA, C, O, or OXT.
 void setMode(AminoAcidEnum aminoAcidType)
          Restricts the traversal to a particular AminoAcid type (this mode can also be used to restrict which Segments are visited).
 void setMode(AtomEnum atomType)
          Sets the traversal mode with regard to Atom type.
 void setMode(RegionMode regionMode)
          Sets the traversal mode with regard to Regions: NO_REGIONS, LOOPS, HELICES, BETA_STRANDS, or ALL_REGIONS.
 void setMode(ResidueMode residueMode)
          Sets the traversal mode with regard to what kind of Residues should be visited: ALL, AMINO_ACIDS, AA_AND_HETEROGENS, AA_AND_WATERS, HETEROGENS, WATERS, HET_AND_WATERS, or NONE.
 void setMode(String atomID)
          Restricts the traversal to an atomID (as examples, all alpha carbons have the atomID of "CA", and all carbonyl oxygens have the atomID of "O").
 void setVisitSegments(boolean visitSegments)
          Sets a boolean to indicate that Segments should be visited
 void visit(AminoAcid aminoAcid)
          Traverses all Atoms owned by the AminoAcid if AAPortionMode is set to ENTIRE_AA.
 void visit(Atom atom)
          Traverses all Bonds owned by the Atom.
 void visit(BetaStrand betaStrand)
          If debug is true, the betaStrandID, startResidueID, and endResidueID will be printed to standard out.
 void visit(Bond bond)
          If debug is true, the atomID of both the source Atom and the destination Atom will be printed to standard out.
 void visit(Chain chain)
          Uses the current ResidueMode to determine if it should traverse the AminoAcids, Heterogens, and/or Waters owned by the Chain.
 void visit(Helix helix)
          If debug is true, the helixID, startResidueID, and endResidueID will be printed to standard out.
 void visit(Heterogen heterogen)
          Traverses all Atoms owned by the Heterogen.
 void visit(Loop loop)
          If debug is true, the loopID will be printed to standard out.
 void visit(Model model)
          Traverses all Chains owned by the Model.
 void visit(Segment segment)
          If debug is true, the segmentID will be printed to standard out.
 void visit(Structure structure)
          Traverses all Models owned by the Structure.
 void visit(Water water)
          Traverses all Atoms owned by the Water.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Visitor

public Visitor()
No-arg constuctor sets ResidueMode.ALL, RegionMode.NO_REGIONS, AAPortionMode to ENTIRE_AA, restrictions (AminoAcid type, Atom type, and Atom ID) to null, and debug to false.

Method Detail

clear

public void clear()
Resets Visitor to default of ResidueMode.ALL, RegionMode.NO_REGIONS, AAPortionMode.ENTIRE_AA, and restrictions (AminoAcid type, Atom type, and Atom ID) to null.


setMode

public void setMode(RegionMode regionMode)
Sets the traversal mode with regard to Regions: NO_REGIONS, LOOPS, HELICES, BETA_STRANDS, or ALL_REGIONS. If null is given as an argument, the mode is set to NO_REGIONS.

Parameters:
regionMode - the Region(s) to visit.

setMode

public void setMode(ResidueMode residueMode)
Sets the traversal mode with regard to what kind of Residues should be visited: ALL, AMINO_ACIDS, AA_AND_HETEROGENS, AA_AND_WATERS, HETEROGENS, WATERS, HET_AND_WATERS, or NONE. If null is given as an argument, the mode will be set to ALL.

Parameters:
residueMode - the Residues to visit.

includeAAHetAndWater

public void includeAAHetAndWater(boolean includeAminoAcids,
                                 boolean includeHeterogens,
                                 boolean includeWaters)
Sets the mode to include or exclude AminoAcids, Heterogens, and Waters. This method is an alternative to using setMode( ResidueMode ) with modes of ALL, AMINO_ACIDS, AA_AND_HETEROGENS, AA_AND_WATERS, HETEROGENS, WATERS, HET_AND_WATERS, or NONE.

Parameters:
includeAminoAcids - true if AminoAcids should be visited.
includeHeterogens - true if Heterogens should be visited.
includeWaters - true if Waters should be visited.

setMode

public void setMode(AAPortionMode aaPortionMode)
Sets the traversal mode with regard to what portion of each AminoAcid should be visited: ENTIRE_AA, BACKBONE, SIDE_CHAIN, N, CA, C, O, or OXT. If null is given as an argument, the mode will be set to ENTIRE_AA.

Parameters:
aaPortionMode - the AminoAcid portion to visit.

setMode

public void setMode(AminoAcidEnum aminoAcidType)
Restricts the traversal to a particular AminoAcid type (this mode can also be used to restrict which Segments are visited). An argument of null means that there will be no restriction based on AminoAcid type.

Parameters:
aminoAcidType - the AminoAcid type as an enum.

setMode

public void setMode(AtomEnum atomType)
Sets the traversal mode with regard to Atom type.

Parameters:
atomType - the Atom type as an enum.

setMode

public void setMode(String atomID)
Restricts the traversal to an atomID (as examples, all alpha carbons have the atomID of "CA", and all carbonyl oxygens have the atomID of "O").

Parameters:
atomID - the Atom ID as a String.

setVisitSegments

public void setVisitSegments(boolean visitSegments)
Sets a boolean to indicate that Segments should be visited

Parameters:
visitSegments - true or false.

setDebug

public void setDebug(boolean debug)
Sets debug to true or false.

Parameters:
debug - true or false.

visit

public void visit(Structure structure)
           throws VisitorException
Traverses all Models owned by the Structure.

If debug is true, the structureID will be printed to standard out before traversing the Models.

Parameters:
structure - the Structure to visit.
Throws:
VisitorException - if a problem occurs while visiting a node.

visit

public void visit(Model model)
           throws VisitorException
Traverses all Chains owned by the Model.

If debug is true, the modelID will be printed to standard out before traversing the Chains.

Parameters:
model - the Model to visit.
Throws:
VisitorException - if a problem occurs while visiting the Model.

visit

public void visit(Chain chain)
           throws VisitorException
Uses the current ResidueMode to determine if it should traverse the AminoAcids, Heterogens, and/or Waters owned by the Chain.

If debug is true, the chainID will be printed to standard out before traversing any Residues.

Parameters:
chain - the Chain to visit.
Throws:
VisitorException - if a problem occurs while visiting the Chain.

visit

public void visit(Loop loop)
           throws VisitorException
If debug is true, the loopID will be printed to standard out.

Parameters:
loop - the Loop to visit.
Throws:
VisitorException - if a problem occurs while visiting the Loop.

visit

public void visit(Helix helix)
           throws VisitorException
If debug is true, the helixID, startResidueID, and endResidueID will be printed to standard out.

Parameters:
helix - the Helix to visit.
Throws:
VisitorException - if a problem occurs while visiting the Helix.

visit

public void visit(BetaStrand betaStrand)
           throws VisitorException
If debug is true, the betaStrandID, startResidueID, and endResidueID will be printed to standard out.

Parameters:
betaStrand - the BetaStrand to visit.
Throws:
VisitorException - if a problem occurs while visiting the BetaStrand.

visit

public void visit(AminoAcid aminoAcid)
           throws VisitorException
Traverses all Atoms owned by the AminoAcid if AAPortionMode is set to ENTIRE_AA. To traverse only a subset of the Atoms, AAPortionMode can be set to BACKBONE, SIDE_CHAIN, N, CA, C, O, or OXT.

If debug is true, the residueID will be printed to standard out before traversing any Atoms.

Parameters:
aminoAcid - the AminoAcid to visit.
Throws:
VisitorException - if a problem occurs while visiting the AminoAcid.

visit

public void visit(Heterogen heterogen)
           throws VisitorException
Traverses all Atoms owned by the Heterogen.

If debug is true, the residueID will be printed to standard out before traversing any Atoms.

Parameters:
heterogen - the Heterogen to visit.
Throws:
VisitorException - if a problem occurs while visiting the Heterogen.

visit

public void visit(Water water)
           throws VisitorException
Traverses all Atoms owned by the Water.

If debug is true, the residueID will be printed to standard out before traversing any Atoms.

Parameters:
water - the Water to visit.
Throws:
VisitorException - if a problem occurs while visiting the Water.

visit

public void visit(Atom atom)
           throws VisitorException
Traverses all Bonds owned by the Atom.

If debug is true, the atomID will be printed to standard out before traversing any Atoms.

Parameters:
atom - the Atom to visit.
Throws:
VisitorException - if a problem occurs while visiting the Atom.

visit

public void visit(Bond bond)
           throws VisitorException
If debug is true, the atomID of both the source Atom and the destination Atom will be printed to standard out.

Parameters:
bond - the Bond to visit.
Throws:
VisitorException - if a problem occurs while visiting the Atom.

visit

public void visit(Segment segment)
           throws VisitorException
If debug is true, the segmentID will be printed to standard out.

Parameters:
segment - the Segment to visit.
Throws:
VisitorException - if a problem occurs while visiting the Segment.


Copyright © 2007-2008