CloneSet159


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
47230.991method_declaration
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
147213
E:/TSE/Projects-CloneDR/jfreechart-1.0.10/src/org/jfree/data/ComparableObjectSeries.java
247340
E:/TSE/Projects-CloneDR/jfreechart-1.0.10/src/org/jfree/data/xy/XYSeries.java
Next
Last
Clone Instance
1
Line Count
47
Source Line
213
Source File
E:/TSE/Projects-CloneDR/jfreechart-1.0.10/src/org/jfree/data/ComparableObjectSeries.java

/**
 * Adds a data item to the series and, if requested, sends a 
 * {@link SeriesChangeEvent} to all registered listeners.
 *
 * @param item  the (x, y) item (<code>null</code> not permitted).
 * @param notify  a flag that controls whether or not a 
 *                {@link SeriesChangeEvent} is sent to all registered 
 *                listeners.
 */
protected void add(ComparableObjectItem item, boolean notify) {
  if (item == null) {
    throw new IllegalArgumentException("Null \'item\' argument.");
  }
  if (this.autoSort) {
    int index = Collections.binarySearch(this.data, item);
    if (index < 0) {
      this.data.add(-index - 1, item);
    }
    else {
      if (this.allowDuplicateXValues) {
        // need to make sure we are adding *after* any duplicates
        int size = this.data.size();
        while (index < size && item.compareTo(this.data.get(index)) == 0) {
          index++;
        }
        if (index < this.data.size()) {
          this.data.add(index, item);
        }
        else {
          this.data.add(item);
        }
      }
      else {
        throw new SeriesException("X-value already exists.");
      }
    }
  }
  else {
    if ( !this.allowDuplicateXValues) {
      // can't allow duplicate values, so we need to check whether
      // there is an item with the given x-value already
      int index = indexOf(item.getComparable());
      if (index >= 0) {
        throw new SeriesException("X-value already exists.");
      }
    }
    this.data.add(item);
  }
  if (getItemCount() > this.maximumItemCount) {
    this.data.remove(0);
  }
  if (notify) {
    fireSeriesChanged();
  }
}


First
Previous
Clone Instance
2
Line Count
47
Source Line
340
Source File
E:/TSE/Projects-CloneDR/jfreechart-1.0.10/src/org/jfree/data/xy/XYSeries.java

/**
 * Adds a data item to the series and, if requested, sends a
 * {@link SeriesChangeEvent} to all registered listeners.
 *
 * @param item  the (x, y) item (<code>null</code> not permitted).
 * @param notify  a flag that controls whether or not a
 *                {@link SeriesChangeEvent} is sent to all registered
 *                listeners.
 */
public void add(XYDataItem item, boolean notify) {
  if (item == null) {
    throw new IllegalArgumentException("Null \'item\' argument.");
  }
  if (this.autoSort) {
    int index = Collections.binarySearch(this.data, item);
    if (index < 0) {
      this.data.add(-index - 1, item);
    }
    else {
      if (this.allowDuplicateXValues) {
        // need to make sure we are adding *after* any duplicates
        int size = this.data.size();
        while (index < size && item.compareTo(this.data.get(index)) == 0) {
          index++;
        }
        if (index < this.data.size()) {
          this.data.add(index, item);
        }
        else {
          this.data.add(item);
        }
      }
      else {
        throw new SeriesException("X-value already exists.");
      }
    }
  }
  else {
    if ( !this.allowDuplicateXValues) {
      // can't allow duplicate values, so we need to check whether
      // there is an item with the given x-value already
      int index = indexOf(item.getX());
      if (index >= 0) {
        throw new SeriesException("X-value already exists.");
      }
    }
    this.data.add(item);
  }
  if (getItemCount() > this.maximumItemCount) {
    this.data.remove(0);
  }
  if (notify) {
    fireSeriesChanged();
  }
}


Clone AbstractionParameter Count: 3Parameter Bindings

 [[#variable1aa9d220]]void add( [[#variable1aa9d180]] item, boolean notify) {
  if (item == null) {
    throw new IllegalArgumentException("Null \'item\' argument.");
  }
  if (this.autoSort) {
    int index = Collections.binarySearch(this.data, item);
    if (index < 0) {
      this.data.add(-index - 1, item);
    }
    else {
      if (this.allowDuplicateXValues) {
        // need to make sure we are adding *after* any duplicates
        int size = this.data.size();
        while (index < size && item.compareTo(this.data.get(index)) == 0) {
          index++;
        }
        if (index < this.data.size()) {
          this.data.add(index, item);
        }
        else {
          this.data.add(item);
        }
      }
      else {
        throw new SeriesException("X-value already exists.");
      }
    }
  }
  else {
    if ( !this.allowDuplicateXValues) {
      // can't allow duplicate values, so we need to check whether
      // there is an item with the given x-value already
      int index = indexOf(item. [[#variable1aa9d140]]());
      if (index >= 0) {
        throw new SeriesException("X-value already exists.");
      }
    }
    this.data.add(item);
  }
  if (getItemCount() > this.maximumItemCount) {
    this.data.remove(0);
  }
  if (notify) {
    fireSeriesChanged();
  }
}
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#1aa9d220]]
/**
 * Adds a data item to the series and, if requested, sends a 
 * {@link SeriesChangeEvent} to all registered listeners.
 *
 * @param item  the (x, y) item (<code>null</code> not permitted).
 * @param notify  a flag that controls whether or not a 
 *                {@link SeriesChangeEvent} is sent to all registered 
 *                listeners.
 */
protected 
12[[#1aa9d220]]
/**
 * Adds a data item to the series and, if requested, sends a
 * {@link SeriesChangeEvent} to all registered listeners.
 *
 * @param item  the (x, y) item (<code>null</code> not permitted).
 * @param notify  a flag that controls whether or not a
 *                {@link SeriesChangeEvent} is sent to all registered
 *                listeners.
 */
public 
21[[#1aa9d180]]
ComparableObjectItem 
22[[#1aa9d180]]
XYDataItem 
31[[#1aa9d140]]
getComparable 
32[[#1aa9d140]]
getX