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
;
16 * This class contains the results of a dependency match.
21 public final class MatchResult
23 /** The matched results. */
24 protected final DependencyInfo matched
;
26 /** The unmatched results. */
27 protected final DependencyInfo unmatched
;
30 * Initializes the match result.
32 * @param __matched The matched dependencies.
33 * @param __unmatched The unmatched dependencies.
34 * @throws NullPointerException On null arguments.
38 public MatchResult(DependencyInfo __matched
, DependencyInfo __unmatched
)
39 throws NullPointerException
41 if (__matched
== null || __unmatched
== null)
42 throw new NullPointerException("NARG");
44 this.matched
= __matched
;
45 this.unmatched
= __unmatched
;
53 public boolean equals(Object __o
)
58 if (!(__o
instanceof MatchResult
))
61 MatchResult o
= (MatchResult
)__o
;
62 return this.matched
.equals(o
.matched
) &&
63 this.unmatched
.equals(o
.unmatched
);
67 * Returns {@code true} if there have been matches in the result.
69 * @return Has there been any matches?
73 public final boolean hasMatches()
75 return !this.matched
.isEmpty();
83 public final int hashCode()
85 return this.matched
.hashCode() ^
86 this.unmatched
.hashCode();
90 * Returns the dependency information which contains every dependency
91 * which has been matched.
93 * @return The dependency information containing only matched items.
97 public final DependencyInfo
matched()
103 * Returns the dependency information which contains every dependency
104 * which has yet to be matched.
106 * @return The dependency information containing only unmatched items.
110 public final DependencyInfo
unmatched()
112 return this.unmatched
;
120 public final String
toString()
122 throw Debugging
.todo();