当前位置: 首页>>代码示例>>Java>>正文


Java ArrayFactory类代码示例

本文整理汇总了Java中com.intellij.util.ArrayFactory的典型用法代码示例。如果您正苦于以下问题:Java ArrayFactory类的具体用法?Java ArrayFactory怎么用?Java ArrayFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ArrayFactory类属于com.intellij.util包,在下文中一共展示了ArrayFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getStubOrPsiChildren

import com.intellij.util.ArrayFactory; //导入依赖的package包/类
/**
 * @return children of specified type, taken from stubs (if this element is currently stub-based) or AST (otherwise).
 */
public <S extends StubElement, Psi extends PsiElement> Psi[] getStubOrPsiChildren(final IStubElementType<S, Psi> elementType, ArrayFactory<Psi> f) {
  T stub = myStub;
  if (stub != null) {
    //noinspection unchecked
    return (Psi[])stub.getChildrenByType(elementType, f);
  }
  else {
    final ASTNode[] nodes = SharedImplUtil.getChildrenOfType(getNode(), elementType);
    Psi[] psiElements = f.create(nodes.length);
    for (int i = 0; i < nodes.length; i++) {
      //noinspection unchecked
      psiElements[i] = (Psi)nodes[i].getPsi();
    }
    return psiElements;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:StubBasedPsiElementBase.java

示例2: getChildrenAsPsiElements

import com.intellij.util.ArrayFactory; //导入依赖的package包/类
@NotNull
public <T extends PsiElement> T[] getChildrenAsPsiElements(@Nullable TokenSet filter, ArrayFactory<T> constructor) {
  ApplicationManager.getApplication().assertReadAccessAllowed();
  int count = countChildren(filter);
  T[] result = constructor.create(count);
  if (count == 0) {
    return result;
  }
  int idx = 0;
  for (ASTNode child = getFirstChildNode(); child != null && idx < count; child = child.getTreeNext()) {
    if (filter == null || filter.contains(child.getElementType())) {
      @SuppressWarnings("unchecked") T element = (T)child.getPsi();
      LOG.assertTrue(element != null, child);
      result[idx++] = element;
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:CompositeElement.java

示例3: getImportElements

import com.intellij.util.ArrayFactory; //导入依赖的package包/类
@NotNull
public PyImportElement[] getImportElements() {
  final PyFromImportStatementStub stub = getStub();
  if (stub != null) {
    return stub.getChildrenByType(PyElementTypes.IMPORT_ELEMENT, new ArrayFactory<PyImportElement>() {
      @NotNull
      public PyImportElement[] create(int count) {
        return new PyImportElement[count];
      }
    });
  }
  List<PyImportElement> result = new ArrayList<PyImportElement>();
  final ASTNode importKeyword = getNode().findChildByType(PyTokenTypes.IMPORT_KEYWORD);
  if (importKeyword != null) {
    for (ASTNode node = importKeyword.getTreeNext(); node != null; node = node.getTreeNext()) {
      if (node.getElementType() == PyElementTypes.IMPORT_ELEMENT) {
        result.add((PyImportElement)node.getPsi());
      }
    }
  }
  return result.toArray(new PyImportElement[result.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:PyFromImportStatementImpl.java

示例4: getStubOrPsiChildren

import com.intellij.util.ArrayFactory; //导入依赖的package包/类
/**
 * @return children of specified type, taken from stubs (if this element is currently stub-based) or AST (otherwise).
 */
@Nonnull
public <S extends StubElement, Psi extends PsiElement> Psi[] getStubOrPsiChildren(@Nonnull IStubElementType<S, ? extends Psi> elementType, @Nonnull ArrayFactory<Psi> f) {
  T stub = getGreenStub();
  if (stub != null) {
    //noinspection unchecked
    return (Psi[])stub.getChildrenByType(elementType, f);
  }
  else {
    final ASTNode[] nodes = SharedImplUtil.getChildrenOfType(getNode(), elementType);
    Psi[] psiElements = f.create(nodes.length);
    for (int i = 0; i < nodes.length; i++) {
      //noinspection unchecked
      psiElements[i] = (Psi)nodes[i].getPsi();
    }
    return psiElements;
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:StubBasedPsiElementBase.java

示例5: getChildrenAsPsiElements

import com.intellij.util.ArrayFactory; //导入依赖的package包/类
@Nonnull
public <T extends PsiElement> T[] getChildrenAsPsiElements(@Nullable TokenSet filter, ArrayFactory<T> constructor) {
  ApplicationManager.getApplication().assertReadAccessAllowed();
  int count = countChildren(filter);
  T[] result = constructor.create(count);
  if (count == 0) {
    return result;
  }
  int idx = 0;
  for (ASTNode child = getFirstChildNode(); child != null && idx < count; child = child.getTreeNext()) {
    if (filter == null || filter.contains(child.getElementType())) {
      @SuppressWarnings("unchecked") T element = (T)child.getPsi();
      LOG.assertTrue(element != null, child);
      result[idx++] = element;
    }
  }
  return result;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:CompositeElement.java

示例6: createPackage

import com.intellij.util.ArrayFactory; //导入依赖的package包/类
@Nonnull
@Override
public PsiPackage createPackage(@Nonnull PsiManager psiManager,
                                @Nonnull PsiPackageManager packageManager,
                                @Nonnull Class<? extends ModuleExtension> extensionClass,
                                @Nonnull String packageName) {
  return new PsiPackageBase(psiManager, packageManager, extensionClass, packageName) {
    @Override
    protected ArrayFactory<? extends PsiPackage> getPackageArrayFactory() {
      return PsiPackage.ARRAY_FACTORY;
    }

    @RequiredReadAction
    @Nonnull
    @Override
    public Language getLanguage() {
      return SandLanguage.INSTANCE;
    }
  };
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:Sand2PackageProvider.java

示例7: getStubChildrenByType

import com.intellij.util.ArrayFactory; //导入依赖的package包/类
private static <E extends PsiElement> E[] getStubChildrenByType(JSClassStub stub, final IElementType elementType, ArrayFactory<E> f)
{
	assert JSElementTypes.INCLUDE_DIRECTIVE != elementType;

	ArrayList<E> result = new ArrayList<E>(Arrays.asList(stub.getChildrenByType(elementType, f)));
	JSIncludeDirective[] includes = stub.getChildrenByType(JSElementTypes.INCLUDE_DIRECTIVE, new ArrayFactory<JSIncludeDirective>()
	{
		@Override
		public JSIncludeDirective[] create(final int count)
		{
			return new JSIncludeDirective[count];
		}
	});
	Collection<JSFile> visited = new THashSet<JSFile>();
	TokenSet filter = TokenSet.create(JSElementTypes.INCLUDE_DIRECTIVE, elementType);
	for(JSIncludeDirective include : includes)
	{
		PsiFile file = include.resolveFile();
		if(file instanceof JSFile)
		{
			process(filter, (JSFile) file, result, visited);
		}
	}
	return result.toArray(f.create(result.size()));
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:26,代码来源:JSClassBase.java

示例8: getChildrenByType

import com.intellij.util.ArrayFactory; //导入依赖的package包/类
@Override
public <E extends PsiElement> E[] getChildrenByType(final IElementType elementType, final ArrayFactory<E> f) {
  int count = countChildren(elementType);

  E[] result = f.create(count);
  if (count > 0) fillFilteredChildren(elementType, result);

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:StubBase.java

示例9: getImportElements

import com.intellij.util.ArrayFactory; //导入依赖的package包/类
@NotNull
public PyImportElement[] getImportElements() {
  final PyImportStatementStub stub = getStub();
  if (stub != null) {
    return stub.getChildrenByType(PyElementTypes.IMPORT_ELEMENT, new ArrayFactory<PyImportElement>() {
      @NotNull
      public PyImportElement[] create(int count) {
        return new PyImportElement[count];
      }
    });
  }
  return childrenToPsi(TokenSet.create(PyElementTypes.IMPORT_ELEMENT), new PyImportElement[0]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:PyImportStatementImpl.java

示例10: getStubOrPsiChildren

import com.intellij.util.ArrayFactory; //导入依赖的package包/类
public <Stub extends StubElement, Psi extends PsiElement> Psi[] getStubOrPsiChildren(final IStubElementType<Stub, Psi> elementType, ArrayFactory<Psi> f) {
  T stub = myStub;
  if (stub != null) {
    //noinspection unchecked
    return (Psi[])stub.getChildrenByType(elementType, f);
  }
  else {
    final ASTNode[] nodes = SharedImplUtil.getChildrenOfType(getNode(), elementType);
    Psi[] psiElements = f.create(nodes.length);
    for (int i = 0; i < nodes.length; i++) {
      psiElements[i] = (Psi)nodes[i].getPsi();
    }
    return psiElements;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:StubBasedPsiElementBase.java

示例11: getChildrenByType

import com.intellij.util.ArrayFactory; //导入依赖的package包/类
@Nonnull
@Override
public <E extends PsiElement> E[] getChildrenByType(@Nonnull final IElementType elementType, @Nonnull final ArrayFactory<E> f) {
  int count = countChildren(elementType);

  E[] result = f.create(count);
  if (count > 0) fillFilteredChildren(elementType, result);

  return result;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:11,代码来源:StubBase.java

示例12: getPackageArrayFactory

import com.intellij.util.ArrayFactory; //导入依赖的package包/类
@Override
protected ArrayFactory<? extends PsiPackage> getPackageArrayFactory()
{
	return HaxePackage.ARRAY_FACTORY;
}
 
开发者ID:consulo,项目名称:consulo-haxe,代码行数:6,代码来源:HaxePackageImpl.java

示例13: getFirstStubOrPsiChild

import com.intellij.util.ArrayFactory; //导入依赖的package包/类
@Nullable
public <T extends PsiElement> T getFirstStubOrPsiChild(TokenSet tokenSet, ArrayFactory<T> arrayFactory)
{
	T[] stubOrPsiChildren = getStubOrPsiChildren(tokenSet, arrayFactory);
	return ArrayUtil2.safeGet(stubOrPsiChildren, 0);
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:7,代码来源:MsilStubElementImpl.java

示例14: getStubOrPsiChildByIndex

import com.intellij.util.ArrayFactory; //导入依赖的package包/类
@Nullable
public <T extends PsiElement> T getStubOrPsiChildByIndex(TokenSet tokenSet, ArrayFactory<T> arrayFactory, int index)
{
	T[] stubOrPsiChildren = getStubOrPsiChildren(tokenSet, arrayFactory);
	return ArrayUtil2.safeGet(stubOrPsiChildren, index);
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:7,代码来源:MsilStubElementImpl.java

示例15: getPackageArrayFactory

import com.intellij.util.ArrayFactory; //导入依赖的package包/类
@Override
protected ArrayFactory<? extends PsiPackage> getPackageArrayFactory()
{
	return DotNetPackage.ARRAY_FACTORY;
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:6,代码来源:DotNetPackage.java


注:本文中的com.intellij.util.ArrayFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。