Base initial handle of remote instructions.
[SquirrelJME.git] / tools / squirreljme-debugger / src / main / java / cc / squirreljme / debugger / StoredInfoManager.java
blob5d4d9a3b6e7f05b09dea0beb131b77be58bf5bd1
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;
12 /**
13 * Managers for each specific storage type.
15 * @since 2024/01/20
17 public class StoredInfoManager
19 /** Stored info storage for each type. */
20 private final StoredInfo[] _infos;
22 /**
23 * Initializes the storage information manager.
25 * @since 2024/01/20
27 public StoredInfoManager()
29 InfoKind[] types = InfoKind.values();
30 int numTypes = types.length;
32 // Setup storage
33 StoredInfo[] infos = new StoredInfo[numTypes];
34 for (int i = 0; i < numTypes; i++)
35 infos[i] = new StoredInfo(types[i]);
36 this._infos = infos;
39 /**
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.
47 * @since 2024/01/20
49 @SuppressWarnings("unchecked")
50 public final <I extends Info> StoredInfo<I> get(Class<I> __class,
51 InfoKind __type)
52 throws NullPointerException
54 if (__class == null || __type == null)
55 throw new NullPointerException("NARG");
57 return (StoredInfo<I>)this._infos[__type.ordinal()];
60 /**
61 * Returns the class storage manager.
63 * @return The class storage.
64 * @since 2024/01/22
66 public StoredInfo<InfoByteCode> getByteCodes()
68 return this.<InfoByteCode>get(InfoByteCode.class, InfoKind.BYTE_CODE);
71 /**
72 * Returns the class storage manager.
74 * @return The class storage.
75 * @since 2024/01/22
77 public StoredInfo<InfoClass> getClasses()
79 return this.<InfoClass>get(InfoClass.class, InfoKind.CLASS);
82 /**
83 * Returns the method storage.
85 * @return The method storage.
86 * @since 2024/01/23
88 public final StoredInfo<InfoMethod> getMethods()
90 return this.<InfoMethod>get(InfoMethod.class, InfoKind.METHOD);
93 /**
94 * Returns the thread storage.
96 * @return The thread storage.
97 * @since 2024/01/20
99 public final StoredInfo<InfoThread> getThread()
101 return this.<InfoThread>get(InfoThread.class, InfoKind.THREAD);