Пример #1
0
        // ----------------------------------------------------------------------------------------
        /// <!-- BuildSegment -->
        /// <summary>
        ///      Converts a formatted endeme item string into an endeme item with a string value
        /// </summary>
        /// <param name="enItemFormatted"></param>
        /// <param name="enRef"></param>
        /// <returns></returns>
        public static EndemeItem BuildSegment(string enItemFormatted, EndemeReference enRef, bool rawSource)
        {
            // --------------------------------------------------------------------------
            //  Resolve endeme set
            // --------------------------------------------------------------------------
            string    label = Endeme.Part(0, enItemFormatted);
            EndemeSet enSet = null;

            if (enRef != null)
            {
                enSet = enRef[label];
            }
            if (enSet == null || string.IsNullOrEmpty(enSet.Label))
            {
                enSet = new EndemeSet(label);
            }


            // --------------------------------------------------------------------------
            //  Build endeme item
            // --------------------------------------------------------------------------
            EndemeItem enItem = new EndemeItem(new Endeme(enSet, Endeme.Part(1, enItemFormatted), rawSource), "");

            enItem.Item = Endeme.Part(2, enItemFormatted);
            return(enItem);
        }
Пример #2
0
 // ----------------------------------------------------------------------------------------
 /// <!-- FillSegments -->
 /// <summary>
 ///
 /// </summary>
 /// <param name="path"></param>
 /// <param name="enRef"></param>
 private void FillSegments(string path, EndemeReference enRef, bool rawSource)
 {
     string[] seq = path.Split("|!*+^".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
     for (int i = 0; i < seq.Length; ++i)
     {
         Segment.Add(BuildSegment(seq[i], enRef, rawSource));
     }
 }
Пример #3
0
 // ----------------------------------------------------------------------------------------
 /// <!-- Set -->
 /// <summary>
 ///
 /// </summary>
 /// <param name="enDef"></param>
 public void Set(EndemeDefinition enDef)
 {
     _list     = enDef._list;
     _order    = enDef._order;
     _labelIdx = enDef._labelIdx;
     _codeIdx  = enDef._codeIdx;
     _enRef    = enDef._enRef;
     _label    = enDef._label;
 }
Пример #4
0
 // ----------------------------------------------------------------------------------------
 /// <!-- Add -->
 /// <summary>
 ///      Adds an element to the EndemeArray
 /// </summary>
 /// <param name="guid"></param>
 /// <param name="element"></param>
 /// <returns>
 ///      Probably ought to return the element not just the Guid since the Element contains the Guid
 /// </returns>
 /// <remarks>beta code - nearly production ready</remarks>
 public Guid Add(Guid guid, EndemeObject element) // <------------------------------------+
 {                                                // |
     element.ItemKey = guid;                      // |
     _list.Add(guid, element);                    // |
     _order.Add(guid);                            // |
     if (_enRef == null && element.EnRef != null)
     {
         _enRef = element.EnRef;                                                       // |  warning: side effect
     }
     return(guid);                                                                     // |
 }                                                                                     // |
Пример #5
0
        public EndemeList(string label, EndemeReference enRef, double equalThreshold)
        {
            Init(label, null);
            if (enRef == null)
            {
                throw new Exception("boom");                // EnRef = new EndemeReference();
            }
            else
            {
                this.EnRef = enRef;
            }
            this.EqualityThreshold = equalThreshold;

            this._enSet = enRef.SetRef.FirstOrDefault(x => x.Key != "").Value;
        }
Пример #6
0
 public EndemeProfile(EndemeTermKey profile, EndemeReference enRef)
 {
     Init(); FillSegments(profile, enRef, true); FillOperators(profile.ToString());
 }
Пример #7
0
 public EndemeProfile(string profile, EndemeReference enRef)
 {
     Init(); FillSegments(profile, enRef, true); FillOperators(profile);
 }
Пример #8
0
 public EndemeDefinition(string label, EndemeReference enRef)
 {
     _label = label; _enRef = enRef; Clear();
 }
Пример #9
0
 // ----------------------------------------------------------------------------------------
 //  Constructors
 // ----------------------------------------------------------------------------------------
 public EndemeField(string label, EndemeReference enRef, double equalThreshold)
 {
     Label     = label;
     _field    = new EndemeList(label, enRef, equalThreshold);
     _register = new EndemeDefinition(label, enRef);
 }
Пример #10
0
 // --------------------------------------------------------------------------------------
 //  Constructors
 // --------------------------------------------------------------------------------------
 public EndemeObject(string profile, EndemeReference enRef, EndemeValue value)
 {
     Init("", new EndemeProfile(profile, enRef), value);
 }