Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.9.0)

E52944-01


oracle.jdeveloper.audit.model
Class Location

java.lang.Object
  extended by oracle.jdeveloper.audit.model.Location

All Implemented Interfaces:
java.lang.Comparable<Location>, Located

public abstract class Location
extends java.lang.Object
implements java.lang.Comparable<Location>, Located

A location in a model in a project. This class encapsulates a model and a range of characters within the text buffer for the model; and using the model, allows clients to go back and forth between Locations and constructs in the source model for the model. A location adjusts the offset and length it exposes to clients to account for edits in the containing model that happen after its creation.

The model is defined by a ModelAdapter, which encapsulates a workspace, project, and file 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 model changes.

Location implements Comparable in such a way that a location which includes another always sorts first.

Notes

When a whole model location is created, the length should be the length of the model. 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 model.getStartLength(), which will also be Integer.MAX_VALUE until the model is actually opened. Because getEnd propagates the length to the offset, the same replacement is also done for the internal offset value.

See Also:
ModelAdapter

Constructor Summary
protected Location(ModelAdapter model)
          Creates a location within a model.

 

Method Summary
 int compareTo(Location that)
           A Location which encloses another will always sort first.
 boolean contains(Location that)
          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.
 Location getEnd()
          Gets a zero length location at the end of this location.
 int getEndOffset()
          Gets the number of characters in the model text buffer before the first character following this location, adjusted for edits to the containing model.
 int getLength()
          Gets the number of characters in the model text buffer contained by this location, adjusted for edits to the containing model.
 Location getLocation()
          Gets this location in fulfillment of the Located interface.
 ModelAdapter getModel()
          Gets the model containing this location.
 int getOffset()
          Gets the number of characters in the model text buffer before this location, adjusted for edits to the containing model.
 Project getProject()
          Gets the project containing this location.
 Workspace getWorkspace()
          Gets the workspace containing this location.
 int hashCode()
           
 Location intersection(Location that)
          Gets the intersection of this location with a location, or null if they do not intersect.
 boolean intersects(Location that)
          Gets whether this location intersects with a location.
 boolean isRoot()
          Gets whether this location corresponds to the root construct in the object model for its model.
 java.lang.String toString()
           

 

Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait

 

Constructor Detail

Location

protected Location(ModelAdapter model)
Creates a location within a model.
Parameters:
model - The ModelAdapter containing this location.

Method Detail

getLocation

public final Location getLocation()
Gets this location in fulfillment of the Located interface.
Specified by:
getLocation in interface Located
Returns:
this location.

isRoot

public boolean isRoot()
Gets whether this location corresponds to the root construct in the object model for its model.

getWorkspace

public Workspace getWorkspace()
Gets the workspace containing this location.

getProject

public Project getProject()
Gets the project containing this location.

getModel

public ModelAdapter getModel()
Gets the model containing this location.

getOffset

public int getOffset()
Gets the number of characters in the model text buffer before this location, adjusted for edits to the containing model.

getLength

public int getLength()
Gets the number of characters in the model text buffer contained by this location, adjusted for edits to the containing model.

getEndOffset

public int getEndOffset()
Gets the number of characters in the model text buffer before the first character following this location, adjusted for edits to the containing model.

getBeginning

public Location getBeginning()
Gets a zero length location at the beginning of this location.

getEnd

public Location getEnd()
Gets a zero length location at the end of this location.

intersection

public Location intersection(Location that)
Gets the intersection of this location with a location, or null if they do not intersect.

contains

public boolean contains(Location that)
Gets whether this location contains a location. A root location contains all locations in the same model. A location does not contain a zero- or negative-length location at its end offset.
Parameters:
that - The location to test.

compareTo

public int compareTo(Location that)
A Location which encloses another will always sort first. The implementation deals with nested model adapters correctly.
Specified by:
compareTo in interface java.lang.Comparable<Location>

intersects

public boolean intersects(Location that)
Gets whether this location intersects with a location.

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.9.0)

E52944-01


Copyright © 1997, 2015, Oracle. All rights reserved.