本文整理汇总了Java中org.dmfs.rfc5545.DateTime.isAllDay方法的典型用法代码示例。如果您正苦于以下问题:Java DateTime.isAllDay方法的具体用法?Java DateTime.isAllDay怎么用?Java DateTime.isAllDay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.dmfs.rfc5545.DateTime
的用法示例。
在下文中一共展示了DateTime.isAllDay方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toTime
import org.dmfs.rfc5545.DateTime; //导入方法依赖的package包/类
/**
* {@link Time} will eventually be replaced with {@link DateTime} in the project.
* This conversion function is only needed in the transition period.
*/
@VisibleForTesting
Time toTime(DateTime dateTime)
{
if (dateTime.isFloating() && !dateTime.isAllDay())
{
throw new IllegalArgumentException("Cannot support floating DateTime that is not all-day, can't represent it with Time");
}
// Time always needs a TimeZone (default ctor falls back to TimeZone.getDefault())
String timeZoneId = dateTime.getTimeZone() == null ? "UTC" : dateTime.getTimeZone().getID();
Time time = new Time(timeZoneId);
time.set(dateTime.getTimestamp());
// TODO Would using time.set(monthDay, month, year) be better?
if (dateTime.isAllDay())
{
time.allDay = true;
// This is needed as per time.allDay docs:
time.hour = 0;
time.minute = 0;
time.second = 0;
}
return time;
}
示例2: iterator
import org.dmfs.rfc5545.DateTime; //导入方法依赖的package包/类
/**
* Get a new {@link RuleIterator} that iterates all instances of this rule. <p> <strong>Note:</strong> If the rule contains an UNTIL part with a floating
* value, you have to provide <code>null</code> as the timezone. </p>
*
* @param start
* The time of the first instance in milliseconds since the epoch.
* @param timezone
* The {@link TimeZone} of the first instance or <code>null</code> for floating times.
*
* @return A {@link RecurrenceRuleIterator}.
*/
public RecurrenceRuleIterator iterator(long start, TimeZone timezone)
{
// TODO: avoid creating a temporary DATETIME instance.
DateTime dt = new DateTime(mCalendarMetrics, timezone, start);
DateTime until = getUntil();
if (until != null && until.isAllDay())
{
dt = dt.toAllDay();
}
return iterator(dt);
}
示例3: RecurrenceRuleIterator
import org.dmfs.rfc5545.DateTime; //导入方法依赖的package包/类
/**
* Creates a new {@link RecurrenceRuleIterator} that gets its input from <code>ruleIterator</code>.
*
* @param ruleIterator
* The last {@link RuleIterator} in the chain of iterators.
* @param start
* The first instance to iterate.
*/
RecurrenceRuleIterator(RuleIterator ruleIterator, DateTime start, CalendarMetrics calendarMetrics)
{
mRuleIterator = ruleIterator;
mAllDay = start.isAllDay();
mCalendarMetrics = calendarMetrics;
mTimeZone = start.isFloating() ? null : start.getTimeZone();
fetchNextInstance();
}
示例4: isEquivalentDateTimeAndTime
import org.dmfs.rfc5545.DateTime; //导入方法依赖的package包/类
/**
* Contains the definition/requirement of when a {@link DateTime} and {@link Time} is considered equivalent in this project.
*/
private boolean isEquivalentDateTimeAndTime(DateTime dateTime, Time time)
{
// android.text.Time doesn't seem to store in millis precision, there is a 1000 multiplier used there internally
// when calculating millis, so we can only compare in this precision:
boolean millisMatch =
dateTime.getTimestamp() / 1000
==
time.toMillis(false) / 1000;
boolean yearMatch = dateTime.getYear() == time.year;
boolean monthMatch = dateTime.getMonth() == time.month;
boolean dayMatch = dateTime.getDayOfMonth() == time.monthDay;
boolean hourMatch = dateTime.getHours() == time.hour;
boolean minuteMatch = dateTime.getMinutes() == time.minute;
boolean secondsMatch = dateTime.getSeconds() == time.second;
boolean allDaysMatch = time.allDay == dateTime.isAllDay();
boolean timeZoneMatch =
(dateTime.isFloating() && dateTime.isAllDay() && time.timezone.equals("UTC"))
||
// This is the regular case with non-floating DateTime
(dateTime.getTimeZone() != null && time.timezone.equals(dateTime.getTimeZone().getID()));
return millisMatch
&& yearMatch
&& monthMatch
&& dayMatch
&& hourMatch
&& minuteMatch
&& secondsMatch
&& allDaysMatch
&& timeZoneMatch;
}
示例5: getFrom
import org.dmfs.rfc5545.DateTime; //导入方法依赖的package包/类
@Override
public DateTime[] getFrom(ContentValues values)
{
String datetimeList = values.getAsString(mDateTimeListFieldName);
if (datetimeList == null)
{
// no list, return null
return null;
}
// create a new TimeZone for the given time zone string
String timezoneString = mTimeZoneFieldName == null ? null : values.getAsString(mTimeZoneFieldName);
TimeZone timeZone = timezoneString == null ? null : TimeZone.getTimeZone(timezoneString);
String[] datetimes = SEPARATOR_PATTERN.split(datetimeList);
DateTime[] result = new DateTime[datetimes.length];
for (int i = 0, count = datetimes.length; i < count; ++i)
{
DateTime value = DateTime.parse(timeZone, datetimes[i]);
if (!value.isAllDay() && value.isFloating())
{
throw new IllegalArgumentException("DateTime values must not be floating, unless they are all-day.");
}
result[i] = value;
if (i > 0 && result[0].isAllDay() != value.isAllDay())
{
throw new IllegalArgumentException("DateTime values must all be of the same type.");
}
}
return result;
}