001: /*
002: * Jacareto Copyright (c) 2002-2005
003: * Applied Computer Science Research Group, Darmstadt University of
004: * Technology, Institute of Mathematics & Computer Science,
005: * Ludwigsburg University of Education, and Computer Based
006: * Learning Research Group, Aachen University. All rights reserved.
007: *
008: * Jacareto is free software; you can redistribute it and/or
009: * modify it under the terms of the GNU General Public
010: * License as published by the Free Software Foundation; either
011: * version 2 of the License, or (at your option) any later version.
012: *
013: * Jacareto is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016: * General Public License for more details.
017: *
018: * You should have received a copy of the GNU General Public
019: * License along with Jacareto; if not, write to the Free
020: * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
021: *
022: */
023:
024: package jacareto.record;
025:
026: import jacareto.system.Environment;
027:
028: /**
029: * A pause which can be inserted into a record.
030: *
031: * @author <a href="mailto:cspannagel@web.de">Christian Spannagel</a>
032: * @version 1.02
033: */
034: public class PauseRecordable extends Recordable {
035: /**
036: * Creates a new pause object with the specified values.
037: *
038: * @param env the environment
039: * @param duration the duration of the pause, in msec
040: */
041: public PauseRecordable(Environment env, long duration) {
042: super (env);
043: setDuration(duration);
044: }
045:
046: /**
047: * Creates a pause with zero duration.
048: *
049: * @param env the environment
050: */
051: public PauseRecordable(Environment env) {
052: this (env, 0L);
053: }
054:
055: /**
056: * Creates a pause recordable with zero duration and no environment. The environment should be
057: * defined with the method {@link
058: * jacareto.system.EnvironmentMember#setEnvironment(Environment)} before environment instances
059: * will be accessed.
060: */
061: public PauseRecordable() {
062: this (null, 0);
063: }
064:
065: /**
066: * Sets the duration.
067: *
068: * @param duration the duration, in msec
069: */
070: public void setDuration(long duration) {
071: super .setDuration(duration);
072: fireValuesChanged();
073: }
074:
075: public void calculateDuration() {
076: }
077:
078: /**
079: * Returns the name of the recordable.
080: *
081: * @return the name
082: */
083: public String getElementName() {
084: return getLanguage().getString(
085: "Recordables.PauseRecordable.Name");
086: }
087:
088: /**
089: * Returns a description of the recordable.
090: *
091: * @return the description
092: */
093: public String getElementDescription() {
094: return getLanguage().getString(
095: "Recordables.PauseRecordable.Description");
096: }
097:
098: /**
099: * Returns a String which describes the content of the recordable shortly.
100: *
101: * @return a string with a short description of the recordable
102: */
103: public String toShortString() {
104: return getElementName() + " (" + getDuration() + ")";
105: }
106:
107: public boolean hasProcTime() {
108: return true;
109: }
110: }
|