| 1 | package pl.zankowski.iextrading4j.api.stocks; | |
| 2 | ||
| 3 | import com.fasterxml.jackson.annotation.JsonCreator; | |
| 4 | import com.fasterxml.jackson.annotation.JsonProperty; | |
| 5 | import com.google.common.base.MoreObjects; | |
| 6 | import com.google.common.base.Objects; | |
| 7 | import pl.zankowski.iextrading4j.api.marketdata.BookEntry; | |
| 8 | import pl.zankowski.iextrading4j.api.marketdata.SystemEvent; | |
| 9 | import pl.zankowski.iextrading4j.api.marketdata.Trade; | |
| 10 | ||
| 11 | import java.io.Serializable; | |
| 12 | import java.util.List; | |
| 13 | ||
| 14 | import static pl.zankowski.iextrading4j.api.util.ListUtil.immutableList; | |
| 15 | ||
| 16 | public class Book implements Serializable { | |
| 17 | ||
| 18 | private static final long serialVersionUID = -251227870271833278L; | |
| 19 | ||
| 20 | private final Quote quote; | |
| 21 | private final List<BookEntry> bids; | |
| 22 | private final List<BookEntry> asks; | |
| 23 | private final List<Trade> trades; | |
| 24 | private final SystemEvent systemEvent; | |
| 25 | ||
| 26 | @JsonCreator | |
| 27 | public Book( | |
| 28 | @JsonProperty("quote") final Quote quote, | |
| 29 | @JsonProperty("bids") final List<BookEntry> bids, | |
| 30 | @JsonProperty("asks") final List<BookEntry> asks, | |
| 31 | @JsonProperty("trades") final List<Trade> trades, | |
| 32 | @JsonProperty("systemEvent") final SystemEvent systemEvent) { | |
| 33 | this.quote = quote; | |
| 34 | this.bids = immutableList(bids); | |
| 35 | this.asks = immutableList(asks); | |
| 36 | this.trades = immutableList(trades); | |
| 37 | this.systemEvent = systemEvent; | |
| 38 | } | |
| 39 | ||
| 40 | public Quote getQuote() { | |
| 41 |
1
1. getQuote : replaced return value with null for pl/zankowski/iextrading4j/api/stocks/Book::getQuote → KILLED |
return quote; |
| 42 | } | |
| 43 | ||
| 44 | public List<BookEntry> getBids() { | |
| 45 |
1
1. getBids : replaced return value with Collections.emptyList for pl/zankowski/iextrading4j/api/stocks/Book::getBids → KILLED |
return bids; |
| 46 | } | |
| 47 | ||
| 48 | public List<BookEntry> getAsks() { | |
| 49 |
1
1. getAsks : replaced return value with Collections.emptyList for pl/zankowski/iextrading4j/api/stocks/Book::getAsks → KILLED |
return asks; |
| 50 | } | |
| 51 | ||
| 52 | public List<Trade> getTrades() { | |
| 53 |
1
1. getTrades : replaced return value with Collections.emptyList for pl/zankowski/iextrading4j/api/stocks/Book::getTrades → KILLED |
return trades; |
| 54 | } | |
| 55 | ||
| 56 | public SystemEvent getSystemEvent() { | |
| 57 |
1
1. getSystemEvent : replaced return value with null for pl/zankowski/iextrading4j/api/stocks/Book::getSystemEvent → KILLED |
return systemEvent; |
| 58 | } | |
| 59 | ||
| 60 | @Override | |
| 61 | public boolean equals(Object o) { | |
| 62 |
2
1. equals : negated conditional → KILLED 2. equals : replaced boolean return with false for pl/zankowski/iextrading4j/api/stocks/Book::equals → KILLED |
if (this == o) return true; |
| 63 |
3
1. equals : negated conditional → KILLED 2. equals : negated conditional → KILLED 3. equals : replaced boolean return with true for pl/zankowski/iextrading4j/api/stocks/Book::equals → KILLED |
if (o == null || getClass() != o.getClass()) return false; |
| 64 | Book book = (Book) o; | |
| 65 |
2
1. equals : negated conditional → KILLED 2. equals : replaced boolean return with true for pl/zankowski/iextrading4j/api/stocks/Book::equals → KILLED |
return Objects.equal(quote, book.quote) && |
| 66 |
1
1. equals : negated conditional → KILLED |
Objects.equal(bids, book.bids) && |
| 67 |
1
1. equals : negated conditional → KILLED |
Objects.equal(asks, book.asks) && |
| 68 |
1
1. equals : negated conditional → KILLED |
Objects.equal(trades, book.trades) && |
| 69 |
1
1. equals : negated conditional → KILLED |
Objects.equal(systemEvent, book.systemEvent); |
| 70 | } | |
| 71 | ||
| 72 | @Override | |
| 73 | public int hashCode() { | |
| 74 |
1
1. hashCode : replaced int return with 0 for pl/zankowski/iextrading4j/api/stocks/Book::hashCode → KILLED |
return Objects.hashCode(quote, bids, asks, trades, systemEvent); |
| 75 | } | |
| 76 | ||
| 77 | @Override | |
| 78 | public String toString() { | |
| 79 |
1
1. toString : replaced return value with "" for pl/zankowski/iextrading4j/api/stocks/Book::toString → KILLED |
return MoreObjects.toStringHelper(this) |
| 80 | .add("quote", quote) | |
| 81 | .add("bids", bids) | |
| 82 | .add("asks", asks) | |
| 83 | .add("trades", trades) | |
| 84 | .add("systemEvent", systemEvent) | |
| 85 | .toString(); | |
| 86 | } | |
| 87 | } | |
Mutations | ||
| 41 |
1.1 |
|
| 45 |
1.1 |
|
| 49 |
1.1 |
|
| 53 |
1.1 |
|
| 57 |
1.1 |
|
| 62 |
1.1 2.2 |
|
| 63 |
1.1 2.2 3.3 |
|
| 65 |
1.1 2.2 |
|
| 66 |
1.1 |
|
| 67 |
1.1 |
|
| 68 |
1.1 |
|
| 69 |
1.1 |
|
| 74 |
1.1 |
|
| 79 |
1.1 |