@Inject public PortableFileSystem(KExceptionManager kem, FileUtil fileUtil) { this.fileUtil = fileUtil; this.kem = kem; descriptors.put(0L, FileDescriptor.in); descriptors.put(1L, FileDescriptor.out); descriptors.put(2L, FileDescriptor.err); files.put(FileDescriptor.in, new InputStreamFile(System.in, kem)); files.put(FileDescriptor.out, new OutputStreamFile(System.out, kem)); files.put(FileDescriptor.err, new OutputStreamFile(System.err, kem)); }
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); } } }
@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.BOOKMARKED, "http://id.tincanapi.com/verb/bookmarked"); verbActionMap.put(Action.COMMENTED, "http://adlnet.gov/expapi/verbs/commented"); verbActionMap.put(Action.COMPLETED, "http://adlnet.gov/expapi/verbs/completed"); verbActionMap.put(Action.DISLIKED, "http://activitystrea.ms/schema/1.0/dislike"); verbActionMap.put(Action.GRADED, "http://adlnet.gov/expapi/verbs/scored"); verbActionMap.put(Action.LIKED, "http://activitystrea.ms/schema/1.0/like"); verbActionMap.put(Action.LOGGED_IN, "https://brindlewaye.com/xAPITerms/verbs/loggedin/"); verbActionMap.put(Action.LOGGED_OUT, "https://brindlewaye.com/xAPITerms/verbs/loggedout/"); verbActionMap.put(Action.PAUSED, "http://id.tincanapi.com/verb/paused"); verbActionMap.put(Action.QUESTIONED, "http://adlnet.gov/expapi/verbs/asked"); verbActionMap.put(Action.REPLIED, "http://adlnet.gov/expapi/verbs/responded"); verbActionMap.put(Action.RESUMED, "http://adlnet.gov/expapi/verbs/resumed"); verbActionMap.put(Action.REVIEWED, "http://id.tincanapi.com/verb/reviewed"); verbActionMap.put(Action.SEARCHED, "http://activitystrea.ms/schema/1.0/search"); verbActionMap.put(Action.SHARED, "http://activitystrea.ms/schema/1.0/share"); verbActionMap.put(Action.SKIPPED, "http://id.tincanapi.com/verb/skipped"); verbActionMap.put(Action.STARTED, "http://activitystrea.ms/schema/1.0/start"); verbActionMap.put(Action.SUBMITTED, "http://activitystrea.ms/schema/1.0/submit"); verbActionMap.put(Action.TAGGED, "http://activitystrea.ms/schema/1.0/tag"); verbActionMap.put(Action.VIEWED, "http://id.tincanapi.com/verb/viewed"); objectEntityMap.put(EntityType.ANNOTATION, "http://risc-inc.com/annotator/activities/highlight"); objectEntityMap.put(EntityType.COURSE_SECTION, "http://adlnet.gov/expapi/activities/course"); objectEntityMap.put(EntityType.DIGITAL_RESOURCE, "http://adlnet.gov/expapi/activities/media"); objectEntityMap.put(EntityType.GROUP, "http://activitystrea.ms/schema/1.0/group");
@PostConstruct private void init() { verbActionMap = new DualHashBidiMap<Action, String>(); 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.BOOKMARKED, "http://id.tincanapi.com/verb/bookmarked"); verbActionMap.put(Action.COMMENTED, "http://adlnet.gov/expapi/verbs/commented"); verbActionMap.put(Action.COMPLETED, "http://adlnet.gov/expapi/verbs/completed"); verbActionMap.put(Action.DISLIKED, "http://activitystrea.ms/schema/1.0/dislike"); verbActionMap.put(Action.GRADED, "http://adlnet.gov/expapi/verbs/scored"); verbActionMap.put(Action.LIKED, "http://activitystrea.ms/schema/1.0/like"); verbActionMap.put(Action.LOGGED_IN, "https://brindlewaye.com/xAPITerms/verbs/loggedin/"); verbActionMap.put(Action.LOGGED_OUT, "https://brindlewaye.com/xAPITerms/verbs/loggedout/"); verbActionMap.put(Action.PAUSED, "http://id.tincanapi.com/verb/paused"); verbActionMap.put(Action.QUESTIONED, "http://adlnet.gov/expapi/verbs/asked"); verbActionMap.put(Action.REPLIED, "http://adlnet.gov/expapi/verbs/responded"); verbActionMap.put(Action.RESUMED, "http://adlnet.gov/expapi/verbs/resumed"); verbActionMap.put(Action.REVIEWED, "http://id.tincanapi.com/verb/reviewed"); verbActionMap.put(Action.SEARCHED, "http://activitystrea.ms/schema/1.0/search");
cache.put(internalValue, result);
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)); } } } }
descriptors.put(fd, fileFD); files.put(fileFD, file); return fd;
public synchronized DAG addVertex(Vertex vertex) { if (vertices.containsKey(vertex.getName())) { throw new IllegalStateException( "Vertex " + vertex.getName() + " already defined!"); } vertices.put(vertex.getName(), vertex); return this; }
private void cacheTree(ITracerObject treeNode) { traceTreeCache.put(traceTreeCache.size(), treeNode); if (treeNode instanceof RefToTracerNodeObject) { //no need to add children nodes of reference node to the treeCache //because they will be added from original node return; } Iterable<ITracerObject> children = treeNode.getChildren(); for (ITracerObject child : children) { cacheTree(child); } }
private void cacheTree(ITracerObject treeNode) { traceTreeCache.put(traceTreeCache.size(), treeNode); if (treeNode instanceof RefToTracerNodeObject) { //no need to add children nodes of reference node to the treeCache //because they will be added from original node return; } Iterable<ITracerObject> children = treeNode.getChildren(); for (ITracerObject child : children) { cacheTree(child); } }
/** * Adds a new Tag to the structure. * * @param field */ private synchronized void addTag(TagValue field){ TagValue tmp = this.tagValueMappings.get(field.getTagNumber()); if(tmp == null){ this.tagNameMappings.put(field.getTagNumber(), field.getName()); this.tagValueMappings.put(field.getTagNumber(), field); }else{ //merge tag information tmp.updateTagInformation(field); this.tagNameMappings.put(tmp.getTagNumber(), tmp.getName()); } }
@Override public String undecorate(Object decoratedValue) { String result = cache.getKey(decoratedValue); if (result == null && decoratedValue != null) { if (decoratedValue instanceof Month) { result = "Month" + SEP + ((Month)decoratedValue).getMonthNumber(); } else if (decoratedValue instanceof TimeStep) { result = "TimeStep" + SEP + ((TimeStep)decoratedValue).getStep(); } else if (decoratedValue instanceof TopiaEntity) { result = ((TopiaEntity)decoratedValue).getTopiaId() + SEP + decoratedValue; } else { result = String.valueOf(decoratedValue); } // on retrouve souvent les memes semantiques dans les matrices // pour minimiser les chaines en memoire, on prend la representation // interne avant de l'utiliser comme cle. result = result.intern(); cache.put(result, decoratedValue); } return result; }
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); } }
System.out.println("Processing" + socket + " Bulb " + name + " " + response.getResponseText()); id2device.put(ID, name); String ll = " (" + lampNames.stream().collect(Collectors.joining(" ")) + ")"; System.out.println("Processing Room " + name + ll + " " + response.getResponseText()); id2room.put(json.getInt(INSTANCE_ID), name); System.out.println("Processing Mood " + name + " for Room ID " + path[0] + " " + response.getResponseText()); roomID2moods.get(Integer.parseInt(path[0])).put(ID, name); } else if (json.has(TYPE) && json.getInt(TYPE) == TYPE_REMOTE) { System.out.println("Processing Remote " + name + " " + response.getResponseText()); id2device.put(json.getInt(INSTANCE_ID), name); } else { System.out.println("Got entity '" + name + "' that is neither bulb, group or remote..." + " " + response.getResponseText());
for (int i = 0; config.resource_resolver_virtual() != null && i < config.resource_resolver_virtual().length; i++) { final String[] parts = Mapping.split(config.resource_resolver_virtual()[i]); virtuals.put(parts[0], parts[2]);
int id = ((GetNextIdNetworkResponse) resp).getId(); addressToSocketId.put(source, id);