1 | /**
|
---|
2 | * Overlay.java
|
---|
3 | * Copyright (C) 2010 New Zealand Digital Library, http://expeditee.org
|
---|
4 | *
|
---|
5 | * This program is free software: you can redistribute it and/or modify
|
---|
6 | * it under the terms of the GNU General Public License as published by
|
---|
7 | * the Free Software Foundation, either version 3 of the License, or
|
---|
8 | * (at your option) any later version.
|
---|
9 | *
|
---|
10 | * This program is distributed in the hope that it will be useful,
|
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | * GNU General Public License for more details.
|
---|
14 | *
|
---|
15 | * You should have received a copy of the GNU General Public License
|
---|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
17 | */
|
---|
18 |
|
---|
19 | package org.expeditee.gui;
|
---|
20 |
|
---|
21 | import java.util.Collection;
|
---|
22 |
|
---|
23 | import org.expeditee.items.UserAppliedPermission;
|
---|
24 |
|
---|
25 | public class Overlay {
|
---|
26 | public Frame Frame;
|
---|
27 |
|
---|
28 | public UserAppliedPermission permission;
|
---|
29 |
|
---|
30 | public Overlay(Frame overlay, UserAppliedPermission level) {
|
---|
31 | Frame = overlay;
|
---|
32 | permission = level;
|
---|
33 | }
|
---|
34 |
|
---|
35 | @Override
|
---|
36 | public boolean equals(Object o) {
|
---|
37 | if (o == null || o.getClass() != Overlay.class)
|
---|
38 | return false;
|
---|
39 |
|
---|
40 | return ((Overlay) o).Frame == Frame;
|
---|
41 | }
|
---|
42 |
|
---|
43 | @Override
|
---|
44 | public int hashCode() {
|
---|
45 | return 0;
|
---|
46 | }
|
---|
47 |
|
---|
48 | public static Overlay getOverlay(Collection<Overlay>overlays, Frame frame){
|
---|
49 | // Check the frame is in the list of overlays
|
---|
50 | for (Overlay o : overlays) {
|
---|
51 | if (o.Frame.equals(frame)) {
|
---|
52 | return o;
|
---|
53 | }
|
---|
54 | }
|
---|
55 | return null;
|
---|
56 | }
|
---|
57 | }
|
---|