• R/O
  • SSH

dialog-studio-java: コミット

Galatea Dialog Studio: Eclipse-based Java project. Migrated from CVS repository (scripts are omitted).


コミットメタ情報

リビジョンd4dc009fdfcdcb36266e2700503ed8d705d984d6 (tree)
日時2010-10-18 15:42:27
作者Takuya Nishimoto <nishimoto@m.ie...>
コミッターTakuya Nishimoto

ログメッセージ

cleanup

変更サマリ

  • delete: src/galatea/agent/BehaviorManager2.java
  • delete: src/galatea/agentmanager/AMMCL.java
  • delete: src/galatea/agentmanager/GalateaBase.java

差分

diff -r c8e792b5ee59 -r d4dc009fdfcd src/galatea/agent/BehaviorManager2.java
--- a/src/galatea/agent/BehaviorManager2.java Mon Oct 18 15:35:49 2010 +0900
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,352 +0,0 @@
1-/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2- * Galatea Behavior Manager:
3- * (c)2010 Takuya NISHIMOTO (nishimoto [atmark] m.ieice.org)
4- */
5-
6-package galatea.agent;
7-
8-//import galatea.util.AMBuffer;
9-import galatea.util.Getopt;
10-import galatea.util.HashArray;
11-
12-import java.text.DecimalFormat;
13-import java.util.regex.Matcher;
14-
15-public class BehaviorManager2 extends GalateaBase
16-{
17- java.util.Random random_;
18- private HashArray agents_; // map String => Agent
19-
20- private long prevTime_;
21-
22- private boolean isFsmAlive_;
23- private boolean useAutoMove_;
24- private String currAgent_;
25-
26- private Vector3D prevEyeRot_ = new Vector3D(0, 0, 0);
27- private Vector3D prevHeadRot_ = new Vector3D(0, 0, 0);
28- private Vector3D prevBodyRot_ = new Vector3D(0, 0, 0);
29- private Vector3D prevBodyTrans_ = new Vector3D(0, 0, 0);
30- private Agent prevAgent_ = null;
31- private double prevBodyScale_ = 0.0;
32- private String prevExpType_ = "NEUTRAL";
33- private double prevExpLevel_ = 0.0;
34-
35- private DecimalFormat formatter_;
36-
37- public BehaviorManager2()
38- {
39- super();
40- random_ = new java.util.Random();
41- formatter_ = new DecimalFormat("0.000");
42-
43- isFsmAlive_ = false;
44- useAutoMove_ = false;
45-
46- currAgent_ = AgentUtil.getDefaultAgent();
47- agents_ = AgentUtil.loadAgents();
48- }
49-
50-
51- private String _format(double d)
52- {
53- return formatter_.format(d);
54- }
55-
56-
57- private Agent _getCurrAgent()
58- {
59- return (Agent)agents_.get(currAgent_);
60- }
61-
62-
63- private Agent _getAgentByName(String name)
64- {
65- return (Agent)agents_.get(name);
66- }
67-
68-
69- private void _outputFaceExp()
70- {
71- Agent agent = _getCurrAgent();
72- boolean maskChanged = true;
73- if ( agent == prevAgent_ ) {
74- maskChanged = false;
75- }
76-
77- Vector3D e = agent.getEyeRot();
78- if ( maskChanged || (! e.equals(prevEyeRot_)) ) {
79- send("to @FSM set EyeRot = " + _format(e.x) + " " + _format(e.y) + " " + _format(e.z));
80- }
81-
82- Vector3D h = agent.getHeadRot();
83- if ( maskChanged || (! h.equals(prevHeadRot_)) ) {
84- send("to @FSM set HeadRotAbs.1 = " + _format(h.x) + " " + _format(h.y) + " " + _format(h.z));
85- }
86-
87- Vector3D b = agent.getBodyRot();
88- if ( maskChanged || (! b.equals(prevBodyRot_)) ) {
89- send("to @FSM set AgentRot = " + _format(b.x) + " " + _format(b.y) + " " + _format(b.z));
90- }
91-
92- Vector3D t = agent.getBodyTrans();
93- if ( maskChanged || (! t.equals(prevBodyTrans_)) ) {
94- send("to @FSM set AgentTrans = " + _format(t.x) + " " + _format(t.y));
95- }
96-
97- double scale = agent.getBodyScale();
98- if ( maskChanged
99- || Math.abs(scale - prevBodyScale_) > 0.01 ) {
100- send("to @FSM set AgentScale = " + _format(scale));
101- }
102-
103- String exptype = agent.getExpType();
104- double explevel = agent.getExpLevel();
105- if ( maskChanged
106- || ! exptype.equals(prevExpType_)
107- || Math.abs(explevel - prevExpLevel_) > 3.0 ) {
108- send("to @FSM set FaceExp = " + exptype + " 1 " + _format(explevel) + " 0");
109- }
110-
111- prevAgent_ = agent;
112- prevEyeRot_.set(e);
113- prevHeadRot_.set(h);
114- prevBodyRot_.set(b);
115- prevBodyTrans_.set(t);
116- prevBodyScale_ = scale;
117- prevExpType_ = exptype;
118- prevExpLevel_ = explevel;
119- }
120-
121-
122- private void _setupCurrMask()
123- {
124- String bg = _getCurrAgent().getBackground();
125- String mask = _getCurrAgent().getMask();
126- send("to @FSM set Background = " + bg);
127- send("to @FSM set Mask = " + mask);
128- _outputFaceExp();
129- }
130-
131-
132- public void handleRep(String module, String slot, String arg)
133- {
134- if (module.equals("FSM") && slot.equals("Run") && arg.equals("LIVE")) {
135- isFsmAlive_ = true;
136- }
137- }
138-
139-
140- private void _sendFadeOut()
141- {
142- send("to @FSM set AgentEnable = DISABLE");
143- }
144-
145-
146- private void _sendFadeIn()
147- {
148- send("to @FSM set AgentEnable = ENABLE");
149- }
150-
151-
152- public void handleSet(String module, String slot, String arg)
153- {
154- if (slot.equals("AutoMove")) {
155- useAutoMove_ = (Integer.parseInt(arg) == 0) ? false : true;
156- if (useAutoMove_) {
157- _setupCurrMask();
158- }
159-
160- } else if (slot.equals("AgentSpeakState")) {
161- _getCurrAgent().setAgentSpeakState(Integer.parseInt(arg));
162-
163- } else if (slot.equals("Emotion")) {
164- Matcher matcher2 = pattern2_.matcher(arg);
165- if (matcher2.matches()) {
166- String type = matcher2.group(1);
167- double level = Double.parseDouble(matcher2.group(2));
168- _getCurrAgent().setEmotionTarget(type, level);
169- } else {
170- _getCurrAgent().setEmotionTarget(arg);
171- }
172- } else if (slot.equals("EmotionNow")) {
173- Matcher matcher2 = pattern2_.matcher(arg);
174- if (matcher2.matches()) {
175- String type = matcher2.group(1);
176- double level = Double.parseDouble(matcher2.group(2));
177- _getCurrAgent().setEmotionNow(type, level);
178- } else {
179- _getCurrAgent().setEmotionNow(arg);
180- }
181- } else if (slot.equals("Rot")) {
182- Matcher matcher3 = pattern3_.matcher(arg);
183- if (matcher3.matches()) {
184- double tx = Double.parseDouble(matcher3.group(1));
185- double ty = Double.parseDouble(matcher3.group(2));
186- double tz = Double.parseDouble(matcher3.group(3));
187- _getCurrAgent().setRotTarget(tx, ty, tz);
188- }
189- } else if (slot.equals("RotNow")) {
190- Matcher matcher3 = pattern3_.matcher(arg);
191- if (matcher3.matches()) {
192- double tx = Double.parseDouble(matcher3.group(1));
193- double ty = Double.parseDouble(matcher3.group(2));
194- double tz = Double.parseDouble(matcher3.group(3));
195- _getCurrAgent().setRotNow(tx, ty, tz);
196- }
197- } else if (slot.equals("Background")) {
198- Matcher matcher2 = pattern2_.matcher(arg);
199- if (matcher2.matches()) {
200- Agent ag = _getAgentByName(matcher2.group(1));
201- ag.setBackground(matcher2.group(2));
202- }
203- } else if (slot.equals("HeadMoveRatio")) {
204- Matcher matcher2 = pattern2_.matcher(arg);
205- if (matcher2.matches()) {
206- double d1 = Double.parseDouble(matcher2.group(1));
207- double d2 = Double.parseDouble(matcher2.group(2));
208- _getCurrAgent().setHeadMove(d1, d2);
209- }
210- } else if (slot.equals("Mask")) {
211- if (arg.equals("DISABLE")) {
212- _sendFadeOut();
213- } else {
214- if (! arg.equals(currAgent_)) {
215- _sendFadeOut();
216- }
217- currAgent_ = arg;
218- _setupCurrMask();
219- _sendFadeIn();
220- }
221- } else if (slot.equals("FaceMot")) {
222- send("to @FSM set FaceMot = " + arg);
223-
224- } else if (slot.equals("Action")) {
225- if (arg.equals("Thinking")) {
226- _getCurrAgent().setRotTarget(+0.3, 0, 0);
227- int v = random_.nextInt(8);
228- switch(v) {
229- case 0:
230- _getCurrAgent().setEyeRotNow(-5, 0, 0); // up
231- break;
232- case 1:
233- _getCurrAgent().setEyeRotNow(+5, 0, 0); // down
234- break;
235- case 2:
236- _getCurrAgent().setEyeRotNow( 0, -7, 0); // left
237- break;
238- case 3:
239- _getCurrAgent().setEyeRotNow( 0, +7, 0); // right
240- break;
241- case 4:
242- _getCurrAgent().setEyeRotNow(-4, -4, 0); //
243- break;
244- case 5:
245- _getCurrAgent().setEyeRotNow(-4, +4, 0); //
246- break;
247- case 6:
248- _getCurrAgent().setEyeRotNow(+4, -4, 0); //
249- break;
250- case 7:
251- _getCurrAgent().setEyeRotNow(+4, +4, 0); //
252- break;
253- }
254- } else if (arg.equals("InfoRequest")) {
255- _getCurrAgent().setRotTarget(0, 0, 0);
256- } else if (arg.equals("Speaking")) {
257- _getCurrAgent().setRotTarget(-0.5, 0, 0);
258- } else if (arg.equals("Busy")) {
259- _getCurrAgent().setRotTarget(5, 3, 0);
260- } else if (arg.equals("Blink")) {
261- send("to @FSM set FaceMot = BLINK 2");
262- }
263- } else if (slot.equals("Nod")) {
264- double d = Double.parseDouble(arg);
265- _getCurrAgent().startNodding(d);
266- } else if (slot.equals("Refuse")) {
267- double d = Double.parseDouble(arg);
268- _getCurrAgent().startRefuse(d);
269- } else if (slot.equals("Tilt")) {
270- double d = Double.parseDouble(arg);
271- _getCurrAgent().setHeadRotTarget(0, 0, d);
272- }
273- }
274-
275- private void _iteration2()
276- {
277- if (useAutoMove_) {
278- long currentTime = System.currentTimeMillis();
279- long delta = currentTime - prevTime_;
280- if (delta >= 100) {
281- _getCurrAgent().calc();
282- _outputFaceExp();
283- _getCurrAgent().addClock((double)delta / 1000.0);
284- prevTime_ = currentTime;
285- }
286- }
287- if (isFsmAlive_ == false) {
288- send("to @FSM inq Run");
289- sleep(100);
290- }
291- }
292-
293- public void run()
294- {
295- prevTime_ = System.currentTimeMillis();
296- send("rep Status.power = ON");
297- while (true) {
298- iteration();
299- _iteration2();
300- }
301- }
302-
303- public static final String COPYRIGHT =
304- "(c)2003-2010 Takuya NISHIMOTO (nishimoto [atmark] m.ieice.org)\n";
305-
306- public static void showVersion() {
307- System.err.println("BehaviorManager");
308- System.err.println(galatea.dialog.DialogStudioVersion.TSTAMP);
309- System.err.print(COPYRIGHT);
310- System.err.println();
311- }
312-
313- /**
314- * java -cp gdm.jar galatea.BehaviorManager2
315- *
316- * [in] From @DM set Mask = DISABLE
317- * [out] to @FSM set AgentEnable = DISABLE
318- *
319- */
320- public static void main(String argv[])
321- {
322- String conf = "gdm.conf";
323-
324- Getopt g = new Getopt("", argv, "a:c:dev");
325- g.setOpterr(false);
326- int c;
327- while ((c = g.getopt()) != -1){
328- switch (c) {
329- case 'a':
330- // behaviorManager._setAgentByName(g.getOptarg());
331- break;
332- case 'c':
333- conf = g.getOptarg();
334- break;
335- case 'd':
336- // behaviorManager._setDebugMode(true);
337- break;
338- case 'e':
339- // behaviorManager._setEventViewerMode(true);
340- break;
341- case 'v':
342- showVersion();
343- break;
344- }
345- }
346-
347- AgentUtil.loadConfigFile(conf);
348- BehaviorManager2 behaviorManager = new BehaviorManager2();
349- behaviorManager.run();
350- }
351-
352-}
diff -r c8e792b5ee59 -r d4dc009fdfcd src/galatea/agentmanager/AMMCL.java
--- a/src/galatea/agentmanager/AMMCL.java Mon Oct 18 15:35:49 2010 +0900
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,340 +0,0 @@
1-///*
2-// * $Id: AMMCL.java,v 1.2 2009/01/28 13:51:17 nishimoto Exp $
3-// * Galatea AM-MCL for Java
4-// * by Takuya NISHIMOTO (nishimoto [atmark] m.ieice.org)
5-// */
6-//
7-//package galatea.agentmanager;
8-//
9-//import galatea.agent.Agent;
10-//import galatea.util.HashArray;
11-//
12-//import java.util.regex.Matcher;
13-//import java.util.regex.Pattern;
14-//
15-//public class AMMCL extends GalateaBase
16-//{
17-// private int state = 0;
18-// //
19-// // sequence for Speak
20-// // state0 : IDLE
21-// // state1 : wait FSM/SSM "rep Speak.stat = READY"
22-// // state2 : wait FSM/SSM "rep Speak.stat = IDLE"
23-// //
24-// // sequence for MouthMove
25-// // state0 : IDLE
26-// // state3 : wait FSM "rep Speak.stat = READY"
27-// // state4 : wait FSM "rep Speak.stat = IDLE"
28-//
29-// private boolean ready_ssm = false;
30-// private boolean ready_fsm = false;
31-//
32-// private HashArray agents_;
33-// private String currAgent_;
34-//
35-// public AMMCL()
36-// {
37-// super();
38-// modulename_ = "AM-MCL";
39-// debug_ = false;
40-// printDebug("initializing...");
41-//
42-// agents_ = new HashArray();
43-// agents_.put("man01", new Agent("man01", "male01", "bg01", 1.2));
44-// agents_.put("man02", new Agent("man02", "m001", "bg02", 1.6));
45-// agents_.put("woman01", new Agent("woman01", "female01", "bg03", 1.2));
46-// currAgent_ = "woman01";
47-// }
48-//
49-// private void _doSetSpeak(String arg)
50-// {
51-// if (arg.equals("STOP")) {
52-// state = 0;
53-// printOut("to @FSM set Speak = STOP");
54-// printOut("to @SSM set Speak = STOP");
55-// ready_ssm = false;
56-// ready_fsm = false;
57-// } else {
58-// if (state != 0) {
59-// // if speaking, stop automatically
60-// printOut("to @FSM set Speak = STOP");
61-// printOut("to @SSM set Speak = STOP");
62-// }
63-// state = 1;
64-// printOut("to @FSM prop Speak.stat = AutoOutput");
65-// printOut("to @SSM prop Speak.stat = AutoOutput");
66-// printOut("to @SSM prop Speak.pho = AutoOutput");
67-// printOut("to @SSM set Text = " + arg);
68-// ready_ssm = false;
69-// ready_fsm = false;
70-// }
71-// }
72-//
73-// private void _doSetMask(String arg)
74-// {
75-// Pattern pat1 = Pattern.compile("^(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)$");
76-// Matcher m1 = pat1.matcher(arg);
77-// if (m1.matches()) {
78-// printOut("to @FS-MCL set Mask = " + m1.group(1));
79-// printOut("to @FS-MCL set EmotionNow = "
80-// + m1.group(2) + " " + m1.group(3));
81-// printOut("to @FS-MCL set RotNow = "
82-// + m1.group(4) + " " + m1.group(5) + " " + m1.group(6));
83-// if (!currAgent_.equals(m1.group(1))) {
84-// currAgent_ = m1.group(1);
85-// }
86-// }
87-// }
88-//
89-// private void _doSet(String slot, String arg)
90-// {
91-// if (slot.equals("Speak")) {
92-// _doSetSpeak(arg);
93-// } else if (slot.equals("Mask")) {
94-// _doSetMask(arg);
95-// }
96-// }
97-//
98-// private void _acceptFromState1(String mod, String str)
99-// {
100-// }
101-//}
102-//
103-///*
104-// def do_set_mask(arg)
105-// case arg
106-// when /(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/
107-// printOut( "to @FS-MCL set Mask = #{$1}"
108-// printOut( "to @FS-MCL set EmotionNow = #{$2} #{$3}"
109-// printOut( "to @FS-MCL set RotNow = #{$4} #{$5} #{$6}"
110-// if self.curr_agent != $1
111-// self.curr_agent = $1
112-// printOut( "to @SSM set Speaker = #{curr_speaker}"
113-// end
114-// set_emotion $2, $3.to_f
115-// when /(\S+)\s+(\S+)\s+([0-9\.\+\-]+)/
116-// if self.curr_agent != $1
117-// self.curr_agent = $1
118-// printOut( "to @SSM set Speaker = #{curr_speaker}"
119-// end
120-// set_emotion $2, $3.to_f
121-// printOut( "to @FS-MCL set Mask = #{$1}"
122-// printOut( "to @FS-MCL set EmotionNow = #{$2} #{$3}"
123-// when /(\S+)\s+(\S+)/
124-// if self.curr_agent != $1
125-// self.curr_agent = $1
126-// printOut( "to @SSM set Speaker = #{curr_speaker}"
127-// end
128-// set_emotion $2
129-// printOut( "to @FS-MCL set Mask = #{$1}"
130-// printOut( "to @FS-MCL set EmotionNow = #{$2}"
131-// when /(\S+)/
132-// if self.curr_agent != $1
133-// self.curr_agent = $1
134-// printOut( "to @SSM set Speaker = #{curr_speaker}"
135-// end
136-// printOut( "to @FS-MCL set Mask = #{$1}"
137-// end
138-// end
139-//
140-//
141-// def set_emotion(type, level=90, duration=0)
142-// # duration is not used
143-//=begin
144-// @mutex.synchronize do
145-// @agents[@curr_agent].set_emotion(type, level)
146-// end
147-//=end
148-// self.agents[self.curr_agent].set_emotion(type, level)
149-// end
150-//
151-//
152-// def do_set_emotion(arg)
153-// printOut( "to @FS-MCL set Emotion = #{arg}"
154-// case arg
155-// when /(.+)\s+([0-9\.\+\-]+)\s+([0-9\.\+\-]+)/
156-// set_emotion($1, $2.to_f, $3.to_f)
157-// when /(.+)\s+([0-9\.\+\-]+)/
158-// set_emotion($1, $2.to_f)
159-// when /(.+)/
160-// set_emotion($1)
161-// end
162-// end
163-//
164-//
165-// def set_speak_speed(arg)
166-// self.agents[self.curr_agent].ssmspeed = arg.to_f
167-// end
168-//
169-//
170-// def do_set(slot, arg)
171-// super
172-// case slot
173-// when "Speak"
174-// do_set_speak(arg)
175-// when "MoveMouth"
176-// do_set_move_mouth(arg)
177-// when "SpeakSpeed"
178-// set_speak_speed(arg)
179-// when "AutoMove"
180-// printOut( "to @FS-MCL set AutoMove = #{arg}"
181-// when "AutoGaze"
182-// printOut( "to @DIM set AutoGaze = #{arg}"
183-// when "Mask"
184-// do_set_mask(arg)
185-// when "Emotion"
186-// do_set_emotion(arg)
187-// when "AutoEmotionSpeak"
188-// self.auto_emotion_speak = arg.to_i
189-// end
190-// end
191-//
192-//
193-// def accept_from_state0(mod, str)
194-// end
195-//
196-//
197-// def accept_from_state1(mod, str)
198-// # waiting responce of "@SSM set Text = value"
199-// case mod
200-// when "SSM"
201-// case str
202-// when /rep\s+Speak\.pho\s*=\s*(.*)$/
203-// phones = $1
204-// phones.gsub!( /\[/, " " )
205-// phones.gsub!( /\]/, "" )
206-// # sil 10 k 100 o 85 N 90 n 25 i 60 ch 105 i 50 w 50 a 95 sil 10
207-// printDebug phones
208-//# printOut( "to @FSM prop Speak.stat = AutoOutput"
209-// printOut( "to @FSM set LipSync.pho = #{phones}"
210-// printOut( "to @FSM inq Speak.stat"
211-// printDebug "state: #{self.state} speak.pho ready"
212-// when /rep\s+Speak\.stat\s*=\s*READY\s*$/
213-// self.ready_ssm = true
214-// printDebug "state: #{self.state} ready_ssm"
215-// when /rep\s+Speak\.stat\s*=\s*ERROR\s*$/
216-// self.state = 0
217-// sendAgentSpeakState
218-// self.ready_ssm = false
219-// self.ready_fsm = false
220-// printDebug "state: #{self.state}"
221-// end
222-// when "FSM"
223-// case str
224-// when /rep\s+Speak\.stat\s*=\s*READY\s*$/
225-// self.ready_fsm = true
226-// printDebug "state: #{self.state} ready_fsm"
227-// when /rep\s+Speak\.stat\s*=\s*ERROR\s*$/
228-// self.state = 0
229-// sendAgentSpeakState
230-// self.ready_ssm = false
231-// self.ready_fsm = false
232-// printDebug "state: #{self.state}"
233-// end
234-// end
235-//
236-// if self.ready_fsm && self.ready_ssm
237-// self.state = 2
238-// sendAgentSpeakState
239-// # printOut( "to @SSM set Save = _speech.raw"
240-// # printOut( "to @SSM set SpeechFile = _speech.raw"
241-// # $ play -t .sw -x -r 16000 ../../SSM/_speech.raw
242-//
243-//# printOut( "to @SSM set Speak = +100" # for SSMclient.rb
244-// printOut( "to @SSM set Speak = +0" #
245-//
246-// printOut( "to @FSM set Speak = + 0"
247-// printDebug "state: #{self.state} Speak start"
248-// end
249-// end
250-//
251-//
252-// def accept_from_state2(mod, str)
253-// #
254-// if mod == "SSM" && /rep\s+Speak\.stat\s*=\s*IDLE\s*$/ =~ str
255-// self.ready_ssm = false
256-// # printDebug "state: #{self.state} ready_ssm = false"
257-//
258-// elsif mod == "FSM" && /rep\s+Speak\.stat\s*=\s*IDLE\s*$/ =~ str
259-// self.ready_fsm = false
260-// # printDebug "state: #{self.state} ready_fsm = false"
261-//
262-// end
263-//
264-// if self.ready_fsm == false && self.ready_ssm == false
265-// self.state = 0
266-// printDebug "state: #{self.state} Speak end"
267-// sendAgentSpeakState
268-// end
269-// end
270-//
271-//
272-// def accept_from_state3(mod, str)
273-// if mod == "FSM" && /rep\s+Speak\.stat\s*=\s*READY\s*$/ =~ str
274-// self.state = 4
275-// sendAgentSpeakState
276-// self.ready_ssm = false
277-// self.ready_fsm = true
278-// printDebug "state: #{self.state} ready_fsm"
279-// printOut( "to @FSM set Speak = + 0"
280-// printDebug "state: #{self.state} Speak start"
281-//
282-// elsif mod == "FSM" && /rep\s+Speak\.stat\s*=\s*ERROR\s*$/ =~ str
283-// self.state = 0
284-// sendAgentSpeakState
285-// self.ready_ssm = false
286-// self.ready_fsm = false
287-// printDebug "state: #{self.state}"
288-// end
289-// end
290-//
291-//
292-// def accept_from_state4(mod, str)
293-// if mod == "FSM" && /rep\s+Speak\.stat\s*=\s*IDLE\s*$/ =~ str
294-// self.state = 0
295-// printDebug "state: #{self.state} Speak end"
296-// self.ready_fsm = false
297-// sendAgentSpeakState
298-// end
299-// end
300-//
301-//
302-// def accept_from(mod, str)
303-//
304-// #
305-// # From @XXX set YYY = ZZZ を to @AM-MCL と見なして do_set で処理
306-// #
307-// if /^\s*set\s+([^\s=]*)\s*=\s*(.*)$/ =~ str
308-// do_set $1, $2
309-// return
310-// end
311-//
312-// #
313-// # lipsync
314-// #
315-//
316-// case self.state
317-// when 1
318-// accept_from_state1(mod, str)
319-// when 2
320-// accept_from_state2(mod, str)
321-// when 3
322-// accept_from_state3(mod, str)
323-// when 4
324-// accept_from_state4(mod, str)
325-// end
326-//
327-// end
328-//
329-// def accept_to(mod, str)
330-// printOut( "to @MON set SysLogText = #{str}"
331-// end
332-//
333-//end
334-//
335-//# ------------------------------
336-//
337-//AM_MCL.new.run
338-//
339-//# end of file
340-//*/
diff -r c8e792b5ee59 -r d4dc009fdfcd src/galatea/agentmanager/GalateaBase.java
--- a/src/galatea/agentmanager/GalateaBase.java Mon Oct 18 15:35:49 2010 +0900
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +0,0 @@
1-///*
2-// * $Id: GalateaBase.java,v 1.2 2009/01/28 13:51:17 nishimoto Exp $
3-// *
4-// * Galatea Submodule base class
5-// * by Takuya NISHIMOTO (nishimoto [atmark] m.ieice.org)
6-// */
7-//
8-//package galatea.agentmanager;
9-//
10-//import galatea.util.AMBuffer;
11-//import galatea.util.StringHashArray;
12-//import galatea.util.Util;
13-//
14-//import java.util.regex.*;
15-//import java.nio.charset.Charset;
16-//import java.text.DecimalFormat;
17-//
18-//
19-//public class GalateaBase
20-//{
21-// protected String modulename_;
22-// protected boolean debug_ = false;
23-// protected StringHashArray myslot_;
24-// protected StringHashArray myprop_;
25-//
26-// private AMBuffer ambuf_;
27-// private DecimalFormat intFormatter_ = new DecimalFormat("0");
28-//// private DecimalFormat doubleFormatter_ = new DecimalFormat("0.000");
29-//
30-// public GalateaBase()
31-// {
32-// ambuf_ = new AMBuffer(Util.getSystemDefaultCharset());
33-// modulename_ = "GalateaBase";
34-// myslot_ = new StringHashArray();
35-// myslot_.set("Run","DEAD");
36-// myslot_.set("ProtocolVersion", "ProtocolVersion 1.0");
37-// myslot_.set("ModuleVersion", "ModuleVersion 1.0");
38-// myprop_ = new StringHashArray();
39-// }
40-//
41-// private String _format(int i)
42-// {
43-// return intFormatter_.format(i);
44-// }
45-//
46-//// private String _format(double d)
47-//// {
48-//// return doubleFormatter_.format(d);
49-//// }
50-//
51-// public void sendSet(String mod, String slot, String str)
52-// {
53-// String s = "to @" + mod + " set " + slot + " = " + str;
54-// ambuf_.send(s);
55-// }
56-//
57-// public void sendSet(String mod, String slot, int num)
58-// {
59-// String s = "to @" + mod + " set " + slot + " = " + _format(num);
60-// ambuf_.send(s);
61-// }
62-//
63-// public void printOut(String str)
64-// {
65-// ambuf_.send(str);
66-// }
67-//
68-// public void printDebug(String str)
69-// {
70-// if (debug_) {
71-// System.err.println(str);
72-// System.err.flush();
73-// }
74-// }
75-//
76-// public void printTell(String str)
77-// {
78-// ambuf_.send("tell " + str);
79-// }
80-//
81-// public void printRep(String str)
82-// {
83-// ambuf_.send("rep " + str);
84-// }
85-//
86-// public void doSet(String slot, String arg)
87-// {
88-// // overrided
89-// }
90-//
91-// public void doProp(String prop, String arg)
92-// {
93-// // overrided
94-// }
95-//
96-// public void acceptFrom(String mod, String str)
97-// {
98-// // overrided
99-// }
100-//
101-// public void acceptTo(String mod, String str)
102-// {
103-// // overrided
104-// }
105-//
106-// public void run()
107-// {
108-// Pattern p1 = Pattern.compile("^\\s*set\\s+([^\\s=]*)\\s*=\\s*(.*)$");
109-// Pattern p2 = Pattern.compile("^\\s*prop\\s+([^\\s=]*)\\s*=\\s*(.*)$");
110-// Pattern p3 = Pattern.compile("^\\s*inq\\s+(.*)$");
111-// Pattern p4 = Pattern.compile("^\\s*From\\s+\\@(\\S+)\\s(.*)$");
112-// Pattern p5 = Pattern.compile("^\\s*to\\s+\\@(\\S+)\\s(.*)$");
113-// Matcher m;
114-// while (true) {
115-// String s;
116-// while ((s = ambuf_.receive()).length() > 0) {
117-// if ((m = p1.matcher(s)).matches()) {
118-// myslot_.set(m.group(1), m.group(2));
119-// doSet(m.group(1), m.group(2));
120-// if (m.group(1).equals("Run")) {
121-// if (m.group(2).equals("INIT")) {
122-// myslot_.set("Run", "LIVE");
123-// } else if (m.group(2).equals("EXIT")) {
124-// myslot_.set("Run", "DEAD");
125-// }
126-// }
127-// } else if ((m = p2.matcher(s)).matches()) {
128-// myprop_.set(m.group(1), m.group(2));
129-// doProp(m.group(1), m.group(2));
130-// } else if ((m = p3.matcher(s)).matches()) {
131-// printRep(m.group(1) + " = " + myslot_.get(m.group(1)));
132-// } else if ((m = p4.matcher(s)).matches()) {
133-// acceptFrom(m.group(1), m.group(2));
134-// } else if ((m = p5.matcher(s)).matches()) {
135-// acceptTo(m.group(1), m.group(2));
136-// }
137-// }
138-// try {
139-// Thread.sleep(0,1);
140-// } catch (Exception e) {
141-// e.printStackTrace();
142-// }
143-// }
144-// }
145-//
146-//
147-// /**
148-// * java -cp classes galatea.GalateaBase
149-// */
150-// public static void main(String argv[])
151-// {
152-// GalateaBase gb = new GalateaBase();
153-// gb.run();
154-// }
155-//
156-//}
157-//
158-///* end of file */
旧リポジトリブラウザで表示