|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.proteinshader.structure.visitor.Visitor
org.proteinshader.structure.visitor.ModifierVisitor
public class ModifierVisitor
Knows how to modify multiple Drawable objects while traversing
the hierarchy of objects contained in a Structure.
An AtomModifier, BondModifier, or SegmentModifier can be added to this
Visitor. A newly created Visitor (or a Visitor on which clear() has
been called) will have its RegionMode set to NO_REGIONS, its
ResidueMode set to ALL, and its AAPortionMode set to ENTIRE_AA. Any
of these modes can be changed with the setMode() method on Visitor.
Usage
The following code will set all Atoms and Bonds belonging to a Helix
as invisible.
// Set up Atom and Bond modifications.
AtomModifier atomModifier = new AtomModifier();
atomModifier.setVisibility( VisibilityEnum.INVISIBLE );
BondModifier bondModifier = new BondModifier();
bondModifier.setVisibility( VisibilityEnum.INVISIBLE );
// Add the modifiers to the visitor.
ModifierVisitor visitor = new ModifierVisitor();
visitor.add( atomModifier );
visitor.add( bondModifier );
visitor.setMode( RegionMode.HELICES );
// Use the visitor to modify a Chain.
chain.accept( visitor );
| Constructor Summary | |
|---|---|
ModifierVisitor()
Constructs a ModifierVisitor. |
|
| Method Summary | |
|---|---|
void |
add(AtomModifier modifier)
Adds a AtomModifier. |
void |
add(BondModifier modifier)
Adds a BondModifier. |
void |
add(SegmentModifier modifier)
Adds a SegmentModifier. |
void |
clear()
Clears all memory of previously added Modifiers. |
boolean |
hasAtomModifier()
Returns true if this ModifierVisitor holds an AtomModifier object. |
boolean |
hasBondModifier()
Returns true if this ModifierVisitor holds a BondModifier object. |
boolean |
hasSegmentModifier()
Returns true if this ModifierVisitor holds a SegmentModifier object. |
void |
visit(Atom atom)
If an AtomModifier has been added, it will be used to modify the Atom. |
void |
visit(Bond bond)
If a BondModifier has been added, it will be used to modify the Bond. |
void |
visit(Segment segment)
If a SegmentModifier has been added, it will be used to modify the Segment. |
| Methods inherited from class org.proteinshader.structure.visitor.Visitor |
|---|
includeAAHetAndWater, setDebug, setMode, setMode, setMode, setMode, setMode, setMode, setVisitSegments, visit, visit, visit, visit, visit, visit, visit, visit, visit |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ModifierVisitor()
| Method Detail |
|---|
public void clear()
clear in class Visitorpublic void add(AtomModifier modifier)
modifier - the AtomModifier to use.public void add(BondModifier modifier)
modifier - the BondModifier to use.public void add(SegmentModifier modifier)
modifier - the SegmentModifier to use.
public void visit(Segment segment)
throws VisitorException
visit in class Visitorsegment - the Segment to modify.
VisitorException - if an error occurs during modifications.
public void visit(Atom atom)
throws VisitorException
visit in class Visitoratom - the Atom to modify.
VisitorException - if an error occurs during modifications.
public void visit(Bond bond)
throws VisitorException
visit in class Visitorbond - the Bond to modify.
VisitorException - if an error occurs during modifications.public boolean hasAtomModifier()
public boolean hasBondModifier()
public boolean hasSegmentModifier()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||