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


Java IntArrayList.add方法代码示例

本文整理汇总了Java中com.carrotsearch.hppc.IntArrayList.add方法的典型用法代码示例。如果您正苦于以下问题:Java IntArrayList.add方法的具体用法?Java IntArrayList.add怎么用?Java IntArrayList.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.carrotsearch.hppc.IntArrayList的用法示例。


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

示例1: readFrom

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    int size = in.readVInt();
    locations = new IntArrayList(size);
    responses = new ArrayList<>(size);
    failures = new ArrayList<>(size);
    for (int i = 0; i < size; i++) {
        locations.add(in.readVInt());
        if (in.readBoolean()) {
            GetResponse response = new GetResponse();
            response.readFrom(in);
            responses.add(response);
        } else {
            responses.add(null);
        }
        if (in.readBoolean()) {
            failures.add(MultiGetResponse.Failure.readFailure(in));
        } else {
            failures.add(null);
        }
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:24,代码来源:MultiGetShardResponse.java

示例2: readFrom

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    int size = in.readVInt();
    locations = new IntArrayList(size);
    items = new ArrayList<>(size);

    for (int i = 0; i < size; i++) {
        locations.add(in.readVInt());
        items.add(MultiGetRequest.Item.readItem(in));
    }

    preference = in.readOptionalString();
    refresh = in.readBoolean();
    realtime = in.readBoolean();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:MultiGetShardRequest.java

示例3: readFrom

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    int size = in.readVInt();
    locations = new IntArrayList(size);
    responses = new ArrayList<>(size);
    failures = new ArrayList<>(size);
    for (int i = 0; i < size; i++) {
        locations.add(in.readVInt());
        if (in.readBoolean()) {
            TermVectorsResponse response = new TermVectorsResponse();
            response.readFrom(in);
            responses.add(response);
        } else {
            responses.add(null);
        }
        if (in.readBoolean()) {
            failures.add(MultiTermVectorsResponse.Failure.readFailure(in));
        } else {
            failures.add(null);
        }
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:24,代码来源:MultiTermVectorsShardResponse.java

示例4: ensureStringTypesAreStrings

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
public static void ensureStringTypesAreStrings(DataType[] dataTypes, Object[][] rows) {
    if (rows.length == 0) {
        return;
    }

    // NOTE: currently BytesRef inside Maps aren't converted here because
    // if the map is coming from a ESSearchTask/EsGetTask they already contain strings
    // and we have no case in which another Task returns a Map with ByteRefs/Strings inside.
    final IntArrayList stringColumns = new IntArrayList();
    final IntArrayList stringCollectionColumns = new IntArrayList();
    int idx = 0;
    for (DataType dataType : dataTypes) {
        if (BYTES_REF_TYPES.contains(dataType)) {
            stringColumns.add(idx);
        } else if ((DataTypes.isCollectionType(dataType)
                && (BYTES_REF_TYPES.contains(((CollectionType)dataType).innerType())))) {
            stringCollectionColumns.add(idx);
        }
        idx++;
    }

    for (Object[] row : rows) {
        convertStringColumns(row, stringColumns);
        convertStringCollectionColumns(row, stringCollectionColumns);
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:27,代码来源:BytesRefUtils.java

示例5: readFrom

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    jobId = new UUID(in.readLong(), in.readLong());
    fetchPhaseId = in.readVInt();
    int numReaders = in.readVInt();
    if (numReaders > 0) {
        toFetch = new IntObjectHashMap<>(numReaders);
        for (int i = 0; i < numReaders; i++) {
            int readerId = in.readVInt();
            int numDocs = in.readVInt();
            IntArrayList docs = new IntArrayList(numDocs);
            toFetch.put(readerId, docs);
            for (int j = 0; j < numDocs; j++) {
                docs.add(in.readInt());
            }
        }
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:20,代码来源:NodeFetchRequest.java

示例6: readFrom

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    int size = in.readVInt();
    locations = new IntArrayList(size);
    failures = new ArrayList<>(size);
    for (int i = 0; i < size; i++) {
        locations.add(in.readVInt());
        if (in.readBoolean()) {
            failures.add(Failure.readFailure(in));
        } else {
            failures.add(null);
        }
    }
    if (in.readBoolean()) {
        failure = in.readThrowable();
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:19,代码来源:ShardResponse.java

示例7: readFrom

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    int size = in.readVInt();
    locations = new IntArrayList(size);
    items = new ArrayList<>(size);

    for (int i = 0; i < size; i++) {
        locations.add(in.readVInt());
        items.add(MultiGetRequest.Item.readItem(in));
    }

    preference = in.readOptionalString();
    refresh = in.readBoolean();
    byte realtime = in.readByte();
    if (realtime == 0) {
        this.realtime = false;
    } else if (realtime == 1) {
        this.realtime = true;
    }
    ignoreErrorsOnGeneratedFields = in.readBoolean();
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:23,代码来源:MultiGetShardRequest.java

示例8: minimize

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
private void minimize() {
	if (graph == null || isImmutable())
		return;

	IntArrayList verticesToRemove = new IntArrayList();
	IntSet vertices = graph.getVertices();
	if (!vertices.contains(entryNode) || !vertices.contains(targetNode)) {
		graph = null;
		return;
	}

	IntArrayList visitedFromStart = getVisited(entryNode, true);
	IntArrayList visitedFromExit = getVisited(targetNode, false);

	for (IntCursor nodeCur : vertices) {
		int node = nodeCur.value;
		if (!visitedFromStart.contains(node) || !visitedFromExit.contains(node)) {
			verticesToRemove.add(node);
		}
	}
	graph.removeVertices(verticesToRemove.toArray());
	if (graph.getVertices().size() == 0 || graph.getEdges().size() == 0)
		graph = null;
	if (graph != null)
		setImmutable();
}
 
开发者ID:themaplelab,项目名称:boomerang,代码行数:27,代码来源:FieldGraph.java

示例9: getVisited

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
private IntArrayList getVisited(int source, boolean forward) {
	if (graph == null)
		return new IntArrayList();

	Queue<Integer> queue = new LinkedList<Integer>();
	queue.add(source);
	IntArrayList visited = new IntArrayList();
	while (!queue.isEmpty()) {
		Integer next = queue.poll();
		if (!visited.contains(next)) {
			visited.add(next);
			IntSet edges = forward ? graph.getOutEdges(next) : graph.getInEdges(next);
			for (IntCursor eCur : edges) {
				int e = eCur.value;
				int succNode;
				if (forward) {
					succNode = graph.getDirectedSimpleEdgeHead(e);
				} else {
					succNode = graph.getDirectedSimpleEdgeTail(e);
				}
				queue.add(succNode);
			}
		}
	}
	return visited;
}
 
开发者ID:themaplelab,项目名称:boomerang,代码行数:27,代码来源:FieldGraph.java

示例10: make3dMatrix

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
private SparseMatrixn make3dMatrix ()
{
  int[] sizes = new int[]{2, 3, 4};
  IntArrayList idxs = new IntArrayList ();
  DoubleArrayList vals = new DoubleArrayList ();

  for (int i = 0; i < 24; i++) {
    if (i % 3 != 0) {
      idxs.add (i);
      vals.add (2.0 * i);
    }
  }

  SparseMatrixn a = new SparseMatrixn (sizes, idxs.toArray (), vals.toArray ());
  return a;
}
 
开发者ID:mimno,项目名称:Mallet,代码行数:17,代码来源:TestSparseMatrixn.java

示例11: State

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
public State(String input) {
	stateStack = new Stack<int[]>();
	int[] neutral = new int[alphabet.features];
	for (int i = 0; i < neutral.length; ++i)
		neutral[i] = 0;
	stateStack.push(neutral);
	outputString = new IntArrayList();
	inputString = new IntArrayList();
	outputPointer = 0;
	inputPointer = 0;
	displayVector = new ArrayList<Result>();

	IndexString inputLine = new IndexString(input);
	while (inputLine.index < input.length()) {
		inputString.add(letterTrie.findKey(inputLine));
		if (inputString.get(inputString.size() - 1) == HfstOptimizedLookup.NO_SYMBOL_NUMBER) {
			inputString.clear();
			break;
		}
	}
	inputString.add(HfstOptimizedLookup.NO_SYMBOL_NUMBER);

}
 
开发者ID:jiemakel,项目名称:seco-hfst,代码行数:24,代码来源:UnweightedTransducer.java

示例12: readSparseVector

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
private SparseVector readSparseVector (String str, Alphabet dict) throws IOException
{
  IntArrayList idxs = new IntArrayList ();
  DoubleArrayList vals = new DoubleArrayList ();
  String[] lines = str.split ("\n");
  for (int li = 0; li < lines.length; li++) {
    String line = lines[li];
    if (Pattern.matches ("^\\s*$", line)) continue;

    String[] fields = line.split ("\t");
    int idx;
    if (dict != null) {
      idx = dict.lookupIndex (fields[0]);
    } else {
      idx = Integer.parseInt (fields[0]);
    }

    double val = Double.parseDouble (fields[1]);
    idxs.add (idx);
    vals.add (val);
  }
  return new SparseVector (idxs.toArray (), vals.toArray ());
}
 
开发者ID:cmoen,项目名称:mallet,代码行数:24,代码来源:ACRF.java

示例13: getDocumentsWithWord

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
@Override
public void getDocumentsWithWord(String word, IntArrayList documents) {
    DocsEnum docs = null;
    Term term = new Term(fieldName, word);
    try {
        int baseDocId;
        for (int i = 0; i < reader.length; i++) {
            docs = reader[i].termDocsEnum(term);
            baseDocId = contexts[i].docBase;
            if (docs != null) {
                while (docs.nextDoc() != DocsEnum.NO_MORE_DOCS) {
                    documents.add(docs.docID() + baseDocId);
                }
            }
        }
    } catch (IOException e) {
        LOGGER.error("Error while requesting documents for word \"" + word + "\".", e);
    }
}
 
开发者ID:dice-group,项目名称:Palmetto,代码行数:20,代码来源:LuceneCorpusAdapter.java

示例14: buildInterferenceGraph

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
private Graph buildInterferenceGraph(List<Map<Instruction, BitSet>> liveInInformation, Program program) {
    GraphBuilder builder = new GraphBuilder(program.variableCount());
    for (Map<Instruction, BitSet> blockLiveIn : liveInInformation) {
        for (BitSet liveVarsSet : blockLiveIn.values()) {
            IntArrayList liveVars = new IntArrayList();
            for (int i = liveVarsSet.nextSetBit(0); i >= 0; i = liveVarsSet.nextSetBit(i + 1)) {
                liveVars.add(i);
            }
            int[] liveVarArray = liveVars.toArray();
            for (int i = 0; i < liveVarArray.length - 1; ++i) {
                for (int j = i + 1; j < liveVarArray.length; ++j) {
                    builder.addEdge(liveVarArray[i], liveVarArray[j]);
                    builder.addEdge(liveVarArray[j], liveVarArray[i]);
                }
            }
        }
    }
    return builder.build();
}
 
开发者ID:konsoletyper,项目名称:teavm,代码行数:20,代码来源:GCShadowStackContributor.java

示例15: apply

import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
public void apply(Program program, MethodReference method, ClassReaderSource classes,
        DependencyInfo dependencyInfo) {
    depthsByBlock = new IntArrayList(program.basicBlockCount());
    for (int i = 0; i < program.basicBlockCount(); ++i) {
        depthsByBlock.add(0);
    }
    instructionsToSkip = new HashSet<>();

    while (applyOnce(program, classes)) {
        devirtualize(program, method, dependencyInfo);
    }
    depthsByBlock = null;
    instructionsToSkip = null;

    new UnreachableBasicBlockEliminator().optimize(program);
}
 
开发者ID:konsoletyper,项目名称:teavm,代码行数:17,代码来源:Inlining.java


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