Skip to content

Commit 46f778a

Browse files
committed
Revision 3
1 parent 7909e7d commit 46f778a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+12219
-5547
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</parent>
1111

1212
<artifactId>imagescience</artifactId>
13-
<version>2.4.3-SNAPSHOT</version>
13+
<version>3.0.0</version>
1414

1515
<name>jars/imagescience.jar</name>
1616
<description />
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package imagescience;
2+
3+
/** Contains the name and version number of the ImageScience library. */
4+
public class ImageScience {
5+
6+
/** Default constructor. */
7+
public ImageScience() { }
8+
9+
/** Returns the name of the library.
10+
11+
@return A new {@code String} object with the name of the library.
12+
*/
13+
public static String name() {
14+
15+
return "ImageScience";
16+
}
17+
18+
/** Returns the version number of the library.
19+
20+
@return A new {@code String} object with the version number of the library.
21+
*/
22+
public static String version() {
23+
24+
final String version = ImageScience.class.getPackage().getImplementationVersion();
25+
26+
return (version == null) ? "DEV" : version;
27+
}
28+
29+
/** Returns the name and version number of the library appended with a colon and space.
30+
31+
@return A new {@code String} object with the name and version number of the library appended with a colon and space.
32+
*/
33+
public static String prelude() {
34+
35+
return name()+" "+version()+": ";
36+
}
37+
38+
}

src/main/java/imagescience/array/ByteArray.java

Lines changed: 56 additions & 67 deletions
Large diffs are not rendered by default.

src/main/java/imagescience/array/DoubleArray.java

Lines changed: 56 additions & 67 deletions
Large diffs are not rendered by default.

src/main/java/imagescience/array/FloatArray.java

Lines changed: 56 additions & 67 deletions
Large diffs are not rendered by default.

src/main/java/imagescience/array/IntArray.java

Lines changed: 56 additions & 67 deletions
Large diffs are not rendered by default.

src/main/java/imagescience/array/LongArray.java

Lines changed: 57 additions & 68 deletions
Large diffs are not rendered by default.

src/main/java/imagescience/array/ShortArray.java

Lines changed: 56 additions & 67 deletions
Large diffs are not rendered by default.

src/main/java/imagescience/color/Palette.java

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
package imagescience.color;
2+
23
import java.awt.Color;
34

45
/** A palette of 100 different colors. */
@@ -54,16 +55,16 @@ public class Palette {
5455

5556
private final int mode;
5657

57-
private int nextindex;
58+
private int next;
5859

5960
/** Default constructor. Results in a palette operating in the arbitrary mode. */
6061
public Palette() { this(ARBITRARY); }
6162

6263
/** Mode constructor. Results in a palette operating in the given mode.
6364
64-
@param mode the palette mode. Must be one of the static fields of this class.
65+
@param mode The palette mode. Must be one of the static fields of this class.
6566
66-
@exception IllegalArgumentException if {@code mode} is not one of the static fields of this class.
67+
@throws IllegalArgumentException If {@code mode} is not one of the static fields of this class.
6768
*/
6869
public Palette(final int mode) {
6970

@@ -85,13 +86,15 @@ public Palette(final int mode) {
8586

8687
/** Returns the palette mode.
8788
88-
@return the palette mode. The returned value is equal to one of the static fields of this class.
89+
@return The palette mode. The returned value is equal to one of the static fields of this class.
8990
*/
9091
public int mode() { return mode; }
9192

9293
/** Returns the color at the given index (modulo 100).
9394
94-
@return the color at the given index (modulo 100). The actual color returned depends on the mode of the palette.
95+
@param index The index.
96+
97+
@return The color at the given index (modulo 100). The actual color returned depends on the mode of the palette.
9598
*/
9699
public Color get(final int index) {
97100

@@ -100,9 +103,9 @@ public Color get(final int index) {
100103

101104
/** Returns the index of the given color.
102105
103-
@param color the color whose index is to be returned.
106+
@param color The color.
104107
105-
@return the index of the given color. The actual index returned depends on the mode of the palette. If {@code color} is {@code null} or it is not in the palette, the method returns -1.
108+
@return The index of the given color. The actual index returned depends on the mode of the palette. If {@code color} is {@code null} or it is not in the palette, the method returns -1.
106109
*/
107110
public int index(final Color color) {
108111

@@ -118,22 +121,22 @@ public int index(final Color color) {
118121

119122
/** Returns the next color. Calling this method repeatedly yields a sequence of colors with a period of 100 colors. Colors that have been marked explicitly as used will first be skipped until all colors have been used and a new cycle is started.
120123
121-
@return the next color. The actual color returned depends on the mode of the palette.
124+
@return The next color. The actual color returned depends on the mode of the palette.
122125
*/
123126
public Color next() {
124127

125128
while (true) {
126-
if (nextindex == SIZE) { reset(); break; }
127-
else if (!used[nextindex]) break;
128-
else ++nextindex;
129+
if (next == SIZE) { reset(); break; }
130+
else if (!used[next]) break;
131+
else ++next;
129132
}
130-
used[nextindex] = true;
131-
return colors[nextindex++];
133+
used[next] = true;
134+
return colors[next++];
132135
}
133136

134137
/** Marks the given color as used if it is in the palette. Colors that have been marked as used will first be skipped by the {@link #next()} method until all colors have been used and a new cycle is started.
135138
136-
@param color the color to be marked as used.
139+
@param color The color.
137140
*/
138141
public void used(final Color color) {
139142

@@ -149,7 +152,7 @@ public void used(final Color color) {
149152
public void reset() {
150153

151154
for (int i=0; i<SIZE; ++i) used[i] = false;
152-
nextindex = 0;
155+
next = 0;
153156
}
154157

155158
}

src/main/java/imagescience/color/Wave2Color.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ public Wave2Color() { }
1010

1111
/** Converts a wavelength to its corresponding RGBA color values.
1212
13-
@param wavelen the wavelength (in nanometers) to be converted.
13+
@param wavelen The wavelength (in nanometers) to be converted.
1414
15-
@param rgba the {@code double} array in which the RGBA values will be stored:<br>
15+
@param rgba The {@code double} array in which the RGBA values will be stored:<br>
1616
{@code [0]} = the value of the red (R) component,<br>
1717
{@code [1]} = the value of the green (G) component,<br>
1818
{@code [2]} = the value of the blue (B) component,<br>
1919
{@code [3]} = the value of the alpha (A) component.<br>
2020
The value of each component is in the range {@code [0.0,1.0]}.
2121
22-
@exception NullPointerException if {@code rgba} is {@code null}.
22+
@throws NullPointerException If {@code rgba} is {@code null}.
2323
24-
@exception ArrayIndexOutOfBoundsException if the length of {@code rgba} is not {@code 4}.
24+
@throws ArrayIndexOutOfBoundsException If the length of {@code rgba} is not {@code 4}.
2525
*/
2626
public void rgba(final double wavelen, final double[] rgba) {
2727

@@ -71,9 +71,9 @@ public void rgba(final double wavelen, final double[] rgba) {
7171

7272
/** Converts a wavelength to its corresponding RGBA color values.
7373
74-
@param wavelen the wavelength (in nanometers) to be converted.
74+
@param wavelen The wavelength (in nanometers) to be converted.
7575
76-
@return a new {@code double} array with four elements:<br>
76+
@return A new {@code double} array with four elements:<br>
7777
{@code [0]} = the value of the red (R) component,<br>
7878
{@code [1]} = the value of the green (G) component,<br>
7979
{@code [2]} = the value of the blue (B) component,<br>
@@ -89,9 +89,9 @@ public double[] rgba(final double wavelen) {
8989

9090
/** Converts a wavelength to its corresponding RGBA color values.
9191
92-
@param wavelen the wavelength (in nanometers) to be converted.
92+
@param wavelen The wavelength (in nanometers) to be converted.
9393
94-
@return a new {@code Color} object containing the RGBA color values.
94+
@return A new {@code Color} object containing the RGBA color values.
9595
*/
9696
public Color color(final double wavelen) {
9797

0 commit comments

Comments
 (0)