runarray Specification Sheet


Portable Object Compiler (c) 1997,98. All Rights Reserved.

RunArray

Inherits from: Cltn

Maturity Index: Experimental

Class Description

A RunArray is a Collection that, for each character in a String, holds a list of TextAttribute instances. The i-th element of a RunArray is a set of textattributes that correspond to the i-th character in a String.

RunArray is used by the Text class, to hold String segments that have the same TextAttributes, called runs.

Accessing

The message at: takes as argument an index that corresponds to an index into the String instance, associated to this

Method types

Creation

Accessing

Printing

Methods

new

+new
Creates an empty RunArray collection.

free

-free

values

-values

values:

-values:v

at:

-at:(unsigned)i
Returns a collection of TextAttributes for the i-th character. The collection contains at least one element.

size

- (unsigned)size
Returns the size of the RunArray, which is the same as the size of the String instance for this RunArray object.

runLengthAt:

- (unsigned)runLengthAt:(unsigned)i
Returns the size of the run to which the character at position i belongs.

addAttribute:from:size:

-addAttribute:attribfrom:(unsigned)psize:(unsigned)s
Adds attrib to the attribute lists for the s characters from position p.

coalesce

-coalesce
Merges adjacent lists of TextAttribute instances, by testing whether they are equal (in the sense of TextAttribute's isEqual method).

printOn:

-printOn:(IOD)aFile
Prints the RunArray values.