private boolean isActive(Calendar activeStart,Calendar inactiveStart){
  if (inactiveStart != null && activeStart != null && inactiveStart.before(activeStart))   return !isActive(inactiveStart,activeStart);
  Calendar current=Calendar.getInstance();
  return !(activeStart != null && current.before(activeStart)) && !(inactiveStart != null && current.after(inactiveStart));
}

private boolean isActive ( Calendar activeStart , Calendar inactiveStart ) { if ( inactiveStart != null && activeStart != null && inactiveStart . before ( activeStart ) ) return ! isActive ( inactiveStart , activeStart ) ; Calendar current = Calendar . getInstance ( ) ; return ! ( activeStart != null && current . before ( activeStart ) ) && ! ( inactiveStart != null && current . after ( inactiveStart ) ) ; }
given a time when a particular state changes from inactive to active , and a time when a particular state changes from active to inactive , determines whether that state is currently active .
