Skip to content

Commit 200aadd

Browse files
committed
cleanup / javadoc
1 parent a57a841 commit 200aadd

15 files changed

Lines changed: 32 additions & 46 deletions

File tree

androidplot-core/src/main/java/com/androidplot/Bounds.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
/**
2020
* Defines simple min/max boundary. Differs from {@link LineRegion} in that it accepts null values.
21+
* @since 0.9.7
2122
*/
2223
public class Bounds {
2324

androidplot-core/src/main/java/com/androidplot/LineRegion.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public LineRegion(Number v1, Number v2) {
3939
* @param v1
4040
* @param v2
4141
* @return The distance between val1 and val2 or null if either parameters are null.
42+
* @since 0.9.7
4243
*/
4344
public static Number measure(Number v1, Number v2) {
4445
return new LineRegion(v1, v2).length();

androidplot-core/src/main/java/com/androidplot/Plot.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,7 @@ protected void notifyListenersAfterDraw(Canvas canvas) {
528528
* @param formatter
529529
* @param series
530530
* @return True if all series were successfully added, false otherwise.
531+
* @since 0.9.7
531532
*/
532533
public synchronized boolean addSeries(FormatterType formatter, SeriesType... series) {
533534
for(SeriesType s : series) {
@@ -572,7 +573,7 @@ public synchronized boolean addSeries(SeriesType series, FormatterType formatter
572573
* @return The {@link SeriesAndFormatter} that matches the series and rendererClass params, or null if one is not found.
573574
*/
574575
protected SeriesAndFormatter<SeriesType, FormatterType> getSeries(SeriesType series, Class<? extends RendererType> rendererClass) {
575-
for(SeriesAndFormatter<SeriesType, FormatterType> thisPair : seriesRegistry.asList()) {
576+
for(SeriesAndFormatter<SeriesType, FormatterType> thisPair : seriesRegistry) {
576577
if(thisPair.getSeries() == series && thisPair.getFormatter().getRendererClass() == rendererClass) {
577578
return thisPair;
578579
}
@@ -588,7 +589,7 @@ protected SeriesAndFormatter<SeriesType, FormatterType> getSeries(SeriesType ser
588589
protected List<SeriesAndFormatter<SeriesType, FormatterType>> getSeries(SeriesType series) {
589590
List<SeriesAndFormatter<SeriesType, FormatterType>> results =
590591
new ArrayList<SeriesAndFormatter<SeriesType, FormatterType>>();
591-
for(SeriesAndFormatter<SeriesType, FormatterType> thisPair : seriesRegistry.asList()) {
592+
for(SeriesAndFormatter<SeriesType, FormatterType> thisPair : seriesRegistry) {
592593
if(thisPair.getSeries() == series) {
593594
results.add(thisPair);
594595
}

androidplot-core/src/main/java/com/androidplot/SeriesRegistry.java

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -24,45 +24,17 @@
2424
import java.util.List;
2525

2626
/**
27-
* Created by halfhp on 1/16/16.
27+
* Manages a list of {@link Series} and their associated {@link Formatter} in the context of a {@link Plot}.
28+
* @since 0.9.7
2829
*/
29-
public class SeriesRegistry<SeriesType extends Series, FormatterType extends Formatter> {
30-
31-
private ArrayList<SeriesAndFormatter<SeriesType, FormatterType>> sfPairs;
32-
33-
{
34-
sfPairs = new ArrayList<>();
35-
}
36-
37-
public void add(SeriesAndFormatter<SeriesType, FormatterType> sfPair) {
38-
sfPairs.add(sfPair);
39-
}
40-
41-
public void remove(SeriesAndFormatter<SeriesType, FormatterType> sfPair) {
42-
sfPairs.remove(sfPair);
43-
}
44-
45-
public ArrayList<SeriesAndFormatter<SeriesType, FormatterType>> asList() {
46-
return sfPairs;
47-
}
48-
49-
public Iterator<SeriesAndFormatter<SeriesType, FormatterType>> iterator() {
50-
return sfPairs.iterator();
51-
}
30+
public class SeriesRegistry<SeriesType extends Series, FormatterType extends Formatter>
31+
extends ArrayList<SeriesAndFormatter<SeriesType, FormatterType>> {
5232

5333
public List<SeriesType> getSeriesList() {
5434
List<SeriesType> result = new ArrayList<>();
55-
for(SeriesAndFormatter<SeriesType, FormatterType> sfPair : sfPairs) {
35+
for(SeriesAndFormatter<SeriesType, FormatterType> sfPair : this) {
5636
result.add(sfPair.getSeries());
5737
}
5838
return result;
5939
}
60-
61-
public boolean isEmpty() {
62-
return sfPairs.isEmpty();
63-
}
64-
65-
public int size() {
66-
return sfPairs.size();
67-
}
6840
}

androidplot-core/src/main/java/com/androidplot/candlestick/CandlestickFormatter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
/**
2828
* Format for drawing a value using {@link CandlestickRenderer}.
29+
* @since 0.9.7
2930
*/
3031
public class CandlestickFormatter extends XYSeriesFormatter<XYRegionFormatter> {
3132

androidplot-core/src/main/java/com/androidplot/candlestick/CandlestickMaker.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
/**
2323
* Helper utility to simplify the creation of of candlestick charts
24+
* @since 0.9.7
2425
*/
2526
public abstract class CandlestickMaker {
2627

androidplot-core/src/main/java/com/androidplot/candlestick/CandlestickRenderer.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import com.androidplot.ui.RenderStack;
2121
import com.androidplot.ui.SeriesAndFormatter;
2222
import com.androidplot.util.ValPixConverter;
23-
import com.androidplot.xy.ComplexRenderer;
23+
import com.androidplot.xy.GroupRenderer;
2424
import com.androidplot.xy.XYPlot;
2525
import com.androidplot.xy.XYSeries;
2626

@@ -37,8 +37,9 @@
3737
* high, low, open, close
3838
*
3939
* {@link CandlestickMaker} simplified methods for setting up a candlestick chart.
40+
* @since 0.9.7
4041
*/
41-
public class CandlestickRenderer<FormatterType extends CandlestickFormatter> extends ComplexRenderer<FormatterType> {
42+
public class CandlestickRenderer<FormatterType extends CandlestickFormatter> extends GroupRenderer<FormatterType> {
4243

4344
private static final int HIGH_INDEX = 0;
4445
private static final int LOW_INDEX = 1;

androidplot-core/src/main/java/com/androidplot/ui/RenderStack.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public void sync() {
8484
* TODO: rendering performance *might* be improved by reusing StackElement instances but I'm skeptical...
8585
*/
8686
getElements().clear();
87-
List<SeriesAndFormatter<SeriesType, FormatterType>> pairList = plot.getSeriesRegistry().asList();
87+
List<SeriesAndFormatter<SeriesType, FormatterType>> pairList = plot.getSeriesRegistry();
8888
for(SeriesAndFormatter<SeriesType, FormatterType> thisPair: pairList) {
8989
getElements().add(new StackElement<>(thisPair));
9090
}

androidplot-core/src/main/java/com/androidplot/ui/SeriesRenderer.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public void drawSeriesLegendIcon(Canvas canvas, RectF rect, SeriesFormatterType
9696
*/
9797
public List<SeriesAndFormatter<SeriesType, ? extends SeriesFormatterType>> getSeriesAndFormatterList() {
9898
List<SeriesAndFormatter<SeriesType, ? extends SeriesFormatterType>> results = new ArrayList<>();
99-
ArrayList<SeriesAndFormatter> sfList = getPlot().getSeriesRegistry().asList();
99+
ArrayList<SeriesAndFormatter> sfList = getPlot().getSeriesRegistry();
100100

101101
for(SeriesAndFormatter<SeriesType, ? extends SeriesFormatterType> thisPair : sfList) {
102102
if(thisPair.rendersWith(this)) {
@@ -106,9 +106,14 @@ public void drawSeriesLegendIcon(Canvas canvas, RectF rect, SeriesFormatterType
106106
return results;
107107
}
108108

109+
/**
110+
*
111+
* @return
112+
* @since 0.9.7
113+
*/
109114
public List<SeriesType> getSeriesList() {
110115
List<SeriesType> results = new ArrayList<>();
111-
ArrayList<SeriesAndFormatter> sfList = getPlot().getSeriesRegistry().asList();
116+
ArrayList<SeriesAndFormatter> sfList = getPlot().getSeriesRegistry();
112117

113118
for(SeriesAndFormatter<SeriesType, ? extends SeriesFormatterType> thisPair : sfList) {
114119
if(thisPair.rendersWith(this)) {

androidplot-core/src/main/java/com/androidplot/xy/BarRenderer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
/**
3434
* Renders the points in an XYSeries as bars.
3535
*/
36-
public class BarRenderer<FormatterType extends BarFormatter> extends ComplexRenderer<FormatterType> {
36+
public class BarRenderer<FormatterType extends BarFormatter> extends GroupRenderer<FormatterType> {
3737

3838
private BarRenderStyle renderStyle = BarRenderStyle.OVERLAID; // default Render Style
3939
private BarWidthStyle widthStyle = BarWidthStyle.FIXED_WIDTH; // default Width Style

0 commit comments

Comments
 (0)