Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFraction.java @ 6970:7be97faf5848
flys/issue1235: Same kicks against a few inconsistencies and bugs in the calculation of sediment loads. I believe it _do_not_ delivers the right results.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 05 Sep 2013 17:15:04 +0200 |
parents | 33f3cc375a23 |
children | 9f45c17e8fda |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFraction.java Thu Sep 05 15:47:24 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFraction.java Thu Sep 05 17:15:04 2013 +0200 @@ -25,15 +25,15 @@ double total; double unknown; /** Values are valid within this km range. */ - Range sandRange = null; - Range fineMiddleRange = null; - Range coarseRange = null; - Range suspSandRange = null; - Range suspSandBedRange = null; - Range suspSedimentRange = null; - Range loadTotalRange = null; - Range totalRange = null; - Range unknownRange = null; + Range sandRange; + Range fineMiddleRange; + Range coarseRange; + Range suspSandRange; + Range suspSandBedRange; + Range suspSedimentRange; + Range loadTotalRange; + Range totalRange; + Range unknownRange; public SedimentLoadFraction() { sand = 0d; @@ -189,5 +189,35 @@ public void setUnknownRange(Range unknownRange) { this.unknownRange = unknownRange; } + + /** Returns true if all fraction values except SuspSediment are unset. */ + public boolean hasOnlySuspValues() { + return + getSuspSediment() != 0d && + getCoarse() == 0d && + getFineMiddle() == 0d && + getSand() == 0d && + getSuspSand() == 0d; + } + + /** Returns true if all fraction values except SuspSediment are set. */ + public boolean hasButSuspValues() { + return + getSuspSediment() == 0d && + getCoarse() != 0d && + getFineMiddle() != 0d && + getSand() != 0d && + getSuspSand() != 0d; + } + + /** Returns true if all fraction needed for total calculation are set. */ + public boolean isComplete() { + return + getCoarse() != 0d && + getFineMiddle() != 0d && + getSand() != 0d && + getSuspSand() != 0d && + getSuspSediment() != 0d; + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :