ScalABM / auctions

A functional API for auction simulations
Apache License 2.0
13 stars 1 forks source link

Add clear result class #61

Closed davidrpugh closed 7 years ago

davidrpugh commented 7 years ago

@bherd-rb Based on your work on the Java side, this PR adds a ClearResult class which replaces the Tuple2 return type previously used for the clear method.

davidrpugh commented 7 years ago

@bherd-rb I am stuck trying to fix a compile error in the Java code. Specifically in src/functional/java/org/economicsl/auctions/Sandbox.java I am trying to print out the resulting fills...

// after inserting orders, now we can define the pricing rule...
DoubleAuction<GoogleStock> auction = withOrderBook5.withUniformPricing(midPointPricing);
ClearResult<GoogleStock, DoubleAuction<GoogleStock>> result = auction.clear();
result.fills().map(fills -> fills.foreach(fill -> System.out.println(fill)));

...and am getting a compile error...

[info] Compiling 11 Scala sources and 3 Java sources to C:\Users\pughdr\Research\scalabm\auctions\target\scala-2.12\functional-classes...
[error] C:\Users\pughdr\Research\scalabm\auctions\src\functional\java\org\economicsl\auctions\Sandbox.java:108:  error: incompatible types: inferred type does not conform to upper bound(s)
[error]         result.fills().map(fills -> fills.foreach(fill -> System.out.println(fill)));
[error]                           ^
[error] (functional:compileIncremental) javac returned nonzero exit code
[error] Total time: 15 s, completed Apr 26, 2017 1:43:08 PM

thoughts?

bherd-rb commented 7 years ago

@davidrpugh It works well in my case. Are you compiling with Maven or sbt?

davidrpugh commented 7 years ago

@bherd-rb I am using SBT to compile. I am getting the same error as Travis.

davidrpugh commented 7 years ago

@bherd-rb I think this is now ready for merge. I made some cosmetic changes to Sandbox.java in order to get everything to compile. Still not certain why is worked for you (compiling with Maven) but not for me (compiling with SBT)...this is a bit worrying!

bherd-rb commented 7 years ago

@davidrpugh It is a bit worrying, yes. I'll take a look at the issue when I'm back from the US.