Limit how often GC can be run.
[SquirrelJME.git] / buildSrc / src / main / java / cc / squirreljme / plugin / multivm / CandidateTestFiles.java
blobc7548f9a376e33a8cf1edfb5d97573c38a5b778d
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.multivm;
12 import cc.squirreljme.plugin.util.FileLocation;
13 import java.io.Serializable;
14 import java.util.Collections;
15 import java.util.LinkedHashMap;
16 import java.util.Map;
17 import java.util.Objects;
19 /**
20 * Represents a candidate test to run.
22 * This class is immutable.
24 * @since 2020/09/06
26 public final class CandidateTestFiles
27 implements Serializable
29 /** Source code for the test. */
30 public final FileLocation sourceCode;
32 /** The expected test results. */
33 public final FileLocation expectedResult;
35 /** Expected values. */
36 public final Map<String, String> expectedValues;
38 /** Is this a primary test source? */
39 public final boolean primary;
41 /**
42 * Initializes the test.
44 * @param __primary Is this a primary test source?
45 * @param __sourceCode The source code for the test.
46 * @param __expectedResult The expected result file.
47 * @throws NullPointerException If {@code __sourceCode} is null.
48 * @since 2020/09/06
50 public CandidateTestFiles(boolean __primary, FileLocation __sourceCode,
51 FileLocation __expectedResult)
52 throws NullPointerException
54 this(__primary, __sourceCode, __expectedResult, null);
57 /**
58 * Initializes the test.
60 * @param __primary Is this a primary test source?
61 * @param __sourceCode The source code for the test.
62 * @param __expectedResult The expected result file.
63 * @param __expectedValues The expected values.
64 * @throws NullPointerException If {@code __sourceCode} is null.
65 * @since 2020/09/06
67 public CandidateTestFiles(boolean __primary, FileLocation __sourceCode,
68 FileLocation __expectedResult, Map<String, String> __expectedValues)
69 throws NullPointerException
71 if (__sourceCode == null)
72 throw new NullPointerException("NARG");
74 this.primary = __primary;
75 this.sourceCode = __sourceCode;
76 this.expectedResult = __expectedResult;
77 this.expectedValues = (__expectedValues == null ||
78 __expectedValues.isEmpty() ? Collections.emptyMap() :
79 Collections.unmodifiableMap(
80 new LinkedHashMap<>(__expectedValues)));
83 /**
84 * {@inheritDoc}
85 * @since 2020/09/06
87 @Override
88 public final boolean equals(Object __o)
90 if (__o == this)
91 return true;
93 if (!(__o instanceof CandidateTestFiles))
94 return false;
96 CandidateTestFiles o = (CandidateTestFiles)__o;
97 return this.sourceCode.equals(o.sourceCode) &&
98 Objects.equals(this.expectedResult, o.expectedResult);
102 * {@inheritDoc}
103 * @since 2020/09/06
105 @Override
106 public final int hashCode()
108 return this.sourceCode.hashCode() ^
109 Objects.hashCode(this.expectedResult.hashCode());
113 * {@inheritDoc}
114 * @since 2020/02/28
116 @Override
117 public final String toString()
119 return String.format("{sourceCode=%s, expectedResult=%s}",
120 this.sourceCode, this.expectedResult);