it.unimi.dsi.fastutil.longs.Long2ObjectArrayMap Java Examples
The following examples show how to use
it.unimi.dsi.fastutil.longs.Long2ObjectArrayMap.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RightNodeMetadataLeftIndexedMultiSegmentBipartiteGraphTest.java From GraphJet with Apache License 2.0 | 5 votes |
private void testGraph(RightNodeMetadataLeftIndexedMultiSegmentBipartiteGraph multiSegmentPowerLawBipartiteGraph) { assertEquals(3, multiSegmentPowerLawBipartiteGraph.getLeftNodeDegree(1)); assertEquals(2, multiSegmentPowerLawBipartiteGraph.getLeftNodeDegree(2)); assertEquals(1, multiSegmentPowerLawBipartiteGraph.getLeftNodeDegree(3)); assertEquals(3, multiSegmentPowerLawBipartiteGraph.getLeftNodeDegree(4)); Long2ObjectArrayMap long2IntArrayMap = new Long2ObjectArrayMap<IntArrayList>(); int[] array11 = {1, 1, 0, 0, 2, 3, 0}; // one like, one retweet int[] array12 = {1, 0, 0, 1, 2, 3, 0}; // one retweet, one reply int[] array13 = {0, 0, 2, 0, 2, 3, 0}; // two quotes int[] array21 = {0, 0, 1, 0, 2, 3, 0}; // one quote int[] array22 = {0, 0, 0, 1, 2, 3, 0}; // one reply int[] array31 = {1, 0, 0, 0, 2, 3, 0}; // one retweet long2IntArrayMap.put(11, new IntArrayList(array11)); long2IntArrayMap.put(12, new IntArrayList(array12)); long2IntArrayMap.put(13, new IntArrayList(array13)); long2IntArrayMap.put(21, new IntArrayList(array21)); long2IntArrayMap.put(22, new IntArrayList(array22)); long2IntArrayMap.put(31, new IntArrayList(array31)); for (int i = 1; i <= 3; i++) { EdgeIterator edgeIterator = multiSegmentPowerLawBipartiteGraph.getLeftNodeEdges(i); while (edgeIterator.hasNext()) { long rightNode = edgeIterator.nextLong(); int[] metadata = new int[FEATURE_SIZE + NUM_INTEGER_TO_UNPACK_SHORT]; ((RightNodeMetadataMultiSegmentIterator) edgeIterator).fetchFeatureArrayForNode(rightNode, 0, metadata, NUM_INTEGER_TO_UNPACK_SHORT); assertEquals(long2IntArrayMap.get(rightNode), new IntArrayList(metadata)); } } }
Example #2
Source File: OrderBooks.java From parity with Apache License 2.0 | 5 votes |
OrderBooks(List<String> instruments, MarketData marketData, MarketReporting marketReporting) { this.books = new Long2ObjectArrayMap<>(); this.orders = new Long2ObjectOpenHashMap<>(); EventHandler handler = new EventHandler(); for (String instrument : instruments) books.put(ASCII.packLong(instrument), new OrderBook(handler)); this.marketData = marketData; this.marketReporting = marketReporting; this.nextOrderNumber = 1; this.nextMatchNumber = 1; }
Example #3
Source File: Market.java From parity with Apache License 2.0 | 5 votes |
/** * Create a market. * * @param listener a listener for outbound events from the market */ public Market(MarketListener listener) { this.books = new Long2ObjectArrayMap<>(); this.orders = new Long2ObjectOpenHashMap<>(); this.listener = listener; }