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. Warning: this class defines compareTo which implicitly defines a coarser equality relation than equals

Version:
$Id: BrowserDocumentRegion.java 5425 2011-02-03 06:46:51Z rcartwright $

Field Summary
protected  OpenDefinitionsDocument _doc
           
protected  Position _endPosition
           
protected  File _file
           
private  int _index
           
private static int _indexCounter
           
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 coarset than equals.
 OpenDefinitionsDocument getDocument()
           
 int getEndOffset()
           
 File getFile()
           
 int getIndex()
           
 int getStartOffset()
           
 int hashCode()
          This hash function is consistent with equals.
 String toString()
           
 void update(BrowserDocumentRegion other)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_indexCounter

private static volatile int _indexCounter

_index

private final int _index

_doc

protected final OpenDefinitionsDocument _doc

_file

protected final File _file

_startPosition

protected Position _startPosition

_endPosition

protected 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.

Parameters:
doc - document that contains this region
file - file that contains the region
sp - start position of the region
ep - end position of the region
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 coarset than 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

update

public void update(BrowserDocumentRegion other)

toString

public String toString()
Overrides:
toString in class Object