edu.mssm.crover.domain2d
Class ResidueGlyphFactoryImpl

java.lang.Object
  |
  +--edu.mssm.crover.domain2d.ResidueGlyphFactoryImpl
All Implemented Interfaces:
ResidueGlyphFactory

public class ResidueGlyphFactoryImpl
extends java.lang.Object
implements ResidueGlyphFactory

Factory to create ResidueGlyphs. Basic implementation: simply calls new ResidueGlyph(model) each time a creation is requested, and keep track of the glyphs the factory created. Provides a convenient lookup method to find a residue glyph previously built.


Constructor Summary
ResidueGlyphFactoryImpl(int glyph_number)
           
 
Method Summary
 ResidueGlyph createResidueGlyph(ResidueModel model)
          Create a residue glyph.
 ResidueGlyph findGlyph(int position)
          Returns the residue glyph that represents this model.
 ResidueGlyph findGlyph(ResidueModel model)
          Returns the residue glyph that represents this model.
 int getBorder()
          Returns the width of the invisible border around residue glyphs.
 int getGLyphCount()
          Returns the number of glyphs this factory built.
 ResidueGlyph[] getGlyphs()
          Returns the glyphs built by this factory.
 double getInterGlyphDistance()
          Returns the suggested inter-glyph distance.
 java.awt.geom.Rectangle2D getRenderingBox()
          Returns the box in which the glyph rendering is being done.
 java.awt.geom.Dimension2D getTotalSize()
          Returns the total size of this glyphs.
 void register(ResidueGlyph glyph, ResidueModel model)
          Registers this glyph with the factory as if it was created though it.
 void release(ResidueGlyph glyph)
          Release the residue glyph.
 void setGlyphSize(java.awt.geom.Dimension2D size)
          Sets the dimension of the glyphs to be assembled by this factory.
 void setInterGlyphDistance(double value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResidueGlyphFactoryImpl

public ResidueGlyphFactoryImpl(int glyph_number)
Method Detail

createResidueGlyph

public ResidueGlyph createResidueGlyph(ResidueModel model)
Create a residue glyph. Index a reference to it on the sequence position of the model. This index is used by findGlyph() for fast lookup of the glyph.

Specified by:
createResidueGlyph in interface ResidueGlyphFactory

getGlyphs

public ResidueGlyph[] getGlyphs()
Returns the glyphs built by this factory.

Specified by:
getGlyphs in interface ResidueGlyphFactory

setGlyphSize

public void setGlyphSize(java.awt.geom.Dimension2D size)
Sets the dimension of the glyphs to be assembled by this factory.


findGlyph

public ResidueGlyph findGlyph(ResidueModel model)
Returns the residue glyph that represents this model.

Specified by:
findGlyph in interface ResidueGlyphFactory
Returns:
The residue glyph or null if the residue model is not represented by a glyph constructed with this factory.

findGlyph

public ResidueGlyph findGlyph(int position)
Description copied from interface: ResidueGlyphFactory
Returns the residue glyph that represents this model. Finds it from its position in the sequence.

Specified by:
findGlyph in interface ResidueGlyphFactory

getGLyphCount

public int getGLyphCount()
Returns the number of glyphs this factory built.

Specified by:
getGLyphCount in interface ResidueGlyphFactory

release

public void release(ResidueGlyph glyph)
Release the residue glyph. In order to be garbage collected, a glyph must be released from the factory that created it.

Specified by:
release in interface ResidueGlyphFactory

register

public void register(ResidueGlyph glyph,
                     ResidueModel model)
Description copied from interface: ResidueGlyphFactory
Registers this glyph with the factory as if it was created though it.

Specified by:
register in interface ResidueGlyphFactory

getInterGlyphDistance

public double getInterGlyphDistance()
Description copied from interface: ResidueGlyphFactory
Returns the suggested inter-glyph distance. This distance should be observed when laying out residue glyphs to avoid an overlap of their rendering.

Specified by:
getInterGlyphDistance in interface ResidueGlyphFactory

setInterGlyphDistance

public void setInterGlyphDistance(double value)

getTotalSize

public java.awt.geom.Dimension2D getTotalSize()
Description copied from interface: ResidueGlyphFactory
Returns the total size of this glyphs. The total size includes the border.

Specified by:
getTotalSize in interface ResidueGlyphFactory

getBorder

public int getBorder()
Returns the width of the invisible border around residue glyphs.

Specified by:
getBorder in interface ResidueGlyphFactory

getRenderingBox

public java.awt.geom.Rectangle2D getRenderingBox()
Description copied from interface: ResidueGlyphFactory
Returns the box in which the glyph rendering is being done. This box excludes the border of the residue glyph.

Specified by:
getRenderingBox in interface ResidueGlyphFactory


Copyright @ 2003 Mount Sinai School of Medicine. All Rights Reserved.