示例#1
0
 public smartPtrFeatureBase(FeatureBase p) : this(libtischPINVOKE.new_smartPtrFeatureBase__SWIG_0(FeatureBase.getCPtr(p)), true)
 {
     if (libtischPINVOKE.SWIGPendingException.Pending)
     {
         throw libtischPINVOKE.SWIGPendingException.Retrieve();
     }
 }
示例#2
0
        public void Initialize()
        {
            Trace.WriteLine("Initializing System.Web.Providers");
            var dummy = new FeatureBase();

            Trace.WriteLine(string.Format("Instantiated {0}", dummy));
        }
示例#3
0
        public void Initialize()
        {
            Trace.WriteLine("Initializing Feature Base");
            var baseFeature = new FeatureBase();

            Trace.WriteLine(string.Format("Instantiated {0}", baseFeature));
        }
示例#4
0
        private System.Collections.Generic.List <string> GetModules(FeatureBase feature)
        {
            if (this.cacheModules.TryGetValue(feature, out var list) == false)
            {
                list = new System.Collections.Generic.List <string>();
                var script = MonoScript.FromScriptableObject(feature);
                var text   = script.text;

                var matches = System.Text.RegularExpressions.Regex.Matches(text, @"AddModule\s*\<(.*?)\>");
                foreach (System.Text.RegularExpressions.Match match in matches)
                {
                    if (match.Groups.Count > 0)
                    {
                        var systemType = match.Groups[1].Value;
                        var spl        = systemType.Split('.');
                        systemType = spl[spl.Length - 1];
                        list.Add(systemType);
                    }
                }

                this.cacheModules.Add(feature, list);
            }

            return(list);
        }
示例#5
0
        private double getPointwiseMutualInformation(RulePart rulePart, FeatureBase feature)
        {
            var ruleProbability       = P(rulePart);
            var featureProbability    = P(feature);
            var coocurenceProbability = P(rulePart, feature);

            return(Math.Log(coocurenceProbability / (ruleProbability * featureProbability + StabilizationConstant) + StabilizationConstant));
        }
示例#6
0
        private double P(FeatureBase feature)
        {
            var allFeatureCount = _registeredFeatures.Count;
            int featureCount;

            _registeredFeatures.TryGetValue(feature, out featureCount);

            return(1.0 * featureCount / (1 + allFeatureCount));
        }
示例#7
0
        public static double IsValueInStatsMetric(FeatureBase value, IFeatureCollectionWrapper <FeatureBase> featureValues)
        {
            if (value.FeatureValue.Equals(-1.0) || !featureValues.Any())
            {
                return(0);
            }

            return(featureValues.Any(feature => value.FeatureValue.Equals(feature.FeatureValue))? 0.0 : 1.0);
        }
示例#8
0
    public FeatureBase __ref__()
    {
        FeatureBase ret = new FeatureBase(libtischPINVOKE.smartPtrFeatureBase___ref__(swigCPtr), false);

        if (libtischPINVOKE.SWIGPendingException.Pending)
        {
            throw libtischPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
示例#9
0
    public virtual FeatureBase clone()
    {
        IntPtr      cPtr = libtischPINVOKE.FeatureBase_clone(swigCPtr);
        FeatureBase ret  = (cPtr == IntPtr.Zero) ? null : new FeatureBase(cPtr, false);

        if (libtischPINVOKE.SWIGPendingException.Pending)
        {
            throw libtischPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
示例#10
0
    public new static MultiBlobScale dynamic_cast(FeatureBase arg0)
    {
        IntPtr         cPtr = libtischPINVOKE.MultiBlobScale_dynamic_cast(FeatureBase.getCPtr(arg0));
        MultiBlobScale ret  = (cPtr == IntPtr.Zero) ? null : new MultiBlobScale(cPtr, false);

        if (libtischPINVOKE.SWIGPendingException.Pending)
        {
            throw libtischPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
示例#11
0
    public new static Rotation dynamic_cast(FeatureBase arg0)
    {
        IntPtr   cPtr = libtischPINVOKE.Rotation_dynamic_cast(FeatureBase.getCPtr(arg0));
        Rotation ret  = (cPtr == IntPtr.Zero) ? null : new Rotation(cPtr, false);

        if (libtischPINVOKE.SWIGPendingException.Pending)
        {
            throw libtischPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
示例#12
0
    public FeatureBase __deref__()
    {
        IntPtr      cPtr = libtischPINVOKE.smartPtrFeatureBase___deref__(swigCPtr);
        FeatureBase ret  = (cPtr == IntPtr.Zero) ? null : new FeatureBase(cPtr, false);

        if (libtischPINVOKE.SWIGPendingException.Pending)
        {
            throw libtischPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
示例#13
0
    public static FeatureVector dynamic_cast(FeatureBase arg0)
    {
        IntPtr        cPtr = libtischPINVOKE.FeatureVector_dynamic_cast(FeatureBase.getCPtr(arg0));
        FeatureVector ret  = (cPtr == IntPtr.Zero) ? null : new FeatureVector(cPtr, false);

        if (libtischPINVOKE.SWIGPendingException.Pending)
        {
            throw libtischPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
示例#14
0
        private double P(RulePart rule, FeatureBase feature)
        {
            int coocurenceCount;
            int featureCount;

            _registeredFeatures.TryGetValue(feature, out featureCount);
            _registeredRulePartFeaturePairs.TryGetValue(Tuple.Create(rule, feature), out coocurenceCount);

            var pModel = 1.0 * coocurenceCount / (1 + featureCount);

            var heuristicModel = P_Heuristic(rule, feature);

            return(HeuristicProbabilityWeight * heuristicModel + (1.0 - HeuristicProbabilityWeight) * pModel);
        }
示例#15
0
        public void Get_FeatureName_ReturnsFeature()
        {
            // arrange
            FeatureManager featureManager = new FeatureManager();

            featureManager.Add(new Feature <int>("F1"));

            // act
            FeatureBase feature = featureManager.Get("F1");
            Type        type    = feature.GetFeatureType();

            // assert
            Assert.IsNotNull(feature);
            Assert.AreEqual(feature.Name, "F1");
            Assert.AreEqual(typeof(int), type);
        }
示例#16
0
        public static double First3BEqualMetric(FeatureBase value, IFeatureCollectionWrapper <FeatureBase> featureValues)
        {
            if (value.FeatureValue.Equals(-1.0) || !featureValues.Any())
            {
                return(0);
            }
            var tmpTrue  = featureValues.Count(x => x.FeatureValue.Equals(1.0));
            var tmpFalse = featureValues.Count(x => x.FeatureValue.Equals(0.0));

            Console.WriteLine("3Bequal " + tmpTrue + " " + tmpFalse + " FeatureValue: " + value.FeatureValue);
            if ((tmpTrue > tmpFalse && value.FeatureValue.Equals(1.0)) || (tmpTrue < tmpFalse && value.FeatureValue.Equals(0.0)))
            {
                return(0.0);
            }

            return(1.0);
        }
示例#17
0
        public FeatureViewModel(FeatureBase feature, IFeatureController featureController)
        {
            _feature           = feature;
            _featureController = featureController;

            var canAddFeature = _featureController.SelectedFeatures
                                .Connect()
                                .QueryWhenChanged(CanAddFeature);

            canAddFeature = canAddFeature.StartWith(true);

            AddFeatureCommand = ReactiveCommand.Create <bool>(AddFeature, canAddFeature);

            _featureController.SelectedFeatures
            .Connect()
            .QueryWhenChanged(x => x.Contains(_feature))
            .ToPropertyEx(this, x => x.IsFeatureSelected);
        }
示例#18
0
        /// <summary>
        /// Tests the common functionality across all ML.Feature classes.
        /// </summary>
        /// <param name="testObject">The object that implemented FeatureBase</param>
        /// <param name="paramName">The name of a parameter that can be set on this object</param>
        /// <param name="paramValue">A parameter value that can be set on this object</param>
        public void TestFeatureBase(
            FeatureBase <T> testObject,
            string paramName,
            object paramValue)
        {
            Assert.NotEmpty(testObject.ExplainParams());

            Param param = testObject.GetParam(paramName);

            Assert.NotEmpty(param.Doc);
            Assert.NotEmpty(param.Name);
            Assert.Equal(param.Parent, testObject.Uid());

            Assert.NotEmpty(testObject.ExplainParam(param));
            testObject.Set(param, paramValue);
            Assert.IsAssignableFrom <Identifiable>(testObject.Clear(param));

            Assert.IsType <string>(testObject.Uid());
        }
示例#19
0
        public static double DistanceMetric(FeatureBase value, IFeatureCollectionWrapper <FeatureBase> featureValues)
        {
            if (value.FeatureValue.Equals(-1.0) || !featureValues.Any())
            {
                return(0);
            }
            var result = Math.Abs(value.FeatureValue - featureValues.First().FeatureValue);

            foreach (var stat in featureValues.Skip(1))
            {
                var d = Math.Abs(value.FeatureValue - stat.FeatureValue);
                if (d < result)
                {
                    result = d;
                }
            }
            //Console.WriteLine("Distance " + result + " value: " + value.FeatureValue);
            return(result);
        }
示例#20
0
        public void Add_OneFeature_ReturnsTrue()
        {
            // arrange
            FeatureBase    featureBase    = null;
            FeatureManager featureManager = new FeatureManager();

            featureManager.FeatureAdded += (s, e) =>
            {
                featureBase = e as FeatureBase;
            };
            Feature <int> feature = new Feature <int>("F");

            // act
            bool r = featureManager.Add(feature);

            // assert
            Assert.AreEqual(true, r);
            Assert.IsNotNull(featureBase);
            Assert.AreEqual("F", featureBase.Name);
        }
示例#21
0
 /// <summary>
 /// 指定フィーチャーのトークンリスナーに指定IDが含まれているかどうか調べる
 /// </summary>
 /// <param name="fo"></param>
 /// <param name="tokenid"></param>
 /// <returns></returns>
 public static bool ContainsTokenID(FeatureBase fo, NamedId tokenid)
 {
     if (fo is ITokenListener)
     {
         if (((ITokenListener)fo).TokenTriggerID == tokenid)
         {
             return(true);
         }
     }
     if (fo is IMultiTokenListener)
     {
         foreach (var fid in ((IMultiTokenListener)fo).MultiTokenTriggerID)
         {
             if (fid == tokenid)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
示例#22
0
        protected override IRecord ReadNextRecord()
        {
            if (_reader == null || (_reader.Name != this.ValuesRowElement))
            {
                return(null);
            }
            else
            {
                if (_recDoc == null)
                {
                    _recDoc = new XmlDocument();
                }

                //TODO: We can probably make this more efficient.
                _recDoc.LoadXml(_reader.ReadOuterXml());
                var propertyNodeList = _recDoc[this.ValuesRowElement].SelectNodes(this.ValuesRowPropertyElement);
                var rec  = new XmlRecord(_properties, _wktReader, propertyNodeList, this.ValuesRowPropertyNameElement, this.ValuesRowPropertyValueElement);
                var feat = new FeatureBase(this.ClassDefinition);
                feat.Update(rec);
                return(feat);
            }
        }
示例#23
0
        /// <summary>
        /// トークンを追加(予約)する。これはFlushを実行したときに、本当に追加される
        /// </summary>
        /// <param name="id">トークンに付けた名前</param>
        /// <param name="from">トークンを追加したクラス</param>
        public void Add(NamedId id, FeatureBase from)
        {
            System.Diagnostics.Debug.Assert(id != null, "ffTokenTray.Addにnull id を指定しないでください");
            lock (_dat.SyncRoot)
            {
                _dat[id] = from;
            }

            // トークン処理中にトークン追加された場合、起動済みフィーチャーを解除して、そのフィーチャーをもう一度起動できるようにする
            IList dels = new ArrayList();

            foreach (FeatureBase fo in TokenInvokedChecker.Keys) // fo = 起動済みフィーチャー
            {
                if (ContainsTokenID(fo, id))
                {
                    dels.Add(fo);
                }
            }
            foreach (FeatureBase fo in dels)
            {
                TokenInvokedChecker.Remove(fo);
            }
        }
示例#24
0
 /// <summary>
 /// 指定フィーチャーが要求するリスナーがTokenTrayにあるかどうかを調査する
 /// </summary>
 /// <param name="value">調査対象とするフィーチャー</param>
 /// <returns>true = 含まれている / false = 含まれない</returns>
 public bool Contains(FeatureBase value)
 {
     lock (_dat.SyncRoot)
     {
         var ret = false;
         if (value is ITokenListener)
         {
             ret = _dat.Contains(((ITokenListener)value).TokenTriggerID);
         }
         if (!ret && value is IMultiTokenListener)
         {
             foreach (var id in ((IMultiTokenListener)value).MultiTokenTriggerID)
             {
                 ret = _dat.Contains(id);
                 if (ret)
                 {
                     break;
                 }
             }
         }
         return(ret);
     }
 }
示例#25
0
 public Chat(FeatureBase featureBase)
 {
     _featureBase = featureBase;
     _firefox = featureBase.Firefox;
 }
示例#26
0
 public ProductPage(FeatureBase featureBase)
 {
     _featureBase = featureBase;
     _firefox = _featureBase.Firefox;
 }
示例#27
0
 internal StatusTray(FeatureBase parent)
 {
     _parent = parent;
 }
示例#28
0
 internal static HandleRef getCPtr(FeatureBase obj) {
   return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
示例#29
0
 private int GetModulesCount(FeatureBase feature)
 {
     return(this.GetModules(feature).Count);
 }
 public FeatureBase __ref__() {
   FeatureBase ret = new FeatureBase(libtischPINVOKE.smartPtrFeatureBase___ref__(swigCPtr), false);
   if (libtischPINVOKE.SWIGPendingException.Pending) throw libtischPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
示例#31
0
 private int GetSystemsCount(FeatureBase feature)
 {
     return(this.GetSystems(feature).Count);
 }
示例#32
0
 public TagFeatureSwitch(FeatureBase fc, bool featureSw)
 {
     switchingFeatureID = fc.ID;
     sw = featureSw;
 }
示例#33
0
 public SignInPage(FeatureBase featureBase)
 {
     _firefox = featureBase.Firefox;
     _featureBase = featureBase;
 }
 public smartPtrFeatureBase(FeatureBase p) : this(libtischPINVOKE.new_smartPtrFeatureBase__SWIG_0(FeatureBase.getCPtr(p)), true) {
   if (libtischPINVOKE.SWIGPendingException.Pending) throw libtischPINVOKE.SWIGPendingException.Retrieve();
 }
 public new static MultiBlobScale dynamic_cast(FeatureBase arg0) {
   IntPtr cPtr = libtischPINVOKE.MultiBlobScale_dynamic_cast(FeatureBase.getCPtr(arg0));
   MultiBlobScale ret = (cPtr == IntPtr.Zero) ? null : new MultiBlobScale(cPtr, false);
   if (libtischPINVOKE.SWIGPendingException.Pending) throw libtischPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static extern void FeatureBase_director_connect(HandleRef jarg1, FeatureBase.SwigDelegateFeatureBase_0 delegate0, FeatureBase.SwigDelegateFeatureBase_1 delegate1, FeatureBase.SwigDelegateFeatureBase_2 delegate2, FeatureBase.SwigDelegateFeatureBase_3 delegate3, FeatureBase.SwigDelegateFeatureBase_4 delegate4, FeatureBase.SwigDelegateFeatureBase_5 delegate5);
示例#37
0
 internal FeaturedRule(FeatureBase feature, ContextRule rule)
 {
     Feature = feature;
     Rule    = rule;
 }
示例#38
0
 public new static BlobPos dynamic_cast(FeatureBase arg0) {
   IntPtr cPtr = libtischPINVOKE.BlobPos_dynamic_cast(FeatureBase.getCPtr(arg0));
   BlobPos ret = (cPtr == IntPtr.Zero) ? null : new BlobPos(cPtr, false);
   if (libtischPINVOKE.SWIGPendingException.Pending) throw libtischPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
示例#39
0
 protected static void AssertDistanceValue(FeatureBase feature, double distance, double expectedValue)
 {
     Assert.AreEqual(expectedValue, distance, $"{feature.GetType().Name} - ComputeDistanceToProtocolModel returned incorrect value in {feature.FlowDirection} direction.");
 }
 public static FeatureVector dynamic_cast(FeatureBase arg0) {
   IntPtr cPtr = libtischPINVOKE.FeatureVector_dynamic_cast(FeatureBase.getCPtr(arg0));
   FeatureVector ret = (cPtr == IntPtr.Zero) ? null : new FeatureVector(cPtr, false);
   if (libtischPINVOKE.SWIGPendingException.Pending) throw libtischPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }