int findCoordElement ( double [ ] target , boolean bounded ) { switch ( axis . getSpacing ( ) ) { case regularInterval : // can use midpoint return findCoordElementRegular ( ( target [ 0 ] + target [ 1 ] ) / 2 , bounded ) ; case contiguousInterval : // can use midpoint return findCoordElementContiguous ( ( target [ 0 ] + target [ 1 ] ) / 2 , bounded ) ; case discontiguousInterval : // cant use midpoint return findCoordElementDiscontiguousInterval ( target , bounded ) ; } throw new IllegalStateException ( "unknown spacing" + axis . getSpacing ( ) ) ; }
Given a coordinate interval find what grid element matches it .