Skip to content

Commit

Permalink
fix PMD errors
Browse files Browse the repository at this point in the history
|

refactor: use Expect.Number
  • Loading branch information
asmirnov-backend committed Jan 19, 2025
1 parent a137f69 commit d7f02b1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 32 deletions.
10 changes: 2 additions & 8 deletions eo-runtime/src/main/java/EOorg/EOeolang/EOnumber$EOdiv.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,8 @@ public final class EOnumber$EOdiv extends PhDefault implements Atom {

@Override
public Phi lambda() {
final Double left = Expect.at(this, Attr.RHO)
.that(phi -> new Dataized(phi).asNumber())
.otherwise("must be a number")
.it();
final Double right = Expect.at(this, "x")
.that(phi -> new Dataized(phi).asNumber())
.otherwise("must be a number")
.it();
final Double left = new Expect.Number(Expect.at(this, Attr.RHO)).it();
final Double right = new Expect.Number(Expect.at(this, "x")).it();
return new Data.ToPhi(left / right);
}
}
10 changes: 2 additions & 8 deletions eo-runtime/src/main/java/EOorg/EOeolang/EOnumber$EOgt.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,8 @@ public final class EOnumber$EOgt extends PhDefault implements Atom {

@Override
public Phi lambda() {
final Double left = Expect.at(this, Attr.RHO)
.that(phi -> new Dataized(phi).asNumber())
.otherwise("must be a number")
.it();
final Double right = Expect.at(this, "x")
.that(phi -> new Dataized(phi).asNumber())
.otherwise("must be a number")
.it();
final Double left = new Expect.Number(Expect.at(this, Attr.RHO)).it();
final Double right = new Expect.Number(Expect.at(this, "x")).it();
return new Data.ToPhi(left > right);
}
}
10 changes: 2 additions & 8 deletions eo-runtime/src/main/java/EOorg/EOeolang/EOnumber$EOplus.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,8 @@ public final class EOnumber$EOplus extends PhDefault implements Atom {

@Override
public Phi lambda() {
final Double left = Expect.at(this, Attr.RHO)
.that(phi -> new Dataized(phi).asNumber())
.otherwise("must be a number")
.it();
final Double right = Expect.at(this, "x")
.that(phi -> new Dataized(phi).asNumber())
.otherwise("must be a number")
.it();
final Double left = new Expect.Number(Expect.at(this, Attr.RHO)).it();
final Double right = new Expect.Number(Expect.at(this, "x")).it();
return new Data.ToPhi(Double.sum(left, right));
}
}
10 changes: 2 additions & 8 deletions eo-runtime/src/main/java/EOorg/EOeolang/EOnumber$EOtimes.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,8 @@ public final class EOnumber$EOtimes extends PhDefault implements Atom {

@Override
public Phi lambda() {
final Double left = Expect.at(this, Attr.RHO)
.that(phi -> new Dataized(phi).asNumber())
.otherwise("must be a number")
.it();
final Double right = Expect.at(this, "x")
.that(phi -> new Dataized(phi).asNumber())
.otherwise("must be a number")
.it();
final Double left = new Expect.Number(Expect.at(this, Attr.RHO)).it();
final Double right = new Expect.Number(Expect.at(this, "x")).it();
return new Data.ToPhi(left * right);
}
}

0 comments on commit d7f02b1

Please sign in to comment.