// Javadoc inherited.
public Prioritised[] split(StyleProperties properties) {
// Reset the state.
for (Iterator i = priority2Values.values().iterator(); i.hasNext();) {
PropertyValueArray array = (PropertyValueArray) i.next();
array.clear();
}
properties = addSystemFont(properties);
for (Iterator i = properties.propertyValueIterator(); i.hasNext();) {
PropertyValue propertyValue = (PropertyValue) i.next();
StyleValue value = propertyValue.getValue();
// Compile the value.
StyleValue compiledValue = compiler.compile(value);
// If compiling changed the value then create a new property value.
Priority priority = propertyValue.getPriority();
if (compiledValue != value) {
propertyValue = ThemeFactory.getDefaultInstance().
createPropertyValue(propertyValue.getProperty(),
compiledValue, priority);
}
PropertyValueArray array = (PropertyValueArray)
priority2Values.get(priority);
if (array == null) {
array = new SparsePropertyValueArray();
priority2Values.put(priority, array);
}
array.setPropertyValue(propertyValue);
}
Prioritised[] prioritised = new Prioritised[priority2Values.size()];
int p = 0;
for (Iterator i = priority2Values.entrySet().iterator(); i.hasNext();
p += 1) {
Map.Entry entry = (Map.Entry) i.next();
Priority priority = (Priority) entry.getKey();
PropertyValueArray array = (PropertyValueArray) entry.getValue();
prioritised[p] = new Prioritised(priority,
array.toPropertyValueArray());
}
return prioritised;
}