void addEquation(IdEquation equation) { size++; IdResult rhs = equation.rhs; if (rhs instanceof IdFinal) { solved.put(equation.id, ((IdFinal) rhs).value); moving.push(equation.id); } else if (rhs instanceof IdPending) { IdPending pendResult = ((IdPending) rhs).copy(); IdResult norm = normalize(pendResult.delta); if (norm instanceof IdFinal) { solved.put(equation.id, ((IdFinal) norm).value); moving.push(equation.id); } else { IdPending pendResult1 = ((IdPending) rhs).copy(); for (IntIdComponent component : pendResult1.delta) { for (long trigger : component.ids) { TLongHashSet set = dependencies.get(trigger); if (set == null) { set = new TLongHashSet(); dependencies.put(trigger, set); } set.add(equation.id); } pending.put(equation.id, pendResult1); } } } }
public void testP2OMap() { // Long-long TLongObjectHashMap<Long> lomap = new TLongObjectHashMap<Long>(); assertTrue(serializesCorrectly(lomap, "p2o-l-1")); lomap.put(0, Long.valueOf(1)); assertTrue(serializesCorrectly(lomap, "p2o-l-2")); lomap.put(Long.MIN_VALUE, Long.valueOf(Long.MIN_VALUE)); assertTrue(serializesCorrectly(lomap, "p2o-l-3")); lomap.put(Long.MAX_VALUE, Long.valueOf(Long.MAX_VALUE)); assertTrue(serializesCorrectly(lomap, "p2o-l-4")); // Int-int TIntObjectHashMap<Integer> iomap = new TIntObjectHashMap<Integer>(); assertTrue(serializesCorrectly(iomap, "p2o-i-1")); iomap.put(0, Integer.valueOf(1)); assertTrue(serializesCorrectly(iomap, "p2o-i-2")); iomap.put(Integer.MIN_VALUE, Integer.valueOf(Integer.MIN_VALUE)); assertTrue(serializesCorrectly(iomap, "p2o-i-3")); iomap.put(Integer.MAX_VALUE, Integer.valueOf(Integer.MAX_VALUE)); assertTrue(serializesCorrectly(iomap, "p2o-i-4")); // Double-double TDoubleObjectHashMap<Double> domap = new TDoubleObjectHashMap<Double>(); assertTrue(serializesCorrectly(domap, "p2o-d-1")); domap.put(0, Double.valueOf(1)); assertTrue(serializesCorrectly(domap, "p2o-d-2")); domap.put(Double.MIN_VALUE, Double.valueOf(Double.MIN_VALUE)); assertTrue(serializesCorrectly(domap, "p2o-d-3")); domap.put(Double.MAX_VALUE, Double.valueOf(Double.MAX_VALUE)); assertTrue(serializesCorrectly(domap, "p2o-d-4")); domap.put(Double.POSITIVE_INFINITY, Double.valueOf(Double.POSITIVE_INFINITY)); assertTrue(serializesCorrectly(domap, "p2o-d-5")); domap.put(Double.NEGATIVE_INFINITY, Double.valueOf(Double.NEGATIVE_INFINITY)); assertTrue(serializesCorrectly(domap, "p2o-d-6")); // NOTE: trove doesn't deal well with NaN // ddmap.put( Double.NaN, Double.NaN ); // assertTrue( serializesCorrectly( ddmap ) ); // Float-float TFloatObjectHashMap<Float> fomap = new TFloatObjectHashMap<Float>(); assertTrue(serializesCorrectly(fomap, "p2o-f-1")); fomap.put(0, Float.valueOf(1)); assertTrue(serializesCorrectly(fomap, "p2o-f-2")); fomap.put(Float.MIN_VALUE, Float.valueOf(Float.MIN_VALUE)); assertTrue(serializesCorrectly(fomap, "p2o-f-3")); fomap.put(Float.MAX_VALUE, Float.valueOf(Float.MAX_VALUE)); assertTrue(serializesCorrectly(fomap, "p2o-f-4")); fomap.put(Float.POSITIVE_INFINITY, Float.valueOf(Float.POSITIVE_INFINITY)); assertTrue(serializesCorrectly(fomap, "p2o-f-5")); fomap.put(Float.NEGATIVE_INFINITY, Float.valueOf(Float.NEGATIVE_INFINITY)); assertTrue(serializesCorrectly(fomap, "p2o-f-6")); // NOTE: trove doesn't deal well with NaN // ffmap.put( Float.NaN, Float.NaN ); // assertTrue( serializesCorrectly( ffmap ) ); }
public SNode put(SNodeId key, SNode value) { if (key instanceof Regular) { return myRegularMap.put(((Regular) key).getId(), value); } else if (key instanceof Foreign) { return myForeignMap.put(((Foreign) key).getId(), value); } else { return myOtherMap.put(key, value); } }
@Override public SNode put(SNodeId key, SNode value) { if (!(key instanceof Regular)) { LOG.error( "Trying to add node with id class " + key.getClass().getName() + " to a regular model"); return null; } return myRegularMap.put(((Regular) key).getId(), value); }
@Override public void setItemName(Material item, short data, String name) { customNames.put(toLong(item.getId(), data), name); for (Player player : Bukkit.getServer().getOnlinePlayers()) { if (player instanceof SpoutCraftPlayer) { if (((SpoutPlayer) player).isSpoutCraftEnabled()) { ((SpoutPlayer) player).sendPacket(new PacketItemName(item.getId(), data, name)); } } } }
@Override public void setCustomBlockDesign(Integer blockId, Integer metaData, BlockDesign design) { Player[] players = Spout.getInstance().getServer().getOnlinePlayers(); long info = toLong(blockId, metaData); if (design != null) { customBlockDesigns.put(info, design); } else { customBlockDesigns.remove(info); } updateCustomBlockDesigns(players, info, design); }
TLongObjectHashMap<Value> solve() { while (!moving.empty()) { long id = moving.pop(); Value value = solved.get(id); boolean stable = id > 0; long[] pIds = stable ? new long[] {id, -id} : new long[] {-id, id}; Value[] pVals = stable ? new Value[] {value, value} : new Value[] {value, lattice.top}; for (int i = 0; i < pIds.length; i++) { long pId = pIds[i]; Value pVal = pVals[i]; TLongHashSet dIds = dependencies.get(pId); if (dIds == null) { continue; } TLongIterator dIdsIterator = dIds.iterator(); while (dIdsIterator.hasNext()) { long dId = dIdsIterator.next(); IdPending pend = pending.remove(dId); if (pend != null) { IdResult pend1 = substitute(pend, pId, pVal); if (pend1 instanceof IdFinal) { IdFinal fi = (IdFinal) pend1; solved.put(dId, fi.value); moving.push(dId); } else { pending.put(dId, (IdPending) pend1); } } } } } pending.clear(); return solved; }
@Override public void setItemTexture(Material item, short data, Plugin plugin, String texture) { String pluginName; if (plugin == null) { pluginName = null; } else { pluginName = plugin.getDescription().getName(); } long newKey = toLong(item.getId(), data); customTextures.put(newKey, texture); if (pluginName == null) { customTexturesPlugin.remove(newKey); } else { customTexturesPlugin.put(newKey, pluginName); } for (Player player : Bukkit.getServer().getOnlinePlayers()) { if (player instanceof SpoutCraftPlayer) { if (((SpoutPlayer) player).isSpoutCraftEnabled()) { ((SpoutPlayer) player) .sendPacket(new PacketItemTexture(item.getId(), data, pluginName, texture)); } } } }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { // VERSION in.readByte(); // NUMBER OF ENTRIES int size = in.readInt(); setUp(size); // ENTRIES while (size-- > 0) { long key = in.readLong(); V val = (V) in.readObject(); put(key, val); } }
public void addMethodInfo(MethodInfo info) { methodInfos.put(info.getHash(), info); }
public SimpleItemManager() { itemNames.put(toLong(1), "Stone"); itemNames.put(toLong(2), "Grass"); itemNames.put(toLong(3), "Dirt"); itemNames.put(toLong(4), "Cobblestone"); itemNames.put(toLong(5), "Wooden Planks"); itemNames.put(toLong(6, 0), "Sapling"); itemNames.put(toLong(6, 1), "Spruce Sapling"); itemNames.put(toLong(6, 2), "Birch Sapling"); itemNames.put(toLong(7), "Bedrock"); itemNames.put(toLong(8), "Water"); itemNames.put(toLong(9), "Stationary Water"); itemNames.put(toLong(10), "Lava"); itemNames.put(toLong(11), "Stationary Lava"); itemNames.put(toLong(12), "Sand"); itemNames.put(toLong(13), "Gravel"); itemNames.put(toLong(14), "Gold Ore"); itemNames.put(toLong(15), "Iron Ore"); itemNames.put(toLong(16), "Coal Ore"); itemNames.put(toLong(17), "Wood"); itemNames.put(toLong(18), "Leaves"); itemNames.put(toLong(19), "Spone"); itemNames.put(toLong(20), "Glass"); itemNames.put(toLong(21), "Lapis Lazuli Ore"); itemNames.put(toLong(22), "Lapis Lazuli Block"); itemNames.put(toLong(23), "Dispenser"); itemNames.put(toLong(24), "SandStone"); itemNames.put(toLong(25), "Note Block"); itemNames.put(toLong(26), "Bed"); itemNames.put(toLong(27), "Powered Rail"); itemNames.put(toLong(28), "Detector Rail"); itemNames.put(toLong(29), "Sticky Piston"); itemNames.put(toLong(30), "Cobweb"); itemNames.put(toLong(31, 0), "Dead Grass"); itemNames.put(toLong(31, 1), "Tall Grass"); itemNames.put(toLong(31, 2), "Fern"); itemNames.put(toLong(32), "Dead Shrubs"); itemNames.put(toLong(33), "Piston"); itemNames.put(toLong(34), "Piston (Head)"); itemNames.put(toLong(35, 0), "Wool"); itemNames.put(toLong(35, 1), "Orange Wool"); itemNames.put(toLong(35, 2), "Magenta Wool"); itemNames.put(toLong(35, 3), "Light Blue Wool"); itemNames.put(toLong(35, 4), "Yellow Wool"); itemNames.put(toLong(35, 5), "Light Green Wool"); itemNames.put(toLong(35, 6), "Pink Wool"); itemNames.put(toLong(35, 7), "Gray Wool"); itemNames.put(toLong(35, 8), "Light Gray Wool"); itemNames.put(toLong(35, 9), "Cyan Wool"); itemNames.put(toLong(35, 10), "Purple Wool"); itemNames.put(toLong(35, 11), "Blue Wool"); itemNames.put(toLong(35, 12), "Brown Wool"); itemNames.put(toLong(35, 13), "Dark Green Wool"); itemNames.put(toLong(35, 14), "Red Wool"); itemNames.put(toLong(35, 15), "Black Wool"); itemNames.put(toLong(37), "Dandelion"); itemNames.put(toLong(38), "Rose"); itemNames.put(toLong(39), "Brown Mushroom"); itemNames.put(toLong(40), "Red Mushroom"); itemNames.put(toLong(41), "Gold Block"); itemNames.put(toLong(42), "Iron Block"); itemNames.put(toLong(43, 0), "Stone Double Slab"); itemNames.put(toLong(43, 1), "Sandstone Double Slabs"); itemNames.put(toLong(43, 2), "Wooden Double Slabs"); itemNames.put(toLong(43, 3), "Stone Double Slabs"); itemNames.put(toLong(43, 4), "Brick Double Slabs"); itemNames.put(toLong(43, 5), "Stone Brick Double Slabs"); itemNames.put(toLong(44, 0), "Stone Slab"); itemNames.put(toLong(44, 1), "Sandstone Slab"); itemNames.put(toLong(44, 2), "Wooden Slab"); itemNames.put(toLong(44, 3), "Stone Slab"); itemNames.put(toLong(44, 4), "Brick Slab"); itemNames.put(toLong(44, 5), "Stone Brick Slab"); itemNames.put(toLong(45), "Brick Block"); itemNames.put(toLong(46), "TNT"); itemNames.put(toLong(47), "Bookshelf"); itemNames.put(toLong(48), "Moss Stone"); itemNames.put(toLong(49), "Obsidian"); itemNames.put(toLong(50), "Torch"); itemNames.put(toLong(51), "Fire"); itemNames.put(toLong(52), "Monster Spawner"); itemNames.put(toLong(53), "Wooden Stairs"); itemNames.put(toLong(54), "Chest"); itemNames.put(toLong(55), "Redstone Wire"); itemNames.put(toLong(56), "Diamond Ore"); itemNames.put(toLong(57), "Diamond Block"); itemNames.put(toLong(58), "Crafting Table"); itemNames.put(toLong(59), "Seeds"); itemNames.put(toLong(60), "Farmland"); itemNames.put(toLong(61), "Furnace"); itemNames.put(toLong(62), "Burning Furnace"); itemNames.put(toLong(63), "Sign Post"); itemNames.put(toLong(64), "Wooden Door"); itemNames.put(toLong(65), "Ladders"); itemNames.put(toLong(66), "Rails"); itemNames.put(toLong(67), "Cobblestone Stairs"); itemNames.put(toLong(68), "Wall Sign"); itemNames.put(toLong(69), "Lever"); itemNames.put(toLong(70), "Stone Pressure Plate"); itemNames.put(toLong(71), "Iron Door"); itemNames.put(toLong(72), "Wooden Pressure Plate"); itemNames.put(toLong(73), "Redstone Ore"); itemNames.put(toLong(74), "Glowing Redstone Ore"); itemNames.put(toLong(75), "Redstone Torch"); itemNames.put(toLong(76), "Redstone Torch (On)"); itemNames.put(toLong(77), "Stone Button"); itemNames.put(toLong(78), "Snow"); itemNames.put(toLong(79), "Ice"); itemNames.put(toLong(80), "Snow Block"); itemNames.put(toLong(81), "Cactus"); itemNames.put(toLong(82), "Clay Block"); itemNames.put(toLong(83), "Sugar Cane"); itemNames.put(toLong(84), "Jukebox"); itemNames.put(toLong(85), "Fence"); itemNames.put(toLong(86), "Pumpkin"); itemNames.put(toLong(87), "Netherrack"); itemNames.put(toLong(88), "Soul Sand"); itemNames.put(toLong(89), "Glowstone Block"); itemNames.put(toLong(90), "Portal"); itemNames.put(toLong(91), "Jack 'o' Lantern"); itemNames.put(toLong(92), "Cake Block"); itemNames.put(toLong(93), "Redstone Repeater"); itemNames.put(toLong(94), "Redstone Repeater (On)"); itemNames.put(toLong(95), "Locked Chest"); itemNames.put(toLong(96), "Trapdoor"); itemNames.put(toLong(97), "Silverfish Stone"); itemNames.put(toLong(98), "Stone Brick"); itemNames.put(toLong(99), "Huge Red Mushroom"); itemNames.put(toLong(100), "Huge Brown Mushroom"); itemNames.put(toLong(101), "Iron Bars"); itemNames.put(toLong(102), "Glass Pane"); itemNames.put(toLong(103), "Watermelon"); itemNames.put(toLong(104), "Pumpkin Stem"); itemNames.put(toLong(105), "Melon Stem"); itemNames.put(toLong(106), "Vines"); itemNames.put(toLong(107), "Fence Gate"); itemNames.put(toLong(108), "Brick Stairs"); itemNames.put(toLong(109), "Stone Brick Stairs"); itemNames.put(toLong(256), "Iron Shovel"); itemNames.put(toLong(257), "Iron Pickaxe"); itemNames.put(toLong(258), "Iron Axe"); itemNames.put(toLong(259), "Flint and Steel"); itemNames.put(toLong(260), "Apple"); itemNames.put(toLong(261), "Bow"); itemNames.put(toLong(262), "Arrow"); itemNames.put(toLong(263, 0), "Coal"); itemNames.put(toLong(263, 1), "Charcoal"); itemNames.put(toLong(264), "Diamond"); itemNames.put(toLong(265), "Iron Ingot"); itemNames.put(toLong(266), "Gold Ingot"); itemNames.put(toLong(267), "Iron Sword"); itemNames.put(toLong(268), "Wooden Sword"); itemNames.put(toLong(269), "Wooden Shovel"); itemNames.put(toLong(270), "Wooden Pickaxe"); itemNames.put(toLong(271), "Wooden Axe"); itemNames.put(toLong(272), "Stone Sword"); itemNames.put(toLong(273), "Stone Shovel"); itemNames.put(toLong(274), "Stone Pickaxe"); itemNames.put(toLong(275), "Stone Axe"); itemNames.put(toLong(276), "Diamond Sword"); itemNames.put(toLong(277), "Diamond Shovel"); itemNames.put(toLong(278), "Diamond Pickaxe"); itemNames.put(toLong(279), "Diamond Axe"); itemNames.put(toLong(280), "Stick"); itemNames.put(toLong(281), "Bowl"); itemNames.put(toLong(282), "Mushroom Soup"); itemNames.put(toLong(283), "Gold Sword"); itemNames.put(toLong(284), "Gold Shovel"); itemNames.put(toLong(285), "Gold Pickaxe"); itemNames.put(toLong(286), "Gold Axe"); itemNames.put(toLong(287), "String"); itemNames.put(toLong(288), "Feather"); itemNames.put(toLong(289), "Gunpowder"); itemNames.put(toLong(290), "Wooden Hoe"); itemNames.put(toLong(291), "Stone Hoe"); itemNames.put(toLong(292), "Iron Hoe"); itemNames.put(toLong(293), "Diamond Hoe"); itemNames.put(toLong(294), "Gold Hoe"); itemNames.put(toLong(295), "Seeds"); itemNames.put(toLong(296), "Wheat"); itemNames.put(toLong(297), "Bread"); itemNames.put(toLong(298), "Leather Cap"); itemNames.put(toLong(299), "Leather Tunic"); itemNames.put(toLong(300), "Leather Boots"); itemNames.put(toLong(301), "Leather Boots"); itemNames.put(toLong(302), "Chain Helmet"); itemNames.put(toLong(303), "Chain Chestplate"); itemNames.put(toLong(304), "Chain Leggings"); itemNames.put(toLong(305), "Chain Boots"); itemNames.put(toLong(306), "Iron Helmet"); itemNames.put(toLong(307), "Iron Chestplate"); itemNames.put(toLong(308), "Iron Leggings"); itemNames.put(toLong(309), "Iron Boots"); itemNames.put(toLong(310), "Diamond Helmet"); itemNames.put(toLong(311), "Diamond Chestplate"); itemNames.put(toLong(312), "Diamond Leggings"); itemNames.put(toLong(313), "Diamond Boots"); itemNames.put(toLong(314), "Gold Helmet"); itemNames.put(toLong(315), "Gold Chestplate"); itemNames.put(toLong(316), "Gold Leggings"); itemNames.put(toLong(317), "Gold Boots"); itemNames.put(toLong(318), "Flint"); itemNames.put(toLong(319), "Raw Porkchop"); itemNames.put(toLong(320), "Cooked Porkchop"); itemNames.put(toLong(321), "Paintings"); itemNames.put(toLong(322), "Golden Apple"); itemNames.put(toLong(323), "Sign"); itemNames.put(toLong(324), "Wooden Door"); itemNames.put(toLong(325), "Bucket"); itemNames.put(toLong(326), "Water Bucket"); itemNames.put(toLong(327), "Lava Bucket"); itemNames.put(toLong(328), "Minecart"); itemNames.put(toLong(329), "Saddle"); itemNames.put(toLong(330), "Iron Door"); itemNames.put(toLong(331), "Redstone"); itemNames.put(toLong(332), "Snowball"); itemNames.put(toLong(333), "Boat"); itemNames.put(toLong(334), "Leather"); itemNames.put(toLong(335), "Milk"); itemNames.put(toLong(336), "Brick"); itemNames.put(toLong(337), "Clay"); itemNames.put(toLong(338), "Sugar Canes"); itemNames.put(toLong(339), "Paper"); itemNames.put(toLong(340), "Book"); itemNames.put(toLong(341), "Slimeball"); itemNames.put(toLong(342), "Minecart with Chest"); itemNames.put(toLong(343), "Minecart with Furnace"); itemNames.put(toLong(344), "Egg"); itemNames.put(toLong(345), "Compass"); itemNames.put(toLong(346), "Fishing Rod"); itemNames.put(toLong(347), "Clock"); itemNames.put(toLong(348), "Glowstone Dust"); itemNames.put(toLong(349), "Raw Fish"); itemNames.put(toLong(350), "Cooked Fish"); itemNames.put(toLong(351, 0), "Ink Sac"); itemNames.put(toLong(351, 1), "Rose Red"); itemNames.put(toLong(351, 2), "Cactus Green"); itemNames.put(toLong(351, 3), "Cocoa Beans"); itemNames.put(toLong(351, 4), "Lapis Lazuli"); itemNames.put(toLong(351, 5), "Purple Dye"); itemNames.put(toLong(351, 6), "Cyan Dye"); itemNames.put(toLong(351, 7), "Light Gray Dye"); itemNames.put(toLong(351, 8), "Gray Dye"); itemNames.put(toLong(351, 9), "Pink Dye"); itemNames.put(toLong(351, 10), "Lime Dye"); itemNames.put(toLong(351, 11), "Dandelion Yellow"); itemNames.put(toLong(351, 12), "Light Blue Dye"); itemNames.put(toLong(351, 13), "Magenta Dye"); itemNames.put(toLong(351, 14), "Orange Dye"); itemNames.put(toLong(351, 15), "Bone Meal"); itemNames.put(toLong(352), "Bone"); itemNames.put(toLong(353), "Sugar"); itemNames.put(toLong(354), "Cake"); itemNames.put(toLong(355), "Bed"); itemNames.put(toLong(356), "Redstone Repeater"); itemNames.put(toLong(357), "Cookie"); itemNames.put(toLong(358), "Map"); itemNames.put(toLong(359), "Shears"); itemNames.put(toLong(2256), "Music Disc"); itemNames.put(toLong(2257), "Music Disc"); }