Changeset 9975 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2016-03-13T00:27:11+01:00 (8 years ago)
Author:
Don-vip
Message:

sonar - make some final fields static too, use Collection.isEmpty(), remove useless cast

Location:
trunk/src/org/openstreetmap/josm
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/corrector/TagCorrector.java

    r9067 r9975  
    4646    public abstract Collection<Command> execute(P oldprimitive, P primitive) throws UserCancelException;
    4747
    48     private final String[] applicationOptions = new String[] {
     48    private static final String[] APPLICATION_OPTIONS = new String[] {
    4949            tr("Apply selected changes"),
    5050            tr("Do not apply changes"),
     
    133133                    JOptionPane.PLAIN_MESSAGE,
    134134                    null,
    135                     applicationOptions,
    136                     applicationOptions[0]
     135                    APPLICATION_OPTIONS,
     136                    APPLICATION_OPTIONS[0]
    137137            );
    138138
  • trunk/src/org/openstreetmap/josm/data/osm/Storage.java

    r9703 r9975  
    9191    private int size;
    9292    private volatile int modCount;
    93     private final double loadFactor = 0.6d;
     93    private static final double LOAD_FACTOR = 0.6d;
    9494    private static final int DEFAULT_CAPACITY = 16;
    9595    private final boolean safeIterator;
     
    143143    public Storage(Hash<? super T, ? super T> ha, int capacity, boolean safeIterator) {
    144144        this.hash = ha;
    145         int cap = 1 << (int) (Math.ceil(Math.log(capacity/loadFactor) / Math.log(2)));
     145        int cap = 1 << (int) (Math.ceil(Math.log(capacity/LOAD_FACTOR) / Math.log(2)));
    146146        @SuppressWarnings("unchecked") T[] newData = (T[]) new Object[cap];
    147147        data = newData;
     
    328328
    329329    private void ensureSpace() {
    330         if (size > data.length*loadFactor) { // rehash
     330        if (size > data.length*LOAD_FACTOR) { // rehash
    331331            @SuppressWarnings("unchecked") T[] big = (T[]) new Object[data.length * 2];
    332332            int nMask = big.length - 1;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/FilterDialog.java

    r9941 r9975  
    9898            KeyEvent.VK_H, Shortcut.ALT_CTRL);
    9999
    100     protected final String[] columnToolTips = {
     100    protected static final String[] COLUMN_TOOLTIPS = {
    101101            Main.platform.makeTooltip(tr("Enable filter"), ENABLE_FILTER_SHORTCUT),
    102102            Main.platform.makeTooltip(tr("Hiding filter"), HIDING_FILTER_SHORTCUT),
     
    116116                        int index = columnModel.getColumnIndexAtX(p.x);
    117117                        int realIndex = columnModel.getColumn(index).getModelIndex();
    118                         return columnToolTips[realIndex];
     118                        return COLUMN_TOOLTIPS[realIndex];
    119119                    }
    120120                };
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java

    r9926 r9975  
    888888        @Override
    889889        public boolean supportLayers(List<Layer> layers) {
    890             if (layers.size() < 1) {
     890            if (layers.isEmpty()) {
    891891                return false;
    892892            } else {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/StyleCache.java

    r9770 r9975  
    2121
    2222    @SuppressWarnings("unchecked")
    23     private final DividedScale<StyleElementList>[] states = (DividedScale<StyleElementList>[]) new DividedScale[2];
     23    private final DividedScale<StyleElementList>[] states = new DividedScale[2];
    2424
    2525    private StyleCache(StyleCache sc) {
Note: See TracChangeset for help on using the changeset viewer.