Exemple #1
0
            public static DuplicateName GetToken()
            {
                if (_token == null)
                {
                    _token = new DuplicateName();
                }

                return(_token);
            }
Exemple #2
0
        protected void registerUniqueNames(string fullVarName)
        {
            string[]  names   = fullVarName.Split(NAME_SEPARATORS);
            Hashtable current = _varTable;

            if (names[0] != _specName)
            {
                throw new FormatException("Object name does not start with unique appliance name.");
            }

            string fullName = names[0] + GroupNode.NAME_SEPARATOR;

            for (int i = 1; i < names.Length; i++)
            {
                fullName += names[i];

                if (_uniqueNameTable[names[i]] == null)
                {
                    // we have identified a unique name
                    _uniqueNameTable[names[i]] = fullName;
                }
                else
                {
                    // we may have identified a duplicate name

                    // first check to see if the name is registered as not being unique
                    if (!(_uniqueNameTable[names[i]] is DuplicateName))
                    {
                        // it is not, so now check if this name and the registered one
                        // point to the same instance
                        if (((string)_uniqueNameTable[names[i]]) != fullName)
                        {
                            // our name and the one in the table represent different
                            // instances, so put in a DuplicateName token
                            _uniqueNameTable[names[i]] = DuplicateName.GetToken();
                        }
                    }
                }

                fullName += GroupNode.NAME_SEPARATOR;
            }
        }