public Sector union(float[] array,int count,int stride){
  if (array == null || array.length < stride) {
    throw new IllegalArgumentException(Logger.logMessage(Logger.ERROR,"Sector","union","missingArray"));
  }
  if (count < 0) {
    throw new IllegalArgumentException(Logger.logMessage(Logger.ERROR,"Sector","union","invalidCount"));
  }
  if (stride < 2) {
    throw new IllegalArgumentException(Logger.logMessage(Logger.ERROR,"Sector","union","invalidStride"));
  }
  double minLat=Double.isNaN(this.minLatitude) ? Double.MAX_VALUE : this.minLatitude;
  double maxLat=Double.isNaN(this.maxLatitude) ? -Double.MAX_VALUE : this.maxLatitude;
  double minLon=Double.isNaN(this.minLongitude) ? Double.MAX_VALUE : this.minLongitude;
  double maxLon=Double.isNaN(this.maxLongitude) ? -Double.MAX_VALUE : this.maxLongitude;
  for (int idx=0; idx < count; idx+=stride) {
    float lon=array[idx];
    float lat=array[idx + 1];
    if (maxLat < lat) {
      maxLat=lat;
    }
    if (minLat > lat) {
      minLat=lat;
    }
    if (maxLon < lon) {
      maxLon=lon;
    }
    if (minLon > lon) {
      minLon=lon;
    }
  }
  if (minLat < Double.MAX_VALUE) {
    this.minLatitude=minLat;
  }
  if (maxLat > -Double.MAX_VALUE) {
    this.maxLatitude=maxLat;
  }
  if (minLon < Double.MAX_VALUE) {
    this.minLongitude=minLon;
  }
  if (maxLon > -Double.MAX_VALUE) {
    this.maxLongitude=maxLon;
  }
  return this;
}

public Sector union ( float [ ] array , int count , int stride ) { if ( array == null || array . length < stride ) { throw new IllegalArgumentException ( Logger . logMessage ( Logger . ERROR , "Sector" , "union" , "missingArray" ) ) ; } if ( count < 0 ) { throw new IllegalArgumentException ( Logger . logMessage ( Logger . ERROR , "Sector" , "union" , "invalidCount" ) ) ; } if ( stride < 2 ) { throw new IllegalArgumentException ( Logger . logMessage ( Logger . ERROR , "Sector" , "union" , "invalidStride" ) ) ; } double minLat = Double . isNaN ( this . minLatitude ) ? Double . MAX_VALUE : this . minLatitude ; double maxLat = Double . isNaN ( this . maxLatitude ) ? - Double . MAX_VALUE : this . maxLatitude ; double minLon = Double . isNaN ( this . minLongitude ) ? Double . MAX_VALUE : this . minLongitude ; double maxLon = Double . isNaN ( this . maxLongitude ) ? - Double . MAX_VALUE : this . maxLongitude ; for ( int idx = 0 ; idx < count ; idx += stride ) { float lon = array [ idx ] ; float lat = array [ idx + 1 ] ; if ( maxLat < lat ) { maxLat = lat ; } if ( minLat > lat ) { minLat = lat ; } if ( maxLon < lon ) { maxLon = lon ; } if ( minLon > lon ) { minLon = lon ; } } if ( minLat < Double . MAX_VALUE ) { this . minLatitude = minLat ; } if ( maxLat > - Double . MAX_VALUE ) { this . maxLatitude = maxLat ; } if ( minLon < Double . MAX_VALUE ) { this . minLongitude = minLon ; } if ( maxLon > - Double . MAX_VALUE ) { this . maxLongitude = maxLon ; } return this ; }
sets this sector to the union of itself and an array of specified locations . if this sector is empty , it bounds the specified locations . the array is understood to contain location of at least two coordinates organized as ( longitude , latitude , . . . ) , where stride indicates the number of coordinates between longitude values .
