本文整理汇总了Java中com.intellij.util.containers.IntArrayList.add方法的典型用法代码示例。如果您正苦于以下问题:Java IntArrayList.add方法的具体用法?Java IntArrayList.add怎么用?Java IntArrayList.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.containers.IntArrayList
的用法示例。
在下文中一共展示了IntArrayList.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processGoto
import com.intellij.util.containers.IntArrayList; //导入方法依赖的package包/类
private static void processGoto(ControlFlow flow, int start, int end,
IntArrayList exitPoints,
Collection<PsiStatement> exitStatements, BranchingInstruction instruction, Class[] classesFilter, final PsiStatement statement) {
if (statement == null) return;
int gotoOffset = instruction.offset;
if (start > gotoOffset || gotoOffset >= end || isElementOfClass(statement, classesFilter)) {
// process chain of goto's
gotoOffset = promoteThroughGotoChain(flow, gotoOffset);
if (!exitPoints.contains(gotoOffset) && (gotoOffset >= end || gotoOffset < start)) {
exitPoints.add(gotoOffset);
}
if (gotoOffset >= end || gotoOffset < start) {
processGotoStatement(classesFilter, exitStatements, statement);
}
else {
boolean isReturn = instruction instanceof GoToInstruction && ((GoToInstruction)instruction).isReturn;
final Instruction gotoInstruction = flow.getInstructions().get(gotoOffset);
isReturn |= gotoInstruction instanceof GoToInstruction && ((GoToInstruction)gotoInstruction).isReturn;
if (isReturn) {
processGotoStatement(classesFilter, exitStatements, statement);
}
}
}
}
示例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) {
myGenerateConditionalExit = true;
areExitStatementsTheSame();
}
return myExitStatements;
}
示例3: initEmptyVariables
import com.intellij.util.containers.IntArrayList; //导入方法依赖的package包/类
private IntArrayList initEmptyVariables() {
int endSegmentNumber = myTemplate.getEndSegmentNumber();
int selStart = myTemplate.getSelectionStartSegmentNumber();
int selEnd = myTemplate.getSelectionEndSegmentNumber();
IntArrayList indices = new IntArrayList();
for (int i = 0; i < myTemplate.getSegmentsCount(); i++) {
int length = mySegments.getSegmentEnd(i) - mySegments.getSegmentStart(i);
if (length != 0) continue;
if (i == endSegmentNumber || i == selStart || i == selEnd) continue;
String name = myTemplate.getSegmentName(i);
for (int j = 0; j < myTemplate.getVariableCount(); j++) {
if (myTemplate.getVariableNameAt(j).equals(name)) {
Expression e = myTemplate.getExpressionAt(j);
@NonNls String marker = "a";
if (e instanceof MacroCallNode) {
marker = ((MacroCallNode)e).getMacro().getDefaultValue();
}
replaceString(marker, mySegments.getSegmentStart(i), mySegments.getSegmentEnd(i), i);
indices.add(i);
break;
}
}
}
return indices;
}
示例4: calcBreakOffsets
import com.intellij.util.containers.IntArrayList; //导入方法依赖的package包/类
public static IntArrayList calcBreakOffsets(char[] text, int startOffset, int endOffset, int column, double x, double clipX, WidthProvider widthProvider) {
IntArrayList breakOffsets = new IntArrayList();
int nextOffset = startOffset;
while (true) {
int prevOffset = nextOffset;
nextOffset = calcWordBreakOffset(text, nextOffset, endOffset, x, clipX, widthProvider);
if (nextOffset == prevOffset && column == 0) {
nextOffset = calcCharBreakOffset(text, nextOffset, endOffset, x, clipX, widthProvider);
if (nextOffset == prevOffset) {
nextOffset++; // extremal case when even one character doesn't fit into clip width
}
}
if (nextOffset >= endOffset) {
break;
}
breakOffsets.add(nextOffset);
column = 0;
x = 0;
}
return breakOffsets;
}
示例5: addIfWithinInclusive
import com.intellij.util.containers.IntArrayList; //导入方法依赖的package包/类
private static void addIfWithinInclusive(int min, int max, int value, IntArrayList list, @Nullable List<ResourceItem> items) {
if (value >= min && value <= max) {
// Make sure we have a compatible match for this version for this resources
boolean foundCompatible = true;
if (items != null) {
foundCompatible = false;
// Make sure that if you're looking at a layout only present in say -v14, we don't attempt
// to render this in -v9.
for (ResourceItem item : items) {
FolderConfiguration configuration = item.getConfiguration();
VersionQualifier qualifier = configuration.getVersionQualifier();
if (qualifier == null || qualifier.getVersion() <= value) {
foundCompatible = true;
break;
}
}
}
if (foundCompatible) {
list.add(value);
}
}
}
示例6: 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;
}
示例7: calcBreakOffsets
import com.intellij.util.containers.IntArrayList; //导入方法依赖的package包/类
private IntArrayList calcBreakOffsets(Graphics2D g, char[] text, int offset, int endOffset, int colNumber,
Point2D position, Rectangle2D clip) {
IntArrayList breakOffsets = new IntArrayList();
int nextOffset = offset;
double x = position.getX();
while (true) {
int prevOffset = nextOffset;
nextOffset = calcWordBreakOffset(g, text, nextOffset, endOffset, x, clip);
if (nextOffset == offset || nextOffset == prevOffset && colNumber == 0) {
nextOffset = calcCharBreakOffset(g, text, nextOffset, endOffset, x, clip);
if (nextOffset == prevOffset) { //it shouldn't be, but if clip.width is <= 1...
return breakOffsets;
}
}
if (nextOffset >= endOffset) {
break;
}
breakOffsets.add(nextOffset);
colNumber = 0;
x = 0;
}
return breakOffsets;
}
示例8: getNullParameterIndices
import com.intellij.util.containers.IntArrayList; //导入方法依赖的package包/类
@Nullable
private static IntArrayList getNullParameterIndices(LighterAST lighterAst, @NotNull LighterASTNode methodCall)
{
final LighterASTNode node = LightTreeUtil.firstChildOfType(lighterAst, methodCall, EXPRESSION_LIST);
if(node == null)
{
return null;
}
final List<LighterASTNode> parameters = JavaLightTreeUtil.getExpressionChildren(lighterAst, node);
IntArrayList indices = new IntArrayList(1);
for(int idx = 0; idx < parameters.size(); idx++)
{
if(isNullLiteral(lighterAst, parameters.get(idx)))
{
indices.add(idx);
}
}
return indices;
}
示例9: addReference
import com.intellij.util.containers.IntArrayList; //导入方法依赖的package包/类
private static void addReference(PsiReference ref, ArrayList<PsiFile> filesList, IntArrayList startsList, IntArrayList endsList) {
PsiElement element = ref.getElement();
filesList.add(element.getContainingFile());
TextRange range = element.getTextRange();
TextRange rangeInElement = ref.getRangeInElement();
startsList.add(range.getStartOffset() + rangeInElement.getStartOffset());
endsList.add(range.getStartOffset() + rangeInElement.getEndOffset());
}
示例10: InternedPath
import com.intellij.util.containers.IntArrayList; //导入方法依赖的package包/类
/**
* @param path assuming system-independent path with forward slashes
*/
protected InternedPath(String path) {
final IntArrayList list = new IntArrayList();
final StringTokenizer tokenizer = new StringTokenizer(path, "/", false);
while(tokenizer.hasMoreTokens()) {
final String element = tokenizer.nextToken();
list.add(FileNameCache.storeName(element));
}
myPath = list.toArray();
}
示例11: 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;
}
示例12: componentToPath
import com.intellij.util.containers.IntArrayList; //导入方法依赖的package包/类
private static void componentToPath(RadComponent component, IntArrayList path) {
RadComponent parent = component.getParent();
if (parent != null) {
path.add(0, parent.getChildren().indexOf(component));
componentToPath(parent, path);
}
}
示例13: initEmptyVariables
import com.intellij.util.containers.IntArrayList; //导入方法依赖的package包/类
private IntArrayList initEmptyVariables() {
int endSegmentNumber = myTemplate.getEndSegmentNumber();
int selStart = myTemplate.getSelectionStartSegmentNumber();
int selEnd = myTemplate.getSelectionEndSegmentNumber();
IntArrayList indices = new IntArrayList();
for (int i = 0; i < myTemplate.getSegmentsCount(); i++) {
int length = mySegments.getSegmentEnd(i) - mySegments.getSegmentStart(i);
if (length != 0) continue;
if (i == endSegmentNumber || i == selStart || i == selEnd) continue;
String name = myTemplate.getSegmentName(i);
for (int j = 0; j < myTemplate.getVariableCount(); j++) {
if (myTemplate.getVariableNameAt(j).equals(name)) {
Expression e = myTemplate.getExpressionAt(j);
@NonNls String marker = "a";
if (e instanceof MacroCallNode) {
marker = ((MacroCallNode)e).getMacro().getDefaultValue();
}
int start = mySegments.getSegmentStart(i);
int end = start + marker.length();
myDocument.insertString(start, marker);
mySegments.replaceSegmentAt(i, start, end);
indices.add(i);
break;
}
}
}
return indices;
}
示例14: componentToPath
import com.intellij.util.containers.IntArrayList; //导入方法依赖的package包/类
private static void componentToPath(RadComponent component, IntArrayList path) {
RadComponent parent = component.getParent();
if (parent != null) {
path.add(0, parent.getChildren().indexOf(component));
componentToPath(parent, path);
}
}
示例15: 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;
}