1 /* 2 * Copyright (C) 2001 - 2005 ScalAgent Distributed Technologies 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 17 * USA. 18 * 19 * Initial developer(s): ScalAgent Distributed Technologies 20 * Contributor(s): 21 */ 22 package com.scalagent.scheduler.event; 23 24 /** 25 * The <code>DiaryEvent</code> interface allows access to the occurrence dates 26 * of an event that could be stored in a diary. 27 */ 28 public interface DiaryEvent extends java.io.Serializable { 29 /** 30 * Gets the next event date after the parameter date. Returns 31 * <code>-1</code> if there is no such date. 32 * 33 * @param now 34 * starting date for the lookup 35 * @param inclusive 36 * if <code>true</code> checks <code>now</code> as an answer 37 * @return 38 * the next event date after now, 39 * <code>-1</code> if there is no such date 40 */ 41 public long getNextDate(long now, boolean inclusive); 42 43 /** 44 * Gets the next event date after the parameter date. Returns 45 * <code>-1</code> if there is no such date. 46 * Calls {@link getNextDate(long, boolean) getNextDate} with the 47 * <code>inclusive</code> parameter set to <code>false</code>. 48 * 49 * @param now 50 * starting date for the lookup 51 * @return 52 * the next event date after now, 53 * <code>-1</code> if there is no such date 54 */ 55 public long getNextDate(long now); 56 57 /** 58 * Gets the last event date before the parameter date. Returns 59 * <code>-1</code> if there is no such date. 60 * 61 * @param now 62 * starting date for the backward lookup 63 * @param inclusive 64 * if <code>true</code> checks <code>now</code> as an answer 65 * @return 66 * the last event date before now, 67 * <code>-1</code> if there is no such date 68 */ 69 public long getLastDate(long now, boolean inclusive); 70 71 /** 72 * Gets the last event date before the parameter date. Returns 73 * <code>-1</code> if there is no such date. 74 * Calls {@link getLastDate(long, boolean) getLastDate} with the 75 * <code>inclusive</code> parameter set to <code>false</code>. 76 * 77 * @param now 78 * starting date for the backward lookup 79 * @return 80 * the last event date before now, 81 * <code>-1</code> if there is no such date 82 */ 83 public long getLastDate(long now); 84 } 85