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
.debug
.Debugging
;
15 * This class contains the results of a dependency match.
19 public final class MatchResult
21 /** The matched results. */
22 protected final DependencyInfo matched
;
24 /** The unmatched results. */
25 protected final DependencyInfo unmatched
;
28 * Initializes the match result.
30 * @param __matched The matched dependencies.
31 * @param __unmatched The unmatched dependencies.
32 * @throws NullPointerException On null arguments.
35 public MatchResult(DependencyInfo __matched
, DependencyInfo __unmatched
)
36 throws NullPointerException
38 if (__matched
== null || __unmatched
== null)
39 throw new NullPointerException("NARG");
41 this.matched
= __matched
;
42 this.unmatched
= __unmatched
;
50 public boolean equals(Object __o
)
55 if (!(__o
instanceof MatchResult
))
58 MatchResult o
= (MatchResult
)__o
;
59 return this.matched
.equals(o
.matched
) &&
60 this.unmatched
.equals(o
.unmatched
);
64 * Returns {@code true} if there have been matches in the result.
66 * @return Has there been any matches?
69 public final boolean hasMatches()
71 return !this.matched
.isEmpty();
79 public final int hashCode()
81 return this.matched
.hashCode() ^
82 this.unmatched
.hashCode();
86 * Returns the dependency information which contains every dependency
87 * which has been matched.
89 * @return The dependency information containing only matched items.
92 public final DependencyInfo
matched()
98 * Returns the dependency information which contains every dependency
99 * which has yet to be matched.
101 * @return The dependency information containing only unmatched items.
104 public final DependencyInfo
unmatched()
106 return this.unmatched
;
114 public final String
toString()
116 throw Debugging
.todo();