public double volume(){
  if (cachedVolume < 0) {
    cachedVolume=1.0;
    IHypercube cube=this.region;
    int nd=cube.dimensionality();
    for (int d=1; d <= nd; d++) {
      double right=cube.getRight(d);
      double left=cube.getLeft(d);
      if (Double.isInfinite(right)) {
        right=+1;
      }
      if (Double.isInfinite(left)) {
        left=-1;
      }
      if (left == -1 && right == +1) {
      }
 else {
        cachedVolume*=(right - left);
      }
    }
  }
  return cachedVolume;
}

public double volume ( ) { if ( cachedVolume < 0 ) { cachedVolume = 1.0 ; IHypercube cube = this . region ; int nd = cube . dimensionality ( ) ; for ( int d = 1 ; d <= nd ; d ++ ) { double right = cube . getRight ( d ) ; double left = cube . getLeft ( d ) ; if ( Double . isInfinite ( right ) ) { right = + 1 ; } if ( Double . isInfinite ( left ) ) { left = - 1 ; } if ( left == - 1 && right == + 1 ) { } else { cachedVolume *= ( right - left ) ; } } } return cachedVolume ; }
return volume of hypercube region associated with node . < p > volume is useful to be able to set threshold values when considering when to apply threads to sub - problems . < p > compute using lazy evaluation and store for use ; also assume points are drawn from within the unit square , so convert infinities into - 1 and + 1 .
