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

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

本文整理了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

@Override
protected void setUp() {
  //_oldDebugState = Debug.setEnabled(true);
  _oldDebugState = Debug.setEnabled(false);
}

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

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

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

@Override
protected void tearDown() {
  Debug.setEnabled(_oldDebugState);
}

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

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

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

@Override
protected void tearDown() {
  Debug.setEnabled(_oldDebugState);
}

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

private static boolean isDebugClassTestable() {
  boolean oldDebugState = Debug.isEnabled();
  Debug.setEnabled(true);
  boolean newDebugState = Debug.isEnabled();
  Debug.setEnabled(oldDebugState);
  return newDebugState;
}

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

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

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

public void testAssertNotNull() {
  Debug.setEnabled(false);
  try {
    Debug.assertNotNull(new Object());
  } catch (AssertionFailure e) {
    fail("no AssertionFailure expected");
  }
  try {
    Debug.assertNotNull(null);
  } catch (AssertionFailure e) {
    fail("no AssertionFailure expected");
  }
  Debug.setEnabled(true);
  Debug.setWriter(new java.io.StringWriter());
  try {
    Debug.assertNotNull(new Object());
  } catch (AssertionFailure e) {
    fail("no AssertionFailure expected");
  }
  try {
    Debug.assertNotNull(null);
    fail("AssertionFailure expected");
  } catch (AssertionFailure e) {
  }
}

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

public void testAssertWidthoutMessage() {
  Debug.setEnabled(false);
  try {
    Debug.assertTrue(true);
  } catch (AssertionFailure e) {
    fail("no AssertionFailure expected");
  }
  try {
    Debug.assertTrue(false);
  } catch (AssertionFailure e) {
    fail("no AssertionFailure expected");
  }
  Debug.setEnabled(true);
  java.io.StringWriter sw = new java.io.StringWriter();
  Debug.setWriter(sw);
  try {
    Debug.assertTrue(true);
  } catch (AssertionFailure e) {
    fail("no AssertionFailure expected");
  }
  try {
    Debug.assertTrue(false);
    fail("AssertionFailure expected");
  } catch (AssertionFailure e) {
  }
  String assertionFailureMsg = sw.getBuffer().toString();
  String expectedContent = Debug.class.getName();
  assertEquals(true, assertionFailureMsg.indexOf(expectedContent) >= 0);
}

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

public void testAssertWidtMessage() {
  Debug.setEnabled(false);
  try {
    Debug.assertTrue(true, "ErrorMessage");
  } catch (AssertionFailure e) {
    fail("no AssertionFailure expected");
  }
  try {
    Debug.assertTrue(false, "ErrorMessage");
  } catch (AssertionFailure e) {
    fail("no AssertionFailure expected");
  }
  Debug.setEnabled(true);
  java.io.StringWriter sw = new java.io.StringWriter();
  Debug.setWriter(sw);
  try {
    Debug.assertTrue(true, "ErrorMessage");
  } catch (AssertionFailure e) {
    fail("no AssertionFailure expected");
  }
  try {
    Debug.assertTrue(false, "ErrorMessage");
    fail("AssertionFailure expected");
  } catch (AssertionFailure e) {
    assertEquals("ErrorMessage", e.getMessage());
  }
  String assertionFailureMsg = sw.getBuffer().toString();
  String expectedContent = Debug.class.getName();
  assertEquals(true, assertionFailureMsg.indexOf(expectedContent) >= 0);
}

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

public static void main(String[] args) throws Exception {
  String sourceDirFile = args[0];
  String regionWktFile = args[1];
  String binnerConfigFile = args[2];
  String[] outputterConfigFiles = new String[args.length - 3];
  System.arraycopy(args, 3, outputterConfigFiles, 0, outputterConfigFiles.length);
  File[] sourceFiles = new File(sourceDirFile).listFiles(new FilenameFilter() {
    @Override
    public boolean accept(File dir, String name) {
      return name.endsWith(".N1");
    }
  });
  String regionWkt = FileUtils.readText(new File(regionWktFile));
  BinningConfig binningConfig = BinningConfig.fromXml(FileUtils.readText(new File(binnerConfigFile)));
  Debug.setEnabled(true);
  StopWatch stopWatch = new StopWatch();
  stopWatch.start();
  BinningContext binningContext = binningConfig.createBinningContext(null, null, null);
  // 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>
  SortedMap<Long, List<SpatialBin>> spatialBinMap = doSpatialBinning(binningContext, sourceFiles);
  // Step 2: Temporal binning - creates a list of temporal bins, sorted by bin ID
  List<TemporalBin> temporalBins = doTemporalBinning(binningContext, spatialBinMap);
  // Step 3: Formatting
  for (String outputterConfigFile : outputterConfigFiles) {
    FormatterConfig formatterConfig = FormatterConfig.fromXml(FileUtils.readText(new File(outputterConfigFile)));
    doOutputting(regionWkt, formatterConfig, binningContext, temporalBins);
  }
  stopWatch.stopAndTrace(String.format("Total time for binning %d product(s)", sourceFiles.length));
}

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

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

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

public void testAssertNotNullOrEmpty() {
  Debug.setEnabled(false);
  try {
    Debug.assertNotNullOrEmpty(null);
  Debug.setEnabled(true);
  Debug.setWriter(new java.io.StringWriter());
  try {

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

public void testRawAgainstOptimized(FXYSum fxyRaw, FXYSum fxyOpt) {
  final int m = 100;
  double[][] data = new double[m][3];
  double x, y, z;
  for (int i = 0; i < m; i++) {
    x = Math.PI * random(-0.5, +0.5);
    y = Math.PI * random(-0.5, +0.5);
    z = Math.sin((x * y) / 4.0 + (x + y) / 2.0);
    data[i][0] = x;
    data[i][1] = y;
    data[i][2] = z;
  }
  fxyRaw.approximate(data, null);
  fxyOpt.approximate(data, null);
  final boolean oldState = Debug.setEnabled(true);
  try {
    assertEquals(fxyRaw.getRootMeanSquareError(), fxyOpt.getRootMeanSquareError(), EPS);
    double zRaw, zOpt;
    for (int i = 0; i < 10; i++) {
      x = Math.PI * random(-0.5, +0.5);
      y = Math.PI * random(-0.5, +0.5);
      zRaw = fxyRaw.computeZ(x, y);
      zOpt = fxyOpt.computeZ(x, y);
      assertEquals(zRaw, zOpt, EPS);
    }
  } finally {
    Debug.setEnabled(oldState);
  }
}

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

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

相关文章