public int calcWeek(int y, int m, int d) { if (!validateDate(y, m, d)) { System.out.println("日期格式不正确"); return -1; } if ((y > 2008) || (y < 1980)) { System.out.println("年份越界"); return -1; } int allday = 1; for (int i = 1980; i < y; i++) { if (isLoop(i)) { allday += 366; } else { allday += 365; } allday = allday % 7; } switch (m) { case 12: allday += 30; case 11: allday += 31; case 10: allday += 30; case 9: allday += 31; case 8: allday += 31; case 7: allday += 30; case 6: allday += 31; case 5: allday += 30; case 4: allday += 31; case 3: allday += 28; case 2: allday += 31; case 1: allday += d; default : break; } int week; if ((isLoop(y)) && (m > 2)) { allday += 1; } week = allday % 7; num++; return week; }该代码的桩模块
时间: 2024-02-10 15:32:50 浏览: 64
jquery.validate 版本大全
这段代码的桩模块应该是validateDate(int y, int m, int d)方法,该方法用于验证输入的日期是否合法。如果输入的年月日不合法,该方法会返回false,否则返回true。在calcWeek(int y, int m, int d)方法中,首先会调用validateDate(int y, int m, int d)方法进行日期合法性验证,如果日期不合法则会输出错误信息并返回-1。因此,该方法的正确性和可靠性受到validateDate(int y, int m, int d)方法的影响。
阅读全文