de.goerntkai.scot.app.document
Class SCoTDocument

java.lang.Object
  extended byde.goerntkai.scot.app.document.SCoTDocument
Direct Known Subclasses:
ContentDocument, FramesetDocument, HeaderDocument, OrderDocument

public abstract class SCoTDocument
extends java.lang.Object

Every file that is a source to SCoT is a SCoTDocument. The file consists of SCoTBlocks and lines.

Version:
$Id: SCoTDocument.java,v 1.8 2005/05/19 20:19:36 GoerntKai Exp $
Author:
Kai Görnt

Constructor Summary
SCoTDocument(java.lang.String path, Configuration aConfiguration)
          Instantiates and reads the file.
 
Method Summary
 SCoTBlock[] getBlocks(int start)
          Returns the lines beginning with the starting index as an array of block definitions.
 Configuration getConfiguration()
           
 java.lang.String getLine(int index)
          Returns the line with the given index.
 java.lang.String[] getLines()
          Returns an array with all the lines in the file.
 java.lang.String[] getLines(int end)
          Returns an array of the lines from the file.
 java.lang.String[] getLines(int start, int end)
          Returns an array of lines from the file.
 java.lang.String getReference()
          Returns the reference that another file will need to set a link to this HTML document.
 java.lang.String toString()
          This method is mainly contained for debugging.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SCoTDocument

public SCoTDocument(java.lang.String path,
                    Configuration aConfiguration)
             throws java.io.FileNotFoundException

Instantiates and reads the file.

Parameters:
path - path and name of the file
aConfiguration - the configuration of this application
Throws:
java.io.FileNotFoundException
Method Detail

getBlocks

public SCoTBlock[] getBlocks(int start)
                      throws java.io.FileNotFoundException

Returns the lines beginning with the starting index as an array of block definitions. Returns null if start is not in the range.

Parameters:
start - the index for the starting line
Returns:
blocks
Throws:
java.io.FileNotFoundException

getConfiguration

public Configuration getConfiguration()
Returns:
configuration of the application

getLine

public java.lang.String getLine(int index)

Returns the line with the given index. Returns "" when the index is not in the range.

Parameters:
index - the number of the line to return
Returns:
the line

getLines

public java.lang.String[] getLines()

Returns an array with all the lines in the file.

Returns:
all lines of the file

getLines

public java.lang.String[] getLines(int end)

Returns an array of the lines from the file. Not all lines will be returned but all beginning from the first to the one indexed by end-1.

Parameters:
end - the index for the line after the endig one
Returns:
lines of the file

getLines

public java.lang.String[] getLines(int start,
                                   int end)

Returns an array of lines from the file. The array beginns with the one indexed by start and ends with the one indexed by end-1. If end is greater than lines.length it returns every line beginning with start.

Parameters:
start - the index for the starting line
end - the index for the ending line
Returns:
lines of the file

getReference

public java.lang.String getReference()

Returns the reference that another file will need to set a link to this HTML document. The reference is the plain file name without any extension or parent folder structure. It has to be concatenated with .html for referencing a HTML document or can be used as it is for referencing an anchor withing an HTML document.

Returns:
the reference to the HTML document

toString

public java.lang.String toString()

This method is mainly contained for debugging.

Returns:
the String representation of the object
See Also:
Object.toString()


© 2004 by Kai Görnt