public float getCellSpacing ( ) throws DescriptorException { float [ ] cellRanges = myCELV . getCellRanges ( ) ; // // use the first cell spacing as our expected value // float cellSpacing = cellRanges [ 1 ] - cellRanges [ 0 ] ; // // Check the rest of the cells against the expected value, allowing // 1% fudge // for ( int i = 2 ; i < cellRanges . length ; i ++ ) { float space = cellRanges [ i ] - cellRanges [ i - 1 ] ; if ( ! Misc . nearlyEquals ( space , cellSpacing ) && ( Math . abs ( space / cellSpacing - 1.0 ) > 0.01 ) ) { throw new DescriptorException ( "variable cell spacing" ) ; } } return cellSpacing ; }
Get the cell spacing . An exception is thrown if the cell spacing is not constant .