summaryrefslogtreecommitdiff
path: root/test/cuchaz/enigma/TestEntryFactory.java
diff options
context:
space:
mode:
authorGravatar jeff2015-02-09 22:23:45 -0500
committerGravatar jeff2015-02-09 22:23:45 -0500
commitaf1041731c8c0ce1846ff7e7b6052ed7327a5dbc (patch)
treee781b93f526a6c1ba7b6f5e14c319450199aa1df /test/cuchaz/enigma/TestEntryFactory.java
parentDon't automatically move mappings around. We're more interested in stability ... (diff)
downloadenigma-fork-af1041731c8c0ce1846ff7e7b6052ed7327a5dbc.tar.gz
enigma-fork-af1041731c8c0ce1846ff7e7b6052ed7327a5dbc.tar.xz
enigma-fork-af1041731c8c0ce1846ff7e7b6052ed7327a5dbc.zip
fix translation issues, particularly with fields
Diffstat (limited to 'test/cuchaz/enigma/TestEntryFactory.java')
-rw-r--r--test/cuchaz/enigma/TestEntryFactory.java68
1 files changed, 68 insertions, 0 deletions
diff --git a/test/cuchaz/enigma/TestEntryFactory.java b/test/cuchaz/enigma/TestEntryFactory.java
new file mode 100644
index 0000000..754f308
--- /dev/null
+++ b/test/cuchaz/enigma/TestEntryFactory.java
@@ -0,0 +1,68 @@
1/*******************************************************************************
2 * Copyright (c) 2014 Jeff Martin.\
3 *
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the GNU Public License v3.0
6 * which accompanies this distribution, and is available at
7 * http://www.gnu.org/licenses/gpl.html
8 *
9 * Contributors:
10 * Jeff Martin - initial API and implementation
11 ******************************************************************************/
12package cuchaz.enigma;
13
14import cuchaz.enigma.analysis.EntryReference;
15import cuchaz.enigma.mapping.BehaviorEntry;
16import cuchaz.enigma.mapping.ClassEntry;
17import cuchaz.enigma.mapping.ConstructorEntry;
18import cuchaz.enigma.mapping.FieldEntry;
19import cuchaz.enigma.mapping.MethodEntry;
20import cuchaz.enigma.mapping.Signature;
21import cuchaz.enigma.mapping.Type;
22
23public class TestEntryFactory {
24
25 public static ClassEntry newClass(String name) {
26 return new ClassEntry(name);
27 }
28
29 public static FieldEntry newField(String className, String fieldName, String fieldType) {
30 return newField(newClass(className), fieldName, fieldType);
31 }
32
33 public static FieldEntry newField(ClassEntry classEntry, String fieldName, String fieldType) {
34 return new FieldEntry(classEntry, fieldName, new Type(fieldType));
35 }
36
37 public static MethodEntry newMethod(String className, String methodName, String methodSignature) {
38 return newMethod(newClass(className), methodName, methodSignature);
39 }
40
41 public static MethodEntry newMethod(ClassEntry classEntry, String methodName, String methodSignature) {
42 return new MethodEntry(classEntry, methodName, new Signature(methodSignature));
43 }
44
45 public static ConstructorEntry newConstructor(String className, String signature) {
46 return newConstructor(newClass(className), signature);
47 }
48
49 public static ConstructorEntry newConstructor(ClassEntry classEntry, String signature) {
50 return new ConstructorEntry(classEntry, new Signature(signature));
51 }
52
53 public static EntryReference<FieldEntry,BehaviorEntry> newFieldReferenceByMethod(FieldEntry fieldEntry, String callerClassName, String callerName, String callerSignature) {
54 return new EntryReference<FieldEntry,BehaviorEntry>(fieldEntry, "", newMethod(callerClassName, callerName, callerSignature));
55 }
56
57 public static EntryReference<FieldEntry,BehaviorEntry> newFieldReferenceByConstructor(FieldEntry fieldEntry, String callerClassName, String callerSignature) {
58 return new EntryReference<FieldEntry,BehaviorEntry>(fieldEntry, "", newConstructor(callerClassName, callerSignature));
59 }
60
61 public static EntryReference<BehaviorEntry,BehaviorEntry> newBehaviorReferenceByMethod(BehaviorEntry behaviorEntry, String callerClassName, String callerName, String callerSignature) {
62 return new EntryReference<BehaviorEntry,BehaviorEntry>(behaviorEntry, "", newMethod(callerClassName, callerName, callerSignature));
63 }
64
65 public static EntryReference<BehaviorEntry,BehaviorEntry> newBehaviorReferenceByConstructor(BehaviorEntry behaviorEntry, String callerClassName, String callerSignature) {
66 return new EntryReference<BehaviorEntry,BehaviorEntry>(behaviorEntry, "", newConstructor(callerClassName, callerSignature));
67 }
68}