本文整理匯總了Java中gnu.trove.THashMap.get方法的典型用法代碼示例。如果您正苦於以下問題:Java THashMap.get方法的具體用法?Java THashMap.get怎麽用?Java THashMap.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gnu.trove.THashMap
的用法示例。
在下文中一共展示了THashMap.get方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: factorDuplicates
import gnu.trove.THashMap; //導入方法依賴的package包/類
public static <D extends PsiElement> Map<D, List<D>> factorDuplicates(D[] elements, TObjectHashingStrategy<D> strategy) {
if (elements == null || elements.length == 0) return Collections.emptyMap();
THashMap<D, List<D>> map = new THashMap<D, List<D>>(strategy);
for (D element : elements) {
List<D> list = map.get(element);
if (list == null) {
list = new ArrayList<D>();
}
list.add(element);
map.put(element, list);
}
return map;
}
示例2: EdgesIterator
import gnu.trove.THashMap; //導入方法依賴的package包/類
public EdgesIterator (ACRF.UnrolledGraph acrf, Assignment observed)
{
this.graph = acrf;
this.observed = observed;
cliquesByEdge = new THashMap();
for (Iterator it = acrf.unrolledVarSetIterator (); it.hasNext();) {
ACRF.UnrolledVarSet clique = (ACRF.UnrolledVarSet) it.next ();
for (int v1idx = 0; v1idx < clique.size(); v1idx++) {
Variable v1 = clique.get(v1idx);
List adjlist = graph.allFactorsContaining (v1);
for (Iterator factorIt = adjlist.iterator(); factorIt.hasNext();) {
Factor factor = (Factor) factorIt.next ();
if (!cliquesByEdge.containsKey (factor)) { cliquesByEdge.put (factor, new ArrayList()); }
List l = (List) cliquesByEdge.get (factor);
if (!l.contains (clique)) { l.add (clique); }
}
}
}
cursor = cliquesByEdge.keySet().iterator ();
}
示例3: Record
import gnu.trove.THashMap; //導入方法依賴的package包/類
public Record (String name, LabeledSpans spans) {
this.name = name;
fieldMap = new THashMap ();
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);
}
}
}
}
示例4: toXmlDocument
import gnu.trove.THashMap; //導入方法依賴的package包/類
public Document toXmlDocument (String rootEltName, Namespace 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);
THashMap children = new THashMap ();
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 new Document (generateElement (rootEltName, wholeDoc, roots, children));
}
示例5: generateElement
import gnu.trove.THashMap; //導入方法依賴的package包/類
private Element generateElement (String parentName, Span span, List childSpans, THashMap 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;
}
示例6: removeValue
import gnu.trove.THashMap; //導入方法依賴的package包/類
private void removeValue(int inputId, Object fileSet, Value value) {
if (fileSet == null) {
return;
}
if (fileSet instanceof ChangeBufferingList) {
final ChangeBufferingList changesList = (ChangeBufferingList)fileSet;
changesList.remove(inputId);
if (!changesList.isEmpty()) return;
}
else if (fileSet instanceof Integer) {
if (((Integer)fileSet).intValue() != inputId) {
return;
}
}
if (!(myInputIdMapping instanceof THashMap)) {
myInputIdMapping = null;
myInputIdMappingValue = null;
} else {
THashMap<Value, Object> mapping = (THashMap<Value, Object>)myInputIdMapping;
mapping.remove(value);
if (mapping.size() == 1) {
myInputIdMapping = mapping.keySet().iterator().next();
myInputIdMappingValue = mapping.get((Value)myInputIdMapping);
}
}
}