Java 类com.google.common.collect.ImmutableTable.Builder 实例源码

项目:RuneCraftery    文件:GameData.java   
public static void buildModObjectTable()
{
    if (modObjectTable != null)
    {
        throw new IllegalStateException("Illegal call to buildModObjectTable!");
    }

    Map<Integer, Cell<String, String, Integer>> map = Maps.transformValues(idMap, new Function<ItemData,Cell<String,String,Integer>>() {
        public Cell<String,String,Integer> apply(ItemData data)
        {
            if ("Minecraft".equals(data.getModId()) || !data.isOveridden())
            {
                return null;
            }
            return Tables.immutableCell(data.getModId(), data.getItemType(), data.getItemId());
        }
    });

    Builder<String, String, Integer> tBuilder = ImmutableTable.builder();
    for (Cell<String, String, Integer> c : map.values())
    {
        if (c!=null)
        {
            tBuilder.put(c);
        }
    }
    modObjectTable = tBuilder.build();
}
项目:RuneCraftery    文件:GameData.java   
public static void dumpRegistry(File minecraftDir)
{
    if (customItemStacks == null)
    {
        return;
    }
    if (Boolean.valueOf(System.getProperty("fml.dumpRegistry", "false")).booleanValue())
    {
        ImmutableListMultimap.Builder<String, String> builder = ImmutableListMultimap.builder();
        for (String modId : customItemStacks.rowKeySet())
        {
            builder.putAll(modId, customItemStacks.row(modId).keySet());
        }

        File f = new File(minecraftDir, "itemStackRegistry.csv");
        MapJoiner mapJoiner = Joiner.on("\n").withKeyValueSeparator(",");
        try
        {
            Files.write(mapJoiner.join(builder.build().entries()), f, Charsets.UTF_8);
            FMLLog.log(Level.INFO, "Dumped item registry data to %s", f.getAbsolutePath());
        }
        catch (IOException e)
        {
            FMLLog.log(Level.SEVERE, e, "Failed to write registry data to %s", f.getAbsolutePath());
        }
    }
}
项目:RuneCraftery    文件:GameData.java   
public static void buildModObjectTable()
{
    if (modObjectTable != null)
    {
        throw new IllegalStateException("Illegal call to buildModObjectTable!");
    }

    Map<Integer, Cell<String, String, Integer>> map = Maps.transformValues(idMap, new Function<ItemData,Cell<String,String,Integer>>() {
        public Cell<String,String,Integer> apply(ItemData data)
        {
            if ("Minecraft".equals(data.getModId()) || !data.isOveridden())
            {
                return null;
            }
            return Tables.immutableCell(data.getModId(), data.getItemType(), data.getItemId());
        }
    });

    Builder<String, String, Integer> tBuilder = ImmutableTable.builder();
    for (Cell<String, String, Integer> c : map.values())
    {
        if (c!=null)
        {
            tBuilder.put(c);
        }
    }
    modObjectTable = tBuilder.build();
}
项目:RuneCraftery    文件:GameData.java   
public static void dumpRegistry(File minecraftDir)
{
    if (customItemStacks == null)
    {
        return;
    }
    if (Boolean.valueOf(System.getProperty("fml.dumpRegistry", "false")).booleanValue())
    {
        ImmutableListMultimap.Builder<String, String> builder = ImmutableListMultimap.builder();
        for (String modId : customItemStacks.rowKeySet())
        {
            builder.putAll(modId, customItemStacks.row(modId).keySet());
        }

        File f = new File(minecraftDir, "itemStackRegistry.csv");
        MapJoiner mapJoiner = Joiner.on("\n").withKeyValueSeparator(",");
        try
        {
            Files.write(mapJoiner.join(builder.build().entries()), f, Charsets.UTF_8);
            FMLLog.log(Level.INFO, "Dumped item registry data to %s", f.getAbsolutePath());
        }
        catch (IOException e)
        {
            FMLLog.log(Level.SEVERE, e, "Failed to write registry data to %s", f.getAbsolutePath());
        }
    }
}
项目:BetterNutritionMod    文件:GameData.java   
public static void buildModObjectTable()
{
    if (modObjectTable != null)
    {
        throw new IllegalStateException("Illegal call to buildModObjectTable!");
    }

    Map<Integer, Cell<String, String, Integer>> map = Maps.transformValues(idMap, new Function<ItemData,Cell<String,String,Integer>>() {
        public Cell<String,String,Integer> apply(ItemData data)
        {
            if ("Minecraft".equals(data.getModId()) || !data.isOveridden())
            {
                return null;
            }
            return Tables.immutableCell(data.getModId(), data.getItemType(), data.getItemId());
        }
    });

    Builder<String, String, Integer> tBuilder = ImmutableTable.builder();
    for (Cell<String, String, Integer> c : map.values())
    {
        if (c!=null)
        {
            tBuilder.put(c);
        }
    }
    modObjectTable = tBuilder.build();
}
项目:BetterNutritionMod    文件:GameData.java   
public static void dumpRegistry(File minecraftDir)
{
    if (customItemStacks == null)
    {
        return;
    }
    if (Boolean.valueOf(System.getProperty("fml.dumpRegistry", "false")).booleanValue())
    {
        ImmutableListMultimap.Builder<String, String> builder = ImmutableListMultimap.builder();
        for (String modId : customItemStacks.rowKeySet())
        {
            builder.putAll(modId, customItemStacks.row(modId).keySet());
        }

        File f = new File(minecraftDir, "itemStackRegistry.csv");
        MapJoiner mapJoiner = Joiner.on("\n").withKeyValueSeparator(",");
        try
        {
            Files.write(mapJoiner.join(builder.build().entries()), f, Charsets.UTF_8);
            FMLLog.log(Level.INFO, "Dumped item registry data to %s", f.getAbsolutePath());
        }
        catch (IOException e)
        {
            FMLLog.log(Level.SEVERE, e, "Failed to write registry data to %s", f.getAbsolutePath());
        }
    }
}