Example #1
0
            public virtual void  putDatum(System.Collections.ArrayList valNodeKey, System.String value_Renamed)
            {
                // make a DatumPath from valNodeKey and info in this:
                NuGenDatumPath valDatumPath = new NuGenDatumPath();

                valDatumPath.add(m_segmentId).add(m_segmentRepIdx);
                for (int i = 0; i < valNodeKey.Count; ++i)
                {
                    // valNodeKey: everything counts from 0 -- not so with DatumPath ... sigh.
                    int itval = ((System.Int32)valNodeKey[i]);
                    valDatumPath.add((System.Object)(i == 1?itval:itval + 1));
                }

                // see if valDatumPath passes m_msgMask:
                bool valDatumPathPassesMask = false;

                for (System.Collections.IEnumerator maskIt = m_msgMask.GetEnumerator(); !valDatumPathPassesMask && maskIt.MoveNext();)
                {
                    valDatumPathPassesMask = valDatumPath.startsWith((NuGenDatumPath)(maskIt.Current));
                }

                if (valDatumPathPassesMask)
                {
                    m_props[valDatumPath.ToString()] = value_Renamed;
                }
            }
Example #2
0
        public static void  Main(System.String[] args)
        {
            NuGenDatumPath dp = new NuGenDatumPath();

            dp.add(new System.Text.StringBuilder("ZYX").ToString());
            dp.add((System.Object) 42);

            NuGenDatumPath dp2 = (new NuGenDatumPath()).add(new System.Text.StringBuilder().ToString()).add(-42);

            System.Console.Out.WriteLine(dp);
        }
		public static void  Main(System.String[] args)
		{
			NuGenDatumPath dp = new NuGenDatumPath();
			dp.add(new System.Text.StringBuilder("ZYX").ToString());
			dp.add((System.Object) 42);
			
			NuGenDatumPath dp2 = (new NuGenDatumPath()).add(new System.Text.StringBuilder().ToString()).add(- 42);
			
			System.Console.Out.WriteLine(dp);
		}
Example #4
0
			/* doc location == msgID & curPath together.  
			If we've encountered an element called "elementNam", then this tries 
			to determine what it is, based on what we already know about the document.
			returns true if we can make sense of this new element name given the
			position we're at (represented by msgID / curPath), 
			false if we can't (which probably means this should be a useless element). 
			returning true doesn't mean that we actually changed msgID or curPath, it
			might mean that we just passed through a segment group element OK.
			*/
			protected internal static bool tryToGrowDocLocationFromElementName(System.Text.StringBuilder msgID, NuGenDatumPath curPath, System.Collections.IDictionary segmentId2nextRepIdx, NuGenDatumPath lastDumpedPath, System.String elementName)
			{
				bool ok = false; // ok == can we make sense of this new element?
				// hmm ... where are we in the document: 
				if ((msgID.Length == 0) && (curPath.size() == 0))
				{
					// we're entering a message
					msgID.Replace(msgID.ToString(0, msgID.Length - 0), elementName, 0, msgID.Length - 0);
					segmentId2nextRepIdx.Clear();
					ok = true;
				}
				else if ((msgID.Length > 0) && (curPath.size() == 0))
				{
					// we're entering either a segment-group element (eg. <ADT_A01.PROCEDURE>)
					// or an actual segment element.
					if (!(elementName.StartsWith("" + msgID + '.')))
					{
						// must be an actual segment.
						curPath.add(elementName);
						
						if (segmentId2nextRepIdx.Contains(elementName))
							curPath.add(segmentId2nextRepIdx[elementName]);
						else
							curPath.add((System.Object) 0);
						
						segmentId2nextRepIdx[elementName] = (System.Int32) (((System.Int32) curPath.get_Renamed(curPath.size() - 1)) + 1);
					}
					ok = true;
				}
				else if ((msgID.Length > 0) && (curPath.size() > 0))
				{
					// we're entering a field or a component or a subcomponent.
					if (curPath.size() == 2)
					{
						// we're entering a field element
						// all fields should start with segment-ID + '.' 
						if (elementName.StartsWith("" + curPath.get_Renamed(0) + '.'))
						{
							try
							{
								int fieldIdxFromElementName = System.Int32.Parse(elementName.Substring(elementName.IndexOf('.') + 1));
								
								curPath.add((System.Object) fieldIdxFromElementName);
								
								// now add the repetition idx to curPath: 
								if ((lastDumpedPath.size() >= 4) && (((System.Int32) lastDumpedPath.get_Renamed(2)) == fieldIdxFromElementName))
								{
									// lastDumpedPath has a fieldIdx and a fieldRepIdx.
									curPath.add((System.Object) (((System.Int32) lastDumpedPath.get_Renamed(3)) + 1));
								}
								else
									curPath.add((System.Object) 0);
								
								ok = true;
							}
							catch (System.FormatException)
							{
							}
						} // else => this isn't a field -- must be useless.
					}
					else if ((curPath.size() == 4) || (curPath.size() == 5))
					{
						// we're entering a component or subcomponent element
						try
						{
							int idxFromElementName = System.Int32.Parse(elementName.Substring(elementName.IndexOf('.') + 1));
							curPath.add((System.Object) idxFromElementName);
							ok = true;
						}
						catch (System.FormatException)
						{
						}
					}
				}
				return ok;
			}
Example #5
0
            /* doc location == msgID & curPath together.
             * If we've encountered an element called "elementNam", then this tries
             * to determine what it is, based on what we already know about the document.
             * returns true if we can make sense of this new element name given the
             * position we're at (represented by msgID / curPath),
             * false if we can't (which probably means this should be a useless element).
             * returning true doesn't mean that we actually changed msgID or curPath, it
             * might mean that we just passed through a segment group element OK.
             */
            protected internal static bool tryToGrowDocLocationFromElementName(System.Text.StringBuilder msgID, NuGenDatumPath curPath, System.Collections.IDictionary segmentId2nextRepIdx, NuGenDatumPath lastDumpedPath, System.String elementName)
            {
                bool ok = false;                 // ok == can we make sense of this new element?

                // hmm ... where are we in the document:
                if ((msgID.Length == 0) && (curPath.size() == 0))
                {
                    // we're entering a message
                    msgID.Replace(msgID.ToString(0, msgID.Length - 0), elementName, 0, msgID.Length - 0);
                    segmentId2nextRepIdx.Clear();
                    ok = true;
                }
                else if ((msgID.Length > 0) && (curPath.size() == 0))
                {
                    // we're entering either a segment-group element (eg. <ADT_A01.PROCEDURE>)
                    // or an actual segment element.
                    if (!(elementName.StartsWith("" + msgID + '.')))
                    {
                        // must be an actual segment.
                        curPath.add(elementName);

                        if (segmentId2nextRepIdx.Contains(elementName))
                        {
                            curPath.add(segmentId2nextRepIdx[elementName]);
                        }
                        else
                        {
                            curPath.add((System.Object) 0);
                        }

                        segmentId2nextRepIdx[elementName] = (System.Int32)(((System.Int32)curPath.get_Renamed(curPath.size() - 1)) + 1);
                    }
                    ok = true;
                }
                else if ((msgID.Length > 0) && (curPath.size() > 0))
                {
                    // we're entering a field or a component or a subcomponent.
                    if (curPath.size() == 2)
                    {
                        // we're entering a field element
                        // all fields should start with segment-ID + '.'
                        if (elementName.StartsWith("" + curPath.get_Renamed(0) + '.'))
                        {
                            try
                            {
                                int fieldIdxFromElementName = System.Int32.Parse(elementName.Substring(elementName.IndexOf('.') + 1));

                                curPath.add((System.Object)fieldIdxFromElementName);

                                // now add the repetition idx to curPath:
                                if ((lastDumpedPath.size() >= 4) && (((System.Int32)lastDumpedPath.get_Renamed(2)) == fieldIdxFromElementName))
                                {
                                    // lastDumpedPath has a fieldIdx and a fieldRepIdx.
                                    curPath.add((System.Object)(((System.Int32)lastDumpedPath.get_Renamed(3)) + 1));
                                }
                                else
                                {
                                    curPath.add((System.Object) 0);
                                }

                                ok = true;
                            }
                            catch (System.FormatException)
                            {
                            }
                        }                         // else => this isn't a field -- must be useless.
                    }
                    else if ((curPath.size() == 4) || (curPath.size() == 5))
                    {
                        // we're entering a component or subcomponent element
                        try
                        {
                            int idxFromElementName = System.Int32.Parse(elementName.Substring(elementName.IndexOf('.') + 1));
                            curPath.add((System.Object)idxFromElementName);
                            ok = true;
                        }
                        catch (System.FormatException)
                        {
                        }
                    }
                }
                return(ok);
            }