01: package org.andromda.translation.ocl.validation;
02:
03: import org.apache.commons.lang.StringUtils;
04:
05: import java.util.Arrays;
06: import java.util.Collection;
07:
08: /**
09: * Contains a single operation {@link #isPredicateFeature(String) that determines if a passed in <code>feature</code>
10: * matches the name of a feature that should use a predicate when being translated.
11: *
12: * @author Chad Brandon
13: */
14: class OCLPredicateFeatures {
15: /**
16: * Contains the names of feature calls that are expected to use predicates while being translated.
17: */
18: private static final String[] PREDICATE_FEATURES = new String[] {
19: "one", "forAll", "reject", "select", "any", "exists", };
20:
21: private static final Collection features = Arrays
22: .asList(PREDICATE_FEATURES);
23:
24: /**
25: * Indicates whether or not the passed in <code>feature</code> is the name of a boolean evaluating feature.
26: *
27: * @param feature
28: * @return true/false
29: */
30: static final boolean isPredicateFeature(final String feature) {
31: return features.contains(StringUtils.trimToEmpty(feature));
32: }
33: }
|