-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
emissions grid using jersey #104
base: master
Are you sure you want to change the base?
Conversation
while (result != null) { | ||
log.info("-- JSON size: " + result.getSecond().length()); | ||
|
||
Bin b = new Bin(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use single character names
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're being pedantic, the code is crystal-clear, but I will fix it for you. Would Bin bin
be more appropriate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I am. Yes it is.
b.setData(result.getSecond()); | ||
mergedViz.addBin(b); | ||
|
||
result = analyzer.processNextTimeBin(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, we can leave it like this for now. But having a while loop with a null condition looks error prone. Maybe the Iterator Interface is what you want here? I'm not sure, but maybe that would come close to the yield return we were talking about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the main thing I was wondering about in this commit. It feels dirty to me as well. In Java I'm not sure what the least-errorprone / most-appropriate form would be. I'll look at the Iterator interface.
@Lob | ||
private String data = ""; | ||
@OneToMany(mappedBy = "visualization", fetch = FetchType.LAZY, orphanRemoval = true, cascade = CascadeType.ALL) | ||
Set<Bin> bins = new HashSet(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bins property should be private.
} | ||
|
||
@GET | ||
@Path("/bins") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be a good idea to rename the endpoints.
data -> bin
bins -> startTimes
return findVisualization(agent, vizId).getData(); | ||
if (startTimes == null) | ||
throw new InvalidInputException("No time bins found"); | ||
return startTimes; | ||
} | ||
|
||
private Visualization findVisualization(Agent agent, String vizId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this method still used? otherwise please remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make changes and merge
Seems to all be working and the Jersey code is WAAAAY better than what I had before.