List of usage examples for java.util LinkedHashSet add
boolean add(E e);
From source file:edu.ksu.cs.a4vm.bse.MeasurementsTable.java
@Override public void onResume() { super.onResume(); //load data//w w w . j a va 2 s. com Util.setFields( SharedPrefUtil.getValue(getApplicationContext(), Constant.PREFS_BULL_MEASUREMENT_INFO, bullKey), fields); Util.setCheckBoxes( SharedPrefUtil.getValue(getApplicationContext(), Constant.PREFS_BULL_MEASUREMENT_INFO, bullKey), checks); /*check9.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if(isChecked) { Util.setAllCheckBoxes(checks, true); } else { Util.setAllCheckBoxes(checks, false); } } });*/ saveBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (valid1 && valid2 && valid3 && valid4 && valid5 && valid6 && valid8) { LinkedHashSet<String> data = new LinkedHashSet<String>(); String text = field1.getText().toString().trim(); if (text.length() > 0 && text.contains(".")) { String[] txtparts = text.split("\\."); if (txtparts != null && txtparts[1].length() > 1) { text = text.substring(0, text.indexOf(".") + 2); } } data.add(field1.getHint().toString().trim() + "=" + text.replace(",", ";")); data.add(field2.getHint().toString().trim() + "=" + field2.getText().toString().trim().replace(",", ";")); data.add(field3.getHint().toString().trim() + "=" + field3.getText().toString().trim().replace(",", ";")); data.add(field4.getHint().toString().trim() + "=" + field4.getText().toString().trim().replace(",", ";")); data.add(field5.getHint().toString().trim() + "=" + field5.getText().toString().trim().replace(",", ";")); data.add(field6.getHint().toString().trim() + "=" + field6.getText().toString().trim().replace(",", ";")); data.add(field7.getHint().toString().trim() + "=" + field7.getText().toString().trim().replace(",", ";")); data.add(field8.getHint().toString().trim() + "=" + field8.getText().toString().trim().replace(",", ";")); /*if (check1.isChecked()) data.add(Integer.toString(check1.getId()).trim() + "=" + field1.getHint().toString().trim()); if (check2.isChecked()) data.add(Integer.toString(check2.getId()).trim() + "=" + field2.getHint().toString().trim()); if (check3.isChecked()) data.add(Integer.toString(check3.getId()).trim() + "=" + field3.getHint().toString().trim()); if (check4.isChecked()) data.add(Integer.toString(check4.getId()).trim() + "=" + field4.getHint().toString().trim()); if (check5.isChecked()) data.add(Integer.toString(check5.getId()).trim() + "=" + field5.getHint().toString().trim()); if (check6.isChecked()) data.add(Integer.toString(check6.getId()).trim() + "=" + field6.getHint().toString().trim()); if (check7.isChecked()) data.add(Integer.toString(check7.getId()).trim() + "=" + field7.getHint().toString().trim()); if (check8.isChecked()) data.add(Integer.toString(check8.getId()).trim() + "=" + field8.getHint().toString().trim()); if (check9.isChecked()) data.add(Integer.toString(check9.getId()).trim() + "=" + "true");*/ //save to file SharedPrefUtil.saveGroup(getApplicationContext(), Constant.PREFS_BULL_MEASUREMENT_INFO, bullKey, data); Intent goPrev = new Intent(getApplicationContext(), PhysicalParameter.class); goPrev.putExtra("bullKey", bullKey); startActivity(goPrev); //display /*Util.setFields(SharedPrefUtil.getValue(getApplicationContext(), Constant.PREFS_BULL_MEASUREMENT_INFO, bullKey), fields); Util.setCheckBoxes(SharedPrefUtil.getValue(getApplicationContext(), Constant.PREFS_BULL_MEASUREMENT_INFO, bullKey), checks);*/ Toast.makeText(getApplicationContext(), "Saved!", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getApplicationContext(), "Correct the fields highlighted red", Toast.LENGTH_SHORT).show(); } } }); field1.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { String text = field1.getText().toString().trim(); try { if (text.length() == 0 || (Float.valueOf(text) >= 0.0 && Float.valueOf(text) < 61.0)) { field1.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.focus_color)); valid1 = true; } else { field1.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.highlight)); valid1 = false; Toast.makeText(getApplicationContext(), "Value must be between 0-60", Toast.LENGTH_SHORT).show(); } /*if(valid1) { if(text.length() > 0 && text.contains(".")) { String[] txtparts = text.split("\\."); if(txtparts!=null && txtparts[1].length()>1) { field1.setBackground(ContextCompat.getDrawable(getApplicationContext(), R.drawable.highlight)); valid1 = false; Toast.makeText(getApplicationContext(), "Precision more than 1 decimal place not allowed", Toast.LENGTH_SHORT).show(); } } }*/ } catch (NumberFormatException ne) { field1.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.highlight)); valid1 = false; Toast.makeText(getApplicationContext(), "Number expected", Toast.LENGTH_SHORT).show(); } catch (Exception e) { e.printStackTrace(); Toast.makeText(getApplicationContext(), e.toString() + " Unexpected error due to invalid entry", Toast.LENGTH_SHORT).show(); } } } }); field2.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { String text = field2.getText().toString().trim(); try { if (text.length() == 0 || (Float.valueOf(text) >= 0.0 && Float.valueOf(text) < 10.0)) { field2.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.focus_color)); valid2 = true; } else { field2.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.highlight)); valid2 = false; Toast.makeText(getApplicationContext(), "Value must be between 0-9", Toast.LENGTH_SHORT) .show(); } } catch (NumberFormatException ne) { field2.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.highlight)); valid2 = false; Toast.makeText(getApplicationContext(), "Invalid entry", Toast.LENGTH_SHORT).show(); } } } }); field3.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { String text = field3.getText().toString().trim(); try { if (text.length() == 0 || (Float.valueOf(text) >= 8.0 && Float.valueOf(text) < 31.0)) { field3.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.focus_color)); valid3 = true; } else { field3.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.highlight)); valid3 = false; Toast.makeText(getApplicationContext(), "Value must be between 8-30", Toast.LENGTH_SHORT).show(); } } catch (NumberFormatException ne) { field3.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.highlight)); valid3 = false; Toast.makeText(getApplicationContext(), "Invalid entry", Toast.LENGTH_SHORT).show(); } } } }); field4.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { String text = field4.getText().toString().trim(); try { if (text.length() == 0 || (Float.valueOf(text) >= 8.0 && Float.valueOf(text) < 31.0)) { field4.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.focus_color)); valid4 = true; } else { field4.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.highlight)); valid4 = false; Toast.makeText(getApplicationContext(), "Value must be between 8-30", Toast.LENGTH_SHORT).show(); } } catch (NumberFormatException ne) { field4.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.highlight)); valid4 = false; Toast.makeText(getApplicationContext(), "Invalid entry", Toast.LENGTH_SHORT).show(); } } } }); field5.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { String text = field5.getText().toString().trim(); try { if (text.length() == 0 || (Float.valueOf(text) > 0.0 && Float.valueOf(text) < 21.0)) { field5.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.focus_color)); valid5 = true; } else { field5.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.highlight)); valid5 = false; Toast.makeText(getApplicationContext(), "Value must be between 1-20", Toast.LENGTH_SHORT).show(); } } catch (NumberFormatException ne) { field5.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.highlight)); valid5 = false; Toast.makeText(getApplicationContext(), "Invalid entry", Toast.LENGTH_SHORT).show(); } } } }); field6.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { String text = field6.getText().toString().trim(); try { if (text.length() == 0 || Float.valueOf(text) >= 0.0) { field6.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.focus_color)); valid6 = true; } else { field6.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.highlight)); valid6 = false; Toast.makeText(getApplicationContext(), "Value must positive", Toast.LENGTH_SHORT) .show(); } } catch (NumberFormatException ne) { field6.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.highlight)); valid6 = false; Toast.makeText(getApplicationContext(), "Invalid entry", Toast.LENGTH_SHORT).show(); } } } }); field8.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { String text = field8.getText().toString().trim(); try { if (text.length() == 0 || text.equalsIgnoreCase("cm") || text.equalsIgnoreCase("inches")) { valid8 = true; field8.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.focus_color)); } else { field8.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.highlight)); valid8 = false; Toast.makeText(getApplicationContext(), "cm or inches allowed", Toast.LENGTH_SHORT) .show(); } } catch (Exception e) { field8.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.highlight)); valid8 = false; Toast.makeText(getApplicationContext(), "Invalid entry", Toast.LENGTH_SHORT).show(); } } } }); }
From source file:net.sf.maltcms.chromaui.project.spi.nodes.DescriptorNode.java
@Override public Action[] getActions(boolean context) { List<?> interfaces = ClassUtils.getAllInterfaces(getBean().getClass()); List<?> superClasses = ClassUtils.getAllSuperclasses(getBean().getClass()); LinkedHashSet<Action> descriptorActions = new LinkedHashSet<>(); for (Object o : interfaces) { Class<?> c = (Class) o; descriptorActions.addAll(Utilities.actionsForPath("Actions/DescriptorNodeActions/" + c.getName())); descriptorActions//w w w. j ava 2 s .c om .addAll(Utilities.actionsForPath("Actions/DescriptorNodeActions/" + c.getSimpleName())); } for (Object o : superClasses) { Class<?> c = (Class) o; descriptorActions.addAll(Utilities.actionsForPath("Actions/DescriptorNodeActions/" + c.getName())); descriptorActions .addAll(Utilities.actionsForPath("Actions/DescriptorNodeActions/" + c.getSimpleName())); } descriptorActions.addAll( Utilities.actionsForPath("Actions/DescriptorNodeActions/" + getBean().getClass().getName())); descriptorActions.addAll( Utilities.actionsForPath("Actions/DescriptorNodeActions/" + getBean().getClass().getSimpleName())); descriptorActions.add(null); descriptorActions.addAll(Utilities.actionsForPath("Actions/DescriptorNodeActions/DefaultActions")); descriptorActions.add(SystemAction.get(PropertiesAction.class)); return descriptorActions.toArray(new Action[descriptorActions.size()]); }
From source file:ArrayUtils.java
/** * Merges all elements of a set of arrays into a single array with no * duplicates./* w w w.ja va 2 s . c o m*/ * * @param <T1> * The type of the result * @param <T2> * The type of the input arrays * @param type * The type of the result * @param arrays * The arrays to merge * @return A new array containing all elements of <code>array1</code> and * all elements of <code>array2</code> that are not present in * <code>array1</code> * @throws NullPointerException * If either array is null */ public static <T1, T2 extends T1> T1[] mergeInclusive(Class<T1> type, T2[]... arrays) { java.util.LinkedHashSet<T1> set = new java.util.LinkedHashSet<T1>(); int i, j; for (i = 0; i < arrays.length; i++) { for (j = 0; j < arrays[i].length; j++) set.add(arrays[i][j]); } return set.toArray((T1[]) Array.newInstance(type, set.size())); }
From source file:pt.webdetails.cda.utils.mondrian.CompactBandedMDXTableModel.java
public CompactBandedMDXTableModel(final Result resultSet, final int rowLimit) { if (resultSet == null) { throw new NullPointerException("ResultSet returned was null"); }//from w w w . j a v a 2 s .co m this.resultSet = resultSet; // rowcount is the product of all axis-sizes. If an axis contains more than one member, then // Mondrian already performs the crossjoin for us. // column count is the count of all hierachies of all axis. final Axis[] axes = this.resultSet.getAxes(); this.rowCount = 0; this.axesSize = new int[axes.length]; final int[] axesMembers = new int[axes.length]; @SuppressWarnings("unchecked") final List<Dimension>[] dimensionsForMembersPerAxis = new List[axes.length]; @SuppressWarnings("unchecked") final List<Integer>[] membersPerAxis = new List[axes.length]; // process the column axis first .. if (axesSize.length > 0) { final Axis axis = axes[0]; final List<Position> positions = axis.getPositions(); axesSize[0] = positions.size(); if (positions.isEmpty()) { noMeasures = true; } } // Axis contains (zero or more) positions, which contains (zero or more) members for (int axesIndex = axes.length - 1; axesIndex >= 1; axesIndex -= 1) { final Axis axis = axes[axesIndex]; final List<Position> positions = axis.getPositions(); axesSize[axesIndex] = positions.size(); if (positions.isEmpty()) { noMeasures = true; } final ArrayList<Integer> memberList = new ArrayList<Integer>(); final ArrayList<Dimension> dimensionsForMembers = new ArrayList<Dimension>(); for (int positionsIndex = 0; positionsIndex < positions.size(); positionsIndex++) { final Position position = positions.get(positionsIndex); for (int positionIndex = 0; positionIndex < position.size(); positionIndex++) { Member m = position.get(positionIndex); final Dimension dimension = m.getDimension(); int hierarchyLevelCount = 1; // Originally was 0 // // Change compared to BandedMDXTM - we don't want all levels // while (false && m != null) // { // m = m.getParentMember(); // hierarchyLevelCount += 1; // } if (memberList.size() <= positionIndex) { memberList.add(hierarchyLevelCount); dimensionsForMembers.add(dimension); } else { final Integer existingLevel = memberList.get(positionIndex); if (existingLevel.intValue() < hierarchyLevelCount) { memberList.set(positionIndex, hierarchyLevelCount); dimensionsForMembers.set(positionIndex, dimension); } } } } int memberCount = 0; for (int i = 0; i < memberList.size(); i++) { memberCount += memberList.get(i); } axesMembers[axesIndex] = memberCount; dimensionsForMembersPerAxis[axesIndex] = dimensionsForMembers; membersPerAxis[axesIndex] = memberList; } if (axesSize.length > 1) { rowCount = axesSize[1]; for (int i = 2; i < axesSize.length; i++) { final int size = axesSize[i]; rowCount *= size; } } if (noMeasures == false) { rowCount = Math.max(1, rowCount); } if (axesSize.length == 0) { columnCount = 1; } else if (axesSize.length > 0) { columnCount = axesSize[0]; } for (int i = 1; i < axesMembers.length; i++) { columnCount += axesMembers[i]; } columnNames = new String[columnCount]; columnToDimensionMapping = new Dimension[columnCount]; columnToAxisPosition = new int[columnCount]; int columnIndex = 0; int dimColIndex = 0; // final FastStack memberStack = new FastStack(); for (int axesIndex = axes.length - 1; axesIndex >= 1; axesIndex -= 1) { final Axis axis = axes[axesIndex]; final List<Position> positions = axis.getPositions(); final LinkedHashSet<String> columnNamesSet = new LinkedHashSet<String>(); for (int positionsIndex = 0; positionsIndex < positions.size(); positionsIndex++) { final Position position = positions.get(positionsIndex); for (int positionIndex = 0; positionIndex < position.size(); positionIndex++) { // memberStack.clear(); Member m = position.get(positionIndex); // Get member's hierarchy final String name = m.getHierarchy().getName(); if (columnNamesSet.contains(name) == false) { columnNamesSet.add(name); } } } if (columnNamesSet.size() != axesMembers[axesIndex]) { logger.error("ERROR: Number of names is not equal the pre-counted number."); } final List<Dimension> dimForMemberPerAxis = dimensionsForMembersPerAxis[axesIndex]; final List<Integer> memberCntPerAxis = membersPerAxis[axesIndex]; for (int i = 0; i < memberCntPerAxis.size(); i++) { final Integer count = memberCntPerAxis.get(i); final Dimension dim = dimForMemberPerAxis.get(i); for (int x = 0; x < count.intValue(); x += 1) { this.columnToDimensionMapping[dimColIndex + x] = dim; this.columnToAxisPosition[dimColIndex + x] = axesIndex; } dimColIndex = count.intValue() + dimColIndex; } final String[] names = columnNamesSet.toArray(new String[columnNamesSet.size()]); System.arraycopy(names, 0, this.columnNames, columnIndex, names.length); columnIndex += names.length; } if (axesSize.length > 0) { // now create the column names for the column-axis final Axis axis = axes[0]; final List<Position> positions = axis.getPositions(); for (int i = 0; i < positions.size(); i++) { final Position position = positions.get(i); final StringBuffer positionName = new StringBuffer(100); for (int j = 0; j < position.size(); j++) { if (j != 0) { positionName.append('/'); } final Member member = position.get(j); //positionName.append(MondrianUtil.getUniqueMemberName(member)); positionName.append(member.getName()); } columnNames[columnIndex] = positionName.toString(); columnIndex += 1; } } if (axesSize.length == 0) { columnNames[0] = "Measure"; } if (rowLimit > 0) { rowCount = Math.min(rowLimit, rowCount); } }
From source file:com.smartitengineering.dao.impl.hbase.CommonDao.java
@Override public Set<Template> getByIds(List<IdType> ids) { LinkedHashSet<Future<Template>> set = new LinkedHashSet<Future<Template>>(ids.size()); LinkedHashSet<Template> resultSet = new LinkedHashSet<Template>(ids.size()); for (IdType id : ids) { set.add(executorService.executeAsynchronously(getDefaultTableName(), getByIdCallback(id))); }/*from w ww. j a va 2 s .c o m*/ for (Future<Template> future : set) { try { final Template get = future.get(); if (get != null) { resultSet.add(get); } } catch (Exception ex) { logger.warn("Could not retrieve from Future...", ex); } } return resultSet; }
From source file:Simulator.PerformanceCalculation.java
public JPanel waitTime1() { LinkedHashSet no = new LinkedHashSet(); LinkedHashMap<Integer, ArrayList<Double>> wait1 = new LinkedHashMap<>(); for (Map.Entry<Integer, TraceObject> entry : l.getLocalTrace().entrySet()) { TraceObject traceObject = entry.getValue(); if (wait1.get(traceObject.getSurgeonId()) == null) { ArrayList details = new ArrayList(); details.add(traceObject.getWaitTime1()); wait1.put(traceObject.getSurgeonId(), details); } else {//ww w . j a va2 s. co m wait1.get(traceObject.getSurgeonId()).add(traceObject.getWaitTime1()); } no.add(traceObject.getSurgeonId()); } String[] column = new String[no.size()]; String series1 = "Wait Time 1"; for (int i = 0; i < no.size(); i++) { column[i] = "Surgeon " + (i + 1); } DefaultCategoryDataset dataset = new DefaultCategoryDataset(); LinkedHashMap<Integer, Double> average = new LinkedHashMap<>(); for (Map.Entry<Integer, ArrayList<Double>> entry : wait1.entrySet()) { Integer integer = entry.getKey(); ArrayList<Double> arrayList = entry.getValue(); double total = 0; for (Double double1 : arrayList) { total += double1; } average.put(integer, total / arrayList.size()); } for (int i = 1; i <= average.size(); i++) { dataset.addValue(Math.round(average.get(i) / 600), series1, column[i - 1]); } JFreeChart chart = ChartFactory.createBarChart("Wait Time 1", // chart title "Surgeon ID", // domain axis label "Days", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips? false // URLs? ); return new ChartPanel(chart); }
From source file:Simulator.PerformanceCalculation.java
public JPanel waitTime2() { LinkedHashSet no = new LinkedHashSet(); LinkedHashMap<Integer, ArrayList<Double>> wait1 = new LinkedHashMap<>(); for (Map.Entry<Integer, TraceObject> entry : l.getLocalTrace().entrySet()) { TraceObject traceObject = entry.getValue(); if (wait1.get(traceObject.getSurgeonId()) == null) { ArrayList details = new ArrayList(); details.add(traceObject.getWaitTime2()); wait1.put(traceObject.getSurgeonId(), details); } else {/*from w ww . j a va 2 s. c om*/ wait1.get(traceObject.getSurgeonId()).add(traceObject.getWaitTime2()); } no.add(traceObject.getSurgeonId()); } String[] column = new String[no.size()]; String series1 = "Wait Time 2"; for (int i = 0; i < no.size(); i++) { column[i] = "Surgeon " + (i + 1); } DefaultCategoryDataset dataset = new DefaultCategoryDataset(); LinkedHashMap<Integer, Double> average = new LinkedHashMap<>(); for (Map.Entry<Integer, ArrayList<Double>> entry : wait1.entrySet()) { Integer integer = entry.getKey(); ArrayList<Double> arrayList = entry.getValue(); double total = 0; for (Double double1 : arrayList) { total += double1; } average.put(integer, total / arrayList.size()); } for (int i = 1; i <= average.size(); i++) { dataset.addValue(Math.round(average.get(i) / 600), series1, column[i - 1]); } JFreeChart chart = ChartFactory.createBarChart("Wait Time 2", // chart title "Surgeon ID", // domain axis label "Days", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips? false // URLs? ); return new ChartPanel(chart); }
From source file:com.persinity.ndt.dbdiff.rel.JsonTransformEntityStore.java
@Override public Collection<TransformEntity> loadTransformEntities() { return resource.accessAndAutoClose(new Resource.Accessor<InputStream, LinkedHashSet<TransformEntity>>() { @Override//from ww w.java2s . c o m public InputStream getResource() { final InputStream fis; try { fis = new FileInputStream(sourceFile); } catch (FileNotFoundException e) { throw new RuntimeException(e); } return new BufferedInputStream(fis); } @Override public LinkedHashSet<TransformEntity> access(final InputStream is) throws Exception { final LinkedHashSet<TransformEntity> transformEntities = new LinkedHashSet<>(); final String jsonTxt = IOUtils.toString(is); final JSONObject obj = new JSONObject(jsonTxt); final JSONArray array = obj.getJSONArray(TRANSFORMATIONS_KEY); for (int i = 0; i < array.length(); i++) { final JSONObject element = array.getJSONObject(i); final String targetEntity = element.getString(TARGET_ENTITY_KEY); final String transformStatement = element.getString(TRANSFORM_STATEMENT_KEY); final String sourceLeadingEntity = element.getString(SOURCE_LEADING_ENTITY_KEY); final Set<String> sourceLeadingColumns = convertToStringSet( element.getJSONArray(SOURCE_LEADING_COLUMNS_KEY)); final TransformEntity transformEntity = new TransformEntity(targetEntity, transformStatement, sourceLeadingEntity, sourceLeadingColumns); transformEntities.add(transformEntity); } log.info("Read transformations: {} from file: {}", transformEntities.size(), sourceFile); return transformEntities; } }); }
From source file:Simulator.PerformanceCalculation.java
JPanel minmaxwaitTime2(boolean minCheck) { LinkedHashSet no = new LinkedHashSet(); LinkedHashMap<Integer, ArrayList<Double>> wait1 = new LinkedHashMap<>(); for (Map.Entry<Integer, TraceObject> entry : l.getLocalTrace().entrySet()) { TraceObject traceObject = entry.getValue(); if (wait1.get(traceObject.getSurgeonId()) == null) { ArrayList details = new ArrayList(); details.add(traceObject.getWaitTime2()); wait1.put(traceObject.getSurgeonId(), details); } else {// ww w . j a va 2 s. com wait1.get(traceObject.getSurgeonId()).add(traceObject.getWaitTime2()); } no.add(traceObject.getSurgeonId()); } XYSeriesCollection dataset = new XYSeriesCollection(); LinkedHashMap<Integer, Double> average = new LinkedHashMap<>(); for (Map.Entry<Integer, ArrayList<Double>> entry : wait1.entrySet()) { Integer integer = entry.getKey(); ArrayList<Double> arrayList = entry.getValue(); double value = 0; if (minCheck) { value = Collections.min(arrayList); value = value / 600; } else { value = Collections.max(arrayList); value = value / 600; } average.put(integer, value); } XYSeries series = new XYSeries("Surgeon Minimum Wait Time 2"); for (int i = 1; i <= average.size(); i++) { series.add(i, average.get(i)); } dataset.addSeries(series); String name; if (minCheck) { name = "Minimum"; } else { name = "Maximum"; } // Generate the graph JFreeChart chart = ChartFactory.createXYLineChart(name + " Wait Time 2 For Patients", // Title "Surgeon ID", // x-axis Label "Time (Days)", // y-axis Label dataset, // Dataset PlotOrientation.VERTICAL, // Plot Orientation true, // Show Legend true, // Use tooltips false // Configure chart to generate URLs? ); XYPlot xyPlot = (XYPlot) chart.getPlot(); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyPlot.getRenderer(); renderer.setBaseShapesVisible(true); NumberAxis domain = (NumberAxis) xyPlot.getDomainAxis(); domain.setVerticalTickLabels(true); return new ChartPanel(chart); }
From source file:Simulator.PerformanceCalculation.java
JPanel minmaxwaitTime1(boolean minCheck) { LinkedHashSet no = new LinkedHashSet(); LinkedHashMap<Integer, ArrayList<Double>> wait1 = new LinkedHashMap<>(); for (Map.Entry<Integer, TraceObject> entry : l.getLocalTrace().entrySet()) { TraceObject traceObject = entry.getValue(); if (wait1.get(traceObject.getSurgeonId()) == null) { ArrayList details = new ArrayList(); details.add(traceObject.getWaitTime1()); wait1.put(traceObject.getSurgeonId(), details); } else {/* ww w .j a va 2 s . c o m*/ wait1.get(traceObject.getSurgeonId()).add(traceObject.getWaitTime1()); } no.add(traceObject.getSurgeonId()); } XYSeriesCollection dataset = new XYSeriesCollection(); LinkedHashMap<Integer, Double> average = new LinkedHashMap<>(); for (Map.Entry<Integer, ArrayList<Double>> entry : wait1.entrySet()) { Integer integer = entry.getKey(); ArrayList<Double> arrayList = entry.getValue(); double value = 0; if (minCheck) { value = Collections.min(arrayList); value = value / 600; } else { value = Collections.max(arrayList); value = value / 600; } average.put(integer, value); } XYSeries series = new XYSeries("Surgeon Minimum Wait Time 1"); for (int i = 1; i <= average.size(); i++) { series.add(i, average.get(i)); } dataset.addSeries(series); String name; if (minCheck) { name = "Minimum"; } else { name = "Maximum"; } // Generate the graph JFreeChart chart = ChartFactory.createXYLineChart(name + " Wait Time 1 For Patients", // Title "Surgeon ID", // x-axis Label "Time (Days)", // y-axis Label dataset, // Dataset PlotOrientation.VERTICAL, // Plot Orientation true, // Show Legend true, // Use tooltips false // Configure chart to generate URLs? ); XYPlot xyPlot = (XYPlot) chart.getPlot(); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyPlot.getRenderer(); renderer.setBaseShapesVisible(true); NumberAxis domain = (NumberAxis) xyPlot.getDomainAxis(); domain.setVerticalTickLabels(true); return new ChartPanel(chart); }