Example #1
0
        public override void CopyFrom(YqlNode source)
        {
            base.CopyFrom(source);
            var castedSource = (YqlPropertyNode)source;

            AbstractPropertyId = castedSource.AbstractPropertyId;
        }
Example #2
0
 internal static void RegisterXmlElements()
 {
     foreach (YqlOperation value in Enum.GetValues(typeof(YqlOperation)))
     {
         YqlNode.RegisterXmlElement(typeof(YqlOperationNode), value.ToString());
     }
 }
Example #3
0
        public override void CopyFrom(YqlNode source)
        {
            base.CopyFrom(source);
            var castedSource = (YqlValueNode)source;

            Value = castedSource.Value;
        }
Example #4
0
        public override void CopyFrom(YqlNode source)
        {
            base.CopyFrom(source);
            var castedSource = (YqlListContainsNode)source;

            this.List       = CloneIfNotNull(castedSource.List);
            this.ItemToFind = CloneIfNotNull(castedSource.ItemToFind);
        }
Example #5
0
 public static YqlNode CloneIfNotNull(YqlNode source)
 {
     if (source == null)
     {
         return(null);
     }
     return(source.Clone());
 }
Example #6
0
 internal static XElement SaveToXmlOrNull(YqlNode node)
 {
     if (node == null)
     {
         return(null);
     }
     return(node.SaveToXml());
 }
Example #7
0
 public YqlTextMatchNode(YqlNode sourceString,
                         string searchText, bool wholeWords, bool matchAllWords)
 {
     this.SourceString  = sourceString;
     this.SearchText    = searchText;
     this.WholeWords    = wholeWords;
     this.MatchAllWords = matchAllWords;
 }
Example #8
0
        public override void CopyFrom(YqlNode source)
        {
            base.CopyFrom(source);
            var castedSource = (YqlListNode)source;

            this.Items.Clear();
            this.Items.AddRange(castedSource.Items.Select(x => x.Clone()));
        }
Example #9
0
        public override void CopyFrom(YqlNode source)
        {
            base.CopyFrom(source);
            var castedSource = (YqlObjectActionNode)source;

            this.TargetObject     = YqlNode.CloneIfNotNull(castedSource.TargetObject);
            this.TargetObjectType = castedSource.TargetObjectType;
        }
Example #10
0
        public override void CopyFrom(YqlNode source)
        {
            base.CopyFrom(source);
            var castedSource = (YqlOperationNode)source;

            Operation = castedSource.Operation;
            Args.Clear();
            Args.AddRange(castedSource.Args.Select(x => x.Clone()));
        }
Example #11
0
 public YqlCompiledNode(YqlNode node, Expression expression, IEnumerable <YqlCompiledNode> compiledArgs)
 {
     if (node == null)
     {
         throw new ArgumentNullException("node");
     }
     this.Node         = node;
     this.Expression   = expression;
     this.CompiledArgs = new ReadOnlyCollection <YqlCompiledNode>(compiledArgs.ToArray());
 }
Example #12
0
        public override void CopyFrom(YqlNode source)
        {
            base.CopyFrom(source);
            var castedSource = (YqlTextMatchNode)source;

            this.SourceString  = castedSource.SourceString;
            this.SearchText    = castedSource.SearchText;
            this.WholeWords    = castedSource.WholeWords;
            this.MatchAllWords = castedSource.MatchAllWords;
        }
Example #13
0
        public YqlNode Clone()
        {
#if true
            YqlNode clonedNode = (YqlNode)Activator.CreateInstance(GetType());
            clonedNode.CopyFrom(this);
#else
            XElement xxx = this.SaveToXml();
            Debug.WriteLine(xxx.ToString());
            YqlNode clonedNode = YqlNode.LoadFromXml(xxx);
#endif
            return(clonedNode);
        }
Example #14
0
        internal static YqlNode LoadFromXml(XElement element)
        {
            if (element == null)
            {
                return(null);
            }
            Type    type = xmlNameToType[element.Name.ToString()];
            YqlNode node = (YqlNode)Activator.CreateInstance(type);

            node.LoadXmlElement(element);
            return(node);
        }
Example #15
0
        internal Func <YqlExecutionContext, bool> CompileMessage(YqlNode rootNode)
        {
            var compiledNode = CompileNode(rootNode.Clone());
            //Debug.WriteLine(compiledNode.Expression.ToString());
            //Debug.WriteLine("-------");
            var lambda = Expression.Lambda <Func <YqlExecutionContext, bool> >(compiledNode.Expression, ExecutionContextParameter);
            //Debug.WriteLine(lambda.ToString());
            //Debug.WriteLine("-------");
            Func <YqlExecutionContext, bool> func = lambda.Compile();

            return(func);
        }
Example #16
0
        internal static void RegisterXmlElements(YamsterModelType modelType,
                                                 Type classType, Type enumType)
        {
            if (!typeof(YqlPropertyNode).IsAssignableFrom(classType))
            {
                throw new ArgumentException("The classType must inherit from YqlPropertyNode");
            }
            if (!enumType.IsEnum)
            {
                throw new ArgumentException("The enumType must be an enum");
            }

            foreach (Enum enumValue in Enum.GetValues(enumType))
            {
                // E.g. "Message_UserIdRepliedTo"
                string xmlName = modelType.ToString() + "_" + enumValue.ToString();
                YqlNode.RegisterXmlElement(classType, xmlName);
            }
        }
Example #17
0
        internal static void RegisterXmlElements()
        {
            var typeCodes = new TypeCode[]
            {
                TypeCode.Boolean,
                TypeCode.DateTime,
                TypeCode.Int16,
                TypeCode.Int32,
                TypeCode.Int64,
                TypeCode.UInt16,
                TypeCode.UInt32,
                TypeCode.UInt64,
                TypeCode.String
            };

            foreach (TypeCode typeCode in typeCodes)
            {
                YqlNode.RegisterXmlElement(typeof(YqlValueNode), typeCode.ToString());
            }
        }
Example #18
0
 public YamsterThreadQuery(string title, YqlNode filterNode)
     : base(title, filterNode)
 {
 }
Example #19
0
 public virtual void CopyFrom(YqlNode source)
 {
     this.SourceLocation = source.SourceLocation;
 }
Example #20
0
 public virtual void CopyFrom(YamsterModelQuery source)
 {
     this.Title      = source.Title;
     this.FilterNode = YqlNode.CloneIfNotNull(source.FilterNode);
 }
Example #21
0
 public YqlCompiledNode(YqlNode node, Expression expression)
     : this(node, expression, new YqlCompiledNode[0])
 {
 }
Example #22
0
 protected YqlPropertyNode(PropertyMapping mapping, YamsterModelType targetObjectType, YqlNode targetObject)
     : base(targetObjectType, targetObject)
 {
     this.Mapping = mapping;
 }
Example #23
0
 public YqlUserPropertyNode(YqlUserProperty propertyId, YqlNode targetObject = null)
     : base(UserMapping, YamsterModelType.User, targetObject)
 {
     this.PropertyId = propertyId;
 }
Example #24
0
 public YqlMessagePropertyNode(YqlMessageProperty propertyId, YqlNode targetObject = null)
     : base(MessageMapping, YamsterModelType.Message, targetObject)
 {
     this.PropertyId = propertyId;
 }
Example #25
0
 public YqlThreadPropertyNode(YqlThreadProperty propertyId, YqlNode targetObject = null)
     : base(ThreadMapping, YamsterModelType.Thread, targetObject)
 {
     this.PropertyId = propertyId;
 }
Example #26
0
 public YamsterMessageQuery(string title, YqlNode filterNode)
     : base(title, filterNode)
 {
 }
Example #27
0
 protected void LoadFromXml(XElement element)
 {
     this.Title      = XmlUtilities.GetStringAttribute(element, "Title");
     this.FilterNode = YqlNode.LoadFromXml(XmlUtilities.GetChildElement(element, "FilterNode"));
 }
Example #28
0
 protected override void LoadXmlElement(XElement element)
 {
     this.List       = LoadFromXmlOrNull(element, "List");
     this.ItemToFind = LoadFromXmlOrNull(element, "ItemToFind");
 }
Example #29
0
 public YqlCompiledNode CompileNode(YqlNode node)
 {
     return(node.CompileNode(this));
 }
Example #30
0
 public YamsterModelQuery(string title, YqlNode filterNode)
 {
     this.Title      = title;
     this.FilterNode = filterNode;
 }