1 25 26 package org.jrobin.core; 27 28 final class RrdCacher { 29 private boolean cached = false; 30 private int i; 31 private long l; 32 private double d; 33 private String s; 34 35 final boolean setInt(int value) { 36 if (cached && value == i) { 37 return false; 38 } 39 else { 40 i = value; 41 return cached = true; 42 } 43 } 44 45 final boolean setLong(long value) { 46 if(cached && value == l) { 47 return false; 48 } 49 else { 50 l = value; 51 return cached = true; 52 } 53 } 54 55 final boolean setDouble(double value) { 56 if(cached && value == d) { 57 return false; 58 } 59 else { 60 d = value; 61 return cached = true; 62 } 63 } 64 65 final boolean setString(String value) { 66 if(cached && value.equals(s)) { 67 return false; 68 } 69 else { 70 s = value; 71 return cached = true; 72 } 73 } 74 75 final boolean isEmpty() { 76 return !cached; 77 } 78 79 final int getInt() { 80 return i; 81 } 82 83 final long getLong() { 84 return l; 85 } 86 87 final double getDouble() { 88 return d; 89 } 90 91 final String getString() { 92 return s; 93 } 94 95 final void clearCache() { 96 cached = false; 97 } 98 99 } 100 | Popular Tags |