PageRenderTime 25ms CodeModel.GetById 14ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://mobicents.googlecode.com/
Java | 125 lines | 83 code | 21 blank | 21 comment | 16 complexity | 46d2f95d8ae3e03096b1fd2ecabe0dda 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.List;
 27
 28public class AnnouncementParmValue extends Value {
 29
 30	List<SegmentId> segmentIds = new ArrayList<SegmentId>();
 31	List<TextToSpeechSeg> textToSpeechSegs = new ArrayList<TextToSpeechSeg>();
 32	List<DisplayTextSeg> displayTextSegs = new ArrayList<DisplayTextSeg>();
 33	List<SilenceSeg> silenceSegs = new ArrayList<SilenceSeg>();
 34	Parameter parameter = null;
 35
 36	public AnnouncementParmValue(Parameter parameter) {
 37		this.parameter = parameter;
 38	}
 39
 40	public List<SegmentId> getSegmentIds() {
 41		return segmentIds;
 42	}
 43
 44	public void addSegmentId(SegmentId s) {
 45		segmentIds.add(s);
 46	}
 47
 48	public List<TextToSpeechSeg> getTextToSpeechSegs() {
 49		return textToSpeechSegs;
 50	}
 51
 52	public void addTextToSpeechSeg(TextToSpeechSeg textToSpeechSeg) {
 53		textToSpeechSegs.add(textToSpeechSeg);
 54	}
 55
 56	public List<DisplayTextSeg> getDisplayTextSegs() {
 57		return displayTextSegs;
 58	}
 59
 60	public void addDisplayTextSeg(DisplayTextSeg displayTextSeg) {
 61		displayTextSegs.add(displayTextSeg);
 62	}
 63
 64	public List<SilenceSeg> getSilenceSegs() {
 65		return silenceSegs;
 66	}
 67
 68	public void addSilenceSeg(SilenceSeg silenceSeg) {
 69		silenceSegs.add(silenceSeg);
 70	}
 71
 72	@Override
 73	public String toString() {
 74
 75		String s = this.parameter + "=";
 76		boolean first = true;
 77		if (segmentIds.size() > 0) {
 78
 79			for (SegmentId sId : segmentIds) {
 80				if (first) {
 81					s = s + sId.toString();
 82					first = false;
 83				} else {
 84					s = s + "," + sId.toString();
 85				}
 86			}
 87		}
 88
 89		if (textToSpeechSegs.size() > 0) {
 90			for (TextToSpeechSeg ttsSeg : textToSpeechSegs) {
 91				if (first) {
 92					s = s + ttsSeg.toString();
 93					first = false;
 94				} else {
 95					s = s + "," + ttsSeg.toString();
 96				}
 97			}
 98		}
 99
100		if (displayTextSegs.size() > 0) {
101			for (DisplayTextSeg dtSeg : displayTextSegs) {
102				if (first) {
103					s = s + dtSeg.toString();
104					first = false;
105				} else {
106					s = s + "," + dtSeg.toString();
107				}
108			}
109		}
110
111		if (silenceSegs.size() > 0) {
112			for (SilenceSeg siSeg : silenceSegs) {
113				if (first) {
114					s = s + siSeg.toString();
115					first = false;
116				} else {
117					s = s + "," + siSeg.toString();
118				}
119			}
120		}
121
122		return s;
123	}
124
125}