[JACOB-6] Rename Process as RunnableProcess to prepare a better Process abstraction
Project: http://git-wip-us.apache.org/repos/asf/ode-jacob/repo Commit: http://git-wip-us.apache.org/repos/asf/ode-jacob/commit/38592a08 Tree: http://git-wip-us.apache.org/repos/asf/ode-jacob/tree/38592a08 Diff: http://git-wip-us.apache.org/repos/asf/ode-jacob/diff/38592a08 Branch: refs/heads/master Commit: 38592a08262b5aee93b83e4ea0c0f6eaa86a0c95 Parents: 57a06e2 Author: Hadrian Zbarcea <[email protected]> Authored: Mon Jan 13 15:05:48 2014 -0500 Committer: Hadrian Zbarcea <[email protected]> Committed: Mon Jan 13 15:05:48 2014 -0500 ---------------------------------------------------------------------- src/main/java/org/apache/ode/jacob/Process.java | 34 -------------------- .../org/apache/ode/jacob/RunnableProcess.java | 34 ++++++++++++++++++++ .../apache/ode/jacob/examples/cell/CELL_.java | 4 +-- .../ode/jacob/examples/cell/JacobCellTest.java | 4 +-- .../ode/jacob/examples/eratosthenes/Sieve.java | 12 +++---- .../jacob/examples/helloworld/HelloWorld.java | 18 +++++------ .../ode/jacob/examples/sequence/Sequence.java | 4 +-- .../ode/jacob/examples/synch/SynchPrinter.java | 6 ++-- 8 files changed, 58 insertions(+), 58 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/38592a08/src/main/java/org/apache/ode/jacob/Process.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/ode/jacob/Process.java b/src/main/java/org/apache/ode/jacob/Process.java deleted file mode 100644 index ea00f49..0000000 --- a/src/main/java/org/apache/ode/jacob/Process.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.ode.jacob; - -import java.io.Serializable; - -/** - * Base class for constructs which rely on a Java method body to represent some - * aspect of the process. - */ -@SuppressWarnings("serial") -public abstract class Process implements Runnable, Serializable { - - public String toString() { - return "<Process:" + getClass().getSimpleName() + ">"; - } - -} http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/38592a08/src/main/java/org/apache/ode/jacob/RunnableProcess.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/ode/jacob/RunnableProcess.java b/src/main/java/org/apache/ode/jacob/RunnableProcess.java new file mode 100644 index 0000000..c844180 --- /dev/null +++ b/src/main/java/org/apache/ode/jacob/RunnableProcess.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.ode.jacob; + +import java.io.Serializable; + +/** + * Base class for constructs which rely on a Java method body to represent some + * aspect of the process. + */ +@SuppressWarnings("serial") +public abstract class RunnableProcess implements Runnable, Serializable { + + public String toString() { + return "<Process:" + getClass().getSimpleName() + ">"; + } + +} http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/38592a08/src/test/java/org/apache/ode/jacob/examples/cell/CELL_.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/ode/jacob/examples/cell/CELL_.java b/src/test/java/org/apache/ode/jacob/examples/cell/CELL_.java index a30f2b1..5c4c7ce 100644 --- a/src/test/java/org/apache/ode/jacob/examples/cell/CELL_.java +++ b/src/test/java/org/apache/ode/jacob/examples/cell/CELL_.java @@ -18,7 +18,7 @@ */ package org.apache.ode.jacob.examples.cell; -import org.apache.ode.jacob.Process; +import org.apache.ode.jacob.RunnableProcess; import org.apache.ode.jacob.oo.ReceiveProcess; import org.apache.ode.jacob.oo.Val; @@ -31,7 +31,7 @@ import static org.apache.ode.jacob.Jacob.*; * Cell(self, val) = self ? [ read(r) = { Cell(self, val) | r ! val(val) } & write(newVal) = { Cell(self, newVal) } ] * </code> */ -public class CELL_<T> extends Process { +public class CELL_<T> extends RunnableProcess { private static final long serialVersionUID = 1550566086202728251L; private Cell _self; http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/38592a08/src/test/java/org/apache/ode/jacob/examples/cell/JacobCellTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/ode/jacob/examples/cell/JacobCellTest.java b/src/test/java/org/apache/ode/jacob/examples/cell/JacobCellTest.java index 7027c3b..98c5a24 100644 --- a/src/test/java/org/apache/ode/jacob/examples/cell/JacobCellTest.java +++ b/src/test/java/org/apache/ode/jacob/examples/cell/JacobCellTest.java @@ -24,7 +24,7 @@ import java.io.IOException; import junit.framework.TestCase; -import org.apache.ode.jacob.Process; +import org.apache.ode.jacob.RunnableProcess; import org.apache.ode.jacob.oo.Val; import org.apache.ode.jacob.vpu.ExecutionQueueImpl; import org.apache.ode.jacob.vpu.JacobVPU; @@ -62,7 +62,7 @@ public class JacobCellTest extends TestCase { } @SuppressWarnings("serial") - static class CellTest1 extends Process { + static class CellTest1 extends RunnableProcess { public void run() { Cell cell = newChannel(Cell.class, "cell"); Val ret = newChannel(Val.class, "val"); http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/38592a08/src/test/java/org/apache/ode/jacob/examples/eratosthenes/Sieve.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/ode/jacob/examples/eratosthenes/Sieve.java b/src/test/java/org/apache/ode/jacob/examples/eratosthenes/Sieve.java index d189814..1a9c543 100644 --- a/src/test/java/org/apache/ode/jacob/examples/eratosthenes/Sieve.java +++ b/src/test/java/org/apache/ode/jacob/examples/eratosthenes/Sieve.java @@ -19,7 +19,7 @@ package org.apache.ode.jacob.examples.eratosthenes; -import org.apache.ode.jacob.Process; +import org.apache.ode.jacob.RunnableProcess; import org.apache.ode.jacob.oo.ReceiveProcess; import org.apache.ode.jacob.oo.Synch; import org.apache.ode.jacob.vpu.ExecutionQueueImpl; @@ -41,7 +41,7 @@ import static org.apache.ode.jacob.Jacob.object; * * @author Maciej Szefler <a href="mailto:[email protected]">mbs</a> */ -public class Sieve extends Process { +public class Sieve extends RunnableProcess { private static final long serialVersionUID = -1303509567096202776L; private static int _cnt = 0; @@ -63,7 +63,7 @@ public class Sieve extends Process { * Counter(out, n) := out.val(n) | Counter(out, n+1) * </em></pre> */ - private static class Counter extends Process { + private static class Counter extends RunnableProcess { private static final long serialVersionUID = 4739323750438991003L; private NaturalNumberStream _out; @@ -95,7 +95,7 @@ public class Sieve extends Process { * * */ - private static final class Head extends Process { + private static final class Head extends RunnableProcess { private static final long serialVersionUID = 1791641314141082728L; NaturalNumberStream _in; @@ -124,7 +124,7 @@ public class Sieve extends Process { } } - private static final class Print extends Process { + private static final class Print extends RunnableProcess { private static final long serialVersionUID = -3134193737519487672L; private NaturalNumberStream _in; @@ -151,7 +151,7 @@ public class Sieve extends Process { * ! in ? [val(n)={ if(n mod prime <> 0) out.val(n) } * </em></prime> */ - private static class PrimeFilter extends Process { + private static class PrimeFilter extends RunnableProcess { private static final long serialVersionUID = 1569523200422202448L; private int _prime; http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/38592a08/src/test/java/org/apache/ode/jacob/examples/helloworld/HelloWorld.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/ode/jacob/examples/helloworld/HelloWorld.java b/src/test/java/org/apache/ode/jacob/examples/helloworld/HelloWorld.java index 448f804..4dac54a 100644 --- a/src/test/java/org/apache/ode/jacob/examples/helloworld/HelloWorld.java +++ b/src/test/java/org/apache/ode/jacob/examples/helloworld/HelloWorld.java @@ -27,7 +27,7 @@ import org.apache.log4j.Logger; import org.apache.ode.jacob.ChannelRef; import org.apache.ode.jacob.Message; import org.apache.ode.jacob.MessageListener; -import org.apache.ode.jacob.Process; +import org.apache.ode.jacob.RunnableProcess; import org.apache.ode.jacob.examples.sequence.Sequence; import org.apache.ode.jacob.oo.Channel; import org.apache.ode.jacob.oo.ReceiveProcess; @@ -61,7 +61,7 @@ import static org.apache.ode.jacob.Jacob.subscribe; * */ @SuppressWarnings("serial") -public class HelloWorld extends Process { +public class HelloWorld extends RunnableProcess { public static interface Callback<T, R extends Channel> extends Channel { @@ -69,7 +69,7 @@ public class HelloWorld extends Process { } - static class ReliablePrinterProcess extends Process { + static class ReliablePrinterProcess extends RunnableProcess { private Callback<String, Synch> in; @JsonCreator @@ -89,7 +89,7 @@ public class HelloWorld extends Process { } } - static class ReliableStringEmitterProcess extends Process { + static class ReliableStringEmitterProcess extends RunnableProcess { private String str; private Callback<String, Synch> to; @@ -119,7 +119,7 @@ public class HelloWorld extends Process { } } - static class PrinterProcess extends Process { + static class PrinterProcess extends RunnableProcess { private Val _in; @JsonCreator @@ -138,7 +138,7 @@ public class HelloWorld extends Process { } } - static class StringEmitterProcess extends Process { + static class StringEmitterProcess extends RunnableProcess { private String str; private Val to; @@ -153,7 +153,7 @@ public class HelloWorld extends Process { } } - static class ForwarderProcess extends Process { + static class ForwarderProcess extends RunnableProcess { private Val in; private Val out; @@ -266,7 +266,7 @@ public class HelloWorld extends Process { } } - static class StringEmitterRunnable extends Process { + static class StringEmitterRunnable extends RunnableProcess { private String str; private ChannelRef to; @@ -300,7 +300,7 @@ public class HelloWorld extends Process { return new SequenceItemEmitter(greetings[step], done, out); } - static class SequenceItemEmitter extends Process { + static class SequenceItemEmitter extends RunnableProcess { private final String string; private final Synch done; private final Val out; http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/38592a08/src/test/java/org/apache/ode/jacob/examples/sequence/Sequence.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/ode/jacob/examples/sequence/Sequence.java b/src/test/java/org/apache/ode/jacob/examples/sequence/Sequence.java index d626394..8ea152c 100644 --- a/src/test/java/org/apache/ode/jacob/examples/sequence/Sequence.java +++ b/src/test/java/org/apache/ode/jacob/examples/sequence/Sequence.java @@ -19,7 +19,7 @@ package org.apache.ode.jacob.examples.sequence; -import org.apache.ode.jacob.Process; +import org.apache.ode.jacob.RunnableProcess; import org.apache.ode.jacob.oo.ReceiveProcess; import org.apache.ode.jacob.oo.Synch; @@ -35,7 +35,7 @@ import static org.apache.ode.jacob.Jacob.object; * Abstract process that executes a number of steps sequentially. */ @SuppressWarnings("serial") -public abstract class Sequence extends Process { +public abstract class Sequence extends RunnableProcess { private final SequenceData data = new SequenceData(); /** http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/38592a08/src/test/java/org/apache/ode/jacob/examples/synch/SynchPrinter.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/ode/jacob/examples/synch/SynchPrinter.java b/src/test/java/org/apache/ode/jacob/examples/synch/SynchPrinter.java index 22de017..1be2a21 100644 --- a/src/test/java/org/apache/ode/jacob/examples/synch/SynchPrinter.java +++ b/src/test/java/org/apache/ode/jacob/examples/synch/SynchPrinter.java @@ -19,7 +19,7 @@ package org.apache.ode.jacob.examples.synch; -import org.apache.ode.jacob.Process; +import org.apache.ode.jacob.RunnableProcess; import org.apache.ode.jacob.oo.ReceiveProcess; import org.apache.ode.jacob.oo.Synch; import org.apache.ode.jacob.vpu.ExecutionQueueImpl; @@ -38,7 +38,7 @@ import static org.apache.ode.jacob.Jacob.object; */ public class SynchPrinter { - public static final class SystemPrinter extends Process { + public static final class SystemPrinter extends RunnableProcess { private static final long serialVersionUID = -8516348116865575605L; private SynchPrint _self; @@ -58,7 +58,7 @@ public class SynchPrinter { } } - public static final class Tester extends Process { + public static final class Tester extends RunnableProcess { private static final long serialVersionUID = 7899682832271627464L; public void run() {
