예제 #1
0
        /// <see cref="AddReceptacle" />
        /// <exception cref="ArgumentException">Caso os argumentos estejam
        /// incorretos</exception>
        /// <exception cref="ArgumentNullException">Caso os argumentos estejam
        /// nulos</exception>
        public void AddReceptacle(String name, String interfaceName, Boolean isMultiple)
        {
            if (String.IsNullOrEmpty(name))
            {
                throw new ArgumentException("O campo 'name' não pode ser nulo ou vazio.", "name");
            }

            if (receptacles.ContainsKey(name))
            {
                throw new ReceptacleAlreadyExistsException(name);
            }
            Receptacle receptacle = new Receptacle(name, interfaceName, isMultiple);

            receptacles[name] = receptacle;
        }
예제 #2
0
        /// <see cref="Equals" />
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }
            Receptacle receptacle = (Receptacle)obj;

            if (this.name != receptacle.name)
            {
                return(false);
            }
            if (this.interfaceName != receptacle.interfaceName)
            {
                return(false);
            }
            if (this.isMultiple != receptacle.isMultiple)
            {
                return(false);
            }
            return(true);
        }
예제 #3
0
        /// <see cref="Equals" />
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }

            ComponentContext            objContext = (ComponentContext)obj;
            IDictionary <string, Facet> objFacets  = objContext.GetFacets();

            if (this.facets.Count != objFacets.Count)
            {
                return(false);
            }
            foreach (Facet facet in this.facets.Values)
            {
                if (!objFacets.ContainsKey(facet.Name))
                {
                    return(false);
                }
                Facet objFacet = objFacets[facet.Name];
                if (!facet.Equals(objFacet))
                {
                    return(false);
                }
            }

            IDictionary <string, Receptacle> objReceptacles = objContext.GetReceptacles();

            if (this.receptacles.Count != objReceptacles.Count)
            {
                return(false);
            }
            foreach (Receptacle receptacle in this.receptacles.Values)
            {
                if (!objReceptacles.ContainsKey(receptacle.Name))
                {
                    return(false);
                }
                Receptacle objReceptacle = objReceptacles[receptacle.Name];
                if (!receptacle.Equals(objReceptacle))
                {
                    return(false);
                }
            }

            if (this.componentId.name != objContext.GetComponentId().name)
            {
                return(false);
            }
            if (this.componentId.major_version != objContext.GetComponentId().major_version)
            {
                return(false);
            }
            if (this.componentId.minor_version != objContext.GetComponentId().minor_version)
            {
                return(false);
            }
            if (this.componentId.patch_version != objContext.GetComponentId().patch_version)
            {
                return(false);
            }
            if (this.componentId.platform_spec != objContext.GetComponentId().platform_spec)
            {
                return(false);
            }

            return(true);
        }