public TestSiteDataProviders_Operational() { locs.add(loc1); locs.add(loc2); locs.add(loc3); locs.add(loc4); locs.add(loc5); }
/** * get a list of locations that constitutes the perimeter (forst row, last col, last row, and * first col) */ public LocationList getSurfacePerimeterLocsList() { LocationList locList = new LocationList(); for (int c = 0; c < getNumCols(); c++) locList.add(get(0, c)); for (int r = 0; r < getNumRows(); r++) locList.add(get(r, getNumCols() - 1)); for (int c = getNumCols() - 1; c >= 0; c--) locList.add(get(getNumRows() - 1, c)); for (int r = getNumRows() - 1; r >= 0; r--) locList.add(get(r, 0)); return locList; }
/** * Reads location list (each location being specified by a doublet (longitude,latitude)) and * returns a {@link LocationList} */ private LocationList get2DLocList(Element posList) { LocationList locList = new LocationList(); String positionList = (String) posList.getData(); StringTokenizer st = new StringTokenizer(positionList); while (st.hasMoreTokens()) { double lon = Double.valueOf(st.nextToken()); double lat = Double.valueOf(st.nextToken()); locList.add(new Location(lat, lon)); } return locList; }
/** * This tests that values were returned, and at least one is valid * * @param prov * @throws IOException */ private void testProv(SiteDataAPI prov) throws IOException { ArrayList<?> vals = prov.getValues(locs); boolean hasOneValid = false; for (int i = 0; i < vals.size(); i++) { Object serverGroupVal = vals.get(i); // just to make sure that the server gives the save values individually as it does in a list Object serverSingleVal = prov.getValue(locs.get(i)); System.out.println("Got val: " + serverSingleVal); assertEquals(serverSingleVal, serverGroupVal); if (prov.isValueValid(serverSingleVal)) hasOneValid = true; } assertTrue("At least one 'valid' value per test is expected.", hasOneValid); }
/** * Put all the locations of this surface into a location list * * @return */ public LocationList getLocationList() { LocationList locList = new LocationList(); Iterator<Location> it = listIterator(); while (it.hasNext()) locList.add((Location) it.next()); return locList; }
/** * It returns a list of all the locations which make up the surface for this source. * * @return LocationList - List of all the locations which constitute the surface of this source */ public LocationList getAllSourceLocs() { LocationList locList = new LocationList(); locList.add(this.location); return locList; }