[1997] | 1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany
|
---|
| 2 | //
|
---|
| 3 | // Licensed under the Apache License, Version 2.0 (the "License");
|
---|
| 4 | // you may not use this file except in compliance with the License.
|
---|
| 5 | // You may obtain a copy of the License at
|
---|
| 6 | //
|
---|
| 7 | // http://www.apache.org/licenses/LICENSE-2.0
|
---|
| 8 | //
|
---|
| 9 | // Unless required by applicable law or agreed to in writing, software
|
---|
| 10 | // distributed under the License is distributed on an "AS IS" BASIS,
|
---|
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
| 12 | // See the License for the specific language governing permissions and
|
---|
| 13 | // limitations under the License.
|
---|
| 14 |
|
---|
| 15 | package de.ugoe.cs.autoquest.eventcore;
|
---|
| 16 |
|
---|
| 17 | import java.util.Collection;
|
---|
| 18 | import java.util.List;
|
---|
| 19 | import java.util.logging.Level;
|
---|
| 20 |
|
---|
| 21 | import de.ugoe.cs.util.console.Console;
|
---|
| 22 |
|
---|
| 23 | /**
|
---|
| 24 | * <p>
|
---|
| 25 | * Convenience functions for working with events and sequences of events.
|
---|
| 26 | * </p>
|
---|
| 27 | *
|
---|
| 28 | * @author Steffen Herbold
|
---|
| 29 | */
|
---|
| 30 | public class EventUtils {
|
---|
| 31 |
|
---|
| 32 | /**
|
---|
| 33 | * <p>
|
---|
| 34 | * prints a collection of sequences to the trace stream of the console
|
---|
| 35 | * </p>
|
---|
| 36 | *
|
---|
| 37 | * @param logLevel
|
---|
| 38 | * the trace log level
|
---|
| 39 | * @param sequences
|
---|
| 40 | * sequences to be printed
|
---|
| 41 | */
|
---|
| 42 | public static void traceSequences(Level logLevel, Collection<List<Event>> sequences) {
|
---|
| 43 | if (sequences != null) {
|
---|
| 44 | for (List<Event> sequence : sequences) {
|
---|
| 45 | traceSequence(logLevel, sequence);
|
---|
| 46 | }
|
---|
| 47 | }
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | /**
|
---|
| 51 | * <p>
|
---|
| 52 | * prints a sequence to the trace stream of the console
|
---|
| 53 | * </p>
|
---|
| 54 | *
|
---|
| 55 | * @param logLevel
|
---|
| 56 | * the trace log level
|
---|
| 57 | * @param sequence
|
---|
| 58 | * sequence to be printed
|
---|
| 59 | */
|
---|
| 60 | public static void traceSequence(Level logLevel, List<Event> sequence) {
|
---|
| 61 | if (sequence != null) {
|
---|
| 62 | for (Event event : sequence) {
|
---|
| 63 | Console.traceln(logLevel, event.toString());
|
---|
| 64 | }
|
---|
| 65 | }
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | /**
|
---|
| 69 | * <p>
|
---|
| 70 | * private constructor to prevent initialization
|
---|
| 71 | * </p>
|
---|
| 72 | */
|
---|
| 73 | private EventUtils() {}
|
---|
| 74 | }
|
---|