public void calculate() { long start = System.currentTimeMillis(); rowsHeaderTree = null; columnsHeaderTree = null; getRowsHeaderTree(); long t1 = System.currentTimeMillis(); System.out.println("created rowsHeaderTree in " + (t1 - start)); getColumnsHeaderTree(); long t2 = System.currentTimeMillis(); System.out.println("created columnsHeaderTree in " + (t2 - t1)); t1 = System.currentTimeMillis(); List<PivotField> dataFields = getFields(PivotField.Area.DATA); calculatedData = new ArrayList<MultiKeyMap>(); for (PivotField field : dataFields) { field.getAggregator().init(); calculatedData.add(getData(field)); } t2 = System.currentTimeMillis(); System.out.println("filled calculatedData in " + (t2 - t1)); long stop = System.currentTimeMillis(); System.out.println("calculated in " + (stop- start)); System.out.println("calculatedData = " + calculatedData); // getValues(field, filter) }
public Collection<Score> getAllOneCCS() { MultiKeyMap map = new MultiKeyMap(); for (Score onecc : this.oneccs) { Score score = (Score) map.get(onecc.player, onecc.mode, onecc.difficulty); if (score == null) { map.put(onecc.player, onecc.mode, onecc.difficulty, onecc); } else if (score.isWorstThan(onecc)) { map.put(onecc.player, onecc.mode, onecc.difficulty, onecc); } } List<Score> scores = new ArrayList<Score>(map.values()); Collections.sort(scores, new Comparator<Score>() { @Override public int compare(Score o1, Score o2) { return o1.player.name.compareToIgnoreCase(o2.player.name); } }); return scores; }
@Bedrijfsregel(Regel.R1839) private List<MeldingElement> filterGedeblokkeerdeMeldingen(final BijhoudingVerzoekBericht bericht, final List<MeldingElement> meldingen) { final List<MeldingElement> result = new ArrayList<>(); final MultiKeyMap gedeblokkeerdeRegelMap = new MultiKeyMap(); for (final GedeblokkeerdeMeldingElement gedeblokkeerdeMelding : bericht.getAdministratieveHandeling().getGedeblokkeerdeMeldingen()) { gedeblokkeerdeRegelMap.put(gedeblokkeerdeMelding.getReferentie(), gedeblokkeerdeMelding.getRegelCode().getWaarde(), gedeblokkeerdeMelding); } for (final MeldingElement melding : meldingen) { final GedeblokkeerdeMeldingElement gedeblokkeerdeMeldingVoorGroep = (GedeblokkeerdeMeldingElement) gedeblokkeerdeRegelMap.get(melding.getReferentie(), melding.getRegelCode().getWaarde()); final boolean isDeblokeerbareMelding = SoortMelding.DEBLOKKEERBAAR.equals(melding.getRegel().getSoortMelding()); if (isDeblokeerbareMelding && gedeblokkeerdeMeldingVoorGroep != null && melding.getRegelCode().equals(gedeblokkeerdeMeldingVoorGroep.getRegelCode())) { gedeblokkeerdeRegelMap.remove(melding.getReferentie(), melding.getRegelCode().getWaarde()); } else { if (!(isDeblokeerbareMelding && bericht.getAdministratieveHandeling().getSoort().gbaAdministratieveHandeling())) { result.add(melding); } } } for (final Object gedeblokkeerdeMeldingElement : gedeblokkeerdeRegelMap.values()) { // Voor alle gedeblokkeerde meldingen in het bericht die niet zijn opgetreden wordt een fout gerapporteerd result.add(MeldingElement.getInstance(Regel.R1839, (GedeblokkeerdeMeldingElement) gedeblokkeerdeMeldingElement)); } return result; }
public EndpointConfiguration getEndpointConfiguration(EndpointReference endpointReference) { /** * Previously ode used getEndpointProperties method to access endpoint properties. * With new config mechanism, I changed the way that integration layer access endpoint * configuration. But BPEL engine is using old method even now. */ final Map map = eprContext.getConfigLookup(endpointReference); final QName service = (QName) map.get("service"); final String port = (String) map.get("port"); EndpointConfiguration endpointConfig = null; if (bpelPackageConfiguration != null) { MultiKeyMap endpointConfigs = bpelPackageConfiguration.getEndpoints(); if (endpointConfigs.size() > 0) { endpointConfig = (EndpointConfiguration) endpointConfigs.get(service.getLocalPart(), service.getNamespaceURI(), port); if (endpointConfig == null) { endpointConfig = (EndpointConfiguration) endpointConfigs.get( service.getLocalPart(), service.getNamespaceURI(), null); } } } if (endpointConfig == null) { endpointConfig = new EndpointConfiguration(); endpointConfig.setServiceName(service.getLocalPart()); endpointConfig.setServicePort(port); endpointConfig.setServiceNS(service.getNamespaceURI()); UnifiedEndpoint uep = new UnifiedEndpoint(); uep.setUepId(service.getLocalPart()); uep.setAddressingEnabled(true); uep.setAddressingVersion(UnifiedEndpointConstants.ADDRESSING_VERSION_FINAL); bpelPackageConfiguration.addEndpoint(endpointConfig); } return endpointConfig; }
private List<DataSourceListBo> reorderDataSourceListBos(List<DataSourceListBo> dataSourceListBos) { // reorder dataSourceBo using id and timeSlot MultiKeyMap dataSourceListBoMap = new MultiKeyMap(); for (DataSourceListBo dataSourceListBo : dataSourceListBos) { for (DataSourceBo dataSourceBo : dataSourceListBo.getList()) { int id = dataSourceBo.getId(); long timestamp = dataSourceBo.getTimestamp(); long timeSlot = AgentStatUtils.getBaseTimestamp(timestamp); DataSourceListBo mappedDataSourceListBo = (DataSourceListBo) dataSourceListBoMap.get(id, timeSlot); if (mappedDataSourceListBo == null) { mappedDataSourceListBo = new DataSourceListBo(); mappedDataSourceListBo.setAgentId(dataSourceBo.getAgentId()); mappedDataSourceListBo.setStartTimestamp(dataSourceBo.getStartTimestamp()); mappedDataSourceListBo.setTimestamp(dataSourceBo.getTimestamp()); dataSourceListBoMap.put(id, timeSlot, mappedDataSourceListBo); } // set fastest timestamp if (mappedDataSourceListBo.getTimestamp() > dataSourceBo.getTimestamp()) { mappedDataSourceListBo.setTimestamp(dataSourceBo.getTimestamp()); } mappedDataSourceListBo.add(dataSourceBo); } } Collection values = dataSourceListBoMap.values(); return new ArrayList<DataSourceListBo>(values); }
private MultiKeyMap getData(PivotField dataField) { MultiKeyMap data = new MultiKeyMap(); List<List<Object>> rowKeys = getRowKeys(); System.out.println("rowKeys.size() = " + rowKeys.size()); List<List<Object>> columnKeys = getColumnKeys(); System.out.println("columnKeys.size() = " + columnKeys.size()); List<PivotField> rowFields = getFields(PivotField.Area.ROW); List<PivotField> columnFields = getFields(PivotField.Area.COLUMN); for (List<Object> rowKey : rowKeys) { for (List<Object> columnKey : columnKeys) { Map<Integer, Object> rowFilter = getFilter(rowFields, rowKey); Map<Integer, Object> columnFilter = getFilter(columnFields, columnKey); Map<Integer, Object> filter = new HashMap<Integer, Object>(rowFilter); filter.putAll(columnFilter); List<Object> values = getValues(dataField, filter); if (!CollectionUtils.isEmpty(values)) { /* System.out.println("filter = " + filter); System.out.println("values = " + values); System.out.println(values.size()); */ Object summary = PivotUtils.getSummary(dataField, values); // System.out.println("summary = " + summary); data.put(rowKey, columnKey, summary); } } } return data; }
public MultiKeyMap getEndpoints() { return endpointConfigurations; }
public void setEndpoints(MultiKeyMap endpointConfigurations) { this.endpointConfigurations = endpointConfigurations; }