boolean isValid ( int cycle , int yearOfCycle , EastAsianMonth month , int dayOfMonth ) { if ( ( cycle < 72 ) || ( cycle > 94 ) || ( yearOfCycle < 1 ) || ( yearOfCycle > 60 ) || ( ( cycle == 72 ) && ( yearOfCycle < 22 ) ) || ( ( cycle == 94 ) && ( yearOfCycle > 56 ) ) || ( dayOfMonth < 1 ) || ( dayOfMonth > 30 ) || ( month == null ) || ( month . isLeap ( ) && ( month . getNumber ( ) != this . getLeapMonth ( cycle , yearOfCycle ) ) ) ) { return false ; } else if ( dayOfMonth == 30 ) { // the only case when astronomical validation is required long monthStart = this . firstDayOfMonth ( cycle , yearOfCycle , month ) ; long nextNewMoon = this . newMoonOnOrAfter ( monthStart + 1 ) ; return ( nextNewMoon - monthStart == 30 ) ; } return true ; }
true if valid else false