1 /* 2 * File: Event.java 3 * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) 4 * A commercial license is available, see http://www.jaret.de. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 */ 20 package de.jaret.util.date; 21 22 23 /** 24 * Extension of the interval implementation forming a single point in time. 25 * 26 * @author kliem 27 * @version $Id: Event.java 562 2007-09-15 14:45:12Z olk $ 28 */ 29 public class Event extends IntervalImpl { 30 31 public Event(JaretDate date) { 32 setBegin(date); 33 setEnd(date); 34 } 35 36 37 @Override 38 public void setBegin(JaretDate begin) { 39 if (_begin != null) { 40 _begin.removePropertyChangeListener(this); 41 } 42 JaretDate oldVal = _begin; 43 _begin = begin; 44 _end = _begin; 45 _begin.addPropertyChangeListener(this); 46 firePropertyChange(PROP_BEGIN, oldVal, begin); 47 } 48 49 50 /** 51 * {@inheritDoc} 52 */ 53 public void setEnd(JaretDate end) { 54 if (_end != null) { 55 _end.removePropertyChangeListener(this); 56 } 57 JaretDate oldVal = _end; 58 _end = end; 59 _begin = end; 60 _end.addPropertyChangeListener(this); 61 firePropertyChange(PROP_END, oldVal, end); 62 } 63 64 65 }