|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.rice.cs.drjava.model.EventNotifier<RegionManagerListener<R>>
edu.rice.cs.drjava.model.ConcreteRegionManager<R>
public class ConcreteRegionManager<R extends OrderedDocumentRegion>
Simple region manager for the entire model. Follows readers/writers locking protocol of EventNotifier. TODO: fix the typing of regions. In many (all?) places, R should be OrderedDocumentRegion.
Field Summary |
---|
Fields inherited from class edu.rice.cs.drjava.model.EventNotifier |
---|
_listeners, _lock |
Constructor Summary | |
---|---|
ConcreteRegionManager()
|
Method Summary | |
---|---|
void |
addRegion(R region)
Add the supplied DocumentRegion to the manager. |
void |
changeRegion(R region,
Lambda<R,Object> cmd)
Apply the given command to the specified region to change it. |
void |
clearRegions()
Tells the manager to remove all regions. |
boolean |
contains(R region)
Tests if specified region r is contained in this manager. |
Set<OpenDefinitionsDocument> |
getDocuments()
|
ArrayList<FileRegion> |
getFileRegions()
|
SortedSet<R> |
getHeadSet(R r)
Gets the sorted set of regions less than r. |
R |
getRegionAt(OpenDefinitionsDocument odd,
int offset)
Returns the region [start, end) containing offset. |
Pair<R,R> |
getRegionInterval(OpenDefinitionsDocument odd,
int offset)
Finds the interval of regions in odd such that the line label (excerpt) for the region contains offset. |
ArrayList<R> |
getRegions()
|
SortedSet<R> |
getRegions(OpenDefinitionsDocument odd)
|
Collection<R> |
getRegionsOverlapping(OpenDefinitionsDocument odd,
int startOffset,
int endOffset)
Returns the set of regions in the given document that overlap the specified interval [startOffset, endOffset), including degenerate regions [offset, offset) where [offset, offset] is a subset of (startOffset, endOffset). |
SortedSet<R> |
getTailSet(R r)
Gets the sorted set of regions greater than or equal to r. |
void |
removeRegion(R region)
Remove the given IDocumentRegion from the manager. |
void |
removeRegions(Iterable<? extends R> regions)
Invoke removeRegion(R) on all of the given regions. |
void |
removeRegions(OpenDefinitionsDocument doc)
Remove the specified document from _documents and _regions (removing all of its contained regions). |
void |
updateLines(R firstRegion,
R lastRegion)
Updates _lineStartPos, _lineEndPos of regions in the interval [firstRegion, lastRegion] using total ordering on regions. |
Methods inherited from class edu.rice.cs.drjava.model.EventNotifier |
---|
addListener, removeAllListeners, removeListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface edu.rice.cs.drjava.model.RegionManager |
---|
addListener, removeAllListeners, removeListener |
Constructor Detail |
---|
public ConcreteRegionManager()
Method Detail |
---|
public Set<OpenDefinitionsDocument> getDocuments()
getDocuments
in interface RegionManager<R extends OrderedDocumentRegion>
public SortedSet<R> getHeadSet(R r)
public SortedSet<R> getTailSet(R r)
getTailSet
in interface RegionManager<R extends OrderedDocumentRegion>
public R getRegionAt(OpenDefinitionsDocument odd, int offset)
getRegionAt
in interface RegionManager<R extends OrderedDocumentRegion>
odd
- the documentoffset
- the offset in the document
public Pair<R,R> getRegionInterval(OpenDefinitionsDocument odd, int offset)
getRegionInterval
in interface RegionManager<R extends OrderedDocumentRegion>
odd
- the documentoffset
- the offset in the document
public Collection<R> getRegionsOverlapping(OpenDefinitionsDocument odd, int startOffset, int endOffset)
getRegionsOverlapping
in interface RegionManager<R extends OrderedDocumentRegion>
odd
- the documentstartOffset
- the left end of the specified intervalendOffset
- the right end of the specified interval
public void addRegion(R region)
addRegion
in interface RegionManager<R extends OrderedDocumentRegion>
region
- the DocumentRegion to be inserted into the managerpublic void removeRegion(R region)
removeRegion
in interface RegionManager<R extends OrderedDocumentRegion>
region
- the IDocumentRegion to be removed.public void removeRegions(Iterable<? extends R> regions)
removeRegion(R)
on all of the given regions.
removeRegions
in interface RegionManager<R extends OrderedDocumentRegion>
regions
- the DocumentRegions to be removed.public void removeRegions(OpenDefinitionsDocument doc)
removeRegions
in interface RegionManager<R extends OrderedDocumentRegion>
public SortedSet<R> getRegions(OpenDefinitionsDocument odd)
getRegions
in interface RegionManager<R extends OrderedDocumentRegion>
public ArrayList<R> getRegions()
getRegions
in interface RegionManager<R extends OrderedDocumentRegion>
public ArrayList<FileRegion> getFileRegions()
public boolean contains(R region)
RegionManager
contains
in interface RegionManager<R extends OrderedDocumentRegion>
region
- The region
public void clearRegions()
clearRegions
in interface RegionManager<R extends OrderedDocumentRegion>
public void changeRegion(R region, Lambda<R,Object> cmd)
changeRegion
in interface RegionManager<R extends OrderedDocumentRegion>
region
- the region to find and changecmd
- command that mutates the region.public void updateLines(R firstRegion, R lastRegion)
updateLines
in interface RegionManager<R extends OrderedDocumentRegion>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |