diff options
| author | 2018-05-19 17:06:26 +0200 | |
|---|---|---|
| committer | 2018-05-19 17:06:26 +0200 | |
| commit | 406b9a89318473571d27de60b8aa1b51f84af245 (patch) | |
| tree | 4be0066dfe09eb98cd337779d8f759334276a18c /src/main/java/cuchaz/enigma/mapping/MethodEntry.java | |
| parent | Initial port to ASM (diff) | |
| download | enigma-fork-406b9a89318473571d27de60b8aa1b51f84af245.tar.gz enigma-fork-406b9a89318473571d27de60b8aa1b51f84af245.tar.xz enigma-fork-406b9a89318473571d27de60b8aa1b51f84af245.zip | |
Package updates
Diffstat (limited to 'src/main/java/cuchaz/enigma/mapping/MethodEntry.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/mapping/MethodEntry.java | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/src/main/java/cuchaz/enigma/mapping/MethodEntry.java b/src/main/java/cuchaz/enigma/mapping/MethodEntry.java deleted file mode 100644 index f8a5ff1..0000000 --- a/src/main/java/cuchaz/enigma/mapping/MethodEntry.java +++ /dev/null | |||
| @@ -1,79 +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.mapping; | ||
| 13 | |||
| 14 | import com.google.common.base.Preconditions; | ||
| 15 | import cuchaz.enigma.utils.Utils; | ||
| 16 | |||
| 17 | public class MethodEntry implements Entry { | ||
| 18 | |||
| 19 | protected final ClassEntry classEntry; | ||
| 20 | protected final String name; | ||
| 21 | protected final MethodDescriptor descriptor; | ||
| 22 | |||
| 23 | public MethodEntry(ClassEntry classEntry, String name, MethodDescriptor descriptor) { | ||
| 24 | Preconditions.checkNotNull(classEntry, "Class cannot be null"); | ||
| 25 | Preconditions.checkNotNull(name, "Method name cannot be null"); | ||
| 26 | Preconditions.checkNotNull(descriptor, "Method descriptor cannot be null"); | ||
| 27 | |||
| 28 | this.classEntry = classEntry; | ||
| 29 | this.name = name; | ||
| 30 | this.descriptor = descriptor; | ||
| 31 | } | ||
| 32 | |||
| 33 | @Override | ||
| 34 | public ClassEntry getOwnerClassEntry() { | ||
| 35 | return this.classEntry; | ||
| 36 | } | ||
| 37 | |||
| 38 | @Override | ||
| 39 | public String getName() { | ||
| 40 | return this.name; | ||
| 41 | } | ||
| 42 | |||
| 43 | public MethodDescriptor getDesc() { | ||
| 44 | return this.descriptor; | ||
| 45 | } | ||
| 46 | |||
| 47 | public boolean isConstructor() { | ||
| 48 | return name.equals("<init>") || name.equals("<clinit>"); | ||
| 49 | } | ||
| 50 | |||
| 51 | @Override | ||
| 52 | public String getClassName() { | ||
| 53 | return this.classEntry.getName(); | ||
| 54 | } | ||
| 55 | |||
| 56 | @Override | ||
| 57 | public MethodEntry updateOwnership(ClassEntry classEntry) { | ||
| 58 | return new MethodEntry(new ClassEntry(classEntry.getName()), name, descriptor); | ||
| 59 | } | ||
| 60 | |||
| 61 | @Override | ||
| 62 | public int hashCode() { | ||
| 63 | return Utils.combineHashesOrdered(this.classEntry, this.name, this.descriptor); | ||
| 64 | } | ||
| 65 | |||
| 66 | @Override | ||
| 67 | public boolean equals(Object other) { | ||
| 68 | return other instanceof MethodEntry && equals((MethodEntry) other); | ||
| 69 | } | ||
| 70 | |||
| 71 | public boolean equals(MethodEntry other) { | ||
| 72 | return this.classEntry.equals(other.getOwnerClassEntry()) && this.name.equals(other.getName()) && this.descriptor.equals(other.getDesc()); | ||
| 73 | } | ||
| 74 | |||
| 75 | @Override | ||
| 76 | public String toString() { | ||
| 77 | return this.classEntry.getName() + "." + this.name + this.descriptor; | ||
| 78 | } | ||
| 79 | } | ||