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


Java THashMap.get方法代码示例

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


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

示例1: writeMetaData

import gnu.trove.map.hash.THashMap; //导入方法依赖的package包/类
protected static final void writeMetaData(File resultFile, THashMap<String, String> cmdLine) {
	StringBuilder metaDataLineBuilder = new StringBuilder();
	for (String optionKey : cmdLine.keySet()) {
		if (cmdLine.get(optionKey) != null) {
			metaDataLineBuilder.append(String.format("# %s :\t%s\n", optionKey, cmdLine.get(optionKey)));
			System.out.print(String.format("# %s :\t%s\n", optionKey, cmdLine.get(optionKey)));
		} else {
			metaDataLineBuilder.append(String.format("# %s :\t%s\n", optionKey, "true"));
			System.out.print(String.format("# %s :\t%s\n", optionKey, "true"));
		}
	}
	metaDataLineBuilder.append("#Filename\t#Rows\t#Columns\tTime\t#Deps\t#<2Deps\t#<3Deps\t#<4Deps\t#<5Deps\t#<6Deps\t#>5Deps\t#Partitions\n");
	System.out.println("#Filename\t#Rows\t#Columns\tTime\t#Deps\t#<2Deps\t#<3Deps\t#<4Deps\t#<5Deps\t#<6Deps\t#>5Deps\t#Partitions\n");
	try {
		BufferedWriter resultFileWriter = new BufferedWriter(new FileWriter(resultFile));
		resultFileWriter.write(metaDataLineBuilder.toString());
		resultFileWriter.close();
	} catch (IOException e) {
		System.out.println("Couldn't write meta data.");
	}
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:22,代码来源:Benchmarker.java

示例2: EdgesIterator

import gnu.trove.map.hash.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 ();
}
 
开发者ID:iamxiatian,项目名称:wikit,代码行数:24,代码来源:PseudolikelihoodACRFTrainer.java

示例3: Record

import gnu.trove.map.hash.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);
      }
    }
  }
}
 
开发者ID:iamxiatian,项目名称:wikit,代码行数:18,代码来源:Record.java

示例4: readDataSetFile

import gnu.trove.map.hash.THashMap; //导入方法依赖的package包/类
private static void readDataSetFile(List<DataSetFileEntry> _data) {
    features_frequencies_per_class = new THashMap();
    records_count = _data.size();
    for (DataSetFileEntry line_entry : _data) {
        classes_frequencies.increment(line_entry.class_name, 1);
        for (String feature_name : line_entry.features.keySet()) {
            // the value of the feature is either 1 or nothing ////FIXME this part I am not sure about
            int feature_val = line_entry.features.get(feature_name).intValue();
            CustomStringIntHashMap feature_map;
            if (features_frequencies_per_class.containsKey(feature_name)) {
                feature_map = features_frequencies_per_class.get(feature_name);
            } else {
                feature_map = new CustomStringIntHashMap();
                features_frequencies_per_class.put(feature_name, feature_map);
            }
            feature_map.increment(line_entry.class_name, feature_val);
            features_frequencies.increment(feature_name, feature_val);
        }
    }
    all_features_count = features_frequencies.size();
    all_classes_count = classes_frequencies.size();
}
 
开发者ID:amagdy,项目名称:feature_select,代码行数:23,代码来源:FeatureSelectionApp.java

示例5: getGamlDocumentation

import gnu.trove.map.hash.THashMap; //导入方法依赖的package包/类
@Override
public IGamlDescription getGamlDocumentation(final EObject object) {
	if (object == null) {
		return null;
	}
	final THashMap<EObject, IGamlDescription> map = getDocumentationCache(object.eResource());
	if (map == null)
		return null;
	return map.get(object);
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:11,代码来源:GamlResourceDocumenter.java

示例6: toXmlDocument

import gnu.trove.map.hash.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));
}
 
开发者ID:iamxiatian,项目名称:wikit,代码行数:36,代码来源:DocumentExtraction.java

示例7: generateElement

import gnu.trove.map.hash.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;
}
 
开发者ID:iamxiatian,项目名称:wikit,代码行数:38,代码来源:DocumentExtraction.java

示例8: createOperator

import gnu.trove.map.hash.THashMap; //导入方法依赖的package包/类
@Override
public IExpression createOperator(final String op, final IDescription context, final EObject currentEObject,
		final IExpression... args) {
	if (args == null) { return null; }
	for (final IExpression exp : args) {
		if (exp == null) { return null; }
	}
	if (OPERATORS.containsKey(op)) {
		// We get the possible sets of types registered in OPERATORS
		final THashMap<Signature, OperatorProto> ops = OPERATORS.get(op);
		// We create the signature corresponding to the arguments
		// 19/02/14 Only the simplified signature is used now
		Signature userSignature = new Signature(args).simplified();
		final Signature originalUserSignature = userSignature;
		// If the signature is not present in the registry
		if (!ops.containsKey(userSignature)) {
			final Collection<Signature> filtered = Collections2.filter(ops.keySet(),
					operatorSignature -> originalUserSignature.matchesDesiredSignature(operatorSignature));
			final int size = filtered.size();
			if (size == 0) {
				context.error(
						"No operator found for applying '" + op + "' to " + userSignature
								+ " (operators available for " + Arrays.toString(ops.keySet().toArray()) + ")",
						IGamlIssue.UNMATCHED_OPERANDS, currentEObject);
				return null;
			} else if (size == 1) {
				userSignature = Iterables.get(filtered, 0);
			} else {
				int distance = Integer.MAX_VALUE;
				for (final Signature s : filtered) {
					final int dist = s.distanceTo(originalUserSignature);
					if (dist == 0) {
						userSignature = s;
						break;
					} else if (dist < distance) {
						distance = dist;
						userSignature = s;
					}
				}
			}

			// We coerce the types if necessary, by wrapping the original
			// expressions in a
			// casting expression
			final IType[] coercingTypes = userSignature.coerce(originalUserSignature, context);
			for (int i = 0; i < coercingTypes.length; i++) {
				final IType t = coercingTypes[i];
				if (t != null) {
					// Emits a warning when a float is truncated. See Issue
					// 735.
					if (t.id() == IType.INT) {
						// 20/1/14 Changed to info to avoid having too many
						// harmless warnings
						context.info(
								t.toString() + " expected. '" + args[i].serialize(false)
										+ "' will be  truncated to int.",
								IGamlIssue.UNMATCHED_OPERANDS, currentEObject);
					}
					// System.out.println("Coercing arg " + args[i] + " to "
					// + t + " in " + op);
					args[i] =
							createOperator(IKeyword.AS, context, currentEObject, args[i], createTypeExpression(t));
				}
			}
		}
		final OperatorProto proto = ops.get(userSignature);
		// We finally make an instance of the operator and init it with the
		// arguments
		final IExpression copy = proto.create(context, currentEObject, args);
		if (copy != null) {
			final String ged = proto.getDeprecated();
			if (ged != null) {
				context.warning(proto.getName() + " is deprecated: " + ged, IGamlIssue.DEPRECATED, currentEObject);
			}
		}
		return copy;
	}
	return null;

}
 
开发者ID:gama-platform,项目名称:gama,代码行数:81,代码来源:GamlExpressionFactory.java


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