diff options
Diffstat (limited to 'src/main/java/cuchaz/enigma/analysis/Access.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/analysis/Access.java | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/src/main/java/cuchaz/enigma/analysis/Access.java b/src/main/java/cuchaz/enigma/analysis/Access.java deleted file mode 100644 index 82ca669..0000000 --- a/src/main/java/cuchaz/enigma/analysis/Access.java +++ /dev/null | |||
| @@ -1,43 +0,0 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2015 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Lesser General Public | ||
| 5 | * License v3.0 which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/lgpl.html | ||
| 7 | * <p> | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | |||
| 12 | package cuchaz.enigma.analysis; | ||
| 13 | |||
| 14 | import cuchaz.enigma.translation.representation.AccessFlags; | ||
| 15 | |||
| 16 | import java.lang.reflect.Modifier; | ||
| 17 | |||
| 18 | public enum Access { | ||
| 19 | |||
| 20 | PUBLIC, PROTECTED, PACKAGE, PRIVATE; | ||
| 21 | |||
| 22 | public static Access get(AccessFlags flags) { | ||
| 23 | return get(flags.getFlags()); | ||
| 24 | } | ||
| 25 | |||
| 26 | public static Access get(int modifiers) { | ||
| 27 | boolean isPublic = Modifier.isPublic(modifiers); | ||
| 28 | boolean isProtected = Modifier.isProtected(modifiers); | ||
| 29 | boolean isPrivate = Modifier.isPrivate(modifiers); | ||
| 30 | |||
| 31 | if (isPublic && !isProtected && !isPrivate) { | ||
| 32 | return PUBLIC; | ||
| 33 | } else if (!isPublic && isProtected && !isPrivate) { | ||
| 34 | return PROTECTED; | ||
| 35 | } else if (!isPublic && !isProtected && isPrivate) { | ||
| 36 | return PRIVATE; | ||
| 37 | } else if (!isPublic && !isProtected && !isPrivate) { | ||
| 38 | return PACKAGE; | ||
| 39 | } | ||
| 40 | // assume public by default | ||
| 41 | return PUBLIC; | ||
| 42 | } | ||
| 43 | } | ||