| Constructor: |
Mark(Mark other) {
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(JspCompilationContext ctxt,
String filename,
int line,
int col) {
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;
}
|
Mark(JspReader reader,
char[] inStream,
int fileId,
String name,
String inBaseDir,
String inEncoding) {
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();
}
Parameters:
reader - JspReader this mark belongs to
inStream - current stream for this mark
fileId - id of requested jsp file
name - JSP file name
inBaseDir - base directory of requested jsp file
inEncoding - encoding of current file
|
| Method from org.apache.jasper.compiler.Mark Detail: |
public boolean equals(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 int getColumnNumber() {
return col;
}
|
public String getFile() {
return this.fileName;
}
|
public int getLineNumber() {
return line;
}
|
public String getPublicId() {
return null;
}
|
public String getSystemId() {
return getFile();
}
|
public URL getURL() throws MalformedURLException {
return ctxt.getResource(getFile());
}
Gets the URL of the resource with which this Mark is associated |
public boolean isGreater(Mark other) {
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 Mark popStream() {
// 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;
}
Restores this mark's state to a previously stored stream. |
public void pushStream(char[] inStream,
int inFileId,
String name,
String inBaseDir,
String inEncoding) {
// 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;
}
Sets this mark's state to a new stream.
It will store the current stream in it's includeStack. |
public String toShortString() {
return "("+line+","+col+")";
}
|
public String toString() {
return getFile()+"("+line+","+col+")";
}
|