I would like to define the ContextItem class as an extension of the java Predicate class with the Confidence sign.
Confidence is a simple trait that simply adds a confidence field to what it expands.
trait Confidence{ def confidence:Double }
I define my ContextItem class by simply stating:
class ContextItem extends Predicate with Confidence{}
But trying to compile this gives ...
com/slug/berds/Berds.scala:11: error: overloaded method constructor Predicate with alternatives: (java.lang.String,<repeated...>[java.lang.String])com.Predicate <and> (java.lang.String,<repeated...>[com.Symbol])com.Predicate <and> (java.lang.String,java.util.ArrayList[com.Symbol])com.Predicate <and> (com.Predicate)com.Predicate <and> (com.Term)com.Predicate <and> (java.lang.String)com.Predicate cannot be applied to () class ContextItem(pred:Predicate) extends Predicate with Confidence{ ^
This seems like a trivial example, so what's wrong?
The predicate (which is not mine) looks like this:
public class Predicate extends Term implements Serializable { public Predicate(String n) { super(n); } public Predicate(Term t) { super(t); } public Predicate(Predicate p) { super((Term)p); } public Predicate(String n, ArrayList<Symbol> a) { super(n, a); } public Predicate(String n, Symbol... a) { super(n, a); } public Predicate(String n, String... a) { super(n, a); } @Override public Predicate copy() { return new Predicate(this); } }
Neither the Predicate, nor any of its ancestors realize confidence.
williamstome
source share