All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.samples.java.ex.UEC_Sample Maven / Gradle / Ivy

Go to download

An auxiliary findbugs.sourceforge.net plugin for java bug detectors that fall outside the narrow scope of detectors to be packaged with the product itself.

There is a newer version: 7.6.8
Show newest version
package ex;

import java.util.EnumMap;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

@SuppressWarnings("all")
public class UEC_Sample {

    Map fpConcur = new ConcurrentHashMap<>();

    public enum Suite {
        Spades, Hearts, Clubs, Diamonds
    };

    public enum FalsePositive {
        A, B, C
    };

    private final Set wildSuites = new HashSet<>();
    private final EnumSet eWildSuites = EnumSet.noneOf(Suite.class);

    private interface EnumStub {
    }

    public enum EnumWithInf implements EnumStub {
        A, B, C
    };

    public UEC_Sample() {
        wildSuites.add(Suite.Spades);
    }

    public UEC_Sample(Suite s) {
        wildSuites.add(s);
    }

    public Map deal() {
        Map hand = new HashMap<>();
        hand.put(Suite.Spades, new Integer(10));
        hand.put(Suite.Hearts, new Integer(9));

        return hand;
    }

    public EnumMap eDeal() {
        EnumMap hand = new EnumMap(Suite.class);
        hand.put(Suite.Spades, new Integer(10));
        hand.put(Suite.Hearts, new Integer(9));

        return hand;
    }

    public void uecFP() {
        Set testSet = EnumSet.of(FalsePositive.A);

        testSet.add(FalsePositive.B);
    }

    public Set getSuites() {
        return EnumSet. allOf(Suite.class);
    }

    public void uecFP2() {
        Set suites = getSuites();

        suites.add(Suite.Clubs);
    }

    public void fpEnumsWithInf() {
        Set es = new HashSet<>();
        es.add(EnumWithInf.A);
        es.add(EnumWithInf.B);
        es.add(EnumWithInf.C);
    }

    public void fpDontRecommendOnConcurrent(FalsePositive fp) {
        fpConcur.put(fp, Integer.valueOf(1));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy