Beispiel #1
0
 public void Reset()
 {
     Origin = Origins.NotDefined;
     Value  = 0;
     Possibles.SetAllTo(true);
     HorizontalDirections.SetAllTo(false);
     VerticalDirections.SetAllTo(false);
 }
Beispiel #2
0
        /// <summary>
        /// Uses Levenshtein Distance to determine the closest string.  Outputs the string and the distance
        /// </summary>
        /// <param name="context"></param>
        protected override void Execute(NativeActivityContext context)
        {
            LevenshteinEngine engine = new LevenshteinEngine(BaseString.Get(context));
            Boolean           first  = true;

            foreach (String possible in Possibles.Get(context))
            {
                int currentDistance = engine.Distance(possible);

                if (currentDistance < Distance.Get(context) || first)
                {
                    Distance.Set(context, currentDistance);
                    SelectedString.Set(context, possible);
                }
                first = false;
            }
        }