Пример #1
0
                                                         public void IterateThrough_fromRoot(
                                                             string iteration_in,
                                                             OGen.Libraries.Generator.IterationFound iteration_found_in,
                                                             ref bool valueHasBeenFound_out
                                                             )
 {
     this.IterateThrough_fromRoot(
         iteration_in,
         iteration_found_in,
         ref valueHasBeenFound_out,
         true
         );
 }
Пример #2
0
		public void IterateThrough_fromRoot(
			string iteration_in, 
			OGen.Libraries.Generator.IterationFound iteration_found_in,
			ref bool valueHasBeenFound_out
		) {
			OGen.Libraries.Generator.Utilities.ReflectThrough(
				this, 
				this.Root_MetadataDB, 
				iteration_found_in, 
				iteration_in, 
				this.Root_MetadataDB, 
				false, 
				true, 
				ref valueHasBeenFound_out
			);
		}
Пример #3
0
                                                                public void IterateThrough_fromRoot(
                                                                    string iteration_in,
                                                                    OGen.Libraries.Generator.IterationFound iteration_found_in,
                                                                    ref bool valueHasBeenFound_out,
                                                                    bool useCache_in
                                                                    )
        {
#if NET_1_1
            ArrayList _aux;
#else
            System.Collections.Generic.List <string> _aux;
#endif

            if (useCache_in && this.IterateThrough_fromRoot_cache.ContainsKey(iteration_in))
            {
#if NET_1_1
                _aux = (ArrayList)this.IterateThrough_fromRoot_cache[iteration_in];
#else
                _aux = this.IterateThrough_fromRoot_cache[iteration_in];
#endif
                for (int i = 0; i < _aux.Count; i++)
                {
#if NET_1_1
                    iteration_found_in((string)_aux[i]);
#else
                    iteration_found_in(_aux[i]);
#endif
                }
                valueHasBeenFound_out = _aux.Count > 0;

                return;
            }

#if NET_1_1
            _aux = new ArrayList();
#else
            _aux = new System.Collections.Generic.List <string>();
#endif
            valueHasBeenFound_out = false;
            bool   _didit = false;
            string _begin;
            string _indexstring;
            string _end;

            if (OGen.Libraries.Generator.Utilities.rootExpression_TryParse(
                    iteration_in,
                    ROOT_METADATA,
                    out _begin,
                    out _indexstring,
                    out _end
                    ))
            {
                if (_indexstring == "n")
                {
                    for (int i = 0; i < this.metadatacollection_.Count; i++)
                    {
                        this.metadatacollection_[i].IterateThrough_fromRoot(
                            string.Format(
                                System.Globalization.CultureInfo.CurrentCulture,
                                "{0}{1}{2}",
                                _begin,
                                i,
                                _end
                                ),
                            useCache_in
                                                                ? delegate(string message_in) {
                            _aux.Add(message_in);
                        }
                                                                : iteration_found_in,
                            ref valueHasBeenFound_out
                            );
                    }
                    _didit = true;
                }
                else
                {
                    int _indexint = int.Parse(_indexstring, System.Globalization.CultureInfo.CurrentCulture);
                    this.metadatacollection_[
                        _indexint
                    ].IterateThrough_fromRoot(
                        string.Format(
                            System.Globalization.CultureInfo.CurrentCulture,
                            "{0}{1}{2}",
                            _begin,
                            _indexint,
                            _end
                            ),
                        useCache_in
                                                        ? delegate(string message_in) {
                        _aux.Add(message_in);
                    }
                                                        : iteration_found_in,
                        ref valueHasBeenFound_out
                        );

                    _didit = true;
                }
            }
            else if (OGen.Libraries.Generator.Utilities.rootExpression_TryParse(
                         iteration_in,
                         ROOT_SCHEMA,
                         out _begin,
                         out _indexstring,
                         out _end
                         ))
            {
                if (_indexstring == "n")
                {
                    for (int i = 0; i < this.schemacollection_.Count; i++)
                    {
                        this.schemacollection_[i].IterateThrough_fromRoot(
                            string.Format(
                                System.Globalization.CultureInfo.CurrentCulture,
                                "{0}{1}{2}",
                                _begin,
                                i,
                                _end
                                ),
                            useCache_in
                                                                ? delegate(string message_in) {
                            _aux.Add(message_in);
                        }
                                                                : iteration_found_in,
                            ref valueHasBeenFound_out
                            );
                    }
                    _didit = true;
                }
                else
                {
                    int _indexint = int.Parse(_indexstring, System.Globalization.CultureInfo.CurrentCulture);
                    this.schemacollection_[
                        _indexint
                    ].IterateThrough_fromRoot(
                        string.Format(
                            System.Globalization.CultureInfo.CurrentCulture,
                            "{0}{1}{2}",
                            _begin,
                            _indexint,
                            _end
                            ),
                        useCache_in
                                                        ? delegate(string message_in) {
                        _aux.Add(message_in);
                    }
                                                        : iteration_found_in,
                        ref valueHasBeenFound_out
                        );

                    _didit = true;
                }
            }

            if (_didit)
            {
                if (useCache_in)
                {
                    for (int i = 0; i < _aux.Count; i++)
                    {
#if NET_1_1
                        iteration_found_in((string)_aux[i]);
#else
                        iteration_found_in(_aux[i]);
#endif
                    }
                    valueHasBeenFound_out = _aux.Count > 0;

                    // check before lock
                    if (!this.IterateThrough_fromRoot_cache.ContainsKey(iteration_in))
                    {
                        lock (this.IterateThrough_fromRoot_locker) {
                            // double check, thread safer!
                            if (!this.IterateThrough_fromRoot_cache.ContainsKey(iteration_in))
                            {
                                // initialization...
                                // ...attribution (last thing before unlock)
                                this.IterateThrough_fromRoot_cache.Add(
                                    iteration_in,
                                    _aux
                                    );
                            }
                        }
                    }
                }
            }
            else
            {
                throw new Exception(string.Format(
                                        System.Globalization.CultureInfo.CurrentCulture,
                                        "\n---\n{0}.{1}.IterateThrough_fromRoot(...): can't handle: {2}\n---",
                                        typeof(XS__RootMetadata).Namespace,
                                        typeof(XS__RootMetadata).Name,
                                        iteration_in
                                        ));
            }
        }