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


Java DualHashBidiMap类代码示例

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


DualHashBidiMap类属于org.apache.commons.collections15.bidimap包,在下文中一共展示了DualHashBidiMap类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: suggestCanvasUpdatedVisualizationLayerInfoForNewDesign

import org.apache.commons.collections15.bidimap.DualHashBidiMap; //导入依赖的package包/类
public Pair<BidiMap<NetworkLayer, Integer>, Map<NetworkLayer, Boolean>> suggestCanvasUpdatedVisualizationLayerInfoForNewDesign(Set<NetworkLayer> newNetworkLayers)
{
    final Map<NetworkLayer, Boolean> oldLayerVisibilityMap = getCanvasLayerVisibilityMap();
    final BidiMap<NetworkLayer, Integer> oldLayerOrderMap = new DualHashBidiMap<>(getCanvasLayerOrderIndexMap(true));
    final Map<NetworkLayer, Boolean> newLayerVisibilityMap = new HashMap<>();
    final BidiMap<NetworkLayer, Integer> newLayerOrderMap = new DualHashBidiMap<>();
    for (int oldVisibilityOrderIndex = 0; oldVisibilityOrderIndex < oldLayerOrderMap.size(); oldVisibilityOrderIndex++)
    {
        final NetworkLayer oldLayer = oldLayerOrderMap.inverseBidiMap().get(oldVisibilityOrderIndex);
        if (newNetworkLayers.contains(oldLayer))
        {
            newLayerOrderMap.put(oldLayer, newLayerVisibilityMap.size());
            newLayerVisibilityMap.put(oldLayer, oldLayerVisibilityMap.get(oldLayer));
        }
    }
    final Set<NetworkLayer> newLayersNotExistingBefore = Sets.difference(newNetworkLayers, oldLayerVisibilityMap.keySet());
    for (NetworkLayer newLayer : newLayersNotExistingBefore)
    {
        newLayerOrderMap.put(newLayer, newLayerVisibilityMap.size());
        newLayerVisibilityMap.put(newLayer, true); // new layers always visible
    }
    return Pair.of(newLayerOrderMap, newLayerVisibilityMap);
}
 
开发者ID:girtel,项目名称:Net2Plan,代码行数:24,代码来源:VisualizationState.java

示例2: convertCasToTrees

import org.apache.commons.collections15.bidimap.DualHashBidiMap; //导入依赖的package包/类
/**
 * 
 * @param jcas a JCas created by an EOP LAP
 * @return A list of roots, each belonging to a BIU dependency parse tree of a sentence in the CAS. Trees are ordered by sentence order.
 * @throws CasTreeConverterException
 * @throws UnsupportedPosTagStringException
 */
public List<BasicNode> convertCasToTrees(JCas jcas) throws CasTreeConverterException, UnsupportedPosTagStringException {
	Collection<Sentence> sentenceAnnotations = JCasUtil.select(jcas, Sentence.class);
	lastSentenceList = new ArrayList<Sentence>(sentenceAnnotations);
	lastTokenToNodeBySentence = new LinkedHashMap<Sentence, OneToManyBidiMultiHashMap<Token,BasicNode>>();
	lastRootList = new ArrayList<BasicNode>(sentenceAnnotations.size());
	lastSentenceToRoot = new DualHashBidiMap<>();
	
	for (Sentence sentenceAnno : lastSentenceList) {
		BasicNode root = convertSentenceToTree(jcas, sentenceAnno);
		lastSentenceToRoot.put(sentenceAnno, root);
		lastRootList.add(root);
		
		OneToManyBidiMultiHashMap<Token,BasicNode> tokenToNodeCopy = new OneToManyBidiMultiHashMap<Token,BasicNode>(tokenToNode);
		lastTokenToNodeBySentence.put(sentenceAnno, tokenToNodeCopy);
	}
	
	return lastRootList;
}
 
开发者ID:hltfbk,项目名称:Excitement-TDMLEDA,代码行数:26,代码来源:CasTreeConverter.java

示例3: initializeData

import org.apache.commons.collections15.bidimap.DualHashBidiMap; //导入依赖的package包/类
/**
 * This is separate from initialize() because these data structures are shared among all
 * graphs loaded (i.e., they're defined inside <code>graphml</code> rather than <code>graph</code>.
 */
protected void initializeData()
{
    this.vertex_ids = new DualHashBidiMap<V, String>();
    this.vertex_desc = new HashMap<V, String>();
    this.vertex_metadata = new HashMap<String, GraphMLMetadata<V>>();

    this.edge_ids = new DualHashBidiMap<E, String>();
    this.edge_desc = new HashMap<E, String>();
    this.edge_metadata = new HashMap<String, GraphMLMetadata<E>>();

    this.graph_desc = new HashMap<G, String>();
    this.graph_metadata = new HashMap<String, GraphMLMetadata<G>>();

    this.hyperedge_vertices = new ArrayList<V>();
}
 
开发者ID:iTransformers,项目名称:netTransformer,代码行数:20,代码来源:MyGraphMLReader.java

示例4: getEnumAliases

import org.apache.commons.collections15.bidimap.DualHashBidiMap; //导入依赖的package包/类
/**
 * Return the enum aliases map.
 *
 * @return the enum aliases map
 */
public BidiMap<String, Class<? extends Enum<?>>> getEnumAliases()
{
	// using the double-checked locking with volatile
	// @see http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html
	if (enumAliases == null)
	{
		synchronized (this)
		{
			if (enumAliases == null)
			{
				enumAliases = initializeEnumAliases();
			}
		}
	}
	// Defensive copy. TODO: move to CollectionUtil as a generic factory method
	return new DualHashBidiMap<>(enumAliases);
}
 
开发者ID:openfurther,项目名称:further-open-core,代码行数:23,代码来源:EnumAliasService.java

示例5: setCanvasLayerVisibility

import org.apache.commons.collections15.bidimap.DualHashBidiMap; //导入依赖的package包/类
public void setCanvasLayerVisibility(final NetworkLayer layer, final boolean isVisible)
{
    if (!this.getNetPlan().getNetworkLayers().contains(layer)) throw new RuntimeException();
    BidiMap<NetworkLayer, Integer> new_layerVisiblityOrderMap = new DualHashBidiMap<>(this.visualizationSnapshot.getMapCanvasLayerVisualizationOrder());
    Map<NetworkLayer, Boolean> new_layerVisibilityMap = new HashMap<>(this.visualizationSnapshot.getMapCanvasLayerVisibility());
    new_layerVisibilityMap.put(layer, isVisible);
    setCanvasLayerVisibilityAndOrder(this.getNetPlan(), new_layerVisiblityOrderMap, new_layerVisibilityMap);
}
 
开发者ID:girtel,项目名称:Net2Plan,代码行数:9,代码来源:VisualizationState.java

示例6: generateCanvasDefaultVisualizationLayerInfo

import org.apache.commons.collections15.bidimap.DualHashBidiMap; //导入依赖的package包/类
public static Pair<BidiMap<NetworkLayer, Integer>, Map<NetworkLayer, Boolean>> generateCanvasDefaultVisualizationLayerInfo(NetPlan np)
{
    final BidiMap<NetworkLayer, Integer> res_1 = new DualHashBidiMap<>();
    final Map<NetworkLayer, Boolean> res_2 = new HashMap<>();

    for (NetworkLayer layer : np.getNetworkLayers())
    {
        res_1.put(layer, res_1.size());
        res_2.put(layer, true);
    }
    return Pair.of(res_1, res_2);
}
 
开发者ID:girtel,项目名称:Net2Plan,代码行数:13,代码来源:VisualizationState.java

示例7: getMap

import org.apache.commons.collections15.bidimap.DualHashBidiMap; //导入依赖的package包/类
public Map getMap() {
    Map testMap = new DualHashBidiMap();
    testMap.put("A", "a");
    testMap.put("B", "b");
    testMap.put("C", "c");
    return testMap;
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:8,代码来源:TestUnmodifiableMapIterator.java

示例8: MyGraphMLReader

import org.apache.commons.collections15.bidimap.DualHashBidiMap; //导入依赖的package包/类
/**
 * Creates a <code>GraphMLReader</code> instance with the specified
 * vertex and edge factories.
 *
 * @param vertex_factory the vertex factory to use to create vertex objects
 * @param edge_factory the edge factory to use to create edge objects
 * @throws ParserConfigurationException
 * @throws SAXException
 */
public MyGraphMLReader(Factory<V> vertex_factory,
                       Factory<E> edge_factory)
    throws ParserConfigurationException, SAXException
{
    current_vertex = null;
    current_edge = null;

    SAXParserFactory factory = SAXParserFactory.newInstance();
    saxp = factory.newSAXParser();

    current_states = new LinkedList<TagState>();

    tag_state = new DualHashBidiMap<String, TagState>();
    tag_state.put("node", TagState.VERTEX);
    tag_state.put("edge", TagState.EDGE);
    tag_state.put("hyperedge", TagState.HYPEREDGE);
    tag_state.put("endpoint", TagState.ENDPOINT);
    tag_state.put("graph", TagState.GRAPH);
    tag_state.put("data", TagState.DATA);
    tag_state.put("key", TagState.KEY);
    tag_state.put("desc", TagState.DESC);
    tag_state.put("default", TagState.DEFAULT_KEY);
    tag_state.put("graphml", TagState.GRAPHML);

    this.key_type = KeyType.NONE;

    this.vertex_factory = vertex_factory;
    this.edge_factory = edge_factory;
}
 
开发者ID:iTransformers,项目名称:netTransformer,代码行数:39,代码来源:MyGraphMLReader.java

示例9: GraphMLReader

import org.apache.commons.collections15.bidimap.DualHashBidiMap; //导入依赖的package包/类
/**
 * Creates a <code>GraphMLReader</code> instance with the specified
 * vertex and edge factories.
 *
 * @param vertex_factory the vertex factory to use to create vertex objects
 * @param edge_factory the edge factory to use to create edge objects
 * @throws ParserConfigurationException
 * @throws SAXException
 */
public GraphMLReader(Factory<V> vertex_factory,
		Factory<E> edge_factory)
    throws ParserConfigurationException, SAXException
{
    current_vertex = null;
    current_edge = null;

    SAXParserFactory factory = SAXParserFactory.newInstance();
    saxp = factory.newSAXParser();

    current_states = new LinkedList<TagState>();

    tag_state = new DualHashBidiMap<String, TagState>();
    tag_state.put("node", TagState.VERTEX);
    tag_state.put("edge", TagState.EDGE);
    tag_state.put("hyperedge", TagState.HYPEREDGE);
    tag_state.put("endpoint", TagState.ENDPOINT);
    tag_state.put("graph", TagState.GRAPH);
    tag_state.put("data", TagState.DATA);
    tag_state.put("key", TagState.KEY);
    tag_state.put("desc", TagState.DESC);
    tag_state.put("default", TagState.DEFAULT_KEY);
    tag_state.put("graphml", TagState.GRAPHML);

    this.key_type = KeyType.NONE;

    this.vertex_factory = vertex_factory;
    this.edge_factory = edge_factory;
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:39,代码来源:GraphMLReader.java

示例10: initializeEnumAliases

import org.apache.commons.collections15.bidimap.DualHashBidiMap; //导入依赖的package包/类
/**
 * Set the static enum alias map field.
 * <p>
 * Warning: do not call this method outside this class. It is meant to be called by
 * Spring when instantiating the singleton instance of this bean.
 */
@SuppressWarnings("unchecked")
private BidiMap<String, Class<? extends Enum<?>>> initializeEnumAliases()
{
	final Class<Alias> annotationClass = Alias.class;
	// TODO: move to CollectionUtil as a generic factory method
	final BidiMap<String, Class<? extends Enum<?>>> map = new DualHashBidiMap<>();
	for (final Class<?> annotatedClass : this.getObject())
	{
		if (annotatedClass.isEnum())
		{
			final String alias = annotatedClass
					.getAnnotation(annotationClass)
					.value();
			final Class<? extends Enum<?>> otherClass = map.get(alias);
			if (otherClass != null)
			{
				// This is the second time that we encountered the alias
				// key, signal name collision
				final String errorMessage = "Enum alias collision!!! Both "
						+ otherClass + ", " + annotatedClass
						+ " have the same alias: " + quote(alias) + ". Rename the @"
						+ annotationClass.getSimpleName()
						+ " annotation value one of them.";
				// Log message before throwing, otherwise Spring will
				// show an incomprehensible TargetInvocationException
				// without its cause here.
				log.error(errorMessage);
				throw new ApplicationException(errorMessage);
			}
			map.put(alias, (Class<? extends Enum<?>>) annotatedClass);
		}
	}
	return map;
}
 
开发者ID:openfurther,项目名称:further-open-core,代码行数:41,代码来源:EnumAliasService.java

示例11: makeEmptyMapIterator

import org.apache.commons.collections15.bidimap.DualHashBidiMap; //导入依赖的package包/类
public MapIterator makeEmptyMapIterator() {
    return UnmodifiableMapIterator.decorate(new DualHashBidiMap().mapIterator());
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:4,代码来源:TestUnmodifiableMapIterator.java

示例12: create

import org.apache.commons.collections15.bidimap.DualHashBidiMap; //导入依赖的package包/类
/**
 * Returns a <code>BidiMap</code> mapping each element of the collection to its
 * index as encountered while iterating over the collection. The purpose
 * of the index operation is to supply an O(1) replacement operation for the
 * O(n) <code>indexOf(element)</code> method of a <code>List</code>
 * @param <T>
 * @param collection
 * @param start start index
 * @return a bidirectional map from collection elements to start-based indices
 */
public static <T> BidiMap<T,Integer> create(Collection<T> collection, int start) {
	BidiMap<T,Integer> map = new DualHashBidiMap<T,Integer>();
	int i=start;
	for(T t : collection) {
		map.put(t,i++);
	}
	return map;
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:19,代码来源:Indexer.java


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