summaryrefslogtreecommitdiff
path: root/src/cuchaz/enigma/mapping/MethodEntry.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/cuchaz/enigma/mapping/MethodEntry.java')
-rw-r--r--src/cuchaz/enigma/mapping/MethodEntry.java88
1 files changed, 88 insertions, 0 deletions
diff --git a/src/cuchaz/enigma/mapping/MethodEntry.java b/src/cuchaz/enigma/mapping/MethodEntry.java
new file mode 100644
index 0000000..e71a466
--- /dev/null
+++ b/src/cuchaz/enigma/mapping/MethodEntry.java
@@ -0,0 +1,88 @@
1/*******************************************************************************
2 * Copyright (c) 2014 Jeff Martin.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the GNU Public License v3.0
5 * which accompanies this distribution, and is available at
6 * http://www.gnu.org/licenses/gpl.html
7 *
8 * Contributors:
9 * Jeff Martin - initial API and implementation
10 ******************************************************************************/
11package cuchaz.enigma.mapping;
12
13import java.io.Serializable;
14
15import cuchaz.enigma.Util;
16
17public class MethodEntry implements Serializable
18{
19 private static final long serialVersionUID = 4770915224467247458L;
20
21 private ClassEntry m_classEntry;
22 private String m_name;
23 private String m_signature;
24
25 public MethodEntry( ClassEntry classEntry, String name, String signature )
26 {
27 if( classEntry == null )
28 {
29 throw new IllegalArgumentException( "Class cannot be null!" );
30 }
31 if( name == null )
32 {
33 throw new IllegalArgumentException( "Method name cannot be null!" );
34 }
35 if( signature == null )
36 {
37 throw new IllegalArgumentException( "Method signature cannot be null!" );
38 }
39
40 m_classEntry = classEntry;
41 m_name = name;
42 m_signature = signature;
43 }
44
45 public ClassEntry getClassEntry( )
46 {
47 return m_classEntry;
48 }
49
50 public String getName( )
51 {
52 return m_name;
53 }
54
55 public String getSignature( )
56 {
57 return m_signature;
58 }
59
60 @Override
61 public int hashCode( )
62 {
63 return Util.combineHashesOrdered( m_classEntry, m_name, m_signature );
64 }
65
66 @Override
67 public boolean equals( Object other )
68 {
69 if( other instanceof MethodEntry )
70 {
71 return equals( (MethodEntry)other );
72 }
73 return false;
74 }
75
76 public boolean equals( MethodEntry other )
77 {
78 return m_classEntry.equals( other.m_classEntry )
79 && m_name.equals( other.m_name )
80 && m_signature.equals( other.m_signature );
81 }
82
83 @Override
84 public String toString( )
85 {
86 return m_classEntry.getName() + "." + m_name + ":" + m_signature;
87 }
88}