• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Martomate / TriPaint / 8896742719

30 Apr 2024 02:39PM UTC coverage: 27.877% (+0.3%) from 27.558%
8896742719

push

github

Martomate
Fixed major performance issue

4 of 6 new or added lines in 1 file covered. (66.67%)

40 existing lines in 5 files now uncovered.

373 of 1338 relevant lines covered (27.88%)

0.28 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.83
/src/main/scala/tripaint/util/InjectiveHashMap.scala
1
package tripaint.util
2

3
import scala.collection.mutable
4

5
class InjectiveHashMap[L, R] extends InjectiveMap[L, R] {
1✔
6
  private val leftToRight: mutable.Map[L, R] = mutable.Map.empty
1✔
7
  private val rightToLeft: mutable.Map[R, L] = mutable.Map.empty
8

1✔
9
  override def getRight(left: L): Option[R] = leftToRight.get(left)
10

1✔
11
  override def getLeft(right: R): Option[L] = rightToLeft.get(right)
12

1✔
UNCOV
13
  override def set(left: L, right: R): Boolean = {
×
14
    val newMapping = !getRight(left).contains(right)
1✔
15
    if (newMapping) {
1✔
16
      removeLeft(left)
1✔
17
      removeRight(right)
1✔
18
      leftToRight.put(left, right)
1✔
19
      rightToLeft.put(right, left)
20
    }
21
    newMapping
22
  }
23

1✔
24
  override def containsLeft(left: L): Boolean = leftToRight.contains(left)
25

1✔
26
  override def containsRight(right: R): Boolean = rightToLeft.contains(right)
27

1✔
28
  override def removeRight(right: R): Boolean = {
1✔
29
    val l = getLeft(right)
1✔
30
    l.foreach(left => removeUnchecked(left, right))
1✔
31
    l.isDefined
32
  }
33

1✔
34
  override def removeLeft(left: L): Boolean = {
1✔
35
    val r = getRight(left)
1✔
36
    r.foreach(right => removeUnchecked(left, right))
1✔
37
    r.isDefined
38
  }
39

1✔
40
  private def removeUnchecked(left: L, right: R): Unit = {
1✔
41
    leftToRight.remove(left)
1✔
42
    rightToLeft.remove(right)
43
  }
44
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc