List of usage examples for java.util LinkedHashMap put
V put(K key, V value);
From source file:au.org.ala.delta.intkey.directives.invocation.ContentsDirectiveInvocation.java
@Override public boolean execute(IntkeyContext context) { try {// w w w. j av a 2 s . c o m BufferedReader reader = new BufferedReader(new FileReader(file)); // use LinkedHashMap to maintain insertion order of keys LinkedHashMap<String, String> contentsMap = new LinkedHashMap<String, String>(); String line; while ((line = reader.readLine()) != null) { if (line.contains("*")) { String[] tokens = line.split("\\*"); if (tokens.length != 2) { context.getUI() .displayErrorMessage(UIUtils.getResourceString("BadlyFormedContentsFile.error")); return false; } contentsMap.put(tokens[0].trim(), tokens[1].trim()); } else { String[] tokens = line.split(" "); if (tokens.length > 1) { String description = StringUtils.join(Arrays.copyOf(tokens, tokens.length - 1), " "); String fileName = tokens[tokens.length - 1]; // TODO hack here. Really should be building // IntkeyDirectiveInvocation objects // from both line formats and passing them to the // contents directive, rather than // getting the contents directive to do directive // parsing. String command = "FILE DISPLAY " + fileName.trim(); contentsMap.put(description.trim(), command); } else { } } } context.getUI().displayContents(contentsMap); } catch (IOException ex) { } return true; }
From source file:com.sillelien.dollar.api.types.DollarMap.java
@NotNull @Override/*from w w w . ja va 2 s .c o m*/ public ImmutableMap<var, var> toVarMap() { LinkedHashMap<var, var> result = new LinkedHashMap<>(); for (Map.Entry<var, var> entry : map.entrySet()) { result.put(entry.getKey(), entry.getValue()._fix(false)); } return copyOf(result); }
From source file:org.ff4j.store.FeatureStoreSpringJdbc.java
/** {@inheritDoc} */ public Map<String, Feature> readAll() { LinkedHashMap<String, Feature> mapFP = new LinkedHashMap<String, Feature>(); List<Feature> lFp = getJdbcTemplate().query(getQueryBuilder().getAllFeatures(), FMAPPER); for (Feature flipPoint : lFp) { mapFP.put(flipPoint.getUid(), flipPoint); }//from www . j a v a 2s . co m // Populating Roles RoleRowMapper rrm = new RoleRowMapper(); getJdbcTemplate().query(getQueryBuilder().getAllRoles(), rrm); Map<String, Set<String>> roles = rrm.getRoles(); for (Map.Entry<String, Set<String>> featId : roles.entrySet()) { if (mapFP.containsKey(featId.getKey())) { mapFP.get(featId.getKey()).getPermissions().addAll(featId.getValue()); } } return mapFP; }
From source file:de.ingrid.importer.udk.strategy.v1.IDCStrategy1_0_4.java
protected void updateSysGui() throws Exception { if (log.isInfoEnabled()) { log.info("Updating sys_gui..."); }/*from www. j a va2s . c o m*/ if (log.isInfoEnabled()) { log.info("Updating sys_gui entries (including Clean Up !)..."); } // clean up, to guarantee no old values ! sqlStr = "DELETE FROM sys_gui"; jdbc.executeUpdate(sqlStr); LinkedHashMap<String, Integer> initialSysGuis = new LinkedHashMap<String, Integer>(); Integer initialBehaviour = -1; Integer mandatory = 1; initialSysGuis.put("1130", initialBehaviour); initialSysGuis.put("1140", initialBehaviour); initialSysGuis.put("1220", initialBehaviour); initialSysGuis.put("1230", initialBehaviour); initialSysGuis.put("1240", initialBehaviour); initialSysGuis.put("1250", initialBehaviour); initialSysGuis.put("1310", initialBehaviour); initialSysGuis.put("1320", initialBehaviour); initialSysGuis.put("1350", initialBehaviour); initialSysGuis.put("1409", mandatory); initialSysGuis.put("1410", mandatory); initialSysGuis.put("3100", initialBehaviour); initialSysGuis.put("3110", initialBehaviour); initialSysGuis.put("3120", initialBehaviour); initialSysGuis.put("3200", initialBehaviour); initialSysGuis.put("3210", initialBehaviour); initialSysGuis.put("3230", initialBehaviour); initialSysGuis.put("3240", initialBehaviour); initialSysGuis.put("3250", initialBehaviour); initialSysGuis.put("3300", initialBehaviour); initialSysGuis.put("3310", initialBehaviour); initialSysGuis.put("3320", initialBehaviour); initialSysGuis.put("3330", initialBehaviour); initialSysGuis.put("3340", initialBehaviour); initialSysGuis.put("3345", initialBehaviour); initialSysGuis.put("3350", initialBehaviour); initialSysGuis.put("3355", initialBehaviour); initialSysGuis.put("3360", initialBehaviour); initialSysGuis.put("3365", initialBehaviour); initialSysGuis.put("3370", initialBehaviour); initialSysGuis.put("3375", initialBehaviour); initialSysGuis.put("3380", initialBehaviour); initialSysGuis.put("3385", initialBehaviour); initialSysGuis.put("3400", initialBehaviour); initialSysGuis.put("3410", initialBehaviour); initialSysGuis.put("3420", initialBehaviour); initialSysGuis.put("3500", initialBehaviour); initialSysGuis.put("3515", initialBehaviour); initialSysGuis.put("3520", initialBehaviour); initialSysGuis.put("3530", initialBehaviour); initialSysGuis.put("3535", initialBehaviour); initialSysGuis.put("3555", initialBehaviour); initialSysGuis.put("3565", initialBehaviour); initialSysGuis.put("3570", initialBehaviour); initialSysGuis.put("4400", initialBehaviour); initialSysGuis.put("4405", initialBehaviour); initialSysGuis.put("4410", initialBehaviour); initialSysGuis.put("4415", initialBehaviour); initialSysGuis.put("4420", initialBehaviour); initialSysGuis.put("4425", initialBehaviour); initialSysGuis.put("4435", initialBehaviour); initialSysGuis.put("4440", initialBehaviour); initialSysGuis.put("4510", mandatory); initialSysGuis.put("5000", initialBehaviour); initialSysGuis.put("5020", initialBehaviour); initialSysGuis.put("5021", initialBehaviour); initialSysGuis.put("5022", initialBehaviour); initialSysGuis.put("5040", initialBehaviour); initialSysGuis.put("5052", initialBehaviour); initialSysGuis.put("5062", initialBehaviour); initialSysGuis.put("5063", initialBehaviour); initialSysGuis.put("5069", initialBehaviour); initialSysGuis.put("5070", initialBehaviour); initialSysGuis.put("N001", initialBehaviour); initialSysGuis.put("N002", initialBehaviour); initialSysGuis.put("N003", initialBehaviour); initialSysGuis.put("N004", initialBehaviour); initialSysGuis.put("N005", initialBehaviour); initialSysGuis.put("N007", initialBehaviour); initialSysGuis.put("N009", initialBehaviour); initialSysGuis.put("N010", initialBehaviour); initialSysGuis.put("N011", initialBehaviour); initialSysGuis.put("N012", initialBehaviour); initialSysGuis.put("N013", initialBehaviour); initialSysGuis.put("N014", initialBehaviour); initialSysGuis.put("N015", initialBehaviour); initialSysGuis.put("N016", initialBehaviour); initialSysGuis.put("N017", initialBehaviour); initialSysGuis.put("N018", initialBehaviour); initialSysGuis.put("N019", mandatory); initialSysGuis.put("N020", initialBehaviour); initialSysGuis.put("N023", initialBehaviour); Iterator<String> itr = initialSysGuis.keySet().iterator(); while (itr.hasNext()) { String key = itr.next(); jdbc.executeUpdate("INSERT INTO sys_gui (id, gui_id, behaviour) VALUES (" + getNextId() + ", '" + key + "', " + initialSysGuis.get(key) + ")"); } if (log.isInfoEnabled()) { log.info("Updating sys_gui... done"); } }
From source file:com.sillelien.dollar.api.types.DollarMap.java
@NotNull private LinkedHashMap<var, var> mapToVarMap(@NotNull Map<?, ?> stringObjectMap) { LinkedHashMap<var, var> result = new LinkedHashMap<>(); for (Map.Entry<?, ?> entry : stringObjectMap.entrySet()) { result.put(DollarFactory.fromValue(entry.getKey()), DollarFactory.fromValue(entry.getValue())); }/*from w w w. j ava 2 s.com*/ return result; }
From source file:org.n52.sensorweb.series.policy.editor.ctrl.SimplePermissionEditorController.java
/** * @return The new Create Permission set view *//* ww w . ja v a 2s .com*/ @RequestMapping(value = "/new", method = RequestMethod.GET) public ModelAndView createPermissionSet(HttpServletRequest request) { ModelAndView mav = new ModelAndView("createPermissionSet"); mav.addObject("pageTitle", "Create Permission Set"); mav.addObject("heading", "Create Permission Set"); LinkedHashMap<String, String> breadCrumb = new LinkedHashMap<String, String>(); /* the ordering of elements maintains a rendering order for bread crumb */ breadCrumb.put("Manager", request.getContextPath() + "/editor/"); breadCrumb.put("Permission Set", request.getContextPath() + "/editor/new"); mav.addObject("breadCrumb", breadCrumb); mav.addObject("preConfiguredEnforcementPoints", enforcementPointService.getEpServices()); return mav; }
From source file:com.sillelien.dollar.api.types.DollarMap.java
@NotNull @Override/*from w w w. ja va 2 s. c o m*/ public var _fix(int depth, boolean parallel) { if (depth <= 1) { return this; } else { LinkedHashMap<var, var> result = new LinkedHashMap<>(); for (Map.Entry<var, var> entry : map.entrySet()) { result.put(entry.getKey(), entry.getValue()._fix(depth - 1, parallel)); } return new DollarMap(errors(), result); } }
From source file:org.ff4j.store.FeatureStoreSpringJdbc.java
/** {@inheritDoc} */ public Map<String, Feature> readGroup(String groupName) { if (groupName == null || groupName.isEmpty()) { throw new IllegalArgumentException(GROUPNAME_CANNOT_BE_NULL_NOR_EMPTY); }//from w ww. j a v a 2 s .co m if (!existGroup(groupName)) { throw new GroupNotFoundException(groupName); } LinkedHashMap<String, Feature> mapFP = new LinkedHashMap<String, Feature>(); List<Feature> lFp = getJdbcTemplate().query(getQueryBuilder().getFeatureOfGroup(), FMAPPER, groupName); for (Feature flipPoint : lFp) { mapFP.put(flipPoint.getUid(), flipPoint); } return mapFP; }
From source file:com.itemanalysis.psychometrics.irt.equating.MeanSigmaMethodTest.java
@Test public void mixedFormatMeanSigmaTestPARSCALE() { System.out.println("Mixed format mean/sigma test: Parscale parameters"); LinkedHashMap<String, ItemResponseModel> itemFormX = new LinkedHashMap<String, ItemResponseModel>(); LinkedHashMap<String, ItemResponseModel> itemFormY = new LinkedHashMap<String, ItemResponseModel>(); itemFormX.put("Item1", new Irm3PL(0.751335, -0.897391, 0.244001, 1.7)); itemFormX.put("Item2", new Irm3PL(0.955947, -0.811477, 0.242883, 1.7)); itemFormX.put("Item3", new Irm3PL(0.497206, -0.858681, 0.260893, 1.7)); itemFormX.put("Item4", new Irm3PL(0.724000, -0.123911, 0.243497, 1.7)); itemFormX.put("Item5", new Irm3PL(0.865200, 0.205889, 0.319135, 1.7)); itemFormX.put("Item6", new Irm3PL(0.658129, 0.555228, 0.277826, 1.7)); itemFormX.put("Item7", new Irm3PL(1.082118, 0.950549, 0.157979, 1.7)); itemFormX.put("Item8", new Irm3PL(0.988294, 1.377501, 0.084828, 1.7)); itemFormX.put("Item9", new Irm3PL(1.248923, 1.614355, 0.181874, 1.7)); itemFormX.put("Item10", new Irm3PL(1.116682, 2.353932, 0.246856, 1.7)); itemFormX.put("Item11", new Irm3PL(0.438171, 3.217965, 0.309243, 1.7)); itemFormX.put("Item12", new Irm3PL(1.082206, 4.441864, 0.192339, 1.7)); double[] step1 = { 1.097268, -1.097268 }; itemFormX.put("Item13", new IrmGPCM2(0.269994, 0.003998, step1, 1.7)); double[] step2 = { 0.106514, -0.106514 }; itemFormX.put("Item14", new IrmGPCM2(0.972506, 1.632662, step2, 1.7)); double[] step3 = { 2.102301, -2.102301 }; itemFormX.put("Item15", new IrmGPCM2(0.378812, 3.464657, step3, 1.7)); double[] step4 = { -0.476513, 1.081282, -0.604770 }; itemFormX.put("Item16", new IrmGPCM2(0.537706, 1.010053, step4, 1.7)); double[] step5 = { 1.00752, -0.197767, -0.809758 }; itemFormX.put("Item17", new IrmGPCM2(0.554506, 2.432938, step5, 1.7)); itemFormY.put("Item1", new Irm3PL(0.887276, -1.334798, 0.134406, 1.7)); itemFormY.put("Item2", new Irm3PL(1.184412, -1.129004, 0.237765, 1.7)); itemFormY.put("Item3", new Irm3PL(0.609412, -1.464546, 0.15139, 1.7)); itemFormY.put("Item4", new Irm3PL(0.923812, -0.576435, 0.240097, 1.7)); itemFormY.put("Item5", new Irm3PL(0.822776, -0.476357, 0.192369, 1.7)); itemFormY.put("Item6", new Irm3PL(0.707818, -0.235189, 0.189557, 1.7)); itemFormY.put("Item7", new Irm3PL(1.306976, 0.242986, 0.165553, 1.7)); itemFormY.put("Item8", new Irm3PL(1.295471, 0.598029, 0.090557, 1.7)); itemFormY.put("Item9", new Irm3PL(1.366841, 0.923206, 0.172993, 1.7)); itemFormY.put("Item10", new Irm3PL(1.389624, 1.380666, 0.238008, 1.7)); itemFormY.put("Item11", new Irm3PL(0.293806, 2.02807, 0.203448, 1.7)); itemFormY.put("Item12", new Irm3PL(0.885347, 3.152928, 0.195473, 1.7)); double[] step1y = { 0.893232, -0.893232 }; itemFormY.put("Item13", new IrmGPCM2(0.346324, -0.494115, step1y, 1.7)); double[] step2y = { 0.099750, -0.099750 }; itemFormY.put("Item14", new IrmGPCM2(1.252012, 0.856264, step2y, 1.7)); double[] step3y = { 1.850498, -1.850498 }; itemFormY.put("Item15", new IrmGPCM2(0.392282, 2.825801, step3y, 1.7)); double[] step4y = { -0.300428, 0.761846, -0.461417 }; itemFormY.put("Item16", new IrmGPCM2(0.660841, 0.342977, step4y, 1.7)); double[] step5y = { 1.001974, -0.107221, -0.894753 }; itemFormY.put("Item17", new IrmGPCM2(0.669612, 1.643267, step5y, 1.7)); MeanSigmaMethod meanSigmaMethod = new MeanSigmaMethod(itemFormX, itemFormY, true); meanSigmaMethod.setPrecision(6);/*from ww w .java2 s . com*/ double B = meanSigmaMethod.getIntercept(); double A = meanSigmaMethod.getScale(); // System.out.println("Slope: " + A); // System.out.println("Intercept: " + B); assertEquals("Mean/sigma slope test", 0.887294, A, 1e-6); assertEquals("Mean/sigma intercept test", -0.560159, B, 1e-6); }
From source file:org.cateproject.features.FeatureStoreSpringJDBC.java
/** {@inheritDoc} */ @Override//from w w w . j av a 2 s . c om public Map<String, Feature> readAll() { LinkedHashMap<String, Feature> mapFP = new LinkedHashMap<String, Feature>(); List<Feature> lFp = getJdbcTemplate().query(SQLQUERY_ALLFEATURES, MAPPER); for (Feature flipPoint : lFp) { mapFP.put(flipPoint.getUid(), flipPoint); } // Populating Roles RoleRowMapper rrm = new RoleRowMapper(); getJdbcTemplate().query(SQL_GET_ALLROLES, rrm); Map<String, Set<String>> roles = rrm.getRoles(); for (String featId : roles.keySet()) { if (mapFP.containsKey(featId)) { mapFP.get(featId).getPermissions().addAll(roles.get(featId)); } } return mapFP; }