/** * Sets the coefficient file name for thic object. * * @param coeffFile the coefficient file name */ void setCoefficientFileName(String coeffFile) { Guardian.assertNotNull("coeffFile", coeffFile); coeffFileName = coeffFile; }
public ColorPaletteDef(Point[] points, int numColors) { Guardian.assertGreaterThan("numColors", numColors, 1); Guardian.assertNotNull("points", points); Guardian.assertGreaterThan("points.length", points.length, 1); this.numColors = numColors; this.points = new Vector<>(points.length); this.points.addAll(Arrays.asList(points)); this.discrete = false; }
public MapProjection(String name, MapTransform mapTransform, String mapUnit, boolean preDefined) { Guardian.assertNotNullOrEmpty("name", name); Guardian.assertNotNull("mapTransform", mapTransform); _name = name; _mapTransform = mapTransform; _mapUnit = mapUnit; _preDefined = preDefined; }
private static void checkValidPropertyName(final String propertyName) { Guardian.assertNotNullOrEmpty("propertyName", propertyName); }
private void checkGeoCoding(final GeoCoding geoCoding) { if (geoCoding instanceof TiePointGeoCoding) { final TiePointGeoCoding gc = (TiePointGeoCoding) geoCoding; Guardian.assertSame("gc.getLatGrid()", gc.getLatGrid(), getTiePointGrid(gc.getLatGrid().getName())); Guardian.assertSame("gc.getLonGrid()", gc.getLonGrid(), getTiePointGrid(gc.getLonGrid().getName())); } else if (geoCoding instanceof MapGeoCoding) { final MapGeoCoding gc = (MapGeoCoding) geoCoding; final MapInfo mapInfo = gc.getMapInfo(); Guardian.assertNotNull("mapInfo", mapInfo); Guardian.assertEquals("mapInfo.getSceneWidth()", mapInfo.getSceneWidth(), getSceneRasterWidth()); Guardian.assertEquals("mapInfo.getSceneHeight()", mapInfo.getSceneHeight(), getSceneRasterHeight()); } }
final GeoCoding destGeoCoding, final Rectangle destArea) { Guardian.assertNotNull("sourceGeoCoding", sourceGeoCoding); Guardian.assertEquals("sourceGeoCoding.canGetPixelPos()", sourceGeoCoding.canGetPixelPos(), true); Guardian.assertNotNull("destGeoCoding", destGeoCoding); Guardian.assertEquals("destGeoCoding.canGetGeoPos()", destGeoCoding.canGetGeoPos(), true); Guardian.assertNotNull("destArea", destArea);
/** * Sets the timeout which is used by the filters created by the factory methods. * * @param timeout the timeout time in milli seconds. * * @throws IllegalArgumentException if the given timeout time is smaller then 1. */ public static void setTimeout(int timeout) throws IllegalArgumentException { Guardian.assertGreaterThan("timeout", timeout, 0); _timeout = timeout; }
private void checkSourceRegionInsideBandRegion(int sourceWidth, final int sourceBandWidth, int sourceHeight, final int sourceBandHeight, int sourceOffsetX, int sourceOffsetY) { Guardian.assertWithinRange("sourceWidth", sourceWidth, 1, sourceBandWidth); Guardian.assertWithinRange("sourceHeight", sourceHeight, 1, sourceBandHeight); Guardian.assertWithinRange("sourceOffsetX", sourceOffsetX, 0, sourceBandWidth - sourceWidth); Guardian.assertWithinRange("sourceOffsetY", sourceOffsetY, 0, sourceBandHeight - sourceHeight); }
/** * Creates a default namespace for the product(s) given in an array. The resulting namespace contains symbols for * all tie-point grids, bands and single flag values. if the array contains more then one product, the symbol's name * will have a prefix according to each product's reference number. * * @param products the array of input products * @param defaultProductIndex the index of the product for which also symbols without the * product prefix <code>$<i>ref-no</i></code> are registered in the namespace * @param prefixProvider a product prefix provider * @return a default namespace, never <code>null</code> */ public static WritableNamespace createDefaultNamespace(Product[] products, int defaultProductIndex, ProductPrefixProvider prefixProvider) { Guardian.assertNotNullOrEmpty("products", products); Guardian.assertWithinRange("defaultProductIndex", defaultProductIndex, 0, products.length); WritableNamespace namespace = new NamespaceImpl(DEFAULT_NAMESPACE); // Register symbols for default product without name prefix registerProductSymbols(namespace, products[defaultProductIndex], ""); // Register symbols for multiple products using a name prefix if (products.length > 1) { for (Product product : products) { registerProductSymbols(namespace, product, prefixProvider.getPrefix(product)); } } namespace.registerSymbol(PIXEL_X_SYMBOL); namespace.registerSymbol(PIXEL_Y_SYMBOL); return namespace; }
public static double getEarthSunDistance(final int julianDay) { Guardian.assertGreaterThan("julianDay <= 0", julianDay, 0); Guardian.assertTrue("julianDay < 367", julianDay < 367); final EarthSunDistance firstElement = distanceCollection.get(0); double distance = firstElement.getDistance(); for (Iterator<EarthSunDistance> iter = distanceCollection.iterator(); iter.hasNext();) { EarthSunDistance element = iter.next(); if (element.getJulianDay() > julianDay) { return distance; } distance = element.getDistance(); } final EarthSunDistance lastElement = distanceCollection.get( distanceCollection.size() - 1); return lastElement.getDistance(); }
/** * Checks if the given values are equal. If not, an <code>IllegalArgumentException</code> is thrown with a * standardized message text using the supplied message. * <p/> * <p>This utility method is used to check arguments passed into methods: * <pre> * public void writeDataAtRegion(int x, inty, int w, int h, byte[] data) { * Guardian.assertEquals("data.length", * data.length, w * h); * ... * } * </pre> * * @param exprText the test expression as text * @param exprValue the test expression result * @param expectedValue the expected value * @throws IllegalArgumentException if the <code>exprValue</code> is not equal to <code>expectedValue</code> */ public static void assertEquals(String exprText, boolean exprValue, boolean expectedValue) { assertEquals(exprText, Boolean.valueOf(exprValue), Boolean.valueOf(expectedValue)); }
public static int[] parseEastingNorthing(final String text) throws ParseException { Guardian.assertNotNullOrEmpty("text", text); if (text.length() == 0) { return null; } return PARSER.parse(text); }
/** * Sets the dataset offset in bytes within the data product file and the size in bytes of each record contained in * the dataset. The method then adjusts the dataset size accordingly. * <p/> * <p> The primary use of this method is to correct defective DSD entries found in the SPH. * * @param datasetOffset the dataset offset in bytes within the data product file. * @param recordSize the size in bytes of each record contained in the dataset. * * @throws java.lang.IllegalArgumentException * if one of the arguments is <code><= 0</code>. */ public final void adjust(long datasetOffset, int recordSize) { Guardian.assertGreaterThan("datasetOffset", datasetOffset, 0); Guardian.assertGreaterThan("recordSize", recordSize, 0); this.datasetOffset = datasetOffset; this.recordSize = recordSize; this.datasetSize = this.numRecords * this.recordSize; }
public IrRadianceCalibrator(int channel) { super(channel); Guardian.assertWithinRange("channel", channel, AvhrrConstants.CH_3B, AvhrrConstants.CH_5); this.operationalDataIndex = channel - AvhrrConstants.CH_3B; }
private void checkBufferSize(int sourceWidth, int sourceHeight, ProductData sourceBuffer) { int expectedBufferSize = sourceWidth * sourceHeight; int actualBufferSize = sourceBuffer.getNumElems(); Guardian.assertEquals("wrong sourceBuffer size", actualBufferSize, expectedBufferSize); }
/** * Constructs a <code>ProductWriter</code>. Since no output destination is set, the <code>setOutput</code> * method must be called before data can be written. * * @param writerPlugIn the plug-in which created this writer, must not be <code>null</code> * @throws IllegalArgumentException * @see #writeProductNodes */ public AbstractProductWriter(ProductWriterPlugIn writerPlugIn) { Guardian.assertNotNull("writerPlugIn", writerPlugIn); _writerPlugIn = writerPlugIn; }
public TiffHeader(final Product[] products) { Guardian.assertNotNull("products", products); Guardian.assertGreaterThan("products.length", products.length, 0); ifds = new TiffIFD[products.length]; for (int i = 0; i < products.length; i++) { ifds[i] = new TiffIFD(products[i]); } }
/** * Replaces all occurrences of the old word within the given string by the new word. * * @param string the string within all occurrences of the old word are to be replaced. * @param oldWord the word to be replaced. Must not be <code>null</code> and must not be empty. * @param newWord the new word. Must not be <code> null</code>. * @return the resulting string, never <code>null</code>. */ public static String replaceWord(final String string, final String oldWord, final String newWord) { Guardian.assertNotNull("string", string); Guardian.assertNotNullOrEmpty("oldWord", oldWord); Guardian.assertNotNull("newWord", newWord); // The "\\b" in a regular expression means "word boundary" return string.replaceAll("\\b" + oldWord + "\\b", newWord); }
/** * @param fileName * * @return if it is a ceos header */ private static boolean isFastCEOSHeader(final String fileName) { Guardian.assertNotNullOrEmpty("fileName", fileName); return fileName.equalsIgnoreCase("VDF_DAT"); }
private MT(int rowCount) { Guardian.assertGreaterThan("rowCount", rowCount, 3); _grid = new ISEAG(rowCount); }