FileDocCategorySizeDatePackage
Mark.javaAPI DocGlassfish v2 API8299Fri May 04 22:32:52 BST 2007org.apache.jasper.compiler

Mark

public final class Mark extends Object
Mark represents a point in the JSP input.
author
Anil K. Vijendran

Fields Summary
int
cursor
int
line
int
col
int
fileid
String
fileName
String
baseDir
char[]
stream
Stack
includeStack
String
encoding
private JspReader
reader
private org.apache.jasper.JspCompilationContext
ctxt
Constructors Summary
Mark(JspReader reader, char[] inStream, int fileid, String name, String inBaseDir, String inEncoding)
Constructor

param
reader JspReader this mark belongs to
param
inStream current stream for this mark
param
fileid id of requested jsp file
param
name JSP file name
param
inBaseDir base directory of requested jsp file
param
inEncoding encoding of current file

	this.reader = reader;
        this.ctxt = reader.getJspCompilationContext();
	this.stream = inStream;
	this.cursor = 0;
	this.line = 1;
	this.col = 1;
	this.fileid = fileid;
	this.fileName = name;
	this.baseDir = inBaseDir;
	this.encoding = inEncoding;
	this.includeStack = new Stack();
    
Mark(Mark other)
Constructor

	this.reader = other.reader;
        this.ctxt = other.reader.getJspCompilationContext();
	this.stream = other.stream;
	this.fileid = other.fileid;
	this.fileName = other.fileName;
	this.cursor = other.cursor;
	this.line = other.line;
	this.col = other.col;
	this.baseDir = other.baseDir;
	this.encoding = other.encoding;

	// clone includeStack without cloning contents
	includeStack = new Stack();
	for ( int i=0; i < other.includeStack.size(); i++ ) {
  	    includeStack.addElement( other.includeStack.elementAt(i) );
	}
    
Mark(org.apache.jasper.JspCompilationContext ctxt, String filename, int line, int col)
Constructor

	this.reader = null;
        this.ctxt = ctxt;
	this.stream = null;
	this.cursor = 0;
	this.line = line;
	this.col = col;
	this.fileid = -1;
	this.fileName = filename;
	this.baseDir = "le-basedir";
	this.encoding = "le-endocing";
	this.includeStack = null;
    
Methods Summary
public booleanequals(java.lang.Object other)

	if (other instanceof Mark) {
	    Mark m = (Mark) other;
	    return this.reader == m.reader && this.fileid == m.fileid 
		&& this.cursor == m.cursor && this.line == m.line 
		&& this.col == m.col;
	} 
	return false;
    
public intgetColumnNumber()

        return col;
    
public java.lang.StringgetFile()

        return this.fileName;
    
public intgetLineNumber()

        return line;
    
public java.lang.StringgetPublicId()

        return null;
    
public java.lang.StringgetSystemId()

        return getFile();
    
public java.net.URLgetURL()
Gets the URL of the resource with which this Mark is associated

return
URL of the resource with which this Mark is associated
exception
MalformedURLException if the resource pathname is incorrect

        return ctxt.getResource(getFile());
    
public booleanisGreater(org.apache.jasper.compiler.Mark other)

return
true if this Mark is greather than the other Mark, false otherwise.


        boolean greater = false;

        if (this.line > other.line) {
            greater = true;
        } else if (this.line == other.line && this.col > other.col) {
            greater = true;
        }

        return greater;
    
public org.apache.jasper.compiler.MarkpopStream()
/* Restores this mark's state to a previously stored stream.

return
null if there is no previous stream The previous Makr instance when the stream is pushed.

	// make sure we have something to pop
	if ( includeStack.size() <= 0 ) {
	    return null;
	}

	// get previous state in stack
	IncludeState state = (IncludeState) includeStack.pop( );

	// set new variables
	cursor = state.cursor;
	line = state.line;
	col = state.col;
	fileid = state.fileid;
	fileName = state.fileName;
	baseDir = state.baseDir;
	stream = state.stream;
	return this;
    
public voidpushStream(char[] inStream, int inFileid, java.lang.String name, java.lang.String inBaseDir, java.lang.String inEncoding)
Sets this mark's state to a new stream. It will store the current stream in it's includeStack.

param
inStream new stream for mark
param
inFileid id of new file from which stream comes from
param
inBaseDir directory of file
param
inEncoding encoding of new file


	// store current state in stack
	includeStack.push(new IncludeState(cursor, line, col, fileid, fileName, baseDir, 
					   encoding, stream) );

	// set new variables
	cursor = 0;
	line = 1;
	col = 1;
	fileid = inFileid;
	fileName = name;
	baseDir = inBaseDir;
	encoding = inEncoding;
	stream = inStream;
    
public java.lang.StringtoShortString()

        return "("+line+","+col+")";
    
public java.lang.StringtoString()

	return getFile()+"("+line+","+col+")";