frysk.dom
Class DOMImage

java.lang.Object
  extended by frysk.dom.DOMImage

public class DOMImage
extends Object

DOMImage represents an image within the source window document object model


Field Summary
static String CCPATH_ATTR
          CCPATH for the image
static boolean DEBUG
           
 DOMFrysk dom
           
 DOMImage image
           
static String IMAGE_NODE
           
private  Element myElement
           
static String NAME_ATTR
           
static String PATH_ATTR
           
private  HashMap sourceMap
           
 
Constructor Summary
DOMImage(Element data)
          Creates a new DOMImage from the given Element.
DOMImage(String name, String path, String ccpath, Element rootElement)
          Creates a new DOMImage
 
Method Summary
 void addSource(DOMSource source)
          Adds the given DOMSource as a source in this image
 DOMSource addSource(Proc proc, SourceLocation line, DOMFrysk dom)
          adds a source element under this DOMImage
 void addSource(String source_name, String path, String[] incpaths)
          adds a source element under this image
 void clearSourceMap()
          Clears this DOMImage's HashMap cache after DOM work has been completed after a particular segment of operation.
 String getCCPath()
          returns the name of the image
protected  Element getElement()
          This function should only be used internally within the frysk source dom
 String getName()
          gets the name of the image
 DOMSource getSource(String name)
          Attempts to fetch an image of the given name from the DOM.
 Iterator getSources()
          gets an iterator pointing to all of the sources belonging to this image
 void setCCPath(String image_name)
          Sets the CCPATH of the current image
 void setName(String name)
          sets the name of the image
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CCPATH_ATTR

public static final String CCPATH_ATTR
CCPATH for the image

See Also:
Constant Field Values

myElement

private Element myElement

IMAGE_NODE

public static final String IMAGE_NODE
See Also:
Constant Field Values

NAME_ATTR

public static final String NAME_ATTR
See Also:
Constant Field Values

PATH_ATTR

public static final String PATH_ATTR
See Also:
Constant Field Values

DEBUG

public static final boolean DEBUG
See Also:
Constant Field Values

dom

public DOMFrysk dom

image

public DOMImage image

sourceMap

private HashMap sourceMap
Constructor Detail

DOMImage

public DOMImage(Element data)
Creates a new DOMImage from the given Element. Data must be of name "image".

Parameters:
data - A JDOM Element of name "image"

DOMImage

public DOMImage(String name,
                String path,
                String ccpath,
                Element rootElement)
Creates a new DOMImage

Parameters:
name - The name of the image
path - the path to the image
ccpath - The CCPATH for the image
Method Detail

addSource

public void addSource(String source_name,
                      String path,
                      String[] incpaths)
adds a source element under this image

Parameters:
source_name -
path -

addSource

public DOMSource addSource(Proc proc,
                           SourceLocation line,
                           DOMFrysk dom)
                    throws IOException
adds a source element under this DOMImage

Parameters:
proc - - the proc image for this source
frame - - the frame for this source
Throws:
IOException

addSource

public void addSource(DOMSource source)
Adds the given DOMSource as a source in this image

Parameters:
source - The source to add

getName

public String getName()
gets the name of the image

Returns:
The name of the image

setCCPath

public void setCCPath(String image_name)
Sets the CCPATH of the current image

Parameters:
image_name - is the image for which this CCPATH is intended

setName

public void setName(String name)
sets the name of the image

Parameters:
name - what the name of the image will be

getCCPath

public String getCCPath()
returns the name of the image

Returns:
The CCPATH of the image

getSources

public Iterator getSources()
gets an iterator pointing to all of the sources belonging to this image

Returns:
an iterator to all the source files contained in this image.

getSource

public DOMSource getSource(String name)
Attempts to fetch an image of the given name from the DOM. If no image is found returns null. The first time a particular source name is searched for, the child source elements of this DOMImage are searched until the requested source Element is found. At that point, that newly created Object is hashed into this DOMImage's sourceMap to be cached for future requests.

Parameters:
name - is the name of the image to look for
Returns:
The DOMSource corresponding to the element, or null if no such element exists

getElement

protected Element getElement()
This function should only be used internally within the frysk source dom

Returns:
The JDom element at the core of this node

clearSourceMap

public void clearSourceMap()
Clears this DOMImage's HashMap cache after DOM work has been completed after a particular segment of operation. The longevity of each source file can't be predicted, so take the high road and free the space each time.