use of gaiasky.util.filter.attrib.AttributeUCD in project gaiasky by langurmonkey.
the class EventScriptingInterface method getAttributeByName.
private IAttribute getAttributeByName(String name, CatalogInfo ci) {
try {
// One of the default attributes
Class<?> clazz = Class.forName("gaiasky.util.filter.attrib.Attribute" + name);
Constructor<?> ctor = clazz.getConstructor();
return (IAttribute) ctor.newInstance();
} catch (ClassNotFoundException | NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) {
// Try extra attributes
if (ci.object instanceof ParticleGroup) {
ParticleGroup pg = (ParticleGroup) ci.object;
ObjectDoubleMap.Keys<UCD> ucds = pg.get(0).extraKeys();
for (UCD ucd : ucds) if (ucd.colname.equalsIgnoreCase(name))
return new AttributeUCD(ucd);
}
}
return null;
}
Aggregations