Make some fields static

A field may be static if it is declared final, and is initialized with a
constant
This commit is contained in:
Nelson A. de Oliveira 2013-08-03 10:09:27 -03:00
parent ca60148431
commit c9dd6c0697
13 changed files with 30 additions and 30 deletions

View file

@ -20,9 +20,9 @@ import org.apache.commons.logging.Log;
public class BinaryRoutePlanner { public class BinaryRoutePlanner {
private final int REVERSE_WAY_RESTRICTION_ONLY = 1024; private static final int REVERSE_WAY_RESTRICTION_ONLY = 1024;
/*private*/ final int STANDARD_ROAD_IN_QUEUE_OVERHEAD = 220; /*private*/ static final int STANDARD_ROAD_IN_QUEUE_OVERHEAD = 220;
/*private */final int STANDARD_ROAD_VISITED_OVERHEAD = 150; /*private*/ static final int STANDARD_ROAD_VISITED_OVERHEAD = 150;
protected static final Log log = PlatformUtil.getLog(BinaryRoutePlanner.class); protected static final Log log = PlatformUtil.getLog(BinaryRoutePlanner.class);

View file

@ -21,8 +21,8 @@ import org.apache.commons.logging.Log;
public class BinaryRoutePlannerOld { public class BinaryRoutePlannerOld {
public static boolean PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST = true; public static boolean PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST = true;
private final int REVERSE_WAY_RESTRICTION_ONLY = 1024; private static final int REVERSE_WAY_RESTRICTION_ONLY = 1024;
private final int STANDARD_ROAD_IN_QUEUE_OVERHEAD = 900; private static final int STANDARD_ROAD_IN_QUEUE_OVERHEAD = 900;
protected static final Log log = PlatformUtil.getLog(BinaryRoutePlannerOld.class); protected static final Log log = PlatformUtil.getLog(BinaryRoutePlannerOld.class);

View file

@ -58,8 +58,8 @@ public class OsmAndLocationProvider implements SensorEventListener {
private final boolean USE_KALMAN_FILTER = true; private static final boolean USE_KALMAN_FILTER = true;
private final float KALMAN_COEFFICIENT = 0.04f; private static final float KALMAN_COEFFICIENT = 0.04f;
float avgValSin = 0; float avgValSin = 0;
float avgValCos = 0; float avgValCos = 0;

View file

@ -43,9 +43,9 @@ public class SQLiteTileSource implements ITileSource {
private int maxZoom = 17; private int maxZoom = 17;
private int baseZoom = 17; //Default base zoom private int baseZoom = 17; //Default base zoom
final int margin = 1; static final int margin = 1;
final int tileSize = 256; static final int tileSize = 256;
final int minScaledSize = 8; static final int minScaledSize = 8;
private ClientContext ctx; private ClientContext ctx;
public SQLiteTileSource(ClientContext ctx, File f, List<TileSourceTemplate> toFindUrl){ public SQLiteTileSource(ClientContext ctx, File f, List<TileSourceTemplate> toFindUrl){
@ -355,7 +355,7 @@ public class SQLiteTileSource implements ITileSource {
db.execSQL("DELETE FROM tiles WHERE x = ? AND y = ? AND z = ?", new String[] {x+"", y+"",(17 - zoom)+""}); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$ db.execSQL("DELETE FROM tiles WHERE x = ? AND y = ? AND z = ?", new String[] {x+"", y+"",(17 - zoom)+""}); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
} }
private final int BUF_SIZE = 1024; private static final int BUF_SIZE = 1024;
/** /**
* Makes method synchronized to give a little more time for get methods and * Makes method synchronized to give a little more time for get methods and

View file

@ -25,8 +25,8 @@ public class DownloadFileHelper {
private final static Log log = PlatformUtil.getLog(DownloadFileHelper.class); private final static Log log = PlatformUtil.getLog(DownloadFileHelper.class);
private static final int BUFFER_SIZE = 32256; private static final int BUFFER_SIZE = 32256;
protected final int TRIES_TO_DOWNLOAD = 15; protected static final int TRIES_TO_DOWNLOAD = 15;
protected final long TIMEOUT_BETWEEN_DOWNLOADS = 8000; protected static final long TIMEOUT_BETWEEN_DOWNLOADS = 8000;
private final ClientContext ctx; private final ClientContext ctx;
private boolean interruptDownloading = false; private boolean interruptDownloading = false;

View file

@ -38,8 +38,8 @@ public class DownloadTracker {
return (new Random(System.currentTimeMillis()).nextInt(100000000) + 100000000) + ""; return (new Random(System.currentTimeMillis()).nextInt(100000000) + 100000000) + "";
} }
final String beaconUrl = "http://www.google-analytics.com/__utm.gif"; static final String beaconUrl = "http://www.google-analytics.com/__utm.gif";
final String analyticsVersion = "4.3"; // Analytics version - AnalyticsVersion static final String analyticsVersion = "4.3"; // Analytics version - AnalyticsVersion
public void trackEvent(ClientContext a, public void trackEvent(ClientContext a,
String category, String action, String label, int value, String trackingAcount) { String category, String action, String label, int value, String trackingAcount) {

View file

@ -54,7 +54,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
private static final Log log = PlatformUtil.getLog(OsmBugsLayer.class); private static final Log log = PlatformUtil.getLog(OsmBugsLayer.class);
private final static int startZoom = 8; private final static int startZoom = 8;
private final int SEARCH_LIMIT = 100; private static final int SEARCH_LIMIT = 100;
private OsmandMapTileView view; private OsmandMapTileView view;
private Handler handlerToLoop; private Handler handlerToLoop;

View file

@ -40,7 +40,7 @@ public class RoutingHelper {
public void routeWasCancelled(); public void routeWasCancelled();
} }
private final float POSITION_TOLERANCE = 60; private static final float POSITION_TOLERANCE = 60;
private List<IRouteInformationListener> listeners = new ArrayList<IRouteInformationListener>(); private List<IRouteInformationListener> listeners = new ArrayList<IRouteInformationListener>();

View file

@ -14,13 +14,13 @@ import net.osmand.util.Algorithms;
public class VoiceRouter { public class VoiceRouter {
private final int STATUS_UTWP_TOLD = -1; private static final int STATUS_UTWP_TOLD = -1;
private final int STATUS_UNKNOWN = 0; private static final int STATUS_UNKNOWN = 0;
private final int STATUS_LONG_PREPARE = 1; private static final int STATUS_LONG_PREPARE = 1;
private final int STATUS_PREPARE = 2; private static final int STATUS_PREPARE = 2;
private final int STATUS_TURN_IN = 3; private static final int STATUS_TURN_IN = 3;
private final int STATUS_TURN = 4; private static final int STATUS_TURN = 4;
private final int STATUS_TOLD = 5; private static final int STATUS_TOLD = 5;
private final RoutingHelper router; private final RoutingHelper router;
private boolean mute = false; private boolean mute = false;

View file

@ -44,9 +44,9 @@ public class ContextMenuLayer extends OsmandMapLayer {
public String getObjectName(Object o); public String getObjectName(Object o);
} }
private final String KEY_LAT_LAN = "context_menu_lat_lon"; private static final String KEY_LAT_LAN = "context_menu_lat_lon";
private final String KEY_DESCRIPTION = "context_menu_description"; private static final String KEY_DESCRIPTION = "context_menu_description";
private final String KEY_SELECTED_OBJECTS = "context_menu_selected_objects"; private static final String KEY_SELECTED_OBJECTS = "context_menu_selected_objects";
private LatLon latLon; private LatLon latLon;
private String description; private String description;
private Map<Object, IContextMenuProvider> selectedObjects = new LinkedHashMap<Object, IContextMenuProvider>(); private Map<Object, IContextMenuProvider> selectedObjects = new LinkedHashMap<Object, IContextMenuProvider>();

View file

@ -18,7 +18,7 @@ import android.widget.Toast;
public class MapTileLayer extends BaseMapLayer { public class MapTileLayer extends BaseMapLayer {
protected final int emptyTileDivisor = 16; protected static final int emptyTileDivisor = 16;
public static final int OVERZOOM_IN = 2; public static final int OVERZOOM_IN = 2;
private final boolean mainMap; private final boolean mainMap;

View file

@ -52,7 +52,7 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
protected final static int LOWEST_ZOOM_TO_ROTATE = 10; protected final static int LOWEST_ZOOM_TO_ROTATE = 10;
protected final int emptyTileDivisor = 16; protected static final int emptyTileDivisor = 16;
public static final float ZOOM_DELTA = 3; public static final float ZOOM_DELTA = 3;
public static final float ZOOM_DELTA_1 = 1/3f; public static final float ZOOM_DELTA_1 = 1/3f;

View file

@ -17,7 +17,7 @@ import android.view.View;
public class MiniMapWidget extends BaseMapWidget { public class MiniMapWidget extends BaseMapWidget {
private float scaleCoefficient = MapInfoLayer.scaleCoefficient; private float scaleCoefficient = MapInfoLayer.scaleCoefficient;
private final float scaleMiniRoute = 0.15f; private static final float scaleMiniRoute = 0.15f;
private final float width = 96 * scaleCoefficient; private final float width = 96 * scaleCoefficient;
private final float height = 96 * scaleCoefficient; private final float height = 96 * scaleCoefficient;
private final float centerMiniRouteY = 3 * height / 4; private final float centerMiniRouteY = 3 * height / 4;