code: private static boolean isEquivalentDateRule(int month, int weekInMonth, int dayOfWeek, DateTimeRule dtrule) {
          if (month != dtrule.getRuleMonth() || dayOfWeek != dtrule.getRuleDayOfWeek()) {
              return false;
          }
          if (dtrule.getTimeRuleType() != DateTimeRule.WALL_TIME) {
              // Do not try to do more intelligent comparison for now.
              return false;
          }
          if (dtrule.getDateRuleType() == DateTimeRule.DOW
                  && dtrule.getRuleWeekInMonth() == weekInMonth) {
              return true;
          }
          int ruleDOM = dtrule.getRuleDayOfMonth();
          if (dtrule.getDateRuleType() == DateTimeRule.DOW_GEQ_DOM) {
              if (ruleDOM%7 == 1 && (ruleDOM + 6)/7 == weekInMonth) {
                  return true;
              }
              if (month != Calendar.FEBRUARY && (MONTHLENGTH[month] - ruleDOM)%7 == 6
                      && weekInMonth == -1*((MONTHLENGTH[month]-ruleDOM+1)/7)) {
                  return true;
              }
          }
          if (dtrule.getDateRuleType() == DateTimeRule.DOW_LEQ_DOM) {
              if (ruleDOM%7 == 0 && ruleDOM/7 == weekInMonth) {
                  return true;
              }
              if (month != Calendar.FEBRUARY && (MONTHLENGTH[month] - ruleDOM)%7 == 0
                      && weekInMonth == -1*((MONTHLENGTH[month] - ruleDOM)/7 + 1)) {
                  return true;
              }
          }
          return false;
      }
docs: /*
  Check if the DOW rule specified by month, weekInMonth and dayOfWeek is equivalent
  to the DateTimerule.