当前位置: 首页>>代码示例>>Java>>正文


Java ReadableInterval.getStartMillis方法代码示例

本文整理汇总了Java中org.joda.time.ReadableInterval.getStartMillis方法的典型用法代码示例。如果您正苦于以下问题:Java ReadableInterval.getStartMillis方法的具体用法?Java ReadableInterval.getStartMillis怎么用?Java ReadableInterval.getStartMillis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.joda.time.ReadableInterval的用法示例。


在下文中一共展示了ReadableInterval.getStartMillis方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: BaseInterval

import org.joda.time.ReadableInterval; //导入方法依赖的package包/类
/**
 * Constructs a time interval converting or copying from another object
 * that describes an interval.
 * 
 * @param interval  the time interval to copy
 * @param chrono  the chronology to use, null means let converter decide
 * @throws IllegalArgumentException if the interval is invalid
 */
protected BaseInterval(Object interval, Chronology chrono) {
    super();
    IntervalConverter converter = ConverterManager.getInstance().getIntervalConverter(interval);
    if (converter.isReadableInterval(interval, chrono)) {
        ReadableInterval input = (ReadableInterval) interval;
        iChronology = (chrono != null ? chrono : input.getChronology());
        iStartMillis = input.getStartMillis();
        iEndMillis = input.getEndMillis();
    } else if (this instanceof ReadWritableInterval) {
        converter.setInto((ReadWritableInterval) this, interval, chrono);
    } else {
        MutableInterval mi = new MutableInterval();
        converter.setInto(mi, interval, chrono);
        iChronology = mi.getChronology();
        iStartMillis = mi.getStartMillis();
        iEndMillis = mi.getEndMillis();
    }
    checkInterval(iStartMillis, iEndMillis);
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:28,代码来源:BaseInterval.java

示例2: contains

import org.joda.time.ReadableInterval; //导入方法依赖的package包/类
/**
 * Does a time interval contain a specified time interval.
 * 
 * @param interval the interval to check
 * @param intervalCompareTo the interval to compare to
 * @return true if this time ' intervalCompareTo' contains 'intervalCompareTo'
 */
public static boolean contains(ReadableInterval interval, ReadableInterval intervalCompareTo) {
    if (intervalCompareTo == null) {
        return DateUtils.containsNow(intervalCompareTo);
    }
    long otherStart = intervalCompareTo.getStartMillis();
    long otherEnd = intervalCompareTo.getEndMillis();
    long thisStart = interval.getStartMillis();
    long thisEnd = interval.getEndMillis();
    return (thisStart <= otherStart && otherStart <= thisEnd && otherEnd <= thisEnd);
}
 
开发者ID:clstoulouse,项目名称:motu,代码行数:18,代码来源:DateUtils.java

示例3: intersects

import org.joda.time.ReadableInterval; //导入方法依赖的package包/类
/**
 * Does a time interval intersect another time interval.
 * <p>
 * 
 * @param interval1 the interval1
 * @param interval2 the interval2
 * @return true if the time intervals intersect
 */
public static boolean intersects(ReadableInterval interval1, ReadableInterval interval2) {

    if (interval1 == null) {
        return false;
    }
    if (interval2 == null) {
        return false;
    }
    long thisStart = interval1.getStartMillis();
    long thisEnd = interval1.getEndMillis();
    long otherStart = interval2.getStartMillis();
    long otherEnd = interval2.getEndMillis();
    return (thisStart <= otherEnd && otherStart <= thisEnd);
}
 
开发者ID:clstoulouse,项目名称:motu,代码行数:23,代码来源:DateUtils.java

示例4: equals

import org.joda.time.ReadableInterval; //导入方法依赖的package包/类
/**
 * Compares this object with the specified object for equality based
 * on start and end millis plus the chronology.
 * All ReadableInterval instances are accepted.
 * <p>
 * To compare the duration of two time intervals, use {@link #toDuration()}
 * to get the durations and compare those.
 *
 * @param readableInterval  a readable interval to check against
 * @return true if the start and end millis are equal
 */
public boolean equals(Object readableInterval) {
    if (this == readableInterval) {
        return true;
    }
    if (readableInterval instanceof ReadableInterval == false) {
        return false;
    }
    ReadableInterval other = (ReadableInterval) readableInterval;
    return 
        getStartMillis() == other.getStartMillis() &&
        getEndMillis() == other.getEndMillis() &&
        FieldUtils.equals(getChronology(), other.getChronology());
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:25,代码来源:AbstractInterval.java

示例5: setInto

import org.joda.time.ReadableInterval; //导入方法依赖的package包/类
/**
 * Sets the values of the mutable duration from the specified interval.
 * 
 * @param writablePeriod  the period to modify
 * @param object  the interval to set from
 * @param chrono  the chronology to use
 */
public void setInto(ReadWritablePeriod writablePeriod, Object object, Chronology chrono) {
    ReadableInterval interval = (ReadableInterval) object;
    chrono = (chrono != null ? chrono : DateTimeUtils.getIntervalChronology(interval));
    long start = interval.getStartMillis();
    long end = interval.getEndMillis();
    int[] values = chrono.get(writablePeriod, start, end);
    for (int i = 0; i < values.length; i++) {
        writablePeriod.setValue(i, values[i]);
    }
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:18,代码来源:ReadableIntervalConverter.java

示例6: equals

import org.joda.time.ReadableInterval; //导入方法依赖的package包/类
/**
 * Compares this object with the specified object for equality based
 * on start and end millis plus the chronology.
 * All ReadableInterval instances are accepted.
 * <p>
 * To compare the duration of two time intervals, use {@link #toDuration()}
 * to get the durations and compare those.
 *
 * @param readableInterval  a readable interval to check against
 * @return true if the intervals are equal comparing the start millis,
 *  end millis and chronology
 */
public boolean equals(Object readableInterval) {
    if (this == readableInterval) {
        return true;
    }
    if (readableInterval instanceof ReadableInterval == false) {
        return false;
    }
    ReadableInterval other = (ReadableInterval) readableInterval;
    return 
        getStartMillis() == other.getStartMillis() &&
        getEndMillis() == other.getEndMillis() &&
        FieldUtils.equals(getChronology(), other.getChronology());
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:26,代码来源:AbstractInterval.java

示例7: contains

import org.joda.time.ReadableInterval; //导入方法依赖的package包/类
/**
 * Does this time interval contain the specified time interval.
 * <p>
 * Non-zero duration intervals are inclusive of the start instant and
 * exclusive of the end. The other interval is contained if this interval
 * wholly contains, starts, finishes or equals it.
 * A zero duration interval cannot contain anything.
 * <p>
 * When two intervals are compared the result is one of three states:
 * (a) they abut, (b) there is a gap between them, (c) they overlap.
 * The <code>contains</code> method is not related to these states.
 * In particular, a zero duration interval is contained at the start of
 * a larger interval, but does not overlap (it abuts instead).
 * <p>
 * For example:
 * <pre>
 * [09:00 to 10:00) contains [09:00 to 10:00)  = true
 * [09:00 to 10:00) contains [09:00 to 09:30)  = true
 * [09:00 to 10:00) contains [09:30 to 10:00)  = true
 * [09:00 to 10:00) contains [09:15 to 09:45)  = true
 * [09:00 to 10:00) contains [09:00 to 09:00)  = true
 * 
 * [09:00 to 10:00) contains [08:59 to 10:00)  = false (otherStart before thisStart)
 * [09:00 to 10:00) contains [09:00 to 10:01)  = false (otherEnd after thisEnd)
 * [09:00 to 10:00) contains [10:00 to 10:00)  = false (otherStart equals thisEnd)
 * 
 * [14:00 to 14:00) contains [14:00 to 14:00)  = false (zero duration contains nothing)
 * </pre>
 * Passing in a <code>null</code> parameter will have the same effect as
 * calling {@link #containsNow()}.
 *
 * @param interval  the time interval to compare to, null means a zero duration interval now
 * @return true if this time interval contains the time interval
 */
public boolean contains(ReadableInterval interval) {
    if (interval == null) {
        return containsNow();
    }
    long otherStart = interval.getStartMillis();
    long otherEnd = interval.getEndMillis();
    long thisStart = getStartMillis();
    long thisEnd = getEndMillis();
    return (thisStart <= otherStart && otherStart < thisEnd && otherEnd <= thisEnd);
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:45,代码来源:AbstractInterval.java

示例8: overlaps

import org.joda.time.ReadableInterval; //导入方法依赖的package包/类
/**
 * Does this time interval overlap the specified time interval.
 * <p>
 * Intervals are inclusive of the start instant and exclusive of the end.
 * An interval overlaps another if it shares some common part of the
 * datetime continuum. 
 * <p>
 * When two intervals are compared the result is one of three states:
 * (a) they abut, (b) there is a gap between them, (c) they overlap.
 * The abuts state takes precedence over the other two, thus a zero duration
 * interval at the start of a larger interval abuts and does not overlap.
 * <p>
 * For example:
 * <pre>
 * [09:00 to 10:00) overlaps [08:00 to 08:30)  = false (completely before)
 * [09:00 to 10:00) overlaps [08:00 to 09:00)  = false (abuts before)
 * [09:00 to 10:00) overlaps [08:00 to 09:30)  = true
 * [09:00 to 10:00) overlaps [08:00 to 10:00)  = true
 * [09:00 to 10:00) overlaps [08:00 to 11:00)  = true
 * 
 * [09:00 to 10:00) overlaps [09:00 to 09:00)  = false (abuts before)
 * [09:00 to 10:00) overlaps [09:00 to 09:30)  = true
 * [09:00 to 10:00) overlaps [09:00 to 10:00)  = true
 * [09:00 to 10:00) overlaps [09:00 to 11:00)  = true
 * 
 * [09:00 to 10:00) overlaps [09:30 to 09:30)  = true
 * [09:00 to 10:00) overlaps [09:30 to 10:00)  = true
 * [09:00 to 10:00) overlaps [09:30 to 11:00)  = true
 * 
 * [09:00 to 10:00) overlaps [10:00 to 10:00)  = false (abuts after)
 * [09:00 to 10:00) overlaps [10:00 to 11:00)  = false (abuts after)
 * 
 * [09:00 to 10:00) overlaps [10:30 to 11:00)  = false (completely after)
 * 
 * [14:00 to 14:00) overlaps [14:00 to 14:00)  = false (abuts before and after)
 * [14:00 to 14:00) overlaps [13:00 to 15:00)  = true
 * </pre>
 *
 * @param interval  the time interval to compare to, null means a zero length interval now
 * @return true if the time intervals overlap
 */
public boolean overlaps(ReadableInterval interval) {
    long thisStart = getStartMillis();
    long thisEnd = getEndMillis();
    if (interval == null) {
        long now = DateTimeUtils.currentTimeMillis();
        return (thisStart < now && now < thisEnd);
    }  else {
        long otherStart = interval.getStartMillis();
        long otherEnd = interval.getEndMillis();
        return (thisStart < otherEnd && otherStart < thisEnd);
    }
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:54,代码来源:AbstractInterval.java

示例9: isEqual

import org.joda.time.ReadableInterval; //导入方法依赖的package包/类
/**
 * Is this interval equal to the specified interval ignoring the chronology.
 * <p>
 * This compares the underlying instants, ignoring the chronology.
 *
 * @param other  a readable interval to check against
 * @return true if the intervals are equal comparing the start and end millis
 * @since 2.3
 */
public boolean isEqual(ReadableInterval other) {
    return getStartMillis() == other.getStartMillis() &&
            getEndMillis() == other.getEndMillis();
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:14,代码来源:AbstractInterval.java


注:本文中的org.joda.time.ReadableInterval.getStartMillis方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。