org.jdom2.Attribute.getFloatValue()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(149)

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

Attribute.getFloatValue介绍

[英]This gets the value of the attribute, in float form, and if no conversion can occur, throws a DataConversionException
[中]它以float的形式获取属性的值,如果无法进行转换,则抛出DataConversionException

代码示例

代码示例来源:origin: sc.fiji/TrackMate_

public static final double readFloatAttribute(final Element element, final String name, final Logger logger) {
  double val = 0;
  final Attribute att = element.getAttribute(name);
  if (null == att) {
    logger.error("Could not find attribute "+name+" for element "+element.getName()+", substituting default value.\n");
    return val;
  }
  try {
    val = att.getFloatValue();
  } catch (final DataConversionException e) {
    logger.error("Cannot read the attribute "+name+" of the element "+element.getName()+", substituting default value.\n");
  }
  return val;
}

代码示例来源:origin: fiji/TrackMate

public static final double readFloatAttribute(final Element element, final String name, final Logger logger) {
  double val = 0;
  final Attribute att = element.getAttribute(name);
  if (null == att) {
    logger.error("Could not find attribute "+name+" for element "+element.getName()+", substituting default value.\n");
    return val;
  }
  try {
    val = att.getFloatValue();
  } catch (final DataConversionException e) {
    logger.error("Cannot read the attribute "+name+" of the element "+element.getName()+", substituting default value.\n");
  }
  return val;
}

代码示例来源:origin: vasl-developers/vasl

terrain.setHalfLevelHeight(e.getAttribute(terrainTypeIsHalfLevelHeightAttr).getBooleanValue());
terrain.setInherentTerrain(e.getAttribute(terrainTypeIsInherentTerrainAttr).getBooleanValue());
terrain.setSplit(e.getAttribute(terrainTypeSplitAttr).getFloatValue());
terrain.setLowerLOSHindrance(e.getAttribute(terrainTypeIsLowerLOSHindranceAttr).getBooleanValue());
terrain.setLowerLOSObstacle(e.getAttribute(terrainTypeIsLowerLOSObstacleAttr).getBooleanValue());

相关文章