コード例 #1
0
ファイル: CodeValue.cs プロジェクト: russlank/Prolog.NET
        public new static CodeValue Create(XElement xCodeValue)
        {
            foreach (var xSubtype in xCodeValue.Elements())
            {
                if (xSubtype.Name == CodeValueNumeric.ElementName)
                {
                    return(CodeValueNumeric.Create(xSubtype));
                }
                if (xSubtype.Name == CodeValueBoolean.ElementName)
                {
                    return(CodeValueBoolean.Create(xSubtype));
                }
                if (xSubtype.Name == CodeValueDateTime.ElementName)
                {
                    return(CodeValueDateTime.Create(xSubtype));
                }
                if (xSubtype.Name == CodeValueException.ElementName)
                {
                    return(CodeValueException.Create(xSubtype));
                }
                if (xSubtype.Name == CodeValueString.ElementName)
                {
                    return(CodeValueString.Create(xSubtype));
                }
                if (xSubtype.Name == CodeValueType.ElementName)
                {
                    return(CodeValueType.Create(xSubtype));
                }
                if (xSubtype.Name == CodeValueObject.ElementName)
                {
                    return(CodeValueObject.Create(xSubtype));
                }

                throw new InvalidOperationException(string.Format("Unknown subtype element {0}", xSubtype.Name));
            }

            throw new InvalidOperationException("No subtype element specified.");
        }
コード例 #2
0
 public override bool Equals(CodeValueNumeric other)
 {
     return(Equals(other as CodeValueDouble));
 }