如何在scala中实现Java抽象接口?
抽象界面:
library("partitions")
numColumns <- 15
numIncrements <- 10
weights <- t(compositions(n=numIncrements, m=numColumns, include.zero=TRUE)/numIncrements)
weights
答案 0 :(得分:0)
看来,你的KeyIndex
类是用Java编写的。在Scala中,未标记为private
或protected
的每个字段都是公开的。 Scala中没有public
个关键字。
但是在Scala中实现Java类是可能的:
class KeyIndexImpl extends KeyIndex[geotrellis.spark.SpatialKey]{
override def toIndex(paramK: geotrellis.spark.SpatialKey): Long =
1l
override def indexRanges(paramTuple2: (geotrellis.spark.SpatialKey, geotrellis.spark.SpatialKey)): Seq[(AnyRef, AnyRef)] =
Seq((paramTuple2, paramTuple2))
}