Example usage for java.time LocalTime equals

List of usage examples for java.time LocalTime equals

Introduction

In this page you can find the example usage for java.time LocalTime equals.

Prototype

@Override
public boolean equals(Object obj) 

Source Link

Document

Checks if this time is equal to another time.

Usage

From source file:Main.java

public static void main(String[] args) {
    LocalTime l = LocalTime.now();

    System.out.println(l.equals(LocalTime.NOON));
}

From source file:fll.scheduler.TableOptimizer.java

/**
 * Get the current table assignments for the specified time so that
 * they can be re-applied if needed.//from  w  w w  .j a  va 2  s .co m
 * 
 * @return key=table info, value=team number
 */
private Map<PerformanceTime, Integer> getCurrentTableAssignments(final LocalTime time) {
    final Map<PerformanceTime, Integer> assignments = new HashMap<>();

    for (final TeamScheduleInfo si : this.schedule.getSchedule()) {
        for (int round = 0; round < this.schedule.getNumberOfRounds(); ++round) {
            final PerformanceTime pt = si.getPerf(round);
            if (time.equals(pt.getTime())) {
                assignments.put(pt, si.getTeamNumber());
            }
        }
    }

    return assignments;
}

From source file:fll.scheduler.TableOptimizer.java

/**
 * Optimize the table use at the specified times.
 * // w ww .  ja va2s  .co  m
 * @param perfTimes the times to optimize at
 * @param checkCancled used to check if the optimization should exit early
 */
private void optimize(final Set<LocalTime> perfTimes, final CheckCanceled checkCanceled) {
    for (final LocalTime time : perfTimes) {
        final List<Integer> teams = new ArrayList<Integer>();

        List<String> tables = null;
        for (final TeamScheduleInfo si : schedule.getSchedule()) {
            for (int round = 0; round < schedule.getNumberOfRounds(); ++round) {
                final PerformanceTime pt = si.getPerf(round);
                if (time.equals(pt.getTime())) {
                    teams.add(si.getTeamNumber());

                    // choose the tables to use for assignments
                    if (null == tables) {
                        for (int i = 0; null == tables && i < tableGroups.size(); ++i) {
                            final List<String> group = this.tableGroups.get(i);
                            if (group.contains(pt.getTable())) {
                                tables = group;
                            }
                        }
                        if (null == tables) {
                            throw new FLLRuntimeException("Cannot find table group for " + pt.getTable());
                        }
                    }

                }
            }
        } // foreach schedule item

        computeBestTableOrdering(teams, time, tables, checkCanceled);

    } // foreach time
}