chrisokasaki / TradeMaximizer

Tool for finding the largest possible set of trades in BoardGameGeek-style "math trades".
MIT License
39 stars 14 forks source link

TradeMaximizer accepting InputStream and OutputStream for easier integration #1

Closed rafacandev closed 6 years ago

rafacandev commented 6 years ago

TradeMaximizer accepting InputStream and OutputStream for easier integration. With this approach it is possible to use TradeMaximizer without the command line by passing the input as InputStream and using OutputStream to get the results.

Here is an example:

String inputString = "(Alice) 1 : 3 2 6\n ..."; // TradeMaximizer input string
InputStream input = new ByteArrayInputStream(inputString.getBytes());
OutputStream output = new ByteArrayOutputStream();
TradeMaximizer tradeMaximizer = new TradeMaximizer(input, output);
tradeMaximizer.run();
String result = output.toString();
// Close the streams and handle exceptions normally
chrisokasaki commented 6 years ago

Thanks. Just so you have some idea of timing, I won't be able to look at this carefully until next week.

rafacandev commented 6 years ago

Hi @chrisokasaki

Thanks for reviewing it. No problem, I removed the introduced tabs. Don't hesitate to contact me if there are other adjustments.

Cheers.