コード例 #1
0
        //+ CLASSIFICATION
        internal static void AddToType(Identifiable.Id id, IdentifiableType type)
        {
            if (!CLASS_LISTING.ContainsKey(type))
            {
                GuuCore.LOGGER.LogError($"Trying to add identifiable {id} to type {type}. but type listing isn't registered");
                return;
            }

            CLASS_LISTING[type].Add(id);
        }
コード例 #2
0
        /// <summary>
        /// Registers a new identifiable type
        /// </summary>
        /// <param name="type">The type to register</param>
        /// <param name="hashSet">The hash set used for the listings</param>
        public static void RegisterType(IdentifiableType type, HashSet <Identifiable.Id> hashSet)
        {
            if (ModLoader.CurrentStep != LoadingState.REGISTER)
            {
                throw new Exception("You can only register things during the 'Register' step");
            }

            if (!CLASS_LISTING.ContainsKey(type))
            {
                GuuCore.LOGGER.LogError($"The identifiable type {type} is already registered");
                return;
            }

            CLASS_LISTING.Add(type, hashSet);
        }
        /// <summary>
        /// The assemble identifiable.
        /// </summary>
        /// <param name="assembleInto">
        /// The assemble into.
        /// </param>
        /// <param name="assembleFrom">
        /// The assemble from.
        /// </param>
        public void AssembleIdentifiable(IdentifiableType assembleInto, IIdentifiableObject assembleFrom)
        {
            if (this.HasAnnotations(assembleFrom))
            {
                assembleInto.Annotations = new Annotations(this.GetAnnotationsType(assembleFrom));
            }

            string str0 = assembleFrom.Id;
            if (!string.IsNullOrWhiteSpace(str0))
            {
                assembleInto.id = assembleFrom.Id;
            }

            if (assembleFrom.Uri != null)
            {
                assembleInto.uri = assembleFrom.Uri;
            }

            assembleInto.urn = assembleFrom.Urn;
        }
コード例 #4
0
 /// <summary>
 /// Organizes the identifiable by adding it to its list
 /// </summary>
 /// <param name="id">The ID to organize</param>
 /// <param name="type">The type of identifiable</param>
 public virtual void Organize(Identifiable.Id id, IdentifiableType type) => IdentifiableRegistry.AddToType(id, type);
コード例 #5
0
 /// <summary>
 /// Checks if an identifiable is from a type
 /// </summary>
 /// <param name="id">The id of the identifiable to check</param>
 /// <param name="type">The type of identifiable to check for</param>
 /// <returns>True if it is a valid type, false otherwise</returns>
 public static bool IsTypeValid(Identifiable.Id id, IdentifiableType type) => CLASS_LISTING.ContainsKey(type) && CLASS_LISTING[type].Contains(id);
コード例 #6
0
        ///////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////BUILD FROM READER                    //////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////    
        // public IdentifiableCore(SdmxStructureType structure, SdmxReader reader, ISdmxStructure parent) {
        // super(structure, reader, parent);
        // id = reader.getAttributeValue("id", true);
        // if(reader.getAttributeValue("uri", false) != null) {
        // setUri(reader.getAttributeValue("uri", false));
        // }
        // }

        ///////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////BUILD FROM V2.1 SCHEMA                 //////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Initializes a new instance of the <see cref="IdentifiableCore"/> class.
        /// </summary>
        /// <param name="createdFrom">
        /// The created from.
        /// </param>
        /// <param name="structureType">
        /// The structure type.
        /// </param>
        /// <param name="parent">
        /// The parent.
        /// </param>
        protected IdentifiableCore(IdentifiableType createdFrom, SdmxStructureType structureType, ISdmxStructure parent)
            : base(createdFrom, structureType, parent)
        {
            this._id = createdFrom.id;
            this.Uri = createdFrom.uri;
            this.ValidateIdentifiableAttributes();
        }