001package org.andromda.translation.ocl.validation; 002 003import java.util.Arrays; 004import java.util.Collection; 005import org.apache.commons.lang.StringUtils; 006 007/** 008 * Contains a single operation {@link #isPredicateFeature(String)} that determines if a passed in <code>feature</code> 009 * matches the name of a feature that should use a predicate when being translated. 010 * 011 * @author Chad Brandon 012 */ 013class OCLPredicateFeatures 014{ 015 /** 016 * Contains the names of feature calls that are expected to use predicates while being translated. 017 */ 018 private static final String[] PREDICATE_FEATURES = new String[]{"one", "forAll", "reject", "select", "any", 019 "exists",}; 020 021 private static final Collection features = Arrays.asList(PREDICATE_FEATURES); 022 023 /** 024 * Indicates whether or not the passed in <code>feature</code> is the name of a boolean evaluating feature. 025 * 026 * @param feature 027 * @return true/false 028 */ 029 static final boolean isPredicateFeature(final String feature) 030 { 031 return features.contains(StringUtils.trimToEmpty(feature)); 032 } 033}