本文整理汇总了Java中org.eclipse.xtext.util.Arrays.contains方法的典型用法代码示例。如果您正苦于以下问题:Java Arrays.contains方法的具体用法?Java Arrays.contains怎么用?Java Arrays.contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtext.util.Arrays
的用法示例。
在下文中一共展示了Arrays.contains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copyReference
import org.eclipse.xtext.util.Arrays; //导入方法依赖的package包/类
@Override
protected void copyReference(EReference eReference, EObject eObject, EObject copyEObject) {
final boolean needsRewiring = Arrays.contains(REWIRED_REFERENCES, eReference);
if (needsRewiring) {
if (!(copyEObject instanceof ReferencingElement_IM)) {
throw new IllegalStateException(
"an EObject with a cross-reference that requires rewiring must have a copy of type ReferencingElement_IM;"
+ "\nin object: " + eObject
+ "\nin resource: " + eObject.eResource().getURI());
}
rewire(eObject, (ReferencingElement_IM) copyEObject);
// note: suppress default behavior (references "id", "property", "declaredType" should stay at 'null')
} else {
super.copyReference(eReference, eObject, copyEObject);
}
}
示例2: getParent
import org.eclipse.xtext.util.Arrays; //导入方法依赖的package包/类
@Override
public Object getParent(Object element) {
// Required by editor - navigator linking to locate parent item in tree.
if (element instanceof IProject && workingSetManagerBroker.isWorkingSetTopLevel()) {
final WorkingSetManager activeManager = workingSetManagerBroker.getActiveManager();
if (activeManager != null) {
for (final WorkingSet workingSet : activeManager.getWorkingSets()) {
final IAdaptable[] elements = workingSet.getElements();
if (!Arrays2.isEmpty(elements) && Arrays.contains(elements, element)) {
return workingSet;
}
}
}
}
return super.getParent(element);
}
示例3: getObservableSequence
import org.eclipse.xtext.util.Arrays; //导入方法依赖的package包/类
/**
* Returns the observables in output sequence. Considers {@link #LIMIT} and {@link #EXCLUDE}.
*
* @param cls the part class to sort the observables (and to cache them for)
* @param observables the observables related to <code>cls</code>
* @return the sorted observables
*/
static IObservable[] getObservableSequence(Class<?> cls, Collection<IObservable> observables) {
IObservable[] result = SEQUENCES.get(cls);
if (null == result && null != observables) {
TreeSet<IObservable> tmp = new TreeSet<IObservable>(ObservableComparator.INSTANCE);
IObservable[] limit = LIMIT.get(cls.getClass());
IObservable[] exclude = EXCLUDE.get(cls.getClass());
for (IObservable observable : observables) {
if ((null == limit || Arrays.contains(limit, observable))
&& (null == exclude || !Arrays.contains(exclude, observable))) {
tmp.add(observable);
}
}
result = new IObservable[tmp.size()];
SEQUENCES.put(cls, tmp.toArray(result));
}
return result;
}
示例4: addTopLevelValues
import org.eclipse.xtext.util.Arrays; //导入方法依赖的package包/类
/**
* Adds top level values configured for <code>source</code> to <code>target</code>.
*
* @param cfg the actual configuration holding the values
* @param source the source project
* @param target the target project
* @param exclude the variable names to exclude
* @return the changed top-level variables ready for freezing
* @throws CSTSemanticException in case of CST errors
*/
private static List<IFreezable> addTopLevelValues(Configuration cfg, Project source, Project target,
String... exclude) throws CSTSemanticException {
List<IFreezable> result = new ArrayList<IFreezable>();
for (int e = 0; e < source.getElementCount(); e++) {
ContainableModelElement elt = source.getElement(e);
if (elt instanceof DecisionVariableDeclaration) {
DecisionVariableDeclaration decl = (DecisionVariableDeclaration) elt;
if (!Arrays.contains(exclude, decl.getName())) {
IDecisionVariable decVar = cfg.getDecision(decl);
Value value = decVar.getValue();
if (null != value && !ConstraintType.isConstraint(decVar.getDeclaration().getType())) {
ConstraintSyntaxTree cst = new OCLFeatureCall(new Variable(decl), IvmlKeyWords.ASSIGNMENT,
new ConstantValue(decVar.getValue().clone()));
cst.inferDatatype();
Constraint constraint = new Constraint(cst, target);
target.addConstraint(constraint);
result.add(decl);
}
}
}
}
return result;
}
示例5: getChildForElementImpl
import org.eclipse.xtext.util.Arrays; //导入方法依赖的package包/类
public ProjectComparisonEntry getChildForElementImpl(@SuppressWarnings("hiding") EObject elementImpl) {
if (elementImpl == null)
throw new IllegalArgumentException("elementImpl may not be null");
for (ProjectComparisonEntry currE : getChildren())
if (Arrays.contains(currE.elementImpl, elementImpl))
return currE;
return null;
}
示例6: AbstractValidationDiagnostic
import org.eclipse.xtext.util.Arrays; //导入方法依赖的package包/类
/**
* @param issueData optional user data. May not contain <code>null</code> entries.
*/
protected AbstractValidationDiagnostic(int severity, String message, EObject source, CheckType checkType, String issueCode, String... issueData) {
if (Arrays.contains(issueData, null)) {
throw new NullPointerException("issueData may not contain null");
}
this.source = source;
this.severity = severity;
this.message = message;
this.issueCode = issueCode;
this.checkType = checkType;
this.issueData = issueData;
}
示例7: equals
import org.eclipse.xtext.util.Arrays; //导入方法依赖的package包/类
protected boolean equals(IEObjectDescription oldObj, IEObjectDescription newObj) {
if (oldObj == newObj)
return true;
if (oldObj.getEClass() != newObj.getEClass())
return false;
if (oldObj.getName() != null && !oldObj.getName().equals(newObj.getName()))
return false;
if (!oldObj.getEObjectURI().equals(newObj.getEObjectURI()))
return false;
String[] oldKeys = oldObj.getUserDataKeys();
String[] newKeys = newObj.getUserDataKeys();
if (oldKeys.length != newKeys.length)
return false;
for (String key : oldKeys) {
if (!Arrays.contains(newKeys, key))
return false;
String oldValue = oldObj.getUserData(key);
String newValue = newObj.getUserData(key);
if (oldValue == null) {
if (newValue != null)
return false;
} else if (!oldValue.equals(newValue)) {
return false;
}
}
return true;
}
示例8: XtextLinkingDiagnostic
import org.eclipse.xtext.util.Arrays; //导入方法依赖的package包/类
/**
* @param data optional user data. May not contain <code>null</code> entries.
* @throws NullPointerException if node is <code>null</code> or data contains <code>null</code>.
*/
public XtextLinkingDiagnostic(INode node, String message, String code, String... data) {
if (node == null)
throw new NullPointerException("node may not be null");
if (Arrays.contains(data, null)) {
throw new NullPointerException("data may not contain null");
}
this.node = node;
this.message = message;
this.code = code;
this.data = data;
}
示例9: isUserDataEqual
import org.eclipse.xtext.util.Arrays; //导入方法依赖的package包/类
protected boolean isUserDataEqual(IEObjectDescription oldObj, IEObjectDescription newObj) {
String[] oldKeys = oldObj.getUserDataKeys();
String[] newKeys = newObj.getUserDataKeys();
if (oldKeys.length != newKeys.length)
return false;
for (String key : oldKeys) {
if (!Arrays.contains(newKeys, key))
return false;
String oldValue = oldObj.getUserData(key);
String newValue = newObj.getUserData(key);
if (!Objects.equal(oldValue, newValue))
return false;
}
return true;
}
示例10: traceHeader
import org.eclipse.xtext.util.Arrays; //导入方法依赖的package包/类
/**
* Trace output for the header line for <code>part</code>.
*
* @param part the part to create the header part for
* @param prefix additional text to be printed before the name of the columns (may be empty)
* @param exclude observables to exclude - trace only other others (may be <b>null</b>)
* @param include observables to include - trace only those (may be <b>null</b>)
*/
protected void traceHeader(SystemPart part, String prefix, IObservable[] exclude, IObservable[] include) {
IObservable[] sequence = Tracing.getObservableSequence(part);
for (int o = 0; o < sequence.length; o++) {
IObservable observable = sequence[o];
if ((null == include || Arrays.contains(include, observable))
&& (null == exclude || !Arrays.contains(exclude, observable))) {
print(prefix + observable.name());
printSeparator();
}
}
}
示例11: isVisible
import org.eclipse.xtext.util.Arrays; //导入方法依赖的package包/类
@Override
public boolean isVisible() {
final WorkingSet[] visibleWorkingSets = delegate.getWorkingSetManager().getWorkingSets();
return Arrays.contains(visibleWorkingSets, delegate);
}
示例12: allowItem
import org.eclipse.xtext.util.Arrays; //导入方法依赖的package包/类
protected boolean allowItem(IContributionItem itemToAdd) {
if (itemToAdd.getId() != null && Arrays.contains(exclusionSet, itemToAdd.getId()))
itemToAdd.setVisible(false);
return super.allowItem(itemToAdd);
}
示例13: allowItem
import org.eclipse.xtext.util.Arrays; //导入方法依赖的package包/类
protected boolean allowItem(IContributionItem itemToAdd) {
if (Arrays.contains(exclude, itemToAdd.getId())) {
itemToAdd.setVisible(false);
}
return true;
}
示例14: trace
import org.eclipse.xtext.util.Arrays; //导入方法依赖的package包/类
/**
* Traces the values observed for <code>part</code>.
*
* @param part the part to trace (may be <b>null</b> if already gone)
* @param partCls the class of part, ignored if part is not <b>null</b>, otherwise used to determine the sequence
* @param exclude observables to exclude - trace only other others (may be <b>null</b>)
* @param include observables to include - trace only those (may be <b>null</b>)
* @param taskId if given, trace only observations for <code>taskId</code>, print <code>part</code>-level
* observables if <b>null</b>
*/
protected void trace(SystemPart part, Class<? extends SystemPart> partCls, IObservable[] exclude,
IObservable[] include, Integer taskId) {
ComponentKey host = null;
IObservable[] sequence;
if (null != part) {
sequence = Tracing.getObservableSequence(part);
} else {
sequence = Tracing.getObservableSequence(partCls, null); // if not seen so far, no (specific) sequence is ok
}
for (int o = 0; o < sequence.length; o++) {
IObservable observable = sequence[o];
if ((null == include || Arrays.contains(include, observable))
&& (null == exclude || !Arrays.contains(exclude, observable))) {
boolean printed = false;
if (null != taskId && null != part) {
ComponentKey key = null;
Set<Object> keys = part.getComponentKeys(observable);
for (Object k : keys) {
if (k instanceof ComponentKey && ((ComponentKey) k).getTaskId() == taskId) {
key = (ComponentKey) k;
break;
}
}
if (null != key) {
print(part.getObservedValue(observable, key));
printed = true;
if (null == host) {
host = key;
}
}
}
if (!printed) {
if (null != part && part.hasValue(observable)) {
print(part.getObservedValue(observable));
printed = true;
}
if (!printed) {
print("");
}
}
printSeparator();
}
}
if (null != host) {
print(host.getHostName());
printSeparator();
}
}
示例15: inTypes
import org.eclipse.xtext.util.Arrays; //导入方法依赖的package包/类
/**
* Whether <code>type</code> is in {@link #types}.
*
* @param type the type to look for
* @return <code>true</code> if type is a contained type, <code>false</code> else
*/
private boolean inTypes(Type type) {
return null == types || Arrays.contains(types, type);
}