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 cc
.squirreljme
.jvm
.suite
;
12 import cc
.squirreljme
.runtime
.cldc
.annotation
.Exported
;
13 import cc
.squirreljme
.runtime
.cldc
.debug
.Debugging
;
14 import cc
.squirreljme
.runtime
.cldc
.util
.StringUtils
;
17 * This represents the name of a midlet suite.
22 public final class SuiteName
23 implements Comparable
<SuiteName
>
26 protected final String string
;
29 * Initializes the suite name.
31 * @param __v The value to parse.
32 * @throws InvalidSuiteException If the input is not valid.
33 * @throws NullPointerException On null arguments.
37 public SuiteName(String __v
)
38 throws InvalidSuiteException
, NullPointerException
42 throw new NullPointerException("NARG");
44 // Colon (':') is technically invalid, but so many JARs use it...
45 if (StringUtils
.firstIndex(":", __v
) >= 0)
46 Debugging
.debugNote("Suite name has a colon: %s", __v
);
48 // {@squirreljme.error DG0e An illegal character was
49 // specified in the midlet suite name. (The midlet suite
51 if (StringUtils
.firstIndex("\0\r\n;", __v
) >= 0)
52 throw new InvalidSuiteException(String
.format("AR0e %s", __v
));
62 public int compareTo(SuiteName __o
)
66 return this.string
.compareTo(__o
.string
);
74 public boolean equals(Object __o
)
80 if (!(__o
instanceof SuiteName
))
83 return this.string
.equals(((SuiteName
)__o
).string
);
93 return this.string
.hashCode();
101 public String
toString()