Hello,

I'm using Planner in a Scala program and it almost works without problems; the 
only one is in implementing the Solution interface, as it uses raw (erased) 
version of Score, which is normally generic (Score<S extends Score>). Scala 
generally doesn't like raw types and in most cases it's impossible to 
extend/implement interfaces which use them. A work-around is to introduce an 
"adapter" in Java, which you can later extend in Scala:

public abstract class ScalaSolution implements Solution {
    public Score getScore() { return getScoreScala(); }
    public abstract Score<?> getScoreScala();

    public void setScore(Score score) { setScoreScala(score); }
    public abstract void setScoreScala(Score<?> score);  
}

and then in Scala:

class Schedule(...) extends ScalaSolution {
  var score: Score[_] = _

  def setScoreScala(score: Score[_]) = { this.score = score }
  def getScoreScala = score

  ...
}

So the fix is to replace the raw Score type with Score<?>. Maybe it would be 
possible to apply that in the code? I tried it locally and it compiles without 
problems.

And a side question: do you have any plans on implementing multithreading in 
planner? So that several moves could be explored concurrently? I saw there's an 
open Jira issue for some time, but it didn't have any timeframe information.

-- 
Adam Warski
http://www.warski.org
http://www.softwaremill.eu





_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to