Message.java
package edu.udel.cis.vsl.tass.dynamic.impl.value;
import edu.udel.cis.vsl.tass.dynamic.IF.value.MessageIF;
import edu.udel.cis.vsl.tass.dynamic.IF.value.ValueIF;
import edu.udel.cis.vsl.tass.model.IF.ProcessIF;
import edu.udel.cis.vsl.tass.morph.MorphicObject;
import edu.udel.cis.vsl.tass.morph.Morphic;
public class Message extends MorphicObject implements MessageIF {
private static int classHashCode = Message.class.hashCode();
private ValueIF data;
private ProcessIF destination;
private ProcessIF source;
private ValueIF tag;
public Message(ValueIF data, ProcessIF source, ProcessIF destination,
ValueIF tag) {
assert data != null;
assert source != null;
assert destination != null;
assert tag != null;
this.data = data;
this.source = source;
this.destination = destination;
this.tag = tag;
}
@Override
protected int computeHashCode() {
return classHashCode + data.hashCode() + destination.hashCode()
+ source.hashCode() + tag.hashCode();
}
@Override
protected boolean computeEquals(Morphic component) {
if (component instanceof Message) {
Message that = (Message) component;
return data.equals(that.data) && source.equals(that.source)
&& destination.equals(that.destination)
&& tag.equals(that.tag);
}
return false;
}
public ValueIF data() {
return data;
}
public ProcessIF destination() {
return destination;
}
public ProcessIF source() {
return source;
}
public ValueIF tag() {
return tag;
}
@Override
protected void commitChildren() {
data.commit();
tag.commit();
}
void canonicalizeChildren(MessageFactory messageFactory,
ValueFactory valueFactory) {
data = valueFactory.canonic(data);
tag = valueFactory.canonic(tag);
}
}