Mercurial > hg > Database > jungle-sharp
comparison Main/jungle-main/traverser/DefaultEvaluator.cs @ 20:1f99e150f336
fix folder and add Object Mapper.
author | Kazuma Takeda |
---|---|
date | Thu, 15 Dec 2016 22:52:48 +0900 |
parents | |
children | f2ea780b3e80 |
comparison
equal
deleted
inserted
replaced
19:0865819106cf | 20:1f99e150f336 |
---|---|
1 using UnityEngine; | |
2 using System.Collections; | |
3 | |
4 namespace JungleDB { | |
5 public class DefaultEvaluator : Evaluator { | |
6 private NodePath path; | |
7 | |
8 public DefaultEvaluator(NodePath _path) { | |
9 path = _path; | |
10 } | |
11 | |
12 public Evaluation evaluate(TreeNode _current, int _pos){ | |
13 Pair<int, NodePath> pop = path.pop (); | |
14 int head = pop.lefts (); | |
15 | |
16 if (path.size () == 1) { | |
17 if (head == _pos) { | |
18 return new DefaultEvaluation (Result.GOAL, null); | |
19 } | |
20 } | |
21 | |
22 DefaultEvaluator nextEvaluator; | |
23 Result result; | |
24 if (head == _pos) { | |
25 result = Result.ACCEPT; | |
26 nextEvaluator = new DefaultEvaluator (pop.rights ()); | |
27 } else { | |
28 result = Result.CONTINUE; | |
29 nextEvaluator = null; | |
30 } | |
31 | |
32 return new DefaultEvaluation (result, nextEvaluator); | |
33 } | |
34 } | |
35 } |