public void Interpret(FileInfo file, MathSystem system) { if(file == null) throw new ArgumentNullException("file"); Interpret(file.OpenText(), system); }
public Bridge(MathSystem system, Document document) { _system = system; _document = document; _signals = new Dictionary<Guid, SignalShape>(); _buses = new Dictionary<Guid, BusShape>(); _ports = new Dictionary<Guid, PortShape>(); }
public void Interpret(TextReader reader, MathSystem system) { if(scanner == null) scanner = new ParserScanner(reader, system); else scanner.Reset(reader, system); scanner.AllStatements(); }
public static MathSystem ReadXml(FileInfo file, Context context) { XmlReader reader = XmlReader.Create(file.OpenText()); MathSystem sys = ReadXml(reader, context); reader.Close(); return(sys); }
public void ImportSystem(MathSystem system) { if (!system.HasSystemMediator) { system.SystemMediator = Binder.GetInstance <ISystemMediator>(); } _namedSystems.Add(system.InstanceId, system); }
public void ImportSystem(MathSystem system) { if (!system.HasMediator) { system.Mediator = new Mediator(); } _namedSystems.Add(system.InstanceId, system); }
public MathSystem AddSystem() { MathSystem system = new MathSystem(_context); system.Mediator = new Mediator(); _namedSystems.Add(system.InstanceId, system); return(system); }
private Bridge CreateBridge(MathSystem system) { Document doc = new Document(); Bridge bridge = new Bridge(system, doc); _mathBridges.Add(system.InstanceId, bridge); _netronBridges.Add(doc, bridge); return bridge; }
public MathSystem AddSystem() { MathSystem system = new MathSystem(); Binder.GetInstance <ISystemMediator, IMathSystem>(system); //system.SystemMediator = Binder.GetInstance<ISystemMediator>(); _namedSystems.Add(system.InstanceId, system); return(system); }
public ParserScanner(TextReader reader, MathSystem system) { if(system == null) throw new ArgumentNullException("system"); if(reader == null) throw new ArgumentNullException("reader"); tokenizer = new ParserMarker(reader, system.Context); this.system = system; this.context = system.Context; }
/// <summary>Clear the buffer. Replace the current stream with a new one.</summary> public void Reset(TextReader reader, MathSystem system) { if(system == null) throw new ArgumentNullException("system"); if(reader == null) throw new ArgumentNullException("reader"); this.system = system; this.context = system.Context; tokenizer.Reset(reader, context); }
public Project() { Service <IPackageLoader> .Instance.LoadDefaultPackages(); _namedSystems = new Dictionary <Guid, MathSystem>(); _localObservers = new List <ISystemObserver>(); _parser = Service <IParser> .Instance; _mediator = Service <IMediator> .Instance; MathSystem sys = AddSystem(); LoadSystem(sys.InstanceId); }
public Project(Context context) { _context = context; _context.Library.LoadPackageManager(new MathNet.Symbolics.StdPackage.StdPackageManager(context)); _namedSystems = new Dictionary <Guid, MathSystem>(); _localObservers = new List <ISystemObserver>(); _parser = new Parser(); MathSystem sys = AddSystem(); LoadSystem(sys.InstanceId); }
public CompoundArchitecture(MathIdentifier id, MathIdentifier entityId, Port port, MathSystem system) : base(id, entityId, false) { this.inputSignals = port.InputSignals; this.outputSignals = port.OutputSignals; this.system = system; this.system.OutputValueChanged += system_OutputValueChanged; SetPort(port); for(int i = 0; i < inputSignals.Count; i++) inputSignals[i].SignalValueChanged += CompoundArchitecture_SignalValueChanged; system.PushInputValueRange(inputSignals); }
private void UnloadSystem() { if (_currentSystem == null) { return; } foreach (ISystemObserver observer in _localObservers) { _currentSystem.Mediator.DetachObserver(observer); } _currentSystem = null; }
public MathSystem BuildSystem() { if (!HasSystem) { Entity localEntity = entity; if (entity.IsGeneric) { localEntity = entity.CompileGenericEntity(1, 0); } Signal[] inputs = new Signal[localEntity.InputSignals.Length]; ReadOnlySignalSet outputs = context.Builder.Functions(localEntity, inputs); system = new MathSystem(context); system.AddSignalTreeRange(outputs, true, true); } return(system); }
public MathSystem BuildSystem() { if (!HasSystem) { IEntity localEntity = entity; if (entity.IsGeneric) { localEntity = entity.CompileGenericEntity(1, 0, null); } Signal[] inputs = new Signal[localEntity.InputSignals.Length]; ReadOnlySignalSet outputs = Service <IBuilder> .Instance.Functions(localEntity, inputs); system = new MathSystem(); system.AddSignalTreeRange(outputs, true, true); } return(system); }
private void LoadSystem(MathSystem system) { _currentSystem = system; if (!system.HasMediator) { system.Mediator = new Mediator(); } foreach (ISystemObserver observer in _localObservers) { system.Mediator.AttachObserver(observer); } if (SystemLoaded != null) { SystemLoaded(this, EventArgs.Empty); } }
private void LoadSystem(MathSystem system) { _currentSystem = system; if (!system.HasSystemMediator) { system.SystemMediator = Binder.GetInstance <ISystemMediator>(); } foreach (ISystemObserver observer in _localObservers) { system.SystemMediator.AttachObserver(observer); } if (SystemLoaded != null) { SystemLoaded(this, EventArgs.Empty); } }
/// <param name="inputSignalIndexes">note: negative indexes are interpreted as internal signal indexes, incremented by one (thus -1 means the internal signal with index zero)!</param> /// <param name="outputSignalIndexes">note: negative indexes are interpreted as internal signal indexes, incremented by one (thus -1 means the internal signal with index zero)!</param> public CompoundProcess(MathSystem system, int[] inputSignalIndexes, int[] outputSignalIndexes, int[] busIndexes) { this.system = system; this.inputSignalIndexes = inputSignalIndexes; this.outputSignalIndexes = outputSignalIndexes; this.busIndexes = busIndexes; if(inputSignalIndexes.Length != system.InputCount) throw new ArgumentException("The count of input signal mappings doesn't match the compound process structure.", "inputSignalIndexes"); if(outputSignalIndexes.Length != system.OutputCount) throw new ArgumentException("The count of output signal mappings doesn't match the compound process structure.", "outputSignalIndexes"); if(busIndexes.Length != system.BusCount) throw new ArgumentException("The count of bus mappings doesn't match the compound process structure.", "busIndexes"); this.inputSignals = new Signal[inputSignalIndexes.Length]; this.outputSignals = new Signal[outputSignalIndexes.Length]; this.buses = new Bus[busIndexes.Length]; this.system.OutputValueChanged += system_OutputValueChanged; }
private void LoadSystem(MathSystem system) { _currentSystem = system; if(!system.HasMediator) system.Mediator = new Mediator(); foreach(ISystemObserver observer in _localObservers) system.Mediator.AttachObserver(observer); if(SystemLoaded != null) SystemLoaded(this, EventArgs.Empty); }
public void ImportSystem(MathSystem system) { if(!system.HasMediator) system.Mediator = new Mediator(); _namedSystems.Add(system.InstanceId, system); }
public MathSystem AddSystem() { MathSystem system = new MathSystem(_context); system.Mediator = new Mediator(); _namedSystems.Add(system.InstanceId, system); return system; }
protected abstract void UnloadSystem(MathSystem system);
public MathSystem BuildSystem() { if(!HasSystem) { IEntity localEntity = entity; if(entity.IsGeneric) localEntity = entity.CompileGenericEntity(1,0,null); Signal[] inputs = new Signal[localEntity.InputSignals.Length]; ReadOnlySignalSet outputs = Service<IBuilder>.Instance.Functions(localEntity, inputs); system = new MathSystem(); system.AddSignalTreeRange(outputs, true, true); } return system; }
public void AttachedToSystem(MathSystem system) { LoadSystem(system); }
public MathFunction(MathSystem system) { this.system = system; }
protected override void UnloadSystem(MathSystem system) { }
public MathFunction(Context context, Entity entity, MathSystem system) { this.context = context; this.entity = entity; this.system = system; }
public CompoundArchitectureFactory(MathIdentifier architectureId, MathIdentifier entityId, MathSystem system) { _architectureId = architectureId; _entityId = entityId; _inputCnt = system.InputCount; _outputCnt = system.OutputCount; _busCnt = system.BusCount; _xml = system.WriteXml(false); }
public MathFunction(Context context, MathSystem system) { this.context = context; this.system = system; }
public MathFunction(Context context, Signal outputSignal, params Signal[] inputSignals) { this.context = context; this.system = new MathSystem(context); system.AddSignalTree(outputSignal, inputSignals, true, true); }
public ParserScanner(TextReader reader, MathSystem system) { tokenizer = new ParserMarker(reader, system.Context); this.system = system; this.context = system.Context; }
public CompoundArchitectureFactory(MathIdentifier architectureId, MathIdentifier entityId, MathSystem system) { if(system == null) throw new ArgumentNullException("system"); _architectureId = architectureId; _entityId = entityId; _inputCnt = system.InputCount; _outputCnt = system.OutputCount; _busCnt = system.BusCount; _xml = system.WriteXml(false); }
private void UnloadSystem() { if(_currentSystem == null) return; foreach(ISystemObserver observer in _localObservers) _currentSystem.Mediator.DetachObserver(observer); _currentSystem = null; }
public void Interpret(string expression, MathSystem system) { Interpret(new StringReader(expression), system); }
public void DetachedFromSystem(MathSystem system) { UnloadSystem(system); }
protected override void LoadSystem(MathSystem system) { Bridge bridge; if(!_mathBridges.ContainsKey(system.InstanceId)) bridge = CreateBridge(system); else bridge = _mathBridges[system.InstanceId]; _presentation.AttachToDocument(bridge.Document); _bridge = bridge; }
public MathFunction(IEntity entity, MathSystem system) { this.entity = entity; this.system = system; }
public void AttachedToSystem(MathSystem system) { _currentSysId = system.InstanceId; _writer.WriteEntry(DateTime.Now, _currentSysId, LogAction.SystemChanged, _emptyGuid, _emptyGuid, _emptyGuid, _emptyId, -1); }
public MathFunction(Signal outputSignal, params Signal[] inputSignals) { this.system = new MathSystem(); system.AddSignalTree(outputSignal, inputSignals, true, true); }
public void DetachedFromSystem(MathSystem system) { }
public void ReadSystem(MathSystem system) { system.AcceptSystemBuilder(_builder); }
private void ScanDefineArchitecture() { tokenizer.Match(TokenTypes.TextIdentifier, "architecture"); MathIdentifier architectureId = ScanEntityMathIdentifierOrLabel(true); MathIdentifier entityId = ScanEntityMathIdentifierOrLabel(true); Entity entity = context.Library.LookupEntity(entityId); tokenizer.Match("{"); MathSystem originalSystem = system; MathSystem tempSystem = new MathSystem(system.Context); system = tempSystem; while(tokenizer.LookaheadFistToken.Text != "}") NextStatement(); foreach(string input in entity.InputSignals) tempSystem.PromoteAsInput(tempSystem.LookupNamedSignal(input)); foreach(string output in entity.OutputSignals) tempSystem.AddSignalTree(tempSystem.LookupNamedSignal(output), tempSystem.GetAllInputs(), true, false); ReadOnlyCollection<Signal> leafs = tempSystem.GetAllLeafSignals(); foreach(Signal s in leafs) { Signal so; if(originalSystem.TryLookupNamedSignal(s.Label, out so) && so.Value != null) s.PostNewValue(so.Value); } context.Scheduler.SimulateInstant(); system = originalSystem; tokenizer.Match("}"); tempSystem.RemoveUnusedObjects(); tempSystem.PublishToLibrary(architectureId, entity.EntityId); }
/// <summary>Clear the buffer. Replace the current stream with a new one.</summary> public void Reset(TextReader reader, MathSystem system) { this.system = system; this.context = system.Context; tokenizer.Reset(reader, context); }