diff --git a/parity-client/pom.xml b/parity-client/pom.xml index 327fb201..6ba33cba 100644 --- a/parity-client/pom.xml +++ b/parity-client/pom.xml @@ -24,6 +24,10 @@ parity-util ${project.version} + + com.paritytrading.foundation + foundation + com.paritytrading.nassau nassau @@ -45,10 +49,6 @@ org.jvirtanen.config config-extras - - org.jvirtanen.lang - lang-extras - org.jvirtanen.util util-extras diff --git a/parity-client/src/main/java/org/jvirtanen/parity/client/command/EnterCommand.java b/parity-client/src/main/java/org/jvirtanen/parity/client/command/EnterCommand.java index 21302d51..f2a8af42 100644 --- a/parity-client/src/main/java/org/jvirtanen/parity/client/command/EnterCommand.java +++ b/parity-client/src/main/java/org/jvirtanen/parity/client/command/EnterCommand.java @@ -1,8 +1,8 @@ package org.jvirtanen.parity.client.command; -import static org.jvirtanen.lang.Strings.*; import static org.jvirtanen.parity.client.TerminalClient.*; +import com.paritytrading.foundation.ASCII; import java.io.IOException; import java.util.NoSuchElementException; import java.util.Scanner; @@ -23,7 +23,7 @@ public EnterCommand(byte side) { public void execute(TerminalClient client, Scanner arguments) throws CommandException, IOException { try { long quantity = arguments.nextInt(); - long instrument = encodeLong(arguments.next()); + long instrument = ASCII.packLong(arguments.next()); long price = (int)(arguments.nextDouble() * PRICE_FACTOR); if (arguments.hasNext()) diff --git a/parity-client/src/main/java/org/jvirtanen/parity/client/event/Order.java b/parity-client/src/main/java/org/jvirtanen/parity/client/event/Order.java index 1c346a9c..508cbf2c 100644 --- a/parity-client/src/main/java/org/jvirtanen/parity/client/event/Order.java +++ b/parity-client/src/main/java/org/jvirtanen/parity/client/event/Order.java @@ -1,8 +1,8 @@ package org.jvirtanen.parity.client.event; -import static org.jvirtanen.lang.Strings.*; import static org.jvirtanen.parity.client.TerminalClient.*; +import com.paritytrading.foundation.ASCII; import org.jvirtanen.parity.util.Timestamps; public class Order { @@ -60,7 +60,7 @@ public long getQuantity() { public String format() { return String.format(LOCALE, "%12s %16s %c %8s %10d %9.2f", Timestamps.format(timestamp / NANOS_PER_MILLI), orderId, side, - decodeLong(instrument), quantity, price / PRICE_FACTOR); + ASCII.unpackLong(instrument), quantity, price / PRICE_FACTOR); } } diff --git a/parity-client/src/main/java/org/jvirtanen/parity/client/event/Trade.java b/parity-client/src/main/java/org/jvirtanen/parity/client/event/Trade.java index ab05e2c4..42c57097 100644 --- a/parity-client/src/main/java/org/jvirtanen/parity/client/event/Trade.java +++ b/parity-client/src/main/java/org/jvirtanen/parity/client/event/Trade.java @@ -1,8 +1,8 @@ package org.jvirtanen.parity.client.event; -import static org.jvirtanen.lang.Strings.*; import static org.jvirtanen.parity.client.TerminalClient.*; +import com.paritytrading.foundation.ASCII; import org.jvirtanen.parity.util.Timestamps; public class Trade { @@ -30,7 +30,7 @@ public long getTimestamp() { public String format() { return String.format(LOCALE, "%12s %16s %c %8s %10d %9.2f", Timestamps.format(timestamp / NANOS_PER_MILLI), order.getOrderId(), order.getSide(), - decodeLong(order.getInstrument()), quantity, price / PRICE_FACTOR); + ASCII.unpackLong(order.getInstrument()), quantity, price / PRICE_FACTOR); } } diff --git a/parity-fix/pom.xml b/parity-fix/pom.xml index 5f324cfb..57fdd356 100644 --- a/parity-fix/pom.xml +++ b/parity-fix/pom.xml @@ -24,6 +24,10 @@ parity-util ${project.version} + + com.paritytrading.foundation + foundation + com.paritytrading.nassau nassau @@ -36,10 +40,6 @@ org.jvirtanen.config config-extras - - org.jvirtanen.lang - lang-extras - org.jvirtanen.util util-extras diff --git a/parity-fix/src/main/java/org/jvirtanen/parity/fix/Session.java b/parity-fix/src/main/java/org/jvirtanen/parity/fix/Session.java index 3e1c40ae..161550e7 100644 --- a/parity-fix/src/main/java/org/jvirtanen/parity/fix/Session.java +++ b/parity-fix/src/main/java/org/jvirtanen/parity/fix/Session.java @@ -3,8 +3,8 @@ import static com.paritytrading.philadelphia.fix44.FIX44Enumerations.*; import static com.paritytrading.philadelphia.fix44.FIX44MsgTypes.*; import static com.paritytrading.philadelphia.fix44.FIX44Tags.*; -import static org.jvirtanen.lang.Strings.*; +import com.paritytrading.foundation.ASCII; import com.paritytrading.nassau.soupbintcp.SoupBinTCP; import com.paritytrading.nassau.soupbintcp.SoupBinTCPClient; import com.paritytrading.nassau.soupbintcp.SoupBinTCPClientStatusListener; @@ -199,7 +199,7 @@ private void newOrderSingle(FIXMessage message) throws IOException { String symbol = symbolValue.asString(); try { - enterOrder.instrument = encodeLong(symbol); + enterOrder.instrument = ASCII.packLong(symbol); } catch (IllegalArgumentException e) { incorrectDataFormatForValue(message, "Expected 'String' in Symbol(55)"); return; diff --git a/parity-net/pom.xml b/parity-net/pom.xml index 87c788d7..c42594e9 100644 --- a/parity-net/pom.xml +++ b/parity-net/pom.xml @@ -14,6 +14,10 @@ Parity Network Protocols + + com.paritytrading.foundation + foundation + com.paritytrading.nassau nassau @@ -23,10 +27,6 @@ junit test - - org.jvirtanen.nio - nio-extras - diff --git a/parity-net/src/main/java/org/jvirtanen/parity/net/pmd/PMD.java b/parity-net/src/main/java/org/jvirtanen/parity/net/pmd/PMD.java index b480b207..b2b9de3a 100644 --- a/parity-net/src/main/java/org/jvirtanen/parity/net/pmd/PMD.java +++ b/parity-net/src/main/java/org/jvirtanen/parity/net/pmd/PMD.java @@ -1,6 +1,6 @@ package org.jvirtanen.parity.net.pmd; -import static org.jvirtanen.nio.ByteBuffers.*; +import static com.paritytrading.foundation.ByteBuffers.*; import java.nio.ByteBuffer; import org.jvirtanen.parity.net.ProtocolMessage; diff --git a/parity-net/src/main/java/org/jvirtanen/parity/net/pmr/PMR.java b/parity-net/src/main/java/org/jvirtanen/parity/net/pmr/PMR.java index 28ad8452..353d0627 100644 --- a/parity-net/src/main/java/org/jvirtanen/parity/net/pmr/PMR.java +++ b/parity-net/src/main/java/org/jvirtanen/parity/net/pmr/PMR.java @@ -1,6 +1,6 @@ package org.jvirtanen.parity.net.pmr; -import static org.jvirtanen.nio.ByteBuffers.*; +import static com.paritytrading.foundation.ByteBuffers.*; import java.nio.ByteBuffer; import org.jvirtanen.parity.net.ProtocolMessage; diff --git a/parity-net/src/main/java/org/jvirtanen/parity/net/poe/POE.java b/parity-net/src/main/java/org/jvirtanen/parity/net/poe/POE.java index 6346da2e..bc9f64c3 100644 --- a/parity-net/src/main/java/org/jvirtanen/parity/net/poe/POE.java +++ b/parity-net/src/main/java/org/jvirtanen/parity/net/poe/POE.java @@ -1,6 +1,6 @@ package org.jvirtanen.parity.net.poe; -import static org.jvirtanen.nio.ByteBuffers.*; +import static com.paritytrading.foundation.ByteBuffers.*; import static org.jvirtanen.parity.net.poe.ByteBuffers.*; import java.nio.ByteBuffer; diff --git a/parity-reporter/pom.xml b/parity-reporter/pom.xml index 47429f4a..25a59bc3 100644 --- a/parity-reporter/pom.xml +++ b/parity-reporter/pom.xml @@ -24,6 +24,10 @@ parity-util ${project.version} + + com.paritytrading.foundation + foundation + com.paritytrading.nassau nassau @@ -36,10 +40,6 @@ org.jvirtanen.config config-extras - - org.jvirtanen.lang - lang-extras - org.jvirtanen.util util-extras diff --git a/parity-reporter/src/main/java/org/jvirtanen/parity/reporter/DisplayFormat.java b/parity-reporter/src/main/java/org/jvirtanen/parity/reporter/DisplayFormat.java index e662de46..34c3f7b4 100644 --- a/parity-reporter/src/main/java/org/jvirtanen/parity/reporter/DisplayFormat.java +++ b/parity-reporter/src/main/java/org/jvirtanen/parity/reporter/DisplayFormat.java @@ -1,7 +1,6 @@ package org.jvirtanen.parity.reporter; -import static org.jvirtanen.lang.Strings.*; - +import com.paritytrading.foundation.ASCII; import org.jvirtanen.parity.net.pmr.PMR; import org.jvirtanen.parity.util.Timestamps; @@ -18,8 +17,8 @@ public DisplayFormat() { @Override public void trade(PMR.Trade message) { printf("%12s %8s %10d %9.2f %8s %8s\n", Timestamps.format(message.timestamp / NANOS_PER_MILLI), - decodeLong(message.instrument), message.quantity, message.price / PRICE_FACTOR, - decodeLong(message.buyer), decodeLong(message.seller)); + ASCII.unpackLong(message.instrument), message.quantity, message.price / PRICE_FACTOR, + ASCII.unpackLong(message.buyer), ASCII.unpackLong(message.seller)); } } diff --git a/parity-reporter/src/main/java/org/jvirtanen/parity/reporter/TSVFormat.java b/parity-reporter/src/main/java/org/jvirtanen/parity/reporter/TSVFormat.java index 69f52d16..04d1915b 100644 --- a/parity-reporter/src/main/java/org/jvirtanen/parity/reporter/TSVFormat.java +++ b/parity-reporter/src/main/java/org/jvirtanen/parity/reporter/TSVFormat.java @@ -1,7 +1,6 @@ package org.jvirtanen.parity.reporter; -import static org.jvirtanen.lang.Strings.*; - +import com.paritytrading.foundation.ASCII; import org.jvirtanen.parity.net.pmr.PMR; import org.jvirtanen.parity.util.Timestamps; @@ -27,12 +26,12 @@ public void trade(PMR.Trade message) { printf("%s\t%d\t%s\t%d\t%.2f\t%s\t%d\t%s\t%d\n", Timestamps.format(message.timestamp / NANOS_PER_MILLI), message.matchNumber, - decodeLong(message.instrument).trim(), + ASCII.unpackLong(message.instrument).trim(), message.quantity, message.price / PRICE_FACTOR, - decodeLong(message.buyer).trim(), + ASCII.unpackLong(message.buyer).trim(), message.buyOrderNumber, - decodeLong(message.seller).trim(), + ASCII.unpackLong(message.seller).trim(), message.sellOrderNumber); } diff --git a/parity-system/pom.xml b/parity-system/pom.xml index 3dbc3c9c..5f5036a7 100644 --- a/parity-system/pom.xml +++ b/parity-system/pom.xml @@ -24,6 +24,10 @@ parity-net ${project.version} + + com.paritytrading.foundation + foundation + com.paritytrading.nassau nassau @@ -40,10 +44,6 @@ org.jvirtanen.config config-extras - - org.jvirtanen.lang - lang-extras - org.jvirtanen.util util-extras diff --git a/parity-system/src/main/java/org/jvirtanen/parity/system/MatchingEngine.java b/parity-system/src/main/java/org/jvirtanen/parity/system/MatchingEngine.java index a5b84875..1b6e86f7 100644 --- a/parity-system/src/main/java/org/jvirtanen/parity/system/MatchingEngine.java +++ b/parity-system/src/main/java/org/jvirtanen/parity/system/MatchingEngine.java @@ -1,7 +1,6 @@ package org.jvirtanen.parity.system; -import static org.jvirtanen.lang.Strings.*; - +import com.paritytrading.foundation.ASCII; import it.unimi.dsi.fastutil.longs.Long2ObjectArrayMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import java.util.List; @@ -41,7 +40,7 @@ public MatchingEngine(List instruments, MarketData marketData, MarketRep EventHandler handler = new EventHandler(); for (String instrument : instruments) - markets.put(encodeLong(instrument), new Market(handler)); + markets.put(ASCII.packLong(instrument), new Market(handler)); this.marketData = marketData; this.marketReporting = marketReporting; diff --git a/parity-system/src/main/java/org/jvirtanen/parity/system/Session.java b/parity-system/src/main/java/org/jvirtanen/parity/system/Session.java index 2670cd26..10d09e52 100644 --- a/parity-system/src/main/java/org/jvirtanen/parity/system/Session.java +++ b/parity-system/src/main/java/org/jvirtanen/parity/system/Session.java @@ -1,7 +1,6 @@ package org.jvirtanen.parity.system; -import static org.jvirtanen.lang.Strings.*; - +import com.paritytrading.foundation.ASCII; import com.paritytrading.nassau.soupbintcp.SoupBinTCP; import com.paritytrading.nassau.soupbintcp.SoupBinTCPServer; import com.paritytrading.nassau.soupbintcp.SoupBinTCPServerStatusListener; @@ -94,7 +93,7 @@ public void loginRequest(SoupBinTCPServer session, SoupBinTCP.LoginRequest paylo close(); } - username = encodeLong(payload.username); + username = ASCII.packLong(payload.username); } @Override diff --git a/parity-ticker/pom.xml b/parity-ticker/pom.xml index 9bf048d7..66d56566 100644 --- a/parity-ticker/pom.xml +++ b/parity-ticker/pom.xml @@ -34,6 +34,10 @@ parity-util ${project.version} + + com.paritytrading.foundation + foundation + com.paritytrading.nassau nassau @@ -46,10 +50,6 @@ org.jvirtanen.config config-extras - - org.jvirtanen.lang - lang-extras - org.jvirtanen.util util-extras diff --git a/parity-ticker/src/main/java/org/jvirtanen/parity/ticker/DisplayFormat.java b/parity-ticker/src/main/java/org/jvirtanen/parity/ticker/DisplayFormat.java index ec33fb3f..b510b038 100644 --- a/parity-ticker/src/main/java/org/jvirtanen/parity/ticker/DisplayFormat.java +++ b/parity-ticker/src/main/java/org/jvirtanen/parity/ticker/DisplayFormat.java @@ -1,7 +1,6 @@ package org.jvirtanen.parity.ticker; -import static org.jvirtanen.lang.Strings.*; - +import com.paritytrading.foundation.ASCII; import it.unimi.dsi.fastutil.longs.Long2ObjectArrayMap; import java.util.List; import java.util.Locale; @@ -29,7 +28,7 @@ public DisplayFormat(List instruments) { trades = new Long2ObjectArrayMap<>(); for (String instrument : instruments) - trades.put(encodeLong(instrument), new Trade()); + trades.put(ASCII.packLong(instrument), new Trade()); printf("\n%s\n", HEADER); } @@ -38,7 +37,7 @@ public DisplayFormat(List instruments) { public void bbo(long instrument, long bidPrice, long bidSize, long askPrice, long askSize) { Trade trade = trades.get(instrument); - printf("%12s %8s ", Timestamps.format(timestampMillis()), decodeLong(instrument)); + printf("%12s %8s ", Timestamps.format(timestampMillis()), ASCII.unpackLong(instrument)); if (bidSize != 0) printf("%9.2f %10d ", bidPrice / PRICE_FACTOR, bidSize); diff --git a/parity-ticker/src/main/java/org/jvirtanen/parity/ticker/StockTicker.java b/parity-ticker/src/main/java/org/jvirtanen/parity/ticker/StockTicker.java index 4523add3..c6af441e 100644 --- a/parity-ticker/src/main/java/org/jvirtanen/parity/ticker/StockTicker.java +++ b/parity-ticker/src/main/java/org/jvirtanen/parity/ticker/StockTicker.java @@ -1,8 +1,8 @@ package org.jvirtanen.parity.ticker; -import static org.jvirtanen.lang.Strings.*; import static org.jvirtanen.util.Applications.*; +import com.paritytrading.foundation.ASCII; import com.paritytrading.nassau.MessageListener; import com.typesafe.config.Config; import com.typesafe.config.ConfigException; @@ -52,7 +52,7 @@ private static void main(Config config, boolean taq) throws IOException { Market market = new Market(listener); for (String instrument : instruments) - market.open(encodeLong(instrument)); + market.open(ASCII.packLong(instrument)); MarketDataProcessor processor = new MarketDataProcessor(market, listener); diff --git a/parity-ticker/src/main/java/org/jvirtanen/parity/ticker/TAQFormat.java b/parity-ticker/src/main/java/org/jvirtanen/parity/ticker/TAQFormat.java index 89696673..48f8cb99 100644 --- a/parity-ticker/src/main/java/org/jvirtanen/parity/ticker/TAQFormat.java +++ b/parity-ticker/src/main/java/org/jvirtanen/parity/ticker/TAQFormat.java @@ -1,8 +1,8 @@ package org.jvirtanen.parity.ticker; import static java.time.format.DateTimeFormatter.ISO_LOCAL_DATE; -import static org.jvirtanen.lang.Strings.*; +import com.paritytrading.foundation.ASCII; import it.unimi.dsi.fastutil.longs.Long2ObjectArrayMap; import java.nio.charset.Charset; import java.time.LocalDate; @@ -62,7 +62,7 @@ public void trade(long instrument, Side side, long price, long size) { private String instrument(long instrument) { String cached = instruments.get(instrument); if (cached == null) { - cached = decodeLong(instrument).trim(); + cached = ASCII.unpackLong(instrument).trim(); instruments.put(instrument, cached); } diff --git a/pom.xml b/pom.xml index 517a3263..d6237d7f 100644 --- a/pom.xml +++ b/pom.xml @@ -55,6 +55,11 @@ + + com.paritytrading.foundation + foundation + 0.1.0 + com.paritytrading.nassau nassau @@ -100,16 +105,6 @@ config-extras 0.1.0 - - org.jvirtanen.lang - lang-extras - 0.1.0 - - - org.jvirtanen.nio - nio-extras - 0.2.0 - org.jvirtanen.util util-extras