本文整理汇总了Java中com.intellij.util.containers.IntArrayList.size方法的典型用法代码示例。如果您正苦于以下问题:Java IntArrayList.size方法的具体用法?Java IntArrayList.size怎么用?Java IntArrayList.size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.containers.IntArrayList
的用法示例。
在下文中一共展示了IntArrayList.size方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareExitStatements
import com.intellij.util.containers.IntArrayList; //导入方法依赖的package包/类
public Collection<PsiStatement> prepareExitStatements(final PsiElement[] elements) throws ExitStatementsNotSameException {
myExitPoints = new IntArrayList();
myExitStatements = ControlFlowUtil
.findExitPointsAndStatements(myControlFlow, myFlowStart, myFlowEnd, myExitPoints, ControlFlowUtil.DEFAULT_EXIT_STATEMENTS_CLASSES);
if (LOG.isDebugEnabled()) {
LOG.debug("exit points:");
for (int i = 0; i < myExitPoints.size(); i++) {
LOG.debug(" " + myExitPoints.get(i));
}
LOG.debug("exit statements:");
for (PsiStatement exitStatement : myExitStatements) {
LOG.debug(" " + exitStatement);
}
}
if (myExitPoints.isEmpty()) {
// if the fragment never exits assume as if it exits in the end
myExitPoints.add(myControlFlow.getEndOffset(elements[elements.length - 1]));
}
if (myExitPoints.size() != 1) {
myGenerateConditionalExit = true;
areExitStatementsTheSame();
}
return myExitStatements;
}
示例2: prepareExitStatements
import com.intellij.util.containers.IntArrayList; //导入方法依赖的package包/类
public Collection<PsiStatement> prepareExitStatements(final PsiElement[] elements) throws ExitStatementsNotSameException {
myExitPoints = new IntArrayList();
myExitStatements = ControlFlowUtil
.findExitPointsAndStatements(myControlFlow, myFlowStart, myFlowEnd, myExitPoints, ControlFlowUtil.DEFAULT_EXIT_STATEMENTS_CLASSES);
if (LOG.isDebugEnabled()) {
LOG.debug("exit points:");
for (int i = 0; i < myExitPoints.size(); i++) {
LOG.debug(" " + myExitPoints.get(i));
}
LOG.debug("exit statements:");
for (PsiStatement exitStatement : myExitStatements) {
LOG.debug(" " + exitStatement);
}
}
if (myExitPoints.isEmpty()) {
// if the fragment never exits assume as if it exits in the end
myExitPoints.add(myControlFlow.getEndOffset(elements[elements.length - 1]));
}
if (myExitPoints.size() != 1) {
areExitStatementsTheSame();
myGenerateConditionalExit = true;
}
return myExitStatements;
}
示例3: restoreEmptyVariables
import com.intellij.util.containers.IntArrayList; //导入方法依赖的package包/类
private void restoreEmptyVariables(IntArrayList indices) {
List<TextRange> rangesToRemove = ContainerUtil.newArrayList();
for (int i = 0; i < indices.size(); i++) {
int index = indices.get(i);
rangesToRemove.add(TextRange.create(mySegments.getSegmentStart(index), mySegments.getSegmentEnd(index)));
}
Collections.sort(rangesToRemove, (o1, o2) -> {
int startDiff = o2.getStartOffset() - o1.getStartOffset();
return startDiff != 0 ? startDiff : o2.getEndOffset() - o1.getEndOffset();
});
DocumentUtil.executeInBulk(myDocument, true, () -> {
if (isDisposed()) {
return;
}
for (TextRange range : rangesToRemove) {
myDocument.deleteString(range.getStartOffset(), range.getEndOffset());
}
});
}
示例4: DuplicatesFinder
import com.intellij.util.containers.IntArrayList; //导入方法依赖的package包/类
public DuplicatesFinder(PsiElement[] pattern,
InputVariables parameters,
@Nullable ReturnValue returnValue,
@NotNull List<? extends PsiVariable> outputParameters
) {
myReturnValue = returnValue;
LOG.assertTrue(pattern.length > 0);
myPattern = pattern;
myPatternAsList = Arrays.asList(myPattern);
myParameters = parameters;
myOutputParameters = outputParameters;
final PsiElement codeFragment = ControlFlowUtil.findCodeFragment(pattern[0]);
try {
final ControlFlow controlFlow = ControlFlowFactory.getInstance(codeFragment.getProject()).getControlFlow(codeFragment, new LocalsControlFlowPolicy(codeFragment), false);
int startOffset;
int i = 0;
do {
startOffset = controlFlow.getStartOffset(pattern[i++]);
} while(startOffset < 0 && i < pattern.length);
int endOffset;
int j = pattern.length - 1;
do {
endOffset = controlFlow.getEndOffset(pattern[j--]);
} while(endOffset < 0 && j >= 0);
IntArrayList exitPoints = new IntArrayList();
final Collection<PsiStatement> exitStatements = ControlFlowUtil
.findExitPointsAndStatements(controlFlow, startOffset, endOffset, exitPoints, ControlFlowUtil.DEFAULT_EXIT_STATEMENTS_CLASSES);
myMultipleExitPoints = exitPoints.size() > 1;
if (myMultipleExitPoints) {
myParameters.removeParametersUsedInExitsOnly(codeFragment, exitStatements, controlFlow, startOffset, endOffset);
}
}
catch (AnalysisCanceledException e) {
}
}
示例5: clearLineModificationFlagsExcept
import com.intellij.util.containers.IntArrayList; //导入方法依赖的package包/类
void clearLineModificationFlagsExcept(@NotNull int[] caretLines) {
IntArrayList modifiedLines = new IntArrayList(caretLines.length);
LineSet lineSet = getLineSet();
for (int line : caretLines) {
if (line >= 0 && line < lineSet.getLineCount() && lineSet.isModified(line)) {
modifiedLines.add(line);
}
}
lineSet = lineSet.clearModificationFlags();
for (int i = 0; i < modifiedLines.size(); i++) {
lineSet = lineSet.setModified(modifiedLines.get(i));
}
myLineSet = lineSet;
myFrozen = null;
}
示例6: checkUsages
import com.intellij.util.containers.IntArrayList; //导入方法依赖的package包/类
static void checkUsages(final SliceUsage usage, final boolean dataFlowToThis, final TIntObjectHashMap<IntArrayList> flownOffsets) {
final List<SliceUsage> children = new ArrayList<SliceUsage>();
boolean b = ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
@Override
public void run() {
usage.processChildren(new CommonProcessors.CollectProcessor<SliceUsage>(children));
}
}, "Expanding", true, usage.getElement().getProject());
assertTrue(b);
int startOffset = usage.getElement().getTextOffset();
IntArrayList list = flownOffsets.get(startOffset);
int[] offsets = list == null ? new int[0] : list.toArray();
Arrays.sort(offsets);
int size = list == null ? 0 : list.size();
assertEquals(message(startOffset, usage), size, children.size());
Collections.sort(children, new Comparator<SliceUsage>() {
@Override
public int compare(SliceUsage o1, SliceUsage o2) {
return o1.compareTo(o2);
}
});
for (int i = 0; i < children.size(); i++) {
SliceUsage child = children.get(i);
int offset = offsets[i];
assertEquals(message(offset, child), offset, child.getUsageInfo().getElement().getTextOffset());
checkUsages(child, dataFlowToThis, flownOffsets);
}
}
示例7: clearLineModificationFlagsExcept
import com.intellij.util.containers.IntArrayList; //导入方法依赖的package包/类
void clearLineModificationFlagsExcept(@Nonnull int[] caretLines) {
IntArrayList modifiedLines = new IntArrayList(caretLines.length);
LineSet lineSet = getLineSet();
for (int line : caretLines) {
if (line >= 0 && line < lineSet.getLineCount() && lineSet.isModified(line)) {
modifiedLines.add(line);
}
}
lineSet = lineSet.clearModificationFlags();
for (int i = 0; i < modifiedLines.size(); i++) {
lineSet = lineSet.setModified(modifiedLines.get(i));
}
myLineSet = lineSet;
myFrozen = null;
}
示例8: prepareExitStatements
import com.intellij.util.containers.IntArrayList; //导入方法依赖的package包/类
public Collection<PsiStatement> prepareExitStatements(final PsiElement[] elements) throws ExitStatementsNotSameException
{
myExitPoints = new IntArrayList();
myExitStatements = ControlFlowUtil.findExitPointsAndStatements(myControlFlow, myFlowStart, myFlowEnd, myExitPoints, ControlFlowUtil.DEFAULT_EXIT_STATEMENTS_CLASSES);
if(LOG.isDebugEnabled())
{
LOG.debug("exit points:");
for(int i = 0; i < myExitPoints.size(); i++)
{
LOG.debug(" " + myExitPoints.get(i));
}
LOG.debug("exit statements:");
for(PsiStatement exitStatement : myExitStatements)
{
LOG.debug(" " + exitStatement);
}
}
if(myExitPoints.isEmpty())
{
// if the fragment never exits assume as if it exits in the end
myExitPoints.add(myControlFlow.getEndOffset(elements[elements.length - 1]));
}
if(myExitPoints.size() != 1)
{
myGenerateConditionalExit = true;
areExitStatementsTheSame();
}
return myExitStatements;
}
示例9: commentNestedComments
import com.intellij.util.containers.IntArrayList; //导入方法依赖的package包/类
static void commentNestedComments(@NotNull Document document, TextRange range, Commenter commenter) {
final int offset = range.getStartOffset();
final IntArrayList toReplaceWithComments = new IntArrayList();
final IntArrayList prefixes = new IntArrayList();
final String text = document.getCharsSequence().subSequence(range.getStartOffset(), range.getEndOffset()).toString();
final String commentedPrefix = commenter.getCommentedBlockCommentPrefix();
final String commentedSuffix = commenter.getCommentedBlockCommentSuffix();
final String commentPrefix = commenter.getBlockCommentPrefix();
final String commentSuffix = commenter.getBlockCommentSuffix();
int nearestSuffix = getNearest(text, commentedSuffix, 0);
int nearestPrefix = getNearest(text, commentedPrefix, 0);
int level = 0;
int lastSuffix = -1;
for (int i = Math.min(nearestPrefix, nearestSuffix); i < text.length(); i = Math.min(nearestPrefix, nearestSuffix)) {
if (i > nearestPrefix) {
nearestPrefix = getNearest(text, commentedPrefix, i);
continue;
}
if (i > nearestSuffix) {
nearestSuffix = getNearest(text, commentedSuffix, i);
continue;
}
if (i == nearestPrefix) {
if (level <= 0) {
if (lastSuffix != -1) {
toReplaceWithComments.add(lastSuffix);
}
level = 1;
lastSuffix = -1;
toReplaceWithComments.add(i);
prefixes.add(i);
}
else {
level++;
}
nearestPrefix = getNearest(text, commentedPrefix, nearestPrefix + 1);
}
else {
lastSuffix = i;
level--;
nearestSuffix = getNearest(text, commentedSuffix, nearestSuffix + 1);
}
}
if (lastSuffix != -1) {
toReplaceWithComments.add(lastSuffix);
}
int prefixIndex = prefixes.size() - 1;
for (int i = toReplaceWithComments.size() - 1; i >= 0; i--) {
int position = toReplaceWithComments.get(i);
if (prefixIndex >= 0 && position == prefixes.get(prefixIndex)) {
prefixIndex--;
document.replaceString(offset + position, offset + position + commentedPrefix.length(), commentPrefix);
}
else {
document.replaceString(offset + position, offset + position + commentedSuffix.length(), commentSuffix);
}
}
}
示例10: restoreEmptyVariables
import com.intellij.util.containers.IntArrayList; //导入方法依赖的package包/类
private void restoreEmptyVariables(IntArrayList indices) {
for (int i = 0; i < indices.size(); i++) {
int index = indices.get(i);
myDocument.deleteString(mySegments.getSegmentStart(index), mySegments.getSegmentEnd(index));
}
}
示例11: commentNestedComments
import com.intellij.util.containers.IntArrayList; //导入方法依赖的package包/类
static void commentNestedComments(@NotNull Document document, TextRange range, Commenter commenter) {
final int offset = range.getStartOffset();
final IntArrayList toReplaceWithComments = new IntArrayList();
final IntArrayList prefixes = new IntArrayList();
if (range.getLength() < 0) return; // TODO: reproduce and fix this case
final String text = document.getCharsSequence().subSequence(range.getStartOffset(), range.getEndOffset()).toString();
final String commentedPrefix = commenter.getCommentedBlockCommentPrefix();
final String commentedSuffix = commenter.getCommentedBlockCommentSuffix();
final String commentPrefix = commenter.getBlockCommentPrefix();
final String commentSuffix = commenter.getBlockCommentSuffix();
int nearestSuffix = getNearest(text, commentedSuffix, 0);
int nearestPrefix = getNearest(text, commentedPrefix, 0);
int level = 0;
int lastSuffix = -1;
for (int i = Math.min(nearestPrefix, nearestSuffix); i < text.length(); i = Math.min(nearestPrefix, nearestSuffix)) {
if (i > nearestPrefix) {
nearestPrefix = getNearest(text, commentedPrefix, i);
continue;
}
if (i > nearestSuffix) {
nearestSuffix = getNearest(text, commentedSuffix, i);
continue;
}
if (i == nearestPrefix) {
if (level <= 0) {
if (lastSuffix != -1) {
toReplaceWithComments.add(lastSuffix);
}
level = 1;
lastSuffix = -1;
toReplaceWithComments.add(i);
prefixes.add(i);
}
else {
level++;
}
nearestPrefix = getNearest(text, commentedPrefix, nearestPrefix + 1);
}
else {
lastSuffix = i;
level--;
nearestSuffix = getNearest(text, commentedSuffix, nearestSuffix + 1);
}
}
if (lastSuffix != -1) {
toReplaceWithComments.add(lastSuffix);
}
int prefixIndex = prefixes.size() - 1;
for (int i = toReplaceWithComments.size() - 1; i >= 0; i--) {
int position = toReplaceWithComments.get(i);
if (prefixIndex >= 0 && position == prefixes.get(prefixIndex)) {
prefixIndex--;
document.replaceString(offset + position, offset + position + commentedPrefix.length(), commentPrefix);
}
else {
document.replaceString(offset + position, offset + position + commentedSuffix.length(), commentSuffix);
}
}
}
示例12: commentNestedComments
import com.intellij.util.containers.IntArrayList; //导入方法依赖的package包/类
static void commentNestedComments(@Nonnull Document document, TextRange range, Commenter commenter) {
final int offset = range.getStartOffset();
final IntArrayList toReplaceWithComments = new IntArrayList();
final IntArrayList prefixes = new IntArrayList();
final String text = document.getCharsSequence().subSequence(range.getStartOffset(), range.getEndOffset()).toString();
final String commentedPrefix = commenter.getCommentedBlockCommentPrefix();
final String commentedSuffix = commenter.getCommentedBlockCommentSuffix();
final String commentPrefix = commenter.getBlockCommentPrefix();
final String commentSuffix = commenter.getBlockCommentSuffix();
int nearestSuffix = getNearest(text, commentedSuffix, 0);
int nearestPrefix = getNearest(text, commentedPrefix, 0);
int level = 0;
int lastSuffix = -1;
for (int i = Math.min(nearestPrefix, nearestSuffix); i < text.length(); i = Math.min(nearestPrefix, nearestSuffix)) {
if (i > nearestPrefix) {
nearestPrefix = getNearest(text, commentedPrefix, i);
continue;
}
if (i > nearestSuffix) {
nearestSuffix = getNearest(text, commentedSuffix, i);
continue;
}
if (i == nearestPrefix) {
if (level <= 0) {
if (lastSuffix != -1) {
toReplaceWithComments.add(lastSuffix);
}
level = 1;
lastSuffix = -1;
toReplaceWithComments.add(i);
prefixes.add(i);
}
else {
level++;
}
nearestPrefix = getNearest(text, commentedPrefix, nearestPrefix + 1);
}
else {
lastSuffix = i;
level--;
nearestSuffix = getNearest(text, commentedSuffix, nearestSuffix + 1);
}
}
if (lastSuffix != -1) {
toReplaceWithComments.add(lastSuffix);
}
int prefixIndex = prefixes.size() - 1;
for (int i = toReplaceWithComments.size() - 1; i >= 0; i--) {
int position = toReplaceWithComments.get(i);
if (prefixIndex >= 0 && position == prefixes.get(prefixIndex)) {
prefixIndex--;
document.replaceString(offset + position, offset + position + commentedPrefix.length(), commentPrefix);
}
else {
document.replaceString(offset + position, offset + position + commentedSuffix.length(), commentSuffix);
}
}
}
示例13: getIndexer
import com.intellij.util.containers.IntArrayList; //导入方法依赖的package包/类
@NotNull
@Override
public DataIndexer<MethodCallData, Void, FileContent> getIndexer()
{
return inputData ->
{
if(myOfflineMode)
{
return Collections.emptyMap();
}
int[] nullOffsets = new StringSearcher(PsiKeyword.NULL, true, true).findAllOccurrences(inputData.getContentAsText());
if(nullOffsets.length == 0)
{
return Collections.emptyMap();
}
LighterAST lighterAst = ((FileContentImpl) inputData).getLighterASTForPsiDependentIndex();
Set<LighterASTNode> calls = findCallsWithNulls(lighterAst, nullOffsets);
if(calls.isEmpty())
{
return Collections.emptyMap();
}
Map<MethodCallData, Void> result = new THashMap<>();
for(LighterASTNode element : calls)
{
final IntArrayList indices = getNullParameterIndices(lighterAst, element);
if(indices != null)
{
final String name = getMethodName(lighterAst, element, element.getTokenType());
if(name != null)
{
for(int i = 0; i < indices.size(); i++)
{
result.put(new MethodCallData(name, indices.get(i)), null);
}
}
}
}
return result;
};
}
示例14: DuplicatesFinder
import com.intellij.util.containers.IntArrayList; //导入方法依赖的package包/类
public DuplicatesFinder(PsiElement[] pattern, InputVariables parameters, @Nullable ReturnValue returnValue, @NotNull List<? extends PsiVariable> outputParameters)
{
myReturnValue = returnValue;
LOG.assertTrue(pattern.length > 0);
myPattern = pattern;
myPatternAsList = Arrays.asList(myPattern);
myParameters = parameters;
myOutputParameters = outputParameters;
final PsiElement codeFragment = ControlFlowUtil.findCodeFragment(pattern[0]);
try
{
final ControlFlow controlFlow = ControlFlowFactory.getInstance(codeFragment.getProject()).getControlFlow(codeFragment, new LocalsControlFlowPolicy(codeFragment), false);
int startOffset;
int i = 0;
do
{
startOffset = controlFlow.getStartOffset(pattern[i++]);
}
while(startOffset < 0 && i < pattern.length);
int endOffset;
int j = pattern.length - 1;
do
{
endOffset = controlFlow.getEndOffset(pattern[j--]);
}
while(endOffset < 0 && j >= 0);
IntArrayList exitPoints = new IntArrayList();
final Collection<PsiStatement> exitStatements = ControlFlowUtil.findExitPointsAndStatements(controlFlow, startOffset, endOffset, exitPoints,
ControlFlowUtil.DEFAULT_EXIT_STATEMENTS_CLASSES);
myMultipleExitPoints = exitPoints.size() > 1;
if(myMultipleExitPoints)
{
myParameters.removeParametersUsedInExitsOnly(codeFragment, exitStatements, controlFlow, startOffset, endOffset);
}
}
catch(AnalysisCanceledException e)
{
}
}