/*
* Jacareto Copyright (c) 2002-2005
* Applied Computer Science Research Group, Darmstadt University of
* Technology, Institute of Mathematics & Computer Science,
* Ludwigsburg University of Education, and Computer Based
* Learning Research Group, Aachen University. All rights reserved.
*
* Jacareto is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* Jacareto is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with Jacareto; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
package jacareto.trackimpl.blockimpl;
import jacareto.record.Recordable;
import jacareto.track.block.Block;
import jacareto.track.block.BlockType;
/**
* Semi-Abstract superclass for {@link AudioBlock} and {@link VideoBlock} to implement {@link
* #getRecordable()} method and simplify differentiation between normal event block and media
* block.
*
* @author Oliver Specht
* @version $revision$
*/
public abstract class DefaultBlock implements Block {
/** The Recordable this block has been build of */
private Recordable recordable;
/**
* Creates a new DefaultBlock which represents the given StructureElement
*
* @param recordable {@link jacareto.struct.StructureElement}
*/
public DefaultBlock (Recordable recordable) {
this.recordable = recordable;
}
/**
* Has to be overwritten to make sure the {@link Recordable recordables} of the {@link
* jacareto.record.VectorRecord} are found.
*
* @param object Object to be compared
*
* @return true, if equal
*/
public boolean equals (Object object) {
if (object == null) {
return false;
} else if (object instanceof DefaultBlock) {
return this.recordable.equals (((DefaultBlock) object).getRecordable ());
} else if (object instanceof Recordable) {
return this.recordable.equals (object);
}
return false;
}
/**
* Has to be overwritten to make sure the {@link Recordable recordables} of the {@link
* jacareto.record.VectorRecord} are found.
*
* @return int hashCode
*/
public int hashCode () {
return this.recordable.hashCode ();
}
/**
* Returns the duration of this block (~Recordable)
*
* @return long the duration
*/
public long getDuration () {
return this.recordable.getDuration ();
}
/**
* {@inheritDoc}
*/
public abstract BlockType getType ();
/**
* Returns the {@link Recordable} this DefaultBlock represents.
*
* @return {@link Recordable}
*/
public Recordable getRecordable () {
return this.recordable;
}
/**
* Informs the block about its start time.
*
* @param startTime the start time (in msec) Does nothing by default.
*/
public void tellStartTime (long startTime) {
}
}
|