* of a property class. The index value is the index of the property
* class name in the classNames[] array.
*/
- private final HashMap classToIndex
- = new HashMap(PropNames.LAST_PROPERTY_INDEX + 1);
+ private final HashMap classToIndex = new HashMap(
+ (int)((PropNames.LAST_PROPERTY_INDEX + 1) / 0.75) + 1);
/**
* An <tt>int[]</tt> containing the <i>inherited</i> values from the
Class pclass;
Property property;
- //System.out.println("setupProperty " + propindex + " "
- //+ PropNames.getPropertyName(propindex));
if ((property = properties[propindex]) != null) return property;
// Get the property class name
// Get the class for this property name
String name = packageName + ".properties." + cname;
try {
- //System.out.println("classes["+propindex+"] "+name);//DEBUG
pclass = Class.forName(name);
classes[propindex] = pclass;
// Instantiate the class
property = (Property)(pclass.newInstance());
properties[propindex] = property;
- //System.out.println
- //("property name "
- //+ property.getClass().getName());
- //System.out.println
- //("property name " +
- //properties[propindex].getClass().getName());
// Set inheritance value
if ((inherited[propindex]
- = pclass.getField("inherited").getInt(null))
+ = property.getInherited())
!= Property.NO)
inheritedprops.set(propindex);
// Set datatypes
- datatypes[propindex] = pclass.getField("dataTypes").getInt(null);
- //System.out.println("datatypes " + datatypes[propindex] + "\n"
- //+ Property.listDataTypes(datatypes[propindex]));
+ datatypes[propindex] = property.getDataTypes();
// Set initialValueTypes
- initialValueTypes[propindex] =
- pclass.getField("initialValueType").getInt(null);
- //System.out.println("initialValueType "
- //+ initialValueTypes[propindex]);
+ initialValueTypes[propindex] = property.getInitialValueType();
- traitMappings[propindex] =
- pclass.getField("traitMapping").getInt(null);
+ traitMappings[propindex] = property.getTraitMapping();
} catch (ClassNotFoundException e) {
throw new PropertyException
throw new PropertyException
("InstantiationException" + e.getMessage());
}
- catch (NoSuchFieldException e) {
- throw new PropertyException
- ("NoSuchFieldException" + e.getMessage());
- }
return property;
}