1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // Multi-Phasic Applications: SquirrelJME
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the Mozilla Public License Version 2.0.
7 // See license.mkd for licensing and copyright information.
8 // ---------------------------------------------------------------------------
10 package cc
.squirreljme
.debugger
;
13 * Managers for each specific storage type.
17 public class StoredInfoManager
19 /** Stored info storage for each type. */
20 private final StoredInfo
[] _infos
;
23 * Initializes the storage information manager.
27 public StoredInfoManager()
29 InfoKind
[] types
= InfoKind
.values();
30 int numTypes
= types
.length
;
33 StoredInfo
[] infos
= new StoredInfo
[numTypes
];
34 for (int i
= 0; i
< numTypes
; i
++)
35 infos
[i
] = new StoredInfo(types
[i
]);
40 * Returns the stored information.
42 * @param <I> The information type.
43 * @param __class The class type used.
44 * @param __type The type to get.
45 * @return The information storage for the given type.
46 * @throws NullPointerException On null arguments.
49 @SuppressWarnings("unchecked")
50 public final <I
extends Info
> StoredInfo
<I
> get(Class
<I
> __class
,
52 throws NullPointerException
54 if (__class
== null || __type
== null)
55 throw new NullPointerException("NARG");
57 return (StoredInfo
<I
>)this._infos
[__type
.ordinal()];
61 * Returns the class storage manager.
63 * @return The class storage.
66 public StoredInfo
<InfoByteCode
> getByteCodes()
68 return this.<InfoByteCode
>get(InfoByteCode
.class, InfoKind
.BYTE_CODE
);
72 * Returns the class storage manager.
74 * @return The class storage.
77 public StoredInfo
<InfoClass
> getClasses()
79 return this.<InfoClass
>get(InfoClass
.class, InfoKind
.CLASS
);
83 * Returns the method storage.
85 * @return The method storage.
88 public final StoredInfo
<InfoMethod
> getMethods()
90 return this.<InfoMethod
>get(InfoMethod
.class, InfoKind
.METHOD
);
94 * Returns the thread storage.
96 * @return The thread storage.
99 public final StoredInfo
<InfoThread
> getThread()
101 return this.<InfoThread
>get(InfoThread
.class, InfoKind
.THREAD
);