1 package run; 2 public class InternalNode extends Node implements uka.patch.Patchable, uka.transport.Transportable { createPatch(Object _copy, uka.patch.PatchOutput po)3 public void createPatch(Object _copy, uka.patch.PatchOutput po) throws java.io.IOException { 4 InternalNode copy = (InternalNode)_copy; 5 super.createPatch(copy, po); 6 copy.master = this.master = (run.Element)po.writeDiff(this.master, copy.master); 7 } applyPatch(Object _copy, uka.patch.PatchInput pi)8 public void applyPatch(Object _copy, uka.patch.PatchInput pi) throws java.io.IOException, ClassNotFoundException { 9 InternalNode copy = (InternalNode)_copy; 10 super.applyPatch(copy, pi); 11 if (pi.hasDiff()) copy.master = this.master = (run.Element)pi.getDiffAsObject(); 12 } descendReferences(uka.patch.ReferenceConsumer c)13 public void descendReferences(uka.patch.ReferenceConsumer c) throws java.io.IOException { 14 super.descendReferences(c); 15 c.descend(this.master); 16 } filterReferences(uka.patch.ReferenceFilter f)17 public void filterReferences(uka.patch.ReferenceFilter f) { 18 super.filterReferences(f); 19 this.master = (run.Element)f.filter(this.master); 20 } 21 public static final uka.transport.TransportDescriptor TRANSPORT_DESCRIPTOR = new uka.transport.TransportDescriptor(){ 22 public Object unmarshalReference(uka.transport.UnmarshalStream s, int id) throws java.io.IOException, ClassNotFoundException { 23 return new InternalNode(s, id); 24 } 25 public boolean unmarshal(Object obj, uka.transport.UnmarshalStream s) throws ClassNotFoundException, java.io.IOException { 26 ((InternalNode)obj).unmarshal(s); 27 return false; 28 } 29 public void marshalReference(Object obj, uka.transport.MarshalStream s) throws java.io.IOException { 30 ((InternalNode)obj).marshalReference(s); 31 } 32 public void marshal(Object obj, uka.transport.MarshalStream s) throws java.io.IOException { 33 ((InternalNode)obj).marshal(s); 34 } 35 public Object deepClone(Object orig, int id, uka.transport.DeepClone _helper) throws CloneNotSupportedException { 36 try { 37 return new InternalNode((InternalNode)orig, id, _helper); 38 } catch (java.io.IOException ex) { 39 throw (CloneNotSupportedException)new CloneNotSupportedException().initCause(ex); 40 } 41 } 42 public boolean deepCloneReferences(Object orig, Object copy, uka.transport.DeepClone _helper) throws CloneNotSupportedException { 43 ((InternalNode)copy).deepCloneReferences((InternalNode)orig, _helper); 44 return false; 45 } 46 public Class getType() { 47 return InternalNode.class; 48 } 49 }; getTransportDescriptor()50 public uka.transport.TransportDescriptor getTransportDescriptor() { 51 return TRANSPORT_DESCRIPTOR; 52 } InternalNode(uka.transport.UnmarshalStream _stream, int _id)53 public InternalNode(uka.transport.UnmarshalStream _stream, int _id) throws java.io.IOException, ClassNotFoundException { 54 super(_stream, _id); 55 } unmarshal(uka.transport.UnmarshalStream _stream)56 public void unmarshal(uka.transport.UnmarshalStream _stream) throws java.io.IOException, ClassNotFoundException { 57 super.unmarshal(_stream); 58 this.master = (run.Element)_stream.readReference(); 59 } marshal(uka.transport.MarshalStream _stream)60 public void marshal(uka.transport.MarshalStream _stream) throws java.io.IOException { 61 super.marshal(_stream); 62 _stream.writeReference(this.master); 63 } InternalNode(InternalNode _orig, int _id, uka.transport.DeepClone _helper)64 public InternalNode(InternalNode _orig, int _id, uka.transport.DeepClone _helper) throws CloneNotSupportedException, java.io.IOException { 65 super(_orig, _id, _helper); 66 } deepCloneReferences(InternalNode _orig, uka.transport.DeepClone _helper)67 public void deepCloneReferences(InternalNode _orig, uka.transport.DeepClone _helper) throws CloneNotSupportedException { 68 super.deepCloneReferences(_orig, _helper); 69 this.master = (run.Element)_helper.internalDeepClone(_orig.master); 70 } 71 Element master; InternalNode()72 public InternalNode() { 73 super(); 74 this.type = run.Node.INTERNAL_NODE; 75 } calculateNewPosition(double timestep, double currtime)76 public void calculateNewPosition(double timestep, double currtime) { 77 this.master.setInternalNodePosition(); 78 } registerMasterElement(Element el)79 public void registerMasterElement(Element el) { 80 this.master = el; 81 } setInitialConditions()82 public void setInitialConditions() { 83 super.setInitialConditions(); 84 this.master.setInternalNodePosition(); 85 } 86 } 87