I have a case class (FSMStateEstimator) which I assume has a public default apply method. However when I try to access it from another class (FSMStateRun) I get the error in the title:
Error:(20, 19) constructor FSMStateEstimator in class FSMStateEstimator cannot be accessed in class FSMStateRun val learner = FSMStateEstimator(fsm)
I don't understand why it is not visible.. Isn't the default apply method public? If I uncomment the apply method in FSMStateEstimator object I get a redefinition error. I am using scalaVersion := "2.11.7"
EDIT: When I explicitrly write val learner = FSMStateEstimator.apply(fsm) I get the same error
File1
package estimator.HMMEstimator
....
class FSMStateRun private (fsm: SDFAInterface) extends LazyLogging {
def estimateHMM(streamSource: StreamSource): FSMStateEstimator = {
val learner = FSMStateEstimator(fsm) //Error here
run(learner,streamSource)
learner.estimate()
learner
}
}
File2
package estimator.HMMEstimator
....
object FSMStateEstimator {
//def apply(fsm: SDFAInterface): FSMStateEstimator = new FSMStateEstimator(fsm)
}
case class FSMStateEstimator private(fsm: SDFAInterface) extends RunEstimator with Serializable { .... }