diff options
| author | Paul Buetow <paul@buetow.org> | 2008-06-13 22:40:16 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-06-13 22:40:16 +0000 |
| commit | 12b26d3285b05ad3d7387280bd7e9ec016f818d8 (patch) | |
| tree | c07310163af1ae9ae10fa74146ed502561393560 | |
| parent | 11dd825fa0e95f5312e77571fb2eadea8a797670 (diff) | |
temp
| -rw-r--r-- | sources/events/VSAbstractEvent.java | 15 | ||||
| -rw-r--r-- | sources/events/VSNotCopyableEvent.java | 34 | ||||
| -rw-r--r-- | sources/events/internal/VSMessageReceiveEvent.java | 5 | ||||
| -rw-r--r-- | sources/events/internal/VSProtocolEvent.java | 11 | ||||
| -rw-r--r-- | sources/events/internal/VSProtocolScheduleEvent.java | 2 |
5 files changed, 64 insertions, 3 deletions
diff --git a/sources/events/VSAbstractEvent.java b/sources/events/VSAbstractEvent.java index 0bc5ec8..834b691 100644 --- a/sources/events/VSAbstractEvent.java +++ b/sources/events/VSAbstractEvent.java @@ -26,6 +26,7 @@ package events; import java.io.*; import core.VSProcess; +import exceptions.*; import prefs.VSPrefs; import serialize.*; import utils.*; @@ -54,6 +55,20 @@ abstract public class VSAbstractEvent extends VSPrefs { private String eventClassname; /** + * Creates a copy of the event. + * + * @return The copy + */ + final public VSAbstractEvent getCopy() throws VSEventNotCopyableException { + VSAbstractEvent copy = null + + if (this instanceof VSCopyableEvent) + throw new VSEventNotCopyableException(eventShortname); + + return copy; + } + + /** * Inits the event. * * @param process the process diff --git a/sources/events/VSNotCopyableEvent.java b/sources/events/VSNotCopyableEvent.java new file mode 100644 index 0000000..49dde93 --- /dev/null +++ b/sources/events/VSNotCopyableEvent.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2008 Paul C. Buetow, vs@dev.buetow.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * All icons of the icons/ folder are under a Creative Commons + * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa. + * + * The icon's homepage is http://code.google.com/p/ultimate-gnome/ + */ + +package events; + + +/** + * The interface VSCopyableEvent, all events which implement this class + * are nor copyable. + * + * @author Paul C. Buetow + */ +public interface VSCopyableEvent { +} diff --git a/sources/events/internal/VSMessageReceiveEvent.java b/sources/events/internal/VSMessageReceiveEvent.java index bc930e6..7755b60 100644 --- a/sources/events/internal/VSMessageReceiveEvent.java +++ b/sources/events/internal/VSMessageReceiveEvent.java @@ -26,17 +26,18 @@ package events.internal; import java.io.*; import core.VSMessage; +import events.VSCopyableEvent; import protocols.VSAbstractProtocol; import serialize.VSNotSerializable; /** - * The class VSMessageReceiveEvent. This event is used if a process receives + * The class VSMessageReceiveEvent, this event is used if a process receives * a message. * * @author Paul C. Buetow */ public class VSMessageReceiveEvent extends VSAbstractInternalEvent - implements VSNotSerializable { + implements VSNotSerializable, VSCopyableEvent { /** The serioal version uid */ private static final long serialVersionUID = 1L; diff --git a/sources/events/internal/VSProtocolEvent.java b/sources/events/internal/VSProtocolEvent.java index f75edc5..d0a12cc 100644 --- a/sources/events/internal/VSProtocolEvent.java +++ b/sources/events/internal/VSProtocolEvent.java @@ -51,6 +51,17 @@ public class VSProtocolEvent extends VSAbstractInternalEvent { /** The event is a protocol activation if true. Else it is a deactivation */ private boolean isProtocolActivation; + /** + * Fills a copy of this event with its values + * + * @param copy The copy + */ + public void initCopy(VSProtocolEvent copy) { + copy.isClientProtocol(isClientProtocol); + copy.isProtocolActivation(isProtocolActivation); + copy.setProtocolClassname(protocolClassname); + } + /* (non-Javadoc) * @see events.VSAbstractEvent#onInit() */ diff --git a/sources/events/internal/VSProtocolScheduleEvent.java b/sources/events/internal/VSProtocolScheduleEvent.java index bab0a63..0ee7d05 100644 --- a/sources/events/internal/VSProtocolScheduleEvent.java +++ b/sources/events/internal/VSProtocolScheduleEvent.java @@ -37,7 +37,7 @@ import serialize.*; * @author Paul C. Buetow */ public class VSProtocolScheduleEvent extends VSAbstractInternalEvent - implements VSNotSerializable { + implements VSNotSerializable, VSCopyableEvent { /** The serial version uid */ private static final long serialVersionUID = 1L; |
