⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 transcriptionimpl.java

📁 编辑视频文件
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                if (ct.getLinguisticTypeName().equals(name)) {                    lt = ct;                    break;                }            }        }        return lt;    }    /**     * DOCUMENT ME!     *     * @param theType DOCUMENT ME!     */    public void addLinguisticType(LinguisticType theType) {        linguisticTypes.add(theType);        modified(ACMEditEvent.ADD_LINGUISTIC_TYPE, theType);    }    /**     * DOCUMENT ME!     *     * @param theType DOCUMENT ME!     */    public void removeLinguisticType(LinguisticType theType) {        linguisticTypes.remove(theType);        modified(ACMEditEvent.REMOVE_LINGUISTIC_TYPE, theType);    }    /**     * DOCUMENT ME!     *     * @param linType DOCUMENT ME!     * @param newTypeName DOCUMENT ME!     * @param constraints DOCUMENT ME!     * @param cvName DOCUMENT ME!     * @param newTimeAlignable DOCUMENT ME!     * @param newGraphicsAllowed DOCUMENT ME!     */    public void changeLinguisticType(LinguisticType linType,        String newTypeName, Vector constraints, String cvName,        boolean newTimeAlignable, boolean newGraphicsAllowed) {        linType.setLinguisticTypeName(newTypeName);        linType.removeConstraints();        if (constraints != null) {            Iterator cIter = constraints.iterator();            while (cIter.hasNext()) {                Constraint constraint = (Constraint) cIter.next();                linType.addConstraint(constraint);            }        }        linType.setControlledVocabularyName(cvName);        linType.setTimeAlignable(newTimeAlignable);        linType.setGraphicReferences(newGraphicsAllowed);        modified(ACMEditEvent.CHANGE_LINGUISTIC_TYPE, linType);    }    /**     * DOCUMENT ME!     *     * @param typeID DOCUMENT ME!     *     * @return DOCUMENT ME!     */    public Vector getTiersWithLinguisticType(String typeID) {        Vector matchingTiers = new Vector();        Iterator tierIter = tiers.iterator();        while (tierIter.hasNext()) {            TierImpl t = (TierImpl) tierIter.next();            if (t.getLinguisticType().getLinguisticTypeName().equals(typeID)) {                matchingTiers.add(t);            }        }        return matchingTiers;    }    /**     * DOCUMENT ME!     *     * @param forTier DOCUMENT ME!     *     * @return DOCUMENT ME!     */    public Vector getCandidateParentTiers(Tier forTier) {        // in the future, this method could take constraints on linguistic types into account.        // for now, it returns all tiers except forTier itself and tiers that have forTier as        // an ancestor        Vector candidates = new Vector();        Enumeration e = null;        e = getTiers().elements();        while (e.hasMoreElements()) {            try {                TierImpl dTier = (TierImpl) e.nextElement();                if (dTier.hasAncestor(forTier)) {                    break;                }                if (dTier != forTier) {                    candidates.add(dTier);                }            } catch (Exception ex) {                ex.printStackTrace();            }        }        return candidates;    }    //    public abstract void setMainMediaFile(String pathName);    /**     * <p>MK:02/06/12<br>     * Implementing method from interface Transription.     * <p>     * @param theTierId see there!     * @return see there!     */    public Tier getTierWithId(String theTierId) {        Tier t = null;        Tier result = null;        Iterator tierIter = tiers.iterator();        while (tierIter.hasNext()) {            t = (Tier) tierIter.next();            if (t.getName().equals(theTierId)) {                result = t;                break;            }        }        return result;    }    /**     * <p>MK:02/06/12<br>     * Where the name of all tiers are unique for a transcription, this method     * returns the tier with the given name.     * If no tier matches the given name, null is returned.<br>     * Unless tier IDs are introduced, this method and getTierWithId() are identical.     * <br>     * Non-unique tiernames must be introduced.     * </p>     * @param name name of tier, as in tier.getName()     * @return first tier in transription with given name, or null.     */    protected final Tier getTierByUniqueName(String name) {        if (tiers == null) {            return null;        }        Enumeration all = this.tiers.elements();        while (all.hasMoreElements()) {            Tier t = (Tier) all.nextElement();            String n = (String) t.getName();            if (n.equals(name)) {                return t;            }        }        return null;    }    /**     * DOCUMENT ME!     *     * @param theSlot DOCUMENT ME!     *     * @return DOCUMENT ME!     */    public Vector getAnnotationsUsingTimeSlot(TimeSlot theSlot) {        Vector resultAnnots = new Vector();        Iterator tierIter = tiers.iterator();        while (tierIter.hasNext()) {            TierImpl t = (TierImpl) tierIter.next();            resultAnnots.addAll(t.getAnnotationsUsingTimeSlot(theSlot));        }        return resultAnnots;    }    /**     * DOCUMENT ME!     *     * @param theSlot DOCUMENT ME!     *     * @return DOCUMENT ME!     */    public Vector getAnnotsBeginningAtTimeSlot(TimeSlot theSlot) {        Vector resultAnnots = new Vector();        Iterator tierIter = tiers.iterator();        while (tierIter.hasNext()) {            TierImpl t = (TierImpl) tierIter.next();            resultAnnots.addAll(t.getAnnotsBeginningAtTimeSlot(theSlot));        }        return resultAnnots;    }    /**     * Refined version of getAnnotsBeginningAtTimeSlot(TimeSlot); here only the specified tier     * (optional) and its depending tiers are polled.     * @param theSlot the TimeSlot     * @param forTier the tier     * @param includeThisTier if true annotations on this tier will also be included     * @return a Vector containing annotations     */    public Vector getAnnotsBeginningAtTimeSlot(TimeSlot theSlot, Tier forTier,        boolean includeThisTier) {        Vector resultAnnots = new Vector();        Vector depTiers = ((TierImpl) forTier).getDependentTiers();        if (includeThisTier) {            depTiers.add(0, forTier);        }        Iterator tierIter = depTiers.iterator();        while (tierIter.hasNext()) {            TierImpl t = (TierImpl) tierIter.next();            resultAnnots.addAll(t.getAnnotsBeginningAtTimeSlot(theSlot));        }        return resultAnnots;    }    /**     * DOCUMENT ME!     *     * @param theSlot DOCUMENT ME!     *     * @return DOCUMENT ME!     */    public Vector getAnnotsEndingAtTimeSlot(TimeSlot theSlot) {        Vector resultAnnots = new Vector();        Iterator tierIter = tiers.iterator();        while (tierIter.hasNext()) {            TierImpl t = (TierImpl) tierIter.next();            resultAnnots.addAll(t.getAnnotsEndingAtTimeSlot(theSlot));        }        return resultAnnots;    }    /**     * Refined version of getAnnotsEndingAtTimeSlot(TimeSlot); here only the specified tier     * (optional) and its depending tiers are polled.     * @param theSlot the TimeSlot     * @param forTier the tier     * @param includeThisTier if true annotations on this tier will also be included     * @return a Vector containing annotations     */    public Vector getAnnotsEndingAtTimeSlot(TimeSlot theSlot, Tier forTier,        boolean includeThisTier) {        Vector resultAnnots = new Vector();        Vector depTiers = ((TierImpl) forTier).getDependentTiers();        if (includeThisTier) {            depTiers.add(0, forTier);        }        Iterator tierIter = depTiers.iterator();        while (tierIter.hasNext()) {            TierImpl t = (TierImpl) tierIter.next();            resultAnnots.addAll(t.getAnnotsEndingAtTimeSlot(theSlot));        }        return resultAnnots;    }    /**     * Iterates over all annotations of time alignable tiers and adds each     * referenced TimeSlot to a HashSet.     *     * @return a set of referenced TimeSlots     */    public HashSet getTimeSlotsInUse() {        HashSet usedSlots = new HashSet(getTimeOrder().size());        Iterator tierIter = tiers.iterator();        while (tierIter.hasNext()) {            TierImpl t = (TierImpl) tierIter.next();            Object annObj;            AlignableAnnotation aa;            if (t.isTimeAlignable()) {                Iterator annIter = t.getAnnotations().iterator();                while (annIter.hasNext()) {                    annObj = annIter.next();                    if (annObj instanceof AlignableAnnotation) {                        aa = (AlignableAnnotation) annObj;                        usedSlots.add(aa.getBegin());                        usedSlots.add(aa.getEnd());                    }                }            }        }        return usedSlots;    }    /**     * DOCUMENT ME!     *     * @param time DOCUMENT ME!     *     * @return DOCUMENT ME!     */    public Vector getAnnotationIdsAtTime(long time) {        Vector resultAnnots = new Vector();        Iterator tierIter = tiers.iterator();        while (tierIter.hasNext()) {            TierImpl t = (TierImpl) tierIter.next();            Annotation ann = t.getAnnotationAtTime(time);            if (ann != null) {                resultAnnots.add(ann.getId());            }        }        return resultAnnots;    }    /**     * DOCUMENT ME!     *     * @param id DOCUMENT ME!     *     * @return DOCUMENT ME!     */    public Annotation getAnnotation(String id) {        if (id == null) {            return null;        }        Iterator tierIter = tiers.iterator();        Annotation a;        while (tierIter.hasNext()) {            TierImpl t = (TierImpl) tierIter.next();            a = t.getAnnotation(id);            if (a != null) {                return a;            }        }        return null;    }    /**     * DOCUMENT ME!     *     * @return DOCUMENT ME!     */    public long getLatestTime() {        long latestTime = 0;        Enumeration elmts = getTimeOrder().elements();        while (elmts.hasMoreElements()) {            long t = ((TimeSlot) elmts.nextElement()).getTime();            if (t > latestTime) {                latestTime = t;            }        }        return latestTime;    }    /**     * This method returns all child annotations for a given annotation,     * irrespective of which tier it is on. There exists an alternative method     * Annotation.getChildrenOnTier(). The main difference is, that getChildAnnotationsOf     * does not base itself on ParentAnnotationListeners for the case of AlignableAnnotations.     * This is essential during deletion of annotations.     * THEREFORE: DO NOT REPLACE THIS METHOD WITH getChildrenOnTier. DELETION OF ANNOTATIONS     * WILL THEN FAIL !!!     * */    public Vector getChildAnnotationsOf(Annotation theAnnot) {        Vector children = new Vector();        //Tier annotsTier = theAnnot.getTier();        if (theAnnot instanceof RefAnnotation) {            children.addAll(((RefAnnotation) theAnnot).getParentListeners());        } else { // theAnnot is AlignableAnnotation            // HB, 6-5-03, to take closed annotation graphs into account            TreeSet connectedAnnots = new TreeSet();            //TreeSet connectedTimeSlots = new TreeSet();            //	getConnectedAnnots(connectedAnnots, connectedTimeSlots, ((AlignableAnnotation) theAnnot).getBegin());            // HS mar 06: pass the top tier as well, to prevent iterations over unrelated tiers            getConnectedSubtree(connectedAnnots,                ((AlignableAnnotation) theAnnot).getBegin(),                ((AlignableAnnotation) theAnnot).getEnd(), theAnnot.getTier());            Vector connAnnotVector = new Vector(connectedAnnots); // 'contains' on TreeSet seems to go wrong in rare cases                                                                  // I don't understand this, but it works - HB            Vector descTiers = new Vector();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -