本文整理汇总了Java中org.eclipse.xtext.util.Arrays类的典型用法代码示例。如果您正苦于以下问题:Java Arrays类的具体用法?Java Arrays怎么用?Java Arrays使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Arrays类属于org.eclipse.xtext.util包,在下文中一共展示了Arrays类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
开发者ID:eclipse,项目名称:n4js,代码行数:17,代码来源:PreparationStep.java
示例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);
}
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:N4JSProjectExplorerContentProvider.java
示例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;
}
开发者ID:QualiMaster,项目名称:Infrastructure,代码行数:25,代码来源:Tracing.java
示例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;
}
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:34,代码来源:AlgorithmProfileHelper.java
示例5: cfOtherImplementedMembers
import org.eclipse.xtext.util.Arrays; //导入依赖的package包/类
private String cfOtherImplementedMembers(MemberMatrix mm, TMember... filteredMembers) {
String others = validatorMessageHelper.descriptions(
StreamSupport.stream(mm.implemented().spliterator(), false)
.filter(m -> !Arrays.contains(filteredMembers, m))
.collect(Collectors.toList()));
if (others.length() == 0) {
return "";
}
return " Also cf. " + others + ".";
}
开发者ID:eclipse,项目名称:n4js,代码行数:11,代码来源:N4JSMemberRedefinitionValidator.java
示例6: 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;
}
开发者ID:eclipse,项目名称:n4js,代码行数:9,代码来源:ProjectComparisonEntry.java
示例7: 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;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:15,代码来源:AbstractValidationDiagnostic.java
示例8: 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;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:28,代码来源:DefaultResourceDescriptionDelta.java
示例9: 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;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:16,代码来源:XtextLinkingDiagnostic.java
示例10: assertNoError
import org.eclipse.xtext.util.Arrays; //导入依赖的package包/类
public void assertNoError(final Resource resource, final String issuecode, final String userData) {
final List<Issue> validate = validate(resource);
Iterable<Issue> issues = filter(validate, new Predicate<Issue>() {
@Override
public boolean apply(Issue input) {
if (issuecode.equals(input.getCode())) {
return userData == null || Arrays.contains(input.getData(), userData);
}
return false;
}
});
if (!isEmpty(issues))
fail("Expected no error '" + issuecode + "' but got " + getIssuesAsString(resource, issues, new StringBuilder()));
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:15,代码来源:ValidationTestHelper.java
示例11: 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;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:16,代码来源:EObjectDescriptionDeltaProvider.java
示例12: 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();
}
}
}
开发者ID:QualiMaster,项目名称:Infrastructure,代码行数:20,代码来源:AbstractFileTrace.java
示例13: isVisible
import org.eclipse.xtext.util.Arrays; //导入依赖的package包/类
@Override
public boolean isVisible() {
final WorkingSet[] visibleWorkingSets = delegate.getWorkingSetManager().getWorkingSets();
return Arrays.contains(visibleWorkingSets, delegate);
}
开发者ID:eclipse,项目名称:n4js,代码行数:6,代码来源:WorkingSetAdapter.java
示例14: execute
import org.eclipse.xtext.util.Arrays; //导入依赖的package包/类
/**
* Run a query on a single container.
*
* @param container
* The container
* @return The query result.
*/
public Iterable<IEObjectDescription> execute(final IContainer container) { // NOPMD NPathComplexity by WTH on 24.11.10 06:07
if (domains != null && !domains.isEmpty() && domainMapper != null) {
IDomain domain = domainMapper.map(container);
if (domain != null && !domains.contains(domain.getName())) {
// Query not applicable to this container.
return ImmutableList.of();
}
}
// Warning: we assume that our Containers and ResourceDescriptions from the index can handle name patterns.
Iterable<IEObjectDescription> result = namePattern != null ? container.getExportedObjects(getType(), namePattern, doIgnoreCase)
: container.getExportedObjectsByType(getType());
if (getUserData() != null && !getUserData().isEmpty()) {
final Map<String, String> userDataEquals = getUserData();
final Predicate<IEObjectDescription> userDataPredicate = new Predicate<IEObjectDescription>() {
@Override
public boolean apply(final IEObjectDescription input) {
for (final Entry<String, String> entry : userDataEquals.entrySet()) {
if (!entry.getValue().equals(input.getUserData(entry.getKey()))) {
return false;
}
}
return true;
}
};
result = Iterables.filter(result, userDataPredicate);
}
result = Iterables.transform(result, new Function<IEObjectDescription, IEObjectDescription>() {
@Override
public IEObjectDescription apply(final IEObjectDescription from) {
String[] keys = from.getUserDataKeys();
if (keys.length == 0 || !Arrays.contains(keys, DetachableEObjectDescription.ALLOW_LOOKUP)) {
LOGGER.error("Found object description '" + from.getQualifiedName() + "' at " + from.getEObjectURI() + ", but lookup is not allowed!"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
return keys.length == 0 ? from : new ProxyFactoryEObjectDescription(from);
}
});
return result;
}
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:50,代码来源:ContainerQuery.java
示例15: 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);
}
开发者ID:Yakindu,项目名称:statecharts,代码行数:6,代码来源:FilteringMenuManager.java
示例16: allowItem
import org.eclipse.xtext.util.Arrays; //导入依赖的package包/类
protected boolean allowItem(IContributionItem itemToAdd) {
if (Arrays.contains(exclude, itemToAdd.getId())) {
itemToAdd.setVisible(false);
}
return true;
}
开发者ID:Yakindu,项目名称:statecharts,代码行数:7,代码来源:DiagramPartitioningEditor.java
示例17: 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();
}
}
开发者ID:QualiMaster,项目名称:Infrastructure,代码行数:59,代码来源:AbstractFileTrace.java
示例18: 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);
}
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:10,代码来源:BasicModelLoadingListener.java
注:本文中的org.eclipse.xtext.util.Arrays类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论