本文整理汇总了Java中com.intellij.util.ArrayFactory.create方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayFactory.create方法的具体用法?Java ArrayFactory.create怎么用?Java ArrayFactory.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.ArrayFactory
的用法示例。
在下文中一共展示了ArrayFactory.create方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例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;
}
示例3: 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;
}
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
}
示例7: 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;
}
示例8: LockFreeCOWSortedArray
import com.intellij.util.ArrayFactory; //导入方法依赖的package包/类
LockFreeCOWSortedArray(@Nonnull Comparator<? super T> comparator, @Nonnull ArrayFactory<T> arrayFactory) {
this.comparator = comparator;
this.arrayFactory = arrayFactory;
listeners = arrayFactory.create(0);
}