final ArrayList<String> groupingsList = new ArrayList<String>(metaData.length);
final HashMap<String, String> diagnosticMap = new HashMap<String, String>();
String group = null;
for (int sourceIdx = 0; sourceIdx < metaData.length; sourceIdx++)
{
final ExpressionMetaData data = metaData[sourceIdx];
if (data.isHidden())
{
continue;
}
if (WorkspaceSettings.getInstance().isShowExpertItems() == false && data.isExpert())
{
continue;
}
if (WorkspaceSettings.getInstance().isShowDeprecatedItems() == false && data.isDeprecated())
{
continue;
}
if (StructureFunction.class.isAssignableFrom(data.getExpressionType()))
{
continue;
}
if (logger.isDebugEnabled())
{
logger.debug("Grouping : " + data.getGrouping(locale) + " - " + data.getGroupingOrdinal(locale) + " -> " + data.getExpressionType());
}
final String diagnosticGroup = group;
if (sourceIdx == 0)
{
group = data.getGrouping(locale);
groupingsList.add(group);
}
else
{
final String newgroup = data.getGrouping(locale);
if ((ObjectUtilities.equal(newgroup, group)) == false)
{
if (groupingsList.contains(newgroup) == false)
{
group = newgroup;
groupingsList.add(newgroup);
}
else
{
logger.warn("Warning: Misconfigured Expression-metadata: Group already processed: '" +
newgroup + "' - " + // NON-NLS
data.getExpressionType() + " - Previous: " + diagnosticMap.get(diagnosticGroup));
}
}
}
diagnosticMap.put(group, data.getExpressionType().getName());
}
root = new ExpressionGroupingRoot();
groupings = groupingsList.toArray(new String[groupingsList.size()]);
expressionsByGroup = new HashNMap<String, ExpressionMetaData>();
for (int i = 0; i < metaData.length; i++)
{
final ExpressionMetaData exMetaData = metaData[i];
if (StructureFunction.class.isAssignableFrom(exMetaData.getExpressionType()))
{
continue;
}
if (exMetaData.isHidden())
{
continue;
}
if (WorkspaceSettings.getInstance().isShowExpertItems() == false && exMetaData.isExpert())
{
continue;
}
if (WorkspaceSettings.getInstance().isShowDeprecatedItems() == false && exMetaData.isDeprecated())
{
continue;
}
expressionsByGroup.add(exMetaData.getGrouping(Locale.getDefault()), exMetaData);
}
}