PageRenderTime 122ms CodeModel.GetById 36ms app.highlight 77ms RepoModel.GetById 1ms app.codeStats 1ms

/protocols/jain-mgcp/stack/src/main/java/org/mobicents/protocols/mgcp/jain/pkg/AUUtils.java

http://mobicents.googlecode.com/
Java | 1180 lines | 939 code | 99 blank | 142 comment | 738 complexity | 709deae5019a98ee6ca56d832d530dc5 MD5 | raw file
   1/*
   2 * JBoss, Home of Professional Open Source
   3 * Copyright 2011, Red Hat, Inc. and individual contributors
   4 * by the @authors tag. See the copyright.txt in the distribution for a
   5 * full listing of individual contributors.
   6 *
   7 * This is free software; you can redistribute it and/or modify it
   8 * under the terms of the GNU Lesser General Public License as
   9 * published by the Free Software Foundation; either version 2.1 of
  10 * the License, or (at your option) any later version.
  11 *
  12 * This software is distributed in the hope that it will be useful,
  13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15 * Lesser General Public License for more details.
  16 *
  17 * You should have received a copy of the GNU Lesser General Public
  18 * License along with this software; if not, write to the Free
  19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  21 */
  22
  23package org.mobicents.protocols.mgcp.jain.pkg;
  24
  25import java.util.ArrayList;
  26import java.util.HashMap;
  27import java.util.List;
  28import java.util.Map;
  29
  30public class AUUtils {
  31	int index = 0;
  32	char[] chars = null;
  33	String rawString = null;
  34	int totalChars = -1;
  35	Value value = null;
  36
  37	AUUtils(String rawString) {
  38		this.rawString = rawString;
  39		System.out.println("rawString = " + rawString);
  40		chars = rawString.toCharArray();
  41		totalChars = chars.length;
  42		value = new EventsValue();
  43
  44		System.out.println("totalChars = " + totalChars);
  45	}
  46
  47	public static void main(String args[]) throws ParserException {
  48		String s = "it=4 an=39<1212,ssss>,40[Lang=dan,gender=female,accent=cajun],47,ts(blaaa),dt(GOOOD),si(asssss)";
  49
  50		AUUtils a = new AUUtils(s);
  51		Value v = a.decode_PlayAnnParmList();
  52		System.out.println("Here it come = " + v.get(ParameterEnum.an) + " " + v.get(ParameterEnum.it));
  53
  54		s = "ip=21 rp=109 nd=102 fa=81 sa=72 dp=#*222 psk=9,nxt sik=*#12345667 na=3";
  55		a = new AUUtils(s);
  56		v = a.decode_PlayColParmList();
  57		System.out.println("Here it come = " + v.get(ParameterEnum.ip) + " " + v.get(ParameterEnum.rp) + " "
  58				+ v.get(ParameterEnum.nd) + " " + v.get(ParameterEnum.fa) + " " + v.get(ParameterEnum.sa) + " "
  59				+ v.get(ParameterEnum.na) + " " + v.get(ParameterEnum.dp) + " " + v.get(ParameterEnum.psk) + " "
  60				+ v.get(ParameterEnum.sik));
  61	}
  62
  63	/*
  64	 * ABNF Definition
  65	 * 
  66	 * PlayAnnParmList = PlayAnnParm *( WSP PlayAnnParm ); PlayAnnParm = (
  67	 * AnnouncementParm / IterationsParm / IntervalParm / DurationParm /
  68	 * SpeedParm / VolumeParm ); AnnouncementParm = AnParmToken EQUALS
  69	 * Segmentlist; Segmentlist = SegmentDescriptor *( COMMA SegmentDescriptor );
  70	 * SegmentDescriptor = ( ( SegmentId [ EmbedVarList ] [ SegSelectorList ] ) / (
  71	 * TextToSpeechSeg [ SegSelectorList ] ) / ( DisplayTextSeg [
  72	 * SegSelectorList ] ) / ( VariableSeg [ SegSelectorList ] ) / SilenceSeg );
  73	 * 
  74	 * 
  75	 * IterationsParm = ItParmToken EQUALS ( NUMBER / "-1" ); IntervalParm =
  76	 * IvParmToken EQUALS NUMBER; DurationParm = DuParmToken EQUALS NUMBER;
  77	 * SpeedParm = SpParmToken EQUALS SIGNEDINT; VolumeParm = VlParmToken EQUALS
  78	 * SIGNEDINT;
  79	 */
  80
  81	public Value decode_PlayAnnParmList() throws ParserException {
  82		boolean f = decode_PlayAnnParm();
  83		if (!f) {
  84			throw new ParserException("Parsing of AnnParm failed");
  85		}
  86		while (f) {
  87			f = decode_WSP();
  88			if (f) {
  89				f = decode_PlayAnnParm();
  90			}
  91		}
  92
  93		return value;
  94	}
  95
  96	public Value decode_PlayColParmList() throws ParserException {
  97		// PlayColParmList = PlayColParm *( WSP PlayColParm );
  98		boolean f = decode_PlayColParm();
  99		if (!f) {
 100			throw new ParserException("Parsing of PlayColParm failed");
 101		}
 102		while (f) {
 103			f = decode_WSP();
 104			if (f) {
 105				f = decode_PlayColParm();
 106			}
 107		}
 108
 109		return value;
 110	}
 111
 112	public Value decode_PlayRecParmList() throws ParserException {
 113		// PlayRecParmList = PlayRecParm *( WSP PlayRecParm );
 114		boolean f = decode_PlayRecParm();
 115		if (!f) {
 116			throw new ParserException("Parsing of PlayRecParm failed");
 117		}
 118		while (f) {
 119			f = decode_WSP();
 120			if (f) {
 121				f = decode_PlayRecParm();
 122			}
 123		}
 124
 125		return value;
 126	}
 127
 128	public Value decode_OpCompleteParmList() throws ParserException {
 129		// PlayRecParmList = PlayRecParm *( WSP PlayRecParm );
 130		boolean f = decode_OpCompleteParm();
 131		if (!f) {
 132			throw new ParserException("Parsing of OpCompleteParm failed");
 133		}
 134		while (f) {
 135			f = decode_WSP();
 136			if (f) {
 137				f = decode_OpCompleteParm();
 138			}
 139		}
 140
 141		return value;
 142	}
 143
 144	// Decode Space or HTAB
 145	private boolean decode_WSP() {
 146		boolean decoded = false;
 147		if (index < totalChars && (chars[index] == 0x20 || chars[index] == 0x09)) {
 148			index++;
 149			decoded = true;
 150		}
 151		return decoded;
 152	}
 153
 154	private boolean decode_Segid(AnnouncementParmValue annPaVa) {
 155		boolean decoded = false;
 156		String strSegId = "";
 157		SegmentId segId = null;
 158
 159		if (chars[index] >= '0' && chars[index] <= '9') {
 160			strSegId = strSegId + chars[index];
 161			decoded = true;
 162			index++;
 163		}
 164		if (decoded) {
 165
 166			for (int i = 0; i <= 31; i++) {
 167				if (index < totalChars && (chars[index] >= '0' && chars[index] <= '9')) {
 168					strSegId = strSegId + chars[index];
 169					index++;
 170				} else {
 171					break;
 172				}
 173			}
 174
 175			segId = new SegmentId(strSegId, null);
 176			annPaVa.addSegmentId(segId);
 177		} else if (chars[index] == '/') {
 178			index = index + 1;
 179			decoded = true;
 180			while (chars[index] != '/') {
 181				strSegId = strSegId + chars[index];
 182				index++;
 183			}
 184			segId = new SegmentId(null, strSegId);
 185			annPaVa.addSegmentId(segId);
 186		}
 187
 188		if (decoded && index < totalChars) {
 189
 190			if (chars[index] == '<') {
 191				index = index + 1;
 192				List<String> embedVarList = new ArrayList<String>();
 193				String tmp = "";
 194				while (chars[index] != '>') {
 195					tmp = tmp + chars[index];
 196					index = index + 1;
 197				}
 198				index = index + 1;
 199				String[] s = tmp.split(",");
 200				for (String sTemp : s) {
 201					embedVarList.add(sTemp);
 202				}
 203				segId.setEmbedVarList(embedVarList);
 204			}
 205
 206			if (chars[index] == '[') {
 207				index = index + 1;
 208				Map<String, String> segSelectorMap = new HashMap<String, String>();
 209				String tmp = "";
 210				while (chars[index] != ']') {
 211					tmp = tmp + chars[index];
 212					index = index + 1;
 213				}
 214				index = index + 1;
 215				String[] s = tmp.split(",");
 216				for (String sTemp : s) {
 217					String[] s1 = sTemp.split("=");
 218					segSelectorMap.put(s1[0], s1[1]);
 219
 220				}
 221				segId.setSegSelectorMap(segSelectorMap);
 222			}
 223		}
 224		return decoded;
 225	}
 226
 227	private boolean decode_TextToSpeechSeg(AnnouncementParmValue annPaVa) {
 228		boolean decoded = false;
 229		String textTpSpeech = "";
 230		if (chars[index] == 't' && chars[index + 1] == 's') {
 231			index = index + 3;
 232			while (chars[index] != ')') {
 233				textTpSpeech = textTpSpeech + chars[index];
 234				index++;
 235			}
 236			decoded = true;
 237			index++;
 238			TextToSpeechSeg ts = new TextToSpeechSeg(textTpSpeech);
 239			annPaVa.addTextToSpeechSeg(ts);
 240
 241			if (index < totalChars && chars[index] == '[') {
 242				index = index + 1;
 243				Map<String, String> segSelectorMap = new HashMap<String, String>();
 244				String tmp = "";
 245				while (chars[index] != ']') {
 246					tmp = tmp + chars[index];
 247					index = index + 1;
 248				}
 249				index = index + 1;
 250				String[] s = tmp.split(",");
 251				for (String sTemp : s) {
 252					String[] s1 = sTemp.split("=");
 253					segSelectorMap.put(s1[0], s1[1]);
 254
 255				}
 256				ts.setSegSelectorMap(segSelectorMap);
 257			}
 258		}
 259
 260		return decoded;
 261	}
 262
 263	private boolean decode_DisplayTextSeg(AnnouncementParmValue annPaVa) {
 264		boolean decoded = false;
 265		String displayText = "";
 266		if (chars[index] == 'd' && chars[index + 1] == 't') {
 267			index = index + 3;
 268			while (chars[index] != ')') {
 269				displayText = displayText + chars[index];
 270				index++;
 271			}
 272			decoded = true;
 273			index++;
 274			DisplayTextSeg ds = new DisplayTextSeg(displayText);
 275			annPaVa.addDisplayTextSeg(ds);
 276
 277			if (index < totalChars && chars[index] == '[') {
 278				index = index + 1;
 279				Map<String, String> segSelectorMap = new HashMap<String, String>();
 280				String tmp = "";
 281				while (chars[index] != ']') {
 282					tmp = tmp + chars[index];
 283					index = index + 1;
 284				}
 285				index = index + 1;
 286				String[] s = tmp.split(",");
 287				for (String sTemp : s) {
 288					String[] s1 = sTemp.split("=");
 289					segSelectorMap.put(s1[0], s1[1]);
 290
 291				}
 292				ds.setSegSelectorMap(segSelectorMap);
 293			}
 294		}
 295
 296		return decoded;
 297	}
 298
 299	private boolean decode_SilenceSeg(AnnouncementParmValue annPaVa) {
 300		boolean decoded = false;
 301		if (index < totalChars && chars[index] == 's' && chars[index + 1] == 'i') {
 302			index = index + 3;
 303			String silenceSeg = "";
 304			while (chars[index] != ')') {
 305				silenceSeg = silenceSeg + chars[index];
 306				index++;
 307			}
 308			index++;
 309
 310			SilenceSeg si = new SilenceSeg(silenceSeg);
 311			annPaVa.addSilenceSeg(si);
 312		}
 313		return decoded;
 314	}
 315
 316	// SegmentDescriptor = ( ( SegmentId [ EmbedVarList ] [ SegSelectorList ] )
 317	// / ( TextToSpeechSeg [ SegSelectorList ] ) / ( DisplayTextSeg [
 318	// SegSelectorList ] ) / ( VariableSeg [ SegSelectorList ] ) / SilenceSeg );
 319	private boolean decode_SegmentDescriptor(AnnouncementParmValue annPaVa) throws ParserException {
 320		boolean decoded = false;
 321		decoded = decode_Segid(annPaVa);
 322		if (!decoded) {
 323			decoded = decode_TextToSpeechSeg(annPaVa);
 324		}
 325		if (!decoded) {
 326			decoded = decode_DisplayTextSeg(annPaVa);
 327		}
 328		// TODO VariableSeg impl pending
 329
 330		if (!decoded) {
 331			decoded = decode_SilenceSeg(annPaVa);
 332		}
 333		return decoded;
 334	}
 335
 336	// Segmentlist = SegmentDescriptor *( COMMA SegmentDescriptor );
 337	private boolean decode_Segmentlist(AnnouncementParmValue annPaVa) throws ParserException {
 338		boolean decoded = false;
 339
 340		decoded = decode_SegmentDescriptor(annPaVa);
 341		if (decoded) {
 342			boolean f = true;
 343
 344			while (f && index < totalChars) {
 345				if (chars[index] == ',') {
 346					index++;
 347					f = decode_SegmentDescriptor(annPaVa);
 348				} else {
 349					f = false;
 350				}
 351
 352			}
 353		}
 354		return decoded;
 355	}
 356
 357	/*
 358	 * OpCompleteParm = ( VoiceInterruptParm / IntKeySeqParm / NumAttemptsParm /
 359	 * AmtPlayedParm / DigitsColParm / RecordingIdParm / ReturnCodeParm );
 360	 */
 361	public boolean decode_OpCompleteParm() throws ParserException {
 362		boolean decoded = false;
 363		if (chars[index] == 'v' && chars[index + 1] == 'i') {
 364			// VoiceInterruptParm = ViParmToken EQUALS BOOLSTR;
 365			index = index + 3;
 366			boolean boolStrValue = decode_BOOLSTR();
 367			BooleanValue boolValue = new BooleanValue(ParameterEnum.vi, boolStrValue);
 368			value.put(ParameterEnum.vi, boolValue);
 369			decoded = true;
 370		} else if (chars[index] == 'i' && chars[index + 1] == 'k') {
 371			// IntKeySeqParm = IkParmToken EQUALS CommandKeySequence;
 372			index = index + 3;
 373			String cmdKeySequence = "";
 374			if ((chars[index] >= '0' && chars[index] <= '9') || chars[index] == '*' || chars[index] == '#') {
 375				decoded = true;
 376				cmdKeySequence = cmdKeySequence + chars[index];
 377				index++;
 378				for (int i = 1; i < 3 && (index < totalChars); i++) {
 379					if ((chars[index] >= '0' && chars[index] <= '9') || chars[index] == '*' || chars[index] == '#') {
 380						cmdKeySequence = cmdKeySequence + chars[index];
 381						index++;
 382					} else {
 383						break;
 384					}
 385				}
 386
 387				StringValue s = new StringValue(ParameterEnum.ik, cmdKeySequence);
 388				value.put(ParameterEnum.ik, s);
 389				decoded = true;
 390
 391			} else {
 392				throw new ParserException("Decoding of IntKeySeqParm failed");
 393			}
 394
 395		} else if (chars[index] == 'n' && chars[index + 1] == 'a') {
 396			// NumAttemptsParm = NaParmToken EQUALS NUMBER;
 397			index = index + 3;
 398			int number = decode_NUMBER();
 399			NumberValue n = new NumberValue(ParameterEnum.na, number);
 400			value.put(ParameterEnum.na, n);
 401			decoded = true;
 402		} else if (chars[index] == 'a' && chars[index + 1] == 'p') {
 403			// AmtPlayedParm = ApParmToken EQUALS NUMBER;
 404			index = index + 3;
 405			int number = decode_NUMBER();
 406			NumberValue n = new NumberValue(ParameterEnum.ap, number);
 407			value.put(ParameterEnum.ap, n);
 408			decoded = true;
 409		} else if (chars[index] == 'd' && chars[index + 1] == 'c') {
 410			// DigitsColParm = DcParmToken EQUALS KeySequence;
 411			index = index + 3;
 412			String keySequence = "";
 413			if ((chars[index] >= '0' && chars[index] <= '9') || chars[index] == '*' || chars[index] == '#') {
 414				decoded = true;
 415				keySequence = keySequence + chars[index];
 416				index++;
 417				for (int i = 1; i < 64 && (index < totalChars); i++) {
 418					if ((chars[index] >= '0' && chars[index] <= '9') || chars[index] == '*' || chars[index] == '#') {
 419						keySequence = keySequence + chars[index];
 420						index++;
 421					} else {
 422						break;
 423					}
 424				}
 425
 426				StringValue s = new StringValue(ParameterEnum.dc, keySequence);
 427				value.put(ParameterEnum.dc, s);
 428				decoded = true;
 429
 430			} else {
 431				throw new ParserException("Decoding of DigitsColParm failed");
 432			}
 433
 434		} else if (chars[index] == 'r' && chars[index + 1] == 'i') {
 435			// RecordingIdParm = RiParmToken EQUALS NUMBER;
 436			index = index + 3;
 437			int number = decode_NUMBER();
 438			NumberValue n = new NumberValue(ParameterEnum.ri, number);
 439			value.put(ParameterEnum.ri, n);
 440			decoded = true;
 441
 442		} else if (chars[index] == 'r' && chars[index + 1] == 'c') {
 443			// ReturnCodeParm = RcParmToken EQUALS 3*3(DIGIT);
 444			index = index + 3;
 445			String rc = "";
 446			if (chars[index] >= '0' && chars[index] <= '9') {
 447				rc = rc + chars[index];
 448				index++;
 449				if (chars[index] >= '0' && chars[index] <= '9') {
 450					rc = rc + chars[index];
 451					index++;
 452					if (chars[index] >= '0' && chars[index] <= '9') {
 453						rc = rc + chars[index];
 454						index++;
 455
 456						try {
 457							int number = Integer.parseInt(rc);
 458							NumberValue n = new NumberValue(ParameterEnum.rc, number);
 459							value.put(ParameterEnum.rc, n);
 460							decoded = true;
 461						} catch (NumberFormatException e) {
 462							throw new ParserException(
 463									"Decoding of ReturnCodeParm failed. The Return code is not number");
 464						}
 465
 466					} else {
 467						throw new ParserException("Decoding of ReturnCodeParm failed");
 468					}
 469				} else {
 470					throw new ParserException("Decoding of ReturnCodeParm failed");
 471				}
 472
 473			} else {
 474				throw new ParserException("Decoding of ReturnCodeParm failed");
 475			}
 476
 477		} else {
 478			throw new ParserException("Decoding of PlayRecParm failed");
 479		}
 480		return decoded;
 481	}
 482
 483	/*
 484	 * PlayRecParm = ( InitPromptParm / RepromptParm / NoSpeechParm /
 485	 * FailAnnParm / SuccessAnnParm / NoInterruptParm / SpeedParm / VolumeParm /
 486	 * ClearBufferParm / PreSpeechParm / PostSpeechParm / RecordLenParm /
 487	 * RestartKeyParm / ReinputKeyParm / ReturnKeyParm / PosKeyParm /
 488	 * StopKeyParm / EndInputKeyParm / RecPersistParm / OverrideAudioParm /
 489	 * RestoreAudioParm / DeletePersistParm / NumAttemptsParm );
 490	 */
 491	public boolean decode_PlayRecParm() throws ParserException {
 492		boolean decoded = false;
 493		if (chars[index] == 'i' && chars[index + 1] == 'p') {
 494			index = index + 3;
 495			AnnouncementParmValue annPaVa = new AnnouncementParmValue(ParameterEnum.ip);
 496			value.put(ParameterEnum.ip, annPaVa);
 497			// InitPromptParm = IpParmToken EQUALS Segmentlist;
 498			decoded = decode_Segmentlist(annPaVa);
 499		} else if (chars[index] == 'r' && chars[index + 1] == 'p') {
 500			index = index + 3;
 501			AnnouncementParmValue annPaVa = new AnnouncementParmValue(ParameterEnum.rp);
 502			value.put(ParameterEnum.rp, annPaVa);
 503			// RepromptParm = RpParmToken EQUALS Segmentlist;;
 504			decoded = decode_Segmentlist(annPaVa);
 505		} else if (chars[index] == 'n' && chars[index + 1] == 's') {
 506			// NoSpeechParm = NsParmToken EQUALS Segmentlist;
 507			index = index + 3;
 508			AnnouncementParmValue annPaVa = new AnnouncementParmValue(ParameterEnum.ns);
 509			value.put(ParameterEnum.ns, annPaVa);
 510			decoded = decode_Segmentlist(annPaVa);
 511		} else if (chars[index] == 'f' && chars[index + 1] == 'a') {
 512			index = index + 3;
 513			AnnouncementParmValue annPaVa = new AnnouncementParmValue(ParameterEnum.fa);
 514			value.put(ParameterEnum.fa, annPaVa);
 515			// FailAnnParm = FaParmToken EQUALS Segmentlist;
 516			decoded = decode_Segmentlist(annPaVa);
 517		} else if (chars[index] == 's' && chars[index + 1] == 'a') {
 518			index = index + 3;
 519			AnnouncementParmValue annPaVa = new AnnouncementParmValue(ParameterEnum.sa);
 520			value.put(ParameterEnum.sa, annPaVa);
 521			// SuccessAnnParm = SaParmToken EQUALS Segmentlist;
 522			decoded = decode_Segmentlist(annPaVa);
 523		} else if (chars[index] == 'n' && chars[index + 1] == 'i') {
 524			index = index + 3;
 525			// NoInterruptParm = NiParmToken EQUALS BOOLSTR;
 526			boolean boolStrValue = decode_BOOLSTR();
 527			BooleanValue boolValue = new BooleanValue(ParameterEnum.ni, boolStrValue);
 528			value.put(ParameterEnum.ni, boolValue);
 529			decoded = true;
 530		} else if (chars[index] == 's' && chars[index + 1] == 'p') {
 531			index = index + 3;
 532			// SpeedParm = SpParmToken EQUALS SIGNEDINT;
 533			String s = decode_SIGNEDINT();
 534			StringValue sValue = new StringValue(ParameterEnum.sp, s);
 535			value.put(ParameterEnum.sp, sValue);
 536			decoded = true;
 537		} else if (chars[index] == 'v' && chars[index + 1] == 'l') {
 538			index = index + 3;
 539			// VolumeParm = VlParmToken EQUALS SIGNEDINT;
 540			String s = decode_SIGNEDINT();
 541			StringValue sValue = new StringValue(ParameterEnum.vl, s);
 542			value.put(ParameterEnum.vl, sValue);
 543			decoded = true;
 544		} else if (chars[index] == 'c' && chars[index + 1] == 'b') {
 545			index = index + 3;
 546			// ClearBufferParm = CbParmToken EQUALS BOOLSTR;
 547			boolean boolStrValue = decode_BOOLSTR();
 548			BooleanValue boolValue = new BooleanValue(ParameterEnum.cb, boolStrValue);
 549			value.put(ParameterEnum.cb, boolValue);
 550			decoded = true;
 551		} else if (chars[index] == 'p' && chars[index + 1] == 'r' && chars[index + 2] == 't') {
 552			// PreSpeechParm = PrtParmToken EQUALS NUMBER;
 553			index = index + 4;
 554			int number = decode_NUMBER();
 555			NumberValue n = new NumberValue(ParameterEnum.prt, number);
 556			value.put(ParameterEnum.prt, n);
 557			decoded = true;
 558
 559		} else if (chars[index] == 'p' && chars[index + 1] == 's' && chars[index + 2] == 't') {
 560			// PostSpeechParm = PstParmToken EQUALS NUMBER;
 561			index = index + 4;
 562			int number = decode_NUMBER();
 563			NumberValue n = new NumberValue(ParameterEnum.pst, number);
 564			value.put(ParameterEnum.pst, n);
 565			decoded = true;
 566		} else if (chars[index] == 'r' && chars[index + 1] == 'l' && chars[index + 2] == 't') {
 567			// RecordLenParm = RltParmToken EQUALS NUMBER;
 568			index = index + 4;
 569			int number = decode_NUMBER();
 570			NumberValue n = new NumberValue(ParameterEnum.rlt, number);
 571			value.put(ParameterEnum.rlt, n);
 572			decoded = true;
 573		} else if (chars[index] == 'r' && chars[index + 1] == 's' && chars[index + 2] == 'k') {
 574			// RestartKeyParm = RskParmToken EQUALS CommandKeySequence;
 575			index = index + 4;
 576			String cmdKeySequence = "";
 577			if ((chars[index] >= '0' && chars[index] <= '9') || chars[index] == '*' || chars[index] == '#') {
 578				decoded = true;
 579				cmdKeySequence = cmdKeySequence + chars[index];
 580				index++;
 581				for (int i = 1; i < 3 && (index < totalChars); i++) {
 582					if ((chars[index] >= '0' && chars[index] <= '9') || chars[index] == '*' || chars[index] == '#') {
 583						cmdKeySequence = cmdKeySequence + chars[index];
 584						index++;
 585					} else {
 586						break;
 587					}
 588				}
 589
 590				StringValue s = new StringValue(ParameterEnum.rsk, cmdKeySequence);
 591				value.put(ParameterEnum.rsk, s);
 592				decoded = true;
 593
 594			} else {
 595				throw new ParserException("Decoding of RestartKeyParm failed");
 596			}
 597
 598		} else if (chars[index] == 'r' && chars[index + 1] == 'i' && chars[index + 2] == 'k') {
 599			// ReinputKeyParm = RikParmToken EQUALS CommandKeySequence;
 600			index = index + 4;
 601			String cmdKeySequence = "";
 602			if ((chars[index] >= '0' && chars[index] <= '9') || chars[index] == '*' || chars[index] == '#') {
 603				decoded = true;
 604				cmdKeySequence = cmdKeySequence + chars[index];
 605				index++;
 606				for (int i = 1; i < 3 && (index < totalChars); i++) {
 607					if ((chars[index] >= '0' && chars[index] <= '9') || chars[index] == '*' || chars[index] == '#') {
 608						cmdKeySequence = cmdKeySequence + chars[index];
 609						index++;
 610					} else {
 611						break;
 612					}
 613				}
 614
 615				StringValue s = new StringValue(ParameterEnum.rik, cmdKeySequence);
 616				value.put(ParameterEnum.rik, s);
 617				decoded = true;
 618			} else {
 619				throw new ParserException("Decoding of ReinputKeyParm failed");
 620			}
 621
 622		} else if (chars[index] == 'r' && chars[index + 1] == 't' && chars[index + 2] == 'k') {
 623			// ReturnKeyParm = RtkParmToken EQUALS CommandKeySequence;
 624			index = index + 4;
 625			String cmdKeySequence = "";
 626			if ((chars[index] >= '0' && chars[index] <= '9') || chars[index] == '*' || chars[index] == '#') {
 627				decoded = true;
 628				cmdKeySequence = cmdKeySequence + chars[index];
 629				index++;
 630				for (int i = 1; i < 3 && (index < totalChars); i++) {
 631					if ((chars[index] >= '0' && chars[index] <= '9') || chars[index] == '*' || chars[index] == '#') {
 632						cmdKeySequence = cmdKeySequence + chars[index];
 633						index++;
 634					} else {
 635						break;
 636					}
 637				}
 638
 639				StringValue s = new StringValue(ParameterEnum.rtk, cmdKeySequence);
 640				value.put(ParameterEnum.rtk, s);
 641				decoded = true;
 642			} else {
 643				throw new ParserException("Decoding of ReinputKeyParm failed");
 644			}
 645		} else if (chars[index] == 'p' && chars[index + 1] == 's' && chars[index + 2] == 'k') {
 646			// PosKeyParm = PskParmToken EQUALS KeyPadKey COMMA
 647			// PosKeyAction;
 648			index = index + 4;
 649
 650			if ((chars[index] >= '0' && chars[index] <= '9') || chars[index] == '*' || chars[index] == '#') {
 651				String keyPadKey = String.valueOf(chars[index]);
 652				String posKeyAction = null;
 653				index++;
 654				if (chars[index] == ',') {
 655					index++;
 656					// PosKeyAction = FirstSegmentToken / LastSegmentToken /
 657					// PreviousSegmentToken / NextSegmentToken /
 658					// CurrentSegmentToken;
 659					if (chars[index] == 'f' && chars[index + 1] == 's' && chars[index + 2] == 't') {
 660						posKeyAction = "fst";
 661						index = index + 3;
 662					} else if (chars[index] == 'l' && chars[index + 1] == 's' && chars[index + 2] == 't') {
 663						posKeyAction = "lst";
 664						index = index + 3;
 665					} else if (chars[index] == 'p' && chars[index + 1] == 'r' && chars[index + 2] == 'v') {
 666						posKeyAction = "prv";
 667						index = index + 3;
 668					} else if (chars[index] == 'n' && chars[index + 1] == 'x' && chars[index + 2] == 't') {
 669						posKeyAction = "nxt";
 670						index = index + 3;
 671					} else if (chars[index] == 'c' && chars[index + 1] == 'u' && chars[index + 2] == 'r') {
 672						posKeyAction = "cur";
 673						index = index + 3;
 674					} else {
 675						throw new ParserException("Decoding of PosKeyParm's PosKeyAction failed");
 676					}
 677					PosKeyValue p = new PosKeyValue(ParameterEnum.psk, keyPadKey, posKeyAction);
 678					value.put(ParameterEnum.psk, p);
 679					decoded = true;
 680				} else {
 681					throw new ParserException("Decoding of PosKeyParm failed. No comma found after KeyPadKey");
 682				}
 683
 684			} else {
 685				throw new ParserException("Decoding of PosKeyParm failed");
 686			}
 687		} else if (chars[index] == 's' && chars[index + 1] == 't' && chars[index + 2] == 'k') {
 688			// StopKeyParm = StkParmToken EQUALS KeyPadKey;
 689			index = index + 4;
 690			if ((chars[index] >= '0' && chars[index] <= '9') || chars[index] == '*' || chars[index] == '#') {
 691				StringValue s = new StringValue(ParameterEnum.stk, String.valueOf(chars[index]));
 692				value.put(ParameterEnum.stk, s);
 693				index++;
 694				decoded = true;
 695			} else {
 696				throw new ParserException("Decoding of StopKeyParm failed.");
 697			}
 698
 699		} else if (chars[index] == 'e' && chars[index + 1] == 'i' && chars[index + 2] == 'k') {
 700			// EndInputKeyParm = EikParmToken EQUALS KeyPadKey;
 701			index = index + 4;
 702			if ((chars[index] >= '0' && chars[index] <= '9') || chars[index] == '*' || chars[index] == '#') {
 703				StringValue s = new StringValue(ParameterEnum.eik, String.valueOf(chars[index]));
 704				value.put(ParameterEnum.eik, s);
 705				index++;
 706				decoded = true;
 707			} else {
 708				throw new ParserException("Decoding of EndInputKeyParm failed.");
 709			}
 710		} else if (chars[index] == 'e' && chars[index + 1] == 'i' && chars[index + 2] == 'k') {
 711			// RecPersistParm = RpaParmToken EQUALS BOOLSTR;
 712			index = index + 4;
 713			boolean boolStrValue = decode_BOOLSTR();
 714			BooleanValue boolValue = new BooleanValue(ParameterEnum.eik, boolStrValue);
 715			value.put(ParameterEnum.eik, boolValue);
 716			decoded = true;
 717		} else if (chars[index] == 'o' && chars[index + 1] == 'a') {
 718			// OverrideAudioParm = OaParmToken EQUALS SEGID;
 719			int number = decode_NUMBER();
 720			NumberValue n = new NumberValue(ParameterEnum.oa, number);
 721			value.put(ParameterEnum.oa, n);
 722			decoded = true;
 723		} else if (chars[index] == 'r' && chars[index + 1] == 'a') {
 724			// RestoreAudioParm = RaParmToken EQUALS SEGID;
 725			int number = decode_NUMBER();
 726			NumberValue n = new NumberValue(ParameterEnum.ra, number);
 727			value.put(ParameterEnum.ra, n);
 728			decoded = true;
 729		} else if (chars[index] == 'd' && chars[index + 1] == 'p' && chars[index + 2] == 'a') {
 730			// DeletePersistParm = DpaParmToken EQUALS SEGID;
 731			int number = decode_NUMBER();
 732			NumberValue n = new NumberValue(ParameterEnum.dpa, number);
 733			value.put(ParameterEnum.dpa, n);
 734			decoded = true;
 735		} else if (chars[index] == 'n' && chars[index + 1] == 'a') {
 736			// NumAttemptsParm = NaParmToken EQUALS NUMBER;
 737			index = index + 3;
 738			int number = decode_NUMBER();
 739			NumberValue n = new NumberValue(ParameterEnum.na, number);
 740			value.put(ParameterEnum.na, n);
 741			decoded = true;
 742		} else {
 743			throw new ParserException("Decoding of PlayRecParm failed");
 744		}
 745		return decoded;
 746	}
 747
 748	/*
 749	 * PlayColParm = ( InitPromptParm / RepromptParm / NoDigitsParm /
 750	 * FailAnnParm / SuccessAnnParm / NoInterruptParm / SpeedParm / VolumeParm /
 751	 * ClearBufferParm / MaxDigitsParm / MinDigitsParm / DigitPatternParm /
 752	 * FirstDigitParm / InterDigitParm / ExtraDigitParm / RestartKeyParm /
 753	 * ReinputKeyParm / ReturnKeyParm / PosKeyParm / StopKeyParm /
 754	 * StartInputKeyParm / EndInputKeyParm / IncludeEndInputKey /
 755	 * NumAttemptsParm );
 756	 */
 757	private boolean decode_PlayColParm() throws ParserException {
 758		boolean decoded = false;
 759		if (index < totalChars) {
 760			if (chars[index] == 'i' && chars[index + 1] == 'p') {
 761				index = index + 3;
 762				AnnouncementParmValue annPaVa = new AnnouncementParmValue(ParameterEnum.ip);
 763				value.put(ParameterEnum.ip, annPaVa);
 764				// InitPromptParm = IpParmToken EQUALS Segmentlist;
 765				decoded = decode_Segmentlist(annPaVa);
 766			} else if (chars[index] == 'r' && chars[index + 1] == 'p') {
 767				index = index + 3;
 768				AnnouncementParmValue annPaVa = new AnnouncementParmValue(ParameterEnum.rp);
 769				value.put(ParameterEnum.rp, annPaVa);
 770				// RepromptParm = RpParmToken EQUALS Segmentlist;;
 771				decoded = decode_Segmentlist(annPaVa);
 772			} else if (chars[index] == 'n' && chars[index + 1] == 'd') {
 773				index = index + 3;
 774				AnnouncementParmValue annPaVa = new AnnouncementParmValue(ParameterEnum.nd);
 775				value.put(ParameterEnum.nd, annPaVa);
 776				// NoDigitsParm = NdParmToken EQUALS Segmentlist;
 777				decoded = decode_Segmentlist(annPaVa);
 778			} else if (chars[index] == 'f' && chars[index + 1] == 'a') {
 779				index = index + 3;
 780				AnnouncementParmValue annPaVa = new AnnouncementParmValue(ParameterEnum.fa);
 781				value.put(ParameterEnum.fa, annPaVa);
 782				// FailAnnParm = FaParmToken EQUALS Segmentlist;
 783				decoded = decode_Segmentlist(annPaVa);
 784			} else if (chars[index] == 's' && chars[index + 1] == 'a') {
 785				index = index + 3;
 786				AnnouncementParmValue annPaVa = new AnnouncementParmValue(ParameterEnum.sa);
 787				value.put(ParameterEnum.sa, annPaVa);
 788				// SuccessAnnParm = SaParmToken EQUALS Segmentlist;
 789				decoded = decode_Segmentlist(annPaVa);
 790			} else if (chars[index] == 'n' && chars[index + 1] == 'i') {
 791				index = index + 3;
 792				// NoInterruptParm = NiParmToken EQUALS BOOLSTR;
 793				boolean boolStrValue = decode_BOOLSTR();
 794				BooleanValue boolValue = new BooleanValue(ParameterEnum.ni, boolStrValue);
 795				value.put(ParameterEnum.ni, boolValue);
 796				decoded = true;
 797			} else if (chars[index] == 's' && chars[index + 1] == 'p') {
 798				index = index + 3;
 799				// SpeedParm = SpParmToken EQUALS SIGNEDINT;
 800				String s = decode_SIGNEDINT();
 801				StringValue sValue = new StringValue(ParameterEnum.sp, s);
 802				value.put(ParameterEnum.sp, sValue);
 803				decoded = true;
 804			} else if (chars[index] == 'v' && chars[index + 1] == 'l') {
 805				index = index + 3;
 806				// VolumeParm = VlParmToken EQUALS SIGNEDINT;
 807				String s = decode_SIGNEDINT();
 808				StringValue sValue = new StringValue(ParameterEnum.vl, s);
 809				value.put(ParameterEnum.vl, sValue);
 810				decoded = true;
 811			} else if (chars[index] == 'c' && chars[index + 1] == 'b') {
 812				index = index + 3;
 813				// ClearBufferParm = CbParmToken EQUALS BOOLSTR;
 814				boolean boolStrValue = decode_BOOLSTR();
 815				BooleanValue boolValue = new BooleanValue(ParameterEnum.cb, boolStrValue);
 816				value.put(ParameterEnum.cb, boolValue);
 817				decoded = true;
 818			} else if (chars[index] == 'm' && chars[index + 1] == 'x') {
 819				index = index + 3;
 820				// MaxDigitsParm = MxParmToken EQUALS NUMBER;
 821				int number = decode_NUMBER();
 822				NumberValue n = new NumberValue(ParameterEnum.mx, number);
 823				value.put(ParameterEnum.mx, n);
 824				decoded = true;
 825			} else if (chars[index] == 'm' && chars[index + 1] == 'n') {
 826				// MinDigitsParm = MnParmToken EQUALS NUMBER;
 827				index = index + 3;
 828				int number = decode_NUMBER();
 829				NumberValue n = new NumberValue(ParameterEnum.mn, number);
 830				value.put(ParameterEnum.mn, n);
 831				decoded = true;
 832			} else if (chars[index] == 'd' && chars[index + 1] == 'p') {
 833				// DigitPatternParm = DpParmToken EQUALS DIGITPATTERN;
 834				// DIGITPATTERN = DigitString *(DigitString) ;
 835				// DigitString = DIGIT / "*" / "#" / "A" / "B" / "C" / "D";
 836				index = index + 3;
 837				String digitPattern = "";
 838				while (!(chars[index] == 0x20 || chars[index] == 0x09)) {
 839					digitPattern = digitPattern + chars[index];
 840					index++;
 841				}
 842				decoded = true;
 843				StringValue s = new StringValue(ParameterEnum.dp, digitPattern);
 844				value.put(ParameterEnum.dp, s);
 845			} else if (chars[index] == 'f' && chars[index + 1] == 'd' && chars[index + 2] == 't') {
 846				// FirstDigitParm = FdtParmToken EQUALS NUMBER;
 847				index = index + 4;
 848				int number = decode_NUMBER();
 849				NumberValue n = new NumberValue(ParameterEnum.fdt, number);
 850				value.put(ParameterEnum.fdt, n);
 851				decoded = true;
 852
 853			} else if (chars[index] == 'i' && chars[index + 1] == 'd' && chars[index + 2] == 't') {
 854				// InterDigitParm = IdtParmToken EQUALS NUMBER;
 855				index = index + 4;
 856				int number = decode_NUMBER();
 857				NumberValue n = new NumberValue(ParameterEnum.idt, number);
 858				value.put(ParameterEnum.idt, n);
 859				decoded = true;
 860
 861			} else if (chars[index] == 'e' && chars[index + 1] == 'd' && chars[index + 2] == 't') {
 862				// ExtraDigitParm = EdtParmToken EQUALS NUMBER;
 863				index = index + 4;
 864				int number = decode_NUMBER();
 865				NumberValue n = new NumberValue(ParameterEnum.edt, number);
 866				value.put(ParameterEnum.edt, n);
 867				decoded = true;
 868
 869			} else if (chars[index] == 'r' && chars[index + 1] == 's' && chars[index + 2] == 'k') {
 870				// RestartKeyParm = RskParmToken EQUALS CommandKeySequence;
 871				index = index + 4;
 872				String cmdKeySequence = "";
 873				if ((chars[index] >= '0' && chars[index] <= '9') || chars[index] == '*' || chars[index] == '#') {
 874					decoded = true;
 875					cmdKeySequence = cmdKeySequence + chars[index];
 876					index++;
 877					for (int i = 1; i < 3 && (index < totalChars); i++) {
 878						if ((chars[index] >= '0' && chars[index] <= '9') || chars[index] == '*' || chars[index] == '#') {
 879							cmdKeySequence = cmdKeySequence + chars[index];
 880							index++;
 881						} else {
 882							break;
 883						}
 884					}
 885
 886					StringValue s = new StringValue(ParameterEnum.rsk, cmdKeySequence);
 887					value.put(ParameterEnum.rsk, s);
 888					decoded = true;
 889
 890				} else {
 891					throw new ParserException("Decoding of RestartKeyParm failed");
 892				}
 893
 894			} else if (chars[index] == 'r' && chars[index + 1] == 'i' && chars[index + 2] == 'k') {
 895				// ReinputKeyParm = RikParmToken EQUALS CommandKeySequence;
 896				index = index + 4;
 897				String cmdKeySequence = "";
 898				if ((chars[index] >= '0' && chars[index] <= '9') || chars[index] == '*' || chars[index] == '#') {
 899					decoded = true;
 900					cmdKeySequence = cmdKeySequence + chars[index];
 901					index++;
 902					for (int i = 1; i < 3 && (index < totalChars); i++) {
 903						if ((chars[index] >= '0' && chars[index] <= '9') || chars[index] == '*' || chars[index] == '#') {
 904							cmdKeySequence = cmdKeySequence + chars[index];
 905							index++;
 906						} else {
 907							break;
 908						}
 909					}
 910
 911					StringValue s = new StringValue(ParameterEnum.rik, cmdKeySequence);
 912					value.put(ParameterEnum.rik, s);
 913					decoded = true;
 914				} else {
 915					throw new ParserException("Decoding of ReinputKeyParm failed");
 916				}
 917
 918			} else if (chars[index] == 'r' && chars[index + 1] == 't' && chars[index + 2] == 'k') {
 919				// ReturnKeyParm = RtkParmToken EQUALS CommandKeySequence;
 920				index = index + 4;
 921				String cmdKeySequence = "";
 922				if ((chars[index] >= '0' && chars[index] <= '9') || chars[index] == '*' || chars[index] == '#') {
 923					decoded = true;
 924					cmdKeySequence = cmdKeySequence + chars[index];
 925					index++;
 926					for (int i = 1; i < 3 && (index < totalChars); i++) {
 927						if ((chars[index] >= '0' && chars[index] <= '9') || chars[index] == '*' || chars[index] == '#') {
 928							cmdKeySequence = cmdKeySequence + chars[index];
 929							index++;
 930						} else {
 931							break;
 932						}
 933					}
 934
 935					StringValue s = new StringValue(ParameterEnum.rtk, cmdKeySequence);
 936					value.put(ParameterEnum.rtk, s);
 937					decoded = true;
 938				} else {
 939					throw new ParserException("Decoding of ReinputKeyParm failed");
 940				}
 941			} else if (chars[index] == 'p' && chars[index + 1] == 's' && chars[index + 2] == 'k') {
 942				// PosKeyParm = PskParmToken EQUALS KeyPadKey COMMA
 943				// PosKeyAction;
 944				index = index + 4;
 945
 946				if ((chars[index] >= '0' && chars[index] <= '9') || chars[index] == '*' || chars[index] == '#') {
 947					String keyPadKey = String.valueOf(chars[index]);
 948					String posKeyAction = null;
 949					index++;
 950					if (chars[index] == ',') {
 951						index++;
 952						// PosKeyAction = FirstSegmentToken / LastSegmentToken /
 953						// PreviousSegmentToken / NextSegmentToken /
 954						// CurrentSegmentToken;
 955						if (chars[index] == 'f' && chars[index + 1] == 's' && chars[index + 2] == 't') {
 956							posKeyAction = "fst";
 957							index = index + 3;
 958						} else if (chars[index] == 'l' && chars[index + 1] == 's' && chars[index + 2] == 't') {
 959							posKeyAction = "lst";
 960							index = index + 3;
 961						} else if (chars[index] == 'p' && chars[index + 1] == 'r' && chars[index + 2] == 'v') {
 962							posKeyAction = "prv";
 963							index = index + 3;
 964						} else if (chars[index] == 'n' && chars[index + 1] == 'x' && chars[index + 2] == 't') {
 965							posKeyAction = "nxt";
 966							index = index + 3;
 967						} else if (chars[index] == 'c' && chars[index + 1] == 'u' && chars[index + 2] == 'r') {
 968							posKeyAction = "cur";
 969							index = index + 3;
 970						} else {
 971							throw new ParserException("Decoding of PosKeyParm's PosKeyAction failed");
 972						}
 973						PosKeyValue p = new PosKeyValue(ParameterEnum.psk, keyPadKey, posKeyAction);
 974						value.put(ParameterEnum.psk, p);
 975						decoded = true;
 976					} else {
 977						throw new ParserException("Decoding of PosKeyParm failed. No comma found after KeyPadKey");
 978					}
 979
 980				} else {
 981					throw new ParserException("Decoding of PosKeyParm failed");
 982				}
 983			} else if (chars[index] == 's' && chars[index + 1] == 't' && chars[index + 2] == 'k') {
 984				// StopKeyParm = StkParmToken EQUALS KeyPadKey;
 985				index = index + 4;
 986				if ((chars[index] >= '0' && chars[index] <= '9') || chars[index] == '*' || chars[index] == '#') {
 987					StringValue s = new StringValue(ParameterEnum.stk, String.valueOf(chars[index]));
 988					value.put(ParameterEnum.stk, s);
 989					index++;
 990					decoded = true;
 991				} else {
 992					throw new ParserException("Decoding of StopKeyParm failed.");
 993				}
 994
 995			} else if (chars[index] == 's' && chars[index + 1] == 'i' && chars[index + 2] == 'k') {
 996				// StartInputKeyParm = SikParmToken EQUALS KeySet;
 997				index = index + 4;
 998				// KeySet = 1*11(KeyPadKey);
 999				String keySet = "";
1000				if ((chars[index] >= '0' && chars[index] <= '9') || chars[index] == '*' || chars[index] == '#') {
1001					keySet = keySet + chars[index];
1002					index++;
1003
1004					for (int i = 1; i < 11 && (!(chars[index] == 0x20 || chars[index] == 0x09)); i++) {
1005						keySet = keySet + chars[index];
1006						index++;
1007					}
1008
1009					StringValue s = new StringValue(ParameterEnum.sik, keySet);
1010					value.put(ParameterEnum.sik, s);
1011					decoded = true;
1012				} else {
1013					throw new ParserException("Decoding of StartInputKeyParm failed.");
1014				}
1015			} else if (chars[index] == 'e' && chars[index + 1] == 'i' && chars[index + 2] == 'k') {
1016				// EndInputKeyParm = EikParmToken EQUALS KeyPadKey;
1017				index = index + 4;
1018				if ((chars[index] >= '0' && chars[index] <= '9') || chars[index] == '*' || chars[index] == '#') {
1019					StringValue s = new StringValue(ParameterEnum.eik, String.valueOf(chars[index]));
1020					value.put(ParameterEnum.eik, s);
1021					index++;
1022					decoded = true;
1023				} else {
1024					throw new ParserException("Decoding of EndInputKeyParm failed.");
1025				}
1026
1027			} else if (chars[index] == 'i' && chars[index + 1] == 'e' && chars[index + 2] == 'k') {
1028				// IncludeEndinputKey = IekParmToken EQUALS BOOLSTR;
1029				index = index + 4;
1030				boolean boolStrValue = decode_BOOLSTR();
1031				BooleanValue boolValue = new BooleanValue(ParameterEnum.iek, boolStrValue);
1032				value.put(ParameterEnum.iek, boolValue);
1033				decoded = true;
1034
1035			} else if (chars[index] == 'n' && chars[index + 1] == 'a') {
1036				// NumAttemptsParm = NaParmToken EQUALS NUMBER;
1037				index = index + 3;
1038				int number = decode_NUMBER();
1039				NumberValue n = new NumberValue(ParameterEnum.na, number);
1040				value.put(ParameterEnum.na, n);
1041				decoded = true;
1042			} else {
1043				throw new ParserException("Decoding of PlayColParm failed");
1044			}
1045
1046		}
1047		return decoded;
1048	}
1049
1050	private boolean decode_BOOLSTR() throws ParserException {
1051		boolean value = false;
1052		if (chars[index] == 't' && chars[index + 1] == 'r' && chars[index + 2] == 'u' && chars[index + 3] == 'e') {
1053			value = true;
1054			index = index + 5;
1055		} else if (chars[index] == 'f' && chars[index + 1] == 'a' && chars[index + 2] == 'l' && chars[index + 3] == 's'
1056				&& chars[index + 3] == 'e') {
1057			value = false;
1058			index = index + 6;
1059		} else {
1060			throw new ParserException("Parsing of BOOLSTR failed");
1061		}
1062		return value;
1063	}
1064
1065	private String decode_SIGNEDINT() throws ParserException {
1066		String sign = "";
1067
1068		if (chars[index] == '+') {
1069			sign = "+";
1070			index++;
1071		} else if (chars[index] == '-') {
1072			sign = "-";
1073			index++;
1074		} else {
1075			throw new ParserException("Parsing of SIGNEDINT failed");
1076		}
1077
1078		return (sign + decode_NUMBER());
1079	}
1080
1081	private int decode_NUMBER() throws ParserException {
1082		boolean decoded = false;
1083		String number = "";
1084		int num = 0;
1085		if (chars[index] >= '0' && chars[index] <= '9') {
1086			number = number + chars[index];
1087			index++;
1088			decoded = true;
1089
1090			for (int i = 0; i < 31 && decoded && (index < totalChars); i++) {
1091				if (chars[index] >= '0' && chars[index] <= '9') {
1092					number = number + chars[index];
1093					index++;
1094					decoded = true;
1095				} else {
1096					decoded = false;
1097				}
1098			}
1099
1100			try {
1101				num = Integer.parseInt(number);
1102			} catch (NumberFormatException e) {
1103				throw new ParserException("decode_NUMBER failed");
1104			}
1105		} else {
1106			throw new ParserException("decode_NUMBER failed");
1107		}
1108		return num;
1109	}
1110
1111	/*
1112	 * PlayAnnParm = ( AnnouncementParm / IterationsParm / IntervalParm /
1113	 * DurationParm / SpeedParm / VolumeParm );
1114	 */
1115	private boolean decode_PlayAnnParm() throws ParserException {
1116		boolean decoded = false;
1117		if (index < totalChars) {
1118			if (chars[index] == 'a' && chars[index + 1] == 'n') {
1119				index = index + 3;
1120				AnnouncementParmValue annPaVa = new AnnouncementParmValue(ParameterEnum.an);
1121				value.put(ParameterEnum.an, annPaVa);
1122
1123				decoded = decode_Segmentlist(annPaVa);
1124			} else if (chars[index] == 'i' && chars[index + 1] == 't') {
1125
1126				index = index + 3;
1127				// IterationsParm = ItParmToken EQUALS ( NUMBER / "-1" );
1128				if (index < totalChars && chars[index] == '-') {
1129					NumberValue temp = new NumberValue(ParameterEnum.it, -1);
1130					value.put(ParameterEnum.it, temp);
1131					index = index + 3;
1132					decoded = true;
1133				} else {
1134					int interval = decode_NUMBER();
1135					NumberValue temp = new NumberValue(ParameterEnum.it, interval);
1136					value.put(ParameterEnum.it, temp);
1137					decoded = true;
1138				}
1139
1140			} else if (chars[index] == 'i' && chars[index + 1] == 'v') {
1141				index = index + 3;
1142				// IntervalParm = IvParmToken EQUALS NUMBER;
1143				decoded = true;
1144				int interval = decode_NUMBER();
1145				NumberValue temp = new NumberValue(ParameterEnum.iv, interval);
1146				value.put(ParameterEnum.iv, temp);
1147
1148			} else if (chars[index] == 'd' && chars[index + 1] == 'u') {
1149				index = index + 3;
1150				// DurationParm = DuParmToken EQUALS NUMBER;
1151
1152				decoded = true;
1153				int interval = decode_NUMBER();
1154				NumberValue temp = new NumberValue(ParameterEnum.du, interval);
1155				value.put(ParameterEnum.du, temp);
1156
1157			} else if (chars[index] == 's' && chars[index + 1] == 'p') {
1158				// SpeedParm = SpParmToken EQUALS SIGNEDINT;
1159				index = index + 3;
1160				String num = decode_SIGNEDINT();
1161				decoded = true;
1162				StringValue temp = new StringValue(ParameterEnum.sp, num);
1163				value.put(ParameterEnum.sp, temp);
1164
1165			} else if (chars[index] == 'v' && chars[index + 1] == 'l') {
1166				// VolumeParm = VlParmToken EQUALS SIGNEDINT;
1167				index = index + 3;
1168				String num = decode_SIGNEDINT();
1169				decoded = true;
1170				StringValue temp = new StringValue(ParameterEnum.vl, num);
1171				value.put(ParameterEnum.vl, temp);
1172			} else {
1173				throw new ParserException(
1174						"PlayAnn decoding failed. None of AnnouncementParm / IterationsParm / IntervalParm / DurationParm / SpeedParm / VolumeParm found");
1175			}
1176		}
1177
1178		return decoded;
1179	}
1180}