|
Extension SDK 9.0.5 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectoracle.jdeveloper.audit.model.Location
A location in a document in a project. This class encapsulates a document
and a range of characters within the text buffer for the document; and using
the document, allows clients to go back and forth between Location
s
and constructs in the source model for the document. A location adjusts the
offset and length it exposes to clients to account for edits in the containing
document that happen after its creation.
The document is defined by a DocumentAdapter
, which encapsulates
a workspace, project, and node and serves as a factory and service provider
for locations.
Analyzer
implementations
typically work directly with constructs rather than with Locations
.
However, the Audit framework relies on locations to avoid holding
references to constructs and thereby locking entire source models into
memory; and to allow it to use source models which are completely recreated
whenever the underlying document changes.
Location implements Comparable in such a way that a location which includes another always sorts first.
Notes
When a whole document location is created, the length should be the length of the document. To avoid opening files that don't otherwise need to be opened, the length is set internally to Integer.MAX_VALUE. When used, lengths of Integer.MAX_VALUE are always replaced by document.getInitialLength(), which will also be Integer.MAX_VALUE until the document is actually opened. Because getEnd propagates the length to the offset, the same replacement is also done for the internal offset value.
DocumentAdapter
Constructor Summary | |
Location(DocumentAdapter document)
Creates a location spanning the entire document. |
|
Location(DocumentAdapter document,
int offset,
int length)
Creates a location within a document. |
Method Summary | |
int |
compareTo(java.lang.Object object)
A Location which encloses another will always sort first. |
boolean |
contains(Location location)
Gets whether this location contains a location. |
boolean |
equals(java.lang.Object object)
|
Location |
getBeginning()
Gets a zero length location at the beginning of this location. |
DocumentAdapter |
getDocument()
Gets the document containing this location. |
Location |
getEnd()
Gets a zero length location at the end of this location. |
int |
getEndOffset()
Gets the number of characters in the document text buffer before the first character following this location, adjusted for edits to the containing document. |
int |
getLength()
Gets the number of characters in the document text buffer contained by this location, adjusted for edits to the containing document. |
Location |
getLocation()
Gets this location in fulfillment of the Located interface. |
int |
getOffset()
Gets the number of characters in the document text buffer before this location, adjusted for edits to the containing document. |
Project |
getProject()
Gets the project containing this location. |
Workspace |
getWorkspace()
Gets the workspace containing this location. |
int |
hashCode()
|
boolean |
isRoot()
Gets whether this location corresponds to the root construct in the object model for its document. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Location(DocumentAdapter document)
document
- The DocumentAdapter
containing this location.public Location(DocumentAdapter document, int offset, int length)
document
- The DocumentAdapter
containing this location.offset
- The number of characters in the text buffer for the
document before the first character
contained by this location.length
- The number of characters within this location.Method Detail |
public final Location getLocation()
Located
interface.
getLocation
in interface Located
public boolean isRoot()
public Workspace getWorkspace()
public Project getProject()
public DocumentAdapter getDocument()
public int getOffset()
public int getLength()
public int getEndOffset()
public Location getBeginning()
public Location getEnd()
public boolean contains(Location location)
location
- The location to test.public int compareTo(java.lang.Object object)
compareTo
in interface java.lang.Comparable
public boolean equals(java.lang.Object object)
public int hashCode()
public java.lang.String toString()
|
Extension SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.