Skip to content

Commit

Permalink
Null fix for Min and Max (#870)
Browse files Browse the repository at this point in the history
* Handle null for Min Max and IsLeapYear

* Handle null differently
  • Loading branch information
SimonCockx authored Nov 14, 2024
1 parent 93c555b commit 6f1b774
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,37 @@
public class Max {

public Integer execute(Integer x, Integer y) {
if (x == null || y == null) {
return null;
if (x == null) {
return y;
} else if (y == null) {
return x;
}
return Integer.max(x, y);
}

public Long execute(Long x, Long y) {
if (x == null || y == null) {
return null;
if (x == null) {
return y;
} else if (y == null) {
return x;
}
return Long.max(x, y);
}

public BigInteger execute(BigInteger x, BigInteger y) {
if (x == null || y == null) {
return null;
if (x == null) {
return y;
} else if (y == null) {
return x;
}
return x.max(y);
}

public BigDecimal execute(BigDecimal x, BigDecimal y) {
if (x == null || y == null) {
return null;
if (x == null) {
return y;
} else if (y == null) {
return x;
}
return x.max(y);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,37 @@
public class Min {

public Integer execute(Integer x, Integer y) {
if (x == null || y == null) {
return null;
if (x == null) {
return y;
} else if (y == null) {
return x;
}
return Integer.min(x, y);
}

public Long execute(Long x, Long y) {
if (x == null || y == null) {
return null;
if (x == null) {
return y;
} else if (y == null) {
return x;
}
return Long.min(x, y);
}

public BigInteger execute(BigInteger x, BigInteger y) {
if (x == null || y == null) {
return null;
if (x == null) {
return y;
} else if (y == null) {
return x;
}
return x.min(y);
}

public BigDecimal execute(BigDecimal x, BigDecimal y) {
if (x == null || y == null) {
return null;
if (x == null) {
return y;
} else if (y == null) {
return x;
}
return x.min(y);
}
Expand Down

0 comments on commit 6f1b774

Please sign in to comment.