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


Java ExceptionDates类代码示例

本文整理汇总了Java中biweekly.property.ExceptionDates的典型用法代码示例。如果您正苦于以下问题:Java ExceptionDates类的具体用法?Java ExceptionDates怎么用?Java ExceptionDates使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: _prepareParameters

import biweekly.property.ExceptionDates; //导入依赖的package包/类
@Override
protected ICalParameters _prepareParameters(ExceptionDates property, WriteContext context) {
	if (isInObservance(context)) {
		return property.getParameters();
	}

	boolean hasTime;
	if (property.getValues().isEmpty()) {
		hasTime = false;
	} else {
		hasTime = (dataType(property, context.getVersion()) == DATE_TIME);
	}
	return handleTzidParameter(property, hasTime, context);
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:15,代码来源:ExceptionDatesScribe.java

示例2: _dataType

import biweekly.property.ExceptionDates; //导入依赖的package包/类
@Override
protected ICalDataType _dataType(ExceptionDates property, ICalVersion version) {
	List<ICalDate> dates = property.getValues();
	if (!dates.isEmpty()) {
		return dates.get(0).hasTime() ? DATE_TIME : DATE;
	}

	return defaultDataType(version);
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:10,代码来源:ExceptionDatesScribe.java

示例3: writeValue

import biweekly.property.ExceptionDates; //导入依赖的package包/类
@Override
protected String writeValue(ExceptionDates property, ICalDate value, WriteContext context) {
	if (isInObservance(context)) {
		return date(value).observance(true).extended(false).write();
	}

	return date(value, property, context).extended(false).write();
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:9,代码来源:ExceptionDatesScribe.java

示例4: readValue

import biweekly.property.ExceptionDates; //导入依赖的package包/类
@Override
protected ICalDate readValue(ExceptionDates property, String value, ICalDataType dataType, ICalParameters parameters, ParseContext context) {
	ICalDate date;
	try {
		boolean hasTime = (dataType == DATE_TIME);
		date = date(value).hasTime(hasTime).parse();
	} catch (IllegalArgumentException e) {
		throw new CannotParseException(19);
	}
	context.addDate(date, property, parameters);

	return date;
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:14,代码来源:ExceptionDatesScribe.java

示例5: _parseJson

import biweekly.property.ExceptionDates; //导入依赖的package包/类
@Override
protected ExceptionDates _parseJson(JCalValue value, ICalDataType dataType, ICalParameters parameters, ParseContext context) {
	List<String> valueStrs = value.asMulti();

	ExceptionDates property = new ExceptionDates();
	List<ICalDate> values = property.getValues();
	for (String valueStr : valueStrs) {
		ICalDate date = readValue(property, valueStr, dataType, parameters, context);
		values.add(date);
	}
	return property;
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:13,代码来源:ExceptionDatesScribe.java

示例6: getDateIterator

import biweekly.property.ExceptionDates; //导入依赖的package包/类
@Test
public void getDateIterator() {
	TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");

	VEvent event = new VEvent();

	event.setDateStart(date("2016-03-25 14:00:00", tz));

	event.setRecurrenceRule(new Recurrence.Builder(Frequency.DAILY).count(10).build());

	RecurrenceDates rdate = new RecurrenceDates();
	rdate.getDates().add(new ICalDate(date("2016-03-26 20:00:00", tz)));
	rdate.getDates().add(new ICalDate(date("2016-03-27 20:00:00", tz)));
	event.addRecurrenceDates(rdate);

	ExceptionDates exdate = new ExceptionDates();
	exdate.getValues().add(new ICalDate(date("2016-03-27 14:00:00", tz)));
	event.addExceptionDates(exdate);

	ExceptionRule exrule = new ExceptionRule(new Recurrence.Builder(Frequency.WEEKLY).count(2).build());
	event.addProperty(exrule);

	//@formatter:off
	List<Date> expectedList = Arrays.asList(
		date("2016-03-26 14:00:00", tz),
		date("2016-03-26 20:00:00", tz),
		date("2016-03-27 20:00:00", tz),
		date("2016-03-28 14:00:00", tz),
		date("2016-03-29 14:00:00", tz),
		date("2016-03-30 14:00:00", tz),
		date("2016-03-31 14:00:00", tz),
		date("2016-04-02 14:00:00", tz),
		date("2016-04-03 14:00:00", tz)
	);
	//@formatter:on

	assertIteratorEquals(expectedList, Google2445Utils.getDateIterator(event, TimeZone.getTimeZone("UTC")));
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:39,代码来源:Google2445UtilsTest.java

示例7: has

import biweekly.property.ExceptionDates; //导入依赖的package包/类
private final Check<ExceptionDates> has(final ICalDate... dates) {
	return new Check<ExceptionDates>() {
		public void check(ExceptionDates actual, ParseContext context) {
			assertEquals(Arrays.asList(dates), actual.getValues());
		}
	};
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:8,代码来源:ExceptionDatesScribeTest.java

示例8: is

import biweekly.property.ExceptionDates; //导入依赖的package包/类
private final Check<ExceptionDates> is(final ExceptionDates expected) {
	return new Check<ExceptionDates>() {
		public void check(ExceptionDates actual, ParseContext context) {
			assertEquals(expected.getValues(), actual.getValues());
		}
	};
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:8,代码来源:ExceptionDatesScribeTest.java

示例9: dateTimeWithTimezone

import biweekly.property.ExceptionDates; //导入依赖的package包/类
private Check<ExceptionDates> dateTimeWithTimezone(final boolean extended) {
	return new Check<ExceptionDates>() {
		public void check(ExceptionDates property, ParseContext context) {
			assertEquals(0, context.getFloatingDates().size());

			ListMultimap<String, TimezonedDate> timezonedDates = context.getTimezonedDates();
			assertEquals(1, timezonedDates.keySet().size());
			List<TimezonedDate> dates = context.getTimezonedDates().get("id");
			assertEquals(2, dates.size());
			assertTrue(dates.contains(new TimezonedDate(icalDate("2014-10-26T12:00:00"), property)));
			assertTrue(dates.contains(new TimezonedDate(icalDate("2014-10-26T14:00:00"), property)));
		}
	};
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:15,代码来源:ExceptionDatesScribeTest.java

示例10: dateTimeWithoutTimezone

import biweekly.property.ExceptionDates; //导入依赖的package包/类
private Check<ExceptionDates> dateTimeWithoutTimezone(final boolean extended) {
	return new Check<ExceptionDates>() {
		public void check(ExceptionDates property, ParseContext context) {
			Collection<TimezonedDate> floating = context.getFloatingDates();
			assertEquals(2, floating.size());
			assertTrue(floating.contains(new TimezonedDate(icalDate("2014-10-26T12:00:00"), property)));
			assertTrue(floating.contains(new TimezonedDate(icalDate("2014-10-26T14:00:00"), property)));

			assertEquals(0, context.getTimezonedDates().size());
		}
	};
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:13,代码来源:ExceptionDatesScribeTest.java

示例11: extractExceptionDates

import biweekly.property.ExceptionDates; //导入依赖的package包/类
/**
 * extract the exception dates
 * 
 * @param e
 * @return
 */
private static List<Date> extractExceptionDates(VEvent e) {
	List<Date> dateList = new ArrayList<Date>();

	List<ExceptionDates> exceptionDates = e.getExceptionDates();
	if (exceptionDates != null) {
		for (ExceptionDates ed : exceptionDates) {
			dateList.addAll(ed.getValues());
		}
	}
	return dateList;
}
 
开发者ID:DHBWLoerrach,项目名称:campus-app,代码行数:18,代码来源:ICalHelper.java

示例12: buildExdate

import biweekly.property.ExceptionDates; //导入依赖的package包/类
/**
 * @param VEvent
 *            event
 * @param TimeZone
 *            tz
 * @return
 */
private static String buildExdate(VEvent event, TimeZone tz) {

	List<ExceptionDates> exceptionDates = event.getExceptionDates();
	if (exceptionDates != null) {

		StringBuilder sb = new StringBuilder();
		List<Date> dates = extractExceptionDates(event);

		if (tz != null) {
			sb.append("TZID=").append(tz.getID()).append(':');
		}

		for (Iterator<Date> iterator = dates.iterator(); iterator.hasNext();) {
			Date date = (Date) iterator.next();

			sb.append(parseIcalDateToString(date, tz));

			if (iterator.hasNext()) {
				sb.append(",");
			}
		}
		return sb.toString();
	}

	return "";
}
 
开发者ID:DHBWLoerrach,项目名称:campus-app,代码行数:34,代码来源:ICalHelper.java

示例13: ExceptionDatesScribe

import biweekly.property.ExceptionDates; //导入依赖的package包/类
public ExceptionDatesScribe() {
	super(ExceptionDates.class, "EXDATE");
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:4,代码来源:ExceptionDatesScribe.java

示例14: newInstance

import biweekly.property.ExceptionDates; //导入依赖的package包/类
@Override
protected ExceptionDates newInstance(ICalDataType dataType, ICalParameters parameters) {
	return new ExceptionDates();
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:5,代码来源:ExceptionDatesScribe.java

示例15: parseExceptionDates

import biweekly.property.ExceptionDates; //导入依赖的package包/类
protected List<ExceptionDates> parseExceptionDates(String property, TimeZone tz) throws ParseException {

		RDateList exDateList = new RDateList(property, tz);

		Calendar calUtc = Calendar.getInstance(TimeZone.getTimeZone("UTC"));

		ExceptionDates exDates = new ExceptionDates();

		for (DateValue exDate: exDateList.getDatesUtc()) {
			calUtc.clear();
			calUtc.set(exDate.year(), exDate.month(), exDate.day());
			exDates.addValue(calUtc.getTime());
		}

		List<ExceptionDates> listExDates = new ArrayList<ExceptionDates>();
		listExDates.add(exDates);

		return listExDates;
	}
 
开发者ID:eXfio,项目名称:CucumberSync,代码行数:20,代码来源:LocalCalendar.java


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