public Set<CALFeatureName> getFeatureNames() {
// CALFeatureNames for all features in the current program.
Set<CALFeatureName> programFeatureNameSet = new HashSet<CALFeatureName>();
// Grab the module names and feature names.
ModuleTypeInfo moduleInfo = module.getModuleTypeInfo();
// Module name.
programFeatureNameSet.add(CALFeatureName.getModuleFeatureName(this));
// Functional agents.
FunctionalAgent[] entities = moduleInfo.getFunctionalAgents();
for (final FunctionalAgent entity : entities) {
programFeatureNameSet.add(CALFeatureName.getScopedEntityFeatureName(entity));
}
// Type constructors.
int constructorCount = moduleInfo.getNTypeConstructors();
for (int i = 0; i < constructorCount; i++) {
TypeConstructor typeConstructor = moduleInfo.getNthTypeConstructor(i);
programFeatureNameSet.add(CALFeatureName.getScopedEntityFeatureName(typeConstructor));
// Data constructors.
int dataConstructorCount = typeConstructor.getNDataConstructors();
for (int n = 0; n < dataConstructorCount; n++) {
DataConstructor dataConstructor = typeConstructor.getNthDataConstructor(n);
programFeatureNameSet.add(CALFeatureName.getScopedEntityFeatureName(dataConstructor));
}
}
// Type classes.
int classCount = moduleInfo.getNTypeClasses();
for (int i = 0; i < classCount; i++) {
TypeClass typeClass = moduleInfo.getNthTypeClass(i);
programFeatureNameSet.add(CALFeatureName.getScopedEntityFeatureName(typeClass));
// Class methods.
int methodCount = typeClass.getNClassMethods();
for (int n = 0; n < methodCount; n++) {
programFeatureNameSet.add(CALFeatureName.getScopedEntityFeatureName(typeClass.getNthClassMethod(n)));
}
}
// Class instances.
int instanceCount = moduleInfo.getNClassInstances();
for (int n = 0; n < instanceCount; n++) {
ClassInstance instance = moduleInfo.getNthClassInstance(n);
programFeatureNameSet.add(CALFeatureName.getClassInstanceFeatureName(instance));
// Instance methods.
TypeClass typeClass = instance.getTypeClass();
int methodCount = typeClass.getNClassMethods();