mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Code tidy a wider set of code.
This commit is contained in:
@@ -82,7 +82,7 @@ public class AcquireGetUsingMain {
|
||||
System.out.println("2 " + data.getTimeAt(1));
|
||||
}
|
||||
|
||||
public static interface Data {
|
||||
public interface Data {
|
||||
void setTimeAt(@MaxSize(8) int index, long time);
|
||||
|
||||
long getTimeAt(int index);
|
||||
|
||||
@@ -82,7 +82,7 @@ public class CHMMetaDataTest {
|
||||
|
||||
@Override
|
||||
public void onRemove(Bytes entry, long metaDataPos, long keyPos, long valuePos, boolean replicationEvent) {
|
||||
System.out.println("Removed entry with ts of " + entry.readLong(metaDataPos));;
|
||||
System.out.println("Removed entry with ts of " + entry.readLong(metaDataPos));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,14 +229,14 @@ public class CHMTest5 {
|
||||
}
|
||||
}
|
||||
|
||||
public static interface CHMTest5Data {
|
||||
public int getMaxNumberOfProcessesAllowed();
|
||||
public interface CHMTest5Data {
|
||||
int getMaxNumberOfProcessesAllowed();
|
||||
|
||||
public void setMaxNumberOfProcessesAllowed(int max);
|
||||
void setMaxNumberOfProcessesAllowed(int max);
|
||||
|
||||
public void setTimeAt(@MaxSize(4) int index, long time);
|
||||
void setTimeAt(@MaxSize(4) int index, long time);
|
||||
|
||||
public long getTimeAt(int index);
|
||||
long getTimeAt(int index);
|
||||
|
||||
boolean compareAndSwapMaxNumberOfProcessesAllowed(int expected, int value);
|
||||
|
||||
|
||||
@@ -1259,7 +1259,7 @@ public class ChronicleMapTest {
|
||||
|
||||
@Test
|
||||
public void mapRemoveReflectedInViews() throws IOException {
|
||||
try (ChronicleMap<Integer, CharSequence> map = getViewTestMap(3);) {
|
||||
try (ChronicleMap<Integer, CharSequence> map = getViewTestMap(3)) {
|
||||
Set<Map.Entry<Integer, CharSequence>> entrySet = map.entrySet();
|
||||
Set<Integer> keySet = map.keySet();
|
||||
Collection<CharSequence> values = map.values();
|
||||
|
||||
@@ -115,15 +115,15 @@ public class DemoChronicleMapTest {
|
||||
}
|
||||
|
||||
interface DemoOrderVOInterface {
|
||||
public CharSequence getSymbol();
|
||||
CharSequence getSymbol();
|
||||
// public StringBuilder getUsingSymbol(StringBuilder sb);
|
||||
|
||||
public void setSymbol(@MaxSize(20) CharSequence symbol);
|
||||
void setSymbol(@MaxSize(20) CharSequence symbol);
|
||||
|
||||
public double addAtomicOrderQty(double toAdd);
|
||||
double addAtomicOrderQty(double toAdd);
|
||||
|
||||
public double getOrderQty();
|
||||
double getOrderQty();
|
||||
|
||||
public void setOrderQty(double orderQty);
|
||||
void setOrderQty(double orderQty);
|
||||
|
||||
}
|
||||
|
||||
@@ -127,9 +127,9 @@ public class ProcessInstanceLimiterMain implements Runnable {
|
||||
}
|
||||
|
||||
public interface Callback {
|
||||
public void tooManyProcessesOfType(String processType);
|
||||
void tooManyProcessesOfType(String processType);
|
||||
|
||||
public void noDefinitionForProcessesOfType(String processType);
|
||||
void noDefinitionForProcessesOfType(String processType);
|
||||
}
|
||||
|
||||
public static class Data implements Serializable {
|
||||
|
||||
@@ -36,9 +36,9 @@ public class RecursiveRefereneChMapTest {
|
||||
.objectSerializer(JDKObjectSerializer.INSTANCE).create();
|
||||
map.put("Test", new StupidCycle());
|
||||
map.put("Test2", new StupidCycle2());
|
||||
StupidCycle cycle = (StupidCycle) map.get("Test");
|
||||
StupidCycle cycle = map.get("Test");
|
||||
assertSame(cycle, cycle.cycle[0]);
|
||||
StupidCycle cycle2 = (StupidCycle) map.get("Test2");
|
||||
StupidCycle cycle2 = map.get("Test2");
|
||||
assertSame(cycle2, cycle2.cycle[0]);
|
||||
}
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ public class ReplicatedChronicleMapTest extends JSR166TestCase {
|
||||
@Test
|
||||
public void testGet() throws IOException {
|
||||
ChronicleMap map = map5();
|
||||
assertEquals("A", (String) map.get(JSR166TestCase.one));
|
||||
assertEquals("A", map.get(JSR166TestCase.one));
|
||||
ChronicleMap empty = newShmIntString();
|
||||
assertNull(map.get(JSR166TestCase.notPresent));
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class ReplicationCheckingMap<K, V> implements ChronicleMap<K, V> {
|
||||
if (r1 != null)
|
||||
Assert.assertEquals(r1.toString(), r2.toString());
|
||||
|
||||
return (R) r1;
|
||||
return r1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -160,9 +160,8 @@ public class SerializerTest {
|
||||
|
||||
MyTestClassExternalizable that = (MyTestClassExternalizable) o;
|
||||
|
||||
if (a != that.a) return false;
|
||||
return a == that.a;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -195,9 +194,8 @@ public class SerializerTest {
|
||||
|
||||
MyTestClass myTestClass = (MyTestClass) o;
|
||||
|
||||
if (a != myTestClass.a) return false;
|
||||
return a == myTestClass.a;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -227,9 +225,8 @@ public class SerializerTest {
|
||||
|
||||
MyTestClassMarshallable that = (MyTestClassMarshallable) o;
|
||||
|
||||
if (a != that.a) return false;
|
||||
return a == that.a;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -269,10 +266,8 @@ public class SerializerTest {
|
||||
|
||||
MyTestClassObjectGraph that = (MyTestClassObjectGraph) o;
|
||||
|
||||
if (delegate != null ? !delegate.equals(that.delegate) : that.delegate != null)
|
||||
return false;
|
||||
return !(delegate != null ? !delegate.equals(that.delegate) : that.delegate != null);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -134,9 +134,9 @@ public class TcpTimeBasedReplicationSoakTest {
|
||||
final ChronicleMap<Integer, CharSequence> map = rnd.nextBoolean() ? map1 : map2;
|
||||
|
||||
if (rnd.nextBoolean()) {
|
||||
map.put((int) rnd.nextInt(100), "test" + j);
|
||||
map.put(rnd.nextInt(100), "test" + j);
|
||||
} else {
|
||||
map.remove((int) rnd.nextInt(100));
|
||||
map.remove(rnd.nextInt(100));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public class LotsOfEntriesMain {
|
||||
}
|
||||
|
||||
interface MyFloats {
|
||||
public void setValueAt(@MaxSize(6) int index, float f);
|
||||
void setValueAt(@MaxSize(6) int index, float f);
|
||||
|
||||
public float getValueAt(int index);
|
||||
float getValueAt(int index);
|
||||
}
|
||||
|
||||
@@ -160,8 +160,7 @@ public class BondVOInterface$$Heap implements BondVOInterface, BytesMarshallable
|
||||
for (int i = 0; i <7; i++) {
|
||||
if(!isEqual(getMarketPxIntraDayHistoryAt(i), that.getMarketPxIntraDayHistoryAt(i))) return false;
|
||||
}
|
||||
if(!isEqual(getSymbol(), that.getSymbol())) return false;
|
||||
return true;
|
||||
return isEqual(getSymbol(), that.getSymbol());
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
||||
@@ -139,7 +139,7 @@ public class BondVOInterface$$Native
|
||||
this._bytes = bytes;
|
||||
this._offset = offset;
|
||||
for (int i = 0; i < 7; i++){
|
||||
((Byteable) _marketPxIntraDayHistory[i]).bytes(bytes,
|
||||
_marketPxIntraDayHistory[i].bytes(bytes,
|
||||
_offset + MARKETPXINTRADAYHISTORY + (i * 40));
|
||||
}
|
||||
}
|
||||
@@ -189,8 +189,7 @@ public class BondVOInterface$$Native
|
||||
if(!isEqual(getMarketPxIntraDayHistoryAt(i), that.getMarketPxIntraDayHistoryAt(i)))
|
||||
return false;
|
||||
}
|
||||
if(!isEqual(getSymbol(), that.getSymbol())) return false;
|
||||
return true;
|
||||
return isEqual(getSymbol(), that.getSymbol());
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
||||
+1
-2
@@ -116,8 +116,7 @@ public class BondVOInterface$MarketPx$$Heap implements MarketPx, BytesMarshallab
|
||||
if(!isEqual(getBidPx(), that.getBidPx())) return false;
|
||||
if(!isEqual(getCallPx(), that.getCallPx())) return false;
|
||||
if(!isEqual(getMaturityPx(), that.getMaturityPx())) return false;
|
||||
if(!isEqual(getParPx(), that.getParPx())) return false;
|
||||
return true;
|
||||
return isEqual(getParPx(), that.getParPx());
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
||||
+1
-2
@@ -151,8 +151,7 @@ public class BondVOInterface$MarketPx$$Native
|
||||
if(!isEqual(getBidPx(), that.getBidPx())) return false;
|
||||
if(!isEqual(getCallPx(), that.getCallPx())) return false;
|
||||
if(!isEqual(getMaturityPx(), that.getMaturityPx())) return false;
|
||||
if(!isEqual(getParPx(), that.getParPx())) return false;
|
||||
return true;
|
||||
return isEqual(getParPx(), that.getParPx());
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
||||
@@ -114,7 +114,7 @@ public class ChronicleMapTest extends JSR166TestCase {
|
||||
@Test(timeout = 5000)
|
||||
public void testGet() throws IOException {
|
||||
try (ChronicleMap map = map5()) {
|
||||
assertEquals("A", (String) map.get(one));
|
||||
assertEquals("A", map.get(one));
|
||||
try (ChronicleMap empty = newStrStrMap(8078)) {
|
||||
assertNull(map.get(notPresent));
|
||||
}
|
||||
|
||||
@@ -386,7 +386,7 @@ public class StatelessChronicleMapTest extends JSR166TestCase {
|
||||
@Test(timeout = 10000)
|
||||
public void testGet() throws IOException {
|
||||
try (ChronicleMap map = map5(s_port++)) {
|
||||
assertEquals("A", (String) map.get(one));
|
||||
assertEquals("A", map.get(one));
|
||||
try (ChronicleMap empty = newStrStrMap(8078)) {
|
||||
assertNull(map.get(notPresent));
|
||||
}
|
||||
|
||||
@@ -458,14 +458,14 @@ public class ProcessInstanceLimiter implements Runnable {
|
||||
* The Callback interface holds all the calls that can be made by the
|
||||
* process instance limiter.
|
||||
*/
|
||||
public static interface Callback {
|
||||
public interface Callback {
|
||||
/**
|
||||
* Called when there are already the specified number of processes of
|
||||
* the given type running, and this process is one too many.
|
||||
*
|
||||
* @param processType - the name of the type of process being limited
|
||||
*/
|
||||
public void tooManyProcessesOfType(String processType);
|
||||
void tooManyProcessesOfType(String processType);
|
||||
|
||||
/**
|
||||
* Called when there is a lock conflict in the limiter
|
||||
@@ -474,7 +474,7 @@ public class ProcessInstanceLimiter implements Runnable {
|
||||
* @param processType - the name of the type of process being limited
|
||||
* @param index - the slot number held by the other process
|
||||
*/
|
||||
public void lockConflictDetected(String processType, int index);
|
||||
void lockConflictDetected(String processType, int index);
|
||||
|
||||
/**
|
||||
* Called when another process has started and successfully acquired a
|
||||
@@ -484,7 +484,7 @@ public class ProcessInstanceLimiter implements Runnable {
|
||||
* @param slot - the slot number held by the other process
|
||||
* @param startTime - the start timestamp of the other process
|
||||
*/
|
||||
public void anotherProcessHasStartedOnSlot(String processType, int slot, long startTime);
|
||||
void anotherProcessHasStartedOnSlot(String processType, int slot, long startTime);
|
||||
|
||||
/**
|
||||
* Called when this process has started and successfully acquired a slot
|
||||
@@ -493,7 +493,7 @@ public class ProcessInstanceLimiter implements Runnable {
|
||||
* @param processType - the name of the type of process being limited
|
||||
* @param slot - the slot number held by this process
|
||||
*/
|
||||
public void thisProcessOfTypeHasStartedAtSlot(String processType, int slot);
|
||||
void thisProcessOfTypeHasStartedAtSlot(String processType, int slot);
|
||||
|
||||
/**
|
||||
* Called if the process was started but there was no data defined in
|
||||
@@ -501,7 +501,7 @@ public class ProcessInstanceLimiter implements Runnable {
|
||||
*
|
||||
* @param processType - the name of the type of process being limited
|
||||
*/
|
||||
public void noDefinitionForProcessesOfType(String processType);
|
||||
void noDefinitionForProcessesOfType(String processType);
|
||||
|
||||
/**
|
||||
* Called when another process somehow managed to steal the slot that
|
||||
@@ -510,7 +510,7 @@ public class ProcessInstanceLimiter implements Runnable {
|
||||
* @param processType - the name of the type of process being limited
|
||||
* @param slot - the slot number held by this process
|
||||
*/
|
||||
public void anotherProcessHasHijackedThisSlot(String processType, int slot);
|
||||
void anotherProcessHasHijackedThisSlot(String processType, int slot);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -519,7 +519,7 @@ public class ProcessInstanceLimiter implements Runnable {
|
||||
*
|
||||
* The Timelock field is just for locking the time field
|
||||
*/
|
||||
public static interface Data {
|
||||
public interface Data {
|
||||
void setTimeAt(@MaxSize(50) int index, long time);
|
||||
|
||||
long getTimeAt(int index);
|
||||
|
||||
Reference in New Issue
Block a user