Skip to content

Commit

Permalink
Merge pull request #349 from nitishgoyal13/formatted-master
Browse files Browse the repository at this point in the history
Formatting changes according to latest shared formatter
  • Loading branch information
santanusinha committed Feb 22, 2022
2 parents fbfccff + fca6ca3 commit 2f062e4
Show file tree
Hide file tree
Showing 174 changed files with 2,089 additions and 2,149 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public String getOpcode() {
}

public List<Filter> getFilters() {
if(filters == null) {
if (filters == null) {
return Lists.newArrayList();
}
return filters;
Expand Down Expand Up @@ -82,7 +82,7 @@ public String toString() {
}

public Object clone() throws CloneNotSupportedException {
ActionRequest actionRequestClone = (ActionRequest)super.clone();
ActionRequest actionRequestClone = (ActionRequest) super.clone();
actionRequestClone.setFilters(new ArrayList<>(this.filters));
return actionRequestClone;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "opcode")
@JsonSubTypes({@JsonSubTypes.Type(value = CountResponse.class, name = Opcodes.COUNT), @JsonSubTypes.Type(value = DistinctResponse.class,
name = Opcodes.DISTINCT),
@JsonSubTypes.Type(value = GroupResponse.class, name = Opcodes.GROUP), @JsonSubTypes.Type(value = HistogramResponse.class,
name = Opcodes.HISTOGRAM),
@JsonSubTypes.Type(value = QueryResponse.class, name = Opcodes.QUERY), @JsonSubTypes.Type(value = MultiQueryResponse
name = Opcodes.DISTINCT),
@JsonSubTypes.Type(value = GroupResponse.class, name = Opcodes.GROUP), @JsonSubTypes.Type(value = HistogramResponse.class,
name = Opcodes.HISTOGRAM),
@JsonSubTypes.Type(value = QueryResponse.class, name = Opcodes.QUERY), @JsonSubTypes.Type(value = MultiQueryResponse
.class, name = Opcodes.MULTI_QUERY), @JsonSubTypes.Type(value = StatsResponse.class, name = Opcodes.STATS), @JsonSubTypes.Type
(value = TrendResponse.class, name = Opcodes.TREND), @JsonSubTypes.Type(value = StatsTrendResponse.class, name =
(value = TrendResponse.class, name = Opcodes.TREND), @JsonSubTypes.Type(value = StatsTrendResponse.class, name =
Opcodes.STATS_TREND), @JsonSubTypes.Type(value = MultiTimeQueryResponse.class, name = Opcodes.MULTI_TIME_QUERY)})
@Data
public abstract class ActionResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public final class Opcodes {
public static final String STATS = "stats";
public static final String TREND = "trend";
public static final String STATS_TREND = "statstrend";

private Opcodes() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ public void accept(ResponseVisitor visitor) {

@Override
public boolean equals(Object o) {
if(this == o)
if (this == o)
return true;
if(o == null || getClass() != o.getClass())
if (o == null || getClass() != o.getClass())
return false;

DistinctResponse that = (DistinctResponse)o;
DistinctResponse that = (DistinctResponse) o;

if(headers != null ? !headers.equals(that.headers) : that.headers != null)
if (headers != null ? !headers.equals(that.headers) : that.headers != null)
return false;
return result != null ? result.equals(that.result) : that.result == null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ public enum EstimationDataType {
* Fixed estimation data, for:
* {@link com.flipkart.foxtrot.common.FieldType#BOOLEAN}
*/
FIXED, /**
FIXED,
/**
* Percentile based estimation for:
* {@link com.flipkart.foxtrot.common.FieldType#LONG}
* {@link com.flipkart.foxtrot.common.FieldType#DATE}
* {@link com.flipkart.foxtrot.common.FieldType#DOUBLE}
* {@link com.flipkart.foxtrot.common.FieldType#FLOAT}
* {@link com.flipkart.foxtrot.common.FieldType#INTEGER}
*/
PERCENTILE, /**
PERCENTILE,
/**
* Fixed estimation data, for:
* {@link com.flipkart.foxtrot.common.FieldType#STRING}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,22 @@ public void setCount(long count) {

@Override
public boolean equals(Object o) {
if(this == o)
if (this == o)
return true;
if(!(o instanceof Count))
if (!(o instanceof Count))
return false;

Count count1 = (Count)o;
Count count1 = (Count) o;

if(count != count1.count)
if (count != count1.count)
return false;
return period.equals(count1.period);
}

@Override
public int hashCode() {
int result = period.hashCode();
result = 31 * result + (int)(count ^ (count >>> 32));
result = 31 * result + (int) (count ^ (count >>> 32));
return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,20 @@
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "operator")
@JsonSubTypes({
//Numeric
@JsonSubTypes.Type(value = GreaterEqualFilter.class, name = FilterOperator.greater_equal), @JsonSubTypes.Type(value = GreaterThanFilter.class, name = FilterOperator.greater_than), @JsonSubTypes.Type(value = LessEqualFilter.class, name = FilterOperator.less_equal), @JsonSubTypes.Type(value = LessThanFilter.class, name = FilterOperator.less_than), @JsonSubTypes.Type(value = BetweenFilter.class, name = FilterOperator.between),
//Numeric
@JsonSubTypes.Type(value = GreaterEqualFilter.class, name = FilterOperator.greater_equal), @JsonSubTypes.Type(value = GreaterThanFilter.class, name = FilterOperator.greater_than), @JsonSubTypes.Type(value = LessEqualFilter.class, name = FilterOperator.less_equal), @JsonSubTypes.Type(value = LessThanFilter.class, name = FilterOperator.less_than), @JsonSubTypes.Type(value = BetweenFilter.class, name = FilterOperator.between),

//General
@JsonSubTypes.Type(value = EqualsFilter.class, name = FilterOperator.equals), @JsonSubTypes.Type(value = InFilter
//General
@JsonSubTypes.Type(value = EqualsFilter.class, name = FilterOperator.equals), @JsonSubTypes.Type(value = InFilter
.class, name = FilterOperator.in), @JsonSubTypes.Type(value = NotInFilter.class, name = FilterOperator.not_in), @JsonSubTypes
.Type(value = NotEqualsFilter.class, name = FilterOperator.not_equals), @JsonSubTypes.Type(value = AnyFilter.class, name =
FilterOperator.any), @JsonSubTypes.Type(value = ExistsFilter.class, name = FilterOperator.exists), @JsonSubTypes.Type(value = MissingFilter.class, name = FilterOperator.missing),

//String
@JsonSubTypes.Type(value = ContainsFilter.class, name = FilterOperator.contains), @JsonSubTypes.Type(value = WildCardFilter.class, name = FilterOperator.wildcard),
//String
@JsonSubTypes.Type(value = ContainsFilter.class, name = FilterOperator.contains), @JsonSubTypes.Type(value = WildCardFilter.class, name = FilterOperator.wildcard),

//String
@JsonSubTypes.Type(value = LastFilter.class, name = FilterOperator.last)})
//String
@JsonSubTypes.Type(value = LastFilter.class, name = FilterOperator.last)})

public abstract class Filter implements Serializable {

Expand Down Expand Up @@ -87,14 +87,14 @@ public String getOperator() {

@Override
public boolean equals(Object o) {
if(this == o)
if (this == o)
return true;
if(o == null || getClass() != o.getClass())
if (o == null || getClass() != o.getClass())
return false;

Filter filter = (Filter)o;
Filter filter = (Filter) o;

if(!field.equals(filter.field))
if (!field.equals(filter.field))
return false;
return operator.equals(filter.operator);
}
Expand All @@ -121,7 +121,7 @@ public boolean isFilterTemporal() {

public Set<String> validate() {
Set<String> validationErrors = new HashSet<>();
if(CollectionUtils.isNullOrEmpty(field)) {
if (CollectionUtils.isNullOrEmpty(field)) {
validationErrors.add("filter field cannot be null or empty");
}
return validationErrors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
import com.flipkart.foxtrot.common.ActionRequest;
import com.flipkart.foxtrot.common.ActionRequestVisitor;
import com.flipkart.foxtrot.common.Opcodes;

import java.util.Map;

import lombok.Data;

/***
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ public void setOrder(Order order) {

@Override
public boolean equals(Object o) {
if(this == o)
if (this == o)
return true;
if(o == null || getClass() != o.getClass())
if (o == null || getClass() != o.getClass())
return false;

ResultSort that = (ResultSort)o;
ResultSort that = (ResultSort) o;

if(!field.equals(that.field))
if (!field.equals(that.field))
return false;
return order == that.order;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,9 @@ public int hashCode() {
result = 31 * result + getField().hashCode();
if (!getField().equals("_timestamp")) {
result = result * 21 + (getCurrentTime() == 0
? 43
: Long.valueOf(getCurrentTime()).hashCode());
}
else {
? 43
: Long.valueOf(getCurrentTime()).hashCode());
} else {
result = result * 21 + Long.valueOf(getCurrentTime() / (long) 30000).hashCode();
}
result = result * 13 + getRoundingMode().name().hashCode();
Expand All @@ -84,8 +83,7 @@ public int hashCode() {
public boolean equals(Object o) {
if (this == o) {
return true;
}
else if (!(o instanceof LastFilter)) {
} else if (!(o instanceof LastFilter)) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ private WindowUtil() {

public static TimeWindow calculate(long endTime, Duration duration, RoundingMode roundingMode) {
DateTime windowStartTime = new DateTime(endTime - duration.toMilliseconds());
if(roundingMode == null || roundingMode == RoundingMode.NONE) {
if (roundingMode == null || roundingMode == RoundingMode.NONE) {
return new TimeWindow(windowStartTime.getMillis(), endTime);
}
return new TimeWindow(roundingMode.translate(windowStartTime, duration)
.getMillis(), endTime);
.getMillis(), endTime);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public <T> T accept(FilterVisitor<T> visitor) {
@Override
public Set<String> validate() {
Set<String> validationErrors = super.validate();
if(value == null) {
if (value == null) {
validationErrors.add("filter field value cannot be null or empty");
}
return validationErrors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public <T> T accept(FilterVisitor<T> visitor) {
@Override
public Set<String> validate() {
Set<String> validationErrors = super.validate();
if(CollectionUtils.isNullOrEmpty(values)) {
if (CollectionUtils.isNullOrEmpty(values)) {
validationErrors.add("at least one value needs to be provided for field");
}
return validationErrors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public <T> T accept(FilterVisitor<T> visitor) {
@Override
public Set<String> validate() {
Set<String> validationErrors = super.validate();
if(value == null) {
if (value == null) {
validationErrors.add("filter field value cannot be null or empty");
}
return validationErrors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public <T> T accept(FilterVisitor<T> visitor) {
@Override
public Set<String> validate() {
Set<String> validationErrors = super.validate();
if(CollectionUtils.isNullOrEmpty(values)) {
if (CollectionUtils.isNullOrEmpty(values)) {
validationErrors.add("at least one value needs to be provided for field");
}
return validationErrors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ public boolean isFilterTemporal() {
@Override
public Set<String> validate() {
Set<String> validationErrors = super.validate();
if(from == null) {
if (from == null) {
validationErrors.add("from field cannot be null");
}

if(to == null) {
if (to == null) {
validationErrors.add("to field cannot be null");
}
return validationErrors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public boolean isFilterTemporal() {
@Override
public Set<String> validate() {
Set<String> validationErrors = super.validate();
if(value == null) {
if (value == null) {
validationErrors.add("filter value cannot be null");
}
return validationErrors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public <T> T accept(FilterVisitor<T> visitor) {
@Override
public Set<String> validate() {
Set<String> validationErrors = super.validate();
if(value == null) {
if (value == null) {
validationErrors.add("filter value cannot be null");
}
return validationErrors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public <T> T accept(FilterVisitor<T> visitor) {
@Override
public Set<String> validate() {
Set<String> validationErrors = super.validate();
if(value == null) {
if (value == null) {
validationErrors.add("filter value cannot be null");
}
return validationErrors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
*
*/
public enum AnalyticsRequestFlags {
STATS_SKIP_PERCENTILES
;
STATS_SKIP_PERCENTILES;

public static boolean hasFlag(Collection<AnalyticsRequestFlags> flags, AnalyticsRequestFlags requestFlag) {
return null != flags && flags.contains(requestFlag);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.flipkart.foxtrot.common.stats;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;

import java.util.Map;

import lombok.NoArgsConstructor;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.KeyDeserializer;

import java.io.IOException;

/***
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ public void accept(ResponseVisitor visitor) {

@Override
public boolean equals(Object o) {
if(this == o)
if (this == o)
return true;
if(!(o instanceof TrendResponse))
if (!(o instanceof TrendResponse))
return false;

TrendResponse that = (TrendResponse)o;
TrendResponse that = (TrendResponse) o;

return trends.equals(that.trends);
}
Expand Down Expand Up @@ -100,22 +100,22 @@ public void setCount(long count) {

@Override
public boolean equals(Object o) {
if(this == o)
if (this == o)
return true;
if(!(o instanceof Count))
if (!(o instanceof Count))
return false;

Count count1 = (Count)o;
Count count1 = (Count) o;

if(count != count1.count)
if (count != count1.count)
return false;
return period.equals(count1.period);
}

@Override
public int hashCode() {
int result = period.hashCode();
result = 31 * result + (int)(count ^ (count >>> 32));
result = 31 * result + (int) (count ^ (count >>> 32));
return result;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
*/
public class CollectionUtils {

private CollectionUtils() {}
private CollectionUtils() {
}

public static boolean isNullOrEmpty(String s) {
return s == null || s.trim()
Expand Down
Loading

0 comments on commit 2f062e4

Please sign in to comment.