コード例 #1
0
 protected override CommandReference Action()
 {
     int idx = System.BusCount;
     Bus b = new Bus(System.Context);
     Guid iid = b.InstanceId;
     System.AddBus(b);
     return new CommandReference(iid, idx);
 }
コード例 #2
0
 void IObserver.OnBusValueChanged(Bus bus)
 {
 }
コード例 #3
0
 private bool DummyBusPredicate(Bus bus)
 {
     return true;
 }
コード例 #4
0
 public bool VisitLeaf(Bus bus, bool again)
 {
     return _leafBus(bus, again);
 }
コード例 #5
0
 public void OnBusAttachedToPortNoLonger(Bus bus, Port port, int busIndex)
 {
     _writer.WriteEntry(DateTime.Now, _currentSysId, LogAction.BusDetachedFromPort, port.InstanceId, _emptyGuid, bus.InstanceId, port.Entity.EntityId.ToString(), busIndex);
 }
コード例 #6
0
 public void OnBusRemoved(Bus bus, int index)
 {
     _writer.WriteEntry(DateTime.Now, _currentSysId, LogAction.BusRemoved, _emptyGuid, _emptyGuid, bus.InstanceId, _emptyId, index);
 }
コード例 #7
0
 protected abstract void Action(Port port, Bus bus, int index);
コード例 #8
0
 public override void OnBusRemoved(Bus bus, int index)
 {
     if(!_bridge.Buses.ContainsKey(bus.InstanceId))
         return;
     BusShape shape = _bridge.Buses[bus.InstanceId];
     _bridge.Buses.Remove(bus.InstanceId);
     _bridge.Model.RemoveShape(shape);
     _presentation.Invalidate();
 }
コード例 #9
0
 public BusPortIndexEventArgs(Bus bus, Port port, int index)
 {
     this.bus = bus;
     this.port = port;
     this.index = index;
 }
コード例 #10
0
ファイル: Mediator.cs プロジェクト: xuchuansheng/GenXSource
 internal void OnBusMoved(Bus bus, int indexBefore, int indexAfter)
 {
     foreach(ISystemObserver observer in _observers)
         observer.OnBusMoved(bus, indexBefore, indexAfter);
 }
コード例 #11
0
ファイル: Mediator.cs プロジェクト: xuchuansheng/GenXSource
 internal void OnBusAttachedToPortNoLonger(Bus bus, Port port, int busIndex)
 {
     foreach(ISystemObserver observer in _observers)
         observer.OnBusAttachedToPortNoLonger(bus, port, busIndex);
 }
コード例 #12
0
ファイル: Mediator.cs プロジェクト: xuchuansheng/GenXSource
 internal void OnBusRemoved(Bus bus, int index)
 {
     foreach(ISystemObserver observer in _observers)
         observer.OnBusRemoved(bus, index);
 }
コード例 #13
0
 protected override void Action(Port port, Bus bus, int index)
 {
     port.AddBusBinding(index, bus);
 }
コード例 #14
0
 void IObserver.OnNewBusCreated(Bus bus)
 {
     _currentSystem.AddBus(bus);
 }
コード例 #15
0
 protected abstract void Action(Port port, Bus bus);
コード例 #16
0
ファイル: Context.cs プロジェクト: xuchuansheng/GenXSource
 internal void NotifyNewBusConstructed(Bus bus)
 {
     EventHandler<BusEventArgs> handler = OnNewBusConstructed;
     if(handler != null)
         handler(this, new BusEventArgs(bus));
 }
コード例 #17
0
 public override void OnBusAdded(Bus bus, int index)
 {
     if(_bridge.Buses.ContainsKey(bus.InstanceId))
         return;
     BusShape shape = new BusShape(new CommandReference(bus.InstanceId, index));
     shape.Bus = bus;
     shape.Location = CreateRandomLocation();
     _bridge.Buses.Add(bus.InstanceId, shape);
     _bridge.Model.AddShape(shape);
     _presentation.Invalidate();
 }
コード例 #18
0
ファイル: Context.cs プロジェクト: xuchuansheng/GenXSource
 internal void NotifyBusNoLongerAttachedToPort(Bus bus, Port port, int busIndex)
 {
     EventHandler<BusPortIndexEventArgs> handler = OnBusNoLongerAttachedToPort;
     if(handler != null)
         handler(this, new BusPortIndexEventArgs(bus, port, busIndex));
 }
コード例 #19
0
 public override void OnBusMoved(Bus bus, int indexBefore, int indexAfter)
 {
     _bridge.Buses[bus.InstanceId].BusReference = new CommandReference(bus.InstanceId, indexAfter);
 }
コード例 #20
0
 public virtual void OnBusAttachedToPortNoLonger(Bus bus, Port port, int busIndex)
 {
 }
コード例 #21
0
 public virtual bool VisitLeaf(Bus bus, bool again)
 {
     return true;
 }
コード例 #22
0
 public virtual void OnBusAdded(Bus bus, int index)
 {
 }
コード例 #23
0
 public void OnBusMoved(Bus bus, int indexBefore, int indexAfter)
 {
 }
コード例 #24
0
 public virtual void OnBusRemoved(Bus bus, int index)
 {
 }
コード例 #25
0
 protected abstract void Action(Bus bus);
コード例 #26
0
 public BusEventArgs(Bus bus)
 {
     this.bus = bus;
 }
コード例 #27
0
 public override bool VisitLeaf(Bus bus, bool again)
 {
     if(!again && _busMatch(bus))
         _buses.Add(bus);
     return true;
 }
コード例 #28
0
 protected override void Action(Bus bus)
 {
     System.RemoveBus(bus);
 }
コード例 #29
0
 private Port ScanInstantiate()
 {
     tokenizer.Match(TokenTypes.InstantiateKeyword, "instantiate");
     Entity entity = ScanEntity();
     Signal[] inputs; //= new Signal[entity.InputSignals.Length];
     Signal[] outputs; // = new Signal[entity.OutputSignals.Length];
     Bus[] buses; // = new Bus[entity.Buses.Length];
     if(tokenizer.LookaheadFistToken.Text == "in")
     {
         tokenizer.Match(TokenTypes.TextIdentifier, "in");
         if(tokenizer.LookaheadToken(1).IsType(TokenTypes.Association))
         {
             List<SignalAssociation> associations = ScanSignalExpressionAssociationList();
             inputs = new Signal[entity.InputSignals.Length];
             foreach(SignalAssociation sa in associations)
                 inputs[Array.IndexOf<string>(entity.InputSignals, sa.Label)] = sa.Association;
         }
         else
         {
             List<Signal> associations = ScanSignalExpressionList();
             inputs = associations.ToArray();
         }
     }
     else
         inputs = new Signal[entity.InputSignals.Length];
     if(tokenizer.LookaheadFistToken.Text == "out")
     {
         tokenizer.Match(TokenTypes.TextIdentifier, "out");
         if(tokenizer.LookaheadToken(1).IsType(TokenTypes.Association))
         {
             List<SignalAssociation> associations = ScanSignalAssociationList();
             outputs = new Signal[entity.OutputSignals.Length];
             foreach(SignalAssociation sa in associations)
                 outputs[Array.IndexOf<string>(entity.OutputSignals, sa.Label)] = sa.Association;
         }
         else
         {
             List<Signal> associations = ScanSignalList();
             outputs = associations.ToArray();
         }
     }
     else
         outputs = new Signal[entity.OutputSignals.Length];
     if(tokenizer.LookaheadFistToken.Text == "bus")
     {
         tokenizer.Match(TokenTypes.TextIdentifier, "bus");
         if(tokenizer.LookaheadToken(1).IsType(TokenTypes.Association))
         {
             List<BusAssociation> associations = ScanBusAssociationList();
             buses = new Bus[entity.Buses.Length];
             foreach(BusAssociation ba in associations)
                 buses[Array.IndexOf<string>(entity.Buses, ba.Label)] = ba.Association;
         }
         else
         {
             List<Bus> associations = ScanBusList();
             buses = associations.ToArray();
         }
     }
     else
         buses = new Bus[entity.Buses.Length];
     Port port = entity.InstantiatePort(context, inputs, outputs, buses);
     system.AddPortTree(port, false, false);
     return port;
 }
コード例 #30
0
 void IObserver.OnBusDetachedFromPort(Bus bus, Port port, int busIndex)
 {
 }