1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the GNU General Public License v3+, or later.
7 // See license.mkd for licensing and copyright information.
8 // ---------------------------------------------------------------------------
10 package net
.multiphasicapps
.classfile
;
13 * This represents an identifier which acts as a name of a fragment of a class
14 * or a member of a class.
18 public abstract class Identifier
20 /** The string which makes up the identifier. */
21 protected final String string
;
24 * Initializes the identifier.
26 * @param __n The input identifier to decode.
27 * @throws InvalidClassFormatException If it is not a valid identifier.
28 * @throws NullPointerException On null arguments.
31 Identifier(String __n
)
32 throws InvalidClassFormatException
, NullPointerException
36 throw new NullPointerException("NARG");
42 for (int i
= 0, n
= __n
.length(); i
< n
; i
++)
44 char c
= __n
.charAt(i
);
46 // {@squirreljme.error JC2x The specified identifier contains an
47 // invalid character. (The identifier)}
48 if (c
== '.' || c
== ';' || c
== '[' || c
== '/')
49 throw new InvalidClassFormatException(
50 String
.format("JC2x %s", __n
));
59 public boolean equals(Object __o
)
65 if (!(__o
instanceof Identifier
))
68 return this.string
.equals(((Identifier
)__o
).string
);
78 return this.string
.hashCode();
82 * Returns the identifier.
84 * @return The identifier.
87 public final String
identifier()
97 public String
toString()