private string GetEventName(EventChannelInfo eventChannelInfo, CUDDNode currentStateDD) { string eventName = eventChannelInfo.name; int parameterLength = eventChannelInfo.numberOfParameters; for (int i = 0; i < parameterLength; i++) { int parameterValue = model.GetColVarValue(currentStateDD, model.eventParameterVariables[i]); eventName += "." + parameterValue; } return(eventName); }
/// <summary> /// Get the event name, channel name from the currentStateDD in the column form /// [ REFS: '', DEREFS: ''] /// </summary> /// <param name="lastValuation"></param> /// <param name="currentValuation"></param> /// <param name="currentStateDD"></param> /// <returns></returns> public string GetEventChannelName(Valuation lastValuation, Valuation currentValuation, CUDDNode currentStateDD) { int eventIndex = model.GetColVarValue(currentStateDD, Model.EVENT_NAME); EventChannelInfo eventChannelInfo = this.allEventIndex[eventIndex]; if (eventChannelInfo.type == EventChannelInfo.EventType.EVENT) { return(GetEventName(eventChannelInfo, currentStateDD)); } else { return(GetChannelName(eventChannelInfo, currentStateDD, lastValuation, currentValuation)); } }
/// <summary> /// Return the event Index based on eventName & parameter Length. If not exist, add new event to allEventIndex dictionary /// </summary> /// <param name="eventName"></param> /// <param name="parameterLength"></param> /// <returns></returns> public int GetEventIndex(string eventName, int parameterLength) { for (int i = 0; i < this.allEventIndex.Count; i++) { EventChannelInfo eventChannel = this.allEventIndex[i]; if (eventChannel.type == EventChannelInfo.EventType.EVENT && eventChannel.name == eventName && eventChannel.numberOfParameters == parameterLength) { return(i); } } this.allEventIndex.Add(new EventChannelInfo(eventName, parameterLength, EventChannelInfo.EventType.EVENT)); // return(this.allEventIndex.Count - 1); }
public int GetChannelIndex(string channelName, EventChannelInfo.EventType type) { for (int i = 0; i < this.allEventIndex.Count; i++) { EventChannelInfo eventChannel = this.allEventIndex[i]; if (eventChannel.type == type && eventChannel.name == channelName) { return(i); } } EventChannelInfo channel = new EventChannelInfo(channelName, 0, type); this.allEventIndex.Add(channel); // return(this.allEventIndex.Count - 1); }
private string GetChannelName(EventChannelInfo eventChannelInfo, CUDDNode currentStateDD, Valuation lastValuation, Valuation currentValuation) { string channelName = eventChannelInfo.name; if (eventChannelInfo.type == EventChannelInfo.EventType.ASYNC_CHANNEL_INPUT) { channelName += "?"; } else if (eventChannelInfo.type == EventChannelInfo.EventType.ASYNC_CHANNEL_OUTPUT) { channelName += "!"; } switch (eventChannelInfo.type) { case EventChannelInfo.EventType.ASYNC_CHANNEL_INPUT: ChannelQueue channelBuffer1 = lastValuation.Channels[eventChannelInfo.name]; foreach (ExpressionValue elementValue in channelBuffer1.Peek()) { int value = int.Parse(elementValue.ExpressionID); channelName += value + "."; } break; case EventChannelInfo.EventType.ASYNC_CHANNEL_OUTPUT: ChannelQueue channelBuffer2 = currentValuation.Channels[eventChannelInfo.name]; foreach (ExpressionValue elementValue in channelBuffer2.ToArray()[channelBuffer2.Size - 1]) { int value = int.Parse(elementValue.ExpressionID); channelName += value + "."; } break; } channelName = channelName.TrimEnd('.'); return(channelName); }
private string GetEventName(EventChannelInfo eventChannelInfo, CUDDNode currentStateDD) { string eventName = eventChannelInfo.name; int parameterLength = eventChannelInfo.numberOfParameters; for (int i = 0; i < parameterLength; i++) { int parameterValue = model.GetColVarValue(currentStateDD, model.eventParameterVariables[i]); eventName += "." + parameterValue; } return eventName; }
private string GetChannelName(EventChannelInfo eventChannelInfo, CUDDNode currentStateDD, Valuation lastValuation, Valuation currentValuation) { string channelName = eventChannelInfo.name; if (eventChannelInfo.type == EventChannelInfo.EventType.ASYNC_CHANNEL_INPUT) { channelName += "?"; } else if (eventChannelInfo.type == EventChannelInfo.EventType.ASYNC_CHANNEL_OUTPUT) { channelName += "!"; } switch (eventChannelInfo.type) { case EventChannelInfo.EventType.ASYNC_CHANNEL_INPUT: ChannelQueue channelBuffer1 = lastValuation.Channels[eventChannelInfo.name]; foreach (ExpressionValue elementValue in channelBuffer1.Peek()) { int value = int.Parse(elementValue.ExpressionID); channelName += value + "."; } break; case EventChannelInfo.EventType.ASYNC_CHANNEL_OUTPUT: ChannelQueue channelBuffer2 = currentValuation.Channels[eventChannelInfo.name]; foreach (ExpressionValue elementValue in channelBuffer2.ToArray()[channelBuffer2.Size - 1]) { int value = int.Parse(elementValue.ExpressionID); channelName += value + "."; } break; } channelName = channelName.TrimEnd('.'); return channelName; }
public int GetChannelIndex(string channelName, EventChannelInfo.EventType type) { for (int i = 0; i < this.allEventIndex.Count; i++) { EventChannelInfo eventChannel = this.allEventIndex[i]; if (eventChannel.type == type && eventChannel.name == channelName) { return i; } } EventChannelInfo channel = new EventChannelInfo(channelName, 0, type); this.allEventIndex.Add(channel); // return this.allEventIndex.Count - 1; }