OSDN Git Service

グラフ自動追尾機能を追加。
[chnosproject/AI004.git] / aimemtag.js
1 var AI_CandidateWordTag = function(str){
2         AI_CandidateWordTag.base.call(this, AI_CandidateWordTag.base.prototype.Type_CandidateWord);
3         this.str = str;
4         this.wordCount = 0;
5         this.wordLevel = 0;
6 }.extend(AI_MemoryTag, {
7         parseToStringData: function(){
8                 //uuid:type:str:wordCount:wordLevel
9                 var e = encodeURIComponent;
10                 var d = new Object();
11                 d.s = e(this.str);
12                 d.c = this.wordCount;
13                 d.l = this.wordLevel.toString();
14                 
15                 return AI_CandidateWordTag.base.prototype.parseToStringData.call(this, d);
16         },
17         loadFromMemoryData: function(data){
18                 var e = decodeURIComponent;
19                 this.str = e(data.s);
20                 this.wordCount = data.c;
21                 this.wordLevel = data.l;
22         },
23 });
24
25 var AI_WordTag = function(str, uuid){
26         AI_WordTag.base.call(this, AI_WordTag.base.prototype.Type_Word);
27         if(str){
28                 this.str = str;
29         }
30         if(uuid){
31                 this.uuid = uuid;
32         }
33         this.wordCount = 0;
34 }.extend(AI_MemoryTag, {
35         parseToStringData: function(){
36                 //uuid:type:str:wordCount:wordLevel
37                 var e = encodeURIComponent;
38                 var d = new Object();
39                 d.s = e(this.str);
40                 d.c = this.wordCount;
41                 return AI_WordTag.base.prototype.parseToStringData.call(this, d);
42         },
43         loadFromMemoryData: function(data){
44                 var e = decodeURIComponent;
45                 this.str = e(data.s);
46                 this.wordCount = data.c;
47         },
48 });
49
50 var AI_PatternTag = function(pattern, uuid, func){
51         // p.func(this.env, separated, separated_UUID);
52         //patternには関数も指定できる。その場合、関数の形式は
53         //f(separated, separated_UUID)となる。戻り値がtrueの場合、パターンはマッチしたとみなされる
54         if(pattern){
55                 this.pattern = pattern;
56         }
57         if(uuid){
58                 this.uuid = uuid;
59         }
60         if(func){
61                 this.func = func;
62         }
63 }.extend(AI_MemoryTag, {
64         parseToStringData: function(){
65                 //Not implemented.
66         },
67 });
68
69 var AI_MeaningTag = function(uuid, description){
70         if(description){
71                 this.description = description;
72         }
73         if(uuid){
74                 this.uuid = uuid;
75         }
76 }.extend(AI_MemoryTag, {
77         parseToStringData: function(){
78                 //Not implemented.
79         },
80 });