/** * 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; }
/** * 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 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; }
private MT(int rowCount) { Guardian.assertGreaterThan("rowCount", rowCount, 3); _grid = new ISEAG(rowCount); }
public CombinedFXYGeoCoding(final CodingWrapper[] codingWrappers) { Guardian.assertNotNull("codingWrappers", codingWrappers); final ArrayList<CodingWrapper> wrappers = new ArrayList<CodingWrapper>(); for (int i = 0; i < codingWrappers.length; i++) { final CodingWrapper codingWrapper = codingWrappers[i]; if (codingWrapper != null) { wrappers.add(codingWrapper); } } Guardian.assertGreaterThan("number of coding wrappers", wrappers.size(), 0); _codingWrappers = wrappers.toArray(new CodingWrapper[wrappers.size()]); _datum = _codingWrappers[0].getGeoGoding().getDatum(); _lastIndex = 0; }
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]); } }
public NewProductDialog(Window parent, ProductNodeList<Product> sourceProducts, final int selectedSourceIndex, boolean sourceProductOwner, String prefix) { super(parent, "New Product", ModalDialog.ID_OK_CANCEL, null); /* I18N */ Guardian.assertNotNull("sourceProducts", sourceProducts); Guardian.assertGreaterThan("sourceProducts.size()", sourceProducts.size(), 0); this.sourceProducts = sourceProducts; selectedProductIndex = selectedSourceIndex; this.parent = parent; this.prefix = prefix; this.sourceProductOwner = sourceProductOwner; }
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(); }
ElevationModel elevationModel, int maxIterationCount) { Guardian.assertGreaterThan("sceneRasterWidth", sceneRasterWidth, 0); Guardian.assertGreaterThan("sceneRasterHeight", sceneRasterHeight, 0); Guardian.assertNotNull("pointing", pointing); Guardian.assertNotNull("pointing.getGeoCoding()", pointing.getGeoCoding()); Guardian.assertGreaterThan("maxIterationCount", maxIterationCount, 1); this.sceneRasterWidth = sceneRasterWidth; this.sceneRasterHeight = sceneRasterHeight;
public void testAssertGreaterThan() { try { Guardian.assertGreaterThan("x", -1, 0); fail("IllegalArgumentException expected"); } catch (IllegalArgumentException e) { testException(e, "[x] is less than or equal to [0]"); } try { Guardian.assertGreaterThan("x", 0, 0); fail("IllegalArgumentException expected"); } catch (IllegalArgumentException e) { testException(e, "[x] is less than or equal to [0]"); } try { Guardian.assertGreaterThan("x", 1, 0); } catch (IllegalArgumentException e) { fail("IllegalArgumentException not Expected"); } }
public BandMathsDialog(final VisatApp visatApp, Product currentProduct, ProductNodeList<Product> productsList, String helpId) { super(visatApp.getMainFrame(), "Band Maths", ID_OK_CANCEL_HELP, helpId); /* I18N */ Guardian.assertNotNull("currentProduct", currentProduct); Guardian.assertNotNull("productsList", productsList); Guardian.assertGreaterThan("productsList must be not empty", productsList.size(), 0); this.visatApp = visatApp; targetProduct = currentProduct; this.productsList = productsList; bindingContext = createBindingContext(); makeUI(); }
public static TiffShort getType(final TiffValue[] values) { Guardian.assertNotNull("values", values); Guardian.assertGreaterThan("values.length", values.length, 0); final TiffValue value = values[0]; Guardian.assertNotNull("value", value);
public static TiffShort getType(final TiffValue[] values) { Guardian.assertNotNull("values", values); Guardian.assertGreaterThan("values.length", values.length, 0); final TiffValue value = values[0]; Guardian.assertNotNull("value", value);
public void write(final ImageOutputStream ios, final long ifdOffset, final long nextIfdOffset) throws IOException { Guardian.assertGreaterThan("ifdOffset", ifdOffset, -1); computeOffsets(ifdOffset); ios.seek(ifdOffset); final TiffDirectoryEntry[] entries = entrySet.getEntries(); new TiffShort(entries.length).write(ios); long entryPosition = ios.getStreamPosition(); for (TiffDirectoryEntry entry : entries) { ios.seek(entryPosition); entry.write(ios); entryPosition += TiffDirectoryEntry.BYTES_PER_ENTRY; } writeNextIfdOffset(ios, ifdOffset, nextIfdOffset); }
public void write(final ImageOutputStream ios, final long ifdOffset, final long nextIfdOffset) throws IOException { Guardian.assertGreaterThan("ifdOffset", ifdOffset, -1); computeOffsets(ifdOffset); ios.seek(ifdOffset); final TiffDirectoryEntry[] entries = entrySet.getEntries(); new TiffShort(entries.length).write(ios); long entryPosition = ios.getStreamPosition(); for (TiffDirectoryEntry entry : entries) { ios.seek(entryPosition); entry.write(ios); entryPosition += TiffDirectoryEntry.BYTES_PER_ENTRY; } writeNextIfdOffset(ios, ifdOffset, nextIfdOffset); }
public void writeXML(XmlWriter writer, int indent) { Guardian.assertNotNull("writer", writer); Guardian.assertGreaterThan("indent", indent, -1); String[][] attributes = new String[1][]; attributes[0] = new String[]{DimapProductConstants.ATTRIB_NAME, getName()}; String[] bdTags = XmlWriter.createTags(indent, DimapProductConstants.TAG_BITMASK_DEFINITION, attributes); writer.println(bdTags[0]); String description = getDescription(); if (description == null) { description = ""; } attributes[0] = new String[]{DimapProductConstants.ATTRIB_VALUE, description}; writer.printLine(indent + 1, DimapProductConstants.TAG_BITMASK_DESCRIPTION, attributes, null); String expr = getExpr(); if (expr == null) { expr = ""; } attributes[0] = new String[]{DimapProductConstants.ATTRIB_VALUE, expr}; writer.printLine(indent + 1, DimapProductConstants.TAG_BITMASK_EXPRESSION, attributes, null); DimapProductHelpers.printColorTag(indent + 1, getColor(), writer); attributes[0] = new String[]{DimapProductConstants.ATTRIB_VALUE, String.valueOf(getTransparency())}; writer.printLine(indent + 1, DimapProductConstants.TAG_BITMASK_TRANSPARENCY, attributes, null); writer.println(bdTags[1]); }
public static void writeXML(Placemark placemark, XmlWriter writer, int indent) { Guardian.assertNotNull("writer", writer); Guardian.assertGreaterThan("indent", indent, -1); final String[][] attributes = {new String[]{DimapProductConstants.ATTRIB_NAME, placemark.getName()}}; final String[] pinTags = XmlWriter.createTags(indent, DimapProductConstants.TAG_PLACEMARK, attributes); writer.println(pinTags[0]); indent++; writer.printLine(indent, DimapProductConstants.TAG_PLACEMARK_LABEL, placemark.getLabel()); writer.printLine(indent, DimapProductConstants.TAG_PLACEMARK_DESCRIPTION, placemark.getDescription()); final GeoPos geoPos = placemark.getGeoPos(); if (geoPos != null) { writer.printLine(indent, DimapProductConstants.TAG_PLACEMARK_LATITUDE, geoPos.lat); writer.printLine(indent, DimapProductConstants.TAG_PLACEMARK_LONGITUDE, geoPos.lon); } final PixelPos pixelPos = placemark.getPixelPos(); if (pixelPos != null && pixelPos.isValid()) { writer.printLine(indent, DimapProductConstants.TAG_PLACEMARK_PIXEL_X, pixelPos.x); writer.printLine(indent, DimapProductConstants.TAG_PLACEMARK_PIXEL_Y, pixelPos.y); } final String styleCss = placemark.getStyleCss(); if (styleCss != null && !styleCss.isEmpty()) { writer.printLine(indent, DimapProductConstants.TAG_PLACEMARK_STYLE_CSS, styleCss); } writer.println(pinTags[1]); }