From 99430c1c2f51895af4395de194aa8921a223cc04 Mon Sep 17 00:00:00 2001 From: Anders Blomdell <anders.blomdell@control.lth.se> Date: Mon, 1 Jun 2015 09:18:46 +0200 Subject: [PATCH] Removing unneccessary method --- compiler/2014/CS_CodeGen.jrag | 6 ------ .../se/lth/control/labcomm2014/DecoderChannel.cs | 2 +- .../se/lth/control/labcomm2014/DecoderRegistry.cs | 10 +++++----- .../se/lth/control/labcomm2014/EncoderRegistry.cs | 10 +++++----- .../se/lth/control/labcomm2014/RenamingRegistry.cs | 4 ---- .../se/lth/control/labcomm2014/SampleDispatcher.cs | 2 -- 6 files changed, 11 insertions(+), 23 deletions(-) diff --git a/compiler/2014/CS_CodeGen.jrag b/compiler/2014/CS_CodeGen.jrag index 17fa08e..3181899 100644 --- a/compiler/2014/CS_CodeGen.jrag +++ b/compiler/2014/CS_CodeGen.jrag @@ -416,12 +416,6 @@ aspect CS_Class { env.println("private class Dispatcher : SampleDispatcher {"); env.indent(); env.println(); - env.println("public SampleDispatcher getSampleIdentity() {"); - env.indent(); - env.println("return dispatcher;"); - env.unindent(); - env.println("}"); - env.println(); env.println("public String getName() {"); env.indent(); env.println("return \"" + getName() + "\";"); diff --git a/lib/csharp/se/lth/control/labcomm2014/DecoderChannel.cs b/lib/csharp/se/lth/control/labcomm2014/DecoderChannel.cs index 4c02d83..95f2214 100644 --- a/lib/csharp/se/lth/control/labcomm2014/DecoderChannel.cs +++ b/lib/csharp/se/lth/control/labcomm2014/DecoderChannel.cs @@ -170,7 +170,7 @@ namespace se.lth.control.labcomm2014 { int index = (int)ReadInt(4); try { DecoderRegistry.Entry e = ref_registry.get(index); - return e.getSampleDispatcher().getSampleIdentity(); + return e.getSampleDispatcher(); } catch (NullReferenceException) { return null; } diff --git a/lib/csharp/se/lth/control/labcomm2014/DecoderRegistry.cs b/lib/csharp/se/lth/control/labcomm2014/DecoderRegistry.cs index 6c7a4a4..d9f9c58 100644 --- a/lib/csharp/se/lth/control/labcomm2014/DecoderRegistry.cs +++ b/lib/csharp/se/lth/control/labcomm2014/DecoderRegistry.cs @@ -90,11 +90,11 @@ namespace se.lth.control.labcomm2014 { } } - private Dictionary<SampleDispatcher, Entry> byIdentity; + private Dictionary<SampleDispatcher, Entry> byDispatcher; private Dictionary<int, Entry> byIndex; public DecoderRegistry() { - byIdentity = new Dictionary<SampleDispatcher, Entry>(); + byDispatcher = new Dictionary<SampleDispatcher, Entry>(); byIndex = new Dictionary<int, Entry>(); } @@ -102,7 +102,7 @@ namespace se.lth.control.labcomm2014 { SampleHandler handler) { lock(this) { Entry e; - byIdentity.TryGetValue(dispatcher.getSampleIdentity(), out e); + byDispatcher.TryGetValue(dispatcher, out e); if (e != null) { e.check(dispatcher.getName(), dispatcher.getSignature()); e.setHandler(handler); @@ -117,7 +117,7 @@ namespace se.lth.control.labcomm2014 { } if (e == null) { e = new Entry(dispatcher, handler); - byIdentity.Add(dispatcher.getSampleIdentity(), e); + byDispatcher.Add(dispatcher, e); } } } @@ -132,7 +132,7 @@ namespace se.lth.control.labcomm2014 { if (e != null) { e.check(name, signature); } else { - foreach (Entry e2 in byIdentity.Values) { + foreach (Entry e2 in byDispatcher.Values) { if (e2.match(name, signature)) { e2.setIndex(index); e = e2; diff --git a/lib/csharp/se/lth/control/labcomm2014/EncoderRegistry.cs b/lib/csharp/se/lth/control/labcomm2014/EncoderRegistry.cs index 72ec5f2..e8b5730 100644 --- a/lib/csharp/se/lth/control/labcomm2014/EncoderRegistry.cs +++ b/lib/csharp/se/lth/control/labcomm2014/EncoderRegistry.cs @@ -26,19 +26,19 @@ namespace se.lth.control.labcomm2014 { } private int userIndex = Constant.FIRST_USER_INDEX; - private Dictionary<SampleDispatcher, Entry> byIdentity; + private Dictionary<SampleDispatcher, Entry> byDispatcher; public EncoderRegistry() { - byIdentity = new Dictionary<SampleDispatcher, Entry>(); + byDispatcher = new Dictionary<SampleDispatcher, Entry>(); } public int add(SampleDispatcher dispatcher) { lock(this) { Entry e; - byIdentity.TryGetValue(dispatcher.getSampleIdentity(), out e); + byDispatcher.TryGetValue(dispatcher, out e); if (e == null) { e = new Entry(dispatcher, userIndex); - byIdentity.Add(dispatcher.getSampleIdentity(), e); + byDispatcher.Add(dispatcher, e); userIndex++; } return e.getIndex(); @@ -48,7 +48,7 @@ namespace se.lth.control.labcomm2014 { public int getTag(SampleDispatcher sample) { lock(this) { Entry e; - byIdentity.TryGetValue(sample, out e); + byDispatcher.TryGetValue(sample, out e); if (e == null) { throw new Exception("'" + sample.ToString() + diff --git a/lib/csharp/se/lth/control/labcomm2014/RenamingRegistry.cs b/lib/csharp/se/lth/control/labcomm2014/RenamingRegistry.cs index 654ef33..901e40a 100644 --- a/lib/csharp/se/lth/control/labcomm2014/RenamingRegistry.cs +++ b/lib/csharp/se/lth/control/labcomm2014/RenamingRegistry.cs @@ -16,10 +16,6 @@ namespace se.lth.control.labcomm2014 { this.name = name; } - public SampleDispatcher getSampleIdentity() { - return this; - } - public String getName() { return name; } diff --git a/lib/csharp/se/lth/control/labcomm2014/SampleDispatcher.cs b/lib/csharp/se/lth/control/labcomm2014/SampleDispatcher.cs index de405d1..1822c25 100644 --- a/lib/csharp/se/lth/control/labcomm2014/SampleDispatcher.cs +++ b/lib/csharp/se/lth/control/labcomm2014/SampleDispatcher.cs @@ -4,8 +4,6 @@ namespace se.lth.control.labcomm2014 { public interface SampleDispatcher { - SampleDispatcher getSampleIdentity(); - String getName(); byte[] getSignature(); -- GitLab