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


Java TreeMap.get方法代码示例

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


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

示例1: NtoNQueryParameter

import java.util.TreeMap; //导入方法依赖的package包/类
/**
 * コンストラクタ.
 * @param srcHandler OEntityDocHandler
 * @param targetSetName ターゲット側のEntitySet名
 * @param targetEntityTypeId ターゲット側のEntityTypeID
 */
public NtoNQueryParameter(
        final EntitySetDocHandler srcHandler,
        final String targetSetName,
        final String targetEntityTypeId) {
    String srcSetName = srcHandler.getType();
    String srcId = srcHandler.getId();

    TreeMap<String, String> tm = new TreeMap<String, String>();
    if (srcSetName.equals(UserDataODataProducer.USER_ODATA_NAMESPACE)) {
        tm.put(srcHandler.getEntityTypeId(), srcId);
        tm.put(targetEntityTypeId, "");
    } else {
        tm.put(srcSetName, srcId);
        tm.put(targetSetName, "");
    }
    this.t1 = tm.firstKey();
    this.t2 = tm.lastKey();
    this.k1 = tm.get(t1);
    this.k2 = tm.get(t2);
}
 
开发者ID:personium,项目名称:personium-core,代码行数:27,代码来源:LinkDocHandler.java

示例2: getKClosestVectors

import java.util.TreeMap; //导入方法依赖的package包/类
/**
 * Iterates along entries in distance map and fill the resulting k-element array.
 *
 * @param trainingData The training data.
 * @param distanceIdxPairs The distance map.
 * @param isCashedDistances Cache distances if true.
 * @return K-nearest neighbors.
 */
@NotNull private LabeledVector[] getKClosestVectors(LabeledVector[] trainingData,
    TreeMap<Double, Set<Integer>> distanceIdxPairs, boolean isCashedDistances) {
    LabeledVector[] res = new LabeledVector[k];
    int i = 0;
    final Iterator<Double> iter = distanceIdxPairs.keySet().iterator();
    while (i < k) {
        double key = iter.next();
        Set<Integer> idxs = distanceIdxPairs.get(key);
        for (Integer idx : idxs) {
            res[i] = trainingData[idx];
            if (isCashedDistances) {
                if (cachedDistances == null)
                    cachedDistances = new double[k];
                cachedDistances[i] = key;
            }
            i++;
            if (i >= k)
                break; // go to next while-loop iteration
        }
    }
    return res;
}
 
开发者ID:Luodian,项目名称:Higher-Cloud-Computing-Project,代码行数:31,代码来源:KNNModel.java

示例3: selectLikelyEntry

import java.util.TreeMap; //导入方法依赖的package包/类
static <A> Entry<A, Double> selectLikelyEntry(TreeMap<A, Double> entries)
{
	ArrayList<A> keys = new ArrayList<A>(entries.keySet());
	
	Double value;
	A randomKey;
	
	do
	{			
		randomKey = keys.get(random.nextInt(keys.size()));
		value = entries.get(randomKey);
		
		//System.out.println("thinking to talk about " + randomKey + " + " + value + "("+keys.size()+" keys)");
	}
	while(value==null || (Math.random() > value.doubleValue()));
	
	return new SimpleEntry<A, Double>(randomKey, value);
}
 
开发者ID:CognitiveModeling,项目名称:BrainControl,代码行数:19,代码来源:VoiceKnowledgeManager.java

示例4: insert

import java.util.TreeMap; //导入方法依赖的package包/类
public void insert(List<MDPoint> points) throws IOException {
  TreeMap<byte[], List<MDPoint>> map = new TreeMap<>(Bytes.BYTES_COMPARATOR);
  for (MDPoint point : points) {
    byte[] row = MDUtils.bitwiseZip(point.values, dimensions);
    List<MDPoint> list = map.get(row);
    if (list == null) {
      list = new ArrayList<>();
      map.put(row, list);
    }
    list.add(point);
  }

  for (Map.Entry<byte[], List<MDPoint>> entry : map.entrySet()) {
    MDBucket bucket = index.fetchBucket(entry.getKey());
    bucket.insert(entry.getKey(), entry.getValue());
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:18,代码来源:MDHBaseAdmin.java

示例5: inhibitEffectsBasedOnKnowledge

import java.util.TreeMap; //导入方法依赖的package包/类
/**
 * Computes a measure for inhibition based on how much is known about a
 * ConditionDirectionPair.
 * 
 * @param knowledge
 * @param collision
 * @return inhibitionFactor
 */

public static double inhibitEffectsBasedOnKnowledge(
		TreeMap<ConditionDirectionPair, TreeMap<Effect, Double>> knowledge,
		ConditionDirectionPair collision) {
	final double inhibitAlsoUnknownEffects = 0.5;

	if (knowledge == null || !knowledge.containsKey(collision)) // nothing
																// is known
																// at all
		return inhibitAlsoUnknownEffects; // the collision may be undesired,
											// so we might want to inhibit
											// it.
	TreeMap<Effect, Double> effects = knowledge.get(collision);
	double inhibitionFactor = 0.0;
	for (Entry<Effect, Double> e : effects.entrySet()) {
		if (e.getKey().getType() != ActionEffect.NOTHING_HAPPENS)
			inhibitionFactor += e.getValue().doubleValue(); // always
															// inhibit
															// non-zero-effects
															// (the more is
															// known
															// about them
															// the more
															// inhibit,
															// therefore sum
															// up all
															// probabilities
															// in knowledge)
	}
	return inhibitionFactor; // never inhibit zero-effects (then 0.0 is
								// returned)
}
 
开发者ID:CognitiveModeling,项目名称:BrainControl,代码行数:41,代码来源:GeneralUtil.java

示例6: getContactGroup

import java.util.TreeMap; //导入方法依赖的package包/类
public List<VirtualCategory<Contact>> getContactGroup(List<Contact> list) {
    List<VirtualCategory<Contact>> cates = new ArrayList<>();
    if (!IMUtils.isEmpty(list)) {
        List<Contact> unA = new ArrayList<>();
        TreeMap<String, List<Contact>> maps = new TreeMap<>();
        for (Contact c : list) {
            String py = c.getPYInitial();
            char A = IMUtils.isEmpty(py) ? '#' : py.charAt(0);
            if (A >= 'A' && A <= 'Z' || A >= 'a' && A <= 'z') {
                String a = String.valueOf(A).toUpperCase();
                List<Contact> values = maps.get(a);
                if (values == null) {
                    values = new ArrayList<>();
                    maps.put(a, values);
                }
                values.add(c);
            } else {
                unA.add(c);
            }
        }
        for (String n : maps.keySet()) {
            cates.add(new VirtualCategory<>(n, maps.get(n)));
        }
        if (!IMUtils.isEmpty(unA)) {
            cates.add(new VirtualCategory<>("#", unA));
        }
    }
    return cates;
}
 
开发者ID:Jamling,项目名称:SmartQQ4IntelliJ,代码行数:30,代码来源:WXContactTreeNode.java

示例7: getToolOutput

import java.util.TreeMap; //导入方法依赖的package包/类
public SortedMap<String, ToolOutput> getToolOutput(List<String> names, IImageGalleryService imageGalleryService,
    Long toolSessionId, Long learnerId) {

TreeMap<String, ToolOutput> outputs = new TreeMap<String, ToolOutput>();
// tool output cache
TreeMap<String, ToolOutput> baseOutputs = new TreeMap<String, ToolOutput>();
if (names == null) {
    outputs.put(ImageGalleryOutputFactory.OUTPUT_NAME_LEARNER_NUM_IMAGES_UPLOADED,
	    getToolOutput(ImageGalleryOutputFactory.OUTPUT_NAME_LEARNER_NUM_IMAGES_UPLOADED,
		    imageGalleryService, toolSessionId, learnerId));
    outputs.put(ImageGalleryOutputFactory.OUTPUT_NAME_LEARNER_NUM_COMMENTS,
	    getToolOutput(ImageGalleryOutputFactory.OUTPUT_NAME_LEARNER_NUM_COMMENTS, imageGalleryService,
		    toolSessionId, learnerId));
    outputs.put(ImageGalleryOutputFactory.OUTPUT_NAME_LEARNER_NUM_VOTES,
	    getToolOutput(ImageGalleryOutputFactory.OUTPUT_NAME_LEARNER_NUM_VOTES, imageGalleryService,
		    toolSessionId, learnerId));
    outputs.put(ImageGalleryOutputFactory.OUTPUT_NAME_UPLOADED_IMAGES_URLS,
	    getToolOutput(ImageGalleryOutputFactory.OUTPUT_NAME_UPLOADED_IMAGES_URLS, imageGalleryService,
		    toolSessionId, learnerId));
} else {
    for (String name : names) {
	String[] nameParts = splitConditionName(name);
	if (baseOutputs.get(nameParts[0]) != null) {
	    outputs.put(name, baseOutputs.get(nameParts[0]));
	} else {
	    ToolOutput output = getToolOutput(name, imageGalleryService, toolSessionId, learnerId);
	    if (output != null) {
		outputs.put(name, output);
		baseOutputs.put(nameParts[0], output);
	    }
	}
    }
}

return outputs;
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:37,代码来源:ImageGalleryOutputFactory.java

示例8: writeSettings

import java.util.TreeMap; //导入方法依赖的package包/类
private static void writeSettings(XmlSerializer serializer, Map<String, Object> prefs) throws IOException {

        for (Entry<String, TreeMap<Integer, SettingsDescription>> versionedSetting :
                GlobalSettings.SETTINGS.entrySet()) {

            String key = versionedSetting.getKey();
            String valueString = (String) prefs.get(key);
            TreeMap<Integer, SettingsDescription> versions = versionedSetting.getValue();
            Integer highestVersion = versions.lastKey();
            SettingsDescription setting = versions.get(highestVersion);
            if (setting == null) {
                // Setting was removed.
                continue;
            }

            if (valueString != null) {
                try {
                    writeKeyAndPrettyValueFromSetting(serializer, key, setting, valueString);
                } catch (InvalidSettingValueException e) {
                    Timber.w("Global setting \"%s\" has invalid value \"%s\" in preference storage. " +
                            "This shouldn't happen!", key, valueString);
                }
            } else {
                Timber.d("Couldn't find key \"%s\" in preference storage. Using default value.", key);
                writeKeyAndDefaultValueFromSetting(serializer, key, setting);
            }
        }
    }
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:29,代码来源:SettingsExporter.java

示例9: dependsOnTransitively

import java.util.TreeMap; //导入方法依赖的package包/类
private boolean dependsOnTransitively(String kit1, String kit2, 
    TreeMap<String, TreeSet<String>> dependingKits) {
    TreeSet<String> kits = dependingKits.get(kit1);
    if (kits == null) {
        return false;
    }
    return kits.contains(kit2);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:ModuleDependencies.java

示例10: getFileUploadProcessors

import java.util.TreeMap; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected List<FileUploadProcessor> getFileUploadProcessors(String group) throws Exception {
  // 初始化业务分支
  if (initdTag.compareAndSet(false, true)) {
    TreeMap<String, TreeMap<Integer, LinkedList<FileUploadProcessor>>> all =
        (TreeMap<String, TreeMap<Integer, LinkedList<FileUploadProcessor>>>) fileProcessFactory.getObject();
    //
    TreeMap<Integer, LinkedList<FileUploadProcessor>> pd = all.get(AbstractChannelProcessor.KEY);
    for (Entry<Integer, LinkedList<FileUploadProcessor>> orderProcessorEntry : pd.entrySet()) {
      publicChannel.addAll(orderProcessorEntry.getValue());
    }
    all.remove(AbstractChannelProcessor.KEY);//干掉主分支
    // 遍历其他的树
    for (Entry<String, TreeMap<Integer, LinkedList<FileUploadProcessor>>> tree : all.entrySet()) {
      TreeMap<Integer, LinkedList<FileUploadProcessor>> thisTree = tree.getValue();
      LinkedList<FileUploadProcessor> thisTreeList = new LinkedList<FileUploadProcessor>();
      // 添加树枝
      for (Entry<Integer, LinkedList<FileUploadProcessor>> branch : thisTree.entrySet()) {
        thisTreeList.addAll(branch.getValue());
      }
      for (int i = 0; i < thisTreeList.size()-1; i++) {
        ((AbstractChannelProcessor)thisTreeList.get(i)).nextProcessor = thisTreeList.get(i+1);
      }
      namedChannel.put(tree.getKey(), thisTreeList);
    }
  }
  //
  if (StringUtils.isBlank(group)) {
    return publicChannel;
  } else {
    LinkedList<FileUploadProcessor> ppl = namedChannel.get(group);
    return ppl == null ? new LinkedList<FileUploadProcessor>() : ppl;
  }
}
 
开发者ID:devpage,项目名称:fastdfs-quickstart,代码行数:35,代码来源:GenericFileProcessor.java

示例11: getAvailableFontFamilyNames

import java.util.TreeMap; //导入方法依赖的package包/类
public String[] getAvailableFontFamilyNames(Locale requestedLocale) {
    FontManagerForSGE fm = getFontManagerForSGE();
    String[] installed = fm.getInstalledFontFamilyNames(requestedLocale);
    /* Use a new TreeMap as used in getInstalledFontFamilyNames
     * and insert all the keys in lower case, so that the sort order
     * is the same as the installed families. This preserves historical
     * behaviour and inserts new families in the right place.
     * It would have been marginally more efficient to directly obtain
     * the tree map and just insert new entries, but not so much as
     * to justify the extra internal interface.
     */
    TreeMap<String, String> map = fm.getCreatedFontFamilyNames();
    if (map == null || map.size() == 0) {
        return installed;
    } else {
        for (int i=0; i<installed.length; i++) {
            map.put(installed[i].toLowerCase(requestedLocale),
                    installed[i]);
        }
        String[] retval =  new String[map.size()];
        Object [] keyNames = map.keySet().toArray();
        for (int i=0; i < keyNames.length; i++) {
            retval[i] = (String)map.get(keyNames[i]);
        }
        return retval;
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:28,代码来源:SunGraphicsEnvironment.java

示例12: getToolOutput

import java.util.TreeMap; //导入方法依赖的package包/类
/**
    * Follows {@link PixlrService#getToolOutput(List, Long, Long)}.
    *
    */
   public SortedMap<String, ToolOutput> getToolOutput(List<String> names, IResourceService resourceService,
    Long toolSessionId, Long learnerId) {

TreeMap<String, ToolOutput> outputs = new TreeMap<String, ToolOutput>();
// tool output cache
TreeMap<String, ToolOutput> baseOutputs = new TreeMap<String, ToolOutput>();
if (names == null) {
    outputs.put(ResourceConstants.SHARED_ITEMS_DEFINITION_NAME, getToolOutput(
	    ResourceConstants.SHARED_ITEMS_DEFINITION_NAME, resourceService, toolSessionId, learnerId));
} else {
    for (String name : names) {
	String[] nameParts = splitConditionName(name);
	if (baseOutputs.get(nameParts[0]) != null) {
	    outputs.put(name, baseOutputs.get(nameParts[0]));
	} else {
	    ToolOutput output = getToolOutput(name, resourceService, toolSessionId, learnerId);
	    if (output != null) {
		outputs.put(name, output);
		baseOutputs.put(nameParts[0], output);
	    }
	}
    }
}

return outputs;

   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:32,代码来源:ResourceOutputFactory.java

示例13: addStartEndKeysForTest

import java.util.TreeMap; //导入方法依赖的package包/类
private void addStartEndKeysForTest(TreeMap<byte[], Integer> map, byte[] first, byte[] last) {
  Integer value = map.containsKey(first)?map.get(first):0;
  map.put(first, value+1);

  value = map.containsKey(last)?map.get(last):0;
  map.put(last, value-1);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:8,代码来源:TestLoadIncrementalHFiles.java

示例14: load

import java.util.TreeMap; //导入方法依赖的package包/类
static boolean load()
    {
        trie = new DoubleArrayTrie<Boolean>();
        if (loadDat()) return true;
        try
        {
            BufferedReader br = new BufferedReader(new InputStreamReader(IOUtil.newInputStream(path), "UTF-8"));
            String line;
            TreeMap<String, Boolean> map = new TreeMap<String, Boolean>();
            TreeMap<Character, Integer> charFrequencyMap = new TreeMap<Character, Integer>();
            while ((line = br.readLine()) != null)
            {
                map.put(line, true);
                // 音译人名常用字词典自动生成
                for (char c : line.toCharArray())
                {
                    // 排除一些过于常用的字
                    if ("不赞".indexOf(c) >= 0) continue;
                    Integer f = charFrequencyMap.get(c);
                    if (f == null) f = 0;
                    charFrequencyMap.put(c, f + 1);
                }
            }
            br.close();
            map.put(String.valueOf('·'), true);
//            map.put(String.valueOf('-'), true);
//            map.put(String.valueOf('—'), true);
            // 将常用字也加进去
            for (Map.Entry<Character, Integer> entry : charFrequencyMap.entrySet())
            {
                if (entry.getValue() < 10) continue;
                map.put(String.valueOf(entry.getKey()), true);
            }
            logger.info("音译人名词典" + path + "开始构建双数组……");
            trie.build(map);
            logger.info("音译人名词典" + path + "开始编译DAT文件……");
            logger.info("音译人名词典" + path + "编译结果:" + saveDat(map));
        }
        catch (Exception e)
        {
            logger.severe("自定义词典" + path + "读取错误!" + e);
            return false;
        }

        return true;
    }
 
开发者ID:priester,项目名称:hanlpStudy,代码行数:47,代码来源:TranslatedPersonDictionary.java

示例15: getServiceToArtifactMap

import java.util.TreeMap; //导入方法依赖的package包/类
public TreeMap<String, HashSet<String>> getServiceToArtifactMap ( ReleasePackage model ) {

		if ( getHostStatusManager() == null ) {
			return null;
		}

		ArrayList<String> lifeCycleHostList = model
			.getLifeCycleToHostMap()
			.get(
				getCurrentLifeCycle() );

		TreeMap<String, HashSet<String>> working_serviceToVersionMap = new TreeMap<String, HashSet<String>>();

		try {
			for ( String host : lifeCycleHostList ) {
				ObjectNode hostRuntime = getHostStatusManager().getResponseFromHost( host );
				if ( hostRuntime != null ) {

					Iterator<String> serviceIter = hostRuntime
						.path( "services" )
						.fieldNames();

					while (serviceIter.hasNext()) {
						String service_port = serviceIter.next();

						String serviceName = hostRuntime
							.path( "services" )
							.path( service_port )
							.path( "serviceName" )
							.asText();

						String artifacts = hostRuntime
							.path( "services" )
							.path( service_port )
							.path( "deployedArtifacts" )
							.asText();

						if ( artifacts.contains( "##" ) ) {
							artifacts = artifacts.substring( artifacts.indexOf( "##" ) + 2 );
						}

						if ( !working_serviceToVersionMap.containsKey( serviceName ) ) {
							working_serviceToVersionMap.put( serviceName, new HashSet<String>() );
						}

						HashSet<String> versionList = working_serviceToVersionMap.get( serviceName );

						if ( artifacts
							.trim()
							.length() != 0 ) {
							versionList.add( artifacts.trim() );
						}
					}
				}
			}
		} catch (Exception e) {
			logger.error( "Failed parsing runtime", e );
		}

		serviceToArtifactMap = working_serviceToVersionMap;

		return serviceToArtifactMap;
	}
 
开发者ID:csap-platform,项目名称:csap-core,代码行数:64,代码来源:Application.java


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