Java 类org.w3c.dom.smil.Time 实例源码

项目:PeSanKita-android    文件:ElementParallelTimeContainerImpl.java   
public float getImplicitDuration() {
    float dur = -1.0F;
    if (ENDSYNC_LAST.equals(getEndSync())) {
        NodeList children = getTimeChildren();
        for (int i = 0; i < children.getLength(); ++i) {
            ElementTime child = (ElementTime) children.item(i);
            TimeList endTimeList = child.getEnd();
            for (int j = 0; j < endTimeList.getLength(); ++j) {
                Time endTime = endTimeList.item(j);
                if (endTime.getTimeType() == Time.SMIL_TIME_INDEFINITE) {
                    // Return "indefinite" here.
                    return -1.0F;
                }
                if (endTime.getResolved()) {
                    float end = (float)endTime.getResolvedOffset();
                    dur = (end > dur) ? end : dur;
                }
            }
        }
    } // Other endsync types are not supported now.

    return dur;
}
项目:TextSecure    文件:ElementParallelTimeContainerImpl.java   
public float getImplicitDuration() {
    float dur = -1.0F;
    if (ENDSYNC_LAST.equals(getEndSync())) {
        NodeList children = getTimeChildren();
        for (int i = 0; i < children.getLength(); ++i) {
            ElementTime child = (ElementTime) children.item(i);
            TimeList endTimeList = child.getEnd();
            for (int j = 0; j < endTimeList.getLength(); ++j) {
                Time endTime = endTimeList.item(j);
                if (endTime.getTimeType() == Time.SMIL_TIME_INDEFINITE) {
                    // Return "indefinite" here.
                    return -1.0F;
                }
                if (endTime.getResolved()) {
                    float end = (float)endTime.getResolvedOffset();
                    dur = (end > dur) ? end : dur;
                }
            }
        }
    } // Other endsync types are not supported now.

    return dur;
}
项目:qksms    文件:ElementParallelTimeContainerImpl.java   
public float getImplicitDuration() {
    float dur = -1.0F;
    if (ENDSYNC_LAST.equals(getEndSync())) {
        NodeList children = getTimeChildren();
        for (int i = 0; i < children.getLength(); ++i) {
            ElementTime child = (ElementTime) children.item(i);
            TimeList endTimeList = child.getEnd();
            for (int j = 0; j < endTimeList.getLength(); ++j) {
                Time endTime = endTimeList.item(j);
                if (endTime.getTimeType() == Time.SMIL_TIME_INDEFINITE) {
                    // Return "indefinite" here.
                    return -1.0F;
                }
                if (endTime.getResolved()) {
                    float end = (float)endTime.getResolvedOffset();
                    dur = (end > dur) ? end : dur;
                }
            }
        }
    } // Other endsync types are not supported now.

    return dur;
}
项目:TextSecureSMP    文件:ElementParallelTimeContainerImpl.java   
public float getImplicitDuration() {
    float dur = -1.0F;
    if (ENDSYNC_LAST.equals(getEndSync())) {
        NodeList children = getTimeChildren();
        for (int i = 0; i < children.getLength(); ++i) {
            ElementTime child = (ElementTime) children.item(i);
            TimeList endTimeList = child.getEnd();
            for (int j = 0; j < endTimeList.getLength(); ++j) {
                Time endTime = endTimeList.item(j);
                if (endTime.getTimeType() == Time.SMIL_TIME_INDEFINITE) {
                    // Return "indefinite" here.
                    return -1.0F;
                }
                if (endTime.getResolved()) {
                    float end = (float)endTime.getResolvedOffset();
                    dur = (end > dur) ? end : dur;
                }
            }
        }
    } // Other endsync types are not supported now.

    return dur;
}
项目:Silence    文件:ElementParallelTimeContainerImpl.java   
public float getImplicitDuration() {
    float dur = -1.0F;
    if (ENDSYNC_LAST.equals(getEndSync())) {
        NodeList children = getTimeChildren();
        for (int i = 0; i < children.getLength(); ++i) {
            ElementTime child = (ElementTime) children.item(i);
            TimeList endTimeList = child.getEnd();
            for (int j = 0; j < endTimeList.getLength(); ++j) {
                Time endTime = endTimeList.item(j);
                if (endTime.getTimeType() == Time.SMIL_TIME_INDEFINITE) {
                    // Return "indefinite" here.
                    return -1.0F;
                }
                if (endTime.getResolved()) {
                    float end = (float)endTime.getResolvedOffset();
                    dur = (end > dur) ? end : dur;
                }
            }
        }
    } // Other endsync types are not supported now.

    return dur;
}
项目:Securecom-Messaging    文件:ElementParallelTimeContainerImpl.java   
public float getImplicitDuration() {
    float dur = -1.0F;
    if (ENDSYNC_LAST.equals(getEndSync())) {
        NodeList children = getTimeChildren();
        for (int i = 0; i < children.getLength(); ++i) {
            ElementTime child = (ElementTime) children.item(i);
            TimeList endTimeList = child.getEnd();
            for (int j = 0; j < endTimeList.getLength(); ++j) {
                Time endTime = endTimeList.item(j);
                if (endTime.getTimeType() == Time.SMIL_TIME_INDEFINITE) {
                    // Return "indefinite" here.
                    return -1.0F;
                }
                if (endTime.getResolved()) {
                    float end = (float)endTime.getResolvedOffset();
                    dur = (end > dur) ? end : dur;
                }
            }
        }
    } // Other endsync types are not supported now.

    return dur;
}
项目:android-aosp-mms    文件:ElementParallelTimeContainerImpl.java   
public float getImplicitDuration() {
    float dur = -1.0F;
    if (ENDSYNC_LAST.equals(getEndSync())) {
        NodeList children = getTimeChildren();
        for (int i = 0; i < children.getLength(); ++i) {
            ElementTime child = (ElementTime) children.item(i);
            TimeList endTimeList = child.getEnd();
            for (int j = 0; j < endTimeList.getLength(); ++j) {
                Time endTime = endTimeList.item(j);
                if (endTime.getTimeType() == Time.SMIL_TIME_INDEFINITE) {
                    // Return "indefinite" here.
                    return -1.0F;
                }
                if (endTime.getResolved()) {
                    float end = (float)endTime.getResolvedOffset();
                    dur = (end > dur) ? end : dur;
                }
            }
        }
    } // Other endsync types are not supported now.

    return dur;
}
项目:PeSanKita-android    文件:TimeListImpl.java   
public Time item(int index) {
    Time time = null;
    try {
        time = mTimes.get(index);
    } catch (IndexOutOfBoundsException e) {
        // Do nothing and return null
    }
    return time;
}
项目:PeSanKita-android    文件:ElementTimeImpl.java   
public TimeList getBegin() {
    String[] beginTimeStringList = mSmilElement.getAttribute("begin").split(";");

    // TODO: Check other constraints on parsed values, e.g., "single, non-negative offset values
    ArrayList<Time> beginTimeList = new ArrayList<Time>();
    // Initialize Time instances and add them to Vector
    for (int i = 0; i < beginTimeStringList.length; i++) {
        try {
            beginTimeList.add(new TimeImpl(beginTimeStringList[i], getBeginConstraints()));
        } catch (IllegalArgumentException e) {
            // Ignore badly formatted times
        }
    }
    if (beginTimeList.size() == 0) {
        /*
         * What is the right default value?
         *
         * In MMS SMIL, this method may be called either on an instance of:
         *
         * 1 - ElementSequentialTimeContainer (The SMILDocument)
         * 2 - ElementParallelTimeContainer (A Time-Child of the SMILDocument, which is a seq)
         * 3 - ElementTime (A SMILMediaElement).
         *
         * 1 - In the first case, the default start time is obviously 0.
         * 2 - In the second case, the specifications mentions that
         *      "For children of a sequence, the only legal value for begin is
         *      a (single) non-negative offset value. The default begin value is 0."
         * 3 - In the third case, the specification mentions that
         *      "The default value of begin for children of a par is 0."
         *
         * In short, if no value is specified, the default is always 0.
         */

        beginTimeList.add(new TimeImpl("0", TimeImpl.ALLOW_ALL));
    }
    return new TimeListImpl(beginTimeList);
}
项目:PeSanKita-android    文件:ElementTimeImpl.java   
public TimeList getEnd() {
    ArrayList<Time> endTimeList = new ArrayList<Time>();

    String[] endTimeStringList = mSmilElement.getAttribute("end").split(";");
    int len = endTimeStringList.length;
    if (!((len == 1) && (endTimeStringList[0].length() == 0))) {  // Ensure the end field is set.
        // Initialize Time instances and add them to Vector
        for (int i = 0; i < len; i++) {
            try {
                endTimeList.add(new TimeImpl(endTimeStringList[i],
                        getEndConstraints()));
            } catch (IllegalArgumentException e) {
                // Ignore badly formatted times
                Log.e(TAG, "Malformed time value.", e);
            }
        }
    }

    // "end" time is not specified
    if (endTimeList.size() == 0) {
        // Get duration
        float duration = getDur();

        if (duration < 0) {
            endTimeList.add(new TimeImpl("indefinite", getEndConstraints()));
        } else {
            // Get begin
            TimeList begin = getBegin();
            for (int i = 0; i < begin.getLength(); i++) {
                endTimeList.add(new TimeImpl(
                        // end = begin + dur
                        begin.item(i).getResolvedOffset() + duration + "s",
                        getEndConstraints()));
            }
        }
    }

    return new TimeListImpl(endTimeList);
}
项目:PeSanKita-android    文件:ElementTimeImpl.java   
private boolean beginAndEndAreZero() {
    TimeList begin = getBegin();
    TimeList end = getEnd();
    if (begin.getLength() == 1 && end.getLength() == 1) {
        Time beginTime = begin.item(0);
        Time endTime = end.item(0);
        return beginTime.getOffset() == 0. && endTime.getOffset() == 0.;
    }
    return false;
}
项目:PeSanKita-android    文件:SmilParElementImpl.java   
@Override
public TimeList getBegin() {
    /*
     * For children of a sequence, the only legal value for begin is
     * a (single) non-negative offset value.
     */
    TimeList beginTimeList = super.getBegin();
    if (beginTimeList.getLength() > 1) {
        ArrayList<Time> singleTimeContainer = new ArrayList<Time>();
        singleTimeContainer.add(beginTimeList.item(0));
        beginTimeList = new TimeListImpl(singleTimeContainer);
    }
    return beginTimeList;
}
项目:TextSecure    文件:TimeListImpl.java   
public Time item(int index) {
    Time time = null;
    try {
        time = mTimes.get(index);
    } catch (IndexOutOfBoundsException e) {
        // Do nothing and return null
    }
    return time;
}
项目:TextSecure    文件:ElementTimeImpl.java   
public TimeList getBegin() {
    String[] beginTimeStringList = mSmilElement.getAttribute("begin").split(";");

    // TODO: Check other constraints on parsed values, e.g., "single, non-negative offset values
    ArrayList<Time> beginTimeList = new ArrayList<Time>();
    // Initialize Time instances and add them to Vector
    for (int i = 0; i < beginTimeStringList.length; i++) {
        try {
            beginTimeList.add(new TimeImpl(beginTimeStringList[i], getBeginConstraints()));
        } catch (IllegalArgumentException e) {
            // Ignore badly formatted times
        }
    }
    if (beginTimeList.size() == 0) {
        /*
         * What is the right default value?
         *
         * In MMS SMIL, this method may be called either on an instance of:
         *
         * 1 - ElementSequentialTimeContainer (The SMILDocument)
         * 2 - ElementParallelTimeContainer (A Time-Child of the SMILDocument, which is a seq)
         * 3 - ElementTime (A SMILMediaElement).
         *
         * 1 - In the first case, the default start time is obviously 0.
         * 2 - In the second case, the specifications mentions that
         *      "For children of a sequence, the only legal value for begin is
         *      a (single) non-negative offset value. The default begin value is 0."
         * 3 - In the third case, the specification mentions that
         *      "The default value of begin for children of a par is 0."
         *
         * In short, if no value is specified, the default is always 0.
         */

        beginTimeList.add(new TimeImpl("0", TimeImpl.ALLOW_ALL));
    }
    return new TimeListImpl(beginTimeList);
}
项目:TextSecure    文件:ElementTimeImpl.java   
public TimeList getEnd() {
    ArrayList<Time> endTimeList = new ArrayList<Time>();

    String[] endTimeStringList = mSmilElement.getAttribute("end").split(";");
    int len = endTimeStringList.length;
    if (!((len == 1) && (endTimeStringList[0].length() == 0))) {  // Ensure the end field is set.
        // Initialize Time instances and add them to Vector
        for (int i = 0; i < len; i++) {
            try {
                endTimeList.add(new TimeImpl(endTimeStringList[i],
                        getEndConstraints()));
            } catch (IllegalArgumentException e) {
                // Ignore badly formatted times
                Log.e(TAG, "Malformed time value.", e);
            }
        }
    }

    // "end" time is not specified
    if (endTimeList.size() == 0) {
        // Get duration
        float duration = getDur();

        if (duration < 0) {
            endTimeList.add(new TimeImpl("indefinite", getEndConstraints()));
        } else {
            // Get begin
            TimeList begin = getBegin();
            for (int i = 0; i < begin.getLength(); i++) {
                endTimeList.add(new TimeImpl(
                        // end = begin + dur
                        begin.item(i).getResolvedOffset() + duration + "s",
                        getEndConstraints()));
            }
        }
    }

    return new TimeListImpl(endTimeList);
}
项目:TextSecure    文件:ElementTimeImpl.java   
private boolean beginAndEndAreZero() {
    TimeList begin = getBegin();
    TimeList end = getEnd();
    if (begin.getLength() == 1 && end.getLength() == 1) {
        Time beginTime = begin.item(0);
        Time endTime = end.item(0);
        return beginTime.getOffset() == 0. && endTime.getOffset() == 0.;
    }
    return false;
}
项目:TextSecure    文件:SmilParElementImpl.java   
@Override
public TimeList getBegin() {
    /*
     * For children of a sequence, the only legal value for begin is
     * a (single) non-negative offset value.
     */
    TimeList beginTimeList = super.getBegin();
    if (beginTimeList.getLength() > 1) {
        ArrayList<Time> singleTimeContainer = new ArrayList<Time>();
        singleTimeContainer.add(beginTimeList.item(0));
        beginTimeList = new TimeListImpl(singleTimeContainer);
    }
    return beginTimeList;
}
项目:qksms    文件:TimeListImpl.java   
public Time item(int index) {
    Time time = null;
    try {
        time = mTimes.get(index);
    } catch (IndexOutOfBoundsException e) {
        // Do nothing and return null
    }
    return time;
}
项目:qksms    文件:ElementTimeImpl.java   
public TimeList getBegin() {
    String[] beginTimeStringList = mSmilElement.getAttribute("begin").split(";");

    // TODO: Check other constraints on parsed values, e.g., "single, non-negative offset values
    ArrayList<Time> beginTimeList = new ArrayList<>();
    // Initialize Time instances and add them to Vector
    for (String aBeginTimeStringList : beginTimeStringList) {
        try {
            beginTimeList.add(new TimeImpl(aBeginTimeStringList, getBeginConstraints()));
        } catch (IllegalArgumentException e) {
            // Ignore badly formatted times
        }
    }
    if (beginTimeList.isEmpty()) {
        /*
         * What is the right default value?
         *
         * In MMS SMIL, this method may be called either on an instance of:
         *
         * 1 - ElementSequentialTimeContainer (The SMILDocument)
         * 2 - ElementParallelTimeContainer (A Time-Child of the SMILDocument, which is a seq)
         * 3 - ElementTime (A SMILMediaElement).
         *
         * 1 - In the first case, the default start time is obviously 0.
         * 2 - In the second case, the specifications mentions that
         *      "For children of a sequence, the only legal value for begin is
         *      a (single) non-negative offset value. The default begin value is 0."
         * 3 - In the third case, the specification mentions that
         *      "The default value of begin for children of a par is 0."
         *
         * In short, if no value is specified, the default is always 0.
         */

        beginTimeList.add(new TimeImpl("0", TimeImpl.ALLOW_ALL));
    }
    return new TimeListImpl(beginTimeList);
}
项目:qksms    文件:ElementTimeImpl.java   
public TimeList getEnd() {
    ArrayList<Time> endTimeList = new ArrayList<>();

    String[] endTimeStringList = mSmilElement.getAttribute("end").split(";");
    int len = endTimeStringList.length;
    if (!((len == 1) && (endTimeStringList[0].length() == 0))) {  // Ensure the end field is set.
        // Initialize Time instances and add them to Vector
        for (String anEndTimeStringList : endTimeStringList) {
            try {
                endTimeList.add(new TimeImpl(anEndTimeStringList,
                        getEndConstraints()));
            } catch (IllegalArgumentException e) {
                // Ignore badly formatted times
                Log.e(TAG, "Malformed time value.", e);
            }
        }
    }

    // "end" time is not specified
    if (endTimeList.isEmpty()) {
        // Get duration
        float duration = getDur();

        if (duration < 0) {
            endTimeList.add(new TimeImpl("indefinite", getEndConstraints()));
        } else {
            // Get begin
            TimeList begin = getBegin();
            for (int i = 0; i < begin.getLength(); i++) {
                endTimeList.add(new TimeImpl(
                        // end = begin + dur
                        begin.item(i).getResolvedOffset() + duration + "s",
                        getEndConstraints()));
            }
        }
    }

    return new TimeListImpl(endTimeList);
}
项目:qksms    文件:ElementTimeImpl.java   
private boolean beginAndEndAreZero() {
    TimeList begin = getBegin();
    TimeList end = getEnd();
    if (begin.getLength() == 1 && end.getLength() == 1) {
        Time beginTime = begin.item(0);
        Time endTime = end.item(0);
        return beginTime.getOffset() == 0. && endTime.getOffset() == 0.;
    }
    return false;
}
项目:qksms    文件:SmilParElementImpl.java   
@Override
public TimeList getBegin() {
    /*
     * For children of a sequence, the only legal value for begin is
     * a (single) non-negative offset value.
     */
    TimeList beginTimeList = super.getBegin();
    if (beginTimeList.getLength() > 1) {
        ArrayList<Time> singleTimeContainer = new ArrayList<>();
        singleTimeContainer.add(beginTimeList.item(0));
        beginTimeList = new TimeListImpl(singleTimeContainer);
    }
    return beginTimeList;
}
项目:TextSecureSMP    文件:TimeListImpl.java   
public Time item(int index) {
    Time time = null;
    try {
        time = mTimes.get(index);
    } catch (IndexOutOfBoundsException e) {
        // Do nothing and return null
    }
    return time;
}
项目:TextSecureSMP    文件:ElementTimeImpl.java   
public TimeList getBegin() {
    String[] beginTimeStringList = mSmilElement.getAttribute("begin").split(";");

    // TODO: Check other constraints on parsed values, e.g., "single, non-negative offset values
    ArrayList<Time> beginTimeList = new ArrayList<Time>();
    // Initialize Time instances and add them to Vector
    for (int i = 0; i < beginTimeStringList.length; i++) {
        try {
            beginTimeList.add(new TimeImpl(beginTimeStringList[i], getBeginConstraints()));
        } catch (IllegalArgumentException e) {
            // Ignore badly formatted times
        }
    }
    if (beginTimeList.size() == 0) {
        /*
         * What is the right default value?
         *
         * In MMS SMIL, this method may be called either on an instance of:
         *
         * 1 - ElementSequentialTimeContainer (The SMILDocument)
         * 2 - ElementParallelTimeContainer (A Time-Child of the SMILDocument, which is a seq)
         * 3 - ElementTime (A SMILMediaElement).
         *
         * 1 - In the first case, the default start time is obviously 0.
         * 2 - In the second case, the specifications mentions that
         *      "For children of a sequence, the only legal value for begin is
         *      a (single) non-negative offset value. The default begin value is 0."
         * 3 - In the third case, the specification mentions that
         *      "The default value of begin for children of a par is 0."
         *
         * In short, if no value is specified, the default is always 0.
         */

        beginTimeList.add(new TimeImpl("0", TimeImpl.ALLOW_ALL));
    }
    return new TimeListImpl(beginTimeList);
}
项目:TextSecureSMP    文件:ElementTimeImpl.java   
public TimeList getEnd() {
    ArrayList<Time> endTimeList = new ArrayList<Time>();

    String[] endTimeStringList = mSmilElement.getAttribute("end").split(";");
    int len = endTimeStringList.length;
    if (!((len == 1) && (endTimeStringList[0].length() == 0))) {  // Ensure the end field is set.
        // Initialize Time instances and add them to Vector
        for (int i = 0; i < len; i++) {
            try {
                endTimeList.add(new TimeImpl(endTimeStringList[i],
                        getEndConstraints()));
            } catch (IllegalArgumentException e) {
                // Ignore badly formatted times
                Log.e(TAG, "Malformed time value.", e);
            }
        }
    }

    // "end" time is not specified
    if (endTimeList.size() == 0) {
        // Get duration
        float duration = getDur();

        if (duration < 0) {
            endTimeList.add(new TimeImpl("indefinite", getEndConstraints()));
        } else {
            // Get begin
            TimeList begin = getBegin();
            for (int i = 0; i < begin.getLength(); i++) {
                endTimeList.add(new TimeImpl(
                        // end = begin + dur
                        begin.item(i).getResolvedOffset() + duration + "s",
                        getEndConstraints()));
            }
        }
    }

    return new TimeListImpl(endTimeList);
}
项目:TextSecureSMP    文件:ElementTimeImpl.java   
private boolean beginAndEndAreZero() {
    TimeList begin = getBegin();
    TimeList end = getEnd();
    if (begin.getLength() == 1 && end.getLength() == 1) {
        Time beginTime = begin.item(0);
        Time endTime = end.item(0);
        return beginTime.getOffset() == 0. && endTime.getOffset() == 0.;
    }
    return false;
}
项目:TextSecureSMP    文件:SmilParElementImpl.java   
@Override
public TimeList getBegin() {
    /*
     * For children of a sequence, the only legal value for begin is
     * a (single) non-negative offset value.
     */
    TimeList beginTimeList = super.getBegin();
    if (beginTimeList.getLength() > 1) {
        ArrayList<Time> singleTimeContainer = new ArrayList<Time>();
        singleTimeContainer.add(beginTimeList.item(0));
        beginTimeList = new TimeListImpl(singleTimeContainer);
    }
    return beginTimeList;
}
项目:Silence    文件:TimeListImpl.java   
public Time item(int index) {
    Time time = null;
    try {
        time = mTimes.get(index);
    } catch (IndexOutOfBoundsException e) {
        // Do nothing and return null
    }
    return time;
}
项目:Silence    文件:ElementTimeImpl.java   
public TimeList getBegin() {
    String[] beginTimeStringList = mSmilElement.getAttribute("begin").split(";");

    // TODO: Check other constraints on parsed values, e.g., "single, non-negative offset values
    ArrayList<Time> beginTimeList = new ArrayList<Time>();
    // Initialize Time instances and add them to Vector
    for (int i = 0; i < beginTimeStringList.length; i++) {
        try {
            beginTimeList.add(new TimeImpl(beginTimeStringList[i], getBeginConstraints()));
        } catch (IllegalArgumentException e) {
            // Ignore badly formatted times
        }
    }
    if (beginTimeList.size() == 0) {
        /*
         * What is the right default value?
         *
         * In MMS SMIL, this method may be called either on an instance of:
         *
         * 1 - ElementSequentialTimeContainer (The SMILDocument)
         * 2 - ElementParallelTimeContainer (A Time-Child of the SMILDocument, which is a seq)
         * 3 - ElementTime (A SMILMediaElement).
         *
         * 1 - In the first case, the default start time is obviously 0.
         * 2 - In the second case, the specifications mentions that
         *      "For children of a sequence, the only legal value for begin is
         *      a (single) non-negative offset value. The default begin value is 0."
         * 3 - In the third case, the specification mentions that
         *      "The default value of begin for children of a par is 0."
         *
         * In short, if no value is specified, the default is always 0.
         */

        beginTimeList.add(new TimeImpl("0", TimeImpl.ALLOW_ALL));
    }
    return new TimeListImpl(beginTimeList);
}
项目:Silence    文件:ElementTimeImpl.java   
public TimeList getEnd() {
    ArrayList<Time> endTimeList = new ArrayList<Time>();

    String[] endTimeStringList = mSmilElement.getAttribute("end").split(";");
    int len = endTimeStringList.length;
    if (!((len == 1) && (endTimeStringList[0].length() == 0))) {  // Ensure the end field is set.
        // Initialize Time instances and add them to Vector
        for (int i = 0; i < len; i++) {
            try {
                endTimeList.add(new TimeImpl(endTimeStringList[i],
                        getEndConstraints()));
            } catch (IllegalArgumentException e) {
                // Ignore badly formatted times
                Log.e(TAG, "Malformed time value.", e);
            }
        }
    }

    // "end" time is not specified
    if (endTimeList.size() == 0) {
        // Get duration
        float duration = getDur();

        if (duration < 0) {
            endTimeList.add(new TimeImpl("indefinite", getEndConstraints()));
        } else {
            // Get begin
            TimeList begin = getBegin();
            for (int i = 0; i < begin.getLength(); i++) {
                endTimeList.add(new TimeImpl(
                        // end = begin + dur
                        begin.item(i).getResolvedOffset() + duration + "s",
                        getEndConstraints()));
            }
        }
    }

    return new TimeListImpl(endTimeList);
}
项目:Silence    文件:ElementTimeImpl.java   
private boolean beginAndEndAreZero() {
    TimeList begin = getBegin();
    TimeList end = getEnd();
    if (begin.getLength() == 1 && end.getLength() == 1) {
        Time beginTime = begin.item(0);
        Time endTime = end.item(0);
        return beginTime.getOffset() == 0. && endTime.getOffset() == 0.;
    }
    return false;
}
项目:Silence    文件:SmilParElementImpl.java   
@Override
public TimeList getBegin() {
    /*
     * For children of a sequence, the only legal value for begin is
     * a (single) non-negative offset value.
     */
    TimeList beginTimeList = super.getBegin();
    if (beginTimeList.getLength() > 1) {
        ArrayList<Time> singleTimeContainer = new ArrayList<Time>();
        singleTimeContainer.add(beginTimeList.item(0));
        beginTimeList = new TimeListImpl(singleTimeContainer);
    }
    return beginTimeList;
}
项目:Securecom-Messaging    文件:TimeListImpl.java   
public Time item(int index) {
    Time time = null;
    try {
        time = mTimes.get(index);
    } catch (IndexOutOfBoundsException e) {
        // Do nothing and return null
    }
    return time;
}
项目:Securecom-Messaging    文件:ElementTimeImpl.java   
public TimeList getBegin() {
    String[] beginTimeStringList = mSmilElement.getAttribute("begin").split(";");

    // TODO: Check other constraints on parsed values, e.g., "single, non-negative offset values
    ArrayList<Time> beginTimeList = new ArrayList<Time>();
    // Initialize Time instances and add them to Vector
    for (int i = 0; i < beginTimeStringList.length; i++) {
        try {
            beginTimeList.add(new TimeImpl(beginTimeStringList[i], getBeginConstraints()));
        } catch (IllegalArgumentException e) {
            // Ignore badly formatted times
        }
    }
    if (beginTimeList.size() == 0) {
        /*
         * What is the right default value?
         *
         * In MMS SMIL, this method may be called either on an instance of:
         *
         * 1 - ElementSequentialTimeContainer (The SMILDocument)
         * 2 - ElementParallelTimeContainer (A Time-Child of the SMILDocument, which is a seq)
         * 3 - ElementTime (A SMILMediaElement).
         *
         * 1 - In the first case, the default start time is obviously 0.
         * 2 - In the second case, the specifications mentions that
         *      "For children of a sequence, the only legal value for begin is
         *      a (single) non-negative offset value. The default begin value is 0."
         * 3 - In the third case, the specification mentions that
         *      "The default value of begin for children of a par is 0."
         *
         * In short, if no value is specified, the default is always 0.
         */

        beginTimeList.add(new TimeImpl("0", TimeImpl.ALLOW_ALL));
    }
    return new TimeListImpl(beginTimeList);
}
项目:Securecom-Messaging    文件:ElementTimeImpl.java   
public TimeList getEnd() {
    ArrayList<Time> endTimeList = new ArrayList<Time>();

    String[] endTimeStringList = mSmilElement.getAttribute("end").split(";");
    int len = endTimeStringList.length;
    if (!((len == 1) && (endTimeStringList[0].length() == 0))) {  // Ensure the end field is set.
        // Initialize Time instances and add them to Vector
        for (int i = 0; i < len; i++) {
            try {
                endTimeList.add(new TimeImpl(endTimeStringList[i],
                        getEndConstraints()));
            } catch (IllegalArgumentException e) {
                // Ignore badly formatted times
                Log.e(TAG, "Malformed time value.", e);
            }
        }
    }

    // "end" time is not specified
    if (endTimeList.size() == 0) {
        // Get duration
        float duration = getDur();

        if (duration < 0) {
            endTimeList.add(new TimeImpl("indefinite", getEndConstraints()));
        } else {
            // Get begin
            TimeList begin = getBegin();
            for (int i = 0; i < begin.getLength(); i++) {
                endTimeList.add(new TimeImpl(
                        // end = begin + dur
                        begin.item(i).getResolvedOffset() + duration + "s",
                        getEndConstraints()));
            }
        }
    }

    return new TimeListImpl(endTimeList);
}
项目:Securecom-Messaging    文件:ElementTimeImpl.java   
private boolean beginAndEndAreZero() {
    TimeList begin = getBegin();
    TimeList end = getEnd();
    if (begin.getLength() == 1 && end.getLength() == 1) {
        Time beginTime = begin.item(0);
        Time endTime = end.item(0);
        return beginTime.getOffset() == 0. && endTime.getOffset() == 0.;
    }
    return false;
}
项目:Securecom-Messaging    文件:SmilParElementImpl.java   
@Override
public TimeList getBegin() {
    /*
     * For children of a sequence, the only legal value for begin is
     * a (single) non-negative offset value.
     */
    TimeList beginTimeList = super.getBegin();
    if (beginTimeList.getLength() > 1) {
        ArrayList<Time> singleTimeContainer = new ArrayList<Time>();
        singleTimeContainer.add(beginTimeList.item(0));
        beginTimeList = new TimeListImpl(singleTimeContainer);
    }
    return beginTimeList;
}
项目:android-aosp-mms    文件:TimeListImpl.java   
public Time item(int index) {
    Time time = null;
    try {
        time = mTimes.get(index);
    } catch (IndexOutOfBoundsException e) {
        // Do nothing and return null
    }
    return time;
}
项目:android-aosp-mms    文件:ElementTimeImpl.java   
public TimeList getBegin() {
    String[] beginTimeStringList = mSmilElement.getAttribute("begin").split(";");

    // TODO: Check other constraints on parsed values, e.g., "single, non-negative offset values
    ArrayList<Time> beginTimeList = new ArrayList<Time>();
    // Initialize Time instances and add them to Vector
    for (int i = 0; i < beginTimeStringList.length; i++) {
        try {
            beginTimeList.add(new TimeImpl(beginTimeStringList[i], getBeginConstraints()));
        } catch (IllegalArgumentException e) {
            // Ignore badly formatted times
        }
    }
    if (beginTimeList.size() == 0) {
        /*
         * What is the right default value?
         *
         * In MMS SMIL, this method may be called either on an instance of:
         *
         * 1 - ElementSequentialTimeContainer (The SMILDocument)
         * 2 - ElementParallelTimeContainer (A Time-Child of the SMILDocument, which is a seq)
         * 3 - ElementTime (A SMILMediaElement).
         *
         * 1 - In the first case, the default start time is obviously 0.
         * 2 - In the second case, the specifications mentions that
         *      "For children of a sequence, the only legal value for begin is
         *      a (single) non-negative offset value. The default begin value is 0."
         * 3 - In the third case, the specification mentions that
         *      "The default value of begin for children of a par is 0."
         *
         * In short, if no value is specified, the default is always 0.
         */

        beginTimeList.add(new TimeImpl("0", TimeImpl.ALLOW_ALL));
    }
    return new TimeListImpl(beginTimeList);
}
项目:android-aosp-mms    文件:ElementTimeImpl.java   
public TimeList getEnd() {
    ArrayList<Time> endTimeList = new ArrayList<Time>();

    String[] endTimeStringList = mSmilElement.getAttribute("end").split(";");
    int len = endTimeStringList.length;
    if (!((len == 1) && (endTimeStringList[0].length() == 0))) {  // Ensure the end field is set.
        // Initialize Time instances and add them to Vector
        for (int i = 0; i < len; i++) {
            try {
                endTimeList.add(new TimeImpl(endTimeStringList[i],
                        getEndConstraints()));
            } catch (IllegalArgumentException e) {
                // Ignore badly formatted times
                Log.e(TAG, "Malformed time value.", e);
            }
        }
    }

    // "end" time is not specified
    if (endTimeList.size() == 0) {
        // Get duration
        float duration = getDur();

        if (duration < 0) {
            endTimeList.add(new TimeImpl("indefinite", getEndConstraints()));
        } else {
            // Get begin
            TimeList begin = getBegin();
            for (int i = 0; i < begin.getLength(); i++) {
                endTimeList.add(new TimeImpl(
                        // end = begin + dur
                        begin.item(i).getResolvedOffset() + duration + "s",
                        getEndConstraints()));
            }
        }
    }

    return new TimeListImpl(endTimeList);
}