public int computeNaiveLCA(final int[] taxonIds,final int length){
  if (length == 0)   return IdMapper.NOHITS_ID;
 else   if (length == 1)   return taxonIds[0];
  if (taxonIds.length > addresses.length) {
    addresses=new String[taxonIds.length];
    weights=new int[taxonIds.length];
  }
  int numberOfAddresses=0;
  for (int i=0; i < length; i++) {
    int taxonId=taxonIds[i];
    if (!TaxonomyData.isTaxonDisabled(taxonId)) {
      String address=TaxonomyData.getAddress(taxonId);
      if (address != null) {
        addresses[numberOfAddresses++]=address;
      }
    }
  }
  if (numberOfAddresses > 0) {
    final String address=LCAAddressing.getCommonPrefix(addresses,numberOfAddresses,true);
    return TaxonomyData.getAddress2Id(address);
  }
  return IdMapper.UNASSIGNED_ID;
}

public int computeNaiveLCA ( final int [ ] taxonIds , final int length ) { if ( length == 0 ) return IdMapper . NOHITS_ID ; else if ( length == 1 ) return taxonIds [ 0 ] ; if ( taxonIds . length > addresses . length ) { addresses = new String [ taxonIds . length ] ; weights = new int [ taxonIds . length ] ; } int numberOfAddresses = 0 ; for ( int i = 0 ; i < length ; i ++ ) { int taxonId = taxonIds [ i ] ; if ( ! TaxonomyData . isTaxonDisabled ( taxonId ) ) { String address = TaxonomyData . getAddress ( taxonId ) ; if ( address != null ) { addresses [ numberOfAddresses ++ ] = address ; } } } if ( numberOfAddresses > 0 ) { final String address = LCAAddressing . getCommonPrefix ( addresses , numberOfAddresses , true ) ; return TaxonomyData . getAddress2Id ( address ) ; } return IdMapper . UNASSIGNED_ID ; }
returns the lca of a set of taxon ids
