当前位置: 首页>>代码示例>>C#>>正文


C# Automaton类代码示例

本文整理汇总了C#中Automaton的典型用法代码示例。如果您正苦于以下问题:C# Automaton类的具体用法?C# Automaton怎么用?C# Automaton使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Automaton类属于命名空间,在下文中一共展示了Automaton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PlaySound

 public void PlaySound(Automaton owner)
 {
     if (template.UseSFX > 0)
     {
         owner.PlaySound(template.UseSFX);
     }
 }
开发者ID:pb0,项目名称:ID0_Test,代码行数:7,代码来源:ItemCommands.cs

示例2: AutomatonQuery

 /// <summary>
 /// Create a new AutomatonQuery from an <seealso cref="Automaton"/>.
 /// </summary>
 /// <param name="term"> Term containing field and possibly some pattern structure. The
 ///        term text is ignored. </param>
 /// <param name="automaton"> Automaton to run, terms that are accepted are considered a
 ///        match. </param>
 public AutomatonQuery(Term term, Automaton automaton)
     : base(term.Field)
 {
     this.Term = term;
     this.Automaton_Renamed = automaton;
     this.Compiled = new CompiledAutomaton(automaton);
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:14,代码来源:AutomatonQuery.cs

示例3: CommandSet

 public CommandSet(Automaton owner, int capacity, bool autoFire, CommandSet pipe)
 {
     this.owner = owner;
     this.capacity = capacity;
     this.queue = new List<Command>();
     this.pipe = pipe;
 }
开发者ID:pb0,项目名称:ID0_Test,代码行数:7,代码来源:CommandSet.cs

示例4: State

 public State(State[] states, string regexPattern, bool isAcceptedState, Automaton automaton)
 {
     this.automaton = automaton;
     this.states = states == null ? null : new List<State>(states);
     this.pattern = regexPattern;
     this.isAcceptedState = isAcceptedState;
 }
开发者ID:jw56578,项目名称:WooCompiler,代码行数:7,代码来源:State.cs

示例5: GetDFARatio

        /// <summary>
        /// Computes the ratio of two dfas
        /// </summary>        
        /// <returns>size of dfa2/ size of dfa1</returns>
        internal static double GetDFARatio(Automaton<BDD> dfa1, Automaton<BDD> dfa2, HashSet<char> al, CharSetSolver solver, bool isSolDense)
        {
            var n = dfa1.StateCount;

            double multiplier = 3;
            int k = Math.Min(13, (int)(n * multiplier));

            int finalDivider = k;

            double[] paths1 = GetPathsUpToN(dfa1, al, solver, k);
            double[] paths2 = GetPathsUpToN(dfa2, al, solver, k);

            double sum = 0;
            for (int i = 0; i <= k; i++)
            {
                //TODO check grading still works
                double divider = Math.Min(paths1[i], Math.Pow(al.Count, i) - paths1[i]);
                if (divider != 0)
                    sum += (paths2[i] / divider);
                else
                {
                    sum += paths2[i];
                    if (paths2[i] == 0)
                        finalDivider--;
                }
            }

            return sum / (finalDivider + 1);
        }
开发者ID:AutomataTutor,项目名称:automatatutor-backend,代码行数:33,代码来源:DFADensity.cs

示例6: MoveSequence

 public MoveSequence(string regex)
 {
     solver = new CharSetSolver(BitWidth.BV7);
     moveAutomaton = solver.Convert("^(" + regex + ")$").Determinize(solver).Minimize(solver);
     currentState = 0;
     //solver.ShowGraph(moveAutomaton, "D");
     //ComputeDeadStates();
 }
开发者ID:mhusinsky,项目名称:prepose,代码行数:8,代码来源:MoveSequence.cs

示例7: MeasurementResultSet

        public readonly long elapsedTime; // in milliseconds

        //public readonly double densityDiffAverage, densityDifferenceDeviation;
        //public readonly double editDistanceAverage, editDistanceDeviation;

        public MeasurementResultSet(PDLPred originalFormula, IEnumerable<PDLPred> generatedFormulas, long time, VariableCache.ConstraintMode constraintmode, 
            PdlFilter.Filtermode filtermode, HashSet<char> alphabet, IDictionary<PDLPred, SingleMeasurementResult> cache,
            IDictionary<Automaton<BDD>, SingleMeasurementResult> automatonCache)
        {
            this.originalFormula = originalFormula;
            this.alphabet = alphabet;
            this.originalAutomaton = originalFormula.GetDFA(alphabet, new CharSetSolver());

            this.constraintmode = constraintmode;
            this.filtermode = filtermode;

            this.elapsedTime = time;

            this.results = new List<SingleMeasurementResult>();

            foreach (PDLPred generatedFormula in generatedFormulas)
            {
                SingleMeasurementResult result;
                if (cache.ContainsKey(generatedFormula))
                {
                    result = cache[generatedFormula];
                }
                else
                {
                    result = SingleMeasurementResult.Create(this.originalAutomaton, generatedFormula, this.alphabet, automatonCache);
                    cache[generatedFormula] = result;
                }
                this.results.Add(result);
            }

            // Compute statistics
            /*
            double densityDiffSum = 0;
            int editDistanceSum = 0;

            foreach (SingleMeasurementResult result in this.results)
            {
                densityDiffSum += result.densityDiff;
                editDistanceSum += result.editDistance;
            }

            this.densityDiffAverage = ((double)densityDiffSum) / ((double)this.results.Count);
            this.editDistanceAverage = ((double)editDistanceSum) / ((double)this.results.Count);

            double densityDiffDeviation = 0;
            double editDistanceDeviation = 0;
            foreach (SingleMeasurementResult result in this.results)
            {
                densityDiffDeviation += Math.Pow(result.densityDiff - this.densityDiffAverage, 2.0);
                editDistanceDeviation += Math.Pow(((double)result.editDistance) - this.editDistanceAverage, 2.0);
            }
            densityDiffDeviation /= this.results.Count;
            densityDiffDeviation = Math.Sqrt(densityDiffDeviation);

            editDistanceDeviation /= this.results.Count;
            editDistanceDeviation = Math.Sqrt(editDistanceDeviation);
            */
        }
开发者ID:AutomataTutor,项目名称:automatatutor-backend,代码行数:63,代码来源:Measurement.cs

示例8: IsPuzzleReady

 static bool IsPuzzleReady(Automaton firer)
 {
     if (firer is HeroCharacter)
     {
         PuzzlePanel puzzle = (firer as HeroCharacter).puzzlePanel;
         return puzzle.IsReadyToBlockTrans();
     }
     return true;
 }
开发者ID:pb0,项目名称:ID0_Test,代码行数:9,代码来源:ItemCommands.cs

示例9: CSharpGenerator

 public CSharpGenerator(Automaton<BDD> automaton, CharSetSolver solver, string classname, string namespacename, bool OptimzeForAsciiInput = true)
 {
     this.solver = solver;
     this.automaton = automaton;
     this.namespacename = namespacename;
     this.classname = classname;
     ASCII = solver.MkCharSetFromRange('\0', '\x7F');
     helper_predicates = new HelperPredicates(solver, OptimzeForAsciiInput);
 }
开发者ID:AutomataDotNet,项目名称:Automata,代码行数:9,代码来源:CSharpStringMatcher.cs

示例10: PrintDFA

        private static void PrintDFA(Automaton<BDD> dfa, string name, HashSet<char> al)
        {
            var sb = new StringBuilder();
            DFAUtilities.printDFA(dfa, al, sb);

            System.IO.StreamWriter file = new System.IO.StreamWriter(@"../../../TestPDL/DFAs/" + name + ".txt");
            file.WriteLine(sb);
            file.Close();
        }
开发者ID:AutomataTutor,项目名称:automatatutor-backend,代码行数:9,代码来源:SynthesisRegexp.cs

示例11: GetNFAOptimalEdit

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public NFAEditScript GetNFAOptimalEdit(Automaton<BDD> nfa2)
        {
            NFAEditScript editScript = new NFAEditScript();           

            //Start timer
            sw.Start();

            //Normalize NFAs
            var normNfaPair = DFAUtilities.normalizeDFA(nfa2);
            var normNfa2 = normNfaPair.First;
            var stateNamesMapping = normNfaPair.Second;


            NFAEditScript bestScript = new NFAEditScript();
            bestScript.script = null;

            // increase depth up to maxMoves
            for (int depth = 1; true; depth++)
            {
                var editList = new List<NFAEdit>();
                if(GetNFAEditScriptTimeout(
                    depth, -1, normNfa2,
                    editScript.script, editScript.GetCost(), bestScript))
                {
                    // if hits timeout break and return null
                    break;
                }
                if (bestScript.script != null)
                {
                    bestScript.script.Reverse();
                    sw.Stop();
                    var mappedEditList = new List<NFAEdit>();

                    //fix states name because of normalization
                    foreach (var edit in bestScript.script)
                    {   
                        NFAEdit mappedEdit = null;
                        if(edit is NFAEditState){
                            var castEdit = edit as NFAEditState;
                            mappedEdit = new NFAEditState(stateNamesMapping[castEdit.state], castEdit.makeFinal);
                        }
                        if(edit is NFAEditMove){
                            var castEdit = edit as NFAEditMove;
                            mappedEdit = new NFAEditMove(
                                stateNamesMapping[castEdit.sourceState], 
                                stateNamesMapping[castEdit.newTargetState],
                                castEdit.ch);
                        }
                        mappedEditList.Add(mappedEdit);
                    }
                    return bestScript;
                }
            }

            return null;
        }
开发者ID:AutomataTutor,项目名称:automatatutor-backend,代码行数:60,代码来源:NFAEditDistance.cs

示例12: MainForm

        public MainForm()
        {
            InitializeComponent();
            this.Size = Properties.Settings.Default.MainFormSize;
            this.Location = Properties.Settings.Default.MainFormLocation;

            // Load all known color on textBoxColorName's AutoComplete Collection
            Automaton c = new Automaton();
            this.textBoxColorName.AutoCompleteCustomSource = c.GetAllKnownColors();
        }
开发者ID:john-lioneil,项目名称:desktop-colorpicker,代码行数:10,代码来源:MainForm.cs

示例13: GetMinimalFormulaEditDistanceRatio

 /// <summary>
 /// Returns the minimum PDL edit distance ratio between all the PDL A1 and A2 inferred for dfa1 and dfa2
 /// in less than timeout. For every  min_ij(d(A1i,A2j)/|A1i)
 /// </summary>
 /// <param name="dfa1"></param>
 /// <param name="dfa2"></param>
 /// <param name="al"></param>
 /// <param name="solver"></param>
 /// <param name="timeout"></param>
 /// <returns></returns>
 public static double GetMinimalFormulaEditDistanceRatio(Automaton<BDD> dfa1, Automaton<BDD> dfa2, HashSet<char> al, CharSetSolver solver, long timeout, PDLEnumerator pdlEnumerator)
 {
     var v = GetMinimalFormulaEditDistanceTransformation(dfa1, dfa2, al, solver, timeout, pdlEnumerator);
     if(v!=null){
         var transformation = v.First;
         var scaling = 1.0;
         return transformation.totalCost / (transformation.minSizeForTreeA * scaling);
     }
     return 10;
 }
开发者ID:AutomataTutor,项目名称:automatatutor-backend,代码行数:20,代码来源:PDLEditDistance.cs

示例14: HasFirable

 public bool HasFirable(Automaton owner)
 {
     foreach (var entity in queue)
     {
         if (entity.IsFirable(owner))
         {
             return true;
         }
     }
     return false;
 }
开发者ID:pb0,项目名称:ID0_Test,代码行数:11,代码来源:CommandSet.cs

示例15: HasFirableTarget

 public bool HasFirableTarget(Automaton firer)
 {
     if (pattern != null)
     {
         if (base.IsFirable(firer))
         {
             return pattern.HasApplicableTarget(firer.FindTarget);
         }
     }
     return false;
 }
开发者ID:pb0,项目名称:ID0_Test,代码行数:11,代码来源:OnDemandCommand.cs


注:本文中的Automaton类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。