diff options
| author | Paul Buetow <paul@buetow.org> | 2022-04-03 19:15:16 +0100 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2022-04-03 20:03:06 +0100 |
| commit | dc9500c513173a0f527e5edc7a8e9c26f1acd99a (patch) | |
| tree | fa44718ea94d19b6b7a38e9ef927f20a6f5b4ab9 | |
| parent | d47aedde47148f6725b56128b26ae2ac3a56dde1 (diff) | |
fix java deprecation notices
62 files changed, 483 insertions, 1930 deletions
diff --git a/sources/core/VSAbstractProcess.java b/sources/core/VSAbstractProcess.java index 5f8987a..83ff99d 100644 --- a/sources/core/VSAbstractProcess.java +++ b/sources/core/VSAbstractProcess.java @@ -1,40 +1,23 @@ -/* - * Copyright (c) 2008 Paul C. Buetow, vs-sim@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 core; -import java.awt.*; -import java.io.*; -import java.util.*; - -import core.time.*; -//import events.*; -//import events.implementations.*; -import prefs.*; -import protocols.*; -import serialize.*; -import simulator.*; -import utils.*; +import java.awt.Color; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.ArrayList; + +import core.time.VSLamportTime; +import core.time.VSTime; +import core.time.VSVectorTime; +import prefs.VSPrefs; +import prefs.VSSerializablePrefs; +import protocols.VSAbstractProtocol; +import serialize.VSSerialize; +import simulator.VSLogging; +import simulator.VSSimulatorVisualization; +import utils.VSPriorityQueue; +import utils.VSRandom; +import utils.VSTools; /** * The class VSAbstractProcess, an object of this class represents a process @@ -42,8 +25,7 @@ import utils.*; * * @author Paul C. Buetow */ -public abstract class VSAbstractProcess extends VSSerializablePrefs - implements VSSerializable { +public abstract class VSAbstractProcess extends VSSerializablePrefs { /** The data serialization id. */ protected static final long serialVersionUID = 1L; @@ -261,7 +243,7 @@ public abstract class VSAbstractProcess extends VSSerializablePrefs final int numProcesses = simulatorVisualization.getNumProcesses(); for (int i = 0; i < numProcesses; ++i) - vectorTime.add(new Long(0)); + vectorTime.add(Long.valueOf(0)); } /** @@ -277,7 +259,7 @@ public abstract class VSAbstractProcess extends VSSerializablePrefs final int numProcesses = simulatorVisualization.getNumProcesses(); for (int i = numProcesses; i > 0; --i) - vectorTime.add(new Long(0)); + vectorTime.add(Long.valueOf(0)); } /** @@ -368,7 +350,7 @@ public abstract class VSAbstractProcess extends VSSerializablePrefs */ public synchronized void isCrashed(boolean isCrashed) { this.isCrashed = isCrashed; - crashHistory.add(new Long(globalTime)); + crashHistory.add(Long.valueOf(globalTime)); if (!hasCrashed) hasCrashed = true; } @@ -514,7 +496,7 @@ public abstract class VSAbstractProcess extends VSSerializablePrefs */ public synchronized void increaseVectorTime() { vectorTime.set(processNum, - new Long(vectorTime.get(processNum).longValue()+1)); + Long.valueOf(vectorTime.get(processNum).longValue()+1)); vectorTime.setGlobalTime(globalTime); vectorTimeHistory.add(vectorTime.getCopy()); } @@ -530,7 +512,7 @@ public abstract class VSAbstractProcess extends VSSerializablePrefs for (int i = 0; i < size; ++i) { if (i == processNum) - vectorTime.set(i, new Long(vectorTime.get(i).longValue()+1)); + vectorTime.set(i, Long.valueOf(vectorTime.get(i).longValue()+1)); else if (vectorTimeUpdate.get(i) > vectorTime.get(i)) vectorTime.set(i, vectorTimeUpdate.get(i)); } @@ -673,24 +655,23 @@ public abstract class VSAbstractProcess extends VSSerializablePrefs + "; id: " + processID + ")"); /** For later backwards compatibility, to add more stuff */ - objectOutputStream.writeObject(new Boolean(false)); + objectOutputStream.writeObject(Boolean.valueOf(false)); - objectOutputStream.writeObject(new Integer(processID)); - objectOutputStream.writeObject(new Integer(protocolsToReset.size())); + objectOutputStream.writeObject(Integer.valueOf(processID)); + objectOutputStream.writeObject(Integer.valueOf(protocolsToReset.size())); for (VSAbstractProtocol protocol : protocolsToReset) { objectOutputStream.writeObject(protocol.getClassname()); protocol.serialize(serialize, objectOutputStream); } /** For later backwards compatibility, to add more stuff */ - objectOutputStream.writeObject(new Boolean(false)); + objectOutputStream.writeObject(Boolean.valueOf(false)); } /* (non-Javadoc) * @see serialize.VSSerializable#deserialize(serialize.VSSerialize, * java.io.ObjectInputStream) */ - @SuppressWarnings("unchecked") public synchronized void deserialize(VSSerialize serialize, ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException { @@ -699,7 +680,6 @@ public abstract class VSAbstractProcess extends VSSerializablePrefs /* Bugfix, being compatible with old versions */ super.deleteLong("process.localTime"); - updateFromPrefs_(); if (VSSerialize.DEBUG) diff --git a/sources/core/VSInternalProcess.java b/sources/core/VSInternalProcess.java index 6bb9c66..c2166b9 100644 --- a/sources/core/VSInternalProcess.java +++ b/sources/core/VSInternalProcess.java @@ -1,37 +1,16 @@ -/* - * Copyright (c) 2008 Paul C. Buetow, vs-sim@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 core; -import java.awt.*; +import java.awt.Color; -import core.time.*; -import events.*; -import events.implementations.*; -import prefs.*; -import protocols.*; -import simulator.*; -import utils.*; +import core.time.VSVectorTime; +import events.VSAbstractEvent; +import events.VSRegisteredEvents; +import events.implementations.VSProcessCrashEvent; +import prefs.VSPrefs; +import protocols.VSAbstractProtocol; +import simulator.VSLogging; +import simulator.VSSimulatorVisualization; +import utils.VSPriorityQueue; /** * The class VSInternalProcess, an object of this class represents a process @@ -372,9 +351,9 @@ public class VSInternalProcess extends VSAbstractProcess { * simulator. */ public synchronized void addedAProcess() { - vectorTime.add(new Long(0)); + vectorTime.add(Long.valueOf(0)); for (VSVectorTime vectorTime : vectorTimeHistory) - vectorTime.add(new Long(0)); + vectorTime.add(Long.valueOf(0)); } /** diff --git a/sources/core/VSMessage.java b/sources/core/VSMessage.java index b53060d..28e1b84 100644 --- a/sources/core/VSMessage.java +++ b/sources/core/VSMessage.java @@ -1,30 +1,7 @@ -/* - * Copyright (c) 2008 Paul C. Buetow, vs-sim@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 core; -import core.time.*; -import events.*; +import core.time.VSVectorTime; +import events.VSRegisteredEvents; import prefs.VSPrefs; /** @@ -34,9 +11,6 @@ import prefs.VSPrefs; * @author Paul C. Buetow */ public class VSMessage extends VSPrefs { - /** The serial version uid */ - private static final long serialVersionUID = 1L; - /** The constant IS_SERVER_MESSAGE. */ public static final boolean IS_SERVER_MESSAGE = true; diff --git a/sources/core/VSMessageStub.java b/sources/core/VSMessageStub.java index f635335..95a515b 100644 --- a/sources/core/VSMessageStub.java +++ b/sources/core/VSMessageStub.java @@ -1,32 +1,5 @@ -/* - * Copyright (c) 2008 Paul C. Buetow, vs-sim@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 core; -//import core.time.*; -//import events.*; -//import prefs.VSPrefs; - /** * An object of this class represents a message stub. A message stub allows * to run the init method on a VSMessage object. The init method should be @@ -35,9 +8,6 @@ package core; * @author Paul C. Buetow */ public class VSMessageStub { - /** The serial version uid */ - private static final long serialVersionUID = 1L; - /** The message */ private VSMessage message; @@ -58,4 +28,3 @@ public class VSMessageStub { message.init(process, protocolClassname, isServerMessage); } } - diff --git a/sources/core/VSTask.java b/sources/core/VSTask.java index 2d44139..3e06a7f 100644 --- a/sources/core/VSTask.java +++ b/sources/core/VSTask.java @@ -1,39 +1,23 @@ -/* - * VS-Simulator (http://buetow.org) - * Copyright (c) 2008 -2009 by Dipl.-Inform. (FH) Paul C. Buetow - * - * 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 core; -import java.io.*; - -import events.*; -import events.implementations.*; -import events.internal.*; -import exceptions.*; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; + +import events.VSAbstractEvent; +import events.VSRegisteredEvents; +import events.implementations.VSProcessCrashEvent; +import events.implementations.VSProcessRecoverEvent; +import events.internal.VSAbstractInternalEvent; +import events.internal.VSMessageReceiveEvent; +import events.internal.VSProtocolEvent; +import exceptions.VSEventNotCopyableException; import prefs.VSPrefs; import protocols.VSAbstractProtocol; -import serialize.*; //import utils.*; +import serialize.VSNotSerializable; +import serialize.VSSerializable; +import serialize.VSSerialize; /** * The class VSTask, an object of this class represents a task to do or done. @@ -44,10 +28,7 @@ import serialize.*; * * @author Paul C. Buetow */ -public class VSTask implements Comparable, VSSerializable { - /** The serial version uid */ - private static final long serialVersionUID = 1L; - +public class VSTask implements Comparable<Object>, VSSerializable { /** The Constant LOCAL. Used for the constructor if it's a local timed * task. */ @@ -450,9 +431,9 @@ public class VSTask implements Comparable, VSSerializable { ObjectOutputStream objectOutputStream) throws IOException { /** For later backwards compatibility, to add more stuff */ - objectOutputStream.writeObject(new Boolean(false)); + objectOutputStream.writeObject(Boolean.valueOf(false)); - objectOutputStream.writeObject(new Integer(process.getProcessNum())); + objectOutputStream.writeObject(Integer.valueOf(process.getProcessNum())); if (event.getClassname() == null) event.init(process); @@ -461,22 +442,21 @@ public class VSTask implements Comparable, VSSerializable { System.out.println("Serializing: " + event.getClassname()); objectOutputStream.writeObject(event.getClassname()); - objectOutputStream.writeObject(new Integer(event.getID())); + objectOutputStream.writeObject(Integer.valueOf(event.getID())); event.serialize(serialize, objectOutputStream); - objectOutputStream.writeObject(new Integer(taskNum)); - objectOutputStream.writeObject(new Long(taskTime)); - objectOutputStream.writeObject(new Boolean(isGlobalTimed)); - objectOutputStream.writeObject(new Boolean(isProgrammed)); + objectOutputStream.writeObject(Integer.valueOf(taskNum)); + objectOutputStream.writeObject(Long.valueOf(taskTime)); + objectOutputStream.writeObject(Boolean.valueOf(isGlobalTimed)); + objectOutputStream.writeObject(Boolean.valueOf(isProgrammed)); /** For later backwards compatibility, to add more stuff */ - objectOutputStream.writeObject(new Boolean(false)); + objectOutputStream.writeObject(Boolean.valueOf(false)); } /* (non-Javadoc) * @see serialize.VSSerializable#deserialize(serialize.VSSerialize, * java.io.ObjectInputStream) */ - @SuppressWarnings("unchecked") public synchronized void deserialize(VSSerialize serialize, ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException { diff --git a/sources/core/VSTaskManager.java b/sources/core/VSTaskManager.java index 643462a..f2ad734 100644 --- a/sources/core/VSTaskManager.java +++ b/sources/core/VSTaskManager.java @@ -1,36 +1,17 @@ -/* - * VS-Simulator (http://buetow.org) - * Copyright (c) 2008 -2009 by Dipl.-Inform. (FH) Paul C. Buetow - * - * 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 core; -import java.io.*; -import java.util.*; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.PriorityQueue; -import prefs.*; -import serialize.*; -import simulator.*; -import utils.*; +import prefs.VSPrefs; +import serialize.VSSerializable; +import serialize.VSSerialize; +import simulator.VSSimulatorVisualization; +import utils.VSPriorityQueue; /** * The class VSTaskManager, it is responsible that all tasks will get @@ -40,9 +21,6 @@ import utils.*; * @author Paul C. Buetow */ public class VSTaskManager implements VSSerializable { - /** The seriao version uid */ - private static final long serialVersionUID = 1L; - /** The simulator canvas. */ private VSSimulatorVisualization simulatorVisualization; @@ -510,7 +488,7 @@ public class VSTaskManager implements VSSerializable { ObjectOutputStream objectOutputStream) throws IOException { /** For later backwards compatibility, to add more stuff */ - objectOutputStream.writeObject(new Boolean(false)); + objectOutputStream.writeObject(Boolean.valueOf(false)); ArrayList<VSTask> serializeThoseTasks = new ArrayList<VSTask>(); @@ -538,19 +516,18 @@ public class VSTaskManager implements VSSerializable { } objectOutputStream.writeObject( - new Integer(serializeThoseTasks.size())); + Integer.valueOf(serializeThoseTasks.size())); for (VSTask task : serializeThoseTasks) task.s |
