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);
@Override public V put(K key, V value) { K normKey = keyNormalizer.transform(key); //if(origToNorm.inverseBidiMap().get(normKey) origToNorm.put(key, normKey); map.put(normKey, value); return value; }
/** * 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; } }
/** * 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; } }
public void loadConfig() { Properties chromConfig = new Properties(); System.out.println("QTLNetMiner configured for taxonomy id: " + taxID); // load chromosomes configuration from file URL configUrl = Thread.currentThread().getContextClassLoader() .getResource("chromosomes.xml"); try { chromConfig.loadFromXML(configUrl.openStream()); } catch (IOException e) { e.printStackTrace(); } // add to bi-directional map for (String key : chromConfig.stringPropertyNames()) { chromBidiMap.put(Integer.valueOf(key), chromConfig.getProperty(key)); } Properties motifConfig = new Properties(); // load motif configuration from file URL motifUrl = Thread.currentThread().getContextClassLoader() .getResource("MotifConfig.xml"); try { motifConfig.loadFromXML(motifUrl.openStream()); } catch (IOException e) { e.printStackTrace(); } // add to cc2config map for (String key : motifConfig.stringPropertyNames()) { cc2motif.put(key, motifConfig.getProperty(key)); } }
private static <T> BidiMap<T,Integer> createBidiMap (Collection<T> col) { final BidiMap<T,Integer> res = new DualHashBidiMap<> (); for (T e : col) res.put(e, res.size()); return res; } private static Link getLink (Node a , Node b)
/** * * @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; }
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); }
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); }
nodesToDnMap.put(tree.getIngressNode(), ingressDn); for (int numHops = 1; numHops <= maxNumberOfHops; numHops++) this.drawnNodes.add(dn); DrawNode.addNodeToGraphics(g2d, dn, dnTopLeftPosition, fontMetrics, regularInterlineSpacePixels, tree.getEgressNodesReached().contains(n) ? Color.CYAN : null); nodesToDnMap.put(n, dn); yPositionTopDn += spaceBetweenVerticalNodes;
@SuppressWarnings("unchecked") protected void createEdge(Attributes atts, TagState state) throws SAXNotSupportedException { Map<String,String> edge_atts = getAttributeMap(atts); String id = edge_atts.remove("id"); E e; if (edge_factory != null) e = edge_factory.create(); else if (id != null) e = (E)id; else throw new IllegalArgumentException("If no edge factory is supplied, " + "edge id may not be null: " + edge_atts); if (id != null) { if (edge_ids.containsKey(e)) throw new SAXNotSupportedException("Edge id \"" + id + "\" is a duplicate of an existing edge ID"); edge_ids.put(e, id); } if (state == TagState.EDGE) assignEdgeSourceTarget(e, atts, edge_atts); //, id); // put remaining attribute/value pairs in edge_data addExtraData(edge_atts, edge_metadata, e); this.current_edge = e; }
@SuppressWarnings("unchecked") protected void createVertex(Attributes atts) throws SAXNotSupportedException { Map<String, String> vertex_atts = getAttributeMap(atts); String id = vertex_atts.remove("id"); if (id == null) throw new SAXNotSupportedException("node attribute list missing " + "'id': " + atts.toString()); V v = vertex_ids.getKey(id); if (v == null) { if (vertex_factory != null) v = vertex_factory.create(); else v = (V)id; vertex_ids.put(v, id); this.current_graph.addVertex(v); // put remaining attribute/value pairs in vertex_data addExtraData(vertex_atts, vertex_metadata, v); } else throw new SAXNotSupportedException("Node id \"" + id + " is a duplicate of an existing node ID"); this.current_vertex = v; }
cache_mapCanvasVisibleLayer2VisualizationOrderRemovingNonVisible.put(layer, cache_mapCanvasVisibleLayer2VisualizationOrderRemovingNonVisible.size());
for (NetworkLayer layer : currentNetPlan.getNetworkLayers()) mapLayer2VisualizationOrder.put(layer, mapLayer2VisualizationOrder.size()); layerVisibilityMap.put(layer, true);
this.mapElementId2ModelIndexWithThatValue.put(visibleElement, rowCount); rowCount ++;
vg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); vg.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); vertexMap.put(v, vg); branch.addChild(vg); String label = renderContext.getVertexStringer().transform(v);