CloneSet43


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
86220.997class_body_declarations[2]
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
187521
E:/TSE/Projects-CloneDR/jfreechart-1.0.10/src/org/jfree/chart/renderer/category/BarRenderer.java
286182
E:/TSE/Projects-CloneDR/jfreechart-1.0.10/src/org/jfree/chart/renderer/category/LevelRenderer.java
Next
Last
Clone Instance
1
Line Count
87
Source Line
521
Source File
E:/TSE/Projects-CloneDR/jfreechart-1.0.10/src/org/jfree/chart/renderer/category/BarRenderer.java

/**
 * Calculates the bar width and stores it in the renderer state.
 *
 * @param plot  the plot.
 * @param dataArea  the data area.
 * @param rendererIndex  the renderer index.
 * @param state  the renderer state.
 */
protected void calculateBarWidth(CategoryPlot plot, Rectangle2D dataArea, int rendererIndex, CategoryItemRendererState state) {
  CategoryAxis domainAxis = getDomainAxis(plot, rendererIndex);
  CategoryDataset dataset = plot.getDataset(rendererIndex);
  if (dataset != null) {
    int columns = dataset.getColumnCount();
    int rows = dataset.getRowCount();
    double space = 0.0;
    PlotOrientation orientation = plot.getOrientation();
    if (orientation == PlotOrientation.HORIZONTAL) {
      space = dataArea.getHeight();
    }
    else
      if (orientation == PlotOrientation.VERTICAL) {
        space = dataArea.getWidth();
      }
    double maxWidth = space * getMaximumBarWidth();
    double categoryMargin = 0.0;
    double currentItemMargin = 0.0;
    if (columns > 1) {
      categoryMargin = domainAxis.getCategoryMargin();
    }
    if (rows > 1) {
      currentItemMargin = getItemMargin();
    }
    double used = space * (1 - domainAxis.getLowerMargin() - domainAxis.getUpperMargin() - categoryMargin - currentItemMargin);
    if ((rows * columns) > 0) {
      state.setBarWidth(Math.min(used / (rows * columns), maxWidth));
    }
    else {
      state.setBarWidth(Math.min(used, maxWidth));
    }
  }
}

/**
 * Calculates the coordinate of the first "side" of a bar.  This will be
 * the minimum x-coordinate for a vertical bar, and the minimum
 * y-coordinate for a horizontal bar.
 *
 * @param plot  the plot.
 * @param orientation  the plot orientation.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param state  the renderer state (has the bar width precalculated).
 * @param row  the row index.
 * @param column  the column index.
 *
 * @return The coordinate.
 */
protected double calculateBarW0(CategoryPlot plot, PlotOrientation orientation, Rectangle2D dataArea, CategoryAxis domainAxis, CategoryItemRendererState state, int row, int column) {
  // calculate bar width...
  double space = 0.0;
  if (orientation == PlotOrientation.HORIZONTAL) {
    space = dataArea.getHeight();
  }
  else {
    space = dataArea.getWidth();
  }
  double barW0 = domainAxis.getCategoryStart(column, getColumnCount(), dataArea, plot.getDomainAxisEdge());
  int seriesCount = getRowCount();
  int categoryCount = getColumnCount();
  if (seriesCount > 1) {
    double seriesGap = space * getItemMargin() / (categoryCount * (seriesCount - 1));
    double seriesW = calculateSeriesWidth(space, domainAxis, categoryCount, seriesCount);
    barW0 = barW0 + row * (seriesW + seriesGap) + (seriesW / 2.0) - (state.getBarWidth() / 2.0);
  }
  else {
    barW0 = domainAxis.getCategoryMiddle(column, getColumnCount(), dataArea, plot.getDomainAxisEdge()) - state.getBarWidth() / 2.0;
  }
  return barW0;
}


First
Previous
Clone Instance
2
Line Count
86
Source Line
182
Source File
E:/TSE/Projects-CloneDR/jfreechart-1.0.10/src/org/jfree/chart/renderer/category/LevelRenderer.java

/**
 * Calculates the bar width and stores it in the renderer state.
 *
 * @param plot  the plot.
 * @param dataArea  the data area.
 * @param rendererIndex  the renderer index.
 * @param state  the renderer state.
 */
protected void calculateItemWidth(CategoryPlot plot, Rectangle2D dataArea, int rendererIndex, CategoryItemRendererState state) {
  CategoryAxis domainAxis = getDomainAxis(plot, rendererIndex);
  CategoryDataset dataset = plot.getDataset(rendererIndex);
  if (dataset != null) {
    int columns = dataset.getColumnCount();
    int rows = dataset.getRowCount();
    double space = 0.0;
    PlotOrientation orientation = plot.getOrientation();
    if (orientation == PlotOrientation.HORIZONTAL) {
      space = dataArea.getHeight();
    }
    else
      if (orientation == PlotOrientation.VERTICAL) {
        space = dataArea.getWidth();
      }
    double maxWidth = space * getMaximumItemWidth();
    double categoryMargin = 0.0;
    double currentItemMargin = 0.0;
    if (columns > 1) {
      categoryMargin = domainAxis.getCategoryMargin();
    }
    if (rows > 1) {
      currentItemMargin = getItemMargin();
    }
    double used = space * (1 - domainAxis.getLowerMargin() - domainAxis.getUpperMargin() - categoryMargin - currentItemMargin);
    if ((rows * columns) > 0) {
      state.setBarWidth(Math.min(used / (rows * columns), maxWidth));
    }
    else {
      state.setBarWidth(Math.min(used, maxWidth));
    }
  }
}

/**
 * Calculates the coordinate of the first "side" of a bar.  This will be
 * the minimum x-coordinate for a vertical bar, and the minimum
 * y-coordinate for a horizontal bar.
 *
 * @param plot  the plot.
 * @param orientation  the plot orientation.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param state  the renderer state (has the bar width precalculated).
 * @param row  the row index.
 * @param column  the column index.
 *
 * @return The coordinate.
 */
protected double calculateBarW0(CategoryPlot plot, PlotOrientation orientation, Rectangle2D dataArea, CategoryAxis domainAxis, CategoryItemRendererState state, int row, int column) {
  // calculate bar width...
  double space = 0.0;
  if (orientation == PlotOrientation.HORIZONTAL) {
    space = dataArea.getHeight();
  }
  else {
    space = dataArea.getWidth();
  }
  double barW0 = domainAxis.getCategoryStart(column, getColumnCount(), dataArea, plot.getDomainAxisEdge());
  int seriesCount = getRowCount();
  int categoryCount = getColumnCount();
  if (seriesCount > 1) {
    double seriesGap = space * getItemMargin() / (categoryCount * (seriesCount - 1));
    double seriesW = calculateSeriesWidth(space, domainAxis, categoryCount, seriesCount);
    barW0 = barW0 + row * (seriesW + seriesGap) + (seriesW / 2.0) - (state.getBarWidth() / 2.0);
  }
  else {
    barW0 = domainAxis.getCategoryMiddle(column, getColumnCount(), dataArea, plot.getDomainAxisEdge()) - state.getBarWidth() / 2.0;
  }
  return barW0;
}


Clone AbstractionParameter Count: 2Parameter Bindings

/**
     * Calculates the bar width and stores it in the renderer state.
     *
     * @param plot  the plot.
     * @param dataArea  the data area.
     * @param rendererIndex  the renderer index.
     * @param state  the renderer state.
     */
protected void [[#variable1ab68200]](CategoryPlot plot, Rectangle2D dataArea, int rendererIndex, CategoryItemRendererState state) {
  CategoryAxis domainAxis = getDomainAxis(plot, rendererIndex);
  CategoryDataset dataset = plot.getDataset(rendererIndex);
  if (dataset != null) {
    int columns = dataset.getColumnCount();
    int rows = dataset.getRowCount();
    double space = 0.0;
    PlotOrientation orientation = plot.getOrientation();
    if (orientation == PlotOrientation.HORIZONTAL) {
      space = dataArea.getHeight();
    }
    else
      if (orientation == PlotOrientation.VERTICAL) {
        space = dataArea.getWidth();
      }
    double maxWidth = space *  [[#variable1ab680a0]]();
    double categoryMargin = 0.0;
    double currentItemMargin = 0.0;
    if (columns > 1) {
      categoryMargin = domainAxis.getCategoryMargin();
    }
    if (rows > 1) {
      currentItemMargin = getItemMargin();
    }
    double used = space * (1 - domainAxis.getLowerMargin() - domainAxis.getUpperMargin() - categoryMargin - currentItemMargin);
    if ((rows * columns) > 0) {
      state.setBarWidth(Math.min(used / (rows * columns), maxWidth));
    }
    else {
      state.setBarWidth(Math.min(used, maxWidth));
    }
  }
}

/**
     * Calculates the coordinate of the first "side" of a bar.  This will be
     * the minimum x-coordinate for a vertical bar, and the minimum
     * y-coordinate for a horizontal bar.
     *
     * @param plot  the plot.
     * @param orientation  the plot orientation.
     * @param dataArea  the data area.
     * @param domainAxis  the domain axis.
     * @param state  the renderer state (has the bar width precalculated).
     * @param row  the row index.
     * @param column  the column index.
     *
     * @return The coordinate.
     */
protected double calculateBarW0(CategoryPlot plot, PlotOrientation orientation, Rectangle2D dataArea, CategoryAxis domainAxis, CategoryItemRendererState state, int row, int column) {
  // calculate bar width...
  double space = 0.0;
  if (orientation == PlotOrientation.HORIZONTAL) {
    space = dataArea.getHeight();
  }
  else {
    space = dataArea.getWidth();
  }
  double barW0 = domainAxis.getCategoryStart(column, getColumnCount(), dataArea, plot.getDomainAxisEdge());
  int seriesCount = getRowCount();
  int categoryCount = getColumnCount();
  if (seriesCount > 1) {
    double seriesGap = space * getItemMargin() / (categoryCount * (seriesCount - 1));
    double seriesW = calculateSeriesWidth(space, domainAxis, categoryCount, seriesCount);
    barW0 = barW0 + row * (seriesW + seriesGap) + (seriesW / 2.0) - (state.getBarWidth() / 2.0);
  }
  else {
    barW0 = domainAxis.getCategoryMiddle(column, getColumnCount(), dataArea, plot.getDomainAxisEdge()) - state.getBarWidth() / 2.0;
  }
  return barW0;
}
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#1ab68200]]
calculateBarWidth 
12[[#1ab68200]]
calculateItemWidth 
21[[#1ab680a0]]
getMaximumBarWidth 
22[[#1ab680a0]]
getMaximumItemWidth