/** * Return Regions as Array * * @param ctx context * @return MCountry Array */ public static MRegion[] getRegions(Ctx ctx) { if (s_regions.isEmpty()) loadAllRegions(ctx); MRegion[] retValue = new MRegion[s_regions.size()]; s_regions.values().toArray(retValue); Arrays.sort(retValue, new MRegion(ctx, 0, null)); return retValue; } // getRegions
/** * Return Array of Regions of Country * * @param ctx context * @param C_Country_ID country * @return MRegion Array */ public static MRegion[] getRegions(Ctx ctx, int C_Country_ID) { if (s_regions.isEmpty()) loadAllRegions(ctx); ArrayList<MRegion> list = new ArrayList<MRegion>(); Iterator<MRegion> it = s_regions.values().iterator(); while (it.hasNext()) { MRegion r = it.next(); if (r.getC_Country_ID() == C_Country_ID) list.add(r); } // Sort it MRegion[] retValue = new MRegion[list.size()]; list.toArray(retValue); Arrays.sort(retValue, new MRegion(ctx, 0, null)); return retValue; } // getRegions