/** * Creates a new instance of this object. * * @param normalMap the normal direction map * @param reverseMap the reverse direction map * @param inverseBidiMap the inverse BidiMap * @return new bidi map */ @Override protected BidiMap<V, K> createBidiMap(final Map<V, K> normalMap, final Map<K, V> reverseMap, final BidiMap<K, V> inverseBidiMap) { return new DualHashBidiMap<>(normalMap, reverseMap, inverseBidiMap); }
/** * Constructs a <code>HashBidiMap</code> and copies the mappings from * specified <code>Map</code>. * * @param map the map whose mappings are to be placed in this map */ public DualHashBidiMap(final Map<? extends K, ? extends V> map) { super(new HashMap<K, V>(), new HashMap<V, K>()); putAll(map); }
@Nullable public static PrimitiveType getPrimitiveType(ObjectType classType){ return primitive2class.getKey(classType.getName()); }
@Nullable public static ObjectType getClassType(PrimitiveType primitiveType){ return requireClassType(primitive2class.get(primitiveType)); }
private void cacheColumnNames() throws SQLException { cachedColumnNames = new DualHashBidiMap<>(); try(Resource res = resultSetHolder.getResource()) { ResultSetMetaData meta = res.getResultSet().getMetaData(); for (int idColumn = 1; idColumn <= meta.getColumnCount(); idColumn++) { cachedColumnNames.put(meta.getColumnName(idColumn), idColumn); } } }
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); normalMap = new HashMap<>(); reverseMap = new HashMap<>(); @SuppressWarnings("unchecked") // will fail at runtime if stream is incorrect final Map<K, V> map = (Map<K, V>) in.readObject(); putAll(map); }
return o1.getName().compareTo(o2.getName()); }); componentNames = new DualHashBidiMap<>(); componentNamesShort = new DualHashBidiMap<>(); for (String componentClassName : componentClassNames) { try {
protected void cacheColumnNames() throws SQLException { cachedColumnNames = new DualHashBidiMap<>(); cachedGeomColumnNames = new DualHashBidiMap<>(); try(Resource res = resultSetHolder.getResource()) { ResultSetMetaData meta = res.getResultSet().getMetaData(); for (int idColumn = 1; idColumn <= meta.getColumnCount(); idColumn++) { cachedColumnNames.put(meta.getColumnName(idColumn), idColumn); } if(excludeGeomFields) { List<String> geomFields = SFSUtilities.getGeometryFields(getConnection(), location); for (String geomField : geomFields) { cachedGeomColumnNames.put(geomField, cachedColumnNames.get(geomField)); } } } }
public void setPdftxt(String aPdftxt) { stringPositionMap = new DualHashBidiMap<>(); extractLines = new HashMap<>(); pdftxt = aPdftxt; StringBuilder sb = new StringBuilder(); String[] lines = pdftxt.split("\n"); int extractLineIndex = 1; int strContentIndex = 0; for (String line : lines) { PdfExtractLine extractLine = new PdfExtractLine(); String[] columns = line.split("\t"); extractLine.setPage(Integer.parseInt(columns[0].trim())); extractLine.setPosition(extractLineIndex); extractLine.setValue(columns[1].trim()); extractLine.setDisplayPositions(columns.length > 2 ? columns[2].trim() : ""); extractLines.put(extractLineIndex, extractLine); // if value of PdfExtractLine is in brackets it is a draw operation and is ignored if (!extractLine.getValue().matches("^\\[.*\\]$") && !extractLine.getValue().equals("NO_UNICODE")) { sb.append(extractLine.getValue()); stringPositionMap.put(strContentIndex, extractLineIndex); strContentIndex++; } extractLineIndex++; } stringContent = sb.toString(); }
private void cachePrimaryKey(ProgressMonitor pm) throws SQLException { ProgressMonitor cachePm = pm.startTask(getRowCount()); if(rowPk == null) { rowPk = new DualHashBidiMap<>(); } else { rowPk.clear(); } try(Connection connection = dataSource.getConnection(); Statement st = connection.createStatement()) { PropertyChangeListener listener = EventHandler.create(PropertyChangeListener.class, st, "cancel"); pm.addPropertyChangeListener(ProgressMonitor.PROP_CANCEL, listener); st.setFetchSize(fetchSize); connection.setAutoCommit(false); // Use postgre cursor try(ResultSet rs = st.executeQuery("SELECT "+pk_name+" FROM "+location+" "+ orderBy)) { // Cache the primary key values int pkRowId = 0; while (rs.next()) { pkRowId++; rowPk.put(pkRowId, rs.getLong(1)); cachePm.endTask(); } } finally { pm.removePropertyChangeListener(listener); } } catch (SQLException ex) { throw new IllegalArgumentException(ex); } }
@PostConstruct private void init() { verbActionMap = new DualHashBidiMap<>(); verbActionMap.put(Action.ABANDONED, "https://w3id.org/xapi/adl/verbs/abandoned"); verbActionMap.put(Action.ATTACHED, "http://activitystrea.ms/schema/1.0/attach"); verbActionMap.put(Action.VIEWED, "http://id.tincanapi.com/verb/viewed"); objectEntityMap = new DualHashBidiMap<>();
@PostConstruct private void init() { verbActionMap = new DualHashBidiMap<Action, String>(); verbActionMap.put(Action.ABANDONED, "https://w3id.org/xapi/adl/verbs/abandoned"); objectEntityMap = new DualHashBidiMap<Type, String>();
int roomID = moodRooms.getInt(roomIdx); roomID2moods.put(roomID, new DualHashBidiMap<Integer, String>());
BidiMap<String, String> methodNameVsPropName = new DualHashBidiMap<>(); BidiMap<String, String> methodNameVsEdgeLabel = new DualHashBidiMap<>();
Bus selfBus = new BasicBus(queue); BidiMap<InetAddress, Integer> addressToSocketId = new DualHashBidiMap<>(); // source address to socket id MultiValuedMap<Integer, UdpRequest> socketIdToRequests = new ArrayListValuedHashMap<>(); // source address to requests
private TagsStruct() this.tagNameMappings = new DualHashBidiMap<>(); this.tagValueMappings = new HashMap<>(); this.nDICOMFields = new HashSet<>();