diff --git a/compiler/Java_CodeGen.jrag b/compiler/Java_CodeGen.jrag index b01ff8f02e5052fd9979c69ed60bee9e32768586..2020b5d572129c1831f49a505a0ffb4d95973395 100644 --- a/compiler/Java_CodeGen.jrag +++ b/compiler/Java_CodeGen.jrag @@ -293,7 +293,7 @@ aspect Java_Register { public void Program.Java_emitTypeRegister(Java_env env) { /* - env.println("static void register(LabCommChannel c) {"); + env.println("static void register(Channel c) {"); env.indent(); for (int i = 0; i < getNumDecl(); i++) { getDecl(i).Java_emitTypeRegister(env); @@ -340,11 +340,11 @@ aspect Java_Class { } env.println("import java.io.IOException;"); - env.println("import se.lth.control.labcomm"+env.verStr+".LabCommType;"); - env.println("import se.lth.control.labcomm"+env.verStr+".LabCommEncoder;"); - env.println("import se.lth.control.labcomm"+env.verStr+".LabCommDecoder;"); + env.println("import se.lth.control.labcomm"+env.verStr+".Type;"); + env.println("import se.lth.control.labcomm"+env.verStr+".Encoder;"); + env.println("import se.lth.control.labcomm"+env.verStr+".Decoder;"); env.println(); - env.println("public class " + getName() + " implements LabCommType {"); + env.println("public class " + getName() + " implements Type {"); env.println(); env.indent(); getType().Java_emitInstance(env); @@ -380,21 +380,21 @@ aspect Java_Class { } env.println("import java.io.IOException;"); - env.println("import se.lth.control.labcomm"+env.verStr+".LabCommDecoder;"); - env.println("import se.lth.control.labcomm"+env.verStr+".LabCommDispatcher;"); - env.println("import se.lth.control.labcomm"+env.verStr+".LabCommEncoder;"); - env.println("import se.lth.control.labcomm"+env.verStr+".LabCommHandler;"); - env.println("import se.lth.control.labcomm"+env.verStr+".LabCommSample;"); + env.println("import se.lth.control.labcomm"+env.verStr+".Decoder;"); + env.println("import se.lth.control.labcomm"+env.verStr+".SampleDispatcher;"); + env.println("import se.lth.control.labcomm"+env.verStr+".Encoder;"); + env.println("import se.lth.control.labcomm"+env.verStr+".SampleHandler;"); + env.println("import se.lth.control.labcomm"+env.verStr+".Sample;"); env.println(); env.print("public class " + getName()); // if(getType().isUserType()) { // env.print(" extends "+getType().getTypeName()); // } - env.println(" implements LabCommSample {"); + env.println(" implements Sample {"); env.println(); env.indent(); getType().Java_emitInstance(env); - env.println("public interface Handler extends LabCommHandler {"); + env.println("public interface Handler extends SampleHandler {"); env.print(" public void handle_" + getName() + "("); if (!isVoid()) { getType().Java_emitType(env); @@ -403,21 +403,21 @@ aspect Java_Class { env.println(") throws Exception;"); env.println("}"); env.println(); - env.println("public static void register(LabCommDecoder d, Handler h) throws IOException {"); + env.println("public static void register(Decoder d, SampleHandler h) throws IOException {"); env.indent(); env.println("d.register(new Dispatcher(), h);"); env.unindent(); env.println("}"); env.println(); - env.println("public static void register(LabCommEncoder e) throws IOException {"); + env.println("public static void register(Encoder e) throws IOException {"); env.indent(); env.println("e.register(new Dispatcher());"); env.unindent(); env.println("}"); env.println(); - env.println("private static class Dispatcher implements LabCommDispatcher {"); + env.println("private static class Dispatcher implements SampleDispatcher {"); env.indent(); env.println(); env.println("public Class getSampleClass() {"); @@ -438,8 +438,8 @@ aspect Java_Class { env.unindent(); env.println("}"); env.println(); - env.println("public void decodeAndHandle(LabCommDecoder d,"); - env.println(" LabCommHandler h) throws Exception {"); + env.println("public void decodeAndHandle(Decoder d,"); + env.println(" SampleHandler h) throws Exception {"); env.indent(); if (isVoid()) { env.println(getName() + ".decode(d);"); @@ -481,7 +481,7 @@ aspect Java_Class { } public void TypeDecl.Java_emitEncoder(Java_env env) { - env.print("public static void encode(LabCommEncoder e"); + env.print("public static void encode(Encoder e"); if (!isVoid()) { env.print(", "); getType().Java_emitType(env); @@ -496,7 +496,7 @@ aspect Java_Class { } public void SampleDecl.Java_emitEncoder(Java_env env) { - env.print("public static void encode(LabCommEncoder e"); + env.print("public static void encode(Encoder e"); if (!isVoid()) { env.print(", "); getType().Java_emitType(env); @@ -588,7 +588,7 @@ aspect Java_Class { public void Decl.Java_emitDecoder(Java_env env) { env.print("public static "); getType().Java_emitType(env); - env.println(" decode(LabCommDecoder d) throws IOException {"); + env.println(" decode(Decoder d) throws IOException {"); env.indent(); if (!isVoid()) { getType().Java_emitType(env); diff --git a/examples/dynamic/test/DynamicPart.java b/examples/dynamic/test/DynamicPart.java index 334d493c421bcc46fd8139fe899a379b729e4940..a3137220ca98e8e00ddf25a6b879d2406d3817c6 100644 --- a/examples/dynamic/test/DynamicPart.java +++ b/examples/dynamic/test/DynamicPart.java @@ -18,12 +18,12 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.Map; -import se.lth.control.labcomm.LabCommDecoder; -import se.lth.control.labcomm.LabCommDecoderChannel; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommEncoderChannel; -import AST.LabCommParser; -import AST.LabCommScanner; +import se.lth.control.labcomm.Decoder; +import se.lth.control.labcomm.DecoderChannel; +import se.lth.control.labcomm.Encoder; +import se.lth.control.labcomm.EncoderChannel; +import AST.Parser; +import AST.Scanner; import AST.Program; import beaver.Parser.Exception; @@ -160,8 +160,8 @@ public class DynamicPart { public static InRAMCompiler generateCode(String lcDecl, HashMap<String, String> handlers) { Program ast = null; InputStream in = new ByteArrayInputStream(lcDecl.getBytes()); - LabCommScanner scanner = new LabCommScanner(in); - LabCommParser parser = new LabCommParser(); + Scanner scanner = new Scanner(in); + Parser parser = new Parser(); Collection errors = new LinkedList(); InRAMCompiler irc = null; @@ -272,7 +272,7 @@ public class DynamicPart { private void decodeTest(InRAMCompiler irc, HandlerContext ctxt, String tmpFile, String... sampleNames) { try { FileInputStream in = new FileInputStream(tmpFile); - LabCommDecoderChannel dec = new LabCommDecoderChannel(in); + DecoderChannel dec = new DecoderChannel(in); Class handlerClass = irc.load(handlerClassName); Constructor hcc = handlerClass.getDeclaredConstructor(Object.class); Object handler = hcc.newInstance(ctxt); @@ -282,7 +282,7 @@ public class DynamicPart { Class sampleClass = irc.load(sampleName); Class handlerInterface = irc.load(sampleName+"$Handler"); - Method reg = sampleClass.getDeclaredMethod("register", LabCommDecoder.class, handlerInterface); + Method reg = sampleClass.getDeclaredMethod("register", Decoder.class, handlerInterface); reg.invoke(sampleClass, dec, handler); } @@ -324,20 +324,20 @@ public class DynamicPart { FileOutputStream out = new FileOutputStream(tmpFile); - LabCommEncoderChannel enc = new LabCommEncoderChannel(out); + EncoderChannel enc = new EncoderChannel(out); /* register and send foo */ - Method regFoo = fc.getDeclaredMethod("register", LabCommEncoder.class); + Method regFoo = fc.getDeclaredMethod("register", Encoder.class); regFoo.invoke(fc, enc); - Method doEncodeFoo = fc.getDeclaredMethod("encode", LabCommEncoder.class, ft); + Method doEncodeFoo = fc.getDeclaredMethod("encode", Encoder.class, ft); doEncodeFoo.invoke(fc, enc, fv); /* register and send bar (NB! uses primitive type int) */ - Method regBar = bc.getDeclaredMethod("register", LabCommEncoder.class); + Method regBar = bc.getDeclaredMethod("register", Encoder.class); regBar.invoke(bc, enc); - Method doEncodeBar = bc.getDeclaredMethod("encode", LabCommEncoder.class, Integer.TYPE); + Method doEncodeBar = bc.getDeclaredMethod("encode", Encoder.class, Integer.TYPE); doEncodeBar.invoke(bc, enc, ctxt.bar); out.close(); diff --git a/examples/dynamic/test/StaticDecoder.java b/examples/dynamic/test/StaticDecoder.java index b3d74edf4c407397f2aae315b1899303ad27d6f9..c1c06d3b90a06270ceaaa0b492fc580a4c1dcd07 100644 --- a/examples/dynamic/test/StaticDecoder.java +++ b/examples/dynamic/test/StaticDecoder.java @@ -6,16 +6,16 @@ import gen.bar; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; -import se.lth.control.labcomm.LabCommDecoderChannel; +import se.lth.control.labcomm.DecoderChannel; public class StaticDecoder implements foo.Handler, bar.Handler { - LabCommDecoderChannel decoder; + DecoderChannel decoder; public StaticDecoder(InputStream in) throws Exception { - decoder = new LabCommDecoderChannel(in); + decoder = new DecoderChannel(in); foo.register(decoder, this); bar.register(decoder, this); diff --git a/examples/dynamic/test/StaticEncoder.java b/examples/dynamic/test/StaticEncoder.java index 697f339e8335de34a4aef9f6bbdc3928d2c207f2..4ea48be4e2e94daf915caac4bb4a2ac2a0ad33f5 100644 --- a/examples/dynamic/test/StaticEncoder.java +++ b/examples/dynamic/test/StaticEncoder.java @@ -2,19 +2,19 @@ package test; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; -import se.lth.control.labcomm.LabCommEncoderChannel; +import se.lth.control.labcomm.EncoderChannel; import gen.foo; import gen.bar; public class StaticEncoder { - LabCommEncoderChannel encoder; + EncoderChannel encoder; public StaticEncoder(OutputStream out) throws Exception { - encoder = new LabCommEncoderChannel(out); + encoder = new EncoderChannel(out); foo.register(encoder); bar.register(encoder); } diff --git a/examples/dynamic/test/TestLabCommCompiler.java b/examples/dynamic/test/TestLabCommCompiler.java index a71e0a67125fd30ac8d34d78276c021743902b35..fe9f5e659633cf036698e2c531a1a295dc99bf32 100644 --- a/examples/dynamic/test/TestLabCommCompiler.java +++ b/examples/dynamic/test/TestLabCommCompiler.java @@ -16,18 +16,18 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.Map; -import se.lth.control.labcomm.LabCommDecoder; -import se.lth.control.labcomm.LabCommDecoderChannel; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommEncoderChannel; -import AST.LabCommParser; -import AST.LabCommScanner; +import se.lth.control.labcomm.Decoder; +import se.lth.control.labcomm.DecoderChannel; +import se.lth.control.labcomm.Encoder; +import se.lth.control.labcomm.EncoderChannel; +import AST.Parser; +import AST.Scanner; import AST.Program; import beaver.Parser.Exception; -public class TestLabCommCompiler { +public class TestCompiler { private static final String BAR = "bar"; private static final String FOO = "foo"; @@ -73,7 +73,7 @@ public class TestLabCommCompiler { private static void decodeTest(InRAMCompiler irc, String tmpFile) { try { FileInputStream in = new FileInputStream(tmpFile); - LabCommDecoderChannel dec = new LabCommDecoderChannel(in); + DecoderChannel dec = new DecoderChannel(in); Class fc = irc.load(FOO); Class hc = irc.load("gen_"+FOO+"Handler"); @@ -81,7 +81,7 @@ public class TestLabCommCompiler { Object h = hc.newInstance(); - Method reg = fc.getDeclaredMethod("register", LabCommDecoder.class, hi); + Method reg = fc.getDeclaredMethod("register", Decoder.class, hi); reg.invoke(fc, dec, h); dec.runOne(); @@ -106,11 +106,11 @@ public class TestLabCommCompiler { z.setInt(f, 12); FileOutputStream out = new FileOutputStream(tmpFile); - LabCommEncoderChannel enc = new LabCommEncoderChannel(out); - Method reg = fc.getDeclaredMethod("register", LabCommEncoder.class); + EncoderChannel enc = new EncoderChannel(out); + Method reg = fc.getDeclaredMethod("register", Encoder.class); reg.invoke(fc, enc); - Method doEncode = fc.getDeclaredMethod("encode", LabCommEncoder.class, fc); + Method doEncode = fc.getDeclaredMethod("encode", Encoder.class, fc); doEncode.invoke(fc, enc, f); out.close(); @@ -123,8 +123,8 @@ public class TestLabCommCompiler { public static InRAMCompiler generateCode(String lcDecl, HashMap<String, String> handlers) { Program ast = null; InputStream in = new ByteArrayInputStream(lcDecl.getBytes()); - LabCommScanner scanner = new LabCommScanner(in); - LabCommParser parser = new LabCommParser(); + Scanner scanner = new Scanner(in); + Parser parser = new Parser(); Collection errors = new LinkedList(); InRAMCompiler irc = null; diff --git a/examples/dynamic/test/TestLabcommGen.java b/examples/dynamic/test/TestLabcommGen.java index 1ad36b4d81b10b5f289ba28004417044834be04e..7ff4e03a3f12cee2e4c321b90f6ef067d397ac76 100644 --- a/examples/dynamic/test/TestLabcommGen.java +++ b/examples/dynamic/test/TestLabcommGen.java @@ -18,12 +18,12 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.Map; -import se.lth.control.labcomm.LabCommDecoder; -import se.lth.control.labcomm.LabCommDecoderChannel; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommEncoderChannel; -import AST.LabCommParser; -import AST.LabCommScanner; +import se.lth.control.labcomm.Decoder; +import se.lth.control.labcomm.DecoderChannel; +import se.lth.control.labcomm.Encoder; +import se.lth.control.labcomm.EncoderChannel; +import AST.Parser; +import AST.Scanner; import AST.Program; import beaver.Parser.Exception; @@ -163,8 +163,8 @@ public class TestLabcommGen { public static InRAMCompiler generateCode(String lcDecl, HashMap<String, String> handlers) { Program ast = null; InputStream in = new ByteArrayInputStream(lcDecl.getBytes()); - LabCommScanner scanner = new LabCommScanner(in); - LabCommParser parser = new LabCommParser(); + Scanner scanner = new Scanner(in); + Parser parser = new Parser(); Collection errors = new LinkedList(); InRAMCompiler irc = null; @@ -332,7 +332,7 @@ public class TestLabcommGen { private static void decodeTest(InRAMCompiler irc, String tmpFile, String... sampleNames) { try { FileInputStream in = new FileInputStream(tmpFile); - LabCommDecoderChannel dec = new LabCommDecoderChannel(in); + DecoderChannel dec = new DecoderChannel(in); Class handlerClass = irc.load(handlerClassName); Constructor hcc = handlerClass.getDeclaredConstructor(Object.class); // Object handler = handlerClass.newInstance(); @@ -344,7 +344,7 @@ public class TestLabcommGen { Class sampleClass = irc.load(sampleName); Class handlerInterface = irc.load(sampleName+"$Handler"); - Method reg = sampleClass.getDeclaredMethod("register", LabCommDecoder.class, handlerInterface); + Method reg = sampleClass.getDeclaredMethod("register", Decoder.class, handlerInterface); reg.invoke(sampleClass, dec, handler); } @@ -389,20 +389,20 @@ public class TestLabcommGen { FileOutputStream out = new FileOutputStream(tmpFile); - LabCommEncoderChannel enc = new LabCommEncoderChannel(out); + EncoderChannel enc = new EncoderChannel(out); /* register and send foo */ - Method regFoo = fc.getDeclaredMethod("register", LabCommEncoder.class); + Method regFoo = fc.getDeclaredMethod("register", Encoder.class); regFoo.invoke(fc, enc); - Method doEncodeFoo = fc.getDeclaredMethod("encode", LabCommEncoder.class, ft); + Method doEncodeFoo = fc.getDeclaredMethod("encode", Encoder.class, ft); doEncodeFoo.invoke(fc, enc, f); /* register and send bar (NB! uses primitive type int) */ - Method regBar = bc.getDeclaredMethod("register", LabCommEncoder.class); + Method regBar = bc.getDeclaredMethod("register", Encoder.class); regBar.invoke(bc, enc); - Method doEncodeBar = bc.getDeclaredMethod("encode", LabCommEncoder.class, Integer.TYPE); + Method doEncodeBar = bc.getDeclaredMethod("encode", Encoder.class, Integer.TYPE); doEncodeBar.invoke(bc, enc, 42); out.close(); @@ -475,7 +475,7 @@ public class TestLabcommGen { private static void decodeTestSeparate(InRAMCompiler irc, String tmpFile, String... sampleNames) { try { FileInputStream in = new FileInputStream(tmpFile); - LabCommDecoderChannel dec = new LabCommDecoderChannel(in); + DecoderChannel dec = new DecoderChannel(in); for (String sampleName : sampleNames) { System.out.println("registering handler for "+sampleName); Class sampleClass = irc.load(sampleName); @@ -484,7 +484,7 @@ public class TestLabcommGen { Object handler = handlerClass.newInstance(); - Method reg = sampleClass.getDeclaredMethod("register", LabCommDecoder.class, handlerInterface); + Method reg = sampleClass.getDeclaredMethod("register", Decoder.class, handlerInterface); reg.invoke(sampleClass, dec, handler); } diff --git a/examples/jgrafchart/labcommTCPtest/client/TestClient.java b/examples/jgrafchart/labcommTCPtest/client/TestClient.java index 0582d9e912c5b7f7eb841e402f4f421406ba59f5..66fa1342e470b12c1516ceacdd89a85b4a7d0616 100644 --- a/examples/jgrafchart/labcommTCPtest/client/TestClient.java +++ b/examples/jgrafchart/labcommTCPtest/client/TestClient.java @@ -6,8 +6,8 @@ import java.io.OutputStream; import java.net.Socket; import java.net.UnknownHostException; -import se.lth.control.labcomm.LabCommDecoderChannel; -import se.lth.control.labcomm.LabCommEncoderChannel; +import se.lth.control.labcomm.DecoderChannel; +import se.lth.control.labcomm.EncoderChannel; import labcommTCPtest.gen.foo; import labcommTCPtest.gen.foo.Handler; @@ -25,7 +25,7 @@ public class TestClient implements Handler { public void test() { try { - LabCommEncoderChannel e = new LabCommEncoderChannel(out ); + EncoderChannel e = new EncoderChannel(out ); foo.register(e); foo sample = new foo(); sample.c = 17; @@ -36,7 +36,7 @@ public class TestClient implements Handler { printSample("Client sending", sample); foo.encode(e, sample); - LabCommDecoderChannel c = new LabCommDecoderChannel(in); + DecoderChannel c = new DecoderChannel(in); foo.register(c,this); c.run(); } catch (Exception e) { diff --git a/examples/jgrafchart/labcommTCPtest/client/TestClientSingleshot.java b/examples/jgrafchart/labcommTCPtest/client/TestClientSingleshot.java index d54c7bb09f78ab3502199f40c70c88677539d3f5..9601bcabcf45d174367aeeb61229ccc3dfeb8d25 100644 --- a/examples/jgrafchart/labcommTCPtest/client/TestClientSingleshot.java +++ b/examples/jgrafchart/labcommTCPtest/client/TestClientSingleshot.java @@ -6,8 +6,8 @@ import java.io.OutputStream; import java.net.Socket; import java.net.UnknownHostException; -import se.lth.control.labcomm.LabCommDecoderChannel; -import se.lth.control.labcomm.LabCommEncoderChannel; +import se.lth.control.labcomm.DecoderChannel; +import se.lth.control.labcomm.EncoderChannel; import labcommTCPtest.gen.FooSample; import labcommTCPtest.gen.FooSample.Handler; @@ -25,7 +25,7 @@ public class TestClientSingleshot implements Handler { public void test() { try { - LabCommEncoderChannel e = new LabCommEncoderChannel(out ); + EncoderChannel e = new EncoderChannel(out ); FooSample.register(e); FooSample sample = new FooSample(); sample.x = 17; @@ -35,7 +35,7 @@ public class TestClientSingleshot implements Handler { printSample("Client sending", sample); FooSample.encode(e, sample); - LabCommDecoderChannel c = new LabCommDecoderChannel(in); + DecoderChannel c = new DecoderChannel(in); FooSample.register(c,this); c.runOne(); } catch (Exception e) { diff --git a/examples/jgrafchart/labcommTCPtest/server/TestServer.java b/examples/jgrafchart/labcommTCPtest/server/TestServer.java index 33be0cdaae064bc00c8eaf2d03fd9883b224ff00..4b95a362a6a1784407336df5b5eab411f2e25f1d 100644 --- a/examples/jgrafchart/labcommTCPtest/server/TestServer.java +++ b/examples/jgrafchart/labcommTCPtest/server/TestServer.java @@ -8,8 +8,8 @@ import java.lang.reflect.Method; import java.net.ServerSocket; import java.net.Socket; -import se.lth.control.labcomm.LabCommDecoderChannel; -import se.lth.control.labcomm.LabCommEncoderChannel; +import se.lth.control.labcomm.DecoderChannel; +import se.lth.control.labcomm.EncoderChannel; import labcommTCPtest.gen.foo; import labcommTCPtest.gen.foo.Handler; @@ -38,7 +38,7 @@ public class TestServer implements Handler { public void runOne() { try { - LabCommDecoderChannel c = new LabCommDecoderChannel(in); + DecoderChannel c = new DecoderChannel(in); foo.register(c,this); c.runOne(); } catch (Exception e) { @@ -47,7 +47,7 @@ public class TestServer implements Handler { } public void handle_foo(foo sample) throws Exception { - LabCommEncoderChannel e = new LabCommEncoderChannel(out ); + EncoderChannel e = new EncoderChannel(out ); foo.register(e); System.out.println("TestServer.handle_foo..."); sample.b *= 2; diff --git a/examples/simple/Decoder.java b/examples/simple/Decoder.java index 4ab97e48fccda695f051157b6eb86d293b700d3f..48dd3edfa2cb6b9501890f17f62f3b9df79047fb 100644 --- a/examples/simple/Decoder.java +++ b/examples/simple/Decoder.java @@ -2,19 +2,19 @@ import java.io.File; import java.io.FileInputStream; import java.io.InputStream; -import se.lth.control.labcomm.LabCommDecoderChannel; +import se.lth.control.labcomm.DecoderChannel; public class Decoder implements theTwoInts.Handler, anotherTwoInts.Handler, IntString.Handler, TwoArrays.Handler, TwoFixedArrays.Handler, doavoid.Handler { - LabCommDecoderChannel decoder; + DecoderChannel decoder; public Decoder(InputStream in) throws Exception { - decoder = new LabCommDecoderChannel(in); + decoder = new DecoderChannel(in); theTwoInts.register(decoder, this); anotherTwoInts.register(decoder, this); IntString.register(decoder, this); diff --git a/examples/simple/Decoder06.java b/examples/simple/Decoder06.java index b6185d7b04e70d89080a79a4fcdacb7b1c8ee1e1..86ba71846540577b0561c101ca62a6ae17758d20 100644 --- a/examples/simple/Decoder06.java +++ b/examples/simple/Decoder06.java @@ -2,19 +2,19 @@ import java.io.File; import java.io.FileInputStream; import java.io.InputStream; -import se.lth.control.labcomm2006.LabCommDecoderChannel; +import se.lth.control.labcomm2006.DecoderChannel; public class Decoder06 implements theTwoInts.Handler, anotherTwoInts.Handler, IntString.Handler, TwoArrays.Handler, TwoFixedArrays.Handler { - LabCommDecoderChannel decoder; + DecoderChannel decoder; public Decoder06(InputStream in) throws Exception { - decoder = new LabCommDecoderChannel(in); + decoder = new DecoderChannel(in); theTwoInts.register(decoder, this); anotherTwoInts.register(decoder, this); IntString.register(decoder, this); diff --git a/examples/simple/Encoder.java b/examples/simple/Encoder.java index b209ea62b547ad289fe553d823bceadb58fb78ff..d70384cee5fe7452d4cb413db3c7c6ef09f9e7a1 100644 --- a/examples/simple/Encoder.java +++ b/examples/simple/Encoder.java @@ -2,7 +2,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; -import se.lth.control.labcomm.LabCommEncoderChannel; +import se.lth.control.labcomm.EncoderChannel; /** * Simple encoder @@ -10,12 +10,12 @@ import se.lth.control.labcomm.LabCommEncoderChannel; public class Encoder { - LabCommEncoderChannel encoder; + EncoderChannel encoder; public Encoder(OutputStream out) throws Exception { - encoder = new LabCommEncoderChannel(out); + encoder = new EncoderChannel(out); theTwoInts.register(encoder); IntString.register(encoder); TwoArrays.register(encoder); diff --git a/examples/simple/Encoder06.java b/examples/simple/Encoder06.java index 5d913d9fc98748c012717ea5f51d662562e39341..1da84c85b6e3efe483e02f7b661b7efcfdc48cd8 100644 --- a/examples/simple/Encoder06.java +++ b/examples/simple/Encoder06.java @@ -2,7 +2,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; -import se.lth.control.labcomm2006.LabCommEncoderChannel; +import se.lth.control.labcomm2006.EncoderChannel; /** * Simple encoder @@ -10,12 +10,12 @@ import se.lth.control.labcomm2006.LabCommEncoderChannel; public class Encoder06 { - LabCommEncoderChannel encoder; + EncoderChannel encoder; public Encoder06(OutputStream out) throws Exception { - encoder = new LabCommEncoderChannel(out); + encoder = new EncoderChannel(out); theTwoInts.register(encoder); IntString.register(encoder); TwoArrays.register(encoder); diff --git a/examples/tcp/labcommTCPtest/client/TestClient.java b/examples/tcp/labcommTCPtest/client/TestClient.java index d9040fb3475ebaa36f2f85ac5f261d7d2b07205f..fcd621e5f0749184d271602054b1d84c151074d8 100644 --- a/examples/tcp/labcommTCPtest/client/TestClient.java +++ b/examples/tcp/labcommTCPtest/client/TestClient.java @@ -6,8 +6,8 @@ import java.io.OutputStream; import java.net.Socket; import java.net.UnknownHostException; -import se.lth.control.labcomm.LabCommDecoderChannel; -import se.lth.control.labcomm.LabCommEncoderChannel; +import se.lth.control.labcomm.DecoderChannel; +import se.lth.control.labcomm.EncoderChannel; import labcommTCPtest.gen.FooSample; import labcommTCPtest.gen.FooSample.Handler; @@ -25,7 +25,7 @@ public class TestClient implements Handler { public void test() { try { - LabCommEncoderChannel e = new LabCommEncoderChannel(out ); + EncoderChannel e = new EncoderChannel(out ); FooSample.register(e); FooSample sample = new FooSample(); int a[] = new int[3]; @@ -42,7 +42,7 @@ public class TestClient implements Handler { printSample("Client sending", sample); FooSample.encode(e, sample); - LabCommDecoderChannel c = new LabCommDecoderChannel(in); + DecoderChannel c = new DecoderChannel(in); FooSample.register(c,this); c.runOne(); } catch (Exception e) { diff --git a/examples/tcp/labcommTCPtest/client/TestClientSingleshot.java b/examples/tcp/labcommTCPtest/client/TestClientSingleshot.java index d54c7bb09f78ab3502199f40c70c88677539d3f5..9601bcabcf45d174367aeeb61229ccc3dfeb8d25 100644 --- a/examples/tcp/labcommTCPtest/client/TestClientSingleshot.java +++ b/examples/tcp/labcommTCPtest/client/TestClientSingleshot.java @@ -6,8 +6,8 @@ import java.io.OutputStream; import java.net.Socket; import java.net.UnknownHostException; -import se.lth.control.labcomm.LabCommDecoderChannel; -import se.lth.control.labcomm.LabCommEncoderChannel; +import se.lth.control.labcomm.DecoderChannel; +import se.lth.control.labcomm.EncoderChannel; import labcommTCPtest.gen.FooSample; import labcommTCPtest.gen.FooSample.Handler; @@ -25,7 +25,7 @@ public class TestClientSingleshot implements Handler { public void test() { try { - LabCommEncoderChannel e = new LabCommEncoderChannel(out ); + EncoderChannel e = new EncoderChannel(out ); FooSample.register(e); FooSample sample = new FooSample(); sample.x = 17; @@ -35,7 +35,7 @@ public class TestClientSingleshot implements Handler { printSample("Client sending", sample); FooSample.encode(e, sample); - LabCommDecoderChannel c = new LabCommDecoderChannel(in); + DecoderChannel c = new DecoderChannel(in); FooSample.register(c,this); c.runOne(); } catch (Exception e) { diff --git a/examples/tcp/labcommTCPtest/server/OneShotServer.java b/examples/tcp/labcommTCPtest/server/OneShotServer.java index b929d8ba52cdd7df9751502030c43c231fcee36b..b79b93e7d8f14d7eac194207d7914c17187fc113 100644 --- a/examples/tcp/labcommTCPtest/server/OneShotServer.java +++ b/examples/tcp/labcommTCPtest/server/OneShotServer.java @@ -6,8 +6,8 @@ import java.io.OutputStream; import java.net.Socket; import java.net.ServerSocket; -import se.lth.control.labcomm.LabCommDecoderChannel; -import se.lth.control.labcomm.LabCommEncoderChannel; +import se.lth.control.labcomm.DecoderChannel; +import se.lth.control.labcomm.EncoderChannel; import labcommTCPtest.gen.FooSample; public class OneShotServer {//implements Handler { @@ -21,7 +21,7 @@ public class OneShotServer {//implements Handler { public void test() { try { - LabCommEncoderChannel e = new LabCommEncoderChannel(out ); + EncoderChannel e = new EncoderChannel(out ); FooSample.register(e); FooSample sample = new FooSample(); sample.s = "OneShotServer message"; diff --git a/examples/tcp/labcommTCPtest/server/TestServer.java b/examples/tcp/labcommTCPtest/server/TestServer.java index b9b6d0b969a05f266510fca8556ec744290185c7..441bac4df2d1d4a08eda8322c0c2717b0e886521 100644 --- a/examples/tcp/labcommTCPtest/server/TestServer.java +++ b/examples/tcp/labcommTCPtest/server/TestServer.java @@ -8,8 +8,8 @@ import java.lang.reflect.Method; import java.net.ServerSocket; import java.net.Socket; -import se.lth.control.labcomm.LabCommDecoderChannel; -import se.lth.control.labcomm.LabCommEncoderChannel; +import se.lth.control.labcomm.DecoderChannel; +import se.lth.control.labcomm.EncoderChannel; import labcommTCPtest.gen.FooSample; import labcommTCPtest.gen.FooSample.Handler; @@ -38,7 +38,7 @@ public class TestServer implements Handler { public void runOne() { try { - LabCommDecoderChannel c = new LabCommDecoderChannel(in); + DecoderChannel c = new DecoderChannel(in); FooSample.register(c,this); c.runOne(); } catch (Exception e) { @@ -47,7 +47,7 @@ public class TestServer implements Handler { } public void handle_FooSample(FooSample sample) throws Exception { - LabCommEncoderChannel e = new LabCommEncoderChannel(out ); + EncoderChannel e = new EncoderChannel(out ); FooSample.register(e); System.out.println("TestServer.handle_FooSample: "+sample.s); int tmp[] = new int[2*sample.a.length]; diff --git a/examples/user_types/Decoder.java b/examples/user_types/Decoder.java index 01bea43a658960fa2817416fd4d6efcf81b1f7de..bdb17374517015db59e66c02c3144b9d9bf886bc 100644 --- a/examples/user_types/Decoder.java +++ b/examples/user_types/Decoder.java @@ -2,19 +2,19 @@ import java.io.File; import java.io.FileInputStream; import java.io.InputStream; -import se.lth.control.labcomm.LabCommDecoderChannel; +import se.lth.control.labcomm.DecoderChannel; public class Decoder implements twoLines.Handler { - LabCommDecoderChannel decoder; + DecoderChannel decoder; public Decoder(InputStream in) throws Exception { - decoder = new LabCommDecoderChannel(in); + decoder = new DecoderChannel(in); twoLines.register(decoder, this); try { diff --git a/examples/user_types/Encoder.java b/examples/user_types/Encoder.java index 8cdbba85598ada7a850b1c110e13cea212719d74..aa2f80e9617aa3b47b468f4d46469573743a8bc9 100644 --- a/examples/user_types/Encoder.java +++ b/examples/user_types/Encoder.java @@ -2,7 +2,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; -import se.lth.control.labcomm.LabCommEncoderChannel; +import se.lth.control.labcomm.EncoderChannel; /** * Simple encoder @@ -10,12 +10,12 @@ import se.lth.control.labcomm.LabCommEncoderChannel; public class Encoder { - LabCommEncoderChannel encoder; + EncoderChannel encoder; public Encoder(OutputStream out) throws Exception { - encoder = new LabCommEncoderChannel(out); + encoder = new EncoderChannel(out); twoLines.register(encoder); } diff --git a/examples/wiki_example/data.java b/examples/wiki_example/data.java index 7acf55a5a1c915dc72ed235b9d3a88cd45ad8b5d..5860ed9a4fb01ca0f411ed347256aff2bed412cc 100644 --- a/examples/wiki_example/data.java +++ b/examples/wiki_example/data.java @@ -2,27 +2,27 @@ sample float data; */ import java.io.IOException; -import se.lth.control.labcomm.LabCommDecoder; -import se.lth.control.labcomm.LabCommDispatcher; -import se.lth.control.labcomm.LabCommEncoder; -import se.lth.control.labcomm.LabCommHandler; -import se.lth.control.labcomm.LabCommSample; +import se.lth.control.labcomm.Decoder; +import se.lth.control.labcomm.Dispatcher; +import se.lth.control.labcomm.Encoder; +import se.lth.control.labcomm.Handler; +import se.lth.control.labcomm.Sample; -public class data implements LabCommSample { +public class data implements Sample { - public interface Handler extends LabCommHandler { + public interface Handler extends Handler { public void handle_data(float value) throws Exception; } - public static void register(LabCommDecoder d, Handler h) throws IOException { + public static void register(Decoder d, Handler h) throws IOException { d.register(new Dispatcher(), h); } - public static void register(LabCommEncoder e) throws IOException { + public static void register(Encoder e) throws IOException { e.register(new Dispatcher()); } - private static class Dispatcher implements LabCommDispatcher { + private static class Dispatcher implements Dispatcher { public Class getSampleClass() { return data.class; @@ -36,20 +36,20 @@ public class data implements LabCommSample { return signature; } - public void decodeAndHandle(LabCommDecoder d, - LabCommHandler h) throws Exception { + public void decodeAndHandle(Decoder d, + Handler h) throws Exception { ((Handler)h).handle_data(data.decode(d)); } } - public static void encode(LabCommEncoder e, float value) throws IOException { + public static void encode(Encoder e, float value) throws IOException { e.begin(data.class); e.encodeFloat(value); e.end(data.class); } - public static float decode(LabCommDecoder d) throws IOException { + public static float decode(Decoder d) throws IOException { float result; result = d.decodeFloat(); return result; diff --git a/examples/wiki_example/example_decoder_encoder.java b/examples/wiki_example/example_decoder_encoder.java index 63f1d96b7a00da8b60e946af48fcd6bdb0e8c943..252cc1d8411ad59259dd445930f74b8f1ff61e2f 100644 --- a/examples/wiki_example/example_decoder_encoder.java +++ b/examples/wiki_example/example_decoder_encoder.java @@ -4,24 +4,24 @@ import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; -import se.lth.control.labcomm.LabCommDecoderChannel; -import se.lth.control.labcomm.LabCommEncoderChannel; +import se.lth.control.labcomm.DecoderChannel; +import se.lth.control.labcomm.EncoderChannel; public class example_decoder_encoder implements data.Handler, log_message.Handler { - LabCommDecoderChannel decoder; - LabCommEncoderChannel encoder; + DecoderChannel decoder; + EncoderChannel encoder; public example_decoder_encoder(InputStream in, OutputStream out) throws Exception { - decoder = new LabCommDecoderChannel(in); + decoder = new DecoderChannel(in); log_message.register(decoder, this); data.register(decoder, this); - encoder = new LabCommEncoderChannel(out); + encoder = new EncoderChannel(out); log_message.register(encoder); data.register(encoder); diff --git a/lib/java/Makefile b/lib/java/Makefile index f3f60c275c4918df19d34603b69a0c03896e2d46..47b112cc2b78496cafc8c2972300aabe2f4bebd7 100644 --- a/lib/java/Makefile +++ b/lib/java/Makefile @@ -1,16 +1,16 @@ -MODULES=LabCommDispatcher \ - LabCommDecoderRegistry \ - LabComm \ - LabCommSample \ - LabCommHandler \ - LabCommEncoderRegistry \ - LabCommType \ - LabCommEncoder \ - LabCommEncoderChannel \ - LabCommDecoder \ - LabCommDecoderChannel \ - LabCommWriter \ - LabCommReader \ +MODULES=Constant \ + Decoder \ + DecoderChannel \ + DecoderRegistry \ + Encoder \ + EncoderChannel \ + EncoderRegistry \ + Reader \ + Sample \ + SampleDispatcher \ + SampleHandler \ + Type \ + Writer \ WriterWrapper all: labcomm.jar labcomm20141009.jar labcomm2006.jar diff --git a/lib/java/se/lth/control/labcomm/LabComm.java b/lib/java/se/lth/control/labcomm/Constant.java similarity index 97% rename from lib/java/se/lth/control/labcomm/LabComm.java rename to lib/java/se/lth/control/labcomm/Constant.java index 0a89ea39579c28cab1122dc3070f9340968edfcf..7c5da70fead9443e593d6b5c71b00b8f339b4188 100644 --- a/lib/java/se/lth/control/labcomm/LabComm.java +++ b/lib/java/se/lth/control/labcomm/Constant.java @@ -1,6 +1,6 @@ package se.lth.control.labcomm; -public class LabComm { +public class Constant { public static final String VERSION = "LabComm20141009"; diff --git a/lib/java/se/lth/control/labcomm/LabCommDecoder.java b/lib/java/se/lth/control/labcomm/Decoder.java similarity index 78% rename from lib/java/se/lth/control/labcomm/LabCommDecoder.java rename to lib/java/se/lth/control/labcomm/Decoder.java index a40fb8531f43c8b064835ca2de4b904325b838ca..c3320f3b5db17573882333472b74b5e8975bafc3 100644 --- a/lib/java/se/lth/control/labcomm/LabCommDecoder.java +++ b/lib/java/se/lth/control/labcomm/Decoder.java @@ -2,10 +2,10 @@ package se.lth.control.labcomm; import java.io.IOException; -public interface LabCommDecoder { +public interface Decoder { - public void register(LabCommDispatcher dispatcher, - LabCommHandler handler) throws IOException; + public void register(SampleDispatcher dispatcher, + SampleHandler handler) throws IOException; public boolean decodeBoolean() throws IOException; public byte decodeByte() throws IOException; public short decodeShort() throws IOException; diff --git a/lib/java/se/lth/control/labcomm/LabCommDecoderChannel.java b/lib/java/se/lth/control/labcomm/DecoderChannel.java similarity index 81% rename from lib/java/se/lth/control/labcomm/LabCommDecoderChannel.java rename to lib/java/se/lth/control/labcomm/DecoderChannel.java index 4910c6b8efcbcdddab98cb914b845ecc88d9890c..6c5a1d2a9f34e1dda4cc7ff5a7dcb7a06d2e105b 100644 --- a/lib/java/se/lth/control/labcomm/LabCommDecoderChannel.java +++ b/lib/java/se/lth/control/labcomm/DecoderChannel.java @@ -6,20 +6,20 @@ import java.io.InputStream; import java.io.IOException; import java.io.EOFException; -public class LabCommDecoderChannel implements LabCommDecoder { +public class DecoderChannel implements Decoder { private DataInputStream in; - private LabCommDecoderRegistry registry; + private DecoderRegistry registry; - public LabCommDecoderChannel(InputStream in) throws IOException { + public DecoderChannel(InputStream in) throws IOException { this.in = new DataInputStream(in); - registry = new LabCommDecoderRegistry(); + registry = new DecoderRegistry(); String version = decodeString(); - if (! version.equals(LabComm.VERSION)) { + if (! version.equals(Constant.VERSION)) { throw new IOException("LabComm version mismatch " + - version + " != " + LabComm.VERSION); + version + " != " + Constant.VERSION); } - System.err.println(LabComm.VERSION); + System.err.println(Constant.VERSION); } public void runOne() throws Exception { @@ -28,7 +28,7 @@ public class LabCommDecoderChannel implements LabCommDecoder { int tag = decodePacked32(); int length = decodePacked32(); switch (tag) { - case LabComm.SAMPLE: { + case Constant.SAMPLE: { int index = decodePacked32(); String name = decodeString(); int signature_length = decodePacked32(); @@ -37,15 +37,15 @@ public class LabCommDecoderChannel implements LabCommDecoder { registry.add(index, name, signature); } break; default: { - LabCommDecoderRegistry.Entry e = registry.get(tag); + DecoderRegistry.Entry e = registry.get(tag); if (e == null) { throw new IOException("Unhandled tag " + tag); } - LabCommDispatcher d = e.getDispatcher(); + SampleDispatcher d = e.getDispatcher(); if (d == null) { throw new IOException("No dispatcher for '" + e.getName() + "'"); } - LabCommHandler h = e.getHandler(); + SampleHandler h = e.getHandler(); if (h == null) { throw new IOException("No handler for '" + e.getName() +"'"); } @@ -62,8 +62,8 @@ public class LabCommDecoderChannel implements LabCommDecoder { } } - public void register(LabCommDispatcher dispatcher, - LabCommHandler handler) throws IOException { + public void register(SampleDispatcher dispatcher, + SampleHandler handler) throws IOException { registry.add(dispatcher, handler); } diff --git a/lib/java/se/lth/control/labcomm/LabCommDecoderRegistry.java b/lib/java/se/lth/control/labcomm/DecoderRegistry.java similarity index 84% rename from lib/java/se/lth/control/labcomm/LabCommDecoderRegistry.java rename to lib/java/se/lth/control/labcomm/DecoderRegistry.java index 890aeae2d0ac3d56d1525053daa5f66729f6dba7..fdf8f591d646dad3680e7fbea48e2dcb9ed2ba15 100644 --- a/lib/java/se/lth/control/labcomm/LabCommDecoderRegistry.java +++ b/lib/java/se/lth/control/labcomm/DecoderRegistry.java @@ -3,18 +3,18 @@ package se.lth.control.labcomm; import java.io.IOException; import java.util.HashMap; -public class LabCommDecoderRegistry { +public class DecoderRegistry { public static class Entry { - private LabCommDispatcher dispatcher; - private LabCommHandler handler; + private SampleDispatcher dispatcher; + private SampleHandler handler; private int index; private String name; private byte[] signature; - public Entry(LabCommDispatcher dispatcher, - LabCommHandler handler) { + public Entry(SampleDispatcher dispatcher, + SampleHandler handler) { this.dispatcher = dispatcher; this.name = dispatcher.getName(); this.signature = dispatcher.getSignature(); @@ -27,19 +27,19 @@ public class LabCommDecoderRegistry { this.signature = signature; } - public LabCommDispatcher getDispatcher() { + public SampleDispatcher getDispatcher() { return dispatcher; } - public void setDispatcher(LabCommDispatcher dispatcher) { + public void setDispatcher(SampleDispatcher dispatcher) { this.dispatcher = dispatcher; } - public LabCommHandler getHandler() { + public SampleHandler getHandler() { return handler; } - public void setHandler(LabCommHandler handler) { + public void setHandler(SampleHandler handler) { this.handler = handler; } @@ -89,13 +89,13 @@ public class LabCommDecoderRegistry { private HashMap<Class, Entry> byClass; private HashMap<Integer, Entry> byIndex; - public LabCommDecoderRegistry() { + public DecoderRegistry() { byClass = new HashMap<Class, Entry>(); byIndex = new HashMap<Integer, Entry>(); } - public synchronized void add(LabCommDispatcher dispatcher, - LabCommHandler handler) throws IOException{ + public synchronized void add(SampleDispatcher dispatcher, + SampleHandler handler) throws IOException{ Entry e = byClass.get(dispatcher.getSampleClass()); if (e != null) { e.check(dispatcher.getName(), dispatcher.getSignature()); @@ -141,4 +141,4 @@ public class LabCommDecoderRegistry { return byIndex.get(Integer.valueOf(index)); } -} \ No newline at end of file +} diff --git a/lib/java/se/lth/control/labcomm/LabCommEncoder.java b/lib/java/se/lth/control/labcomm/Encoder.java similarity index 71% rename from lib/java/se/lth/control/labcomm/LabCommEncoder.java rename to lib/java/se/lth/control/labcomm/Encoder.java index f332d78784cf6281befe30a1eb099fdaea7c175c..d6ef3e5ff2a08502dcde3c548a36e58aa9a5faf5 100644 --- a/lib/java/se/lth/control/labcomm/LabCommEncoder.java +++ b/lib/java/se/lth/control/labcomm/Encoder.java @@ -2,11 +2,11 @@ package se.lth.control.labcomm; import java.io.IOException; -public interface LabCommEncoder { +public interface Encoder { - public void register(LabCommDispatcher dispatcher) throws IOException; - public void begin(Class<? extends LabCommSample> c) throws IOException; - public void end(Class<? extends LabCommSample> c) throws IOException; + public void register(SampleDispatcher dispatcher) throws IOException; + public void begin(Class<? extends Sample> c) throws IOException; + public void end(Class<? extends Sample> c) throws IOException; public void encodeBoolean(boolean value) throws IOException; public void encodeByte(byte value) throws IOException; public void encodeShort(short value) throws IOException; diff --git a/lib/java/se/lth/control/labcomm/LabCommEncoderChannel.java b/lib/java/se/lth/control/labcomm/EncoderChannel.java similarity index 77% rename from lib/java/se/lth/control/labcomm/LabCommEncoderChannel.java rename to lib/java/se/lth/control/labcomm/EncoderChannel.java index b5c422dc32a418f1ca026335a73a1086cf1222fc..1bde995a249a3da8e867888d5ff34ccdc95ec8d6 100644 --- a/lib/java/se/lth/control/labcomm/LabCommEncoderChannel.java +++ b/lib/java/se/lth/control/labcomm/EncoderChannel.java @@ -5,44 +5,44 @@ import java.io.DataOutputStream; import java.io.IOException; import java.io.OutputStream; -public class LabCommEncoderChannel implements LabCommEncoder { +public class EncoderChannel implements Encoder { - private LabCommWriter writer; + private Writer writer; private ByteArrayOutputStream bytes; private DataOutputStream data; - private LabCommEncoderRegistry registry; + private EncoderRegistry registry; private int current_tag; - public LabCommEncoderChannel(LabCommWriter writer, - boolean emitVersion) throws IOException { + public EncoderChannel(Writer writer, + boolean emitVersion) throws IOException { this.writer = writer; bytes = new ByteArrayOutputStream(); data = new DataOutputStream(bytes); - registry = new LabCommEncoderRegistry(); + registry = new EncoderRegistry(); if (emitVersion) { - encodeString(LabComm.VERSION); + encodeString(Constant.VERSION); data.flush(); writer.write(bytes.toByteArray()); bytes.reset(); } } - public LabCommEncoderChannel(LabCommWriter writer) throws IOException { + public EncoderChannel(Writer writer) throws IOException { this(writer, true); } - public LabCommEncoderChannel(OutputStream writer, - boolean emitVersion) throws IOException { + public EncoderChannel(OutputStream writer, + boolean emitVersion) throws IOException { this(new WriterWrapper(writer), emitVersion); } - public LabCommEncoderChannel(OutputStream writer) throws IOException { + public EncoderChannel(OutputStream writer) throws IOException { this(new WriterWrapper(writer), true); } - public void register(LabCommDispatcher dispatcher) throws IOException { + public void register(SampleDispatcher dispatcher) throws IOException { int index = registry.add(dispatcher); - begin(LabComm.SAMPLE); + begin(Constant.SAMPLE); encodePacked32(index); encodeString(dispatcher.getName()); byte[] signature = dispatcher.getSignature(); @@ -58,11 +58,11 @@ public class LabCommEncoderChannel implements LabCommEncoder { bytes.reset(); } - public void begin(Class<? extends LabCommSample> c) throws IOException { + public void begin(Class<? extends Sample> c) throws IOException { begin(registry.getTag(c)); } - public void end(Class<? extends LabCommSample> c) throws IOException { + public void end(Class<? extends Sample> c) throws IOException { data.flush(); WritePacked32(writer, current_tag); WritePacked32(writer, bytes.size()); @@ -70,7 +70,7 @@ public class LabCommEncoderChannel implements LabCommEncoder { bytes.reset(); } - private void WritePacked32(LabCommWriter s, long value) throws IOException { + private void WritePacked32(Writer s, long value) throws IOException { byte[] tmp1 = new byte[5]; byte[] tmp2 = new byte[1]; long v = value & 0xffffffff; diff --git a/lib/java/se/lth/control/labcomm/LabCommEncoderRegistry.java b/lib/java/se/lth/control/labcomm/EncoderRegistry.java similarity index 66% rename from lib/java/se/lth/control/labcomm/LabCommEncoderRegistry.java rename to lib/java/se/lth/control/labcomm/EncoderRegistry.java index a5e848d9de6ac60eadae133f0498fe675b8eb44e..cd0cf72f5f45ed9ccc3cb6ce1902c9c2e37333bf 100644 --- a/lib/java/se/lth/control/labcomm/LabCommEncoderRegistry.java +++ b/lib/java/se/lth/control/labcomm/EncoderRegistry.java @@ -3,19 +3,19 @@ package se.lth.control.labcomm; import java.io.IOException; import java.util.HashMap; -public class LabCommEncoderRegistry { +public class EncoderRegistry { public static class Entry { - private LabCommDispatcher dispatcher; + private SampleDispatcher dispatcher; private int index; - public Entry(LabCommDispatcher dispatcher, int index) { + public Entry(SampleDispatcher dispatcher, int index) { this.dispatcher = dispatcher; this.index = index; } - public LabCommDispatcher getDispatcher() { + public SampleDispatcher getDispatcher() { return dispatcher; } @@ -25,14 +25,14 @@ public class LabCommEncoderRegistry { } - private int userIndex = LabComm.FIRST_USER_INDEX; + private int userIndex = Constant.FIRST_USER_INDEX; private HashMap<Class, Entry> byClass; - public LabCommEncoderRegistry() { + public EncoderRegistry() { byClass = new HashMap<Class, Entry>(); } - public synchronized int add(LabCommDispatcher dispatcher) { + public synchronized int add(SampleDispatcher dispatcher) { Entry e = byClass.get(dispatcher.getSampleClass()); if (e == null) { e = new Entry(dispatcher, userIndex); @@ -42,7 +42,7 @@ public class LabCommEncoderRegistry { return e.getIndex(); } - public int getTag(Class<? extends LabCommSample> sample) throws IOException { + public int getTag(Class<? extends Sample> sample) throws IOException { Entry e = byClass.get(sample); if (e == null) { throw new IOException("'" + @@ -52,4 +52,4 @@ public class LabCommEncoderRegistry { return e.index; } -} \ No newline at end of file +} diff --git a/lib/java/se/lth/control/labcomm/LabCommDispatcher.java b/lib/java/se/lth/control/labcomm/LabCommDispatcher.java deleted file mode 100644 index 86d756c2ab30008c9db1b32c10c8e65df8684dd7..0000000000000000000000000000000000000000 --- a/lib/java/se/lth/control/labcomm/LabCommDispatcher.java +++ /dev/null @@ -1,15 +0,0 @@ -package se.lth.control.labcomm; - -public interface LabCommDispatcher { - - public Class getSampleClass(); - - public String getName(); - - public byte[] getSignature(); - - public void decodeAndHandle(LabCommDecoder decoder, - LabCommHandler handler) throws Exception; - -} - diff --git a/lib/java/se/lth/control/labcomm/LabCommHandler.java b/lib/java/se/lth/control/labcomm/LabCommHandler.java deleted file mode 100644 index d30a12f852b5d555924b36d68aea962000bd0e60..0000000000000000000000000000000000000000 --- a/lib/java/se/lth/control/labcomm/LabCommHandler.java +++ /dev/null @@ -1,4 +0,0 @@ -package se.lth.control.labcomm; - -public interface LabCommHandler { -} \ No newline at end of file diff --git a/lib/java/se/lth/control/labcomm/LabCommReader.java b/lib/java/se/lth/control/labcomm/Reader.java similarity index 73% rename from lib/java/se/lth/control/labcomm/LabCommReader.java rename to lib/java/se/lth/control/labcomm/Reader.java index 28d7d05c1d9680d172f6821136ead8f1b180fb75..1dd0dacd16ecab62bfb7e1de7ed30d082741c9ec 100644 --- a/lib/java/se/lth/control/labcomm/LabCommReader.java +++ b/lib/java/se/lth/control/labcomm/Reader.java @@ -1,6 +1,6 @@ package se.lth.control.labcomm; -public interface LabCommReader { +public interface Reader { public void handle(byte[] data, int begin, int end); diff --git a/lib/java/se/lth/control/labcomm/LabCommType.java b/lib/java/se/lth/control/labcomm/Sample.java similarity index 53% rename from lib/java/se/lth/control/labcomm/LabCommType.java rename to lib/java/se/lth/control/labcomm/Sample.java index 6cb84f67e0126d25f6ad3d38a76cc85e8b0d863e..8210e3a8efd5a407867a4de73ba27e314c604485 100644 --- a/lib/java/se/lth/control/labcomm/LabCommType.java +++ b/lib/java/se/lth/control/labcomm/Sample.java @@ -1,5 +1,5 @@ package se.lth.control.labcomm; -public interface LabCommType { +public interface Sample { } \ No newline at end of file diff --git a/lib/java/se/lth/control/labcomm/SampleDispatcher.java b/lib/java/se/lth/control/labcomm/SampleDispatcher.java new file mode 100644 index 0000000000000000000000000000000000000000..8051296a2104ddf07522d154686221f308934605 --- /dev/null +++ b/lib/java/se/lth/control/labcomm/SampleDispatcher.java @@ -0,0 +1,15 @@ +package se.lth.control.labcomm; + +public interface SampleDispatcher { + + public Class getSampleClass(); + + public String getName(); + + public byte[] getSignature(); + + public void decodeAndHandle(Decoder decoder, + SampleHandler handler) throws Exception; + +} + diff --git a/lib/java/se/lth/control/labcomm/SampleHandler.java b/lib/java/se/lth/control/labcomm/SampleHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..d03da88d64f8a23e795149bda5b7ed1080dd88e4 --- /dev/null +++ b/lib/java/se/lth/control/labcomm/SampleHandler.java @@ -0,0 +1,4 @@ +package se.lth.control.labcomm; + +public interface SampleHandler { +} diff --git a/lib/java/se/lth/control/labcomm/LabCommSample.java b/lib/java/se/lth/control/labcomm/Type.java similarity index 51% rename from lib/java/se/lth/control/labcomm/LabCommSample.java rename to lib/java/se/lth/control/labcomm/Type.java index 8ae824f8c1a94fee397ce6845f949e12da3242b5..46a5507777be00a7ea2a4d8e9d7610df741a5fc9 100644 --- a/lib/java/se/lth/control/labcomm/LabCommSample.java +++ b/lib/java/se/lth/control/labcomm/Type.java @@ -1,5 +1,5 @@ package se.lth.control.labcomm; -public interface LabCommSample { +public interface Type { } \ No newline at end of file diff --git a/lib/java/se/lth/control/labcomm/LabCommWriter.java b/lib/java/se/lth/control/labcomm/Writer.java similarity index 78% rename from lib/java/se/lth/control/labcomm/LabCommWriter.java rename to lib/java/se/lth/control/labcomm/Writer.java index 887c5471842bc8928d89bb469f463f111c835f69..2e015b0f4d94c0c916c76043178a2dda90403d86 100644 --- a/lib/java/se/lth/control/labcomm/LabCommWriter.java +++ b/lib/java/se/lth/control/labcomm/Writer.java @@ -2,7 +2,7 @@ package se.lth.control.labcomm; import java.io.IOException; -public interface LabCommWriter { +public interface Writer { public void write(byte[] data) throws IOException; diff --git a/lib/java/se/lth/control/labcomm/WriterWrapper.java b/lib/java/se/lth/control/labcomm/WriterWrapper.java index 0f7d1922e16cd2ce18cbfc6a8a19b09462679bc4..7c33137e31b309521a7526685dcdc3de6ef04b91 100644 --- a/lib/java/se/lth/control/labcomm/WriterWrapper.java +++ b/lib/java/se/lth/control/labcomm/WriterWrapper.java @@ -3,7 +3,7 @@ package se.lth.control.labcomm; import java.io.OutputStream; import java.io.IOException; -class WriterWrapper implements LabCommWriter{ +class WriterWrapper implements Writer{ private OutputStream os; diff --git a/lib/java/se/lth/control/labcomm2006/LabComm.java b/lib/java/se/lth/control/labcomm2006/Constant.java similarity index 97% rename from lib/java/se/lth/control/labcomm2006/LabComm.java rename to lib/java/se/lth/control/labcomm2006/Constant.java index b83c391a485f57da9f4354d1bc97485671f2de7c..5c14ae5c81186486c17e7a6e7d9f4c97891a7bfa 100644 --- a/lib/java/se/lth/control/labcomm2006/LabComm.java +++ b/lib/java/se/lth/control/labcomm2006/Constant.java @@ -1,6 +1,6 @@ package se.lth.control.labcomm2006; -public class LabComm { +public class Constant { public static final String VERSION = "LabComm2006"; diff --git a/lib/java/se/lth/control/labcomm2006/LabCommDecoder.java b/lib/java/se/lth/control/labcomm2006/Decoder.java similarity index 78% rename from lib/java/se/lth/control/labcomm2006/LabCommDecoder.java rename to lib/java/se/lth/control/labcomm2006/Decoder.java index 864e43e68e6b43d7a4b48b8ec2ae598ed2c0c645..0b442cb9026242c6617691f120f839505fde4a53 100644 --- a/lib/java/se/lth/control/labcomm2006/LabCommDecoder.java +++ b/lib/java/se/lth/control/labcomm2006/Decoder.java @@ -2,10 +2,10 @@ package se.lth.control.labcomm2006; import java.io.IOException; -public interface LabCommDecoder { +public interface Decoder { - public void register(LabCommDispatcher dispatcher, - LabCommHandler handler) throws IOException; + public void register(SampleDispatcher dispatcher, + SampleHandler handler) throws IOException; public boolean decodeBoolean() throws IOException; public byte decodeByte() throws IOException; public short decodeShort() throws IOException; diff --git a/lib/java/se/lth/control/labcomm2006/LabCommDecoderChannel.java b/lib/java/se/lth/control/labcomm2006/DecoderChannel.java similarity index 74% rename from lib/java/se/lth/control/labcomm2006/LabCommDecoderChannel.java rename to lib/java/se/lth/control/labcomm2006/DecoderChannel.java index 28077b58a543b113117b9cf217cc2ce91f65a856..77a96f1e90bde2fcf8bf418aefdc3af7d67cd32a 100644 --- a/lib/java/se/lth/control/labcomm2006/LabCommDecoderChannel.java +++ b/lib/java/se/lth/control/labcomm2006/DecoderChannel.java @@ -5,14 +5,14 @@ import java.io.DataInputStream; import java.io.InputStream; import java.io.IOException; -public class LabCommDecoderChannel implements LabCommDecoder { +public class DecoderChannel implements Decoder { private DataInputStream in; - private LabCommDecoderRegistry registry; + private DecoderRegistry registry; - public LabCommDecoderChannel(InputStream in) throws IOException { + public DecoderChannel(InputStream in) throws IOException { this.in = new DataInputStream(in); - registry = new LabCommDecoderRegistry(); + registry = new DecoderRegistry(); } public void runOne() throws Exception { @@ -20,23 +20,23 @@ public class LabCommDecoderChannel implements LabCommDecoder { while (!done) { int tag = decodePacked32(); switch (tag) { - case LabComm.SAMPLE: { + case Constant.SAMPLE: { int index = decodePacked32(); String name = decodeString(); ByteArrayOutputStream signature = new ByteArrayOutputStream(); - collectFlatSignature(new LabCommEncoderChannel(signature, false)); + collectFlatSignature(new EncoderChannel(signature, false)); registry.add(index, name, signature.toByteArray()); } break; default: { - LabCommDecoderRegistry.Entry e = registry.get(tag); + DecoderRegistry.Entry e = registry.get(tag); if (e == null) { throw new IOException("Unhandled tag " + tag); } - LabCommDispatcher d = e.getDispatcher(); + SampleDispatcher d = e.getDispatcher(); if (d == null) { throw new IOException("No dispatcher for '" + e.getName() + "'"); } - LabCommHandler h = e.getHandler(); + SampleHandler h = e.getHandler(); if (h == null) { throw new IOException("No handler for '" + e.getName() +"'"); } @@ -53,11 +53,11 @@ public class LabCommDecoderChannel implements LabCommDecoder { } } - private void collectFlatSignature(LabCommEncoder out) throws IOException { + private void collectFlatSignature(Encoder out) throws IOException { int type = decodePacked32(); out.encodePacked32(type); switch (type) { - case LabComm.ARRAY: { + case Constant.ARRAY: { int dimensions = decodePacked32(); out.encodePacked32(dimensions); for (int i = 0 ; i < dimensions ; i++) { @@ -65,7 +65,7 @@ public class LabCommDecoderChannel implements LabCommDecoder { } collectFlatSignature(out); } break; - case LabComm.STRUCT: { + case Constant.STRUCT: { int fields = decodePacked32(); out.encodePacked32(fields); for (int i = 0 ; i < fields ; i++) { @@ -73,14 +73,14 @@ public class LabCommDecoderChannel implements LabCommDecoder { collectFlatSignature(out); } } break; - case LabComm.BOOLEAN: - case LabComm.BYTE: - case LabComm.SHORT: - case LabComm.INT: - case LabComm.LONG: - case LabComm.FLOAT: - case LabComm.DOUBLE: - case LabComm.STRING: { + case Constant.BOOLEAN: + case Constant.BYTE: + case Constant.SHORT: + case Constant.INT: + case Constant.LONG: + case Constant.FLOAT: + case Constant.DOUBLE: + case Constant.STRING: { } break; default: { throw new IOException("Unimplemented type=" + type); @@ -89,8 +89,8 @@ public class LabCommDecoderChannel implements LabCommDecoder { out.end(null); } - public void register(LabCommDispatcher dispatcher, - LabCommHandler handler) throws IOException { + public void register(SampleDispatcher dispatcher, + SampleHandler handler) throws IOException { registry.add(dispatcher, handler); } diff --git a/lib/java/se/lth/control/labcomm2006/LabCommDecoderRegistry.java b/lib/java/se/lth/control/labcomm2006/DecoderRegistry.java similarity index 84% rename from lib/java/se/lth/control/labcomm2006/LabCommDecoderRegistry.java rename to lib/java/se/lth/control/labcomm2006/DecoderRegistry.java index a94bc6e3460b83386a1aafee8b84710c14c57784..8bce34d78b43fd2a8a3b2969debf5394e4c62b43 100644 --- a/lib/java/se/lth/control/labcomm2006/LabCommDecoderRegistry.java +++ b/lib/java/se/lth/control/labcomm2006/DecoderRegistry.java @@ -3,18 +3,18 @@ package se.lth.control.labcomm2006; import java.io.IOException; import java.util.HashMap; -public class LabCommDecoderRegistry { +public class DecoderRegistry { public static class Entry { - private LabCommDispatcher dispatcher; - private LabCommHandler handler; + private SampleDispatcher dispatcher; + private SampleHandler handler; private int index; private String name; private byte[] signature; - public Entry(LabCommDispatcher dispatcher, - LabCommHandler handler) { + public Entry(SampleDispatcher dispatcher, + SampleHandler handler) { this.dispatcher = dispatcher; this.name = dispatcher.getName(); this.signature = dispatcher.getSignature(); @@ -27,19 +27,19 @@ public class LabCommDecoderRegistry { this.signature = signature; } - public LabCommDispatcher getDispatcher() { + public SampleDispatcher getDispatcher() { return dispatcher; } - public void setDispatcher(LabCommDispatcher dispatcher) { + public void setDispatcher(SampleDispatcher dispatcher) { this.dispatcher = dispatcher; } - public LabCommHandler getHandler() { + public SampleHandler getHandler() { return handler; } - public void setHandler(LabCommHandler handler) { + public void setHandler(SampleHandler handler) { this.handler = handler; } @@ -89,13 +89,13 @@ public class LabCommDecoderRegistry { private HashMap<Class, Entry> byClass; private HashMap<Integer, Entry> byIndex; - public LabCommDecoderRegistry() { + public DecoderRegistry() { byClass = new HashMap<Class, Entry>(); byIndex = new HashMap<Integer, Entry>(); } - public synchronized void add(LabCommDispatcher dispatcher, - LabCommHandler handler) throws IOException{ + public synchronized void add(SampleDispatcher dispatcher, + SampleHandler handler) throws IOException{ Entry e = byClass.get(dispatcher.getSampleClass()); if (e != null) { e.check(dispatcher.getName(), dispatcher.getSignature()); @@ -141,4 +141,4 @@ public class LabCommDecoderRegistry { return byIndex.get(Integer.valueOf(index)); } -} \ No newline at end of file +} diff --git a/lib/java/se/lth/control/labcomm2006/LabCommEncoder.java b/lib/java/se/lth/control/labcomm2006/Encoder.java similarity index 71% rename from lib/java/se/lth/control/labcomm2006/LabCommEncoder.java rename to lib/java/se/lth/control/labcomm2006/Encoder.java index 51c2223be4241053086715c8878fe37a8052cf62..eaf54b291b1196d34910690f0d3bc54451f90da6 100644 --- a/lib/java/se/lth/control/labcomm2006/LabCommEncoder.java +++ b/lib/java/se/lth/control/labcomm2006/Encoder.java @@ -2,11 +2,11 @@ package se.lth.control.labcomm2006; import java.io.IOException; -public interface LabCommEncoder { +public interface Encoder { - public void register(LabCommDispatcher dispatcher) throws IOException; - public void begin(Class<? extends LabCommSample> c) throws IOException; - public void end(Class<? extends LabCommSample> c) throws IOException; + public void register(SampleDispatcher dispatcher) throws IOException; + public void begin(Class<? extends Sample> c) throws IOException; + public void end(Class<? extends Sample> c) throws IOException; public void encodeBoolean(boolean value) throws IOException; public void encodeByte(byte value) throws IOException; public void encodeShort(short value) throws IOException; diff --git a/lib/java/se/lth/control/labcomm2006/LabCommEncoderChannel.java b/lib/java/se/lth/control/labcomm2006/EncoderChannel.java similarity index 73% rename from lib/java/se/lth/control/labcomm2006/LabCommEncoderChannel.java rename to lib/java/se/lth/control/labcomm2006/EncoderChannel.java index 173ff50a30359b585c70d23e4631e719e3144360..b6c8ab715627215bdfd22afb8e08735811faf573 100644 --- a/lib/java/se/lth/control/labcomm2006/LabCommEncoderChannel.java +++ b/lib/java/se/lth/control/labcomm2006/EncoderChannel.java @@ -5,40 +5,40 @@ import java.io.DataOutputStream; import java.io.IOException; import java.io.OutputStream; -public class LabCommEncoderChannel implements LabCommEncoder { +public class EncoderChannel implements Encoder { - private LabCommWriter writer; + private Writer writer; private ByteArrayOutputStream bytes; private DataOutputStream data; - private LabCommEncoderRegistry registry; + private EncoderRegistry registry; - public LabCommEncoderChannel(LabCommWriter writer, - boolean emitVersion) throws IOException { + public EncoderChannel(Writer writer, + boolean emitVersion) throws IOException { this.writer = writer; bytes = new ByteArrayOutputStream(); data = new DataOutputStream(bytes); - registry = new LabCommEncoderRegistry(); + registry = new EncoderRegistry(); if (emitVersion) { throw new IllegalArgumentException("Labcomm 2006 does not support emitVersion"); } } - public LabCommEncoderChannel(LabCommWriter writer) throws IOException { + public EncoderChannel(Writer writer) throws IOException { this(writer, false); } - public LabCommEncoderChannel(OutputStream writer, - boolean emitVersion) throws IOException { + public EncoderChannel(OutputStream writer, + boolean emitVersion) throws IOException { this(new WriterWrapper(writer), emitVersion); } - public LabCommEncoderChannel(OutputStream writer) throws IOException { + public EncoderChannel(OutputStream writer) throws IOException { this(new WriterWrapper(writer), false); } - public void register(LabCommDispatcher dispatcher) throws IOException { + public void register(SampleDispatcher dispatcher) throws IOException { int index = registry.add(dispatcher); - encodePacked32(LabComm.SAMPLE); + encodePacked32(Constant.SAMPLE); encodePacked32(index); encodeString(dispatcher.getName()); byte[] signature = dispatcher.getSignature(); @@ -48,11 +48,11 @@ public class LabCommEncoderChannel implements LabCommEncoder { end(null); } - public void begin(Class<? extends LabCommSample> c) throws IOException { + public void begin(Class<? extends Sample> c) throws IOException { encodePacked32(registry.getTag(c)); } - public void end(Class<? extends LabCommSample> c) throws IOException { + public void end(Class<? extends Sample> c) throws IOException { data.flush(); //XXX when writer was a stream, it was probably a bit more GC efficient: //bytes.writeTo(writer); diff --git a/lib/java/se/lth/control/labcomm2006/LabCommEncoderRegistry.java b/lib/java/se/lth/control/labcomm2006/EncoderRegistry.java similarity index 66% rename from lib/java/se/lth/control/labcomm2006/LabCommEncoderRegistry.java rename to lib/java/se/lth/control/labcomm2006/EncoderRegistry.java index 2a5564e1d1ae394d26a2d107b7840053ba7b08aa..70f6eb72eedcacf99ec0e9b7e6d743281a3b6aa8 100644 --- a/lib/java/se/lth/control/labcomm2006/LabCommEncoderRegistry.java +++ b/lib/java/se/lth/control/labcomm2006/EncoderRegistry.java @@ -3,19 +3,19 @@ package se.lth.control.labcomm2006; import java.io.IOException; import java.util.HashMap; -public class LabCommEncoderRegistry { +public class EncoderRegistry { public static class Entry { - private LabCommDispatcher dispatcher; + private SampleDispatcher dispatcher; private int index; - public Entry(LabCommDispatcher dispatcher, int index) { + public Entry(SampleDispatcher dispatcher, int index) { this.dispatcher = dispatcher; this.index = index; } - public LabCommDispatcher getDispatcher() { + public SampleDispatcher getDispatcher() { return dispatcher; } @@ -25,14 +25,14 @@ public class LabCommEncoderRegistry { } - private int userIndex = LabComm.FIRST_USER_INDEX; + private int userIndex = Constant.FIRST_USER_INDEX; private HashMap<Class, Entry> byClass; - public LabCommEncoderRegistry() { + public EncoderRegistry() { byClass = new HashMap<Class, Entry>(); } - public synchronized int add(LabCommDispatcher dispatcher) { + public synchronized int add(SampleDispatcher dispatcher) { Entry e = byClass.get(dispatcher.getSampleClass()); if (e == null) { e = new Entry(dispatcher, userIndex); @@ -42,7 +42,7 @@ public class LabCommEncoderRegistry { return e.getIndex(); } - public int getTag(Class<? extends LabCommSample> sample) throws IOException { + public int getTag(Class<? extends Sample> sample) throws IOException { Entry e = byClass.get(sample); if (e == null) { throw new IOException("'" + @@ -52,4 +52,4 @@ public class LabCommEncoderRegistry { return e.index; } -} \ No newline at end of file +} diff --git a/lib/java/se/lth/control/labcomm2006/LabCommReader.java b/lib/java/se/lth/control/labcomm2006/Reader.java similarity index 74% rename from lib/java/se/lth/control/labcomm2006/LabCommReader.java rename to lib/java/se/lth/control/labcomm2006/Reader.java index 1c2561d048795d819974adc7c4ed9d1a30acbe22..62cdacfc94db0da24393036529b43c56b1d8c82c 100644 --- a/lib/java/se/lth/control/labcomm2006/LabCommReader.java +++ b/lib/java/se/lth/control/labcomm2006/Reader.java @@ -1,6 +1,6 @@ package se.lth.control.labcomm2006; -public interface LabCommReader { +public interface Reader { public void handle(byte[] data, int begin, int end); diff --git a/lib/java/se/lth/control/labcomm2006/LabCommType.java b/lib/java/se/lth/control/labcomm2006/Sample.java similarity index 55% rename from lib/java/se/lth/control/labcomm2006/LabCommType.java rename to lib/java/se/lth/control/labcomm2006/Sample.java index 0722e6d2492dbf384712245c6f26f27d61af47b3..a20b06ad0803fadcc6f0ad74ae01732063f5f33d 100644 --- a/lib/java/se/lth/control/labcomm2006/LabCommType.java +++ b/lib/java/se/lth/control/labcomm2006/Sample.java @@ -1,5 +1,5 @@ package se.lth.control.labcomm2006; -public interface LabCommType { +public interface Sample { } \ No newline at end of file diff --git a/lib/java/se/lth/control/labcomm2006/LabCommDispatcher.java b/lib/java/se/lth/control/labcomm2006/SampleDispatcher.java similarity index 50% rename from lib/java/se/lth/control/labcomm2006/LabCommDispatcher.java rename to lib/java/se/lth/control/labcomm2006/SampleDispatcher.java index 469627e5d73d52a3b3b3c8be10ddf5f7d5d98d15..f3acd50aff28b63e526ad090b81994c21491713f 100644 --- a/lib/java/se/lth/control/labcomm2006/LabCommDispatcher.java +++ b/lib/java/se/lth/control/labcomm2006/SampleDispatcher.java @@ -1,6 +1,6 @@ package se.lth.control.labcomm2006; -public interface LabCommDispatcher { +public interface SampleDispatcher { public Class getSampleClass(); @@ -8,8 +8,8 @@ public interface LabCommDispatcher { public byte[] getSignature(); - public void decodeAndHandle(LabCommDecoder decoder, - LabCommHandler handler) throws Exception; + public void decodeAndHandle(Decoder decoder, + SampleHandler handler) throws Exception; } diff --git a/lib/java/se/lth/control/labcomm2006/LabCommHandler.java b/lib/java/se/lth/control/labcomm2006/SampleHandler.java similarity index 51% rename from lib/java/se/lth/control/labcomm2006/LabCommHandler.java rename to lib/java/se/lth/control/labcomm2006/SampleHandler.java index 2880c19f7beea0914f0e39747644dff3356f7d09..046e3b4a21cf96871cd49b445ff9732bfd947ebd 100644 --- a/lib/java/se/lth/control/labcomm2006/LabCommHandler.java +++ b/lib/java/se/lth/control/labcomm2006/SampleHandler.java @@ -1,4 +1,4 @@ package se.lth.control.labcomm2006; -public interface LabCommHandler { -} \ No newline at end of file +public interface SampleHandler { +} diff --git a/lib/java/se/lth/control/labcomm2006/LabCommSample.java b/lib/java/se/lth/control/labcomm2006/Type.java similarity index 54% rename from lib/java/se/lth/control/labcomm2006/LabCommSample.java rename to lib/java/se/lth/control/labcomm2006/Type.java index d1dc1fff83d2343775c36e1c9dcb9e5b012ec728..63646a0f777b9a16e24350180f8f7e8c750fc63d 100644 --- a/lib/java/se/lth/control/labcomm2006/LabCommSample.java +++ b/lib/java/se/lth/control/labcomm2006/Type.java @@ -1,5 +1,5 @@ package se.lth.control.labcomm2006; -public interface LabCommSample { +public interface Type { } \ No newline at end of file diff --git a/lib/java/se/lth/control/labcomm2006/LabCommWriter.java b/lib/java/se/lth/control/labcomm2006/Writer.java similarity index 78% rename from lib/java/se/lth/control/labcomm2006/LabCommWriter.java rename to lib/java/se/lth/control/labcomm2006/Writer.java index e70e14280382596245c6b557c149ab698231cffa..e02b77d3412ff9f8692161e8e7b6b653f71c3605 100644 --- a/lib/java/se/lth/control/labcomm2006/LabCommWriter.java +++ b/lib/java/se/lth/control/labcomm2006/Writer.java @@ -2,7 +2,7 @@ package se.lth.control.labcomm2006; import java.io.IOException; -public interface LabCommWriter { +public interface Writer { public void write(byte[] data) throws IOException; diff --git a/lib/java/se/lth/control/labcomm2006/WriterWrapper.java b/lib/java/se/lth/control/labcomm2006/WriterWrapper.java index 4c96d88d81f2783080119ecd06f5deb451bc9341..b25c0d835c343ff9a3a12ca61a5ba22932fbe54f 100644 --- a/lib/java/se/lth/control/labcomm2006/WriterWrapper.java +++ b/lib/java/se/lth/control/labcomm2006/WriterWrapper.java @@ -3,7 +3,7 @@ package se.lth.control.labcomm2006; import java.io.OutputStream; import java.io.IOException; -class WriterWrapper implements LabCommWriter{ +class WriterWrapper implements Writer{ private OutputStream os; diff --git a/test/relay_gen_java.py b/test/relay_gen_java.py index 93644bc2ed679087264766594acece7467f04eaf..40f584efa217f4903c7800b57396b5a6ad519632 100755 --- a/test/relay_gen_java.py +++ b/test/relay_gen_java.py @@ -26,8 +26,8 @@ if __name__ == '__main__': |import java.io.FileInputStream; |import java.io.FileOutputStream; |import java.io.IOException; - |import se.lth.control.labcomm.LabCommDecoderChannel; - |import se.lth.control.labcomm.LabCommEncoderChannel; + |import se.lth.control.labcomm.DecoderChannel; + |import se.lth.control.labcomm.EncoderChannel; | |public class java_relay implements """)) @@ -37,7 +37,7 @@ if __name__ == '__main__': result.append(' %s.Handler' % sample[-1][0]) result.extend(split_match('^[^|]*\|(.*)$', """ |{ - | LabCommEncoderChannel encoder; + | EncoderChannel encoder; """)) for func,arg in sample: if arg == 'void': @@ -58,9 +58,9 @@ if __name__ == '__main__': result.extend(split_match('^[^|]*\|(.*)$', """ | public java_relay(String InName, String OutName) throws Exception { | FileInputStream InFile = new FileInputStream(InName); - | LabCommDecoderChannel d = new LabCommDecoderChannel(InFile); + | DecoderChannel d = new DecoderChannel(InFile); | FileOutputStream OutFile = new FileOutputStream(OutName); - | encoder = new LabCommEncoderChannel(OutFile); + | encoder = new EncoderChannel(OutFile); | """)) for func,arg in sample: