Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dawn-java-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dawn
java
dawn-java-common
Commits
d3bcaa29
Commit
d3bcaa29
authored
1 year ago
by
Tucker Gary Siegel
Browse files
Options
Downloads
Patches
Plain Diff
add product to the common package since it will be shared
parent
35afb5f7
No related branches found
Branches containing commit
Tags
0.13.0
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/edu/umd/dawn/common/enums/Product.java
+36
-0
36 additions, 0 deletions
src/main/java/edu/umd/dawn/common/enums/Product.java
src/main/java/edu/umd/dawn/common/exceptions/BaseExceptions.java
+3
-0
3 additions, 0 deletions
...n/java/edu/umd/dawn/common/exceptions/BaseExceptions.java
with
39 additions
and
0 deletions
src/main/java/edu/umd/dawn/common/enums/Product.java
0 → 100644
+
36
−
0
View file @
d3bcaa29
package
edu.umd.dawn.common.enums
;
import
edu.umd.dawn.common.exceptions.DawnException
;
import
edu.umd.dawn.common.exceptions.BaseExceptions
;
import
java.util.Map
;
public
enum
Product
{
CORN
(
50.0
);
public
final
double
baseTemp
;
private
Product
(
double
baseTemp
)
{
this
.
baseTemp
=
baseTemp
;
}
public
Map
<
String
,
Double
>
getStages
(
String
mode
,
int
value
)
{
if
(!
this
.
equals
(
CORN
))
{
throw
new
DawnException
(
BaseExceptions
.
PRODUCT_UNSUPPORTED
);
}
double
harvestVal
;
if
(
mode
.
equals
(
"rm"
))
{
harvestVal
=
((((
double
)
value
)
-
95.0
)
*
22.0
)
+
2375.0
;
}
else
{
harvestVal
=
(
double
)
value
;
}
return
Map
.
of
(
"emergence"
,
harvestVal
*
0.07
,
"3LeafCollar"
,
harvestVal
*
0.13
,
"6LeafCollar"
,
harvestVal
*
0.2
,
"silk"
,
harvestVal
*
0.545
,
"milk"
,
harvestVal
*
0.725
,
"harvest"
,
harvestVal
);
}
}
This diff is collapsed.
Click to expand it.
src/main/java/edu/umd/dawn/common/exceptions/BaseExceptions.java
+
3
−
0
View file @
d3bcaa29
...
...
@@ -35,4 +35,7 @@ public class BaseExceptions {
public
static
DawnExceptionParameters
INVALID_OFFSET
(
int
offset
)
{
return
new
DawnExceptionParameters
(
400
,
"BAD_REQUEST"
,
String
.
format
(
"offset of %d is invalid"
,
offset
),
""
);
}
public
static
final
DawnExceptionParameters
PRODUCT_UNSUPPORTED
=
new
DawnExceptionParameters
(
400
,
"BAD_REQUEST"
,
"This operation is unsupported for provided product"
,
""
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment