Skip to content

Commit

Permalink
[#noissue] code style cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
emeroad committed Sep 25, 2017
1 parent 9116554 commit b8f8c3a
Show file tree
Hide file tree
Showing 48 changed files with 101 additions and 104 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ private TAgentStatBatch createAgentStatBatch(String agentId, long startTimestamp
agentStatBatch.setAgentId(agentId);
agentStatBatch.setStartTimestamp(startTimestamp);
final List<TAgentStat> agentStats = new ArrayList<>(numBatches);
for (int i = 0; i < numBatches; ++i) {
for (int i = 0; i < numBatches; i++) {
agentStats.add(createAgentStat(agentId, startTimestamp));
}
agentStatBatch.setAgentStats(agentStats);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public ParallelResultScanner(TableName tableName, HbaseAccessor hbaseAccessor, E

private Scan[] splitScans(Scan originalScan) throws IOException {
Scan[] scans = this.keyDistributor.getDistributedScans(originalScan);
for (int i = 0; i < scans.length; ++i) {
for (int i = 0; i < scans.length; i++) {
Scan scan = scans[i];
scan.setId(originalScan.getId() + "-" + i);
}
Expand All @@ -85,10 +85,10 @@ private List<ScanTask> createScanTasks(ScanTaskConfig scanTaskConfig, Scan[] spl
} else {
int maxIndividualScans = (splitScans.length + (numParallelThreads - 1)) / numParallelThreads;
List<List<Scan>> scanDistributions = new ArrayList<>(numParallelThreads);
for (int i = 0; i < numParallelThreads; ++i) {
for (int i = 0; i < numParallelThreads; i++) {
scanDistributions.add(new ArrayList<Scan>(maxIndividualScans));
}
for (int i = 0; i < splitScans.length; ++i) {
for (int i = 0; i < splitScans.length; i++) {
scanDistributions.get(i % numParallelThreads).add(splitScans[i]);
}
List<ScanTask> scanTasks = new ArrayList<>(numParallelThreads);
Expand Down Expand Up @@ -121,7 +121,7 @@ public Result next() throws IOException {
private Result nextInternal() throws IOException {
Result result = null;
int indexOfResultToUse = -1;
for (int i = 0; i < this.scanTasks.size(); ++i) {
for (int i = 0; i < this.scanTasks.size(); i++) {
ScanTask scanTask = this.scanTasks.get(i);
// fail fast in case of errors
checkTask(scanTask);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private ResultScanner createResultScanner(Table table) throws IOException {
return table.getScanner(scan);
} else {
ResultScanner[] scanners = new ResultScanner[this.scans.length];
for (int i = 0; i < scanners.length; ++i) {
for (int i = 0; i < scanners.length; i++) {
scanners[i] = table.getScanner(this.scans[i]);
}
return new DistributedScanner(this.rowKeyDistributor, scanners);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public ActiveTraceHistogramBo(byte[] serializedActiveTraceHistogramBo) {
case 0:
int numActiveTraceCounts = buffer.readVInt();
List<Integer> activeTraceCounts = new ArrayList<Integer>(numActiveTraceCounts);
for (int i = 0; i < numActiveTraceCounts; ++i) {
for (int i = 0; i < numActiveTraceCounts; i++) {
activeTraceCounts.add(buffer.readVInt());
}
this.activeTraceCountMap = createActiveTraceCountMap(version, activeTraceCounts);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ public Builder(final byte[] value) {
this.serverInfo = buffer.read2PrefixedString();
final int numVmArgs = buffer.readVInt();
this.vmArgs = new ArrayList<String>(numVmArgs);
for (int i = 0; i < numVmArgs; ++i) {
for (int i = 0; i < numVmArgs; i++) {
this.vmArgs.add(buffer.read2PrefixedString());
}
final int numServiceInfos = buffer.readVInt();
this.serviceInfos = new ArrayList<ServiceInfoBo>(numServiceInfos);
for (int i = 0; i < numServiceInfos; ++i) {
for (int i = 0; i < numServiceInfos; i++) {
ServiceInfoBo serviceInfoBo = new ServiceInfoBo.Builder(buffer.readPrefixedBytes()).build();
this.serviceInfos.add(serviceInfoBo);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public byte[] writeValue() {
buffer.put2PrefixedString(this.serviceName);
int numServiceLibs = this.serviceLibs == null ? 0 : this.serviceLibs.size();
buffer.putVInt(numServiceLibs);
for (int i = 0; i < numServiceLibs; ++i) {
for (int i = 0; i < numServiceLibs; i++) {
buffer.put2PrefixedString(this.serviceLibs.get(i));
}
return buffer.getBuffer();
Expand Down Expand Up @@ -106,7 +106,7 @@ public Builder(final byte[] value) {
this.serviceName = buffer.read2PrefixedString();
final int numServiceLibs = buffer.readVInt();
this.serviceLibs = new ArrayList<String>(numServiceLibs);
for (int i = 0; i < numServiceLibs; ++i) {
for (int i = 0; i < numServiceLibs; i++) {
this.serviceLibs.add(buffer.read2PrefixedString());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void encodeTimestamps(Buffer buffer, List<Long> timestamps) {
long prevTimestamp = timestamps.get(0);
long prevDelta = 0;
// skip first timestamp as this value is encoded as the qualifier and delta is meaningless
for (int i = 1; i < timestamps.size(); ++i) {
for (int i = 1; i < timestamps.size(); i++) {
long timestamp = timestamps.get(i);
long timestampDelta = timestamp - prevTimestamp;
buffer.putVLong(timestampDelta - prevDelta);
Expand All @@ -48,7 +48,7 @@ public List<Long> decodeTimestamps(long initialTimestamp, Buffer buffer, int num
long prevTimestamp = initialTimestamp;
long prevDelta = 0;
// loop through numValues - 1 as the first timestamp is gotten from the qualifier
for (int i = 0; i < numValues - 1; ++i) {
for (int i = 0; i < numValues - 1; i++) {
long timestampDelta = prevDelta + buffer.readVLong();
long timestamp = prevTimestamp + timestampDelta;
timestamps.add(timestamp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public byte[] getHeader() {
// strictly follows JDK 7's BitSet.toByteArray()
int len = (headerBitSet.length() + (NUM_BITS_PER_BYTE - 1)) / NUM_BITS_PER_BYTE;
byte[] header = new byte[len];
for (int i = 0; i < len * NUM_BITS_PER_BYTE; ++i) {
for (int i = 0; i < len * NUM_BITS_PER_BYTE; i++) {
int index = i / NUM_BITS_PER_BYTE;
int bitMask = (headerBitSet.get(i) ? 1 : 0) << (i % NUM_BITS_PER_BYTE);
header[index] |= bitMask;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public List<JoinStatBo> decodeValues(Buffer valueBuffer, ApplicationStatDecoding
List<String> maxTotalCountAgentIdList = this.codec.decodeValues(valueBuffer, maxTotalCountAgentIdEncodingStrategy, numValues);

List<JoinStatBo> joinActiveTraceBoList = new ArrayList<JoinStatBo>();
for (int i = 0 ; i < numValues ; ++i) {
for (int i = 0 ; i < numValues ; i++) {
JoinActiveTraceBo joinActiveTraceBo = new JoinActiveTraceBo();
joinActiveTraceBo.setId(id);
joinActiveTraceBo.setVersion(versionList.get(i));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public List<JoinStatBo> decodeValues(Buffer valueBuffer, ApplicationStatDecoding
List<String> maxSysCpuAgentIds = this.codec.decodeValues(valueBuffer, maxSysCpuAgentIdEncodingStrategy, numValues);

List<JoinStatBo> joinCpuLoadBoList = new ArrayList<JoinStatBo>(numValues);
for (int i = 0; i < numValues; ++i) {
for (int i = 0; i < numValues; i++) {
JoinCpuLoadBo joinCpuLoadBo = new JoinCpuLoadBo();
joinCpuLoadBo.setId(id);
joinCpuLoadBo.setTimestamp(timestamps.get(i));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public List<JoinStatBo> decodeValues(Buffer valueBuffer, ApplicationStatDecoding
List<String> maxNonHeapAGentidList = this.codec.decodeValues(valueBuffer, maxNonHeapAgentIdEncodingStrategy, numValues);

List<JoinStatBo> joinCpuLoadBoList = new ArrayList<JoinStatBo>(numValues);
for (int i = 0; i < numValues; ++i) {
for (int i = 0; i < numValues; i++) {
JoinMemoryBo joinMemoryBo = new JoinMemoryBo();
joinMemoryBo.setId(id);
joinMemoryBo.setTimestamp(timestamps.get(i));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public List<JoinStatBo> decodeValues(Buffer valueBuffer, ApplicationStatDecoding
List<String> maxAvgAgentIdList = this.codec.decodeValues(valueBuffer, maxAvgAgentIdEncodingStrategy, numValues);

List<JoinStatBo> joinResponseTimeBoList = new ArrayList<JoinStatBo>();
for (int i = 0 ; i < numValues ; ++i) {
for (int i = 0 ; i < numValues ; i++) {
JoinResponseTimeBo joinResponseTimeBo = new JoinResponseTimeBo();
joinResponseTimeBo.setId(id);
joinResponseTimeBo.setTimestamp(timestampList.get(i));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public List<JoinStatBo> decodeValues(Buffer valueBuffer, ApplicationStatDecoding
List<String> maxTotalCountAgentIdList = this.codec.decodeValues(valueBuffer, maxTotalCountAgentIdEncodingStrategy, numValues);

List<JoinStatBo> joinTransactionBoList = new ArrayList<JoinStatBo>();
for (int i = 0 ; i < numValues ; ++i) {
for (int i = 0 ; i < numValues ; i++) {
JoinTransactionBo joinTransactionBo = new JoinTransactionBo();
joinTransactionBo.setId(id);
joinTransactionBo.setTimestamp(timestampList.get(i));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public List<JvmGcBo> decodeValues(Buffer valueBuffer, AgentStatDecodingContext d
decoder.decode(valueBuffer, headerDecoder, numValues);

List<JvmGcBo> jvmGcBos = new ArrayList<JvmGcBo>(numValues);
for (int i = 0; i < numValues; ++i) {
for (int i = 0; i < numValues; i++) {
JvmGcBo jvmGcBo = decoder.getValue(i);
jvmGcBo.setAgentId(agentId);
jvmGcBo.setTimestamp(timestamps.get(i));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ private DataSourceListBo decodeValue(Buffer valueBuffer, AgentStatDecodingContex
List<Integer> maxConnectionSizes = this.codec.decodeValues(valueBuffer, maxConnectionSizeStrategy, numValues);

DataSourceListBo dataSourceListBo = new DataSourceListBo();
for (int i = 0; i < numValues; ++i) {
for (int i = 0; i < numValues; i++) {
if (i == 0) {
dataSourceListBo.setAgentId(agentId);
dataSourceListBo.setTimestamp(timestamps.get(i));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void encodeValues(Buffer buffer, List<T> values) {
this.bufferHandler.putV(buffer, initialValue);
T previousValue = initialValue;
// skip first value as this value is stored without compression
for (int i = 1; i < values.size(); ++i) {
for (int i = 1; i < values.size(); i++) {
T value = values.get(i);
this.bufferHandler.putV(buffer, this.operation.xor(value, previousValue));
previousValue = value;
Expand All @@ -77,7 +77,7 @@ public List<T> decodeValues(Buffer buffer, int numValues) {
values.add(initialValue);
T previousValue = initialValue;
// loop through numValues - 1 as the first value is simply read from buffer
for (int i = 0; i < numValues - 1; ++i) {
for (int i = 0; i < numValues - 1; i++) {
T value = this.operation.xor(previousValue, this.bufferHandler.readV(buffer));
values.add(value);
previousValue = value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void encodeValues(Buffer buffer, List<T> values) {
T previousValue = initialValue;
T previousDelta = this.operation.zero();
// skip first value as this value is stored without compression
for (int i = 1; i < values.size(); ++i) {
for (int i = 1; i < values.size(); i++) {
T value = values.get(i);
T delta = this.operation.diff(value, previousValue);
this.bufferHandler.putSV(buffer, this.operation.diff(delta, previousDelta));
Expand All @@ -81,7 +81,7 @@ public List<T> decodeValues(Buffer buffer, int numValues) {
T previousValue = initialValue;
T previousDelta = this.operation.zero();
// loop through numValues - 1 as the first value is simply read from buffer
for (int i = 0; i < numValues - 1; ++i) {
for (int i = 0; i < numValues - 1; i++) {
T delta = this.operation.add(previousDelta, this.bufferHandler.readSV(buffer));
T value = this.operation.add(previousValue, delta);
values.add(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public List<T> decodeValues(Buffer buffer, int numValues) {
while (totalCount < numValues) {
int count = buffer.readVInt();
T value = this.bufferHandler.readV(buffer);
for (int i = 0; i < count; ++i) {
for (int i = 0; i < count; i++) {
values.add(value);
totalCount++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public List<String> decodeValues(Buffer buffer, int numValues) {
while (totalCount < numValues) {
int count = buffer.readVInt();
String value = this.bufferHandler.read(buffer);
for (int i = 0; i < count; ++i) {
for (int i = 0; i < count; i++) {
values.add(value);
totalCount++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void encodeValues(Buffer buffer, List<String> values) {
@Override
public List<String> decodeValues(Buffer buffer, int numValues) {
List<String> values = new ArrayList<String>(numValues);
for (int i = 0; i < numValues; ++i) {
for (int i = 0; i < numValues; i++) {
values.add(this.bufferHandler.read(buffer));
}
return values;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void encodeValues(Buffer buffer, List<T> values) {
@Override
public List<T> decodeValues(Buffer buffer, int numValues) {
List<T> values = new ArrayList<T>(numValues);
for (int i = 0; i < numValues; ++i) {
for (int i = 0; i < numValues; i++) {
values.add(this.bufferHandler.readV(buffer));
}
return values;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public abstract class AgentStatCodecTestBase<T extends AgentStatDataPoint> {

@Test
public void should_be_encoded_and_decoded_to_same_value() {
for (int i = 0; i < NUM_TEST_RUNS; ++i) {
for (int i = 0; i < NUM_TEST_RUNS; i++) {
runTest();
}
}
Expand All @@ -67,7 +67,7 @@ private void runTest() {
Buffer valueBuffer = new FixedBuffer(encodedValueBuffer.getBuffer());
List<T> actualAgentStats = getCodec().decodeValues(valueBuffer, decodingContext);
Assert.assertEquals(expectedAgentStats.size(), actualAgentStats.size());
for (int i = 0; i < expectedAgentStats.size(); ++i) {
for (int i = 0; i < expectedAgentStats.size(); i++) {
T expectedAgentStat = expectedAgentStats.get(i);
T actualAgentStat = actualAgentStats.get(i);
verify(expectedAgentStat, actualAgentStat);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private List<Long> createTimestamps(long initialTimestampMs, long intervalMs, lo
List<Long> timestamps = new ArrayList<Long>(numValues);
timestamps.add(initialTimestampMs);
long prevTimestamp = initialTimestampMs;
for (int i = 1; i < numValues; ++i) {
for (int i = 1; i < numValues; i++) {
long delta = ((long) (Math.random() * (randomDelta * 2))) - randomDelta;
long timestamp = prevTimestamp + (intervalMs + delta);
timestamps.add(timestamp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void stats_should_be_encoded_and_decoded_into_same_value() {

private List<TestAgentStat> createTestAgentStats(long initialTimestamp, int numStats) {
List<TestAgentStat> agentStats = new ArrayList<TestAgentStat>(numStats);
for (int i = 0; i < numStats; ++i) {
for (int i = 0; i < numStats; i++) {
long timestamp = initialTimestamp + (COLLECT_INTERVAL * i);
TestAgentStat agentStat = new TestAgentStat();
agentStat.setAgentId(AGENT_ID);
Expand Down Expand Up @@ -113,7 +113,7 @@ public void encodeValues(Buffer valueBuffer, List<TestAgentStat> agentStats) {
public List<TestAgentStat> decodeValues(Buffer valueBuffer, AgentStatDecodingContext decodingContext) {
int size = valueBuffer.readInt();
List<TestAgentStat> agentStats = new ArrayList<TestAgentStat>(size);
for (int i = 0; i < size; ++i) {
for (int i = 0; i < size; i++) {
TestAgentStat agentStat = new TestAgentStat();
agentStat.setAgentId(decodingContext.getAgentId());
agentStat.setStartTimestamp(valueBuffer.readLong());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public List<T> createConstantValues(T minValue, T maxValue) {
public List<T> createConstantValues(T minValue, T maxValue, int numValues) {
T value = this.createValue(minValue, maxValue);
List<T> values = new ArrayList<T>(numValues);
for (int i = 0; i < numValues; ++i) {
for (int i = 0; i < numValues; i++) {
values.add(value);
}
return values;
Expand All @@ -184,7 +184,7 @@ public List<T> createRandomValues(T minValue, T maxValue) {
@Override
public List<T> createRandomValues(T minValue, T maxValue, int numValues) {
List<T> values = new ArrayList<T>(numValues);
for (int i = 0; i < numValues; ++i) {
for (int i = 0; i < numValues; i++) {
T value = this.createValue(minValue, maxValue);
values.add(value);
}
Expand All @@ -202,7 +202,7 @@ public List<T> createIncreasingValues(T minValue, T maxValue, T minIncrement, T
List<T> values = new ArrayList<T>(numValues);
T value = this.createValue(minValue, maxValue);
values.add(value);
for (int i = 0; i < numValues - 1; ++i) {
for (int i = 0; i < numValues - 1; i++) {
T increment = this.createValue(minIncrement, maxIncrement);
value = add(value, increment);
values.add(value);
Expand All @@ -221,7 +221,7 @@ public List<T> createDecreasingValues(T minValue, T maxValue, T minDecrement, T
List<T> values = new ArrayList<T>(numValues);
T value = this.createValue(minValue, maxValue);
values.add(value);
for (int i = 0; i < numValues - 1; ++i) {
for (int i = 0; i < numValues - 1; i++) {
T decrement = this.createValue(minDecrement, maxDecrement);
value = diff(value, decrement);
values.add(value);
Expand All @@ -241,7 +241,7 @@ public List<T> createFluctuatingValues(T minValue, T maxValue, T minFluctuation,
T value = this.createValue(minValue, maxValue);
values.add(value);
boolean sign = RANDOM.nextBoolean();
for (int i = 0; i < numValues - 1; ++i) {
for (int i = 0; i < numValues - 1; i++) {
T fluctuation = this.createValue(minFluctuation, maxFluctuation);
// randomly add or substract fluctuation
if (sign) {
Expand Down
Loading

0 comments on commit b8f8c3a

Please sign in to comment.