Пример #1
0
 /**
  * Looks for the element of the given abscissa and sets its value to ordiante. If there is no
  * points existing with the given abcisssa, adds a point (abscissa, ordinate) to the signal.
  * (actually, this method does the exact same thing as addElement).
  *
  * @param abscissa abscissa of the considered point
  * @param ordinate value to add or update in the signal
  */
 public void setElement(double abscissa, double ordinate) {
   int index = data.indexOf(abscissa);
   if (index < 0) {
     data.add(abscissa, ordinate);
   } else {
     data.updateByIndex(index, ordinate);
   }
 }
Пример #2
0
 /**
  * Returns <code>true</code> if all the y-values for the specified x-value are <code>null</code>
  * and <code>false</code> otherwise.
  *
  * @param x the x-value.
  * @return A boolean.
  */
 protected boolean canPrune(Number x) {
   for (int s = 0; s < this.data.size(); s++) {
     XYSeries series = (XYSeries) this.data.get(s);
     if (series.getY(series.indexOf(x)) != null) {
       return false;
     }
   }
   return true;
 }
Пример #3
0
 /**
  * Returns the value (the ordianate) of a point given its abscissa.
  *
  * @param abscissa abscissa of the considered point
  * @return return the value of the considered point (returns -1 if there is no points with the
  *     given abscissa in the signal).
  */
 public double getValueOfAbscissa(double abscissa) {
   int isInSeries = data.indexOf(abscissa);
   if (isInSeries >= 0) {
     return data.getY(isInSeries).doubleValue();
   } else {
     System.out.println("There is no point whith the abscissa " + abscissa + " in the signal.\n");
     return -1;
   }
 }
Пример #4
0
 /**
  * Returns the index of a point (abscissa, value) in the signal. Returns -1 if there is no point
  * of the given abscissa in the signal.
  *
  * @param abscissa abscissa of the point to look for
  * @return the index in the signal if such a point exists, -1 otherwise.
  */
 public int indexOf(double abscissa) {
   return data.indexOf(abscissa);
 }
Пример #5
0
 /**
  * Check if a point of abscissa abscissa is already in the signal
  *
  * @param abscissa abscissa of the point (abscissa, value) to look for
  * @return true if there exists a point of the given abscissa in the signal, false otherwise
  */
 public boolean isInSeries(double abscissa) {
   return (data.indexOf(abscissa) > 0);
 }