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


Java THashMap类代码示例

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


THashMap类属于gnu.trove.map.hash包,在下文中一共展示了THashMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: combinedKeyWithTHashMapIsScalarized

import gnu.trove.map.hash.THashMap; //导入依赖的package包/类
@Test
public void combinedKeyWithTHashMapIsScalarized() throws Exception {
	final THashMap<StringKey, String> troveMap = new THashMap<>( MAP );
	assertThat(
			new Scenario() {
				@Override
				public long run() {
					final StringKey combinedKey = generateKey( SUCCESSFUL_LOOKUPS_PROBABILITY );
					final String value = troveMap.get( combinedKey );
					if( value == null ) {
						return combinedKey.item1.length();
					} else {
						return value.length();
					}
				}
			},
			finallyAllocatesNothing()
	);
}
 
开发者ID:cheremin,项目名称:scalarization,代码行数:20,代码来源:MapGetWithTupleKeyTest.java

示例3: testTHashMap

import gnu.trove.map.hash.THashMap; //导入依赖的package包/类
public void testTHashMap() {
	TMap<String,String> map = new THashMap<String, String>();

	// Add 5, remove the first four, repeat
	String[] to_remove = new String[ 4 ];
	int batch_index = 0;
	for( String s : Constants.STRING_OBJECTS ) {
		if ( batch_index < 4 ) {
			to_remove[ batch_index ] = s;
		}

		map.put( s, s );
		batch_index++;

		if ( batch_index == 5 ) {
			for( String s_remove : to_remove ) {
				map.remove( s_remove );
			}
			batch_index = 0;
		}
	}
}
 
开发者ID:leventov,项目名称:trove-over-koloboke-compile,代码行数:23,代码来源:ManyRemovalsBenchmark.java

示例4: testTrove2HashMap

import gnu.trove.map.hash.THashMap; //导入依赖的package包/类
public void testTrove2HashMap() {
	gnu.trove.THashMap<String,String> map = new gnu.trove.THashMap<String, String>();

	// Add 5, remove the first four, repeat
	String[] to_remove = new String[ 4 ];
	int batch_index = 0;
	for( String s : Constants.STRING_OBJECTS ) {
		if ( batch_index < 4 ) {
			to_remove[ batch_index ] = s;
		}

		map.put( s, s );
		batch_index++;

		if ( batch_index == 5 ) {
			for( String s_remove : to_remove ) {
				map.remove( s_remove );
			}
			batch_index = 0;
		}
	}
}
 
开发者ID:leventov,项目名称:trove-over-koloboke-compile,代码行数:23,代码来源:ManyRemovalsBenchmark.java

示例5: StateSpace

import gnu.trove.map.hash.THashMap; //导入依赖的package包/类
/**
 * Constructs a container for states associated with a given {@code period}. 
 * Do not use {@code ConcurrentHashMap} in conjunction with forward recursion.
 * 
 * @param period the period associated with this container.
 * @param hash the type of hash used to store the state space
 */
public StateSpace(int period, HashType hash){
	this.period = period;
	switch(hash){
	case HASHTABLE:
	   this.states = new Hashtable<SD,State>();
	   break;
	case CONCURRENT_HASHMAP:
	   this.states = Collections.synchronizedMap(new ConcurrentHashMap<SD,State>());
	   break;
	case THASHMAP:
	   this.states = Collections.synchronizedMap(new THashMap<SD,State>());
	   break;
	case MAPDB_MEMORY:
        this.states = new MapDBHashTable<SD,State>("states", Storage.MEMORY);
        break;   
	case MAPDB_DISK:
        this.states = new MapDBHashTable<SD,State>("states", Storage.DISK);
        break;      
     default: 
        throw new NullPointerException("HashType not available");
	}
}
 
开发者ID:gwr3n,项目名称:jsdp,代码行数:30,代码来源:StateSpace.java

示例6: processOptions

import gnu.trove.map.hash.THashMap; //导入依赖的package包/类
/**
 * Go through the options and sort out the long and the short options
 * into their own hash maps.
 *
 * @since 64bitlabsutils 1.07.00
 */
private void processOptions(){
	longOptions = new THashMap<>();
	shortOptions= new THashMap<>();
	for (CmdLnOption option: options){
		option.setImmutable();
		for (String name: option.getLongNames()){
			if (longOptions.containsKey(name)){
				throw new IllegalArgumentException("More than one long option has the name: '" + name + "'");
			}
			longOptions.put(name, option);
		}
		for (Character c: option.getShortNames()){
			if (shortOptions.containsKey(c)){
				throw new IllegalArgumentException("More than one short option has the character: '" + c + "'");
			}
			shortOptions.put(c, option);
		}
	}
}
 
开发者ID:tolgayilmaz86,项目名称:Common-Java-Utilities,代码行数:26,代码来源:CmdLn.java

示例7: read

import gnu.trove.map.hash.THashMap; //导入依赖的package包/类
public THashMap<String, String> read(long n){
  	
  	THashMap<String,String> res = new THashMap<String,String>();
  	
  	long count = 0;
  	for(String key : file_index.keySet()){
	
	if(count < n){
		String tmp = read(key);
		res.put(key, tmp);
		count++;
	}
	else
		break;
	
}
  	
  	return res;
  	
  }
 
开发者ID:sisinflab,项目名称:lodreclib,代码行数:21,代码来源:StringFileManager.java

示例8: readFileIndex

import gnu.trove.map.hash.THashMap; //导入依赖的package包/类
private THashMap<String, String> readFileIndex(){
   	
   	THashMap<String,String> file_index = new THashMap<String,String>();
	
	try{
		String line = null;
		
		while((line=file_index_reader.readLine()) != null){
			String[] vals = line.split("\t");
			file_index.put(vals[0], vals[1]+":"+vals[2]);
			index_size++;
		}
		
		return file_index;
	}
	catch(Exception e){
		e.printStackTrace();
	}
	
	return null;
	
}
 
开发者ID:sisinflab,项目名称:lodreclib,代码行数:23,代码来源:FileManager.java

示例9: loadFileIndex

import gnu.trove.map.hash.THashMap; //导入依赖的package包/类
public static void loadFileIndex(String file, THashMap<String, String> items_pair_value){
	
	try{
		BufferedReader br = new BufferedReader(new FileReader(file));
		String line = null;
		
		while((line=br.readLine()) != null){
			String[] vals = line.split("\t");
			items_pair_value.put(vals[0], vals[1]+":"+vals[2]);
		}
		
		br.close();
	}
	catch(Exception e){
		e.printStackTrace();
	}
	
}
 
开发者ID:sisinflab,项目名称:lodreclib,代码行数:19,代码来源:TextFileUtils.java

示例10: index

import gnu.trove.map.hash.THashMap; //导入依赖的package包/类
/**
 * Index all current annotations of this document. Creates an internal cache
 * for mappings from bioentity-id to set of annotations.
 * 
 * @see #getGeneAnnotations(String)
 */
public void index() {
	annotationMap = new THashMap<String, List<GeneAnnotation>>();
	for (GeneAnnotation a : getGeneAnnotations()) {
		String eid = a.getBioentity();
		List<GeneAnnotation> entities = annotationMap.get(eid);
		if (entities == null) {
			annotationMap.put(eid, Collections.singletonList(a));
		}
		else if (entities.size() == 1) {
			List<GeneAnnotation> longEntities = new ArrayList<GeneAnnotation>();
			longEntities.add(entities.get(0));
			longEntities.add(a);
			annotationMap.put(eid, longEntities);
		}
		else {
			entities.add(a);
		}
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:26,代码来源:GafDocument.java

示例11: beginExecution

import gnu.trove.map.hash.THashMap; //导入依赖的package包/类
protected boolean beginExecution(final IScope scope) throws GamaRuntimeException {
	final IAgent agent = scope.getAgent();
	if (scope.interrupted()) {
		return false;
	}
	final Boolean enter = (Boolean) agent.getAttribute(ENTER);
	Map<String, Object> memory = (Map) agent.getAttribute(STATE_MEMORY);
	if (enter || memory == null) {
		memory = new THashMap<>();
		agent.setAttribute(STATE_MEMORY, memory);
	} else {
		for (final Map.Entry<String, Object> entry : memory.entrySet()) {
			scope.addVarWithValue(entry.getKey(), entry.getValue());
		}
	}
	if (enter) {
		if (enterActions != null) {
			enterActions.executeOn(scope);
		}
		if (agent.dead()) {
			return false;
		}
		agent.setAttribute(ENTER, false);
	}
	return true;
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:27,代码来源:FsmStateStatement.java

示例12: initResources

import gnu.trove.map.hash.THashMap; //导入依赖的package包/类
static void initResources() {
	eType = GamlPackage.eINSTANCE.getTypeDefinition();
	eVar = GamlPackage.eINSTANCE.getVarDefinition();
	eSkill = GamlPackage.eINSTANCE.getSkillFakeDefinition();
	eAction = GamlPackage.eINSTANCE.getActionDefinition();
	eUnit = GamlPackage.eINSTANCE.getUnitFakeDefinition();
	eEquation = GamlPackage.eINSTANCE.getEquationDefinition();
	resources = new THashMap<>();
	resources.put(eType, createResource("types.xmi"));
	resources.put(eVar, createResource("vars.xmi"));
	resources.put(eSkill, createResource("skills.xmi"));
	resources.put(eUnit, createResource("units.xmi"));
	resources.put(eAction, createResource("actions.xmi"));
	resources.put(eEquation, createResource("equations.xmi"));
	descriptions = new THashMap<>();
	descriptions.put(eVar, new THashMap<>());
	descriptions.put(eType, new THashMap<>());
	descriptions.put(eSkill, new THashMap<>());
	descriptions.put(eUnit, new THashMap<>());
	descriptions.put(eAction, new THashMap<>());
	descriptions.put(eEquation, new THashMap<>());
	allNames = new THashSet<>();
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:24,代码来源:BuiltinGlobalScopeProvider.java

示例13: getExtensionInstance

import gnu.trove.map.hash.THashMap; //导入依赖的package包/类
/**
 * Creates and registers an extension instance.
 *
 * @param extensionClass
 *     the extension class.
 * @param proxy
 *     the proxy to register the extension on.
 * @return the component extension.
 */
protected synchronized IComponentExtension<? extends IComponent> getExtensionInstance(
    Class<IComponentExtension<IComponent>> extensionClass, IComponent proxy) {
  IComponentExtension<IComponent> extension;
  if (componentExtensions == null) {
    componentExtensions = new THashMap<>(1, 1.0f);
    extension = null;
  } else {
    extension = componentExtensions.get(extensionClass);
  }
  if (extension == null) {
    extension = extensionFactory.createComponentExtension(extensionClass,
        componentDescriptor.getComponentContract(), proxy);
    componentExtensions.put(extensionClass, extension);
    configureExtension(extension);
  }
  return extension;
}
 
开发者ID:jspresso,项目名称:jspresso-ce,代码行数:27,代码来源:AbstractComponentInvocationHandler.java

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

示例15: setupLabel2Var

import gnu.trove.map.hash.THashMap; //导入依赖的package包/类
private void setupLabel2Var ()
{
  idx2var = new Variable [lblseq.size ()][];
  var2label = new THashMap();
  for (int t = 0; t < lblseq.size (); t++) {
    Labels lbls = lblseq.getLabels (t);
    idx2var[t] = new Variable [lbls.size ()];
    for (int j = 0; j < lbls.size (); j++) {
      Label lbl = lbls.get (j);
      Variable var = new Variable (lbl.getLabelAlphabet ());
      var.setLabel ("I"+id+"_VAR[f=" + j + "][tm=" + t + "]");
      idx2var[t][j] = var;
      var2label.put (var, lbl);
    }
  }
}
 
开发者ID:iamxiatian,项目名称:wikit,代码行数:17,代码来源:LabelsAssignment.java


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