Example usage for org.joda.time LocalTime getMinuteOfHour

List of usage examples for org.joda.time LocalTime getMinuteOfHour

Introduction

In this page you can find the example usage for org.joda.time LocalTime getMinuteOfHour.

Prototype

public int getMinuteOfHour() 

Source Link

Document

Get the minute of hour field value.

Usage

From source file:business.RegistroBO.java

public LocalTime getLateTimeByMonth(Date dt) {
    LocalTime result = new LocalTime(0, 0);
    try {/* ww w .j  a va  2s.  c o  m*/
        List<Registro> list = registroDao.getListByMonth(dt);
        for (Registro reg : list) {
            LocalTime tmp = getLateTime(reg);
            if ((tmp.getHourOfDay() > 0) || (tmp.getMinuteOfHour() > 0)) {
                result = result.plusHours(tmp.getHourOfDay());
                result = result.plusMinutes(tmp.getMinuteOfHour());
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return result;
}

From source file:business.RegistroBO.java

/**
 *
 * @param beginDate//from w  w  w.j a  v a2  s  .c  o m
 * @param endDate
 * @return
 */
public LocalTime getOvertime(Date beginDate, Date endDate) {
    LocalTime result = new LocalTime(0, 0);
    try {
        List<Registro> list = registroDao.getListBetween(beginDate, endDate);
        for (Registro reg : list) {
            //zerando a data para comparar
            Calendar cal = Calendar.getInstance();
            cal.setTime(reg.getDate());
            Calendar dateCalendar = new GregorianCalendar(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH),
                    cal.get(Calendar.DAY_OF_MONTH));
            if ((dateCalendar.getTime().compareTo(beginDate) >= 0)
                    && (dateCalendar.getTime().compareTo(endDate) <= 0)) {

                LocalTime tmp = getLateLimitedTime(reg);
                //                    if ((tmp.getHourOfDay() > 0) || (tmp.getMinuteOfHour() > 0)) {
                //                        result = result.plusHours(tmp.getHourOfDay());
                //                        result = result.plusMinutes(tmp.getMinuteOfHour());
                //                    }
                if ((reg.getTotalHoras().getHourOfDay() >= Constants.TOTAL_LIMIT.getHourOfDay())
                        && (reg.getTotalHoras().getMinuteOfHour() >= Constants.TOTAL_LIMIT.getMinuteOfHour())) {
                    int h = (reg.getTotalHoras().getHourOfDay() + tmp.getHourOfDay())
                            - (Constants.TOTAL_LIMIT.getHourOfDay());
                    int m = tmp.getMinuteOfHour() + reg.getTotalHoras().getMinuteOfHour();
                    result = result.plusHours(h);
                    result = result.plusMinutes(m);
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return result;
}

From source file:business.RegistroBO.java

public LocalTime getLateTime(Registro reg) {
    LocalTime result = new LocalTime(0, 0);
    try {// www . j  a va2s  .  co m
        //calcula o tempo que infrigiu o horrio ncleo
        result = getLateLimitedTime(reg);
        //calcula o tempo que falta para a carga diria de trabalho
        if ((reg.getTotalHoras().getHourOfDay() < Constants.TOTAL_LIMIT.getHourOfDay())
                && (reg.getTotalHoras().getMinuteOfHour() > Constants.TOTAL_LIMIT.getMinuteOfHour())) {
            int h = (Constants.TOTAL_LIMIT.getHourOfDay() - 1) - reg.getTotalHoras().getHourOfDay();
            int m = 60 - reg.getTotalHoras().getMinuteOfHour();
            result = result.plusHours(h - result.getHourOfDay());
            result = result.plusMinutes(m - result.getMinuteOfHour());
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return result;
}

From source file:ch.eitchnet.android.mabea.MabeaConnection.java

License:Open Source License

/**
 * @param stateChange/* w w  w  .  j  a v  a 2 s.c o  m*/
 * @param stateChange2
 */
private void simulateAction(State previousState, State stateChange) {
    Logger.i(TAG, "simulateAction", "Simulating state change from " + previousState + " to " + stateChange);

    String name = "von Burg";
    String balanceS = "-1:7 (Std:Min)";
    String remainingVacationS = "21,5 Tage";
    String stateS;
    LocalTime now = LocalTime.now();
    String time = "(" + now.getHourOfDay() + ":" + now.getMinuteOfHour() + ")";
    if (stateChange == State.LOGGED_IN) {
        stateS = "Anwesend " + time;
    } else
        stateS = "Abwesend " + time;

    try {
        Duration balance = MabeaParsing.parseBalance(balanceS);
        Duration remainingVacation = MabeaParsing.parseRemainingVacation(remainingVacationS);
        MabeaState.State state = MabeaParsing.parseState(stateS);
        LocalDateTime stateTime = MabeaParsing.parseStateTime(stateS);

        this.mabeaState = new MabeaState(name, balance, remainingVacation, stateTime, state);

    } catch (MabeaParsingException e) {
        this.connectionError = e;
    }
}

From source file:ch.oakmountain.tpa.solver.PeriodicalTrainPathSlot.java

License:Apache License

public PeriodicalTrainPathSlot(String trainPathSectionName, String name, LocalTime startTime, LocalTime endTime,
        SystemNode from, SystemNode to, Periodicity periodicity) {
    this.trainPathSectionName = trainPathSectionName;
    this.periodicity = periodicity;
    this.name = name;
    this.startTime = startTime;
    this.endTime = endTime;
    this.from = from;
    this.to = to;

    for (Integer day : periodicity.getWeekDays()) {
        PeriodicalTimeFrame start = new PeriodicalTimeFrame(day, startTime.getHourOfDay(),
                startTime.getMinuteOfHour());
        PeriodicalTimeFrame end = new PeriodicalTimeFrame(day, endTime.getHourOfDay(),
                endTime.getMinuteOfHour());
        if (end.isBefore(start)) {
            end = end.plusHours(24);/*  ww  w . ja  v  a2  s. co m*/
        }
        if (!end.isWithinBounds(start, start.plusDays(1))) {
            throw new IllegalArgumentException("end " + end + " must be within 24h from " + start);
        }
        TrainPathSlot tp = new TrainPathSlot(name + "_" + day, start, end, from, to, this);
        slots[day] = tp;
    }
}

From source file:ch.oakmountain.tpa.solver.TrainPathApplication.java

License:Apache License

public TrainPathApplication(String name, SystemNode from, SystemNode to, LocalTime startTime, LocalTime endTime,
        Periodicity periodicity, int hardMaximumEarlierDeparture, int hardMinimumDwellTime,
        int hardMaximumLaterArrival) {
    this.name = name;
    this.periodicity = periodicity;
    this.from = from;
    this.to = to;
    this.startTime = startTime;
    this.endTime = endTime;
    for (Integer day : periodicity.getWeekDays()) {
        PeriodicalTimeFrame start = new PeriodicalTimeFrame(day, startTime.getHourOfDay(),
                startTime.getMinuteOfHour());
        PeriodicalTimeFrame end = new PeriodicalTimeFrame(day, endTime.getHourOfDay(),
                endTime.getMinuteOfHour());
        if (end.isBefore(start)) {
            end = new PeriodicalTimeFrame(PeriodicalTimeFrame.nextDayOfWeek(day), endTime.getHourOfDay(),
                    endTime.getMinuteOfHour());
        }//w  w  w .  j a  v  a  2s .c o m
        SimpleTrainPathApplication r = new SimpleTrainPathApplication(name + "_" + day, from, to, start, end,
                this, hardMaximumEarlierDeparture, hardMinimumDwellTime, hardMaximumLaterArrival);
        simpleTrainPathApplications[day] = r;
    }
}

From source file:cherry.goods.util.JodaTimeUtil.java

License:Apache License

/**
 * @param ltm ???{@link LocalTime}// w w  w  .  j  a  v  a  2  s . co m
 * @return ?????{@link Calendar}(?)????????(?1970-01-01)
 */
public static Calendar getCalendar(LocalTime ltm) {
    Calendar cal = Calendar.getInstance();
    cal.set(1970, 0, 1, ltm.getHourOfDay(), ltm.getMinuteOfHour(), ltm.getSecondOfMinute());
    cal.set(MILLISECOND, ltm.getMillisOfSecond());
    return cal;
}

From source file:com.alliander.osgp.domain.core.valueobjects.smartmetering.CosemTime.java

License:Open Source License

public CosemTime(final LocalTime time) {
    this(time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond() / 10);
}

From source file:com.alliander.osgp.dto.valueobjects.smartmetering.CosemTimeDto.java

License:Open Source License

public CosemTimeDto(final LocalTime time) {
    this(time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond() / 10);
}

From source file:com.freewheelschedule.freewheel.api.TriggerBuilder.java

License:Apache License

private String getTriggerTimeFromSource(org.freewheelschedule.freewheel.common.model.Trigger source) {
    LocalTime triggerTime = ((org.freewheelschedule.freewheel.common.model.TriggerWithTime) source)
            .getTriggerTime();//ww w. ja  v a  2s .c  o  m
    return triggerTime == null ? null
            : String.format("%2d:%02d:%02d.%03d", triggerTime.getHourOfDay(), triggerTime.getMinuteOfHour(),
                    triggerTime.getSecondOfMinute(), triggerTime.getMillisOfSecond());
}