public Queue <Queue <float> > ExtractChromosomeGeneSets() { Queue <Queue <float> > chromosome = new Queue <Queue <float> >(); for (int i = 1; i < layers.Length; i++) { foreach (var node in layers[i].nodes) { Queue <float> geneSet = new Queue <float>(); //Extract the bias gene geneSet.Enqueue(node.bias); //Extract each weighting gene foreach (var nodeConnection in node.inputConnections) { geneSet.Enqueue(nodeConnection.weight); } chromosome.Enqueue(geneSet); } } Queue <Queue <float> > deepCopy = new Queue <Queue <float> >(); foreach (Queue <float> floats in chromosome) { deepCopy.Enqueue((Queue <float>)DeepCopy.Copy(floats)); } return(deepCopy); }
/// <summary> /// Create an appropriate response given the results /// </summary> /// <param name="results">The results that matches the query</param> /// <param name="map">The HL7 query parameter mapping</param> /// <param name="request">The original request message</param> /// <param name="count">The number of results that the user requested</param> /// <param name="offset">The offset to the first result</param> /// <param name="queryId">The unique query identifier used</param> /// <returns>The constructed result message</returns> protected virtual IMessage CreateQueryResponse(Hl7MessageReceivedEventArgs request, Expression filter, Hl7QueryParameterType map, IEnumerable results, Guid queryId, int offset, int count, int totalResults) { var retVal = this.CreateACK(map.ResponseType, request.Message, "AA", "Query Success"); var omsh = retVal.GetStructure("MSH") as MSH; var qak = retVal.GetStructure("QAK") as QAK; var odsc = retVal.GetStructure("DSC") as DSC; var oqpd = retVal.GetStructure("QPD") as QPD; DeepCopy.Copy(request.Message.GetStructure("QPD") as ISegment, oqpd); omsh.MessageType.MessageCode.Value = "RSP"; omsh.MessageType.MessageStructure.Value = retVal.GetType().Name; omsh.MessageType.TriggerEvent.Value = map.ResponseTrigger; omsh.MessageType.MessageStructure.Value = map.ResponseTypeXml; qak.HitCount.Value = totalResults.ToString(); qak.HitsRemaining.Value = (totalResults - offset - count > 0 ? totalResults - offset - count : 0).ToString(); qak.QueryResponseStatus.Value = totalResults == 0 ? "NF" : "OK"; qak.ThisPayload.Value = results.OfType <Object>().Count().ToString(); if (ApplicationServiceContext.Current.GetService <Core.Services.IQueryPersistenceService>() != null && Int32.Parse(qak.HitsRemaining.Value) > 0) { odsc.ContinuationPointer.Value = queryId.ToString(); odsc.ContinuationStyle.Value = "RD"; } // Process results retVal = map.QueryHandler.AppendQueryResult(results, filter, retVal, request, offset); return(retVal); }
public List <Vector2> CheckLegalMoves(Board boardClone, List <Vector2> currentLegalMoves) { List <Vector2> newLegalMoves = new List <Vector2>(); Board boardCopy = DeepCopy.Copy(boardClone); bool wasBlackinCheck = KingInCheck.IsBlackInCheck(); bool wasWhiteinCheck = KingInCheck.IsWhiteInCheck(); int selectedPiece = boardClone.GetActivePieces().IndexOf(this); Piece selectedCopy = boardCopy.GetActivePieces()[selectedPiece]; Debug.Log("Current legal moves are: "); foreach (Vector2 move in currentLegalMoves) { //When checkMove is false, the current teams king is not in check and the move is valid if (selectedCopy.CheckMove(boardCopy, move) == false) { newLegalMoves.Add(move); } } KingInCheck.SetBlackCheck(wasBlackinCheck); KingInCheck.SetWhiteCheck(wasWhiteinCheck); return(newLegalMoves); }
/** * Creates a new endstate-safe schedule from the given schedule. (last state copied as deep copy, all others shallow copies) * @param schedToMakeSafeCopyFrom the schedule to copy */ public AssetSchedule(AssetSchedule oldSchedule) { AssetSchedule newAssetSched = DeepCopy.Copy <AssetSchedule>(oldSchedule); InitialState = newAssetSched.InitialState; Events = newAssetSched.Events; }
public Event(Event eventToCopyExactly) { Event newEvent = DeepCopy.Copy <Event>(eventToCopyExactly); Task = newEvent.Task; State = newEvent.State; }
/// <summary> /// A deep clone of the System State, but keeping the reference to Previous as a reference /// </summary> /// <returns></returns> public SystemState DeepClone() { SystemState newState = new SystemState(); //foreach(KeyValuePair<StateVarKey<int>, HSFProfile<int>> data in this.Idata) //{ // newState.addValue(data.Key, new HSFProfile<int>(data.Value)); //} //foreach (KeyValuePair<StateVarKey<bool>, HSFProfile<bool>> data in this.Bdata) //{ // newState.addValue(data.Key, new HSFProfile<bool>(data.Value)); //} //foreach (KeyValuePair<StateVarKey<double>, HSFProfile<double>> data in this.Ddata) //{ // newState.addValue(data.Key, new HSFProfile<double>(data.Value)); //} //foreach (KeyValuePair<StateVarKey<Matrix<double>>, HSFProfile<Matrix<double>>> data in this.Mdata) //{ // newState.addValue(data.Key.DeepClone(), new HSFProfile<Matrix<double>>(data.Value)); //} //foreach (KeyValuePair<StateVarKey<Quat>, HSFProfile<Quat>> data in this.Qdata) //{ // newState.addValue(data.Key.DeepClone(), new HSFProfile<Quat>(data.Value)); //} newState.Idata = (DeepCopy.Copy(Idata)); newState.Bdata = (DeepCopy.Copy(Bdata)); newState.Ddata = (DeepCopy.Copy(Ddata)); newState.Mdata = (DeepCopy.Copy(Mdata)); newState.Previous = Previous; return(newState); }
/** * Creates a new assetSchedule from and old assetSchedule and a new Event shared pointer * @param oldSchedule the old schedule to base this schedule off of * @param newEvent the new event to add to the schedule */ public AssetSchedule(AssetSchedule oldSchedule, Event newEvent) { AssetSchedule newAssetSched = DeepCopy.Copy <AssetSchedule>(oldSchedule); InitialState = newAssetSched.InitialState; Events = newAssetSched.Events; Events.Push(newEvent); }
public TestCopyClass(TestCopyClass other) { TestCopyClass copy = DeepCopy.Copy <TestCopyClass>(other); Num = copy.Num; Name = copy.Name; Helper = copy.Helper; }
/// <summary> /// Rewrite a QPD query to an HDSI query /// </summary> public virtual NameValueCollection ParseQuery(QPD qpd, Hl7QueryParameterType map) { NameValueCollection retVal = new NameValueCollection(); // Control of strength String strStrength = (qpd.GetField(4, 0) as Varies)?.Data.ToString(), algorithm = (qpd.GetField(5, 0) as Varies)?.Data.ToString(); Double?strength = String.IsNullOrEmpty(strStrength) ? null : (double?)Double.Parse(strStrength); // Query parameters foreach (var itm in MessageUtils.ParseQueryElement(qpd.GetField(3).OfType <Varies>(), map, algorithm, strength)) { try { retVal.Add(itm.Key, itm.Value); } catch (Exception e) { this.m_tracer.TraceError("Error processing query parameter", "QPD", "1", 3, 0, e); throw new HL7ProcessingException(this.m_localizationService.FormatString("error.type.HL7ProcessingException", new { param = "query parameter" }), "QPD", "1", 3, 0, e); } } // Return domains foreach (var rt in qpd.GetField(8).OfType <Varies>()) { try { var rid = new CX(qpd.Message); DeepCopy.Copy(rt.Data as GenericComposite, rid); var authority = rid.AssigningAuthority.ToModel(); if (authority.Key == this.m_configuration.LocalAuthority.Key) { retVal.Add("_id", rid.IDNumber.Value); } else { retVal.Add($"identifier[{authority.DomainName}]", "!null"); } } catch (Exception e) { this.m_tracer.TraceError("Error processing return domains", "QPD", "1", 8, 0, e); throw new HL7ProcessingException(this.m_localizationService.FormatString("error.type.HL7ProcessingException", new { param = "return domains" }), "QPD", "1", 8, 0, e); } } retVal.Add("obsoletionTime", "null"); return(retVal); }
//Takes two array segments and combines them into a new genome private float[] CreateChild(List <float> fatherSegment, List <float> motherSegment) { float[] newChromosome = new float[NumberOfGenes]; //Add the father segment to the start of the array, since this is where we took it from earlier fatherSegment.CopyTo(newChromosome, 0); //Add the mother's genes onto the end of the fathers motherSegment.CopyTo(newChromosome, fatherSegment.Count); return((float[])DeepCopy.Copy(newChromosome)); }
/// <summary> /// Rewrite a QPD query to an HDSI query /// </summary> public virtual NameValueCollection ParseQuery(QPD qpd, Hl7QueryParameterType map) { NameValueCollection retVal = new NameValueCollection(); // Query domains foreach (var rt in qpd.GetField(3).OfType <Varies>()) { try { var rid = new CX(qpd.Message); DeepCopy.Copy(rt.Data as GenericComposite, rid); var authority = rid.AssigningAuthority.ToModel(); if (authority.Key == m_configuration.LocalAuthority.Key) { retVal.Add("_id", rid.IDNumber.Value); } else { retVal.Add($"identifier[{authority.DomainName}].value", rid.IDNumber.Value); } } catch (Exception e) { this.m_tracer.TraceError("Error processing patient identity", "QPD", "1", 3, 4, e); throw new HL7ProcessingException(this.m_localizationService.FormatString("error.type.HL7ProcessingException", new { param = "patient identity" }), "QPD", "1", 3, 4, e); } } //// Return domains // This just verifies the return domains foreach (var rt in qpd.GetField(4).OfType <Varies>()) { try { var rid = new CX(qpd.Message); DeepCopy.Copy(rt.Data as GenericComposite, rid); var authority = rid.AssigningAuthority.ToModel(); } catch (Exception e) { this.m_tracer.TraceError("Error processing what domains returned", "QPD", "1", 4, 4, e); throw new HL7ProcessingException(this.m_localizationService.FormatString("error.type.HL7ProcessingException", new { param = "what domains returned" }), "QPD", "1", 4, 4, e); } } return(retVal); }
public void MatrixDeepCopyTest() { Matrix <double> A = new Matrix <double>(new double[, ] { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }); Matrix <double> B = DeepCopy.Copy(A); Assert.AreEqual(B, A); }
public SystemClass(SystemClass other) { SystemClass copy = DeepCopy.Copy <SystemClass>(other); Assets = copy.Assets; Subsystems = copy.Subsystems; Constraints = copy.Constraints; Environment = copy.Environment; ThreadNum = copy.ThreadNum; }
/// <summary> /// New Event with a deep copy of the state. /// </summary> /// <param name="eventToCopyExactly"></param> public Event(Event eventToCopyExactly) { Tasks = eventToCopyExactly.Tasks; State = DeepCopy.Copy(eventToCopyExactly.State); EventStarts = eventToCopyExactly.EventStarts; EventEnds = eventToCopyExactly.EventEnds; //EventStarts = DeepCopy.Copy(eventToCopyExactly.EventStarts); //EventEnds = DeepCopy.Copy(eventToCopyExactly.EventEnds); TaskStarts = DeepCopy.Copy(eventToCopyExactly.TaskStarts); TaskEnds = DeepCopy.Copy(eventToCopyExactly.TaskEnds); }
private List <EncodingTaskBase> GetTasksForSelectedFiles() { var tasksForSelectedFiles = new List <EncodingTaskBase>(); foreach (var file in SelectedFiles) { var taskCopies = Tasks.Select(x => DeepCopy.Copy(x)).ToArray(); tasksForSelectedFiles.Add(ConvertToAssemblyLineIfNeeded(taskCopies, file)); } return(tasksForSelectedFiles); }
/** * Copy constructor for exact state copies */ public SystemState(SystemState initialStateToCopy) { SystemState newState = DeepCopy.Copy <SystemState>(initialStateToCopy); Previous = newState.Previous; EventStart = newState.EventStart; TaskStart = newState.TaskStart; TaskEnd = newState.TaskEnd; EventEnd = newState.EventEnd; Idata = newState.Idata; Ddata = newState.Ddata; // Fdata = newState.Fdata; Bdata = newState.Bdata; Mdata = newState.Mdata; Qdata = newState.Qdata; }
public Queue <float> ExtractChromosome() { Queue <float> chromosome = new Queue <float>(); for (int i = 1; i < layers.Length; i++) { foreach (var node in layers[i].nodes) { //Extract the bias gene chromosome.Enqueue(node.bias); //Extract each weighting gene foreach (var nodeConnection in node.inputConnections) { chromosome.Enqueue(nodeConnection.weight); } } } _chromosome = chromosome.ToList(); return((Queue <float>)DeepCopy.Copy(chromosome)); }
public void DeepCopyTest() { TestCopyClass c1 = new TestCopyClass { Num = 1, Name = "Morgan", Helper = new TestCopyHelperClass { helperString = "Help", helperInt = 2 } }; //Test copy TestCopyClass c2 = DeepCopy.Copy <TestCopyClass>(c1); Assert.AreEqual(c1.Helper.helperInt, c2.Helper.helperInt); Assert.AreEqual(c1.Num, c2.Num); //Test Modify to property c2.Num = 5; Assert.AreNotEqual(c1.Num, c2.Num); Assert.AreEqual(5, c2.Num); Assert.AreEqual(1, c1.Num); //Test Modification to Helper class c2.Helper.helperInt = 12; Assert.AreNotEqual(c1.Helper.helperInt, c2.Helper.helperInt); Assert.AreEqual(12, c2.Helper.helperInt); c2.Helper.helperString = "poop"; Assert.AreNotEqual(c1.Helper.helperString, c2.Helper.helperString); Assert.AreEqual("poop", c2.Helper.helperString); //Test clone constructor TestCopyClass c3 = new TestCopyClass(c1); Assert.AreEqual(c1.Num, c3.Num); Assert.AreEqual(c1.Helper.helperString, c3.Helper.helperString); c3.Num = 7; c3.Helper.helperInt = 7; Assert.AreNotEqual(c1.Helper.helperInt, c3.Helper.helperInt); Assert.AreEqual(7, c3.Helper.helperInt); Assert.AreNotEqual(c1.Num, c3.Num); }
public SystemSchedule(SystemSchedule oldSchedule, List <Task> newTaskList, double newTaskStartTime) { int i = 0; //need a double iterator foreach (AssetSchedule asIt in oldSchedule.AssetScheds) { Task tIt = newTaskList[i]; if (tIt == null) { Event eventToAdd = new Event(tIt, new SystemState(asIt.getLastState(), newTaskStartTime)); AssetScheds.Add(new AssetSchedule(asIt, eventToAdd)); //TODO: double check c# implementation above // shared_ptr<Event> eventToAdd(new Event(*tIt, new State((*assSchedIt)->getLastState(), newTaskStartTime))); // assetscheds.push_back(new assetSchedule(*assSchedIt, eventToAdd)); } else { AssetScheds.Add(DeepCopy.Copy <AssetSchedule>(asIt)); } i++; } }
public Board GetBoardClone() { return(DeepCopy.Copy(board) as Board); }
/// <summary> /// Append query results to the message /// </summary> public virtual IMessage AppendQueryResult(IEnumerable results, Expression queryDefinition, IMessage currentResponse, Hl7MessageReceivedEventArgs evt, int offset = 0) { var patients = results.OfType <Patient>(); if (patients.Count() == 0) { return(currentResponse); } var retVal = currentResponse as RSP_K23; var rqo = evt.Message as QBP_Q21; // Return domains List <AssigningAuthority> returnDomains = new List <AssigningAuthority>(); foreach (var rt in rqo.QPD.GetField(4).OfType <Varies>()) { var rid = new CX(rqo.Message); DeepCopy.Copy(rt.Data as GenericComposite, rid); var domain = rid.AssigningAuthority.ToModel(); returnDomains.Add(domain); } var matchService = ApplicationServiceContext.Current.GetService <IRecordMatchingService>(); var matchConfigService = ApplicationServiceContext.Current.GetService <IRecordMatchingConfigurationService>(); // Process results int i = offset + 1; foreach (var itm in patients) { var queryInstance = retVal.QUERY_RESPONSE; // Expose PK? if (returnDomains.Count == 0 || returnDomains.Any(d => d.Key == this.m_configuration.LocalAuthority.Key)) { queryInstance.PID.GetPatientIdentifierList(queryInstance.PID.PatientIdentifierListRepetitionsUsed).FromModel(new EntityIdentifier(this.m_configuration.LocalAuthority, itm.Key.ToString())); queryInstance.PID.GetPatientIdentifierList(queryInstance.PID.PatientIdentifierListRepetitionsUsed - 1).IdentifierTypeCode.Value = "PI"; } foreach (var id in itm.LoadCollection <EntityIdentifier>("Identifiers")) { if (returnDomains.Count == 0 || returnDomains.Any(o => o.Key == id.AuthorityKey)) { queryInstance.PID.GetPatientIdentifierList(queryInstance.PID.PatientIdentifierListRepetitionsUsed).FromModel(id); } } if (returnDomains.Any(rid => rid.Key == this.m_configuration.LocalAuthority.Key)) { int idx = queryInstance.PID.PatientIdentifierListRepetitionsUsed; queryInstance.PID.GetPatientIdentifierList(idx).IDNumber.Value = itm.Key.Value.ToString(); queryInstance.PID.GetPatientIdentifierList(idx).AssigningAuthority.NamespaceID.Value = this.m_configuration.LocalAuthority.DomainName; queryInstance.PID.GetPatientIdentifierList(idx).AssigningAuthority.UniversalID.Value = this.m_configuration.LocalAuthority.Oid; queryInstance.PID.GetPatientIdentifierList(idx).AssigningAuthority.UniversalIDType.Value = "ISO"; } // No identifiers found in the response domains if (queryInstance.PID.PatientIdentifierListRepetitionsUsed > 0) { (currentResponse.GetStructure("QAK") as QAK).QueryResponseStatus.Value = "OK"; (currentResponse.GetStructure("QAK") as QAK).ThisPayload.Value = "1"; queryInstance.PID.SetIDPID.Value = (i++).ToString(); queryInstance.PID.GetPatientName(0).NameTypeCode.Value = "S"; } else { (currentResponse.GetStructure("QAK") as QAK).HitCount.Value = "0"; (currentResponse.GetStructure("QAK") as QAK).HitsRemaining.Value = "0"; (currentResponse.GetStructure("QAK") as QAK).ThisPayload.Value = "0"; (currentResponse.GetStructure("QAK") as QAK).QueryResponseStatus.Value = "NF"; } } return(retVal); }
public Board Clone() { return(DeepCopy.Copy(this) as Board); }
public virtual Subsystem clone() { return DeepCopy.Copy<Subsystem>(this); }
/** * Applies the constraint to the appropriate variables in the given state, * that contains updated state data for all the requested Subsystems. * @param state a partially updated state * @return true if the state passes the constraint check */ /* * public virtual bool accepts(SystemSchedule sched) * { * return false; * } */ public virtual Constraint clone() { return(DeepCopy.Copy <Constraint>(this)); }
/// <summary> /// Append query results to the message /// </summary> public virtual IMessage AppendQueryResult(IEnumerable results, Expression queryDefinition, IMessage currentResponse, Hl7MessageReceivedEventArgs evt, int offset = 0) { var patients = results.OfType <Patient>(); if (patients.Count() == 0) { return(currentResponse); } var retVal = currentResponse as RSP_K21; var pidHandler = SegmentHandlers.GetSegmentHandler("PID"); var pd1Handler = SegmentHandlers.GetSegmentHandler("PD1"); var nokHandler = SegmentHandlers.GetSegmentHandler("NK1"); var matchService = ApplicationServiceContext.Current.GetService <IRecordMatchingService>(); var matchConfigService = ApplicationServiceContext.Current.GetService <IRecordMatchingConfigurationService>(); // Return domains var rqo = evt.Message as QBP_Q21; List <AssigningAuthority> returnDomains = new List <AssigningAuthority>(); foreach (var rt in rqo.QPD.GetField(8).OfType <Varies>()) { var rid = new CX(rqo.Message); DeepCopy.Copy(rt.Data as GenericComposite, rid); var authority = rid.AssigningAuthority.ToModel(); returnDomains.Add(authority); } if (returnDomains.Count == 0) { returnDomains = null; } // Process results int i = offset + 1; IEnumerable <dynamic> resultScores = patients.Select(o => new { Patient = o, WasScored = false }); if (this.m_scoringService != null) { resultScores = this.m_scoringService.Score <Patient>(queryDefinition as Expression <Func <Patient, bool> >, patients).Select(o => new { Patient = o.Result, Score = o.Score, Method = o.Method, WasScored = true }); } foreach (var itm in resultScores) { var queryInstance = retVal.GetQUERY_RESPONSE(retVal.QUERY_RESPONSERepetitionsUsed); pidHandler.Create(itm.Patient, queryInstance, returnDomains?.ToArray()); pd1Handler.Create(itm.Patient, queryInstance, null); nokHandler.Create(itm.Patient, queryInstance, null); queryInstance.PID.SetIDPID.Value = (i++).ToString(); if (itm.WasScored) { queryInstance.QRI.CandidateConfidence.Value = itm.Score.ToString(); switch ((RecordMatchMethod)itm.Method) { case RecordMatchMethod.Identifier: queryInstance.QRI.GetMatchReasonCode(0).Value = "SS"; break; case RecordMatchMethod.Simple: queryInstance.QRI.GetMatchReasonCode(0).Value = "NA"; break; case RecordMatchMethod.Weighted: queryInstance.QRI.GetMatchReasonCode(0).Value = "NP"; break; } queryInstance.QRI.AlgorithmDescriptor.Identifier.Value = this.m_scoringService.ServiceName; } else { queryInstance.QRI.CandidateConfidence.Value = "1.0"; queryInstance.QRI.AlgorithmDescriptor.Identifier.Value = "PTNM"; } } return(retVal); }
/// <summary> /// Create an Ack message based on a received message /// </summary> /// <param name="inboundMessage">received message</param> /// <param name="ackResult">Send AA, AE or AR message.</param> /// <param name="errorMessage">The reason the message was rejected or an error. If "AA" was supplied as ackCode the errorMessage should be null.</param> /// <returns>Created ACK message</returns> public IMessage MakeACK(IMessage inboundMessage, AckTypes ackResult, string errorMessage) { //this should avoid an unhandled null reference exception in "inboundMessage.Version", because people tend to send the inboudMessage without a check if (inboundMessage == null) { throw new ArgumentNullException("Either process the valid message while retreiving the ack or handle invalid message differently"); } IMessage ackMessage = null; // Get an object from the right ACK class string ackClassType = string.Format("NHapi.Model.V{0}.Message.ACK, NHapi.Model.V{0}", inboundMessage.Version.Replace(".", "")); Type x = Type.GetType(ackClassType); if (x != null) { ackMessage = (IMessage)Activator.CreateInstance(x); } else { // Fix for V2.2 and V2.1 Since tha ACK message class is missing there in NHapi if (inboundMessage.Version == "2.1") { ackMessage = (IMessage) new NHapiTools.Base.CustomImplementation.V21.Messages.ACK(); } if (inboundMessage.Version == "2.2") { ackMessage = (IMessage) new NHapiTools.Base.CustomImplementation.V22.Messages.ACK(); } } Terser inboundTerser = new Terser(inboundMessage); ISegment inboundHeader = null; inboundHeader = inboundTerser.GetSegment("MSH"); // Find the HL7 version of the inbound message: string version = null; try { version = Terser.Get(inboundHeader, 12, 0, 1, 1); } catch (NHapi.Base.HL7Exception) { // I'm not happy to proceed if we can't identify the inbound // message version. throw new NHapi.Base.HL7Exception("Failed to get valid HL7 version from inbound MSH-12-1"); } // Create a Terser instance for the outbound message (the ACK). Terser terser = new Terser(ackMessage); // Populate outbound MSH fields using data from inbound message ISegment outHeader = (ISegment)terser.GetSegment("MSH"); DeepCopy.Copy(inboundHeader, outHeader); // Now set the message type, HL7 version number, acknowledgement code // and message control ID fields: string sendingApp = terser.Get("/MSH-3"); string sendingEnv = terser.Get("/MSH-4"); terser.Set("/MSH-3", appCommunicationName); terser.Set("/MSH-4", environmentIdentifier); terser.Set("/MSH-5", sendingApp); terser.Set("/MSH-6", sendingEnv); terser.Set("/MSH-7", DateTime.Now.ToString("yyyyMMddHHmm")); terser.Set("/MSH-9", "ACK"); terser.Set("/MSH-9-3", null); terser.Set("/MSH-12", version); terser.Set("/MSA-1", Enum.GetName(typeof(AckTypes), ackResult)); terser.Set("/MSA-2", Terser.Get(inboundHeader, 10, 0, 1, 1)); // Set error message if (errorMessage != null) { terser.Set("/ERR-1-1", errorMessage); } return(ackMessage); }