|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.text.SegmentCache
SegmentCache caches Segment
s to avoid continually creating
and destroying of Segment
s. A common use of this class would
be:
Segment segment = segmentCache.getSegment(); // do something with segment ... segmentCache.releaseSegment(segment);
Nested Class Summary | |
private static class |
SegmentCache.CachedSegment
CachedSegment is used as a tagging interface to determine if a Segment can successfully be shared. |
Field Summary | |
private List |
segments
A list of the currently unused Segments. |
private static SegmentCache |
sharedCache
A global cache. |
Constructor Summary | |
SegmentCache()
Creates and returns a SegmentCache. |
Method Summary | |
Segment |
getSegment()
Returns a Segment . |
static SegmentCache |
getSharedInstance()
Returns the shared SegmentCache. |
static Segment |
getSharedSegment()
A convenience method to get a Segment from the shared SegmentCache . |
void |
releaseSegment(Segment segment)
Releases a Segment. |
static void |
releaseSharedSegment(Segment segment)
A convenience method to release a Segment to the shared SegmentCache . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static SegmentCache sharedCache
private List segments
Constructor Detail |
public SegmentCache()
Method Detail |
public static SegmentCache getSharedInstance()
public static Segment getSharedSegment()
SegmentCache
.
public static void releaseSharedSegment(Segment segment)
SegmentCache
.
public Segment getSegment()
Segment
. When done, the Segment
should be recycled by invoking releaseSegment
.
public void releaseSegment(Segment segment)
segmentCache.releaseSegment(segment); segmentCache.releaseSegment(segment);Will likely result in very bad things happening!
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |