%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
ca.spaz.cron.datasource.FoodDataEvent |
|
|
1 | /* |
|
2 | ******************************************************************************* |
|
3 | * Copyright (c) 2005 Chris Rose and AIMedia |
|
4 | * All rights reserved. FoodDataEvent and the accompanying materials |
|
5 | * are made available under the terms of the Common Public License v1.0 |
|
6 | * which accompanies this distribution, and is available at |
|
7 | * http://www.eclipse.org/legal/cpl-v10.html |
|
8 | * |
|
9 | * Contributors: |
|
10 | * Chris Rose |
|
11 | *******************************************************************************/ |
|
12 | package ca.spaz.cron.datasource; |
|
13 | ||
14 | ||
15 | /** |
|
16 | * An event to be fired when a datasource has certain events occur. This is a |
|
17 | * typesafe enumeration pattern. |
|
18 | * |
|
19 | * @author Chris Rose |
|
20 | */ |
|
21 | public final class FoodDataEvent { |
|
22 | ||
23 | /** Enumeration number */ |
|
24 | private final int index; |
|
25 | ||
26 | /** Enumeration name */ |
|
27 | private final transient String enumName; |
|
28 | ||
29 | /** Enumeration values */ |
|
30 | // manual code: replace "ENUMERATION_VALUE_<i>" by the real enumeration identifiers |
|
31 | 0 | public static final FoodDataEvent DSEVENT_FOOD_ADDED = new FoodDataEvent("Food Added", 0); |
32 | ||
33 | 0 | public static final FoodDataEvent DSEVENT_FOOD_DELETED = new FoodDataEvent("Food Deleted", 1); |
34 | ||
35 | 0 | public static final FoodDataEvent DSEVENT_FOOD_CHANGED = new FoodDataEvent("Food Changed", 2); |
36 | ||
37 | 0 | public static final FoodDataEvent DSEVENT_MEASURE_ADDED = new FoodDataEvent("Measure Added", 3); |
38 | ||
39 | 0 | public static final FoodDataEvent DSEVENT_MEASURE_REMOVED = new FoodDataEvent("Measure Removed", 4); |
40 | ||
41 | 0 | public static final FoodDataEvent DSEVENT_MEASURE_CHANGED = new FoodDataEvent("Measures Changed", 5); |
42 | ||
43 | 0 | public static final FoodDataEvent DSEVENT_SERVING_ADDED = new FoodDataEvent("Serving Added", 6); |
44 | ||
45 | 0 | public static final FoodDataEvent DSEVENT_SERVING_REMOVED = new FoodDataEvent("Serving Removed", 7); |
46 | ||
47 | 0 | public static final FoodDataEvent DSEVENT_SERVING_CHANGED = new FoodDataEvent("Serving Changed", 8); |
48 | ||
49 | /** |
|
50 | * Constructor of the enumeration object. <br> |
|
51 | * |
|
52 | * This constructor should remain private. |
|
53 | * |
|
54 | * @param aName the name of the enumeration |
|
55 | */ |
|
56 | 0 | private FoodDataEvent(String name, int index) { |
57 | 0 | this.enumName = name; |
58 | 0 | this.index = index; |
59 | 0 | } |
60 | ||
61 | /** |
|
62 | * Returns the enumeration name. |
|
63 | * |
|
64 | * @return the enumeration name. |
|
65 | */ |
|
66 | public String toString() { |
|
67 | 0 | return this.enumName; |
68 | } |
|
69 | ||
70 | public int getIndex() { |
|
71 | 0 | return this.index; |
72 | } |
|
73 | ||
74 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |