Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. public class MyFixedToken implements TokenType {
  2.  
  3. private final String tokenIdentifier;
  4. private final int fractionDigits;
  5.  
  6. public MyFixedToken(String tokenIdentifier, int fractionDigits) {
  7. this.tokenIdentifier = tokenIdentifier;
  8. this.fractionDigits = fractionDigits;
  9. }
  10.  
  11. @Override
  12. public int getFractionDigits() {
  13. return fractionDigits;
  14. }
  15.  
  16. @NotNull
  17. @Override
  18. public Class<?> getTokenClass() {
  19. return this.getClass();
  20. }
  21.  
  22. @NotNull
  23. @Override
  24. public String getTokenIdentifier() {
  25. return tokenIdentifier;
  26. }
  27.  
  28. @NotNull
  29. @Override
  30. public BigDecimal getDisplayTokenSize() {
  31. return BigDecimal.ONE.scaleByPowerOfTen(-fractionDigits);
  32. }
  33.  
  34. @Override
  35. public boolean equals(Object obj) {
  36. MyFixedToken other = null;
  37. if(obj instanceof MyFixedToken) {
  38. other = (MyFixedToken) obj;
  39. if(this.tokenIdentifier.equals(other.getTokenIdentifier()))
  40. return true;
  41. }
  42. return false;
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement