edu.rice.cs.drjava.model
Class BrowserDocumentRegion

java.lang.Object
  extended by edu.rice.cs.drjava.model.BrowserDocumentRegion
All Implemented Interfaces:
IDocumentRegion, Region, Comparable<BrowserDocumentRegion>

public class BrowserDocumentRegion
extends Object
implements IDocumentRegion, Comparable<BrowserDocumentRegion>

Class for document regions that totally ordered by allocation chronology. They do not conform to the invariants required for OrderedDocumentRegions. TODO: Use a simple stack rather than a TreeSet to represent the collection of accumulated regions.

Version:
$Id$

Field Summary
protected  OpenDefinitionsDocument _doc
           
protected  Position _endPosition
           
protected  File _file
           
protected  Position _startPosition
           
protected  DefaultMutableTreeNode _treeNode
           
 
Constructor Summary
BrowserDocumentRegion(OpenDefinitionsDocument doc, Position sp, Position ep)
          Create a new simple document region with a bona fide document
 
Method Summary
 int compareTo(BrowserDocumentRegion r)
          This relation is consistent with equals.
 OpenDefinitionsDocument getDocument()
           
 int getEndOffset()
           
 File getFile()
           
 int getIndex()
           
 int getStartOffset()
           
 int hashCode()
          This hash function is consistent with equals.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_doc

protected final OpenDefinitionsDocument _doc

_file

protected final File _file

_startPosition

protected final Position _startPosition

_endPosition

protected final Position _endPosition

_treeNode

protected volatile DefaultMutableTreeNode _treeNode
Constructor Detail

BrowserDocumentRegion

public BrowserDocumentRegion(OpenDefinitionsDocument doc,
                             Position sp,
                             Position ep)
Create a new simple document region with a bona fide document

Method Detail

hashCode

public int hashCode()
This hash function is consistent with equals.

Overrides:
hashCode in class Object

compareTo

public int compareTo(BrowserDocumentRegion r)
This relation is consistent with equals.

Specified by:
compareTo in interface Comparable<BrowserDocumentRegion>

getIndex

public int getIndex()

getDocument

public OpenDefinitionsDocument getDocument()
Specified by:
getDocument in interface IDocumentRegion
Returns:
the document.

getFile

public File getFile()
Returns:
the file.

getStartOffset

public int getStartOffset()
Specified by:
getStartOffset in interface Region
Returns:
the start offset

getEndOffset

public int getEndOffset()
Specified by:
getEndOffset in interface Region
Returns:
the end offset

toString

public String toString()
Overrides:
toString in class Object