CommonConstant.java

1
package org.cardanofoundation.explorer.api.common.constant;
2
3
import java.math.BigDecimal;
4
import java.math.BigInteger;
5
import java.sql.Timestamp;
6
7
import lombok.AccessLevel;
8
import lombok.NoArgsConstructor;
9
10
@NoArgsConstructor(access = AccessLevel.PRIVATE)
11
public class CommonConstant {
12
13
  public static final class NetworkType {
14
    public static final String MAINNET = "mainnet";
15
    public static final String PREVIEW = "preview";
16
    public static final String PREPROD = "preprod";
17
    public static final String SANCHONET = "sanchonet";
18
  }
19
20
  public static final class MiCAR {
21
    public static final Double CO2_EMISSION_PER_TX = 0.000018987;
22
  }
23
24
  public static final int SCALE = 6;
25
26
  public static final Integer ZERO = 0;
27
28
  public static final BigDecimal TOTAL_ADA = new BigDecimal(45000000000000000L);
29
30
  public static final BigInteger ONE_ADA_IN_LOVELACES = BigInteger.valueOf(1_000_000L);
31
32
  public static final BigInteger MAX_VALUE_BIGINT = BigInteger.valueOf(Long.MAX_VALUE);
33
34
  public static final Double MAX_PERCENT = 1.0;
35
36
  public static final Double MIN_PERCENT = 0.0;
37
38
  public static final String TESTNET_ADDRESS_PREFIX = "addr_test";
39
40
  public static final String POOL_STATUS_ACTIVE = "ACTIVE";
41
42
  public static final String POOL_STATUS_RETIRED = "RETIRED";
43
44
  public static final String ADDRESS_PREFIX = "addr";
45
46
  public static final String STAKE_ADDRESS_PREFIX = "stake";
47
48
  public static final String LOVELACE = "LOVELACE";
49
50
  public static final BigDecimal PERCENT = new BigDecimal(100);
51
52
  public static final String REDIS_TOTAL_LIVE_STAKE = "TOTAL_LIVE_STAKE_";
53
54
  public static final int TX_HASH_LENGTH = 64;
55
56
  public static final int BLOCK_HASH_LENGTH = 64;
57
58
  public static final int STAKE_KEY_LENGTH_MAINNET = 59;
59
60
  public static final int STAKE_KEY_LENGTH_TESTNET = 64;
61
62
  public static final int POOL_VIEW_LENGTH = 56;
63
64
  public static final int TOKEN_FINGERPRINT_LENGTH = 44;
65
66
  public static final String JWT = "jwt:blacklist:";
67
68
  public static final int HASH_LENGTH = 31;
69
70
  public static final String ACTIVATE_STAKE = "ACTIVATE_STAKE_";
71
72
  public static final String LIVE_STAKE = "LIVE_STAKE_";
73
74
  public static final String REDIS_TOTAL_ACTIVATE_STAKE = "TOTAL_ACTIVATE_STAKE_";
75
76
  public static final String REDIS_POOL_ACTIVATE = "POOL_ACTIVATE_";
77
78
  public static final String REDIS_POOL_INACTIVATE = "POOL_INACTIVATE_";
79
80
  public static final String REDIS_TOTAL_DELEGATOR = "TOTAL_DELEGATOR_";
81
82
  public static final String PREFIXED_STAKE_KEY = "stake";
83
84
  public static final String PREFIXED_POOL_VIEW = "pool";
85
86
  public static final String PREFIXED_TOKEN_FINGERPRINT = "asset";
87
88
  public static final String PREPROD_NETWORK = "preprod";
89
90
  public static final String PREVIEW_NETWORK = "preview";
91
92
  public static final String POOL_IDS_INACTIVATE = "POOL_IDS_INACTIVATE_";
93
94
  public static final String UNDERSCORE = "_";
95
96
  public static final String DATA_IS_NOT_SYNCING = "Data is not syncing";
97
98
  public static final String READY_TO_SERVE = "Ready to serve";
99
100
  public static final String SYNCING_BUT_NOT_READY =
101
      "Data is syncing, but it isn't ready to serve yet";
102
103
  public static final String REPORT_LIMIT_PER_24HOURS = "reportLimitPer24Hours";
104
105
  public static final int UNLIMITED_REPORT = -1;
106
107
  public static final BigInteger METADATA_LABEL_721 = BigInteger.valueOf(721);
108
109
  public static final String[] IMAGE_PREFIX = {"http://", "https://", "ipfs://", "ar://"};
110
111
  public static int hashCode(Object... a) {
112 1 1. hashCode : negated conditional → SURVIVED
    if (a == null) {
113 2 1. hashCode : removed negation → NO_COVERAGE
2. hashCode : replaced int return with 0 for org/cardanofoundation/explorer/api/common/constant/CommonConstant::hashCode → NO_COVERAGE
      return -BigInteger.ONE.intValue();
114
    }
115
116
    int result = BigInteger.ONE.intValue();
117
118
    for (Object element : a) {
119 1 1. hashCode : Replaced integer multiplication with division → SURVIVED
      result =
120
          HASH_LENGTH * result
121 3 1. hashCode : Replaced integer addition with subtraction → SURVIVED
2. hashCode : negated conditional → SURVIVED
3. hashCode : removed negation → NO_COVERAGE
              + (element == null ? -BigInteger.ONE.intValue() : element.hashCode());
122
    }
123
124 1 1. hashCode : replaced int return with 0 for org/cardanofoundation/explorer/api/common/constant/CommonConstant::hashCode → SURVIVED
    return result;
125
  }
126
127
  /**
128
   * check timestamp in range of startTime and endTime or not startTime < endTime
129
   *
130
   * @param timestamp
131
   * @param startFilterTime
132
   * @param endFilterTime
133
   * @return
134
   */
135
  public static boolean isWithinRange(
136
      Timestamp timestamp, Timestamp startFilterTime, Timestamp endFilterTime) {
137 3 1. isWithinRange : negated conditional → KILLED
2. isWithinRange : replaced boolean return with true for org/cardanofoundation/explorer/api/common/constant/CommonConstant::isWithinRange → KILLED
3. isWithinRange : negated conditional → KILLED
    return !(timestamp.before(startFilterTime) || timestamp.after(endFilterTime));
138
  }
139
}

Mutations

112

1.1
Location : hashCode
Killed by : none
negated conditional → SURVIVED

113

1.1
Location : hashCode
Killed by : none
removed negation → NO_COVERAGE

2.2
Location : hashCode
Killed by : none
replaced int return with 0 for org/cardanofoundation/explorer/api/common/constant/CommonConstant::hashCode → NO_COVERAGE

119

1.1
Location : hashCode
Killed by : none
Replaced integer multiplication with division → SURVIVED

121

1.1
Location : hashCode
Killed by : none
Replaced integer addition with subtraction → SURVIVED

2.2
Location : hashCode
Killed by : none
negated conditional → SURVIVED

3.3
Location : hashCode
Killed by : none
removed negation → NO_COVERAGE

124

1.1
Location : hashCode
Killed by : none
replaced int return with 0 for org/cardanofoundation/explorer/api/common/constant/CommonConstant::hashCode → SURVIVED

137

1.1
Location : isWithinRange
Killed by : org.cardanofoundation.explorer.api.service.ProtocolServiceTest.[engine:junit-jupiter]/[class:org.cardanofoundation.explorer.api.service.ProtocolServiceTest]/[method:testChangeHistoryChangeEpoch1()]
negated conditional → KILLED

2.2
Location : isWithinRange
Killed by : org.cardanofoundation.explorer.api.service.ProtocolServiceTest.[engine:junit-jupiter]/[class:org.cardanofoundation.explorer.api.service.ProtocolServiceTest]/[method:testChangeHistoryChangeEpoch2()]
replaced boolean return with true for org/cardanofoundation/explorer/api/common/constant/CommonConstant::isWithinRange → KILLED

3.3
Location : isWithinRange
Killed by : org.cardanofoundation.explorer.api.service.ProtocolServiceTest.[engine:junit-jupiter]/[class:org.cardanofoundation.explorer.api.service.ProtocolServiceTest]/[method:testChangeHistoryChangeEpoch2()]
negated conditional → KILLED

Active mutators

Tests examined


Report generated by PIT 1.14.2