This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package P { | |
| class A(val v: Int) | |
| class B(val v: Int) | |
| class C { | |
| def getV(x: B) = x.v | |
| } | |
| } | |
| package object P { | |
| implicit def a2b(x: A) = new B(x.v) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object Dynamic { | |
| class DynamicBox1(val value: Any) extends Dynamic { | |
| override def applyDyamic[@specialized A](name: String, arg1: A): Dynamic = { | |
| val method = value.getClass.getMethod(name, arg1.getClass) | |
| boxDynamic(method.invoke(value, arg1.asInstanceOf[AnyRef])) | |
| } | |
| override def as[T] = value.asInstanceOf[T] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| case class A(x: Int) | |
| implicit object AIsOrdered extends Ordering[A] { | |
| def compare(x: A, y: A) = x.x - y.x | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public Tableau makeArtificial() { | |
| Matrix tmp = getA().mergeRight(Matrix.identity(constraints)).mergeRight(getRHS()); //insert identity | |
| tmp = tmp.mergeDown(new Matrix(1,vars).extend(0,constraints,1d).extend(0,1)); //add new cost row | |
| return new Tableau(tmp); | |
| } | |
| vs | |
| public Tableau makeArtificial() { | |
| Double[][] tmp = new Double[height][width+height-1]; |
NewerOlder