本文整理汇总了Java中com.carrotsearch.hppc.ObjectObjectHashMap类的典型用法代码示例。如果您正苦于以下问题:Java ObjectObjectHashMap类的具体用法?Java ObjectObjectHashMap怎么用?Java ObjectObjectHashMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectObjectHashMap类属于com.carrotsearch.hppc包,在下文中一共展示了ObjectObjectHashMap类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: readFieldStats
import com.carrotsearch.hppc.ObjectObjectHashMap; //导入依赖的package包/类
public static ObjectObjectHashMap<String, CollectionStatistics> readFieldStats(StreamInput in, ObjectObjectHashMap<String, CollectionStatistics> fieldStatistics) throws IOException {
final int numFieldStatistics = in.readVInt();
if (fieldStatistics == null) {
fieldStatistics = HppcMaps.newNoNullKeysMap(numFieldStatistics);
}
for (int i = 0; i < numFieldStatistics; i++) {
final String field = in.readString();
assert field != null;
final long maxDoc = in.readVLong();
final long docCount = subOne(in.readVLong());
final long sumTotalTermFreq = subOne(in.readVLong());
final long sumDocFreq = subOne(in.readVLong());
CollectionStatistics stats = new CollectionStatistics(field, maxDoc, docCount, sumTotalTermFreq, sumDocFreq);
fieldStatistics.put(field, stats);
}
return fieldStatistics;
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:18,代码来源:DfsSearchResult.java
示例2: copyContextFrom
import com.carrotsearch.hppc.ObjectObjectHashMap; //导入依赖的package包/类
@Override
public synchronized void copyContextFrom(HasContext other) {
if (other == null) {
return;
}
synchronized (other) {
ImmutableOpenMap<Object, Object> otherContext = other.getContext();
if (otherContext == null) {
return;
}
if (context == null) {
ObjectObjectHashMap<Object, Object> map = new ObjectObjectHashMap<>(other.getContext().size());
map.putAll(otherContext);
this.context = map;
} else {
context.putAll(otherContext);
}
}
}
开发者ID:baidu,项目名称:Elasticsearch,代码行数:21,代码来源:ContextAndHeaderHolder.java
示例3: Record
import com.carrotsearch.hppc.ObjectObjectHashMap; //导入依赖的package包/类
public Record (String name, LabeledSpans spans) {
this.name = name;
fieldMap = new ObjectObjectHashMap ();
for (int i = 0; i < spans.size(); i++) {
LabeledSpan span = spans.getLabeledSpan (i);
if (!span.isBackground()) {
Label tag = span.getLabel ();
Field field = (Field) fieldMap.get (tag);
if (field == null) {
field = new Field (span);
fieldMap.put (tag, field);
} else {
field.addFiller (span);
}
}
}
}
开发者ID:mimno,项目名称:Mallet,代码行数:18,代码来源:Record.java
示例4: writeFieldStats
import com.carrotsearch.hppc.ObjectObjectHashMap; //导入依赖的package包/类
public static void writeFieldStats(StreamOutput out, ObjectObjectHashMap<String, CollectionStatistics> fieldStatistics) throws IOException {
out.writeVInt(fieldStatistics.size());
for (ObjectObjectCursor<String, CollectionStatistics> c : fieldStatistics) {
out.writeString(c.key);
CollectionStatistics statistics = c.value;
assert statistics.maxDoc() >= 0;
out.writeVLong(statistics.maxDoc());
out.writeVLong(addOne(statistics.docCount()));
out.writeVLong(addOne(statistics.sumTotalTermFreq()));
out.writeVLong(addOne(statistics.sumDocFreq()));
}
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:14,代码来源:DfsSearchResult.java
示例5: addWithKey
import com.carrotsearch.hppc.ObjectObjectHashMap; //导入依赖的package包/类
/** Add fields so that they can later be fetched using {@link #getByKey(Object)}. */
public void addWithKey(Object key, IndexableField field) {
if (keyedFields == null) {
keyedFields = new ObjectObjectHashMap<>();
} else if (keyedFields.containsKey(key)) {
throw new IllegalStateException("Only one field can be stored per key");
}
keyedFields.put(key, field);
add(field);
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:11,代码来源:ParseContext.java
示例6: ensureNoNullKeys
import com.carrotsearch.hppc.ObjectObjectHashMap; //导入依赖的package包/类
/**
* Wraps the given map and prevent adding of <code>null</code> keys.
*
* @param expectedElements
* The expected number of elements guaranteed not to cause buffer
* expansion (inclusive).
*/
public static <K, V> ObjectObjectHashMap<K, V> ensureNoNullKeys(int expectedElements) {
return new ObjectObjectHashMap<K, V>(expectedElements) {
@Override
public V put(K key, V value) {
if (key == null) {
throw new IllegalArgumentException("Map key must not be null");
}
return super.put(key, value);
}
};
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:19,代码来源:HppcMaps.java
示例7: ClusterStatsIndices
import com.carrotsearch.hppc.ObjectObjectHashMap; //导入依赖的package包/类
public ClusterStatsIndices(List<ClusterStatsNodeResponse> nodeResponses) {
ObjectObjectHashMap<String, ShardStats> countsPerIndex = new ObjectObjectHashMap<>();
this.docs = new DocsStats();
this.store = new StoreStats();
this.fieldData = new FieldDataStats();
this.queryCache = new QueryCacheStats();
this.completion = new CompletionStats();
this.segments = new SegmentsStats();
for (ClusterStatsNodeResponse r : nodeResponses) {
for (org.elasticsearch.action.admin.indices.stats.ShardStats shardStats : r.shardsStats()) {
ShardStats indexShardStats = countsPerIndex.get(shardStats.getShardRouting().getIndexName());
if (indexShardStats == null) {
indexShardStats = new ShardStats();
countsPerIndex.put(shardStats.getShardRouting().getIndexName(), indexShardStats);
}
indexShardStats.total++;
CommonStats shardCommonStats = shardStats.getStats();
if (shardStats.getShardRouting().primary()) {
indexShardStats.primaries++;
docs.add(shardCommonStats.docs);
}
store.add(shardCommonStats.store);
fieldData.add(shardCommonStats.fieldData);
queryCache.add(shardCommonStats.queryCache);
completion.add(shardCommonStats.completion);
segments.add(shardCommonStats.segments);
}
}
shards = new ShardStats();
indexCount = countsPerIndex.size();
for (ObjectObjectCursor<String, ShardStats> indexCountsCursor : countsPerIndex) {
shards.addIndexShardCount(indexCountsCursor.value);
}
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:41,代码来源:ClusterStatsIndices.java
示例8: putInContext
import com.carrotsearch.hppc.ObjectObjectHashMap; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public final synchronized <V> V putInContext(Object key, Object value) {
if (context == null) {
context = new ObjectObjectHashMap<>(2);
}
return (V) context.put(key, value);
}
开发者ID:baidu,项目名称:Elasticsearch,代码行数:9,代码来源:ContextAndHeaderHolder.java
示例9: putAllInContext
import com.carrotsearch.hppc.ObjectObjectHashMap; //导入依赖的package包/类
@Override
public final synchronized void putAllInContext(ObjectObjectAssociativeContainer<Object, Object> map) {
if (map == null) {
return;
}
if (context == null) {
context = new ObjectObjectHashMap<>(map);
} else {
context.putAll(map);
}
}
开发者ID:baidu,项目名称:Elasticsearch,代码行数:12,代码来源:ContextAndHeaderHolder.java
示例10: initMatrix
import com.carrotsearch.hppc.ObjectObjectHashMap; //导入依赖的package包/类
protected void initMatrix(
final ObjectObjectHashMap<Double, IntFloatHashMap> matrix,
final Set<Double> uniqueLabels,
final BagOfPattern[] bag) {
for (Double label : uniqueLabels) {
IntFloatHashMap stat = matrix.get(label);
if (stat == null) {
matrix.put(label, new IntFloatHashMap(bag[0].bag.size() * bag.length));
} else {
stat.clear();
}
}
}
开发者ID:patrickzib,项目名称:SFA,代码行数:14,代码来源:BOSSVS.java
示例11: setup
import com.carrotsearch.hppc.ObjectObjectHashMap; //导入依赖的package包/类
@Override
public void setup(final int[] keys, final float fillFactor, final int oneFailureOutOf ) {
super.setup( keys, fillFactor, oneFailureOutOf );
m_map = new ObjectObjectHashMap<>( keys.length, fillFactor );
for (Integer key : m_keys)
m_map.put(new Integer( key % oneFailureOutOf == 0 ? key + 1 : key ), key);
}
开发者ID:mikvor,项目名称:hashmapTest,代码行数:8,代码来源:HppcObjMapTest.java
示例12: test
import com.carrotsearch.hppc.ObjectObjectHashMap; //导入依赖的package包/类
@Override
public int test() {
final ObjectObjectMap<Integer, Integer> m_map = new ObjectObjectHashMap<>( m_keys.length, m_fillFactor );
for ( int i = 0; i < m_keys.length; ++i )
m_map.put( m_keys[ i ], m_keys[ i ] );
for ( int i = 0; i < m_keys2.length; ++i )
m_map.put( m_keys2[ i ], m_keys2[ i ] );
return m_map.size();
}
开发者ID:mikvor,项目名称:hashmapTest,代码行数:10,代码来源:HppcObjMapTest.java
示例13: toXmlDocument
import com.carrotsearch.hppc.ObjectObjectHashMap; //导入依赖的package包/类
public Element toXmlDocument (String rootEltName, Object ns) {
ArrayList orderedByStart = new ArrayList (extractedSpans);
Collections.sort (orderedByStart, new Comparator () {
public int compare (Object o, Object o1)
{
int start1 = ((Span)o).getStartIdx ();
int start2 = ((Span)o1).getStartIdx ();
return Double.compare (start1, start2);
}
} );
ArrayList roots = new ArrayList (orderedByStart);
ObjectObjectHashMap children = new ObjectObjectHashMap ();
for (int i = 0; i < orderedByStart.size(); i++) {
LabeledSpan child = (LabeledSpan) orderedByStart.get (i);
for (int j = i-1; j >= 0; j--) {
LabeledSpan parent = (LabeledSpan) orderedByStart.get (j);
if (parent.isSubspan (child)) {
List childList = (List) children.get (parent);
if (childList == null) {
childList = new ArrayList ();
children.put (parent, childList);
}
roots.remove (child);
childList.add (child);
break;
}
}
}
CharSequence doc = (CharSequence) document;
Span wholeDoc = new StringSpan (doc, 0, doc.length ());
return generateElement (rootEltName, wholeDoc, roots, children);
}
开发者ID:mimno,项目名称:Mallet,代码行数:36,代码来源:DocumentExtraction.java
示例14: generateElement
import com.carrotsearch.hppc.ObjectObjectHashMap; //导入依赖的package包/类
private Element generateElement (String parentName, Span span, List childSpans, ObjectObjectHashMap tree) {
Element parentElt = new Element (parentName);
if (childSpans == null || childSpans.isEmpty ()) {
parentElt.setContent (new Text (span.getText ()));
} else {
List childElts = new ArrayList (childSpans.size());
int start = span.getStartIdx ();
int current = 0;
for (int i = 0; i < childSpans.size(); i++) {
LabeledSpan childSpan = (LabeledSpan) childSpans.get (i);
Label childLabel = childSpan.getLabel();
int childStart = childSpan.getStartIdx () - start;
if (childStart > current) {
childElts.add (new Text (span.getText().substring (current, childStart)));
}
if (childLabel == backgroundTag) {
childElts.add (new Text (childSpan.getText()));
} else {
String name = childLabel.getEntry ().toString();
List grandchildren = (List) tree.get (childSpan);
childElts.add (generateElement (name, childSpan, grandchildren, tree));
}
current = childSpan.getEndIdx () - start;
}
if (current < span.getEndIdx ())
childElts.add (new Text (span.getText().substring (current)));
parentElt.addContent (childElts);
}
return parentElt;
}
开发者ID:mimno,项目名称:Mallet,代码行数:37,代码来源:DocumentExtraction.java
示例15: AggregatedDfs
import com.carrotsearch.hppc.ObjectObjectHashMap; //导入依赖的package包/类
public AggregatedDfs(ObjectObjectHashMap<Term, TermStatistics> termStatistics, ObjectObjectHashMap<String, CollectionStatistics> fieldStatistics, long maxDoc) {
this.termStatistics = termStatistics;
this.fieldStatistics = fieldStatistics;
this.maxDoc = maxDoc;
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:6,代码来源:AggregatedDfs.java
示例16: termStatistics
import com.carrotsearch.hppc.ObjectObjectHashMap; //导入依赖的package包/类
public ObjectObjectHashMap<Term, TermStatistics> termStatistics() {
return termStatistics;
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:4,代码来源:AggregatedDfs.java
示例17: fieldStatistics
import com.carrotsearch.hppc.ObjectObjectHashMap; //导入依赖的package包/类
public ObjectObjectHashMap<String, CollectionStatistics> fieldStatistics() {
return fieldStatistics;
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:4,代码来源:AggregatedDfs.java
示例18: newMap
import com.carrotsearch.hppc.ObjectObjectHashMap; //导入依赖的package包/类
/**
* Returns a new map with a default initial capacity.
*/
public static <K, V> ObjectObjectHashMap<K, V> newMap() {
return newMap(16);
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:7,代码来源:HppcMaps.java
示例19: newNoNullKeysMap
import com.carrotsearch.hppc.ObjectObjectHashMap; //导入依赖的package包/类
/**
* Returns a map like {@link #newMap()} that does not accept <code>null</code> keys
*/
public static <K, V> ObjectObjectHashMap<K, V> newNoNullKeysMap() {
return ensureNoNullKeys(16);
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:7,代码来源:HppcMaps.java
示例20: ImmutableOpenMap
import com.carrotsearch.hppc.ObjectObjectHashMap; //导入依赖的package包/类
private ImmutableOpenMap(ObjectObjectHashMap<KType, VType> map) {
this.map = map;
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:4,代码来源:ImmutableOpenMap.java
注:本文中的com.carrotsearch.hppc.ObjectObjectHashMap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论