/** * Instantiates a new stats collection event. * * @param name the name * @param time the time * @param data the data */ public StatsCollectionEvent(String name, long time, long data) { this(name, new XYDataItem(time, data)); }
if (!list.isEmpty()) { XYDataItem xy = list.get(list.size() - 1); list.add(new XYDataItem(xy.getX().longValue() + 1, 0)); list.add(new XYDataItem(System.currentTimeMillis(), 0));
stats = statsCollection.newStats(name, maxSeries); stats.add(stats.size(), new XYDataItem(time, statValue)); houseKeepStats(stats); } finally {
statsCollection.newStats(name, maxSeries); } else { XYDataItem data = new XYDataItem(time, value); statsCollection.lockForUpdate(); try {
Shipment s = (Shipment) job; Coordinate pickupCoordinate = getCoordinate(s.getPickupLocation().getCoordinate()); XYDataItem dataItem = new XYDataItem(pickupCoordinate.getX() * scalingFactor, pickupCoordinate.getY() * scalingFactor); activities.add(dataItem); addLabel(s, dataItem); XYDataItem dataItem2 = new XYDataItem(deliveryCoordinate.getX() * scalingFactor, deliveryCoordinate.getY() * scalingFactor); activities.add(dataItem2); addLabel(s, dataItem2); Pickup service = (Pickup) job; Coordinate coord = getCoordinate(service.getLocation().getCoordinate()); XYDataItem dataItem = new XYDataItem(coord.getX() * scalingFactor, coord.getY() * scalingFactor); activities.add(dataItem); addLabel(service, dataItem); Delivery service = (Delivery) job; Coordinate coord = getCoordinate(service.getLocation().getCoordinate()); XYDataItem dataItem = new XYDataItem(coord.getX() * scalingFactor, coord.getY() * scalingFactor); activities.add(dataItem); addLabel(service, dataItem); Service service = (Service) job; Coordinate coord = getCoordinate(service.getLocation().getCoordinate()); XYDataItem dataItem = new XYDataItem(coord.getX() * scalingFactor, coord.getY() * scalingFactor); activities.add(dataItem); addLabel(service, dataItem);
private void retrieveActivities(VehicleRoutingProblem vrp) throws NoLocationFoundException { activities = new XYSeries("activities", false, true); for (Vehicle v : vrp.getVehicles()) { Coordinate start_coordinate = getCoordinate(v.getStartLocation().getCoordinate()); if (start_coordinate == null) throw new NoLocationFoundException(); XYDataItem item = new XYDataItem(start_coordinate.getX() * scalingFactor, start_coordinate.getY() * scalingFactor); markItem(item, Activity.START); activities.add(item); if (!v.getStartLocation().getId().equals(v.getEndLocation().getId())) { Coordinate end_coordinate = getCoordinate(v.getEndLocation().getCoordinate()); if (end_coordinate == null) throw new NoLocationFoundException(); XYDataItem end_item = new XYDataItem(end_coordinate.getX() * scalingFactor, end_coordinate.getY() * scalingFactor); markItem(end_item, Activity.END); activities.add(end_item); } } for (Job job : vrp.getJobs().values()) { addJob(activities, job); } for (VehicleRoute r : vrp.getInitialVehicleRoutes()) { for (Job job : r.getTourActivities().getJobs()) { addJob(activities, job); } } }
private XYDataItem decodeGPGGA(String strGPGGA) throws IOException { String[] tokens = strGPGGA.split(","); String latitude = tokens[2].trim(); String longitude = tokens[4].trim(); // Calculating latitude and longitude in degrees double dlattemp = Double.parseDouble(latitude) / 100.0; double dlat = dlattemp + (Double.parseDouble(latitude) - dlattemp * 100) / 60.0; double dlontemp = Double.parseDouble(longitude) / 100.0; double dlon = dlontemp + (Double.parseDouble(longitude) - dlontemp * 100) / 60.0; return new XYDataItem(dlat, dlon); }
/** * Adds or updates an item in the series and sends a * {@link SeriesChangeEvent} to all registered listeners. * * @param x the x-value ({@code null} not permitted). * @param y the y-value ({@code null} permitted). * * @return A copy of the overwritten data item, or {@code null} if no * item was overwritten. */ public XYDataItem addOrUpdate(Number x, Number y) { // defer argument checking return addOrUpdate(new XYDataItem(x, y)); }
/** * Adds or updates an item in the series and sends a * {@link SeriesChangeEvent} to all registered listeners. * * @param x the x-value (<code>null</code> not permitted). * @param y the y-value (<code>null</code> permitted). * * @return A copy of the overwritten data item, or <code>null</code> if no * item was overwritten. */ public XYDataItem addOrUpdate(Number x, Number y) { // defer argument checking return addOrUpdate(new XYDataItem(x, y)); }
/** * Adds new data to the series and, if requested, sends a * {@link SeriesChangeEvent} to all registered listeners. * <P> * Throws an exception if the x-value is a duplicate AND the * allowDuplicateXValues flag is false. * * @param x the x-value (<code>null</code> not permitted). * @param y the y-value (<code>null</code> permitted). * @param notify a flag the controls whether or not a * {@link SeriesChangeEvent} is sent to all registered * listeners. */ public void add(Number x, Number y, boolean notify) { // delegate argument checking to XYDataItem... XYDataItem item = new XYDataItem(x, y); add(item, notify); }
/** * Adds new data to the series and, if requested, sends a * {@link SeriesChangeEvent} to all registered listeners. * <P> * Throws an exception if the x-value is a duplicate AND the * allowDuplicateXValues flag is false. * * @param x the x-value ({@code null} not permitted). * @param y the y-value ({@code null} permitted). * @param notify a flag the controls whether or not a * {@link SeriesChangeEvent} is sent to all registered * listeners. */ public void add(Number x, Number y, boolean notify) { // delegate argument checking to XYDataItem... XYDataItem item = new XYDataItem(x, y); add(item, notify); }
/** * Returns the index of the item with the specified x-value, or a negative * index if the series does not contain an item with that x-value. Be * aware that for an unsorted series, the index is found by iterating * through all items in the series. * * @param x the x-value (<code>null</code> not permitted). * * @return The index. */ public int indexOf(Number x) { if (this.autoSort) { return Collections.binarySearch(this.data, new XYDataItem(x, null)); } else { for (int i = 0; i < this.data.size(); i++) { XYDataItem item = (XYDataItem) this.data.get(i); if (item.getX().equals(x)) { return i; } } return -1; } }
/** * Returns the index of the item with the specified x-value, or a negative * index if the series does not contain an item with that x-value. Be * aware that for an unsorted series, the index is found by iterating * through all items in the series. * * @param x the x-value ({@code null} not permitted). * * @return The index. */ public int indexOf(Number x) { if (this.autoSort) { return Collections.binarySearch(this.data, new XYDataItem(x, null)); } else { for (int i = 0; i < this.data.size(); i++) { XYDataItem item = (XYDataItem) this.data.get(i); if (item.getX().equals(x)) { return i; } } return -1; } }
XYDataItem leftPeakPoint = new XYDataItem(0, 0); int leftPeakPointIndex = 0; XYDataItem rightPeakPoint = new XYDataItem(0, 0); boolean first = true; int index = -1;
XYSeries ser = new XYSeries(new XYDataItem(0, 0), false); int a = 1; for (double f = -0.9; f <= 0.9; f += 0.01) {
return new XYDataItem(row, matrix.getMatrix().getAsDouble(index, seriesId));
return new XYDataItem(row, matrix.getMatrix().getAsDouble(index, seriesId));
moved.add(new XYDataItem(rand.nextGaussian(), rand.nextGaussian()));
Shipment s = (Shipment) job; Coordinate pickupCoordinate = getCoordinate(s.getPickupLocation().getCoordinate()); XYDataItem dataItem = new XYDataItem(pickupCoordinate.getX() * scalingFactor, pickupCoordinate.getY() * scalingFactor); activities.add(dataItem); addLabel(s, dataItem); XYDataItem dataItem2 = new XYDataItem(deliveryCoordinate.getX() * scalingFactor, deliveryCoordinate.getY() * scalingFactor); activities.add(dataItem2); addLabel(s, dataItem2); Pickup service = (Pickup) job; Coordinate coord = getCoordinate(service.getLocation().getCoordinate()); XYDataItem dataItem = new XYDataItem(coord.getX() * scalingFactor, coord.getY() * scalingFactor); activities.add(dataItem); addLabel(service, dataItem); Delivery service = (Delivery) job; Coordinate coord = getCoordinate(service.getLocation().getCoordinate()); XYDataItem dataItem = new XYDataItem(coord.getX() * scalingFactor, coord.getY() * scalingFactor); activities.add(dataItem); addLabel(service, dataItem); Service service = (Service) job; Coordinate coord = getCoordinate(service.getLocation().getCoordinate()); XYDataItem dataItem = new XYDataItem(coord.getX() * scalingFactor, coord.getY() * scalingFactor); activities.add(dataItem); addLabel(service, dataItem);
private void retrieveActivities(VehicleRoutingProblem vrp) throws NoLocationFoundException { activities = new XYSeries("activities", false, true); for (Vehicle v : vrp.getVehicles()) { Coordinate start_coordinate = getCoordinate(v.getStartLocation().getCoordinate()); if (start_coordinate == null) throw new NoLocationFoundException(); XYDataItem item = new XYDataItem(start_coordinate.getX() * scalingFactor, start_coordinate.getY() * scalingFactor); markItem(item, Activity.START); activities.add(item); if (!v.getStartLocation().getId().equals(v.getEndLocation().getId())) { Coordinate end_coordinate = getCoordinate(v.getEndLocation().getCoordinate()); if (end_coordinate == null) throw new NoLocationFoundException(); XYDataItem end_item = new XYDataItem(end_coordinate.getX() * scalingFactor, end_coordinate.getY() * scalingFactor); markItem(end_item, Activity.END); activities.add(end_item); } } for (Job job : vrp.getJobs().values()) { addJob(activities, job); } for (VehicleRoute r : vrp.getInitialVehicleRoutes()) { for (Job job : r.getTourActivities().getJobs()) { addJob(activities, job); } } }