Exemplo n.º 1
0
		private void  parse(SupportClass.Tokenizer tok, Message message, StructRef root, NuGenEncodingCharacters ec)
		{
			
			Terser t = new Terser(message);
			
			lock (root)
			{
				StructRef ref_Renamed = root.getSuccessor("MSH");
				
				int field = 0;
				Segment segment = null;
				int[] fields = new int[0];
				
				while (tok.HasMoreTokens())
				{
					System.String token = tok.NextToken();
					if (token[0] == ec.FieldSeparator)
					{
						field++;
					}
					else if (token[0] == ourSegmentSeparator)
					{
						field = 0;
					}
					else if (field == 0)
					{
						StructRef newref = drill(ref_Renamed, token);
						if (newref == null)
						{
							segment = null;
							fields = new int[0];
						}
						else
						{
							ref_Renamed = newref;
							segment = t.getSegment(ref_Renamed.FullPath);
							fields = ref_Renamed.Fields;
						}
					}
					else if (segment != null && System.Array.BinarySearch(fields, (System.Object) field) >= 0)
					{
						parse(token, segment, field, ec);
					}
				}
				root.reset();
			}
		}
Exemplo n.º 2
0
		private System.String[] getMSHFields(SupportClass.Tokenizer tok, char fieldSep)
		{
			System.String[] result = new System.String[21];
			result[0] = System.Convert.ToString(fieldSep);
			System.String token = null;
			int field = 1;
			while (tok.HasMoreTokens() && (token = tok.NextToken())[0] != ourSegmentSeparator)
			{
				if (token[0] == fieldSep)
				{
					field++;
				}
				else
				{
					result[field] = token;
				}
			}
			return result;
		}