Commit 99430c1c authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Removing unneccessary method

parent 39e9af9d
......@@ -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() + "\";");
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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() +
......
......@@ -16,10 +16,6 @@ namespace se.lth.control.labcomm2014 {
this.name = name;
}
public SampleDispatcher getSampleIdentity() {
return this;
}
public String getName() {
return name;
}
......
......@@ -4,8 +4,6 @@ namespace se.lth.control.labcomm2014 {
public interface SampleDispatcher {
SampleDispatcher getSampleIdentity();
String getName();
byte[] getSignature();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment