test_class.declarator: DATE_FORMAT = "yyyy.MM.dd_HH:mm:ss"
test_class.modifier: private static
test_class.original_string: private static String DATE_FORMAT = "yyyy.MM.dd_HH:mm:ss";
test_class.type: String
test_class.var_name: DATE_FORMAT
test_class.declarator: UTC = TimeZone.getTimeZone("UTC")
test_class.modifier: private static
test_class.original_string: private static TimeZone UTC = TimeZone.getTimeZone("UTC");
test_class.type: TimeZone
test_class.var_name: UTC
test_class.file: sjk-stacktrace/src/test/java/org/gridkit/jvmtool/stacktrace/analytics/TimeRangeCheckerTest.java
test_class.identifier: TimeRangeCheckerTest
test_case.body: @Test
      public void verify_year_accurate_range() {
          TimeRangeChecker checker = new TimeRangeChecker("16.02.20_18:10:00", "16.04.10_02:20:00", UTC);
  
          assertFalse(checker.evaluate(date("2015.02.20_18:10:00")));
          assertFalse(checker.evaluate(date("2016.02.20_18:09:00")));
          assertTrue (checker.evaluate(date("2016.02.20_18:10:00")));
          assertTrue (checker.evaluate(date("2016.02.25_10:11:00")));
          assertTrue (checker.evaluate(date("2016.03.13_11:18:00")));
          assertTrue (checker.evaluate(date("2016.03.14_11:40:00")));
          assertTrue (checker.evaluate(date("2016.04.10_02:19:59")));
          assertFalse(checker.evaluate(date("2016.04.10_02:20:00")));
          assertFalse(checker.evaluate(date("2016.09.20_02:21:00")));
      }
test_case.class_method_signature: TimeRangeCheckerTest.verify_year_accurate_range()
test_case.full_signature: @Test public void verify_year_accurate_range()
test_case.identifier: verify_year_accurate_range
test_case.invocations: assertFalse evaluate date assertFalse evaluate date assertTrue evaluate date assertTrue evaluate date assertTrue evaluate date assertTrue evaluate date assertTrue evaluate date assertFalse evaluate date assertFalse evaluate date
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void verify_year_accurate_range()
focal_class.declarator: DATE_FORMAT = "yyyy.MM.dd_HH:mm:ss"
focal_class.modifier: private static
focal_class.original_string: private static String DATE_FORMAT = "yyyy.MM.dd_HH:mm:ss";
focal_class.type: String
focal_class.var_name: DATE_FORMAT
focal_class.declarator: DATE_PATTERN = "(((((((\\d\\d)?\\d\\d[.])?\\d\\d[.])?\\d\\d[_])?\\d\\d[:])?\\d\\d[:])\\d\\d)"
focal_class.modifier: private static
focal_class.original_string: private static String DATE_PATTERN = "(((((((\\d\\d)?\\d\\d[.])?\\d\\d[.])?\\d\\d[_])?\\d\\d[:])?\\d\\d[:])\\d\\d)";
focal_class.type: String
focal_class.var_name: DATE_PATTERN
focal_class.declarator: whiteCache = new long[0]
focal_class.modifier: private
focal_class.original_string: private long[] whiteCache = new long[0];
focal_class.type: long[]
focal_class.var_name: whiteCache
focal_class.declarator: blackCache = new long[0]
focal_class.modifier: private
focal_class.original_string: private long[] blackCache = new long[0];
focal_class.type: long[]
focal_class.var_name: blackCache
focal_class.declarator: lowerBound
focal_class.modifier: private
focal_class.original_string: private int[] lowerBound;
focal_class.type: int[]
focal_class.var_name: lowerBound
focal_class.declarator: upperBound
focal_class.modifier: private
focal_class.original_string: private int[] upperBound;
focal_class.type: int[]
focal_class.var_name: upperBound
focal_class.declarator: tz
focal_class.modifier: private
focal_class.original_string: private TimeZone tz;
focal_class.type: TimeZone
focal_class.var_name: tz
focal_class.declarator: inverted = false
focal_class.modifier: private
focal_class.original_string: private boolean inverted = false;
focal_class.type: boolean
focal_class.var_name: inverted
focal_class.declarator: FIELDS = {Calendar.YEAR, Calendar.YEAR, Calendar.MONTH, Calendar.DAY_OF_MONTH, Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND}
focal_class.modifier: private static
focal_class.original_string: private static int[] FIELDS = {Calendar.YEAR, Calendar.YEAR, Calendar.MONTH, Calendar.DAY_OF_MONTH, Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND};
focal_class.type: int[]
focal_class.var_name: FIELDS
focal_class.file: sjk-stacktrace/src/main/java/org/gridkit/jvmtool/stacktrace/analytics/TimeRangeChecker.java
focal_class.identifier: TimeRangeChecker
focal_class.class_method_signature: TimeRangeChecker.TimeRangeChecker(String lower, String upper, TimeZone tz)
focal_class.full_signature: public  TimeRangeChecker(String lower, String upper, TimeZone tz)
focal_class.identifier: TimeRangeChecker
focal_class.modifiers: public
focal_class.parameters: (String lower, String upper, TimeZone tz)
focal_class.signature:  TimeRangeChecker(String lower, String upper, TimeZone tz)
focal_class.class_method_signature: TimeRangeChecker.parse(String bound)
focal_class.full_signature: private int[] parse(String bound)
focal_class.identifier: parse
focal_class.modifiers: private
focal_class.parameters: (String bound)
focal_class.return: int[]
focal_class.signature: int[] parse(String bound)
focal_class.class_method_signature: TimeRangeChecker.substring(String txt, int n, int m)
focal_class.full_signature: private String substring(String txt, int n, int m)
focal_class.identifier: substring
focal_class.modifiers: private
focal_class.parameters: (String txt, int n, int m)
focal_class.return: String
focal_class.signature: String substring(String txt, int n, int m)
focal_class.class_method_signature: TimeRangeChecker.isCached(long timestamp)
focal_class.full_signature:  boolean isCached(long timestamp)
focal_class.identifier: isCached
focal_class.parameters: (long timestamp)
focal_class.return: boolean
focal_class.signature: boolean isCached(long timestamp)
focal_class.class_method_signature: TimeRangeChecker.evaluate(long timestamp)
focal_class.full_signature: public boolean evaluate(long timestamp)
focal_class.identifier: evaluate
focal_class.modifiers: public
focal_class.parameters: (long timestamp)
focal_class.return: boolean
focal_class.signature: boolean evaluate(long timestamp)
focal_class.class_method_signature: TimeRangeChecker.match(int[] p, int[] lower, int[] upper)
focal_class.full_signature: private boolean match(int[] p, int[] lower, int[] upper)
focal_class.identifier: match
focal_class.modifiers: private
focal_class.parameters: (int[] p, int[] lower, int[] upper)
focal_class.return: boolean
focal_class.signature: boolean match(int[] p, int[] lower, int[] upper)
focal_class.class_method_signature: TimeRangeChecker.checkInRange(int[] p, int i, boolean matchLower, boolean matchUpper)
focal_class.full_signature: private boolean checkInRange(int[] p, int i, boolean matchLower, boolean matchUpper)
focal_class.identifier: checkInRange
focal_class.modifiers: private
focal_class.parameters: (int[] p, int i, boolean matchLower, boolean matchUpper)
focal_class.return: boolean
focal_class.signature: boolean checkInRange(int[] p, int i, boolean matchLower, boolean matchUpper)
focal_class.class_method_signature: TimeRangeChecker.adjust(long ldate, int step)
focal_class.full_signature: private long adjust(long ldate, int step)
focal_class.identifier: adjust
focal_class.modifiers: private
focal_class.parameters: (long ldate, int step)
focal_class.return: long
focal_class.signature: long adjust(long ldate, int step)
focal_class.class_method_signature: TimeRangeChecker.add(long[] cache, long ldate, long udate)
focal_class.full_signature: private long[] add(long[] cache, long ldate, long udate)
focal_class.identifier: add
focal_class.modifiers: private
focal_class.parameters: (long[] cache, long ldate, long udate)
focal_class.return: long[]
focal_class.signature: long[] add(long[] cache, long ldate, long udate)
focal_class.class_method_signature: TimeRangeChecker.toDate(int[] r)
focal_class.full_signature: private long toDate(int[] r)
focal_class.identifier: toDate
focal_class.modifiers: private
focal_class.parameters: (int[] r)
focal_class.return: long
focal_class.signature: long toDate(int[] r)
focal_class.class_method_signature: TimeRangeChecker.match(long[] cache, long timestamp)
focal_class.full_signature: private boolean match(long[] cache, long timestamp)
focal_class.identifier: match
focal_class.modifiers: private
focal_class.parameters: (long[] cache, long timestamp)
focal_class.return: boolean
focal_class.signature: boolean match(long[] cache, long timestamp)
focal_method.body: public boolean evaluate(long timestamp) {
          if (match(whiteCache, timestamp)) {
              return true;
          }
          if (match(blackCache, timestamp)) {
              return false;
          }
  
          SimpleDateFormat fmt = new SimpleDateFormat(DATE_FORMAT);
          fmt.setTimeZone(tz);
          String date = fmt.format(timestamp);
  
          int[] p = parse(date);
          int[] rl = Arrays.copyOf(p, p.length);
          int[] ru = Arrays.copyOf(p, p.length);
  
          boolean match = match(p, lowerBound, upperBound);
  
          for(int j = 0; j != rl.length; ++j) {
              if (lowerBound[j] != -1) {
                  rl[j] = lowerBound[j];
                  ru[j] = upperBound[j];
              }
          }
          if (match) {
              // match
              long ldate = toDate(rl);
              long udate = toDate(ru);
              if (ldate == -1 || udate == -1) {
                  // do not cache
                  return true;
              }
              if (udate > ldate) {
                  whiteCache = add(whiteCache, ldate, udate);
              }
              else {
                  if (timestamp >= ldate && timestamp >= udate) {
                      udate = adjust(udate, 1);
                      whiteCache = add(whiteCache, ldate, udate);
                  }
                  else {
                      ldate = adjust(ldate, -1);
                      whiteCache = add(whiteCache, ldate, udate);
                  }
              }
              return true;
          }
          else {
              // do not match
              long ldate = toDate(rl);
              long udate = toDate(ru);
              if (ldate == -1 || udate == -1) {
                  // do not cache
                  return false;
              }
              if (timestamp >= ldate && timestamp >= udate) {
                  ldate = adjust(ldate, 1);
                  blackCache = add(blackCache, udate, ldate);
              }
              else {
                  udate = adjust(udate, -1);
                  blackCache = add(blackCache, udate, ldate);
              }
              return false;
          }
      }
focal_method.class_method_signature: TimeRangeChecker.evaluate(long timestamp)
focal_method.full_signature: public boolean evaluate(long timestamp)
focal_method.identifier: evaluate
focal_method.invocations: match match setTimeZone format parse copyOf copyOf match toDate toDate add adjust add adjust add toDate toDate adjust add adjust add
focal_method.modifiers: public
focal_method.parameters: (long timestamp)
focal_method.return: boolean
focal_method.signature: boolean evaluate(long timestamp)