Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions CodenameOne/src/com/codename1/ads/InnerActive.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*
* @author Chen
*/
public class InnerActive extends AdsService{
public class InnerActive extends AdsService{ // PMD Fix: UnusedPrivateField removed obsolete field

private final String REQUEST_URL = "http://m2m1.inner-active.com/simpleM2M/clientRequestHtmlAd";

Expand All @@ -51,9 +51,6 @@ public class InnerActive extends AdsService{
//UDID/IMEI
private String hid;

//client Id
private String cid;

private boolean banner = true;

private static boolean testAds = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ public interface BackgroundFetch {
* @see com.codename1.ui.Display.getPreferredBackgroundFetchInterval()
* @see com.codename1.ui.Display.isBackgroundFetchSupported()
*/
public void performBackgroundFetch(long deadline, Callback<Boolean> onComplete);
void performBackgroundFetch(long deadline, Callback<Boolean> onComplete); // PMD Fix: UnnecessaryModifier removed

}
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ public class VideoCaptureConstraints {
* to transfer the "preferred" constraints to corresponding "actual" constraints
* based on what the platform supports.
*/
public static interface Compiler {
public VideoCaptureConstraints compile(VideoCaptureConstraints cnst);
public interface Compiler { // PMD Fix: UnnecessaryModifier removed implicit static
VideoCaptureConstraints compile(VideoCaptureConstraints cnst); // PMD Fix: UnnecessaryModifier removed redundant public
}

/**
Expand Down
34 changes: 13 additions & 21 deletions CodenameOne/src/com/codename1/charts/ChartComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -536,29 +536,21 @@ public void pointerDragged(int[] x, int[] y) {
}

double[] zoomLimits = xyChart.getRenderer().getZoomLimits();
if (zoomLimits != null && zoomLimits[0] != 0) {
if (maxX - minX < zoomLimits[0]) {
maxX = xyChart.getRenderer().getXAxisMax();
minX = xyChart.getRenderer().getXAxisMin();
}
if (zoomLimits != null && zoomLimits[0] != 0 && maxX - minX < zoomLimits[0]) { // PMD Fix: CollapsibleIfStatements
maxX = xyChart.getRenderer().getXAxisMax();
minX = xyChart.getRenderer().getXAxisMin();
}
if (zoomLimits != null && zoomLimits[1] != 0) {
if (maxX - minX > zoomLimits[1]) {
maxX = xyChart.getRenderer().getXAxisMax();
minX = xyChart.getRenderer().getXAxisMin();
}
if (zoomLimits != null && zoomLimits[1] != 0 && maxX - minX > zoomLimits[1]) { // PMD Fix: CollapsibleIfStatements
maxX = xyChart.getRenderer().getXAxisMax();
minX = xyChart.getRenderer().getXAxisMin();
}
if (zoomLimits != null && zoomLimits[2] != 0) {
if (maxY - minY < zoomLimits[2]) {
maxY = xyChart.getRenderer().getYAxisMax();
minY = xyChart.getRenderer().getYAxisMin();
}
if (zoomLimits != null && zoomLimits[2] != 0 && maxY - minY < zoomLimits[2]) { // PMD Fix: CollapsibleIfStatements
maxY = xyChart.getRenderer().getYAxisMax();
minY = xyChart.getRenderer().getYAxisMin();
}
if (zoomLimits != null && zoomLimits[3] != 0) {
if (maxY - minY > zoomLimits[3]) {
maxY = xyChart.getRenderer().getYAxisMax();
minY = xyChart.getRenderer().getYAxisMin();
}
if (zoomLimits != null && zoomLimits[3] != 0 && maxY - minY > zoomLimits[3]) { // PMD Fix: CollapsibleIfStatements
maxY = xyChart.getRenderer().getYAxisMax();
minY = xyChart.getRenderer().getYAxisMin();
}

if (!xyChart.getRenderer().isZoomXEnabled()) {
Expand Down Expand Up @@ -894,7 +886,7 @@ private void zoomTransition(double minX, double maxX, double minY, double maxY,
}

private interface IZoomTransition {
public void start();
void start();
}

private class ZoomTransition implements Animation, IZoomTransition {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public GradientDrawable(Orientation orientation, int[] colors) {
this.colors = colors;
}

public static enum Orientation {
public enum Orientation { // PMD Fix: UnnecessaryModifier removed redundant static
BL_TR,
BOTTOM_TOP,
BR_TL,
Expand Down
7 changes: 3 additions & 4 deletions CodenameOne/src/com/codename1/charts/compat/Paint.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@
* @author shannah
* @deprecated
*/
public class Paint {
public class Paint { // PMD Fix: UnusedPrivateField removed redundant antiAlias flag


static Graphics g;
private boolean antiAlias;
private Font typeface = Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL);
private int strokeCap = Cap.BUTT;
private int strokeJoin = Join.BEVEL;
Expand Down Expand Up @@ -154,7 +153,7 @@ public float measureText(char[] chars, int start, int count){


public void setAntiAlias(boolean antialiasing) {
this.antiAlias = antialiasing;
// No-op for compatibility.
}

public Font getTypeface() {
Expand Down Expand Up @@ -209,7 +208,7 @@ public void setStrokeWidth(float i) {



public static enum Style {
public enum Style { // PMD Fix: UnnecessaryModifier removed redundant static
FILL,
FILL_AND_STROKE,
STROKE
Expand Down
5 changes: 2 additions & 3 deletions CodenameOne/src/com/codename1/charts/models/XYSeries.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,14 @@ private void initRange() {
mMaxX = MathHelper.NULL_VALUE;
mMinY = MathHelper.NULL_VALUE;
mMaxY = MathHelper.NULL_VALUE;
int length = getItemCount();
int length = getItemCount(); // PMD Fix: UnusedLocalVariable removed redundant loop index
for (int k = 0; k < length; k++) {
double x = getX(k);
double y = getY(k);
updateRange(x, y);
}

int i=0;
}
}

/**
* Updates the range on both axes.
Expand Down
13 changes: 7 additions & 6 deletions CodenameOne/src/com/codename1/charts/renderers/BasicStroke.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,13 @@ public class BasicStroke {
* @param intervals the path effect intervals
* @param phase the path effect phase
*/
public BasicStroke(int cap, int join, float miter, float[] intervals, float phase) {
mCap = cap;
mJoin = join;
mMiter = miter;
mIntervals = intervals;
}
public BasicStroke(int cap, int join, float miter, float[] intervals, float phase) {
mCap = cap;
mJoin = join;
mMiter = miter;
mIntervals = intervals;
mPhase = phase; // PMD Fix: UnusedFormalParameter store constructor argument
}

/**
* Returns the stroke cap.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/**
* An abstract renderer to be extended by the multiple series classes.
*/
public class DefaultRenderer {
public class DefaultRenderer { // PMD Fix: UnusedPrivateField removed unused text font constant
/** The chart title. */
private String mChartTitle = "";
/** The chart title text size. */
Expand All @@ -34,8 +34,6 @@ public class DefaultRenderer {
public static final int BACKGROUND_COLOR = 0x0;
/** The default color for text. */
public static final int TEXT_COLOR = 0xEAEAEA;
/** A text font for regular text, like the chart labels. */
private static final Font REGULAR_TEXT_FONT = Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL);
/** The typeface name for the texts. */
private int mTextTypefaceName = Font.FACE_SYSTEM;
/** The typeface style for the texts. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ public enum Orientation {
/** The rotate angle. */
private int mAngle = 0;

private Orientation(int angle) {
mAngle = angle;
}
Orientation(int angle) { // PMD Fix: UnnecessaryModifier removed implicit private keyword
mAngle = angle;
}

/**
* Return the orientation rotate angle.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
/**
* A renderer for the XY type series.
*/
public class XYSeriesRenderer extends SimpleSeriesRenderer {
public class XYSeriesRenderer extends SimpleSeriesRenderer { // PMD Fix: UnnecessarySemicolon cleaned extra delimiter
/** If the chart points should be filled. */
private boolean mFillPoints = false;
/** If the chart should be filled outside its line. */
Expand Down Expand Up @@ -61,9 +61,9 @@ public class XYSeriesRenderer extends SimpleSeriesRenderer {
* A descriptor for the line fill behavior.
*/
public static class FillOutsideLine {
public enum Type {
NONE, BOUNDS_ALL, BOUNDS_BELOW, BOUNDS_ABOVE, BELOW, ABOVE
};
public enum Type {
NONE, BOUNDS_ALL, BOUNDS_BELOW, BOUNDS_ABOVE, BELOW, ABOVE
}

/** The fill type. */
private final Type mType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,11 @@ protected void cleanup() {
*/
protected void update(int progress) {
double dProgress = (double)progress;
int len = endVals.getItemCount();
int len = endVals.getItemCount(); // PMD Fix: UnusedLocalVariable removed unused endindex
for (int i=0; i<len; i++){
double x = endVals.getX(i);
double y = endVals.getY(i);
int startIndex = startVals.getIndexForKey(x);
int endindex = i;

double startVal = startIndex == -1 ? 0.0 : startVals.getY(startIndex);
double endVal = y;
double tweenVal = startVal + (endVal-startVal)*dProgress/100.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,13 @@ protected void cleanup() {
*/
protected void update(int progress) {
double dProgress = (double)progress;
int len = endVals.getItemCount();
int len = endVals.getItemCount(); // PMD Fix: UnusedLocalVariable removed unused endindex
for (int i=0; i<len; i++){
double x = endVals.getX(i);
double y = endVals.getY(i);
double val = endVals.getValue(i);
int startIndex = startVals.getIndexForKey(x);
int endindex = i;



double startY = startIndex == -1 ? 0.0 : startVals.getY(startIndex);
double endY = y;
double tweenY = startY + (endY-startY)*dProgress/100.0;
Expand Down
2 changes: 1 addition & 1 deletion CodenameOne/src/com/codename1/charts/util/ColorUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ else if (that instanceof IColor)



private final static int ToARGB(IColor c){
private static int ToARGB(IColor c){ // PMD Fix: UnnecessaryModifier removed redundant final
return ((c.alpha<<24) |
(c.red<<16)|
(c.green<<8)|
Expand Down
13 changes: 7 additions & 6 deletions CodenameOne/src/com/codename1/charts/util/MathHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
package com.codename1.charts.util;

import com.codename1.l10n.ParseException;
import java.util.ArrayList;
import java.util.List;
import com.codename1.util.MathUtil;
import com.codename1.io.Log;
import java.util.ArrayList;
import java.util.List;
import com.codename1.util.MathUtil;


/**
Expand Down Expand Up @@ -87,9 +88,9 @@ public static List<Double> getLabels(final double start, final double end,
// this way, we avoid a label value like 0.4000000000000000001 instead
// of 0.4
z = FORMAT.parseDouble(FORMAT.format(z));
} catch (ParseException e) {
// do nothing here
}
} catch (ParseException e) { // PMD Fix: EmptyCatchBlock log exception
Log.e(e);
}
labels.add(z);
}
return labels;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
import com.codename1.charts.renderers.SimpleSeriesRenderer;
import com.codename1.charts.renderers.XYMultipleSeriesRenderer;
import com.codename1.charts.renderers.XYMultipleSeriesRenderer.Orientation;
import com.codename1.charts.renderers.XYSeriesRenderer;
import com.codename1.charts.renderers.XYSeriesRenderer;
import com.codename1.io.Log;



Expand Down Expand Up @@ -59,9 +60,9 @@ public CombinedXYChart(XYMultipleSeriesDataset dataset, XYMultipleSeriesRenderer
for (int i = 0; i < length; i++) {
try {
mCharts[i] = getXYChart(chartDefinitions[i].getType());
} catch (Exception e) {
// ignore
}
} catch (Exception e) { // PMD Fix: EmptyCatchBlock log exception
Log.e(e);
}
if (mCharts[i] == null) {
throw new IllegalArgumentException("Unknown chart type " + chartDefinitions[i].getType());
} else {
Expand Down
2 changes: 1 addition & 1 deletion CodenameOne/src/com/codename1/charts/views/PointStyle.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public enum PointStyle {
*
* @param name the name
*/
private PointStyle(String name) {
PointStyle(String name) { // PMD Fix: UnnecessaryModifier removed implicit private
mName = name;
}

Expand Down
11 changes: 6 additions & 5 deletions CodenameOne/src/com/codename1/charts/views/RadarChart.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,12 @@ public void draw(Canvas canvas, int x, int y, int width, int height, Paint paint
paint.setColor(ColorUtil.GRAY);
float thisRad = (float) Math.toRadians(90 - currentAngle);
float nextRad = (float) Math.toRadians(90 - (currentAngle + angle));
for (float level = 0; level <= 1f; level += decCoef) {
float thisX = (float) (centerX - Math.sin(thisRad) * radius * level);
float thisY = (float) (centerY - Math.cos(thisRad) * radius * level);
float nextX = (float) (centerX - Math.sin(nextRad) * radius * level);
float nextY = (float) (centerY - Math.cos(nextRad) * radius * level);
for (double level = 0; level <= 1d; level += decCoef) { // PMD Fix: DontUseFloatTypeForLoopIndices switched to double
float levelFactor = (float) level;
float thisX = (float) (centerX - Math.sin(thisRad) * radius * levelFactor);
float thisY = (float) (centerY - Math.cos(thisRad) * radius * levelFactor);
float nextX = (float) (centerX - Math.sin(nextRad) * radius * levelFactor);
float nextY = (float) (centerY - Math.cos(nextRad) * radius * levelFactor);
canvas.drawLine(thisX, thisY, nextX, nextY, paint);
}
canvas.drawLine(centerX, centerY, centerX - (float) Math.sin(thisRad) * radius, centerY - (float) Math.cos(thisRad) * radius, paint);
Expand Down
31 changes: 16 additions & 15 deletions CodenameOne/src/com/codename1/charts/views/TimeChart.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.codename1.charts.compat.Canvas;
import com.codename1.charts.compat.Paint;

import com.codename1.charts.models.XYMultipleSeriesDataset;
import com.codename1.charts.models.XYSeries;
import com.codename1.charts.renderers.XYMultipleSeriesRenderer;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.codename1.charts.compat.Canvas;
import com.codename1.charts.compat.Paint;

import com.codename1.charts.models.XYMultipleSeriesDataset;
import com.codename1.charts.models.XYSeries;
import com.codename1.charts.renderers.XYMultipleSeriesRenderer;
import com.codename1.io.Log;
import java.util.Calendar;
import java.util.TimeZone;

Expand Down Expand Up @@ -143,12 +144,12 @@ protected void drawXLabels(List<Double> xLabels, Double[] xTextLabelLocations, C
private DateFormat getDateFormat(double start, double end) {
if (mDateFormat != null) {
SimpleDateFormat format = null;
try {
format = new SimpleDateFormat(mDateFormat);
return format;
} catch (Exception e) {
// do nothing here
}
try {
format = new SimpleDateFormat(mDateFormat);
return format;
} catch (Exception e) { // PMD Fix: EmptyCatchBlock log exception
Log.e(e);
}
}
DateFormat format = SimpleDateFormat.getDateInstance(SimpleDateFormat.MEDIUM);
double diff = end - start;
Expand Down
Loading
Loading