public override void Attach(
            EventType parentEventType,
            int streamNumber,
            ViewForgeEnv viewForgeEnv)
        {
            var validated = ViewForgeSupport.Validate(
                ViewName,
                parentEventType,
                viewParameters,
                true,
                viewForgeEnv,
                streamNumber);
            if (validated.Length < 1) {
                throw new ViewParameterException(ViewParamMessage);
            }

            if (!validated[0].Forge.EvaluationType.IsNumeric()) {
                throw new ViewParameterException(ViewParamMessage);
            }

            fieldExpression = validated[0];

            additionalProps = StatViewAdditionalPropsForge.Make(validated, 1, parentEventType, streamNumber, viewForgeEnv);
            eventType = UnivariateStatisticsView.CreateEventType(additionalProps, viewForgeEnv, streamNumber);
        }
예제 #2
0
        public override void Attach(
            EventType parentEventType,
            int streamNumber,
            ViewForgeEnv viewForgeEnv)
        {
            var validated = ViewForgeSupport.Validate(
                ViewName,
                parentEventType,
                viewParameters,
                true,
                viewForgeEnv,
                streamNumber);

            if (validated.Length < 2) {
                throw new ViewParameterException(ViewParamMessage);
            }

            if (!validated[0].Forge.EvaluationType.IsNumeric() || !validated[1].Forge.EvaluationType.IsNumeric()) {
                throw new ViewParameterException(ViewParamMessage);
            }

            fieldNameX = validated[0];
            fieldNameWeight = validated[1];
            additionalProps = StatViewAdditionalPropsForge.Make(validated, 2, parentEventType, streamNumber, viewForgeEnv);
            eventType = WeightedAverageView.CreateEventType(additionalProps, viewForgeEnv, streamNumber);
        }
예제 #3
0
        public override void Attach(
            EventType parentEventType,
            int streamNumber,
            ViewForgeEnv viewForgeEnv)
        {
            ExprNode[] validated = ViewForgeSupport.Validate(
                ViewName,
                parentEventType,
                viewParameters,
                true,
                viewForgeEnv,
                streamNumber);

            if (validated.Length < 2) {
                throw new ViewParameterException(ViewParamMessage);
            }

            if ((!TypeHelper.IsNumeric(validated[0].Forge.EvaluationType)) ||
                (!TypeHelper.IsNumeric(validated[1].Forge.EvaluationType))) {
                throw new ViewParameterException(ViewParamMessage);
            }

            expressionX = validated[0];
            expressionY = validated[1];

            additionalProps = StatViewAdditionalPropsForge.Make(validated, 2, parentEventType, streamNumber, viewForgeEnv);
            eventType = RegressionLinestView.CreateEventType(additionalProps, viewForgeEnv, streamNumber);
        }
예제 #4
0
 protected internal static EventType CreateEventType(
     StatViewAdditionalPropsForge additionalProps,
     ViewForgeEnv viewForgeEnv,
     int streamNum)
 {
     var eventTypeMap = new LinkedHashMap<string, object>();
     eventTypeMap.Put(ViewFieldEnum.CORRELATION__CORRELATION.GetName(), typeof(double?));
     StatViewAdditionalPropsForge.AddCheckDupProperties(
         eventTypeMap,
         additionalProps,
         ViewFieldEnum.CORRELATION__CORRELATION);
     return DerivedViewTypeUtil.NewType("correlview", eventTypeMap, viewForgeEnv, streamNum);
 }
예제 #5
0
파일: SizeView.cs 프로젝트: lanicon/nesper
 public static EventType CreateEventType(
     ViewForgeEnv env,
     StatViewAdditionalPropsForge additionalProps,
     int streamNum)
 {
     var schemaMap = new LinkedHashMap<string, object>();
     schemaMap.Put(ViewFieldEnum.SIZE_VIEW__SIZE.GetName(), typeof(long));
     StatViewAdditionalPropsForge.AddCheckDupProperties(
         schemaMap,
         additionalProps,
         ViewFieldEnum.SIZE_VIEW__SIZE);
     return DerivedViewTypeUtil.NewType("sizeview", schemaMap, env, streamNum);
 }
예제 #6
0
 public override void Attach(
     EventType parentEventType,
     int streamNumber,
     ViewForgeEnv viewForgeEnv)
 {
     var validated = ViewForgeSupport.Validate(
         ViewName,
         parentEventType,
         viewParameters,
         true,
         viewForgeEnv,
         streamNumber);
     additionalProps = StatViewAdditionalPropsForge.Make(validated, 0, parentEventType, streamNumber, viewForgeEnv);
     eventType = SizeView.CreateEventType(viewForgeEnv, additionalProps, streamNumber);
 }
        public static void AddCheckDupProperties(
            IDictionary<string, object> target,
            StatViewAdditionalPropsForge addProps,
            params ViewFieldEnum[] builtin)
        {
            if (addProps == null) {
                return;
            }

            for (var i = 0; i < addProps.AdditionalProps.Length; i++) {
                var name = addProps.AdditionalProps[i];
                for (var j = 0; j < builtin.Length; j++) {
                    if (name.Equals(builtin[j].GetName(), StringComparison.InvariantCultureIgnoreCase)) {
                        throw new ArgumentException(
                            "The property by name '" + name + "' overlaps the property name that the view provides");
                    }
                }

                target.Put(name, addProps.AdditionalTypes[i]);
            }
        }