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


Java IntArrayList类代码示例

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


IntArrayList类属于com.carrotsearch.hppc包,在下文中一共展示了IntArrayList类的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: releaseIrrelevantSearchContexts

import com.carrotsearch.hppc.IntArrayList; //导入依赖的package包/类
/**
 * Releases shard targets that are not used in the docsIdsToLoad.
 */
protected void releaseIrrelevantSearchContexts(AtomicArray<? extends QuerySearchResultProvider> queryResults,
                                               AtomicArray<IntArrayList> docIdsToLoad) {
    if (docIdsToLoad == null) {
        return;
    }
    // we only release search context that we did not fetch from if we are not scrolling
    if (request.scroll() == null) {
        for (AtomicArray.Entry<? extends QuerySearchResultProvider> entry : queryResults.asList()) {
            final TopDocs topDocs = entry.value.queryResult().queryResult().topDocs();
            if (topDocs != null && topDocs.scoreDocs.length > 0 // the shard had matches
                    && docIdsToLoad.get(entry.index) == null) { // but none of them made it to the global top docs
                try {
                    DiscoveryNode node = nodes.get(entry.value.queryResult().shardTarget().nodeId());
                    sendReleaseSearchContext(entry.value.queryResult().id(), node);
                } catch (Throwable t1) {
                    logger.trace("failed to release context", t1);
                }
            }
        }
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:25,代码来源:AbstractSearchAsyncAction.java

示例9: innerExecuteFetchPhase

import com.carrotsearch.hppc.IntArrayList; //导入依赖的package包/类
void innerExecuteFetchPhase() throws Exception {
    boolean useScroll = request.scroll() != null;
    sortedShardList = searchPhaseController.sortDocs(useScroll, queryResults);
    searchPhaseController.fillDocIdsToLoad(docIdsToLoad, sortedShardList);

    if (docIdsToLoad.asList().isEmpty()) {
        finishHim();
        return;
    }

    final ScoreDoc[] lastEmittedDocPerShard = searchPhaseController.getLastEmittedDocPerShard(
        request, sortedShardList, firstResults.length()
    );
    final AtomicInteger counter = new AtomicInteger(docIdsToLoad.asList().size());
    for (final AtomicArray.Entry<IntArrayList> entry : docIdsToLoad.asList()) {
        QuerySearchResult queryResult = queryResults.get(entry.index);
        DiscoveryNode node = nodes.get(queryResult.shardTarget().nodeId());
        ShardFetchSearchRequest fetchSearchRequest = createFetchRequest(queryResult, entry, lastEmittedDocPerShard);
        executeFetch(entry.index, queryResult.shardTarget(), counter, fetchSearchRequest, node);
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:22,代码来源:SearchDfsQueryThenFetchAsyncAction.java

示例10: moveToSecondPhase

import com.carrotsearch.hppc.IntArrayList; //导入依赖的package包/类
@Override
protected void moveToSecondPhase() throws Exception {
    boolean useScroll = request.scroll() != null;
    sortedShardList = searchPhaseController.sortDocs(useScroll, firstResults);
    searchPhaseController.fillDocIdsToLoad(docIdsToLoad, sortedShardList);

    if (docIdsToLoad.asList().isEmpty()) {
        finishHim();
        return;
    }

    final ScoreDoc[] lastEmittedDocPerShard = searchPhaseController.getLastEmittedDocPerShard(
        request, sortedShardList, firstResults.length()
    );
    final AtomicInteger counter = new AtomicInteger(docIdsToLoad.asList().size());
    for (AtomicArray.Entry<IntArrayList> entry : docIdsToLoad.asList()) {
        QuerySearchResultProvider queryResult = firstResults.get(entry.index);
        DiscoveryNode node = nodes.get(queryResult.shardTarget().nodeId());
        ShardFetchSearchRequest fetchSearchRequest = createFetchRequest(queryResult.queryResult(), entry, lastEmittedDocPerShard);
        executeFetch(entry.index, queryResult.shardTarget(), counter, fetchSearchRequest, node);
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:23,代码来源:SearchQueryThenFetchAsyncAction.java

示例11: 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

示例12: 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

示例13: convertToInt

import com.carrotsearch.hppc.IntArrayList; //导入依赖的package包/类
protected static int[] convertToInt(IntArrayList[] setToSplit, int exclude) {
  int count = 0;

  for (int i = 0; i < setToSplit.length; i++) {
    if (i != exclude) {
      count += setToSplit[i].size();
    }
  }

  int[] setData = new int[count];
  int a = 0;
  for (int i = 0; i < setToSplit.length; i++) {
    if (i != exclude) {
      for (IntCursor d : setToSplit[i]) {
        setData[a++] = d.value;
      }
    }
  }

  return setData;
}
 
开发者ID:patrickzib,项目名称:SFA,代码行数:22,代码来源:Classifier.java

示例14: computeScores

import com.carrotsearch.hppc.IntArrayList; //导入依赖的package包/类
static double[][] computeScores(EnrichmentLandscape result,
                                int totalAttributes,
                                IntArrayList attributeIndexes,
                                int typeIndex) {

    ScoringFunction score = Neighborhood.getScoringFunction(typeIndex);
    List<? extends Neighborhood> neighborhoods = result.getNeighborhoods();
    int filteredAttributes = attributeIndexes.size();
    double[][] scores = new double[filteredAttributes][];
    IntStream.range(0, filteredAttributes)
             .parallel()
             .forEach(filteredIndex -> {
                 int attributeIndex = attributeIndexes.get(filteredIndex);
                 scores[filteredIndex] = neighborhoods.stream()
                                                      .mapToDouble(n -> score.get(n, attributeIndex))
                                                      .toArray();
             });
    return scores;
}
 
开发者ID:baryshnikova-lab,项目名称:safe-java,代码行数:20,代码来源:ClusterBasedGroupingMethod.java

示例15: 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;
	current_weight = 0.0f;
	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,代码来源:WeightedTransducer.java


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