Skip to content

Commit 62b71af

Browse files
committed
adding some double methods, not sure if they'll stay
1 parent 66acc92 commit 62b71af

5 files changed

Lines changed: 68 additions & 12 deletions

File tree

core/.settings/org.eclipse.jdt.core.prefs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
#Mon Apr 13 07:44:22 EST 2009
1+
#Tue Sep 22 10:13:08 EDT 2009
22
eclipse.preferences.version=1
33
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
44
org.eclipse.jdt.core.compiler.compliance=1.5
55
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
66
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
77
org.eclipse.jdt.core.compiler.source=1.5
88
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
9-
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
9+
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18
1010
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
11-
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
11+
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=18
1212
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18
1313
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
1414
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
15-
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18
15+
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
1616
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
17-
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=82
17+
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
1818
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
19-
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
19+
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18
2020
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
2121
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18
2222
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18
@@ -75,7 +75,7 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
7575
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
7676
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
7777
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
78-
org.eclipse.jdt.core.formatter.indentation.size=2
78+
org.eclipse.jdt.core.formatter.indentation.size=4
7979
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
8080
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
8181
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
@@ -259,6 +259,6 @@ org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body
259259
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
260260
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
261261
org.eclipse.jdt.core.formatter.tabulation.char=space
262-
org.eclipse.jdt.core.formatter.tabulation.size=2
262+
org.eclipse.jdt.core.formatter.tabulation.size=4
263263
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
264264
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#Thu Jan 10 10:50:38 PST 2008
1+
#Tue Sep 22 10:13:08 EDT 2009
22
eclipse.preferences.version=1
3-
formatter_profile=_two spaces no tabs
3+
formatter_profile=_fry (4 spaces)
44
formatter_settings_version=11
55
org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates/>

core/src/processing/core/PApplet.java

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2687,6 +2687,10 @@ static public final float max(float a, float b) {
26872687
return (a > b) ? a : b;
26882688
}
26892689

2690+
static public final double max(double a, double b) {
2691+
return (a > b) ? a : b;
2692+
}
2693+
26902694

26912695
static public final int max(int a, int b, int c) {
26922696
return (a > b) ? ((a > c) ? a : c) : ((b > c) ? b : c);
@@ -2732,6 +2736,24 @@ static public final float max(float[] list) {
27322736
}
27332737

27342738

2739+
/**
2740+
* Find the maximum value in an array.
2741+
* Throws an ArrayIndexOutOfBoundsException if the array is length 0.
2742+
* @param list the source array
2743+
* @return The maximum value
2744+
*/
2745+
static public final double max(double[] list) {
2746+
if (list.length == 0) {
2747+
throw new ArrayIndexOutOfBoundsException(ERROR_MIN_MAX);
2748+
}
2749+
double max = list[0];
2750+
for (int i = 1; i < list.length; i++) {
2751+
if (list[i] > max) max = list[i];
2752+
}
2753+
return max;
2754+
}
2755+
2756+
27352757
static public final int min(int a, int b) {
27362758
return (a < b) ? a : b;
27372759
}
@@ -2740,6 +2762,10 @@ static public final float min(float a, float b) {
27402762
return (a < b) ? a : b;
27412763
}
27422764

2765+
static public final double min(double a, double b) {
2766+
return (a < b) ? a : b;
2767+
}
2768+
27432769

27442770
static public final int min(int a, int b, int c) {
27452771
return (a < b) ? ((a < c) ? a : c) : ((b < c) ? b : c);
@@ -2749,6 +2775,10 @@ static public final float min(float a, float b, float c) {
27492775
return (a < b) ? ((a < c) ? a : c) : ((b < c) ? b : c);
27502776
}
27512777

2778+
static public final double min(double a, double b, double c) {
2779+
return (a < b) ? ((a < c) ? a : c) : ((b < c) ? b : c);
2780+
}
2781+
27522782

27532783
/**
27542784
* Find the minimum value in an array.
@@ -2766,6 +2796,8 @@ static public final int min(int[] list) {
27662796
}
27672797
return min;
27682798
}
2799+
2800+
27692801
/**
27702802
* Find the minimum value in an array.
27712803
* Throws an ArrayIndexOutOfBoundsException if the array is length 0.
@@ -2784,6 +2816,24 @@ static public final float min(float[] list) {
27842816
}
27852817

27862818

2819+
/**
2820+
* Find the minimum value in an array.
2821+
* Throws an ArrayIndexOutOfBoundsException if the array is length 0.
2822+
* @param list the source array
2823+
* @return The minimum value
2824+
*/
2825+
static public final double min(double[] list) {
2826+
if (list.length == 0) {
2827+
throw new ArrayIndexOutOfBoundsException(ERROR_MIN_MAX);
2828+
}
2829+
double min = list[0];
2830+
for (int i = 1; i < list.length; i++) {
2831+
if (list[i] < min) min = list[i];
2832+
}
2833+
return min;
2834+
}
2835+
2836+
27872837
static public final int constrain(int amt, int low, int high) {
27882838
return (amt < low) ? low : ((amt > high) ? high : amt);
27892839
}

core/src/processing/core/PImage.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ public PImage(java.awt.Image img) {
182182
raster.getDataElements(0, 0, width, height, pixels);
183183

184184
} else { // go the old school java 1.0 route
185+
// System.out.println(img.getClass().getName());
185186
width = img.getWidth(null);
186187
height = img.getHeight(null);
187188
pixels = new int[width * height];

core/todo.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
0170 core
2+
X added some min/max functions that work with doubles
3+
X not sure if those are staying in or not
24

5+
_ key and mouse events delivered out of order
6+
_ http://dev.processing.org/bugs/show_bug.cgi?id=638
7+
_ key/mouse events have concurrency problems with noLoop()
8+
_ http://dev.processing.org/bugs/show_bug.cgi?id=1323
9+
_ need to say "no drawing inside mouse/key events w/ noLoop"
310

411
_ make the index lookup use numbers up to 256?
512

@@ -232,8 +239,6 @@ _ PApplet.main(new String[] { "classname" }) won't pass in args
232239
_ this means that no args are after passed to the class
233240
_ the fix would be to use the following as the call to main()
234241
_ PApplet.main(append(new String[] { "classname }, args));
235-
_ key and mouse events delivered out of order
236-
_ http://dev.processing.org/bugs/show_bug.cgi?id=638
237242
_ figure out why 1024x768 image takes 3.5 seconds to load
238243
_ would using a BufferedImage work better?
239244
_ is the image actually a BufferedImage so PixelGrabber is a waste?

0 commit comments

Comments
 (0)