From dc4665151132e8219fc8461c5e49b50dc6cfc115 Mon Sep 17 00:00:00 2001 From: Jackie Goldstein Date: Thu, 3 Dec 2015 18:09:49 -0500 Subject: [PATCH] last edits to multiarray2 for now --- .../org/broadinstitute/hail/utils/MultiArray2.scala | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/main/scala/org/broadinstitute/hail/utils/MultiArray2.scala b/src/main/scala/org/broadinstitute/hail/utils/MultiArray2.scala index 8cadf5a93e4..11ee38e228f 100644 --- a/src/main/scala/org/broadinstitute/hail/utils/MultiArray2.scala +++ b/src/main/scala/org/broadinstitute/hail/utils/MultiArray2.scala @@ -15,10 +15,8 @@ class MultiArray2[T](val n1: Int, class Row(val i:Int) extends IndexedSeq[T] { require(i >= 0 && i < n1) def apply(j:Int): T = { - if (j >= 0 && j < length) - a(i*n2 + j) - else - throw new ArrayIndexOutOfBoundsException + if (j < 0 || j >= length) throw new ArrayIndexOutOfBoundsException + a(i*n2 + j) } def length: Int = n2 } @@ -26,10 +24,8 @@ class MultiArray2[T](val n1: Int, class Column(val j:Int) extends IndexedSeq[T] { require(j >= 0 && j < n2) def apply(i:Int): T = { - if (i >= 0 && i < length) - a(i*n2 + j) - else - throw new ArrayIndexOutOfBoundsException + if (i < 0 || i >= length) throw new ArrayIndexOutOfBoundsException + a(i*n2 + j) } def length: Int = n1 }