Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Erik Jansson
LabComm
Commits
dba43eab
Commit
dba43eab
authored
Oct 14, 2014
by
Anders Blomdell
Browse files
Major Java rename spree...
parent
1812c7dc
Changes
51
Hide whitespace changes
Inline
Side-by-side
compiler/Java_CodeGen.jrag
View file @
dba43eab
...
...
@@ -293,7 +293,7 @@ aspect Java_Register {
public void Program.Java_emitTypeRegister(Java_env env) {
/*
env.println("static void register(
LabComm
Channel 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+".
LabComm
Type;");
env.println("import se.lth.control.labcomm"+env.verStr+".
LabComm
Encoder;");
env.println("import se.lth.control.labcomm"+env.verStr+".
LabComm
Decoder;");
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
LabComm
Type {");
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+".
LabComm
Decoder;");
env.println("import se.lth.control.labcomm"+env.verStr+".
LabComm
Dispatcher;");
env.println("import se.lth.control.labcomm"+env.verStr+".
LabComm
Encoder;");
env.println("import se.lth.control.labcomm"+env.verStr+".
LabComm
Handler;");
env.println("import se.lth.control.labcomm"+env.verStr+".
LabComm
Sample;");
env.println("import se.lth.control.labcomm"+env.verStr+".Decoder;");
env.println("import se.lth.control.labcomm"+env.verStr+".
Sample
Dispatcher;");
env.println("import se.lth.control.labcomm"+env.verStr+".Encoder;");
env.println("import se.lth.control.labcomm"+env.verStr+".
Sample
Handler;");
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
LabComm
Sample {");
env.println(" implements Sample {");
env.println();
env.indent();
getType().Java_emitInstance(env);
env.println("public interface Handler extends
LabComm
Handler {");
env.println("public interface Handler extends
Sample
Handler {");
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(
LabComm
Decoder d, Handler h) throws IOException {");
env.println("public static void register(Decoder d,
Sample
Handler h) throws IOException {");
env.indent();
env.println("d.register(new Dispatcher(), h);");
env.unindent();
env.println("}");
env.println();
env.println("public static void register(
LabComm
Encoder 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
LabComm
Dispatcher {");
env.println("private static class Dispatcher implements
Sample
Dispatcher {");
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(
LabComm
Decoder d,");
env.println("
LabComm
Handler h) throws Exception {");
env.println("public void decodeAndHandle(Decoder d,");
env.println("
Sample
Handler 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(
LabComm
Encoder 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(
LabComm
Encoder 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(
LabComm
Decoder d) throws IOException {");
env.println(" decode(Decoder d) throws IOException {");
env.indent();
if (!isVoid()) {
getType().Java_emitType(env);
...
...
examples/dynamic/test/DynamicPart.java
View file @
dba43eab
...
...
@@ -18,12 +18,12 @@ import java.util.Iterator;
import
java.util.LinkedList
;
import
java.util.Map
;
import
se.lth.control.labcomm.
LabComm
Decoder
;
import
se.lth.control.labcomm.
LabComm
DecoderChannel
;
import
se.lth.control.labcomm.
LabComm
Encoder
;
import
se.lth.control.labcomm.
LabComm
EncoderChannel
;
import
AST.
LabComm
Parser
;
import
AST.
LabComm
Scanner
;
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
());
LabComm
Scanner
scanner
=
new
LabComm
Scanner
(
in
);
LabComm
Parser
parser
=
new
LabComm
Parser
();
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
);
LabComm
DecoderChannel
dec
=
new
LabComm
DecoderChannel
(
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"
,
LabComm
Decoder
.
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
);
LabComm
EncoderChannel
enc
=
new
LabComm
EncoderChannel
(
out
);
EncoderChannel
enc
=
new
EncoderChannel
(
out
);
/* register and send foo */
Method
regFoo
=
fc
.
getDeclaredMethod
(
"register"
,
LabComm
Encoder
.
class
);
Method
regFoo
=
fc
.
getDeclaredMethod
(
"register"
,
Encoder
.
class
);
regFoo
.
invoke
(
fc
,
enc
);
Method
doEncodeFoo
=
fc
.
getDeclaredMethod
(
"encode"
,
LabComm
Encoder
.
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"
,
LabComm
Encoder
.
class
);
Method
regBar
=
bc
.
getDeclaredMethod
(
"register"
,
Encoder
.
class
);
regBar
.
invoke
(
bc
,
enc
);
Method
doEncodeBar
=
bc
.
getDeclaredMethod
(
"encode"
,
LabComm
Encoder
.
class
,
Integer
.
TYPE
);
Method
doEncodeBar
=
bc
.
getDeclaredMethod
(
"encode"
,
Encoder
.
class
,
Integer
.
TYPE
);
doEncodeBar
.
invoke
(
bc
,
enc
,
ctxt
.
bar
);
out
.
close
();
...
...
examples/dynamic/test/StaticDecoder.java
View file @
dba43eab
...
...
@@ -6,16 +6,16 @@ import gen.bar;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.InputStream
;
import
se.lth.control.labcomm.
LabComm
DecoderChannel
;
import
se.lth.control.labcomm.DecoderChannel
;
public
class
StaticDecoder
implements
foo
.
Handler
,
bar
.
Handler
{
LabComm
DecoderChannel
decoder
;
DecoderChannel
decoder
;
public
StaticDecoder
(
InputStream
in
)
throws
Exception
{
decoder
=
new
LabComm
DecoderChannel
(
in
);
decoder
=
new
DecoderChannel
(
in
);
foo
.
register
(
decoder
,
this
);
bar
.
register
(
decoder
,
this
);
...
...
examples/dynamic/test/StaticEncoder.java
View file @
dba43eab
...
...
@@ -2,19 +2,19 @@ package test;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.OutputStream
;
import
se.lth.control.labcomm.
LabComm
EncoderChannel
;
import
se.lth.control.labcomm.EncoderChannel
;
import
gen.foo
;
import
gen.bar
;
public
class
StaticEncoder
{
LabComm
EncoderChannel
encoder
;
EncoderChannel
encoder
;
public
StaticEncoder
(
OutputStream
out
)
throws
Exception
{
encoder
=
new
LabComm
EncoderChannel
(
out
);
encoder
=
new
EncoderChannel
(
out
);
foo
.
register
(
encoder
);
bar
.
register
(
encoder
);
}
...
...
examples/dynamic/test/TestLabCommCompiler.java
View file @
dba43eab
...
...
@@ -16,18 +16,18 @@ import java.util.Iterator;
import
java.util.LinkedList
;
import
java.util.Map
;
import
se.lth.control.labcomm.
LabComm
Decoder
;
import
se.lth.control.labcomm.
LabComm
DecoderChannel
;
import
se.lth.control.labcomm.
LabComm
Encoder
;
import
se.lth.control.labcomm.
LabComm
EncoderChannel
;
import
AST.
LabComm
Parser
;
import
AST.
LabComm
Scanner
;
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
Test
LabComm
Compiler
{
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
);
LabComm
DecoderChannel
dec
=
new
LabComm
DecoderChannel
(
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"
,
LabComm
Decoder
.
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
);
LabComm
EncoderChannel
enc
=
new
LabComm
EncoderChannel
(
out
);
Method
reg
=
fc
.
getDeclaredMethod
(
"register"
,
LabComm
Encoder
.
class
);
EncoderChannel
enc
=
new
EncoderChannel
(
out
);
Method
reg
=
fc
.
getDeclaredMethod
(
"register"
,
Encoder
.
class
);
reg
.
invoke
(
fc
,
enc
);
Method
doEncode
=
fc
.
getDeclaredMethod
(
"encode"
,
LabComm
Encoder
.
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
());
LabComm
Scanner
scanner
=
new
LabComm
Scanner
(
in
);
LabComm
Parser
parser
=
new
LabComm
Parser
();
Scanner
scanner
=
new
Scanner
(
in
);
Parser
parser
=
new
Parser
();
Collection
errors
=
new
LinkedList
();
InRAMCompiler
irc
=
null
;
...
...
examples/dynamic/test/TestLabcommGen.java
View file @
dba43eab
...
...
@@ -18,12 +18,12 @@ import java.util.Iterator;
import
java.util.LinkedList
;
import
java.util.Map
;
import
se.lth.control.labcomm.
LabComm
Decoder
;
import
se.lth.control.labcomm.
LabComm
DecoderChannel
;
import
se.lth.control.labcomm.
LabComm
Encoder
;
import
se.lth.control.labcomm.
LabComm
EncoderChannel
;
import
AST.
LabComm
Parser
;
import
AST.
LabComm
Scanner
;
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
());
LabComm
Scanner
scanner
=
new
LabComm
Scanner
(
in
);
LabComm
Parser
parser
=
new
LabComm
Parser
();
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
);
LabComm
DecoderChannel
dec
=
new
LabComm
DecoderChannel
(
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"
,
LabComm
Decoder
.
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
);
LabComm
EncoderChannel
enc
=
new
LabComm
EncoderChannel
(
out
);
EncoderChannel
enc
=
new
EncoderChannel
(
out
);
/* register and send foo */
Method
regFoo
=
fc
.
getDeclaredMethod
(
"register"
,
LabComm
Encoder
.
class
);
Method
regFoo
=
fc
.
getDeclaredMethod
(
"register"
,
Encoder
.
class
);
regFoo
.
invoke
(
fc
,
enc
);
Method
doEncodeFoo
=
fc
.
getDeclaredMethod
(
"encode"
,
LabComm
Encoder
.
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"
,
LabComm
Encoder
.
class
);
Method
regBar
=
bc
.
getDeclaredMethod
(
"register"
,
Encoder
.
class
);
regBar
.
invoke
(
bc
,
enc
);
Method
doEncodeBar
=
bc
.
getDeclaredMethod
(
"encode"
,
LabComm
Encoder
.
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
);
LabComm
DecoderChannel
dec
=
new
LabComm
DecoderChannel
(
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"
,
LabComm
Decoder
.
class
,
handlerInterface
);
Method
reg
=
sampleClass
.
getDeclaredMethod
(
"register"
,
Decoder
.
class
,
handlerInterface
);
reg
.
invoke
(
sampleClass
,
dec
,
handler
);
}
...
...
examples/jgrafchart/labcommTCPtest/client/TestClient.java
View file @
dba43eab
...
...
@@ -6,8 +6,8 @@ import java.io.OutputStream;
import
java.net.Socket
;
import
java.net.UnknownHostException
;
import
se.lth.control.labcomm.
LabComm
DecoderChannel
;
import
se.lth.control.labcomm.
LabComm
EncoderChannel
;
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
{
LabComm
EncoderChannel
e
=
new
LabComm
EncoderChannel
(
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
);
LabComm
DecoderChannel
c
=
new
LabComm
DecoderChannel
(
in
);
DecoderChannel
c
=
new
DecoderChannel
(
in
);
foo
.
register
(
c
,
this
);
c
.
run
();
}
catch
(
Exception
e
)
{
...
...
examples/jgrafchart/labcommTCPtest/client/TestClientSingleshot.java
View file @
dba43eab
...
...
@@ -6,8 +6,8 @@ import java.io.OutputStream;
import
java.net.Socket
;
import
java.net.UnknownHostException
;
import
se.lth.control.labcomm.
LabComm
DecoderChannel
;
import
se.lth.control.labcomm.
LabComm
EncoderChannel
;
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
{
LabComm
EncoderChannel
e
=
new
LabComm
EncoderChannel
(
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
);
LabComm
DecoderChannel
c
=
new
LabComm
DecoderChannel
(
in
);
DecoderChannel
c
=
new
DecoderChannel
(
in
);
FooSample
.
register
(
c
,
this
);
c
.
runOne
();
}
catch
(
Exception
e
)
{
...
...
examples/jgrafchart/labcommTCPtest/server/TestServer.java
View file @
dba43eab
...
...
@@ -8,8 +8,8 @@ import java.lang.reflect.Method;
import
java.net.ServerSocket
;
import
java.net.Socket
;
import
se.lth.control.labcomm.
LabComm
DecoderChannel
;
import
se.lth.control.labcomm.
LabComm
EncoderChannel
;
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
{
LabComm
DecoderChannel
c
=
new
LabComm
DecoderChannel
(
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
{
LabComm
EncoderChannel
e
=
new
LabComm
EncoderChannel
(
out
);
EncoderChannel
e
=
new
EncoderChannel
(
out
);
foo
.
register
(
e
);
System
.
out
.
println
(
"TestServer.handle_foo..."
);
sample
.
b
*=
2
;
...
...
examples/simple/Decoder.java
View file @
dba43eab
...
...
@@ -2,19 +2,19 @@ import java.io.File;
import
java.io.FileInputStream
;
import
java.io.InputStream
;
import
se.lth.control.labcomm.
LabComm
DecoderChannel
;
import
se.lth.control.labcomm.DecoderChannel
;
public
class
Decoder
implements
theTwoInts
.
Handler
,
anotherTwoInts
.
Handler
,
IntString
.
Handler
,
TwoArrays
.
Handler
,
TwoFixedArrays
.
Handler
,
doavoid
.
Handler
{
LabComm
DecoderChannel
decoder
;
DecoderChannel
decoder
;
public
Decoder
(
InputStream
in
)
throws
Exception
{
decoder
=
new
LabComm
DecoderChannel
(
in
);
decoder
=
new
DecoderChannel
(
in
);
theTwoInts
.
register
(
decoder
,
this
);
anotherTwoInts
.
register
(
decoder
,
this
);
IntString
.
register
(
decoder
,
this
);
...
...
examples/simple/Decoder06.java
View file @
dba43eab
...
...
@@ -2,19 +2,19 @@ import java.io.File;
import
java.io.FileInputStream
;
import
java.io.InputStream
;
import
se.lth.control.labcomm2006.
LabComm
DecoderChannel
;
import
se.lth.control.labcomm2006.DecoderChannel
;
public
class
Decoder06
implements
theTwoInts
.
Handler
,
anotherTwoInts
.
Handler
,
IntString
.
Handler
,
TwoArrays
.
Handler
,
TwoFixedArrays
.
Handler
{
LabComm
DecoderChannel
decoder
;
DecoderChannel
decoder
;
public
Decoder06
(
InputStream
in
)
throws
Exception
{
decoder
=
new
LabComm
DecoderChannel
(
in
);
decoder
=
new
DecoderChannel
(
in
);
theTwoInts
.
register
(
decoder
,
this
);
anotherTwoInts
.
register
(
decoder
,
this
);
IntString
.
register
(
decoder
,
this
);
...
...
examples/simple/Encoder.java
View file @
dba43eab
...
...
@@ -2,7 +2,7 @@ import java.io.File;
import
java.io.FileOutputStream
;
import
java.io.OutputStream
;
import
se.lth.control.labcomm.
LabComm
EncoderChannel
;
import
se.lth.control.labcomm.EncoderChannel
;
/**
* Simple encoder
...
...
@@ -10,12 +10,12 @@ import se.lth.control.labcomm.LabCommEncoderChannel;
public
class
Encoder
{
LabComm
EncoderChannel
encoder
;
EncoderChannel
encoder
;
public
Encoder
(
OutputStream
out
)
throws
Exception
{
encoder
=
new
LabComm
EncoderChannel
(
out
);
encoder
=
new
EncoderChannel
(
out
);
theTwoInts
.
register
(
encoder
);
IntString
.
register
(
encoder
);
TwoArrays
.
register
(
encoder
);
...
...
examples/simple/Encoder06.java
View file @
dba43eab
...
...
@@ -2,7 +2,7 @@ import java.io.File;
import
java.io.FileOutputStream
;
import
java.io.OutputStream
;
import
se.lth.control.labcomm2006.
LabComm
EncoderChannel
;
import
se.lth.control.labcomm2006.EncoderChannel
;
/**
* Simple encoder
...
...
@@ -10,12 +10,12 @@ import se.lth.control.labcomm2006.LabCommEncoderChannel;
public
class
Encoder06
{
LabComm
EncoderChannel
encoder
;
EncoderChannel
encoder
;
public
Encoder06
(
OutputStream
out
)
throws
Exception
{
encoder
=
new
LabComm
EncoderChannel
(
out
);
encoder
=
new
EncoderChannel
(
out
);
theTwoInts
.
register
(
encoder
);
IntString
.
register
(
encoder
);
TwoArrays
.
register
(
encoder
);
...
...
examples/tcp/labcommTCPtest/client/TestClient.java
View file @
dba43eab
...
...
@@ -6,8 +6,8 @@ import java.io.OutputStream;
import
java.net.Socket
;
import
java.net.UnknownHostException
;
import
se.lth.control.labcomm.
LabComm
DecoderChannel
;
import
se.lth.control.labcomm.
LabComm
EncoderChannel
;
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
{
LabComm
EncoderChannel
e
=
new
LabComm
EncoderChannel
(
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
);
LabComm
DecoderChannel
c
=
new
LabComm
DecoderChannel
(
in
);
DecoderChannel
c
=
new
DecoderChannel
(
in
);
FooSample
.
register
(
c
,
this
);
c
.
runOne
();
}
catch
(
Exception
e
)
{
...
...
examples/tcp/labcommTCPtest/client/TestClientSingleshot.java
View file @
dba43eab
...
...
@@ -6,8 +6,8 @@ import java.io.OutputStream;
import
java.net.Socket
;
import
java.net.UnknownHostException
;
import
se.lth.control.labcomm.
LabComm
DecoderChannel
;
import
se.lth.control.labcomm.
LabComm
EncoderChannel
;
import
se.lth.control.labcomm.DecoderChannel
;
import
se.lth.control.labcomm.EncoderChannel
;
import
labcommTCPtest.gen.FooSample
;
import
labcommTCPtest.gen.FooSample.Handler
;