@Override public boolean hasFeature(FeatureType feature) { String name = feature.toString(); // Features are a positive statement. // If we find it mentioned anywhere, then it true if (configAll.containsValue(KEY_FEATURE, name)) { return true; } // Many "features" are GlobalOptionFilters, which in the Sword C++ API // indicate a class to use for filtering. // These mostly have the source type prepended to the feature StringBuilder buffer = new StringBuilder(getProperty(KEY_SOURCE_TYPE)); buffer.append(name); if (configAll.containsValue(KEY_GLOBAL_OPTION_FILTER, buffer.toString())) { return true; } // Check for the alias prefixed by the source type String alias = feature.getAlias(); buffer.setLength(0); buffer.append(getProperty(KEY_SOURCE_TYPE)); buffer.append(alias); // But some do not return configAll.containsValue(KEY_GLOBAL_OPTION_FILTER, name) || configAll.containsValue(KEY_GLOBAL_OPTION_FILTER, buffer.toString()); }
private void mergeConfig(IniSection config) { for (String key : config.getKeys()) { ConfigEntryType type = ConfigEntryType.fromString(key); for (String value : config.getValues(key)) { if (type != null && type.mayRepeat()) { if (!configAll.containsValue(key, value)) { configAll.add(key, value); } } else { setProperty(key, value); } } } }