Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public float get(long timestamp) {
- if (cachedHigherTs != -1) {
- if (timestamp < cachedHigherTs) {
- return cachedVal;
- }
- }
- Entry<Long, Float> result = samples.floorEntry(timestamp);
- Entry<Long, Float> higher = samples.higherEntry(timestamp);
- if (result == null) {
- cachedVal = 0.0f;
- } else {
- cachedVal = result.getValue();
- }
- if (higher == null) {
- cachedHigherTs = Long.MAX_VALUE;
- } else {
- cachedHigherTs = higher.getKey();
- }
- return cachedVal;
- }
- ==========
- @Override
- public float get(long timestamp) {
- return getFloor(timestamp);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement