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);
}