if ((!isNegative() && duration.isNegative()) || (isNegative() && !duration.isNegative())) {
if ((!isNegative() && duration.isNegative()) || (isNegative() && !duration.isNegative())) {
/** * Returns a date representing the end of this duration from the specified start date. * @param start the date to start the duration * @return the end of the duration as a date */ public final Date getTime(final Date start) { final Calendar cal = Calendar.getInstance(); cal.setTime(start); if (isNegative()) { cal.add(Calendar.WEEK_OF_YEAR, -weeks); cal.add(Calendar.DAY_OF_WEEK, -days); cal.add(Calendar.HOUR_OF_DAY, -hours); cal.add(Calendar.MINUTE, -minutes); cal.add(Calendar.SECOND, -seconds); } else { cal.add(Calendar.WEEK_OF_YEAR, weeks); cal.add(Calendar.DAY_OF_WEEK, days); cal.add(Calendar.HOUR_OF_DAY, hours); cal.add(Calendar.MINUTE, minutes); cal.add(Calendar.SECOND, seconds); } return cal.getTime(); }
if ((!isNegative() && duration.isNegative()) || (isNegative() && !duration.isNegative())) {
if ((!isNegative() && duration.isNegative()) || (isNegative() && !duration.isNegative())) {
if ((!isNegative() && duration.isNegative()) || (isNegative() && !duration.isNegative())) {
/** * Returns a date representing the end of this duration from the specified start date. * @param start the date to start the duration * @return the end of the duration as a date */ public final Date getTime(final Date start) { final Calendar cal; if (start instanceof net.fortuna.ical4j.model.Date) { cal = Dates.getCalendarInstance((net.fortuna.ical4j.model.Date)start); } else { cal = Calendar.getInstance(); } cal.setTime(start); if (isNegative()) { cal.add(Calendar.WEEK_OF_YEAR, -weeks); cal.add(Calendar.DAY_OF_WEEK, -days); cal.add(Calendar.HOUR_OF_DAY, -hours); cal.add(Calendar.MINUTE, -minutes); cal.add(Calendar.SECOND, -seconds); } else { cal.add(Calendar.WEEK_OF_YEAR, weeks); cal.add(Calendar.DAY_OF_WEEK, days); cal.add(Calendar.HOUR_OF_DAY, hours); cal.add(Calendar.MINUTE, minutes); cal.add(Calendar.SECOND, seconds); } return cal.getTime(); }
/** * Returns a date representing the end of this duration from the specified start date. * @param start the date to start the duration * @return the end of the duration as a date */ public final Date getTime(final Date start) { final Calendar cal; if (start instanceof net.fortuna.ical4j.model.Date) { cal = Dates.getCalendarInstance((net.fortuna.ical4j.model.Date)start); } else { cal = Calendar.getInstance(); } cal.setTime(start); if (isNegative()) { cal.add(Calendar.WEEK_OF_YEAR, -weeks); cal.add(Calendar.DAY_OF_WEEK, -days); cal.add(Calendar.HOUR_OF_DAY, -hours); cal.add(Calendar.MINUTE, -minutes); cal.add(Calendar.SECOND, -seconds); } else { cal.add(Calendar.WEEK_OF_YEAR, weeks); cal.add(Calendar.DAY_OF_WEEK, days); cal.add(Calendar.HOUR_OF_DAY, hours); cal.add(Calendar.MINUTE, minutes); cal.add(Calendar.SECOND, seconds); } return cal.getTime(); }
/** * Returns a date representing the end of this duration from the specified start date. * @param start the date to start the duration * @return the end of the duration as a date */ public final Date getTime(final Date start) { final Calendar cal; if (start instanceof net.fortuna.ical4j.model.Date) { cal = Dates.getCalendarInstance((net.fortuna.ical4j.model.Date)start); } else { cal = Calendar.getInstance(); } cal.setTime(start); if (isNegative()) { cal.add(Calendar.WEEK_OF_YEAR, -weeks); cal.add(Calendar.DAY_OF_WEEK, -days); cal.add(Calendar.HOUR_OF_DAY, -hours); cal.add(Calendar.MINUTE, -minutes); cal.add(Calendar.SECOND, -seconds); } else { cal.add(Calendar.WEEK_OF_YEAR, weeks); cal.add(Calendar.DAY_OF_WEEK, days); cal.add(Calendar.HOUR_OF_DAY, hours); cal.add(Calendar.MINUTE, minutes); cal.add(Calendar.SECOND, seconds); } return cal.getTime(); }
/** * Returns a date representing the end of this duration from the specified start date. * @param start the date to start the duration * @return the end of the duration as a date */ public final Date getTime(final Date start) { final Calendar cal; if (start instanceof net.fortuna.ical4j.model.Date) { cal = Dates.getCalendarInstance((net.fortuna.ical4j.model.Date)start); } else { cal = Calendar.getInstance(); } cal.setTime(start); if (isNegative()) { cal.add(Calendar.WEEK_OF_YEAR, -weeks); cal.add(Calendar.DAY_OF_WEEK, -days); cal.add(Calendar.HOUR_OF_DAY, -hours); cal.add(Calendar.MINUTE, -minutes); cal.add(Calendar.SECOND, -seconds); } else { cal.add(Calendar.WEEK_OF_YEAR, weeks); cal.add(Calendar.DAY_OF_WEEK, days); cal.add(Calendar.HOUR_OF_DAY, hours); cal.add(Calendar.MINUTE, minutes); cal.add(Calendar.SECOND, seconds); } return cal.getTime(); }
if (isNegative() != arg0.isNegative()) { if (isNegative()) { return Integer.MIN_VALUE; if (isNegative()) { return -result;
if (isNegative() != arg0.isNegative()) { if (isNegative()) { return Integer.MIN_VALUE; if (isNegative()) { return -result;
if (isNegative() != arg0.isNegative()) { if (isNegative()) { return Integer.MIN_VALUE; if (isNegative()) { return -result;
if (isNegative() != arg0.isNegative()) { if (isNegative()) { return Integer.MIN_VALUE; if (isNegative()) { return -result;
if (isNegative() != arg0.isNegative()) { if (isNegative()) { return Integer.MIN_VALUE; if (isNegative()) { return -result;
public static TemporalAmountAdapter from(Dur dur) { TemporalAmount duration; if (dur.getWeeks() > 0) { Period p = Period.ofWeeks(dur.getWeeks()); if (dur.isNegative()) { p = p.negated(); } duration = p; } else { Duration d = Duration.ofDays(dur.getDays()) .plusHours(dur.getHours()) .plusMinutes(dur.getMinutes()) .plusSeconds(dur.getSeconds()); if (dur.isNegative()) { d = d.negated(); } duration = d; } return new TemporalAmountAdapter(duration); }
public static TemporalAmountAdapter from(Dur dur) { TemporalAmount duration; if (dur.getWeeks() > 0) { Period p = Period.ofWeeks(dur.getWeeks()); if (dur.isNegative()) { p = p.negated(); } duration = p; } else { Duration d = Duration.ofDays(dur.getDays()) .plusHours(dur.getHours()) .plusMinutes(dur.getMinutes()) .plusSeconds(dur.getSeconds()); if (dur.isNegative()) { d = d.negated(); } duration = d; } return new TemporalAmountAdapter(duration); }
/** Populate the bean from the given String value. * * @param db BwDuration * @param val String value * @throws CalFacadeException */ public static void populate(final BwDuration db, final String val) throws CalFacadeException { try { if (val == null) { return; } Dur d = new Dur(val); if (d.getWeeks() != 0) { db.setWeeks(d.getWeeks()); return; } db.setDays(d.getDays()); db.setHours(d.getHours()); db.setMinutes(d.getMinutes()); db.setSeconds(d.getSeconds()); db.setNegative(d.isNegative()); } catch (Throwable t) { throw new CalFacadeException("Invalid duration"); } }
else if (t.getDuration() != null && t.getDuration().isNegative()) { Related rel = (Related) t.getParameter(Parameter.RELATED); if (rel != null && rel == Related.END)