本文整理汇总了Java中com.carrotsearch.hppc.IntObjectHashMap类的典型用法代码示例。如果您正苦于以下问题:Java IntObjectHashMap类的具体用法?Java IntObjectHashMap怎么用?Java IntObjectHashMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IntObjectHashMap类属于com.carrotsearch.hppc包,在下文中一共展示了IntObjectHashMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readFrom
import com.carrotsearch.hppc.IntObjectHashMap; //导入依赖的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());
}
}
}
}
示例2: State
import com.carrotsearch.hppc.IntObjectHashMap; //导入依赖的package包/类
protected State (String name, int index, double initialWeight, double finalWeight,
int[] inputs, int[] outputs, double[] weights,
String[] destinationNames, FeatureTransducer transducer)
{
assert (inputs.length == outputs.length
&& inputs.length == weights.length
&& inputs.length == destinationNames.length);
this.transducer = transducer;
this.name = name;
this.index = index;
this.initialWeight = initialWeight;
this.finalWeight = finalWeight;
this.transitions = new Transition[inputs.length];
this.input2transitions = new IntObjectHashMap ();
transitionCounts = null;
for (int i = 0; i < inputs.length; i++) {
// This constructor places the transtion into this.input2transitions
transitions[i] = new Transition (inputs[i], outputs[i],
weights[i], this, destinationNames[i]);
transitions[i].index = i;
}
}
示例3: NodeFetchRequest
import com.carrotsearch.hppc.IntObjectHashMap; //导入依赖的package包/类
public NodeFetchRequest(UUID jobId, int fetchPhaseId, IntObjectHashMap<IntContainer> toFetch) {
this.jobId = jobId;
this.fetchPhaseId = fetchPhaseId;
if (!toFetch.isEmpty()) {
this.toFetch = toFetch;
}
}
示例4: PercolatorService
import com.carrotsearch.hppc.IntObjectHashMap; //导入依赖的package包/类
@Inject
public PercolatorService(Settings settings, IndexNameExpressionResolver indexNameExpressionResolver, IndicesService indicesService,
PageCacheRecycler pageCacheRecycler, BigArrays bigArrays,
HighlightPhase highlightPhase, ClusterService clusterService,
AggregationPhase aggregationPhase, ScriptService scriptService,
MappingUpdatedAction mappingUpdatedAction) {
super(settings);
this.indexNameExpressionResolver = indexNameExpressionResolver;
this.parseFieldMatcher = new ParseFieldMatcher(settings);
this.indicesService = indicesService;
this.pageCacheRecycler = pageCacheRecycler;
this.bigArrays = bigArrays;
this.clusterService = clusterService;
this.highlightPhase = highlightPhase;
this.aggregationPhase = aggregationPhase;
this.scriptService = scriptService;
this.mappingUpdatedAction = mappingUpdatedAction;
this.sortParseElement = new SortParseElement();
final long maxReuseBytes = settings.getAsBytesSize("indices.memory.memory_index.size_per_thread", new ByteSizeValue(1, ByteSizeUnit.MB)).bytes();
cache = new CloseableThreadLocal<MemoryIndex>() {
@Override
protected MemoryIndex initialValue() {
// TODO: should we expose payloads as an option? should offsets be turned on always?
return new ExtendedMemoryIndex(true, false, maxReuseBytes);
}
};
single = new SingleDocumentPercolatorIndex(cache);
multi = new MultiDocumentPercolatorIndex(cache);
percolatorTypes = new IntObjectHashMap<>(6);
percolatorTypes.put(countPercolator.id(), countPercolator);
percolatorTypes.put(queryCountPercolator.id(), queryCountPercolator);
percolatorTypes.put(matchPercolator.id(), matchPercolator);
percolatorTypes.put(queryPercolator.id(), queryPercolator);
percolatorTypes.put(scoringPercolator.id(), scoringPercolator);
percolatorTypes.put(topMatchingPercolator.id(), topMatchingPercolator);
}
示例5: buildNamedAnalyzer
import com.carrotsearch.hppc.IntObjectHashMap; //导入依赖的package包/类
public static synchronized NamedAnalyzer buildNamedAnalyzer(FormatDateTimeFormatter formatter, int precisionStep) {
IntObjectHashMap<NamedAnalyzer> precisionMap = globalAnalyzers.get(formatter.format());
if (precisionMap == null) {
precisionMap = new IntObjectHashMap<>();
globalAnalyzers.put(formatter.format(), precisionMap);
}
NamedAnalyzer namedAnalyzer = precisionMap.get(precisionStep);
if (namedAnalyzer == null) {
String name = "_date/" + ((precisionStep == Integer.MAX_VALUE) ? "max" : precisionStep);
namedAnalyzer = new NamedAnalyzer(name, AnalyzerScope.GLOBAL, new NumericDateAnalyzer(precisionStep, formatter.parser()));
precisionMap.put(precisionStep, namedAnalyzer);
}
return namedAnalyzer;
}
示例6: channelClosed
import com.carrotsearch.hppc.IntObjectHashMap; //导入依赖的package包/类
void channelClosed(Throwable ex) {
isOpen.set(false);
if (ex != null) {
final IntObjectHashMap<RpcOutcome<?>> clonedMap;
synchronized (map) {
clonedMap = map.clone();
map.clear();
}
final RpcException e = RpcException.mapException(ex);
clonedMap.forEach(new SetExceptionProcedure(e));
}
}
示例7: addFragment
import com.carrotsearch.hppc.IntObjectHashMap; //导入依赖的package包/类
private void addFragment(final FragmentData fragmentData) {
final FragmentHandle fragmentHandle = fragmentData.getHandle();
final int majorFragmentId = fragmentHandle.getMajorFragmentId();
final int minorFragmentId = fragmentHandle.getMinorFragmentId();
IntObjectHashMap<FragmentData> minorMap = fragmentDataMap.get(majorFragmentId);
if (minorMap == null) {
minorMap = new IntObjectHashMap<>();
fragmentDataMap.put(majorFragmentId, minorMap);
}
minorMap.put(minorFragmentId, fragmentData);
fragmentDataSet.add(fragmentData);
}
示例8: apply
import com.carrotsearch.hppc.IntObjectHashMap; //导入依赖的package包/类
@Override
public boolean apply(final int majorFragmentId, final IntObjectHashMap<FragmentData> minorMap) {
final MajorFragmentProfile.Builder builder = MajorFragmentProfile.newBuilder().setMajorFragmentId(majorFragmentId);
minorMap.forEach(new InnerIter(builder));
profileBuilder.addFragmentProfile(builder);
return true;
}
示例9: channelClosed
import com.carrotsearch.hppc.IntObjectHashMap; //导入依赖的package包/类
void channelClosed(Throwable ex) {
isOpen.set(false);
if (ex != null) {
final RpcException e = RpcException.mapException(ex);
IntObjectHashMap<RpcOutcome<?>> clonedMap;
synchronized (map) {
clonedMap = map.clone();
map.clear();
}
clonedMap.forEach(new SetExceptionProcedure(e));
}
}
示例10: generate
import com.carrotsearch.hppc.IntObjectHashMap; //导入依赖的package包/类
@Override
public ConcatVectorNamespace generate(SourceOfRandomness sourceOfRandomness, GenerationStatus generationStatus) {
ConcatVectorNamespace namespace = new ConcatVectorNamespace();
namespace.featureToIndex.putAll(generateFeatureMap(sourceOfRandomness));
for (ObjectCursor<String> key : namespace.featureToIndex.keys()) {
if (sourceOfRandomness.nextBoolean()) {
ObjectIntMap<String> sparseMap = generateFeatureMap(sourceOfRandomness);
IntObjectMap< String> reverseSparseMap = new IntObjectHashMap<>();
for (ObjectCursor<String> sparseKey : sparseMap.keys()) reverseSparseMap.put(sparseMap.get(sparseKey.value), sparseKey.value);
namespace.sparseFeatureIndex.put(key.value, sparseMap);
namespace.reverseSparseFeatureIndex.put(key.value, reverseSparseMap);
}
}
return namespace;
}
示例11: test
import com.carrotsearch.hppc.IntObjectHashMap; //导入依赖的package包/类
@Override
public int test() {
final IntObjectHashMap<Integer> m_map = new IntObjectHashMap<>( m_keys.length, 0.5f );
for ( int i = 0; i < m_keys.length; ++i )
m_map.put( m_keys[ i ], null );
for ( int i = 0; i < m_keys.length; ++i )
m_map.put( m_keys[ i ], null );
return m_map.size();
}
示例12: toIntMap
import com.carrotsearch.hppc.IntObjectHashMap; //导入依赖的package包/类
public static <T, K, U> Collector<T, IntObjectHashMap<U>, IntObjectHashMap<U>> toIntMap(
ToIntFunction<? super T> keyMapper, Function<? super T, ? extends U> valueMapper) {
BiConsumer<IntObjectHashMap<U>, T> accumulator = (map, element) -> map
.put(keyMapper.applyAsInt(element), valueMapper.apply(element));
return new CollectorImpl<>(IntObjectHashMap::new, accumulator, (m1, m2) -> {
m1.putAll(m2);
return m1;
}, CH_ID);
}
示例13: OneLabelL2PRConstraints
import com.carrotsearch.hppc.IntObjectHashMap; //导入依赖的package包/类
protected OneLabelL2PRConstraints(IntObjectHashMap<OneLabelPRConstraint> constraints,
IntIntHashMap constraintIndices, StateLabelMap map, boolean normalized) {
this.constraints = new IntObjectHashMap<OneLabelPRConstraint>();
for (IntObjectCursor<OneLabelPRConstraint> keyVal : constraints) {
this.constraints.put(keyVal.key, keyVal.value.copy());
}
//this.constraints = constraints;
this.constraintIndices = constraintIndices;
this.map = map;
this.cache = new IntArrayList();
this.normalized = normalized;
}
示例14: OneLabelL2IndPRConstraints
import com.carrotsearch.hppc.IntObjectHashMap; //导入依赖的package包/类
public OneLabelL2IndPRConstraints(boolean normalized) {
this.normalized = normalized;
this.numDimensions = 0;
this.constraints = new IntObjectHashMap<OneLabelL2IndPRConstraint>();
// this will be set by the PRTrainer
this.map = null;
this.cache = new IntArrayList();
}
示例15: MaxEntRangeL2FLGEConstraints
import com.carrotsearch.hppc.IntObjectHashMap; //导入依赖的package包/类
public MaxEntRangeL2FLGEConstraints(int numFeatures, int numLabels, boolean useValues, boolean normalize) {
this.numFeatures = numFeatures;
this.numLabels = numLabels;
this.useValues = useValues;
this.normalize = normalize;
this.constraints = new IntObjectHashMap<MaxEntL2IndGEConstraint>();
this.indexCache = new IntArrayList();
this.valueCache = new DoubleArrayList();
}