Class CharAssociation
java.lang.Object
org.apache.fop.complexscripts.util.CharAssociation
- All Implemented Interfaces:
Cloneable
A structure class encapsulating an interval of characters expressed as an offset and count of
Unicode scalar values (in an IntBuffer). A
CharAssociation
is used to maintain a
backpointer from a glyph to one or more character intervals from which the glyph was derived.
Each glyph in a glyph sequence is associated with a single CharAssociation
instance.
A CharAssociation
instance is additionally (and optionally) used to record
predication information about the glyph, such as whether the glyph was produced by the
application of a specific substitution table or whether its position was adjusted by a specific
poisitioning table.
This work was originally authored by Glenn Adams (gadams@apache.org).
-
Constructor Summary
ConstructorsConstructorDescriptionCharAssociation
(int[] subIntervals) Instantiate a non-disjoint character association.CharAssociation
(int offset, int count) Instantiate a non-disjoint character association.CharAssociation
(int offset, int count, int[] subIntervals) Instantiate a character association. -
Method Summary
Modifier and TypeMethodDescriptionclone()
boolean
contained
(int offset, int count) int
getCount()
int
getEnd()
int
getPredication
(String key) Get predication KEY.static org.apache.fop.complexscripts.util.CharAssociation.PredicationMerger
Obtain predication merger for KEY.int
getStart()
int
int[]
boolean
static CharAssociation
join
(CharAssociation[] aa) Join (merge) multiple associations into a single, potentially disjoint association.void
mergePredication
(String key, Object value) Merge predication <KEY,VALUE>.void
Merge predications from another CA.static Object
mergePredicationValues
(String key, Object v1, Object v2) Merge predication values V1 and V2 on KEY.static CharAssociation[]
replicate
(CharAssociation a, int repeat) Replicate association to formrepeat
new associations.void
setPredication
(String key, Object value) Set predication <KEY,VALUE>.static void
setPredicationMerger
(String key, org.apache.fop.complexscripts.util.CharAssociation.PredicationMerger pm) Register predication merger PM for KEY.toString()
-
Constructor Details
-
CharAssociation
public CharAssociation(int offset, int count, int[] subIntervals) Instantiate a character association.- Parameters:
offset
- into array of Unicode scalar values (in associated IntBuffer)count
- of Unicode scalar values (in associated IntBuffer)subIntervals
- if disjoint, then array of sub-intervals, otherwise null; even members of array are sub-interval starts, and odd members are sub-interval ends (exclusive)
-
CharAssociation
public CharAssociation(int offset, int count) Instantiate a non-disjoint character association.- Parameters:
offset
- into array of UTF-16 code elements (in associated CharSequence)count
- of UTF-16 character code elements (in associated CharSequence)
-
CharAssociation
public CharAssociation(int[] subIntervals) Instantiate a non-disjoint character association.- Parameters:
subIntervals
- if disjoint, then array of sub-intervals, otherwise null; even members of array are sub-interval starts, and odd members are sub-interval ends (exclusive)
-
-
Method Details
-
getOffset
public int getOffset()- Returns:
- offset (start of association interval)
-
getCount
public int getCount()- Returns:
- count (number of characer codes in association)
-
getStart
public int getStart()- Returns:
- start of association interval
-
getEnd
public int getEnd()- Returns:
- end of association interval
-
isDisjoint
public boolean isDisjoint()- Returns:
- true if association is disjoint
-
getSubIntervals
public int[] getSubIntervals()- Returns:
- subintervals of disjoint association
-
getSubIntervalCount
public int getSubIntervalCount()- Returns:
- count of subintervals of disjoint association
-
contained
public boolean contained(int offset, int count) - Parameters:
offset
- of interval in sequencecount
- length of interval- Returns:
- true if this association is contained within [offset,offset+count)
-
setPredication
Set predication <KEY,VALUE>.- Parameters:
key
- predication keyvalue
- predication value
-
getPredication
Get predication KEY.- Parameters:
key
- predication key- Returns:
- predication KEY at OFFSET or null if none exists
-
mergePredication
Merge predication <KEY,VALUE>.- Parameters:
key
- predication keyvalue
- predication value
-
mergePredicationValues
Merge predication values V1 and V2 on KEY. Uses registeredPredicationMerger
if one exists, otherwise uses V2 if non-null, otherwise uses V1.- Parameters:
key
- predication keyv1
- first (original) predication valuev2
- second (to be merged) predication value- Returns:
- merged value
-
mergePredications
Merge predications from another CA.- Parameters:
ca
- from which to merge
-
clone
-
setPredicationMerger
public static void setPredicationMerger(String key, org.apache.fop.complexscripts.util.CharAssociation.PredicationMerger pm) Register predication merger PM for KEY.- Parameters:
key
- for predication mergerpm
- predication merger
-
getPredicationMerger
public static org.apache.fop.complexscripts.util.CharAssociation.PredicationMerger getPredicationMerger(String key) Obtain predication merger for KEY.- Parameters:
key
- for predication merger- Returns:
- predication merger or null if none exists
-
replicate
Replicate association to formrepeat
new associations.- Parameters:
a
- association to replicaterepeat
- count- Returns:
- array of replicated associations
-
join
Join (merge) multiple associations into a single, potentially disjoint association.- Parameters:
aa
- array of associations to join- Returns:
- (possibly disjoint) association containing joined associations
-
toString
-