Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.cassantec.coreengine
- import scala.collection.{mutable ⇒ mu}
- /**
- * Created by amozhenin on 30.06.2015.
- */
- class SomeTest {
- case class T(day: Array[Double])
- def processComponent() {
- def risks() = {
- val malfunctionRisk = mu.LinkedHashMap[String, T]()
- fillMalfunctionRisk(malfunctionRisk)
- (malfunctionRisk)
- }
- val risk = risks()
- enforceMonotonicity(risk)
- val x:T = risk.get("1").get
- for (elem <- x.day) {
- println (elem)
- }
- }
- def fillMalfunctionRisk(malfunctionRisk: mu.Map[String, T]): Unit = {
- //fills risks
- val day:Array[Double] = Array(0.9, 0.8, 0.7, 0.6, 0.5)
- malfunctionRisk.put("1", new T(day))
- }
- def enforceMonotonicity(map: mu.LinkedHashMap[String, T]): Unit = {
- val x = map.mapValues { ce: T ⇒
- val day = ce.day
- enforceMonotonicity(day)
- }
- // println(x)
- }
- def enforceMonotonicity(row: Array[Double]) = {
- var max = Double.MinValue
- for (j ← row.indices) {
- max = Math.max(row(j), max)
- row(j) = max
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement