org.eclipse.xtext.util.Tuples类的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中org.eclipse.xtext.util.Tuples类的一些代码示例,展示了Tuples类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tuples类的具体详情如下:
包路径:org.eclipse.xtext.util.Tuples
类名称:Tuples

Tuples介绍

暂无

代码示例

代码示例来源:origin: org.eclipse/xtext

@Override
public Pair<Boolean, Boolean> caseAction(Action object) {
  return Tuples.create(true, true);
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase.testing

@SuppressWarnings("unchecked")
public <RT, T1, T2> Functions.Function2<T1, T2, RT> createFunction(
    String body, Class<RT> returnType, Class<T1> paramType1,
    Class<T2> paramType2) {
  return (Functions.Function2<T1, T2, RT>) internalCreateFunction(body,
      returnType, Tuples.pair((Type) paramType1, "p1"),
      Tuples.pair((Type) paramType2, "p2"));
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.util

public static <A,B> Pair<A,B> pair(A a, B b) {
  return create(a,b);
}
public static <A,B> Pair<A,B> create(A a, B b) {

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase.testing

@SuppressWarnings("unchecked")
public <RT, T> Functions.Function1<T, RT> createFunction(String body,
    Class<RT> returnType, Class<T> paramType) {
  return (Functions.Function1<T, RT>) internalCreateFunction(body,
      returnType, Tuples.pair((Type) paramType, "p"));
}

代码示例来源:origin: org.eclipse/xtext

@Override
public Pair<Boolean, Boolean> caseAbstractElement(AbstractElement object) {
  return Tuples.create(false, false);
}

代码示例来源:origin: org.eclipse/xtext

protected void addDeadEnd(int depth, AbstractToken deadend) {
  if (deadends.size() >= THRESHOLD && depth < deadends.first().getFirst())
    return;
  if (deadends.size() >= THRESHOLD)
    deadends.remove(deadends.first());
  deadends.add(Tuples.pair(depth, deadend));
}

代码示例来源:origin: org.eclipse/xtext

public Pair<AbstractElement, AbstractElement> matchBetween() {
    return Tuples.create(after, before);
  }
}

代码示例来源:origin: org.eclipse/xtext

@Override
public String getURIFragment(final EObject object) {
  return cache.get(Tuples.pair(object, "fragment"), this, new Provider<String>() {
    public String get() {
      if (fragmentProvider != null) {
        String result = fragmentProvider.getFragment(object, fragmentProviderFallback);
        return result;
      }
      String result = XtextResource.super.getURIFragment(object);
      return result;
    }
  });
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

protected Object getKey(Notifier context, EReference reference) {
  return Tuples.create(XImportSectionNamespaceScopeProvider.class, context, reference);
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase.testing

protected Pair<String, String> createFullCode(String statementCode,
    Type returnType, @SuppressWarnings("unchecked") Pair<Type, String>... params) {
  String className = "_$GeneratedClass";
  StringBuilder sb = new StringBuilder("public class ").append(className)
      .append(" implements ")
      .append("org.eclipse.xtext.xbase.lib.Functions.Function")
      .append(params.length).append("<");
  for (Pair<Type, String> type : params) {
    sb.append(toString(type.getFirst())).append(",");
  }
  sb.append(toString(returnType));
  sb.append("> {\n");
  sb.append("public ").append(toString(returnType));
  sb.append(" apply(");
  for (int i = 0; i < params.length; i++) {
    Pair<Type, String> pair = params[i];
    sb.append(toString(pair.getFirst())).append(" ")
        .append(pair.getSecond());
    if (i + 1 < params.length)
      sb.append(",");
  }
  sb.append(") {\n");
  sb.append(statementCode);
  sb.append("\n}}");
  return Tuples.pair(className, sb.toString());
}

代码示例来源:origin: org.eclipse.xtext/util

public static <A,B> Pair<A,B> pair(A a, B b) {
  return create(a,b);
}
public static <A,B> Pair<A,B> create(A a, B b) {

代码示例来源:origin: org.eclipse/xtext

public QualifiedName getFullyQualifiedName(final EObject obj) {
  return cache.get(Tuples.pair(obj, "fqn"), obj.eResource(), new Provider<QualifiedName>(){
    public QualifiedName get() {
      EObject temp = obj;
      QualifiedName qualifiedNameFromDispatcher = qualifiedName.invoke(temp);
      if (qualifiedNameFromDispatcher!=null)
        return qualifiedNameFromDispatcher;
      String name = getResolver().apply(temp);
      if (Strings.isEmpty(name))
        return null;
      QualifiedName qualifiedNameFromConverter = converter.toQualifiedName(name);
      while (temp.eContainer() != null) {
        temp = temp.eContainer();
        QualifiedName parentsQualifiedName = getFullyQualifiedName(temp);
        if (parentsQualifiedName != null)
          return parentsQualifiedName.append(qualifiedNameFromConverter);
      }
      return qualifiedNameFromConverter;
    }
  });
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

protected Object getKey(Notifier context, EReference reference) {
  return Tuples.create(XImportSectionNamespaceScopeProvider.class, context, reference);
}

代码示例来源:origin: org.codehaus.openxma/dsl-pom

public QualifiedName getFullyQualifiedName(final EObject obj) {
  return cache.get(Tuples.pair(obj, "fqn"), obj.eResource(), new Provider<QualifiedName>(){
    public QualifiedName get() {
      EObject temp = obj;
      QualifiedName qualifiedNameFromDispatcher = qualifiedName.invoke(temp);
      if (qualifiedNameFromDispatcher!=null)
        return qualifiedNameFromDispatcher;
      String name = getResolver(obj).apply(temp);
      if (Strings.isEmpty(name))
        return null;
      QualifiedName qualifiedNameFromConverter = getConverter().toQualifiedName(name);
      while (temp.eContainer() != null) {
        temp = temp.eContainer();
        QualifiedName parentsQualifiedName = getFullyQualifiedName(temp);
        if (parentsQualifiedName != null)
          return parentsQualifiedName.append(qualifiedNameFromConverter);
      }
      return qualifiedNameFromConverter;
    }
  });
}

代码示例来源:origin: org.eclipse/xtext

protected Object getKey(Notifier context, EReference reference) {
  return Tuples.create(ImportedNamespaceAwareLocalScopeProvider.class, context, reference);
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.ecore

@Override
public QualifiedName getFullyQualifiedName(final EObject obj) {
  return cache.get(Tuples.pair(obj, getCacheKey()), obj.eResource(), new Provider<QualifiedName>() {
    @Override
    public QualifiedName get() {
      EObject temp = obj;
      String name = nameDispatcher.invoke(temp);
      if (Strings.isEmpty(name))
        return null;
      QualifiedName qualifiedName = QualifiedName.create(name);
      if(!isRecurseParent(obj))
        return qualifiedName;
      QualifiedName parentsQualifiedName = getFullyQualifiedName(obj.eContainer());
      if (parentsQualifiedName == null)
        return null;
      else 
        return parentsQualifiedName.append(qualifiedName);
    }
  });
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.ide

@Override
public <T extends Notifier> void addModification(T context, IModification<T> modification) {
  modifications.add(Tuples.create(context, modification));
}

代码示例来源:origin: org.eclipse/xtext

public IScope getScope(final EObject context, final EReference reference) {
  ISelectable resourceContent = cache.get(Tuples.pair(SimpleLocalScopeProvider.class.getName(), reference), 
      context.eResource(), new Provider<ISelectable>() {
    public ISelectable get() {
      return getAllDescriptions(context.eResource());
    }
  });
  IScope globalScope = getGlobalScope(context.eResource(), reference);
  return createScope(globalScope, resourceContent, reference.getEReferenceType(), isIgnoreCase(reference));
}

代码示例来源:origin: org.eclipse/xtext

protected IConstraint getConstraint(EObject context, EClass type) {
  return constraints.get(Tuples.create(context, type));
}

代码示例来源:origin: org.eclipse.xtext/ui

public void acceptDefaultHighlighting(String id, String name, TextStyle style) {
  highlightings.add(Tuples.create(id, name, style));
}

相关文章