DotNetXri.Syntax.Xri3.Impl.XRI3.isIName C# (CSharp) Method

isIName() public method

public isIName ( ) : bool
return bool
        public bool isIName()
        {
            IList<XRI3SubSegment> subSegments = this.authority.SubSegments;

            // all subsegments must be reassignable

            for (int i = 0; i < subSegments.Count; i++)
            {
                XRI3SubSegment subSegment = subSegments[i];
                if (!subSegment.isReassignable())
                    return (false);
            }

            // some additional rules for i-names

            string spelling = this.authority.ToString();

            if (spelling.StartsWith("."))
                return (false);
            if (spelling.EndsWith("."))
                return (false);
            if (spelling.StartsWith("-"))
                return (false);
            if (spelling.EndsWith("-"))
                return (false);
            if (spelling.IndexOf("..") >= 0)
                return (false);
            if (spelling.IndexOf("--") >= 0)
                return (false);
            if (spelling.IndexOf(".-") >= 0)
                return (false);
            if (spelling.IndexOf("-.") >= 0)
                return (false);
            if (spelling.IndexOf('%') >= 0)
                return (false);
            if (spelling.IndexOf('_') >= 0)
                return (false);
            if (spelling.Length > 254)
                return (false);

            return (true);
        }