1 package org.andromda.translation.ocl.validation;
2
3 import java.util.Arrays;
4 import java.util.Collection;
5 import org.apache.commons.lang.StringUtils;
6
7 /**
8 * Contains a single operation {@link #isPredicateFeature(String)} that determines if a passed in <code>feature</code>
9 * matches the name of a feature that should use a predicate when being translated.
10 *
11 * @author Chad Brandon
12 */
13 class OCLPredicateFeatures
14 {
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[]{"one", "forAll", "reject", "select", "any",
19 "exists",};
20
21 private static final Collection features = Arrays.asList(PREDICATE_FEATURES);
22
23 /**
24 * Indicates whether or not the passed in <code>feature</code> is the name of a boolean evaluating feature.
25 *
26 * @param feature
27 * @return true/false
28 */
29 static final boolean isPredicateFeature(final String feature)
30 {
31 return features.contains(StringUtils.trimToEmpty(feature));
32 }
33 }