Commit 5963046f authored by Stephanie Gawroriski's avatar Stephanie Gawroriski
Browse files

Move over manifest.

parent 11a7b90e
......@@ -76,6 +76,8 @@
<module name="squirreljme.modules.tool-jdwp.main" target="1.7" />
<module name="squirreljme.modules.tool-jdwp.test" target="1.7" />
<module name="squirreljme.modules.tool-jdwp.testFixtures" target="1.7" />
<module name="squirreljme.modules.tool-manifest-reader.main" target="1.7" />
<module name="squirreljme.modules.tool-manifest-reader.test" target="1.7" />
<module name="squirreljme.modules.tool-manifest-reader.testFixtures" target="1.7" />
<module name="squirreljme.modules.tool-manifest-writer.testFixtures" target="1.7" />
<module name="squirreljme.modules.tool-packfile.testFixtures" target="1.7" />
......
......@@ -68,7 +68,6 @@
<option value="$PROJECT_DIR$/modules/tac" />
<option value="$PROJECT_DIR$/modules/tool-classfile" />
<option value="$PROJECT_DIR$/modules/tool-jarfile" />
<option value="$PROJECT_DIR$/modules/tool-manifest-reader" />
<option value="$PROJECT_DIR$/modules/tool-manifest-writer" />
<option value="$PROJECT_DIR$/modules/tool-packfile" />
<option value="$PROJECT_DIR$/modules/vodafone-api" />
......
......@@ -15,7 +15,6 @@ dependencies
api project(":modules:common-vm")
api project(":modules:meep-swm")
api project(":modules:tool-classfile")
api project(":modules:tool-manifest-reader")
api project(":modules:debug-jdwp")
}
......
......@@ -8,7 +8,7 @@
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package net.multiphasicapps.tool.manifest;
package cc.squirreljme.jvm.manifest;
import java.io.BufferedReader;
import java.io.IOException;
......@@ -17,9 +17,9 @@ import java.io.InputStreamReader;
import java.io.Reader;
import java.util.AbstractMap;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import net.multiphasicapps.collections.UnmodifiableMap;
/**
* This contains decoders for the standard Java manifest format.
......@@ -31,28 +31,8 @@ import net.multiphasicapps.collections.UnmodifiableMap;
public final class JavaManifest
extends AbstractMap<String, JavaManifestAttributes>
{
/** Read a key. */
private static final int _STAGE_KEY =
0;
/** Read a value (start). */
private static final int _STAGE_VALUE_START =
1;
/** Read a value (padding). */
private static final int _STAGE_VALUE_PADDING =
2;
/** Read a value (length). */
private static final int _STAGE_VALUE_LINE =
3;
/** Potentially may be a continuation of a line. */
private static final int _STAGE_VALUE_MIGHT_CONTINUE =
4;
/** The attributes defined in this manifest file. */
protected final Map<String, JavaManifestAttributes> attributes;
private final Map<String, JavaManifestAttributes> _attributes;
/**
* Initializes a blank manifest.
......@@ -62,13 +42,11 @@ public final class JavaManifest
public JavaManifest()
{
// Initialize a blank set of main attributes
Map<String, JavaManifestAttributes> backing =
new HashMap<>();
Map<String, JavaManifestAttributes> backing = new HashMap<>();
backing.put("", new JavaManifestAttributes());
// Lock in the backing map
this.attributes = UnmodifiableMap.<String, JavaManifestAttributes>
of(backing);
this._attributes = backing;
}
/**
......@@ -84,7 +62,8 @@ public final class JavaManifest
public JavaManifest(InputStream __is)
throws IOException, JavaManifestException, NullPointerException
{
this(new BufferedReader(new InputStreamReader(__is, "utf-8")));
this(new BufferedReader(
new InputStreamReader(__is, "utf-8")));
}
/**
......@@ -104,10 +83,10 @@ public final class JavaManifest
throw new NullPointerException("NARG");
// The backing map and temporary key/value pairs for each
// attiribute set
// attribute set
String curname = "";
Map<String, JavaManifestAttributes> backing = new HashMap<>();
Map<JavaManifestKey, String> working = new HashMap<>();
Map<String, JavaManifestAttributes> backing = new LinkedHashMap<>();
Map<JavaManifestKey, String> working = new LinkedHashMap<>();
// Read input file line by line, since it is more efficient than
// character by character
......@@ -224,8 +203,7 @@ public final class JavaManifest
backing.put(curname, new JavaManifestAttributes(working));
// Lock in the backing map
this.attributes = UnmodifiableMap.<String, JavaManifestAttributes>
of(backing);
this._attributes = backing;
}
/**
......@@ -235,7 +213,7 @@ public final class JavaManifest
@Override
public boolean containsKey(Object __k)
{
return this.attributes.containsKey(__k);
return this._attributes.containsKey(__k);
}
/**
......@@ -245,7 +223,7 @@ public final class JavaManifest
@Override
public Set<Map.Entry<String, JavaManifestAttributes>> entrySet()
{
return this.attributes.entrySet();
return this._attributes.entrySet();
}
/**
......@@ -255,7 +233,7 @@ public final class JavaManifest
@Override
public JavaManifestAttributes get(Object __k)
{
return this.attributes.get(__k);
return this._attributes.get(__k);
}
/**
......@@ -266,7 +244,7 @@ public final class JavaManifest
*/
public JavaManifestAttributes getMainAttributes()
{
return this.attributes.get("");
return this._attributes.get("");
}
/**
......@@ -276,7 +254,7 @@ public final class JavaManifest
@Override
public int size()
{
return this.attributes.size();
return this._attributes.size();
}
/**
......@@ -306,18 +284,5 @@ public final class JavaManifest
{
return JavaManifest.__isAlphaNum(__c) || __c == '_' || __c == '-';
}
/**
* Returns {@code true} if the character is specified to be a newline
* character.
*
* @param __c The character to check.
* @return {@code true} if the character specifies the next line.
* @since 2016/05/29
*/
private static boolean __isNewline(char __c)
{
return __c == '\r' || __c == '\n';
}
}
......@@ -8,14 +8,13 @@
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package net.multiphasicapps.tool.manifest;
package cc.squirreljme.jvm.manifest;
import java.util.AbstractMap;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import net.multiphasicapps.collections.EmptyMap;
import net.multiphasicapps.collections.UnmodifiableMap;
/**
* This contains the attributes for a single section within the manifest file.
......@@ -28,7 +27,7 @@ public final class JavaManifestAttributes
extends AbstractMap<JavaManifestKey, String>
{
/** The key value pairs. */
protected final Map<JavaManifestKey, String> pairs;
private final Map<JavaManifestKey, String> _pairs;
/**
* Initializes empty manifest attributes.
......@@ -37,7 +36,7 @@ public final class JavaManifestAttributes
*/
JavaManifestAttributes()
{
this.pairs = EmptyMap.<JavaManifestKey, String>empty();
this._pairs = new HashMap<>();
}
/**
......@@ -55,8 +54,7 @@ public final class JavaManifestAttributes
throw new NullPointerException("NARG");
// Copy
this.pairs = UnmodifiableMap.<JavaManifestKey, String>of(
new HashMap<>(__from));
this._pairs = new LinkedHashMap<>(__from);
}
/**
......@@ -66,7 +64,7 @@ public final class JavaManifestAttributes
@Override
public boolean containsKey(Object __o)
{
return this.pairs.containsKey(__o);
return this._pairs.containsKey(__o);
}
/**
......@@ -100,7 +98,7 @@ public final class JavaManifestAttributes
@Override
public Set<Map.Entry<JavaManifestKey, String>> entrySet()
{
return this.pairs.entrySet();
return this._pairs.entrySet();
}
/**
......@@ -110,7 +108,7 @@ public final class JavaManifestAttributes
@Override
public String get(Object __o)
{
return this.pairs.get(__o);
return this._pairs.get(__o);
}
/**
......@@ -199,7 +197,7 @@ public final class JavaManifestAttributes
@Override
public int size()
{
return this.pairs.size();
return this._pairs.size();
}
}
......@@ -8,7 +8,7 @@
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package net.multiphasicapps.tool.manifest;
package cc.squirreljme.jvm.manifest;
/**
* This is thrown when the manifest is not valid.
......
......@@ -8,7 +8,7 @@
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package net.multiphasicapps.tool.manifest;
package cc.squirreljme.jvm.manifest;
/**
* This represents a key which is used in a manifest, it is case insensitive
......
......@@ -21,6 +21,5 @@ dependencies
api project(":modules:midp-lcdui")
api project(":modules:meep-swm")
api project(":modules:meep-midlet")
api project(":modules:tool-manifest-reader")
api project(":modules:zip")
}
......@@ -26,5 +26,4 @@ dependencies
api project(":modules:midp-lcdui")
api project(":modules:meep-midlet")
api project(":modules:meep-swm")
api project(":modules:tool-manifest-reader")
}
......@@ -17,7 +17,7 @@ import cc.squirreljme.runtime.swm.EntryPoint;
import java.io.IOException;
import java.io.InputStream;
import javax.microedition.lcdui.Image;
import net.multiphasicapps.tool.manifest.JavaManifest;
import cc.squirreljme.jvm.manifest.JavaManifest;
/**
* Stores the program information which is mapped to what is displayed.
......
......@@ -20,7 +20,6 @@ dependencies
{
api project(":modules:cldc-compact")
api project(":modules:tool-manifest-reader")
api project(":modules:strings")
api project(":modules:collections")
}
......@@ -18,8 +18,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestKey;
import cc.squirreljme.jvm.manifest.JavaManifest;
import cc.squirreljme.jvm.manifest.JavaManifestKey;
public abstract class MIDlet
{
......
......@@ -25,5 +25,4 @@ dependencies
api project(":modules:collections")
api project(":modules:meep-midlet")
api project(":modules:strings")
api project(":modules:tool-manifest-reader")
}
......@@ -20,7 +20,7 @@ import java.util.Set;
import net.multiphasicapps.collections.EmptySet;
import net.multiphasicapps.collections.UnmodifiableSet;
import net.multiphasicapps.strings.StringUtils;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;
import cc.squirreljme.jvm.manifest.JavaManifestAttributes;
/**
* This contains the information which specifies all of the dependencies which
......
......@@ -13,9 +13,9 @@ package cc.squirreljme.runtime.swm;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.List;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;
import net.multiphasicapps.tool.manifest.JavaManifestKey;
import cc.squirreljme.jvm.manifest.JavaManifest;
import cc.squirreljme.jvm.manifest.JavaManifestAttributes;
import cc.squirreljme.jvm.manifest.JavaManifestKey;
/**
* This parses the entry points which are available for usage.
......
......@@ -19,7 +19,7 @@ import java.util.Set;
import net.multiphasicapps.collections.EmptySet;
import net.multiphasicapps.collections.UnmodifiableSet;
import net.multiphasicapps.strings.StringUtils;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;
import cc.squirreljme.jvm.manifest.JavaManifestAttributes;
/**
* This contains all of the information for dependencies which are provided
......
......@@ -13,8 +13,8 @@ package cc.squirreljme.runtime.swm;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Objects;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;
import cc.squirreljme.jvm.manifest.JavaManifest;
import cc.squirreljme.jvm.manifest.JavaManifestAttributes;
/**
* This contains all of the information which is provided by a suite.
......
......@@ -12,9 +12,9 @@ package cc.squirreljme.runtime.swm;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import net.multiphasicapps.tool.manifest.JavaManifest;
import net.multiphasicapps.tool.manifest.JavaManifestAttributes;
import net.multiphasicapps.tool.manifest.JavaManifestKey;
import cc.squirreljme.jvm.manifest.JavaManifest;
import cc.squirreljme.jvm.manifest.JavaManifestAttributes;
import cc.squirreljme.jvm.manifest.JavaManifestKey;
/**
* This represents the type of suite that a suite may be.
......
......@@ -26,7 +26,7 @@ import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import net.multiphasicapps.tool.manifest.JavaManifest;
import cc.squirreljme.jvm.manifest.JavaManifest;
/**
* This is a scanner which can read all of the application groups that are
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment