public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); info.AddValue("entityId", _entityId.ToString()); info.AddValue("inputCount", _inputCnt); info.AddValue("busCount", _busCnt); }
/*internal Signal AutomaticSimplifyOutput(Signal signal) * { * for(int i = 0; i < port.OutputSignalCount; i++) * { * if(port[i] == signal) * return AutomaticSimplifyOutput(i); * } * return signal; * } * * protected virtual Signal AutomaticSimplifyOutput(int outputIndex) * { * return port[outputIndex]; * }*/ public override string ToString() { if (_port == null) { return(_id.ToString()); } else { return(_port.Entity.ToString() + "(" + _id.ToString() + ")"); } }
public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("Routing "); sb.AppendLine(structureId.ToString()); sb.Append("Lossless Neighbours:"); foreach (MathIdentifier id in losslessNeighbors.Keys) { sb.Append(' '); sb.Append(id.ToString()); } sb.AppendLine(); sb.Append("Lossy Neighbours:"); foreach (MathIdentifier id in lossyNeighbors.Keys) { sb.Append(' '); sb.Append(id.ToString()); } sb.AppendLine(); sb.Append("From:"); foreach (KeyValuePair <MathIdentifier, IRouteDistance> item in vector) { sb.Append(' '); sb.Append(item.Key.ToString()); sb.Append(':'); sb.Append(item.Value.Cost); sb.Append(':'); sb.Append(item.Value.Lossless); sb.Append(':'); sb.Append(item.Value.NextHop.TypeIdentifier.ToString()); } sb.AppendLine(); sb.Append("To:"); foreach (MathIdentifier id in targetNeighbors.Keys) { sb.Append(' '); sb.Append(id.ToString()); } sb.AppendLine(); return(sb.ToString()); }
public Guid BuildPort(MathIdentifier entityId, InstanceIdSet inputSignals, InstanceIdSet outputSignals, InstanceIdSet buses) { _fsm.AdvanceTo(BuilderState.Ports); Guid guid = Guid.NewGuid(); _writer.WriteStartElement("Port", Config.YttriumNamespace); _writer.WriteAttributeString("iid", guid.ToString()); _writer.WriteAttributeString("entityId", entityId.ToString()); _writer.WriteStartElement("InputSignals", Config.YttriumNamespace); foreach (Guid id in inputSignals) { _writer.WriteElementString("SignalRef", Config.YttriumNamespace, id.ToString()); } _writer.WriteEndElement(); _writer.WriteStartElement("OutputSignals", Config.YttriumNamespace); foreach (Guid id in outputSignals) { _writer.WriteElementString("SignalRef", Config.YttriumNamespace, id.ToString()); } _writer.WriteEndElement(); _writer.WriteStartElement("Buses", Config.YttriumNamespace); foreach (Guid id in buses) { _writer.WriteElementString("BusRef", Config.YttriumNamespace, id.ToString()); } _writer.WriteEndElement(); _writer.WriteEndElement(); return(guid); }
public Converter <object, object> BuildConverterFrom(MathIdentifier id) { if (structureId.Equals(id)) { return delegate(object value) { return value; } } ; IRouteDistance cd; if (vector.TryGetValue(id, out cd)) { return(cd.Convert); } throw new NotSupportedException("no route available to convert from " + id.ToString()); //throw new MathNet.Symbolics.Backend.Exceptions.IncompatibleStructureException(id.Label, id.Domain); }
public object ConvertFrom(object value) { MathIdentifier id = Service <ILibrary> .Instance.LookupArbitraryType(value.GetType()); if (structureId.Equals(id)) { return(value); } IRouteDistance cd; if (vector.TryGetValue(id, out cd)) { return(cd.Convert(value)); } throw new NotSupportedException("no route available to convert from " + id.ToString()); //throw new MathNet.Symbolics.Backend.Exceptions.IncompatibleStructureException(id.Label, id.Domain); }
public object ConvertFrom(ICustomData value) { MathIdentifier id = value.TypeId; if (structureId.Equals(id)) { return(value); } IRouteDistance cd; if (vector.TryGetValue(id, out cd)) { return(cd.Convert(value)); } throw new NotSupportedException("no route available to convert from " + id.ToString()); //throw new MathNet.Symbolics.Backend.Exceptions.IncompatibleStructureException(id.Label, id.Domain); }
public Guid BuildPort(MathIdentifier entityId, InstanceIdSet inputSignals, InstanceIdSet outputSignals, InstanceIdSet buses) { Guid guid = Guid.NewGuid(); _current.AppendFormat("instanciate {0}", entityId.ToString()); if (inputSignals.Count > 0) { _current.Append(" in "); for (int i = 0; i < inputSignals.Count; i++) { if (i > 0) { _current.Append(','); } _current.Append(_signalMappings[inputSignals[i]]); } } if (outputSignals.Count > 0) { _current.Append(" out "); for (int i = 0; i < outputSignals.Count; i++) { if (i > 0) { _current.Append(','); } _current.Append(_signalMappings[outputSignals[i]]); } } if (buses.Count > 0) { _current.Append(" bus "); for (int i = 0; i < buses.Count; i++) { if (i > 0) { _current.Append(','); } _current.Append(_busMappings[buses[i]]); } } _current.AppendLine(";"); return(guid); }
private object LookupFactory(MathIdentifier id) { object factory; if (!_factoryById.TryGetValue(id, out factory)) { throw new MicrokernelException( string.Format(Config.UserCulture, Resources.BindingUnknownId, id.ToString())); } return(factory); }
public Converter<object, object> BuildConverterFrom(MathIdentifier id) { if(structureId.Equals(id)) return delegate(object value) { return value; }; IRouteDistance cd; if(vector.TryGetValue(id, out cd)) return cd.Convert; throw new NotSupportedException("no route available to convert from " + id.ToString()); //throw new MathNet.Symbolics.Backend.Exceptions.IncompatibleStructureException(id.Label, id.Domain); }
public Guid BuildPort(MathIdentifier entityId, InstanceIdSet inputSignals, InstanceIdSet outputSignals, InstanceIdSet buses) { _fsm.AdvanceTo(BuilderState.Ports); Guid guid = Guid.NewGuid(); _writer.WriteStartElement("Port", Config.YttriumNamespace); _writer.WriteAttributeString("iid", guid.ToString()); _writer.WriteAttributeString("entityId", entityId.ToString()); _writer.WriteStartElement("InputSignals", Config.YttriumNamespace); foreach(Guid id in inputSignals) _writer.WriteElementString("SignalRef", Config.YttriumNamespace, id.ToString()); _writer.WriteEndElement(); _writer.WriteStartElement("OutputSignals", Config.YttriumNamespace); foreach(Guid id in outputSignals) _writer.WriteElementString("SignalRef", Config.YttriumNamespace, id.ToString()); _writer.WriteEndElement(); _writer.WriteStartElement("Buses", Config.YttriumNamespace); foreach(Guid id in buses) _writer.WriteElementString("BusRef", Config.YttriumNamespace, id.ToString()); _writer.WriteEndElement(); _writer.WriteEndElement(); return guid; }
public Guid BuildPort(MathIdentifier entityId, InstanceIdSet inputSignals, InstanceIdSet outputSignals, InstanceIdSet buses) { Guid guid = Guid.NewGuid(); _current.AppendFormat("instanciate {0}", entityId.ToString()); if(inputSignals.Count > 0) { _current.Append(" in "); for(int i = 0; i < inputSignals.Count; i++) { if(i > 0) _current.Append(','); _current.Append(_signalMappings[inputSignals[i]]); } } if(outputSignals.Count > 0) { _current.Append(" out "); for(int i = 0; i < outputSignals.Count; i++) { if(i > 0) _current.Append(','); _current.Append(_signalMappings[outputSignals[i]]); } } if(buses.Count > 0) { _current.Append(" bus "); for(int i = 0; i < buses.Count; i++) { if(i > 0) _current.Append(','); _current.Append(_busMappings[buses[i]]); } } _current.AppendLine(";"); return guid; }