Example usage for org.joda.time Period toMutablePeriod

List of usage examples for org.joda.time Period toMutablePeriod

Introduction

In this page you can find the example usage for org.joda.time Period toMutablePeriod.

Prototype

public MutablePeriod toMutablePeriod() 

Source Link

Document

Get this object as a MutablePeriod.

Usage

From source file:org.openehr.rm.datatypes.quantity.datetime.DvDuration.java

License:LGPL

/**
 * Helper method to negate a copy of period
 * //from w  w  w  .j  ava  2  s  .c  o  m
 * @param mPeriod
 * @return a negated copy of period
 */
static Period negatePeriod(Period period) {
    MutablePeriod mPeriod = period.toMutablePeriod();
    mPeriod.setYears(-mPeriod.getYears());
    mPeriod.setMonths(-mPeriod.getMonths());
    mPeriod.setWeeks(-mPeriod.getWeeks());
    mPeriod.setDays(-mPeriod.getDays());
    mPeriod.setHours(-mPeriod.getHours());
    mPeriod.setMinutes(-mPeriod.getMinutes());
    mPeriod.setSeconds(-mPeriod.getSeconds());
    mPeriod.setMillis(-mPeriod.getMillis());
    return mPeriod.toPeriod();
}