/// <summary>
        /// Returns true if UnitReferenceDataResponse instances are equal
        /// </summary>
        /// <param name="other">Instance of UnitReferenceDataResponse to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(UnitReferenceDataResponse other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     RefId == other.RefId ||
                     RefId != null &&
                     RefId.Equals(other.RefId)
                     ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     UnitSite == other.UnitSite ||
                     UnitSite != null &&
                     UnitSite.Equals(other.UnitSite)
                 ));
        }
예제 #2
0
 DomainRef GetDomainObjById(RefId id)
 {
     // TODO: optimize
     return(FindObjectsOfType <DomainRef>()
            .Where(i => i.id.Equals(id))
            .First());
 }
예제 #3
0
        public static RefId GetNamedId(string name)
        {
            var retId = RefId.CreateRefId();

            retId.SetProperty(nameTag, StringId.CreateStringId(name));
            return(retId);
        }
예제 #4
0
        public static IId getCombinedFunctionDefinition(IId parameterSet, IId functionCallList)
        {
            var ret = RefId.CreateRefId();

            ret.SetProperty(parameters, parameterSet);
            ret.SetProperty(subFunctionCalls, functionCallList);
            return(ret);
        }
예제 #5
0
        public static IId GetFunctionCall(IId valueDictionary, IId callee)
        {
            var ret = RefId.CreateRefId();

            ret.SetProperty(parameterValues, valueDictionary);
            ret.SetProperty(functionCalled, callee);
            return(ret);
        }
예제 #6
0
        public RefId RegisterAndCreateUniqueIId(string uniqueName)
        {
            if (environment.NameToId.ContainsKey(uniqueName))
            {
                throw new Exception();
            }
            var ret = RefId.CreateRefId();

            environment.NameToId.Add(uniqueName, ret);
            return(ret);
        }
예제 #7
0
        public static RefId CreateList(IId[] elements)
        {
            var list    = RefId.CreateRefId();
            var rawList = BareListId.CreateBareListId();

            list.SetProperty(listId, rawList);
            for (int i = 0; i < elements.Length; i++)
            {
                rawList.SetProperty(IntId.CreateId(i), elements[i]);
            }
            return(list);
        }
예제 #8
0
        public static IId CreateSet(ISet <IId> values)
        {
            var set    = RefId.CreateRefId();
            var rawSet = BareSetId.CreateBareSetId();

            set.SetProperty(setId, rawSet);
            foreach (var value in values)
            {
                set.SetProperty(value, value);
            }
            return(set);
        }
예제 #9
0
        public IEnumerable <string> StreamAllIIds()
        {
            var isStreaming = RefId.CreateRefId();
            var streamList  = new List <string>()
            {
                "IID"
            };

            AddIdAndMark(environment.GetRoot(), streamList, isStreaming);
            UnMark(environment.GetRoot(), isStreaming);
            streamList.Add("NAMES");
            WriteUniqueNames(environment.NameToId, streamList);
            return(streamList);
        }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (RefId != null)
         {
             hashCode = hashCode * 59 + RefId.GetHashCode();
         }
         if (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         return(hashCode);
     }
 }
예제 #11
0
 public override int GetHashCode()
 {
     return(RefId?.GetHashCode() ?? 0);
 }