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 Mozilla Public License Version 2.0.
7 // See license.mkd for licensing and copyright information.
8 // ---------------------------------------------------------------------------
10 package cc
.squirreljme
.jvm
.suite
;
12 import cc
.squirreljme
.runtime
.cldc
.debug
.Debugging
;
13 import cc
.squirreljme
.runtime
.cldc
.util
.StringUtils
;
16 * This represents the name of a midlet suite.
20 public final class SuiteName
21 implements Comparable
<SuiteName
>
24 protected final String string
;
27 * Initializes the suite name.
29 * @param __v The value to parse.
30 * @throws InvalidSuiteException If the input is not valid.
31 * @throws NullPointerException On null arguments.
34 public SuiteName(String __v
)
35 throws InvalidSuiteException
, NullPointerException
39 throw new NullPointerException("NARG");
41 // Colon (':') is technically invalid, but so many JARs use it...
42 if (StringUtils
.firstIndex(":", __v
) >= 0)
43 Debugging
.debugNote("Suite name has a colon: %s", __v
);
45 /* {@squirreljme.error DG0e An illegal character was
46 specified in the midlet suite name. (The midlet suite
48 if (StringUtils
.firstIndex("\0\r\n;", __v
) >= 0)
49 throw new InvalidSuiteException(String
.format("AR0e %s", __v
));
59 public int compareTo(SuiteName __o
)
63 return this.string
.compareTo(__o
.string
);
71 public boolean equals(Object __o
)
77 if (!(__o
instanceof SuiteName
))
80 return this.string
.equals(((SuiteName
)__o
).string
);
90 return this.string
.hashCode();
98 public String
toString()