Remove Twitter links.
[SquirrelJME.git] / buildSrc / src / main / java / cc / squirreljme / plugin / swm / SuiteName.java
blobb909cd0380f8a57c01ab39487e8151a9962f8b83
1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // 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.plugin.swm;
12 import cc.squirreljme.plugin.util.StringUtils;
14 /**
15 * This represents the name of a midlet suite.
17 * @since 2016/10/12
19 public final class SuiteName
20 implements Comparable<SuiteName>
22 /** String value. */
23 protected final String string;
25 /**
26 * Initializes the suite name.
28 * @param __v The value to parse.
29 * @throws InvalidSuiteException If the input is not valid.
30 * @throws NullPointerException On null arguments.
31 * @since 2016/10/12
33 public SuiteName(String __v)
34 throws InvalidSuiteException, NullPointerException
36 // Check
37 if (__v == null)
38 throw new NullPointerException("NARG");
40 /* {@squirreljme.error DG0e An illegal character was
41 specified in the midlet suite name. (The midlet suite
42 name)} */
43 if (StringUtils.firstIndex("\0\r\n:;", __v) >= 0)
44 throw new InvalidSuiteException(String.format("AR0e %s", __v));
46 this.string = __v;
49 /**
50 * {@inheritDoc}
51 * @since 2016/10/12
53 @Override
54 public int compareTo(SuiteName __o)
56 if (this == __o)
57 return 0;
58 return this.string.compareTo(__o.string);
61 /**
62 * {@inheritDoc}
63 * @since 2016/10/12
65 @Override
66 public boolean equals(Object __o)
68 if (this == __o)
69 return true;
71 // Check
72 if (!(__o instanceof SuiteName))
73 return false;
75 return this.string.equals(((SuiteName)__o).string);
78 /**
79 * {@inheritDoc}
80 * @since 2016/10/12
82 @Override
83 public int hashCode()
85 return this.string.hashCode();
88 /**
89 * {@inheritDoc}
90 * @since 2016/10/12
92 @Override
93 public String toString()
95 return this.string;