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

E13403-04

oracle.javatools.editor.language
Class StyledFragmentsList

java.lang.Object
  extended by oracle.javatools.editor.language.StyledFragmentsList

public final class StyledFragmentsList
extends java.lang.Object

A StyledFragmentsList is just a list of StyledFragments that we can re-use without having to constantly reallocate arrays and StyledFragment objects. This should help overall performance by reducing the amount of object allocation going on. We can do this because the current usage is to build up a list of StyledFragments for a range of lines, then iterate through them one by one to paint them.

The methods on this class are a subset of the List interface based on the needs of this package. Note that this is an unsynchronized class, and the StyledFragment returned by get() is just a cached member of the list - this means that multiple readers should not be using the list at the same time. This is generally not a problem as a given list will be used only by one renderer at a time.


Constructor Summary
StyledFragmentsList()
          Constructs a new StyledFragmentList with an initial size of the default (100).
StyledFragmentsList(int preferredSize)
          Constructs a new StyledFragmentList with the given preferred size.
 
Method Summary
 void add(java.lang.String styleName, int startOffset, int endOffset)
          Adds the given fragment to the end of the list.
 void clear()
          Discards all fragments from the list.
 StyledFragment get(int index)
          Get the fragment at the specified index.
 int size()
          Returns the size of the list (number of fragments.)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StyledFragmentsList

public StyledFragmentsList()
Constructs a new StyledFragmentList with an initial size of the default (100).


StyledFragmentsList

public StyledFragmentsList(int preferredSize)
Constructs a new StyledFragmentList with the given preferred size.

Parameters:
preferredSize - requested perferred size
Method Detail

add

public void add(java.lang.String styleName,
                int startOffset,
                int endOffset)
Adds the given fragment to the end of the list. If the previously added fragment is of the same style, the list will take care of automatically collapsing the fragment.

Parameters:
styleName - the name of the style of the fragment to add
startOffset - the start offset of the fragment
endOffset - the end offset of the fragment

clear

public void clear()
Discards all fragments from the list.


size

public int size()
Returns the size of the list (number of fragments.)

Returns:
the size of the list

get

public StyledFragment get(int index)
Get the fragment at the specified index.

Parameters:
index - the index of the fragment to retrieve
Returns:
the fragment at the given index.

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

E13403-04

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