diff options
| author | 2016-06-30 00:49:21 +1000 | |
|---|---|---|
| committer | 2016-06-30 00:49:21 +1000 | |
| commit | 4be005617b3b8c3578cca07c5d085d12916f0d1d (patch) | |
| tree | db163431f38703e26da417ef05eaea2b27a498b9 /src/cuchaz/enigma/convert/ClassForest.java | |
| parent | Some small changes to fix idea importing (diff) | |
| download | enigma-fork-4be005617b3b8c3578cca07c5d085d12916f0d1d.tar.gz enigma-fork-4be005617b3b8c3578cca07c5d085d12916f0d1d.tar.xz enigma-fork-4be005617b3b8c3578cca07c5d085d12916f0d1d.zip | |
Json format (#2)
* Added new format
* Fixed bug
* Updated Version
Diffstat (limited to 'src/cuchaz/enigma/convert/ClassForest.java')
| -rw-r--r-- | src/cuchaz/enigma/convert/ClassForest.java | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/src/cuchaz/enigma/convert/ClassForest.java b/src/cuchaz/enigma/convert/ClassForest.java deleted file mode 100644 index 0407730..0000000 --- a/src/cuchaz/enigma/convert/ClassForest.java +++ /dev/null | |||
| @@ -1,60 +0,0 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2015 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Lesser General Public | ||
| 5 | * License v3.0 which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/lgpl.html | ||
| 7 | * | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | package cuchaz.enigma.convert; | ||
| 12 | |||
| 13 | import java.util.Collection; | ||
| 14 | |||
| 15 | import com.google.common.collect.HashMultimap; | ||
| 16 | import com.google.common.collect.Multimap; | ||
| 17 | |||
| 18 | import cuchaz.enigma.mapping.ClassEntry; | ||
| 19 | |||
| 20 | |||
| 21 | public class ClassForest { | ||
| 22 | |||
| 23 | private ClassIdentifier m_identifier; | ||
| 24 | private Multimap<ClassIdentity,ClassEntry> m_forest; | ||
| 25 | |||
| 26 | public ClassForest(ClassIdentifier identifier) { | ||
| 27 | m_identifier = identifier; | ||
| 28 | m_forest = HashMultimap.create(); | ||
| 29 | } | ||
| 30 | |||
| 31 | public void addAll(Iterable<ClassEntry> entries) { | ||
| 32 | for (ClassEntry entry : entries) { | ||
| 33 | add(entry); | ||
| 34 | } | ||
| 35 | } | ||
| 36 | |||
| 37 | public void add(ClassEntry entry) { | ||
| 38 | try { | ||
| 39 | m_forest.put(m_identifier.identify(entry), entry); | ||
| 40 | } catch (ClassNotFoundException ex) { | ||
| 41 | throw new Error("Unable to find class " + entry.getName()); | ||
| 42 | } | ||
| 43 | } | ||
| 44 | |||
| 45 | public Collection<ClassIdentity> identities() { | ||
| 46 | return m_forest.keySet(); | ||
| 47 | } | ||
| 48 | |||
| 49 | public Collection<ClassEntry> classes() { | ||
| 50 | return m_forest.values(); | ||
| 51 | } | ||
| 52 | |||
| 53 | public Collection<ClassEntry> getClasses(ClassIdentity identity) { | ||
| 54 | return m_forest.get(identity); | ||
| 55 | } | ||
| 56 | |||
| 57 | public boolean containsIdentity(ClassIdentity identity) { | ||
| 58 | return m_forest.containsKey(identity); | ||
| 59 | } | ||
| 60 | } | ||