Example usage for com.google.common.collect ImmutableList of

List of usage examples for com.google.common.collect ImmutableList of

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableList of.

Prototype

public static <E> ImmutableList<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) 

Source Link

Usage

From source file:com.mapr.stats.bandit.BanditTrainer.java

public static void main(String[] args) throws FileNotFoundException, NoSuchMethodException,
        InvocationTargetException, InstantiationException, IllegalAccessException, InterruptedException {
    int threads = 16;

    if (args.length > 0) {
        threads = Integer.parseInt(args[0]);
    }/*from  w  w  w.j  a v  a  2  s . c o  m*/

    System.out.printf("regret\n");
    ExecutorService ex = Executors.newFixedThreadPool(threads);

    List<Callable<Integer>> tasks = ImmutableList.of(new Callable<Integer>() {
        @Override
        public Integer call() {
            try {
                totalRegret("regret-normal-0.1.tsv", "local-normal-0.1.tsv", 1000, 2, 10000,
                        new GammaNormalBayesFactory(), new NormalDistributionSampler(0.1, new Random()));
                System.out.printf("2\n");
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
            return null;
        }
    }, new Callable<Integer>() {
        @Override
        public Integer call() {
            try {
                totalRegret("regret-epsilon-normal-1.tsv", "local-epsilon-normal-1.tsv", 1000, 2, 10000,
                        new EpsilonGreedyFactory(0.05), new NormalDistributionSampler(1, new Random()));
                System.out.printf("2e\n");
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
            return null;
        }
    },

            new Callable<Integer>() {
                @Override
                public Integer call() {
                    try {
                        totalRegret("regret-normal-1.tsv", "local-normal-1.tsv", 300, 2, 200000,
                                new GammaNormalBayesFactory(), new NormalDistributionSampler(1, new Random()));
                        System.out.printf("normal 1\n");
                    } catch (FileNotFoundException e) {
                        e.printStackTrace();
                    }
                    return null;
                }
            },

            new Callable<Integer>() {
                @Override
                public Integer call() {
                    try {
                        totalRegret("regret-normal-10x0.1.tsv", "local-normal-10x0.1.tsv", 1000, 10, 1000,
                                new GammaNormalBayesFactory(),
                                new NormalDistributionSampler(0.1, new Random()));
                        System.out.printf("10\n");
                    } catch (FileNotFoundException e) {
                        e.printStackTrace();
                    }
                    return null;
                }
            },

            new Callable<Integer>() {
                @Override
                public Integer call() {
                    try {
                        totalRegret("regret-normal-100x0.1.tsv", "local-normal-100x0.1.tsv", 1000, 100, 1000,
                                new GammaNormalBayesFactory(), new NormalDistributionSampler(.1, new Random()));
                        System.out.printf("100\n");
                    } catch (FileNotFoundException e) {
                        e.printStackTrace();
                    }
                    return null;
                }
            },

            new Callable<Integer>() {
                @Override
                public Integer call() {
                    try {
                        totalRegret("regret.tsv", "local.tsv", 1000, 2, 1000, new BetaBayesFactory(),
                                new BinomialDistributionSampler(1, 1, new Random()));
                        System.out.printf("2\n");
                    } catch (FileNotFoundException e) {
                        e.printStackTrace();
                    }
                    return null;
                }
            },

            new Callable<Integer>() {
                @Override
                public Integer call() {
                    try {
                        totalRegret("regret-100.tsv", "local-100.tsv", 1000, 100, 1000, new BetaBayesFactory(),
                                new BinomialDistributionSampler(1, 1, new Random()));
                        System.out.printf("100\n");
                    } catch (FileNotFoundException e) {
                        e.printStackTrace();
                    }
                    return null;
                }
            },

            new Callable<Integer>() {
                @Override
                public Integer call() {
                    try {
                        totalRegret("regret-20.tsv", "local-20.tsv", 1000, 20, 1000, new BetaBayesFactory(),
                                new BinomialDistributionSampler(1, 1, new Random()));
                        System.out.printf("20\n");
                    } catch (FileNotFoundException e) {
                        e.printStackTrace();
                    }
                    return null;
                }
            });
    ex.invokeAll(tasks);
    ex.shutdown();
    System.out.printf("All done");

    //    System.out.printf("error rates\n");
    //    errorRate("errors.tsv");
    //    System.out.printf("commit time\n");
    //    commitTime("commit.tsv", 3000, 0.1, 0.12, 2000);
    //    System.out.printf("done\n");
}

From source file:org.sonar.plugins.core.ExclusionProperties.java

static List<PropertyDefinition> definitions() {
    return ImmutableList.of(PropertyDefinition.builder(CoreProperties.PROJECT_INCLUSIONS_PROPERTY)
            .name("Source File Inclusions").multiValues(true).category(CoreProperties.CATEGORY_EXCLUSIONS)
            .subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS).onQualifiers(Qualifiers.PROJECT).index(3)
            .build(),//from w  w  w.j  a va  2  s .co m
            PropertyDefinition.builder(CoreProperties.PROJECT_TEST_INCLUSIONS_PROPERTY)
                    .name("Test File Inclusions").multiValues(true).category(CoreProperties.CATEGORY_EXCLUSIONS)
                    .subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS).onQualifiers(Qualifiers.PROJECT)
                    .index(5).build(),
            PropertyDefinition.builder(CoreProperties.GLOBAL_EXCLUSIONS_PROPERTY)
                    .name("Global Source File Exclusions").multiValues(true)
                    .category(CoreProperties.CATEGORY_EXCLUSIONS)
                    .subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS).index(0).build(),
            PropertyDefinition.builder(CoreProperties.GLOBAL_TEST_EXCLUSIONS_PROPERTY)
                    .name("Global Test File Exclusions").multiValues(true)
                    .category(CoreProperties.CATEGORY_EXCLUSIONS)
                    .subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS).index(1).build(),
            PropertyDefinition.builder(CoreProperties.PROJECT_EXCLUSIONS_PROPERTY)
                    .name("Source File Exclusions").multiValues(true)
                    .category(CoreProperties.CATEGORY_EXCLUSIONS)
                    .subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS).onQualifiers(Qualifiers.PROJECT)
                    .index(2).build(),
            PropertyDefinition.builder(CoreProperties.PROJECT_TEST_EXCLUSIONS_PROPERTY)
                    .name("Test File Exclusions").multiValues(true).category(CoreProperties.CATEGORY_EXCLUSIONS)
                    .subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS).onQualifiers(Qualifiers.PROJECT)
                    .index(4).build(),
            PropertyDefinition.builder(CoreProperties.CORE_SKIPPED_MODULES_PROPERTY).name("Exclude Modules")
                    .description("Maven artifact ids of modules to exclude.").multiValues(true)
                    .category(CoreProperties.CATEGORY_EXCLUSIONS)
                    .subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS)
                    .onlyOnQualifiers(Qualifiers.PROJECT).index(0).build(),
            PropertyDefinition.builder(CoreProperties.CORE_INCLUDED_MODULES_PROPERTY).name("Include Modules")
                    .description("Maven artifact ids of modules to include.").multiValues(true)
                    .category(CoreProperties.CATEGORY_EXCLUSIONS)
                    .subCategory(CoreProperties.SUBCATEGORY_FILES_EXCLUSIONS)
                    .onlyOnQualifiers(Qualifiers.PROJECT).index(1).build());
}