Skip to content

Commit

Permalink
https://github.com/das-developers/das2java/issues/104.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbfaden committed Apr 4, 2024
1 parent 7437775 commit d127316
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion dasCoreDatum/src/org/das2/datum/DatumRange.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,21 @@ public String toString() {
}
} else {
Units u= getUnits();
return ""+ this.s1.getFormatter().format(this.s1,u) + " to " + this.s1.getFormatter().format(this.s2,u) + " " + u;
boolean isDouble= !( UnitsUtil.isTimeLocation(u) || UnitsUtil.isNominalMeasurement(u) );
String ss1= this.s1.getFormatter().format(this.s1,u);
String ss2= this.s2.getFormatter().format(this.s2,u);
Datum w= this.width();
if ( isDouble && Double.parseDouble(ss1)==Double.parseDouble(ss2) && w.value()>0 ) {
Datum d1= Datum.create( this.s1.doubleValue(u), u, w.value()/100 );
Datum d2= Datum.create( this.s2.doubleValue(u), u, w.value()/100 );
ss1= d1.getFormatter().format(d1,u);
ss2= d2.getFormatter().format(d2,u);
}
if ( u==Units.dimensionless ) {
return String.format( "%s to %s", ss1, ss2 );
} else {
return String.format( "%s to %s %s", ss1, ss2, u.toString() );
}
}
}

Expand Down

0 comments on commit d127316

Please sign in to comment.