本文整理了Java中org.jdom2.Attribute.getDoubleValue()
方法的一些代码示例,展示了Attribute.getDoubleValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attribute.getDoubleValue()
方法的具体详情如下:
包路径:org.jdom2.Attribute
类名称:Attribute
方法名:getDoubleValue
[英]This gets the value of the attribute, in double
form, and if no conversion can occur, throws a DataConversionException
[中]它以double
的形式获取属性的值,如果无法进行转换,则抛出DataConversionException
代码示例来源:origin: sc.fiji/TrackMate_
private static final double readDistanceCutoffAttribute( final Element element )
{
double val = 0;
try
{
val = element.getChild( TRACKER_SETTINGS_DISTANCE_CUTOFF_ELEMENT )
.getAttribute( TRACKER_SETTINGS_DISTANCE_CUTOFF_ATTNAME_v12 ).getDoubleValue();
}
catch ( final DataConversionException e )
{}
return val;
}
代码示例来源:origin: sc.fiji/TrackMate_
private static final double readTimeCutoffAttribute( final Element element )
{
double val = 0;
try
{
val = element.getChild( TRACKER_SETTINGS_TIME_CUTOFF_ELEMENT )
.getAttribute( TRACKER_SETTINGS_TIME_CUTOFF_ATTNAME_v12 ).getDoubleValue();
}
catch ( final DataConversionException e )
{}
return val;
}
代码示例来源:origin: fiji/TrackMate
private static final double readDistanceCutoffAttribute( final Element element )
{
double val = 0;
try
{
val = element.getChild( TRACKER_SETTINGS_DISTANCE_CUTOFF_ELEMENT )
.getAttribute( TRACKER_SETTINGS_DISTANCE_CUTOFF_ATTNAME_v12 ).getDoubleValue();
}
catch ( final DataConversionException e )
{}
return val;
}
代码示例来源:origin: fiji/TrackMate
private static final double readTimeCutoffAttribute( final Element element )
{
double val = 0;
try
{
val = element.getChild( TRACKER_SETTINGS_TIME_CUTOFF_ELEMENT )
.getAttribute( TRACKER_SETTINGS_TIME_CUTOFF_ATTNAME_v12 ).getDoubleValue();
}
catch ( final DataConversionException e )
{}
return val;
}
代码示例来源:origin: sc.fiji/TrackMate_
private static double[] readCalibration( final File source ) throws JDOMException, IOException
{
final SAXBuilder sb = new SAXBuilder();
final Document document = sb.build( source );
final Element root = document.getRootElement();
final double[] calibration = new double[ 3 ];
final Element settings = root.getChild( "Settings" );
final Element imageData = settings.getChild( "ImageData" );
calibration[ 0 ] = imageData.getAttribute( "pixelwidth" ).getDoubleValue();
calibration[ 1 ] = imageData.getAttribute( "pixelheight" ).getDoubleValue();
calibration[ 2 ] = imageData.getAttribute( "voxeldepth" ).getDoubleValue();
return calibration;
}
代码示例来源:origin: fiji/TrackMate
private static double[] readCalibration( final File source ) throws JDOMException, IOException
{
final SAXBuilder sb = new SAXBuilder();
final Document document = sb.build( source );
final Element root = document.getRootElement();
final double[] calibration = new double[ 3 ];
final Element settings = root.getChild( "Settings" );
final Element imageData = settings.getChild( "ImageData" );
calibration[ 0 ] = imageData.getAttribute( "pixelwidth" ).getDoubleValue();
calibration[ 1 ] = imageData.getAttribute( "pixelheight" ).getDoubleValue();
calibration[ 2 ] = imageData.getAttribute( "voxeldepth" ).getDoubleValue();
return calibration;
}
代码示例来源:origin: fiji/TrackMate
/**
* Unmarshall the attributes of a JDom element in a map of doubles. Mappings
* are <b>added</b> to the specified map. If a value is found not to be a
* double, an error is returned.
*
* @return <code>true</code> if all values were found and mapped as doubles,
* <code>false</code> otherwise and the error holder is updated.
*/
public static boolean unmarshallMap( final Element element, final Map< String, Double > map, final StringBuilder errorHolder )
{
boolean ok = true;
final List< Attribute > attributes = element.getAttributes();
for ( final Attribute att : attributes )
{
final String key = att.getName();
try
{
final double val = att.getDoubleValue();
map.put( key, val );
}
catch ( final DataConversionException e )
{
errorHolder.append( "Could not convert the " + key + " attribute to double. Got " + att.getValue() + ".\n" );
ok = false;
}
}
return ok;
}
代码示例来源:origin: fiji/TrackMate
/**
* Look for all the sub-elements of <code>element</code> with the name
* TRACKER_SETTINGS_FEATURE_ELEMENT, fetch the feature attributes from them,
* and returns them in a map.
*/
private static final Map< String, Double > readTrackerFeatureMap( final Element element )
{
final Map< String, Double > map = new HashMap< >();
final List< Element > featurelinkingElements = element.getChildren( TRACKER_SETTINGS_FEATURE_ELEMENT );
for ( final Element el : featurelinkingElements )
{
final List< Attribute > atts = el.getAttributes();
for ( final Attribute att : atts )
{
final String feature = att.getName();
Double cutoff;
try
{
cutoff = att.getDoubleValue();
}
catch ( final DataConversionException e )
{
cutoff = 0d;
}
map.put( feature, cutoff );
}
}
return map;
}
代码示例来源:origin: sc.fiji/TrackMate_
/**
* Unmarshall the attributes of a JDom element in a map of doubles. Mappings
* are <b>added</b> to the specified map. If a value is found not to be a
* double, an error is returned.
*
* @return <code>true</code> if all values were found and mapped as doubles,
* <code>false</code> otherwise and the error holder is updated.
*/
public static boolean unmarshallMap( final Element element, final Map< String, Double > map, final StringBuilder errorHolder )
{
boolean ok = true;
final List< Attribute > attributes = element.getAttributes();
for ( final Attribute att : attributes )
{
final String key = att.getName();
try
{
final double val = att.getDoubleValue();
map.put( key, val );
}
catch ( final DataConversionException e )
{
errorHolder.append( "Could not convert the " + key + " attribute to double. Got " + att.getValue() + ".\n" );
ok = false;
}
}
return ok;
}
代码示例来源:origin: sc.fiji/TrackMate_
/**
* Look for all the sub-elements of <code>element</code> with the name
* TRACKER_SETTINGS_FEATURE_ELEMENT, fetch the feature attributes from them,
* and returns them in a map.
*/
private static final Map< String, Double > readTrackerFeatureMap( final Element element )
{
final Map< String, Double > map = new HashMap< >();
final List< Element > featurelinkingElements = element.getChildren( TRACKER_SETTINGS_FEATURE_ELEMENT );
for ( final Element el : featurelinkingElements )
{
final List< Attribute > atts = el.getAttributes();
for ( final Attribute att : atts )
{
final String feature = att.getName();
Double cutoff;
try
{
cutoff = att.getDoubleValue();
}
catch ( final DataConversionException e )
{
cutoff = 0d;
}
map.put( feature, cutoff );
}
}
return map;
}
代码示例来源:origin: sc.fiji/TrackMate_
try
attVal = attribute.getDoubleValue();
代码示例来源:origin: sc.fiji/TrackMate_
try
attVal = attribute.getDoubleValue();
代码示例来源:origin: fiji/TrackMate
try
attVal = attribute.getDoubleValue();
代码示例来源:origin: sc.fiji/TrackMate_
public static final double readDoubleAttribute(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.getDoubleValue();
} 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 readDoubleAttribute(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.getDoubleValue();
} catch (final DataConversionException e) {
logger.error("Cannot read the attribute "+name+" of the element "+element.getName()+", substituting default value.\n");
}
return val;
}
代码示例来源:origin: locationtech/jts
private PrecisionModel createPrecisionModel(Element precisionModelElement)
throws TestParseException {
Attribute scaleAttribute = precisionModelElement.getAttribute("scale");
if (scaleAttribute == null) {
throw new TestParseException(
"Missing scale attribute in <precisionModel>");
}
double scale;
try {
scale = scaleAttribute.getDoubleValue();
} catch (DataConversionException e) {
throw new TestParseException(
"Could not convert scale attribute to double: "
+ scaleAttribute.getValue());
}
return new PrecisionModel(scale);
}
代码示例来源:origin: sc.fiji/TrackMate_
private Spot createSpotFrom( final Element spotEl )
{
final int ID = readIntAttribute( spotEl, SPOT_ID_ATTRIBUTE_NAME, logger );
final Spot spot = new Spot( ID );
final List< Attribute > atts = spotEl.getAttributes();
atts.remove( SPOT_ID_ATTRIBUTE_NAME );
String name = spotEl.getAttributeValue( SPOT_NAME_ATTRIBUTE_NAME );
if ( null == name || name.equals( "" ) )
{
name = "ID" + ID;
}
spot.setName( name );
atts.remove( SPOT_NAME_ATTRIBUTE_NAME );
for ( final Attribute att : atts )
{
if ( att.getName().equals( SPOT_NAME_ATTRIBUTE_NAME ) || att.getName().equals( SPOT_ID_ATTRIBUTE_NAME ) )
{
continue;
}
try
{
spot.putFeature( att.getName(), att.getDoubleValue() );
}
catch ( final DataConversionException e )
{
logger.error( "Cannot read the feature " + att.getName() + " value. Skipping.\n" );
}
}
return spot;
}
代码示例来源:origin: fiji/TrackMate
private Spot createSpotFrom( final Element spotEl )
{
final int ID = readIntAttribute( spotEl, SPOT_ID_ATTRIBUTE_NAME, logger );
final Spot spot = new Spot( ID );
final List< Attribute > atts = spotEl.getAttributes();
atts.remove( SPOT_ID_ATTRIBUTE_NAME );
String name = spotEl.getAttributeValue( SPOT_NAME_ATTRIBUTE_NAME );
if ( null == name || name.equals( "" ) )
{
name = "ID" + ID;
}
spot.setName( name );
atts.remove( SPOT_NAME_ATTRIBUTE_NAME );
for ( final Attribute att : atts )
{
if ( att.getName().equals( SPOT_NAME_ATTRIBUTE_NAME ) || att.getName().equals( SPOT_ID_ATTRIBUTE_NAME ) )
{
continue;
}
try
{
spot.putFeature( att.getName(), att.getDoubleValue() );
}
catch ( final DataConversionException e )
{
logger.error( "Cannot read the feature " + att.getName() + " value. Skipping.\n" );
}
}
return spot;
}
代码示例来源:origin: fiji/TrackMate
try
attVal = attribute.getDoubleValue();
代码示例来源:origin: sc.fiji/TrackMate_
try
attVal = attribute.getDoubleValue();
内容来源于网络,如有侵权,请联系作者删除!