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
;
12 import cc
.squirreljme
.runtime
.cldc
.debug
.Debugging
;
15 * This represents an inner class that is contained within an outer class, it
16 * is used by the compiler to determine how classes are contained within each
21 public final class InnerClass
23 /** The name of the inner class. */
24 protected final ClassName name
;
26 /** The outer class this is contained within. */
27 protected final ClassName outerclass
;
29 /** The simple name of the class as defined in the class. */
30 protected final ClassIdentifier simplename
;
32 /** The flags for the inner class. */
33 protected final InnerClassFlags flags
;
36 * Initializes an anonymous inner class.
38 * @param __n The name of the class.
39 * @param __f The class flags.
40 * @throws NullPointerException On null arguments.
43 public InnerClass(ClassName __n
, InnerClassFlags __f
)
44 throws NullPointerException
46 if (__n
== null || __f
== null)
47 throw new NullPointerException("NARG");
50 this.outerclass
= null;
51 this.simplename
= null;
56 * Initializes a standard inner class.
58 * @param __n The name of the class.
59 * @param __o The class this is a member of. If this is {@code null} then
60 * the class is either: a top-level class/interface, a local class (one
61 * that exists only in a method), or is a member of an anonymous class.
62 * @param __i The identifier used to name the class.
63 * @param __f The class flags.
66 public InnerClass(ClassName __n
, ClassName __o
, ClassIdentifier __i
,
70 this.outerclass
= __o
;
71 this.simplename
= __i
;
80 public final boolean equals(Object __o
)
82 throw Debugging
.todo();
86 * Returns the flags for the inner class.
88 * @return The inner class flags.
91 public final InnerClassFlags
flags()
101 public final int hashCode()
103 throw Debugging
.todo();
107 * Is this an anonymous class?
109 * @return Is this an anonymous class?
112 public final boolean isAnonymous()
114 return this.name
!= null &&
115 this.outerclass
== null &&
116 this.simplename
== null;
120 * Returns the name of this class.
122 * @return The class name.
125 public final ClassName
name()
131 * Returns the name of the outer class or {@code null} if it is anonymous.
133 * @return The name of the outer class or {@code null} if anonymous.
136 public final ClassName
outerClass()
138 return this.outerclass
;
142 * Returns the simple name of the class.
144 * @return The simple name of the class.
147 public final ClassIdentifier
simpleName()
149 return this.simplename
;
157 public final String
toString()
159 throw Debugging
.todo();