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


Java THashMap.containsKey方法代码示例

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


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

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

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

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

示例4: exec

import gnu.trove.map.hash.THashMap; //导入方法依赖的package包/类
/**
 * Execute RDF triple extraction
 */
private void exec(NNode node, String list_props, String uri){
	
	if(node.hasChilds()){
		
		ArrayList<String> props = new ArrayList<String>();
		
		for (NNode children : node.getChilds())
			props.add(children.getValue());
		
		THashMap<String, TObjectCharHashMap<String>> res = 
				new THashMap<String, TObjectCharHashMap<String>>();
		res.putAll(runQuery(uri, props));
		
		if(res.size()>0){
			
			for(NNode n : node.getChilds()){
				
				String p = n.getValue();
				
				if(res.containsKey(p)){
					
					String p_index;
					
					for(String uri_res : res.get(p).keySet()){
						
						p_index = String.valueOf(props_index.get(p));
						
						if(inverseProps){
							if(res.get(p).get(uri_res)=='s')
								p_index = String.valueOf(props_index.get("inv_" + p));
						}
						
						if(list_props.length()>0){
							itemTree.addBranches(list_props + "-" + p_index, extractKey(uri_res));
							exec(n, list_props + "-" + p_index, uri_res);
						}
						else{
							itemTree.addBranches(p_index, extractKey(uri_res));
							exec(n, p_index, uri_res);
						}
						
					}
					
				}
				
			}
		}
		
	}
}
 
开发者ID:sisinflab,项目名称:lodreclib,代码行数:54,代码来源:MultiPropQueryExecutor.java


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