org.esa.beam.util.Debug.setEnabled()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(246)

本文整理了Java中org.esa.beam.util.Debug.setEnabled()方法的一些代码示例,展示了Debug.setEnabled()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Debug.setEnabled()方法的具体详情如下:
包路径:org.esa.beam.util.Debug
类名称:Debug
方法名:setEnabled

Debug.setEnabled介绍

[英]Enables the debugging functionality or disables it.
[中]启用或禁用调试功能。

代码示例

代码示例来源:origin: bcdev/beam

  1. @Override
  2. protected void setUp() {
  3. //_oldDebugState = Debug.setEnabled(true);
  4. _oldDebugState = Debug.setEnabled(false);
  5. }

代码示例来源:origin: bcdev/beam

  1. @Override
  2. protected void setUp() throws Exception {
  3. _lastDebugState = Debug.setEnabled(true);
  4. }

代码示例来源:origin: bcdev/beam

  1. @Override
  2. protected void tearDown() {
  3. Debug.setEnabled(_oldDebugState);
  4. }

代码示例来源:origin: bcdev/beam

  1. @Override
  2. protected void tearDown() throws Exception {
  3. Debug.setEnabled(_lastDebugState);
  4. }

代码示例来源:origin: bcdev/beam

  1. @Override
  2. protected void tearDown() {
  3. Debug.setEnabled(_oldDebugState);
  4. }

代码示例来源:origin: bcdev/beam

  1. private static boolean isDebugClassTestable() {
  2. boolean oldDebugState = Debug.isEnabled();
  3. Debug.setEnabled(true);
  4. boolean newDebugState = Debug.isEnabled();
  5. Debug.setEnabled(oldDebugState);
  6. return newDebugState;
  7. }

代码示例来源:origin: bcdev/beam

  1. Debug.setEnabled(debugEnabled);
  2. if (debugEnabled) {
  3. JAI.getDefaultInstance().setImagingListener(new ImagingListener() {

代码示例来源:origin: bcdev/beam

  1. public void testAssertNotNull() {
  2. Debug.setEnabled(false);
  3. try {
  4. Debug.assertNotNull(new Object());
  5. } catch (AssertionFailure e) {
  6. fail("no AssertionFailure expected");
  7. }
  8. try {
  9. Debug.assertNotNull(null);
  10. } catch (AssertionFailure e) {
  11. fail("no AssertionFailure expected");
  12. }
  13. Debug.setEnabled(true);
  14. Debug.setWriter(new java.io.StringWriter());
  15. try {
  16. Debug.assertNotNull(new Object());
  17. } catch (AssertionFailure e) {
  18. fail("no AssertionFailure expected");
  19. }
  20. try {
  21. Debug.assertNotNull(null);
  22. fail("AssertionFailure expected");
  23. } catch (AssertionFailure e) {
  24. }
  25. }

代码示例来源:origin: bcdev/beam

  1. public void testAssertWidthoutMessage() {
  2. Debug.setEnabled(false);
  3. try {
  4. Debug.assertTrue(true);
  5. } catch (AssertionFailure e) {
  6. fail("no AssertionFailure expected");
  7. }
  8. try {
  9. Debug.assertTrue(false);
  10. } catch (AssertionFailure e) {
  11. fail("no AssertionFailure expected");
  12. }
  13. Debug.setEnabled(true);
  14. java.io.StringWriter sw = new java.io.StringWriter();
  15. Debug.setWriter(sw);
  16. try {
  17. Debug.assertTrue(true);
  18. } catch (AssertionFailure e) {
  19. fail("no AssertionFailure expected");
  20. }
  21. try {
  22. Debug.assertTrue(false);
  23. fail("AssertionFailure expected");
  24. } catch (AssertionFailure e) {
  25. }
  26. String assertionFailureMsg = sw.getBuffer().toString();
  27. String expectedContent = Debug.class.getName();
  28. assertEquals(true, assertionFailureMsg.indexOf(expectedContent) >= 0);
  29. }

代码示例来源:origin: bcdev/beam

  1. public void testAssertWidtMessage() {
  2. Debug.setEnabled(false);
  3. try {
  4. Debug.assertTrue(true, "ErrorMessage");
  5. } catch (AssertionFailure e) {
  6. fail("no AssertionFailure expected");
  7. }
  8. try {
  9. Debug.assertTrue(false, "ErrorMessage");
  10. } catch (AssertionFailure e) {
  11. fail("no AssertionFailure expected");
  12. }
  13. Debug.setEnabled(true);
  14. java.io.StringWriter sw = new java.io.StringWriter();
  15. Debug.setWriter(sw);
  16. try {
  17. Debug.assertTrue(true, "ErrorMessage");
  18. } catch (AssertionFailure e) {
  19. fail("no AssertionFailure expected");
  20. }
  21. try {
  22. Debug.assertTrue(false, "ErrorMessage");
  23. fail("AssertionFailure expected");
  24. } catch (AssertionFailure e) {
  25. assertEquals("ErrorMessage", e.getMessage());
  26. }
  27. String assertionFailureMsg = sw.getBuffer().toString();
  28. String expectedContent = Debug.class.getName();
  29. assertEquals(true, assertionFailureMsg.indexOf(expectedContent) >= 0);
  30. }

代码示例来源:origin: bcdev/beam

  1. public static void main(String[] args) throws Exception {
  2. String sourceDirFile = args[0];
  3. String regionWktFile = args[1];
  4. String binnerConfigFile = args[2];
  5. String[] outputterConfigFiles = new String[args.length - 3];
  6. System.arraycopy(args, 3, outputterConfigFiles, 0, outputterConfigFiles.length);
  7. File[] sourceFiles = new File(sourceDirFile).listFiles(new FilenameFilter() {
  8. @Override
  9. public boolean accept(File dir, String name) {
  10. return name.endsWith(".N1");
  11. }
  12. });
  13. String regionWkt = FileUtils.readText(new File(regionWktFile));
  14. BinningConfig binningConfig = BinningConfig.fromXml(FileUtils.readText(new File(binnerConfigFile)));
  15. Debug.setEnabled(true);
  16. StopWatch stopWatch = new StopWatch();
  17. stopWatch.start();
  18. BinningContext binningContext = binningConfig.createBinningContext(null, null, null);
  19. // Step 1: Spatial binning - creates time-series of spatial bins for each bin ID ordered by ID. The tree map structure is <ID, time-series>
  20. SortedMap<Long, List<SpatialBin>> spatialBinMap = doSpatialBinning(binningContext, sourceFiles);
  21. // Step 2: Temporal binning - creates a list of temporal bins, sorted by bin ID
  22. List<TemporalBin> temporalBins = doTemporalBinning(binningContext, spatialBinMap);
  23. // Step 3: Formatting
  24. for (String outputterConfigFile : outputterConfigFiles) {
  25. FormatterConfig formatterConfig = FormatterConfig.fromXml(FileUtils.readText(new File(outputterConfigFile)));
  26. doOutputting(regionWkt, formatterConfig, binningContext, temporalBins);
  27. }
  28. stopWatch.stopAndTrace(String.format("Total time for binning %d product(s)", sourceFiles.length));
  29. }

代码示例来源:origin: bcdev/beam

  1. i++;
  2. } else if (isOption(args, i, 'd', "debug")) {
  3. Debug.setEnabled(true);
  4. } else if (isOption(args, i, 'f', "format")) {
  5. _formatExt = getOptionArg(args, i);

代码示例来源:origin: bcdev/beam

  1. public void testAssertNotNullOrEmpty() {
  2. Debug.setEnabled(false);
  3. try {
  4. Debug.assertNotNullOrEmpty(null);
  5. Debug.setEnabled(true);
  6. Debug.setWriter(new java.io.StringWriter());
  7. try {

代码示例来源:origin: bcdev/beam

  1. public void testRawAgainstOptimized(FXYSum fxyRaw, FXYSum fxyOpt) {
  2. final int m = 100;
  3. double[][] data = new double[m][3];
  4. double x, y, z;
  5. for (int i = 0; i < m; i++) {
  6. x = Math.PI * random(-0.5, +0.5);
  7. y = Math.PI * random(-0.5, +0.5);
  8. z = Math.sin((x * y) / 4.0 + (x + y) / 2.0);
  9. data[i][0] = x;
  10. data[i][1] = y;
  11. data[i][2] = z;
  12. }
  13. fxyRaw.approximate(data, null);
  14. fxyOpt.approximate(data, null);
  15. final boolean oldState = Debug.setEnabled(true);
  16. try {
  17. assertEquals(fxyRaw.getRootMeanSquareError(), fxyOpt.getRootMeanSquareError(), EPS);
  18. double zRaw, zOpt;
  19. for (int i = 0; i < 10; i++) {
  20. x = Math.PI * random(-0.5, +0.5);
  21. y = Math.PI * random(-0.5, +0.5);
  22. zRaw = fxyRaw.computeZ(x, y);
  23. zOpt = fxyOpt.computeZ(x, y);
  24. assertEquals(zRaw, zOpt, EPS);
  25. }
  26. } finally {
  27. Debug.setEnabled(oldState);
  28. }
  29. }

代码示例来源:origin: bcdev/beam

  1. debugEnabled = bV;
  2. if (debugEnabled) {
  3. Debug.setEnabled(true);

相关文章