0
varID是Scala中的某种关键字吗?我在看一些代码,我看到的是这样的:scala中的varID关键字
require(factor.varId == varId, "Can't multiply two factors: variable ids do not match")
我看着因子类,它被定义为:
trait Factor {
type FACTOR_TYPE <: Factor
def getVariableIds(): Seq[Int]
def *(factor: Factor): FACTOR_TYPE = throw new UnsupportedOperationException("Not supported")
}
我不明白这是什么VARID从这个定义。我来自C++的背景,所以这对我来说有点新鲜。
谢谢您的回答。从我在原始文章中的Factor类的定义中,factor.vardID应该是未定义的,对吗? – Luca
不完全。因子是一个特征,与“界面”相似。所以你的'factor'对象是Factor的一个子类。所以它可以具有varId值。 – psisoyev
谢谢!我想到了!谢谢你的帮助。 – Luca