if (DateTickUnitType.MILLISECOND.equals(unit.getUnitType())) { years = calendar.get(Calendar.YEAR); months = calendar.get(Calendar.MONTH); else if (DateTickUnitType.SECOND.equals(unit.getUnitType())) { years = calendar.get(Calendar.YEAR); months = calendar.get(Calendar.MONTH); else if (DateTickUnitType.MINUTE.equals(unit.getUnitType())) { years = calendar.get(Calendar.YEAR); months = calendar.get(Calendar.MONTH); else if (DateTickUnitType.HOUR.equals(unit.getUnitType())) { years = calendar.get(Calendar.YEAR); months = calendar.get(Calendar.MONTH); else if (DateTickUnitType.DAY.equals(unit.getUnitType())) { years = calendar.get(Calendar.YEAR); months = calendar.get(Calendar.MONTH); else if (DateTickUnitType.MONTH.equals(unit.getUnitType())) { value = count * ((current + 1) / count) - 1; years = calendar.get(Calendar.YEAR); else if (DateTickUnitType.YEAR.equals(unit.getUnitType())) { if (this.tickMarkPosition == DateTickMarkPosition.START) { months = 0;
/** * Corrects the given tick date for the position setting. * * @param time the tick date/time. * @param unit the tick unit. * @param position the tick position. * * @return The adjusted time. */ private Date correctTickDateForPosition(Date time, DateTickUnit unit, DateTickMarkPosition position) { Date result = time; if (unit.getUnitType().equals(DateTickUnitType.MONTH)) { result = calculateDateForPosition(new Month(time, this.timeZone, this.locale), position); } else if (unit.getUnitType().equals(DateTickUnitType.YEAR)) { result = calculateDateForPosition(new Year(time, this.timeZone, this.locale), position); } return result; }