target
stringlengths
20
113k
src_fm
stringlengths
11
86.3k
src_fm_fc
stringlengths
21
86.4k
src_fm_fc_co
stringlengths
30
86.4k
src_fm_fc_ms
stringlengths
42
86.8k
src_fm_fc_ms_ff
stringlengths
43
86.8k
@Test public void testExceptionInRegisterReceiver() { when(mContext.registerReceiver( Matchers.isNull(BroadcastReceiver.class), Matchers.any(IntentFilter.class))) .thenThrow(new SecurityException("Testing exception")); DeviceBatteryMetrics metrics = new DeviceBatteryMetrics(); DeviceBatteryMetricsCollector collector = ...
@Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(DeviceBatteryMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); snapshot.batteryLevelPct = getBatteryLevel(getBatteryIntent()); long now = SystemClock.elapsedRealtime(); synchronized (this) { if (mIsCurrentlyCharging) {...
DeviceBatteryMetricsCollector extends SystemMetricsCollector<DeviceBatteryMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(DeviceBatteryMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); snapshot.batteryLevelPct = getBatteryLevel(getBatteryIntent()); long n...
DeviceBatteryMetricsCollector extends SystemMetricsCollector<DeviceBatteryMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(DeviceBatteryMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); snapshot.batteryLevelPct = getBatteryLevel(getBatteryIntent()); long n...
DeviceBatteryMetricsCollector extends SystemMetricsCollector<DeviceBatteryMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(DeviceBatteryMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); snapshot.batteryLevelPct = getBatteryLevel(getBatteryIntent()); long n...
DeviceBatteryMetricsCollector extends SystemMetricsCollector<DeviceBatteryMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(DeviceBatteryMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); snapshot.batteryLevelPct = getBatteryLevel(getBatteryIntent()); long n...
@Test public void testSnapshotAfterValidBroadcasts() { ShadowSystemClock.setElapsedRealtime(5000); when(mContext.registerReceiver( Matchers.isNull(BroadcastReceiver.class), Matchers.any(IntentFilter.class))) .thenReturn(createBatteryIntent(BatteryManager.BATTERY_STATUS_CHARGING, 50, 100)); when(mContext.registerReceive...
@Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(DeviceBatteryMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); snapshot.batteryLevelPct = getBatteryLevel(getBatteryIntent()); long now = SystemClock.elapsedRealtime(); synchronized (this) { if (mIsCurrentlyCharging) {...
DeviceBatteryMetricsCollector extends SystemMetricsCollector<DeviceBatteryMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(DeviceBatteryMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); snapshot.batteryLevelPct = getBatteryLevel(getBatteryIntent()); long n...
DeviceBatteryMetricsCollector extends SystemMetricsCollector<DeviceBatteryMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(DeviceBatteryMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); snapshot.batteryLevelPct = getBatteryLevel(getBatteryIntent()); long n...
DeviceBatteryMetricsCollector extends SystemMetricsCollector<DeviceBatteryMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(DeviceBatteryMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); snapshot.batteryLevelPct = getBatteryLevel(getBatteryIntent()); long n...
DeviceBatteryMetricsCollector extends SystemMetricsCollector<DeviceBatteryMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(DeviceBatteryMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); snapshot.batteryLevelPct = getBatteryLevel(getBatteryIntent()); long n...
@Test public void testNullSnapshot() throws Exception { mExpectedException.expect(IllegalArgumentException.class); T instance = getClazz().newInstance(); instance.getSnapshot(null); }
public abstract boolean getSnapshot(T snapshot);
SystemMetricsCollector { public abstract boolean getSnapshot(T snapshot); }
SystemMetricsCollector { public abstract boolean getSnapshot(T snapshot); }
SystemMetricsCollector { public abstract boolean getSnapshot(T snapshot); abstract boolean getSnapshot(T snapshot); abstract T createMetrics(); }
SystemMetricsCollector { public abstract boolean getSnapshot(T snapshot); abstract boolean getSnapshot(T snapshot); abstract T createMetrics(); }
@Override @Test public void testDiff() throws Exception { MemoryMetrics a = createMemoryMetrics(1); MemoryMetrics b = createMemoryMetrics(2); MemoryMetrics sum = new MemoryMetrics(); MemoryMetricsCollector collector = new MemoryMetricsCollector(); collector.enable(); collector.getSnapshot(a); collector.getSnapshot(b); ...
@Override public MemoryMetrics diff(@Nullable MemoryMetrics b, @Nullable MemoryMetrics output) { if (output == null) { output = new MemoryMetrics(); } if (b == null) { output.set(this); } else { MemoryMetrics latest = sequenceNumber >= b.sequenceNumber ? this : b; output.sequenceNumber = latest.sequenceNumber; output.j...
MemoryMetrics extends SystemMetrics<MemoryMetrics> { @Override public MemoryMetrics diff(@Nullable MemoryMetrics b, @Nullable MemoryMetrics output) { if (output == null) { output = new MemoryMetrics(); } if (b == null) { output.set(this); } else { MemoryMetrics latest = sequenceNumber >= b.sequenceNumber ? this : b; ou...
MemoryMetrics extends SystemMetrics<MemoryMetrics> { @Override public MemoryMetrics diff(@Nullable MemoryMetrics b, @Nullable MemoryMetrics output) { if (output == null) { output = new MemoryMetrics(); } if (b == null) { output.set(this); } else { MemoryMetrics latest = sequenceNumber >= b.sequenceNumber ? this : b; ou...
MemoryMetrics extends SystemMetrics<MemoryMetrics> { @Override public MemoryMetrics diff(@Nullable MemoryMetrics b, @Nullable MemoryMetrics output) { if (output == null) { output = new MemoryMetrics(); } if (b == null) { output.set(this); } else { MemoryMetrics latest = sequenceNumber >= b.sequenceNumber ? this : b; ou...
MemoryMetrics extends SystemMetrics<MemoryMetrics> { @Override public MemoryMetrics diff(@Nullable MemoryMetrics b, @Nullable MemoryMetrics output) { if (output == null) { output = new MemoryMetrics(); } if (b == null) { output.set(this); } else { MemoryMetrics latest = sequenceNumber >= b.sequenceNumber ? this : b; ou...
@Test public void testSet() throws Exception { T a = createInitializedInstance(); T empty = createInstance(); empty.set(a); assertThat(empty).isEqualTo(a); }
public abstract T set(T b);
SystemMetrics implements Serializable { public abstract T set(T b); }
SystemMetrics implements Serializable { public abstract T set(T b); }
SystemMetrics implements Serializable { public abstract T set(T b); abstract T sum(@Nullable T b, @Nullable T output); abstract T diff(@Nullable T b, @Nullable T output); abstract T set(T b); T sum(@Nullable T b); T diff(@Nullable T b); }
SystemMetrics implements Serializable { public abstract T set(T b); abstract T sum(@Nullable T b, @Nullable T output); abstract T diff(@Nullable T b, @Nullable T output); abstract T set(T b); T sum(@Nullable T b); T diff(@Nullable T b); }
@Test public void testSum() throws Exception { T a = createInitializedInstance(); int increment = 1; for (Field field : getClazz().getFields()) { if (MetricsUtil.isNumericField(field)) { field.set(a, 2 * increment); increment += 1; } } T b = createInitializedInstance(); T sum = createInstance(); a.sum(b, sum); incremen...
public abstract T sum(@Nullable T b, @Nullable T output);
SystemMetrics implements Serializable { public abstract T sum(@Nullable T b, @Nullable T output); }
SystemMetrics implements Serializable { public abstract T sum(@Nullable T b, @Nullable T output); }
SystemMetrics implements Serializable { public abstract T sum(@Nullable T b, @Nullable T output); abstract T sum(@Nullable T b, @Nullable T output); abstract T diff(@Nullable T b, @Nullable T output); abstract T set(T b); T sum(@Nullable T b); T diff(@Nullable T b); }
SystemMetrics implements Serializable { public abstract T sum(@Nullable T b, @Nullable T output); abstract T sum(@Nullable T b, @Nullable T output); abstract T diff(@Nullable T b, @Nullable T output); abstract T set(T b); T sum(@Nullable T b); T diff(@Nullable T b); }
@Test public void testDiff() throws Exception { T a = createInitializedInstance(); T b = createInitializedInstance(); T diff = createInitializedInstance(); int index = 1; for (Field field : getClazz().getFields()) { if (MetricsUtil.isNumericField(field)) { field.set(a, 2 * index); index += 1; } } a.diff(b, diff); int i...
public abstract T diff(@Nullable T b, @Nullable T output);
SystemMetrics implements Serializable { public abstract T diff(@Nullable T b, @Nullable T output); }
SystemMetrics implements Serializable { public abstract T diff(@Nullable T b, @Nullable T output); }
SystemMetrics implements Serializable { public abstract T diff(@Nullable T b, @Nullable T output); abstract T sum(@Nullable T b, @Nullable T output); abstract T diff(@Nullable T b, @Nullable T output); abstract T set(T b); T sum(@Nullable T b); T diff(@Nullable T b); }
SystemMetrics implements Serializable { public abstract T diff(@Nullable T b, @Nullable T output); abstract T sum(@Nullable T b, @Nullable T output); abstract T diff(@Nullable T b, @Nullable T output); abstract T set(T b); T sum(@Nullable T b); T diff(@Nullable T b); }
@Test public void testNullOutput() throws Exception { T instanceA = createInitializedInstance(); T instanceB = createInitializedInstance(); T diff = instanceA.diff(instanceB, null); assertThat(diff).isNotNull(); }
public abstract T diff(@Nullable T b, @Nullable T output);
SystemMetrics implements Serializable { public abstract T diff(@Nullable T b, @Nullable T output); }
SystemMetrics implements Serializable { public abstract T diff(@Nullable T b, @Nullable T output); }
SystemMetrics implements Serializable { public abstract T diff(@Nullable T b, @Nullable T output); abstract T sum(@Nullable T b, @Nullable T output); abstract T diff(@Nullable T b, @Nullable T output); abstract T set(T b); T sum(@Nullable T b); T diff(@Nullable T b); }
SystemMetrics implements Serializable { public abstract T diff(@Nullable T b, @Nullable T output); abstract T sum(@Nullable T b, @Nullable T output); abstract T diff(@Nullable T b, @Nullable T output); abstract T set(T b); T sum(@Nullable T b); T diff(@Nullable T b); }
@Test public void testNullSubtrahend() throws Exception { T instanceA = createInitializedInstance(); T diff = createInitializedInstance(); instanceA.diff(null, diff); assertThat(instanceA).isEqualTo(diff); }
public abstract T diff(@Nullable T b, @Nullable T output);
SystemMetrics implements Serializable { public abstract T diff(@Nullable T b, @Nullable T output); }
SystemMetrics implements Serializable { public abstract T diff(@Nullable T b, @Nullable T output); }
SystemMetrics implements Serializable { public abstract T diff(@Nullable T b, @Nullable T output); abstract T sum(@Nullable T b, @Nullable T output); abstract T diff(@Nullable T b, @Nullable T output); abstract T set(T b); T sum(@Nullable T b); T diff(@Nullable T b); }
SystemMetrics implements Serializable { public abstract T diff(@Nullable T b, @Nullable T output); abstract T sum(@Nullable T b, @Nullable T output); abstract T diff(@Nullable T b, @Nullable T output); abstract T set(T b); T sum(@Nullable T b); T diff(@Nullable T b); }
@Test public void testReset() throws Exception { String contents = "notanumber"; String testPath = createFile(contents); ProcFileReader reader = new ProcFileReader(testPath).start(); assertThat(reader.readWord(CharBuffer.allocate(20)).toString()).isEqualTo(contents); assertThat(reader.hasReachedEOF()).isTrue(); reader....
public ProcFileReader reset() { mIsValid = true; if (mFile != null) { try { mFile.seek(0); } catch (IOException ioe) { close(); } } if (mFile == null) { try { mFile = new RandomAccessFile(mPath, "r"); } catch (IOException ioe) { mIsValid = false; close(); } } if (mIsValid) { mPosition = -1; mBufferSize = 0; mChar = 0; ...
ProcFileReader { public ProcFileReader reset() { mIsValid = true; if (mFile != null) { try { mFile.seek(0); } catch (IOException ioe) { close(); } } if (mFile == null) { try { mFile = new RandomAccessFile(mPath, "r"); } catch (IOException ioe) { mIsValid = false; close(); } } if (mIsValid) { mPosition = -1; mBufferSize...
ProcFileReader { public ProcFileReader reset() { mIsValid = true; if (mFile != null) { try { mFile.seek(0); } catch (IOException ioe) { close(); } } if (mFile == null) { try { mFile = new RandomAccessFile(mPath, "r"); } catch (IOException ioe) { mIsValid = false; close(); } } if (mIsValid) { mPosition = -1; mBufferSize...
ProcFileReader { public ProcFileReader reset() { mIsValid = true; if (mFile != null) { try { mFile.seek(0); } catch (IOException ioe) { close(); } } if (mFile == null) { try { mFile = new RandomAccessFile(mPath, "r"); } catch (IOException ioe) { mIsValid = false; close(); } } if (mIsValid) { mPosition = -1; mBufferSize...
ProcFileReader { public ProcFileReader reset() { mIsValid = true; if (mFile != null) { try { mFile.seek(0); } catch (IOException ioe) { close(); } } if (mFile == null) { try { mFile = new RandomAccessFile(mPath, "r"); } catch (IOException ioe) { mIsValid = false; close(); } } if (mIsValid) { mPosition = -1; mBufferSize...
@Test public void testGetLatestDiffAndReset() throws Exception { DummyMetricCollector collector = new DummyMetricCollector(); collector.currentValue = 10; StatefulSystemMetricsCollector<DummyMetric, DummyMetricCollector> statefulCollector = new StatefulSystemMetricsCollector<>(collector); assertThat(statefulCollector.g...
@Nullable public R getLatestDiffAndReset() { if (getLatestDiff() == null) { return null; } R temp = mPrev; mPrev = mCurr; mCurr = temp; return mDiff; }
StatefulSystemMetricsCollector { @Nullable public R getLatestDiffAndReset() { if (getLatestDiff() == null) { return null; } R temp = mPrev; mPrev = mCurr; mCurr = temp; return mDiff; } }
StatefulSystemMetricsCollector { @Nullable public R getLatestDiffAndReset() { if (getLatestDiff() == null) { return null; } R temp = mPrev; mPrev = mCurr; mCurr = temp; return mDiff; } StatefulSystemMetricsCollector(S collector); StatefulSystemMetricsCollector(S collector, R curr, R prev, R diff); }
StatefulSystemMetricsCollector { @Nullable public R getLatestDiffAndReset() { if (getLatestDiff() == null) { return null; } R temp = mPrev; mPrev = mCurr; mCurr = temp; return mDiff; } StatefulSystemMetricsCollector(S collector); StatefulSystemMetricsCollector(S collector, R curr, R prev, R diff); S getCollector(); @N...
StatefulSystemMetricsCollector { @Nullable public R getLatestDiffAndReset() { if (getLatestDiff() == null) { return null; } R temp = mPrev; mPrev = mCurr; mCurr = temp; return mDiff; } StatefulSystemMetricsCollector(S collector); StatefulSystemMetricsCollector(S collector, R curr, R prev, R diff); S getCollector(); @N...
@Test public void testCustomBaseSnapshot() throws Exception { DummyMetric metric = new DummyMetric(); metric.value = 0; DummyMetricCollector collector = new DummyMetricCollector(); collector.currentValue = 10; StatefulSystemMetricsCollector<DummyMetric, DummyMetricCollector> withCustomInitialSnapshot = new StatefulSyst...
@Nullable public R getLatestDiff() { mIsValid &= mCollector.getSnapshot(this.mCurr); if (!mIsValid) { return null; } mCurr.diff(mPrev, mDiff); return mDiff; }
StatefulSystemMetricsCollector { @Nullable public R getLatestDiff() { mIsValid &= mCollector.getSnapshot(this.mCurr); if (!mIsValid) { return null; } mCurr.diff(mPrev, mDiff); return mDiff; } }
StatefulSystemMetricsCollector { @Nullable public R getLatestDiff() { mIsValid &= mCollector.getSnapshot(this.mCurr); if (!mIsValid) { return null; } mCurr.diff(mPrev, mDiff); return mDiff; } StatefulSystemMetricsCollector(S collector); StatefulSystemMetricsCollector(S collector, R curr, R prev, R diff); }
StatefulSystemMetricsCollector { @Nullable public R getLatestDiff() { mIsValid &= mCollector.getSnapshot(this.mCurr); if (!mIsValid) { return null; } mCurr.diff(mPrev, mDiff); return mDiff; } StatefulSystemMetricsCollector(S collector); StatefulSystemMetricsCollector(S collector, R curr, R prev, R diff); S getCollecto...
StatefulSystemMetricsCollector { @Nullable public R getLatestDiff() { mIsValid &= mCollector.getSnapshot(this.mCurr); if (!mIsValid) { return null; } mCurr.diff(mPrev, mDiff); return mDiff; } StatefulSystemMetricsCollector(S collector); StatefulSystemMetricsCollector(S collector, R curr, R prev, R diff); S getCollecto...
@Test public void testGetLatestDiff() { DummyMetricCollector collector = new DummyMetricCollector(); collector.currentValue = 10; StatefulSystemMetricsCollector<DummyMetric, DummyMetricCollector> statefulCollector = new StatefulSystemMetricsCollector<>(collector); assertThat(statefulCollector.getLatestDiff().value).isE...
@Nullable public R getLatestDiff() { mIsValid &= mCollector.getSnapshot(this.mCurr); if (!mIsValid) { return null; } mCurr.diff(mPrev, mDiff); return mDiff; }
StatefulSystemMetricsCollector { @Nullable public R getLatestDiff() { mIsValid &= mCollector.getSnapshot(this.mCurr); if (!mIsValid) { return null; } mCurr.diff(mPrev, mDiff); return mDiff; } }
StatefulSystemMetricsCollector { @Nullable public R getLatestDiff() { mIsValid &= mCollector.getSnapshot(this.mCurr); if (!mIsValid) { return null; } mCurr.diff(mPrev, mDiff); return mDiff; } StatefulSystemMetricsCollector(S collector); StatefulSystemMetricsCollector(S collector, R curr, R prev, R diff); }
StatefulSystemMetricsCollector { @Nullable public R getLatestDiff() { mIsValid &= mCollector.getSnapshot(this.mCurr); if (!mIsValid) { return null; } mCurr.diff(mPrev, mDiff); return mDiff; } StatefulSystemMetricsCollector(S collector); StatefulSystemMetricsCollector(S collector, R curr, R prev, R diff); S getCollecto...
StatefulSystemMetricsCollector { @Nullable public R getLatestDiff() { mIsValid &= mCollector.getSnapshot(this.mCurr); if (!mIsValid) { return null; } mCurr.diff(mPrev, mDiff); return mDiff; } StatefulSystemMetricsCollector(S collector); StatefulSystemMetricsCollector(S collector, R curr, R prev, R diff); S getCollecto...
@Test public void testEquals() { HealthStatsMetrics metricsA = new HealthStatsMetrics(); HealthStatsMetrics metricsB = new HealthStatsMetrics(); assertThat(metricsA).isEqualTo(metricsB); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; HealthStatsMetrics that = (HealthStatsMetrics) o; if (dataType != null ? !dataType.equals(that.dataType) : that.dataType != null) return false; return Utilities.sparseArrayEquals(measuremen...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; HealthStatsMetrics that = (HealthStatsMetrics) o; if (dataType != null ? !dataType.equals(that.dataType) : that.dataType != nu...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; HealthStatsMetrics that = (HealthStatsMetrics) o; if (dataType != null ? !dataType.equals(that.dataType) : that.dataType != nu...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; HealthStatsMetrics that = (HealthStatsMetrics) o; if (dataType != null ? !dataType.equals(that.dataType) : that.dataType != nu...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; HealthStatsMetrics that = (HealthStatsMetrics) o; if (dataType != null ? !dataType.equals(that.dataType) : that.dataType != nu...
@Test public void testEquals() { assertThat(new SensorMetrics()).isEqualTo(new SensorMetrics()); assertThat(createAttributedMetrics()).isEqualTo(createAttributedMetrics()); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } SensorMetrics that = (SensorMetrics) o; return isAttributionEnabled == that.isAttributionEnabled && total.equals(that.total) && Utilities.sparseArrayEquals(sensorConsumption, that.s...
SensorMetrics extends SystemMetrics<SensorMetrics> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } SensorMetrics that = (SensorMetrics) o; return isAttributionEnabled == that.isAttributionEnabled && total.equals(that.total) && ...
SensorMetrics extends SystemMetrics<SensorMetrics> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } SensorMetrics that = (SensorMetrics) o; return isAttributionEnabled == that.isAttributionEnabled && total.equals(that.total) && ...
SensorMetrics extends SystemMetrics<SensorMetrics> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } SensorMetrics that = (SensorMetrics) o; return isAttributionEnabled == that.isAttributionEnabled && total.equals(that.total) && ...
SensorMetrics extends SystemMetrics<SensorMetrics> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } SensorMetrics that = (SensorMetrics) o; return isAttributionEnabled == that.isAttributionEnabled && total.equals(that.total) && ...
@Test public void testSetUninitialized() { HealthStatsMetrics initialized = createTestMetrics(); HealthStatsMetrics uninitialized = new HealthStatsMetrics(); uninitialized.set(initialized); assertThat(uninitialized).isEqualTo(initialized); }
@Override public HealthStatsMetrics set(HealthStatsMetrics b) { dataType = b.dataType; measurement.clear(); for (int i = 0; i < b.measurement.size(); i++) { measurement.append(b.measurement.keyAt(i), b.measurement.valueAt(i)); } timer.clear(); for (int i = 0; i < b.timer.size(); i++) { timer.append(b.timer.keyAt(i), ne...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @Override public HealthStatsMetrics set(HealthStatsMetrics b) { dataType = b.dataType; measurement.clear(); for (int i = 0; i < b.measurement.size(); i++) { measurement.append(b.measurement.keyAt(i), b.measurement.valueAt(i)); } timer.clear(); for (int i = ...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @Override public HealthStatsMetrics set(HealthStatsMetrics b) { dataType = b.dataType; measurement.clear(); for (int i = 0; i < b.measurement.size(); i++) { measurement.append(b.measurement.keyAt(i), b.measurement.valueAt(i)); } timer.clear(); for (int i = ...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @Override public HealthStatsMetrics set(HealthStatsMetrics b) { dataType = b.dataType; measurement.clear(); for (int i = 0; i < b.measurement.size(); i++) { measurement.append(b.measurement.keyAt(i), b.measurement.valueAt(i)); } timer.clear(); for (int i = ...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @Override public HealthStatsMetrics set(HealthStatsMetrics b) { dataType = b.dataType; measurement.clear(); for (int i = 0; i < b.measurement.size(); i++) { measurement.append(b.measurement.keyAt(i), b.measurement.valueAt(i)); } timer.clear(); for (int i = ...
@Test public void testSetInitialized() throws Exception { HealthStatsMetrics initialized = createTestMetrics(); HealthStatsMetrics uninitialized = new HealthStatsMetrics(); initialized.set(uninitialized); assertThat(uninitialized).isEqualTo(initialized); }
@Override public HealthStatsMetrics set(HealthStatsMetrics b) { dataType = b.dataType; measurement.clear(); for (int i = 0; i < b.measurement.size(); i++) { measurement.append(b.measurement.keyAt(i), b.measurement.valueAt(i)); } timer.clear(); for (int i = 0; i < b.timer.size(); i++) { timer.append(b.timer.keyAt(i), ne...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @Override public HealthStatsMetrics set(HealthStatsMetrics b) { dataType = b.dataType; measurement.clear(); for (int i = 0; i < b.measurement.size(); i++) { measurement.append(b.measurement.keyAt(i), b.measurement.valueAt(i)); } timer.clear(); for (int i = ...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @Override public HealthStatsMetrics set(HealthStatsMetrics b) { dataType = b.dataType; measurement.clear(); for (int i = 0; i < b.measurement.size(); i++) { measurement.append(b.measurement.keyAt(i), b.measurement.valueAt(i)); } timer.clear(); for (int i = ...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @Override public HealthStatsMetrics set(HealthStatsMetrics b) { dataType = b.dataType; measurement.clear(); for (int i = 0; i < b.measurement.size(); i++) { measurement.append(b.measurement.keyAt(i), b.measurement.valueAt(i)); } timer.clear(); for (int i = ...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @Override public HealthStatsMetrics set(HealthStatsMetrics b) { dataType = b.dataType; measurement.clear(); for (int i = 0; i < b.measurement.size(); i++) { measurement.append(b.measurement.keyAt(i), b.measurement.valueAt(i)); } timer.clear(); for (int i = ...
@Test public void testSumArrayMaps() { ArrayMap<String, Long> a = new ArrayMap<>(); a.put("a", 1L); a.put("c", 2L); ArrayMap<String, Long> b = new ArrayMap<>(); b.put("b", 1L); b.put("c", 3L); ArrayMap<String, Long> sum = HealthStatsMetrics.opArrayMaps(OP_SUM, a, b); assertThat(sum.get("a")).isEqualTo(1); assertThat(su...
@VisibleForTesting static <K, V> ArrayMap<K, V> opArrayMaps(int op, ArrayMap<K, V> a, @Nullable ArrayMap<K, V> b) { int aSize = a.size(); ArrayMap<K, V> output = new ArrayMap<>(); for (int i = 0; i < aSize; i++) { K key = a.keyAt(i); V bValue = b == null ? null : b.get(key); output.put(key, bValue == null ? a.valueAt(i...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @VisibleForTesting static <K, V> ArrayMap<K, V> opArrayMaps(int op, ArrayMap<K, V> a, @Nullable ArrayMap<K, V> b) { int aSize = a.size(); ArrayMap<K, V> output = new ArrayMap<>(); for (int i = 0; i < aSize; i++) { K key = a.keyAt(i); V bValue = b == null ? ...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @VisibleForTesting static <K, V> ArrayMap<K, V> opArrayMaps(int op, ArrayMap<K, V> a, @Nullable ArrayMap<K, V> b) { int aSize = a.size(); ArrayMap<K, V> output = new ArrayMap<>(); for (int i = 0; i < aSize; i++) { K key = a.keyAt(i); V bValue = b == null ? ...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @VisibleForTesting static <K, V> ArrayMap<K, V> opArrayMaps(int op, ArrayMap<K, V> a, @Nullable ArrayMap<K, V> b) { int aSize = a.size(); ArrayMap<K, V> output = new ArrayMap<>(); for (int i = 0; i < aSize; i++) { K key = a.keyAt(i); V bValue = b == null ? ...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @VisibleForTesting static <K, V> ArrayMap<K, V> opArrayMaps(int op, ArrayMap<K, V> a, @Nullable ArrayMap<K, V> b) { int aSize = a.size(); ArrayMap<K, V> output = new ArrayMap<>(); for (int i = 0; i < aSize; i++) { K key = a.keyAt(i); V bValue = b == null ? ...
@Test public void testDiffArrayMaps() { ArrayMap<String, Long> a = new ArrayMap<>(); a.put("a", 1L); a.put("c", 2L); ArrayMap<String, Long> b = new ArrayMap<>(); b.put("b", 1L); b.put("c", 3L); ArrayMap<String, Long> sum = HealthStatsMetrics.opArrayMaps(OP_DIFF, a, b); assertThat(sum.get("a")).isEqualTo(1); assertThat(...
@VisibleForTesting static <K, V> ArrayMap<K, V> opArrayMaps(int op, ArrayMap<K, V> a, @Nullable ArrayMap<K, V> b) { int aSize = a.size(); ArrayMap<K, V> output = new ArrayMap<>(); for (int i = 0; i < aSize; i++) { K key = a.keyAt(i); V bValue = b == null ? null : b.get(key); output.put(key, bValue == null ? a.valueAt(i...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @VisibleForTesting static <K, V> ArrayMap<K, V> opArrayMaps(int op, ArrayMap<K, V> a, @Nullable ArrayMap<K, V> b) { int aSize = a.size(); ArrayMap<K, V> output = new ArrayMap<>(); for (int i = 0; i < aSize; i++) { K key = a.keyAt(i); V bValue = b == null ? ...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @VisibleForTesting static <K, V> ArrayMap<K, V> opArrayMaps(int op, ArrayMap<K, V> a, @Nullable ArrayMap<K, V> b) { int aSize = a.size(); ArrayMap<K, V> output = new ArrayMap<>(); for (int i = 0; i < aSize; i++) { K key = a.keyAt(i); V bValue = b == null ? ...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @VisibleForTesting static <K, V> ArrayMap<K, V> opArrayMaps(int op, ArrayMap<K, V> a, @Nullable ArrayMap<K, V> b) { int aSize = a.size(); ArrayMap<K, V> output = new ArrayMap<>(); for (int i = 0; i < aSize; i++) { K key = a.keyAt(i); V bValue = b == null ? ...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @VisibleForTesting static <K, V> ArrayMap<K, V> opArrayMaps(int op, ArrayMap<K, V> a, @Nullable ArrayMap<K, V> b) { int aSize = a.size(); ArrayMap<K, V> output = new ArrayMap<>(); for (int i = 0; i < aSize; i++) { K key = a.keyAt(i); V bValue = b == null ? ...
@Test public void testSumSparseArrays() { SparseArray<Long> a = new SparseArray<>(); a.put(10, 10L); a.put(30, 30L); SparseArray<Long> b = new SparseArray<>(); b.put(10, 10L); b.put(20, 20L); SparseArray<Long> sum = new SparseArray<>(); HealthStatsMetrics.op(OP_SUM, a, b, sum); assertThat(sum.get(10)).isEqualTo(20); as...
@VisibleForTesting static <K> SparseArray<K> op(int op, SparseArray<K> a, SparseArray<K> b, SparseArray<K> output) { output.clear(); for (int i = 0; i < a.size(); i++) { int aKey = a.keyAt(i); output.put(aKey, (K) opValues(op, a.valueAt(i), b.get(aKey))); } if (op == OP_SUM) { for (int i = 0; i < b.size(); i++) { int b...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @VisibleForTesting static <K> SparseArray<K> op(int op, SparseArray<K> a, SparseArray<K> b, SparseArray<K> output) { output.clear(); for (int i = 0; i < a.size(); i++) { int aKey = a.keyAt(i); output.put(aKey, (K) opValues(op, a.valueAt(i), b.get(aKey))); }...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @VisibleForTesting static <K> SparseArray<K> op(int op, SparseArray<K> a, SparseArray<K> b, SparseArray<K> output) { output.clear(); for (int i = 0; i < a.size(); i++) { int aKey = a.keyAt(i); output.put(aKey, (K) opValues(op, a.valueAt(i), b.get(aKey))); }...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @VisibleForTesting static <K> SparseArray<K> op(int op, SparseArray<K> a, SparseArray<K> b, SparseArray<K> output) { output.clear(); for (int i = 0; i < a.size(); i++) { int aKey = a.keyAt(i); output.put(aKey, (K) opValues(op, a.valueAt(i), b.get(aKey))); }...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @VisibleForTesting static <K> SparseArray<K> op(int op, SparseArray<K> a, SparseArray<K> b, SparseArray<K> output) { output.clear(); for (int i = 0; i < a.size(); i++) { int aKey = a.keyAt(i); output.put(aKey, (K) opValues(op, a.valueAt(i), b.get(aKey))); }...
@Test public void testDiffSparseArrays() { SparseArray<Long> a = new SparseArray<>(); a.put(10, 10L); a.put(30, 30L); SparseArray<Long> b = new SparseArray<>(); b.put(10, 10L); b.put(20, 20L); SparseArray<Long> sum = new SparseArray<>(); HealthStatsMetrics.op(OP_DIFF, a, b, sum); assertThat(sum.get(10)).isEqualTo(0); a...
@VisibleForTesting static <K> SparseArray<K> op(int op, SparseArray<K> a, SparseArray<K> b, SparseArray<K> output) { output.clear(); for (int i = 0; i < a.size(); i++) { int aKey = a.keyAt(i); output.put(aKey, (K) opValues(op, a.valueAt(i), b.get(aKey))); } if (op == OP_SUM) { for (int i = 0; i < b.size(); i++) { int b...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @VisibleForTesting static <K> SparseArray<K> op(int op, SparseArray<K> a, SparseArray<K> b, SparseArray<K> output) { output.clear(); for (int i = 0; i < a.size(); i++) { int aKey = a.keyAt(i); output.put(aKey, (K) opValues(op, a.valueAt(i), b.get(aKey))); }...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @VisibleForTesting static <K> SparseArray<K> op(int op, SparseArray<K> a, SparseArray<K> b, SparseArray<K> output) { output.clear(); for (int i = 0; i < a.size(); i++) { int aKey = a.keyAt(i); output.put(aKey, (K) opValues(op, a.valueAt(i), b.get(aKey))); }...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @VisibleForTesting static <K> SparseArray<K> op(int op, SparseArray<K> a, SparseArray<K> b, SparseArray<K> output) { output.clear(); for (int i = 0; i < a.size(); i++) { int aKey = a.keyAt(i); output.put(aKey, (K) opValues(op, a.valueAt(i), b.get(aKey))); }...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @VisibleForTesting static <K> SparseArray<K> op(int op, SparseArray<K> a, SparseArray<K> b, SparseArray<K> output) { output.clear(); for (int i = 0; i < a.size(); i++) { int aKey = a.keyAt(i); output.put(aKey, (K) opValues(op, a.valueAt(i), b.get(aKey))); }...
@Test public void testSum() { HealthStatsMetrics a = createTestMetrics(); HealthStatsMetrics b = createTestMetrics(); HealthStatsMetrics sum = a.sum(b, null); HealthStatsMetrics expectedSum = new HealthStatsMetrics(); expectedSum.dataType = TEST_DATATYPE; expectedSum.measurement.put(123, 2000L); expectedSum.measurement...
@Override public HealthStatsMetrics sum( @Nullable HealthStatsMetrics b, @Nullable HealthStatsMetrics output) { if (output == null) { output = new HealthStatsMetrics(); } output.dataType = dataType; if (b == null) { output.set(this); } else if (!strEquals(b.dataType, dataType)) { throw new IllegalArgumentException( "At...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @Override public HealthStatsMetrics sum( @Nullable HealthStatsMetrics b, @Nullable HealthStatsMetrics output) { if (output == null) { output = new HealthStatsMetrics(); } output.dataType = dataType; if (b == null) { output.set(this); } else if (!strEquals(b...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @Override public HealthStatsMetrics sum( @Nullable HealthStatsMetrics b, @Nullable HealthStatsMetrics output) { if (output == null) { output = new HealthStatsMetrics(); } output.dataType = dataType; if (b == null) { output.set(this); } else if (!strEquals(b...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @Override public HealthStatsMetrics sum( @Nullable HealthStatsMetrics b, @Nullable HealthStatsMetrics output) { if (output == null) { output = new HealthStatsMetrics(); } output.dataType = dataType; if (b == null) { output.set(this); } else if (!strEquals(b...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @Override public HealthStatsMetrics sum( @Nullable HealthStatsMetrics b, @Nullable HealthStatsMetrics output) { if (output == null) { output = new HealthStatsMetrics(); } output.dataType = dataType; if (b == null) { output.set(this); } else if (!strEquals(b...
@Test public void testDiff() { HealthStatsMetrics a = createTestMetrics(); HealthStatsMetrics b = createTestMetrics(); HealthStatsMetrics diff = a.diff(b, null); HealthStatsMetrics expectedDiff = new HealthStatsMetrics(); expectedDiff.dataType = TEST_DATATYPE; expectedDiff.measurement.put(123, 0L); expectedDiff.measure...
@Override public HealthStatsMetrics diff( @Nullable HealthStatsMetrics b, @Nullable HealthStatsMetrics output) { if (output == null) { output = new HealthStatsMetrics(); } output.dataType = dataType; if (b == null || compareSnapshotAge(this, b) < 0 ) { output.set(this); } else if (!strEquals(b.dataType, dataType)) { th...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @Override public HealthStatsMetrics diff( @Nullable HealthStatsMetrics b, @Nullable HealthStatsMetrics output) { if (output == null) { output = new HealthStatsMetrics(); } output.dataType = dataType; if (b == null || compareSnapshotAge(this, b) < 0 ) { outp...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @Override public HealthStatsMetrics diff( @Nullable HealthStatsMetrics b, @Nullable HealthStatsMetrics output) { if (output == null) { output = new HealthStatsMetrics(); } output.dataType = dataType; if (b == null || compareSnapshotAge(this, b) < 0 ) { outp...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @Override public HealthStatsMetrics diff( @Nullable HealthStatsMetrics b, @Nullable HealthStatsMetrics output) { if (output == null) { output = new HealthStatsMetrics(); } output.dataType = dataType; if (b == null || compareSnapshotAge(this, b) < 0 ) { outp...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @Override public HealthStatsMetrics diff( @Nullable HealthStatsMetrics b, @Nullable HealthStatsMetrics output) { if (output == null) { output = new HealthStatsMetrics(); } output.dataType = dataType; if (b == null || compareSnapshotAge(this, b) < 0 ) { outp...
@Test public void testDiffWithReset() { HealthStatsMetrics a = createTestMetrics(); a.measurement.put(UidHealthStats.MEASUREMENT_REALTIME_BATTERY_MS, 100L); HealthStatsMetrics b = createTestMetrics(); b.measurement.put(UidHealthStats.MEASUREMENT_REALTIME_BATTERY_MS, 200L); HealthStatsMetrics output = a.diff(b, null); H...
@Override public HealthStatsMetrics diff( @Nullable HealthStatsMetrics b, @Nullable HealthStatsMetrics output) { if (output == null) { output = new HealthStatsMetrics(); } output.dataType = dataType; if (b == null || compareSnapshotAge(this, b) < 0 ) { output.set(this); } else if (!strEquals(b.dataType, dataType)) { th...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @Override public HealthStatsMetrics diff( @Nullable HealthStatsMetrics b, @Nullable HealthStatsMetrics output) { if (output == null) { output = new HealthStatsMetrics(); } output.dataType = dataType; if (b == null || compareSnapshotAge(this, b) < 0 ) { outp...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @Override public HealthStatsMetrics diff( @Nullable HealthStatsMetrics b, @Nullable HealthStatsMetrics output) { if (output == null) { output = new HealthStatsMetrics(); } output.dataType = dataType; if (b == null || compareSnapshotAge(this, b) < 0 ) { outp...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @Override public HealthStatsMetrics diff( @Nullable HealthStatsMetrics b, @Nullable HealthStatsMetrics output) { if (output == null) { output = new HealthStatsMetrics(); } output.dataType = dataType; if (b == null || compareSnapshotAge(this, b) < 0 ) { outp...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { @Override public HealthStatsMetrics diff( @Nullable HealthStatsMetrics b, @Nullable HealthStatsMetrics output) { if (output == null) { output = new HealthStatsMetrics(); } output.dataType = dataType; if (b == null || compareSnapshotAge(this, b) < 0 ) { outp...
@Test public void datatypeToJSON() throws Exception { HealthStatsMetrics metrics = new HealthStatsMetrics(); metrics.dataType = TEST_DATATYPE; JSONObject json = metrics.toJSONObject(); assertThat(json.getString("type")).isEqualTo(TEST_DATATYPE); }
public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
@Test public void testSet() { SensorMetrics metrics = new SensorMetrics(true); metrics.set(createAttributedMetrics()); assertThat(metrics).isEqualTo(createAttributedMetrics()); }
@Override public SensorMetrics set(SensorMetrics b) { total.set(b.total); if (isAttributionEnabled && b.isAttributionEnabled) { sensorConsumption.clear(); for (int i = 0, l = b.sensorConsumption.size(); i < l; i++) { sensorConsumption.put(b.sensorConsumption.keyAt(i), b.sensorConsumption.valueAt(i)); } } return this; }
SensorMetrics extends SystemMetrics<SensorMetrics> { @Override public SensorMetrics set(SensorMetrics b) { total.set(b.total); if (isAttributionEnabled && b.isAttributionEnabled) { sensorConsumption.clear(); for (int i = 0, l = b.sensorConsumption.size(); i < l; i++) { sensorConsumption.put(b.sensorConsumption.keyAt(i)...
SensorMetrics extends SystemMetrics<SensorMetrics> { @Override public SensorMetrics set(SensorMetrics b) { total.set(b.total); if (isAttributionEnabled && b.isAttributionEnabled) { sensorConsumption.clear(); for (int i = 0, l = b.sensorConsumption.size(); i < l; i++) { sensorConsumption.put(b.sensorConsumption.keyAt(i)...
SensorMetrics extends SystemMetrics<SensorMetrics> { @Override public SensorMetrics set(SensorMetrics b) { total.set(b.total); if (isAttributionEnabled && b.isAttributionEnabled) { sensorConsumption.clear(); for (int i = 0, l = b.sensorConsumption.size(); i < l; i++) { sensorConsumption.put(b.sensorConsumption.keyAt(i)...
SensorMetrics extends SystemMetrics<SensorMetrics> { @Override public SensorMetrics set(SensorMetrics b) { total.set(b.total); if (isAttributionEnabled && b.isAttributionEnabled) { sensorConsumption.clear(); for (int i = 0, l = b.sensorConsumption.size(); i < l; i++) { sensorConsumption.put(b.sensorConsumption.keyAt(i)...
@Test public void measurementToJSON() throws Exception { HealthStatsMetrics metrics = new HealthStatsMetrics(); metrics.measurement.put(234, 345L); JSONObject json = metrics.toJSONObject(); assertThat(json.getJSONObject("measurement").getLong("234")).isEqualTo(345L); }
public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
@Test public void timerToJSON() throws Exception { HealthStatsMetrics metrics = new HealthStatsMetrics(); metrics.timer.put(123, new HealthStatsMetrics.TimerMetrics(1, 11)); JSONObject json = metrics.toJSONObject(); assertThat(json.getJSONObject("timer")).isNotNull(); assertThat(json.getJSONObject("timer").getJSONObjec...
public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
@Test public void measurementsToJSON() throws Exception { HealthStatsMetrics metrics = new HealthStatsMetrics(); metrics.measurements.put(234, new ArrayMap<String, Long>()); metrics.measurements.get(234).put("abcd", 2000L); JSONObject json = metrics.toJSONObject(); assertThat(json.getJSONObject("measurements").getJSONO...
public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
@Test public void timersToJSON() throws Exception { HealthStatsMetrics metrics = new HealthStatsMetrics(); metrics.timers.put(345, new ArrayMap<String, HealthStatsMetrics.TimerMetrics>()); metrics.timers.get(345).put("val", new HealthStatsMetrics.TimerMetrics(23, 24)); JSONObject json = metrics.toJSONObject(); assertTh...
public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
@Test public void jsonConversionSkipsEmptyContainers() throws Exception { HealthStatsMetrics metrics = new HealthStatsMetrics(); assertThat(metrics.toJSONObject().length()).isEqualTo(0); }
public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
@Test public void jsonConversionSkipsZeroMeasurement() throws Exception { HealthStatsMetrics metrics = new HealthStatsMetrics(); metrics.measurement.put(123, 0L); assertThat(metrics.toJSONObject().length()).isEqualTo(0); }
public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
@Test public void jsonConversionSkipsZeroTimer() throws Exception { HealthStatsMetrics metrics = new HealthStatsMetrics(); metrics.timer.put(123, new HealthStatsMetrics.TimerMetrics(0, 0)); assertThat(metrics.toJSONObject().length()).isEqualTo(0); }
public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
@Test public void jsonConversionDoesNotSkipPartialZeroTimer() throws Exception { HealthStatsMetrics metrics = new HealthStatsMetrics(); metrics.timer.put(123, new HealthStatsMetrics.TimerMetrics(0, 2)); metrics.timer.put(234, new HealthStatsMetrics.TimerMetrics(2, 0)); assertThat(metrics.toJSONObject().getJSONObject("t...
public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
@Test public void jsonConversionSkipsZeroMeasurements() throws Exception { HealthStatsMetrics metrics = new HealthStatsMetrics(); metrics.measurements.put(234, new ArrayMap<String, Long>()); metrics.measurements.get(234).put("abcd", 0L); assertThat(metrics.toJSONObject().length()).isEqualTo(0); }
public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
@Test public void jsonConversionSkipsZeroTimers() throws Exception { HealthStatsMetrics metrics = new HealthStatsMetrics(); metrics.timers.put(345, new ArrayMap<String, HealthStatsMetrics.TimerMetrics>()); metrics.timers.get(345).put("val", new HealthStatsMetrics.TimerMetrics(0, 0)); assertThat(metrics.toJSONObject().l...
public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
@Test public void testUnattributedSet() { SensorMetrics metrics = new SensorMetrics(); metrics.set(createAttributedMetrics()); SensorMetrics comparisonMetrics = createAttributedMetrics(); comparisonMetrics.isAttributionEnabled = false; comparisonMetrics.sensorConsumption.clear(); assertThat(metrics).isEqualTo(compariso...
@Override public SensorMetrics set(SensorMetrics b) { total.set(b.total); if (isAttributionEnabled && b.isAttributionEnabled) { sensorConsumption.clear(); for (int i = 0, l = b.sensorConsumption.size(); i < l; i++) { sensorConsumption.put(b.sensorConsumption.keyAt(i), b.sensorConsumption.valueAt(i)); } } return this; }
SensorMetrics extends SystemMetrics<SensorMetrics> { @Override public SensorMetrics set(SensorMetrics b) { total.set(b.total); if (isAttributionEnabled && b.isAttributionEnabled) { sensorConsumption.clear(); for (int i = 0, l = b.sensorConsumption.size(); i < l; i++) { sensorConsumption.put(b.sensorConsumption.keyAt(i)...
SensorMetrics extends SystemMetrics<SensorMetrics> { @Override public SensorMetrics set(SensorMetrics b) { total.set(b.total); if (isAttributionEnabled && b.isAttributionEnabled) { sensorConsumption.clear(); for (int i = 0, l = b.sensorConsumption.size(); i < l; i++) { sensorConsumption.put(b.sensorConsumption.keyAt(i)...
SensorMetrics extends SystemMetrics<SensorMetrics> { @Override public SensorMetrics set(SensorMetrics b) { total.set(b.total); if (isAttributionEnabled && b.isAttributionEnabled) { sensorConsumption.clear(); for (int i = 0, l = b.sensorConsumption.size(); i < l; i++) { sensorConsumption.put(b.sensorConsumption.keyAt(i)...
SensorMetrics extends SystemMetrics<SensorMetrics> { @Override public SensorMetrics set(SensorMetrics b) { total.set(b.total); if (isAttributionEnabled && b.isAttributionEnabled) { sensorConsumption.clear(); for (int i = 0, l = b.sensorConsumption.size(); i < l; i++) { sensorConsumption.put(b.sensorConsumption.keyAt(i)...
@Test public void jsonConversionDoesNotSkipPartialZeroTimers() throws Exception { HealthStatsMetrics metrics = new HealthStatsMetrics(); metrics.timers.put(345, new ArrayMap<String, HealthStatsMetrics.TimerMetrics>()); metrics.timers.get(345).put("val", new HealthStatsMetrics.TimerMetrics(0, 10)); metrics.timers.get(34...
public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
@Test public void jsonConversionSkipsEmptyHealthStats() throws Exception { HealthStatsMetrics metrics = new HealthStatsMetrics(); metrics.stats.put(123, new ArrayMap<String, HealthStatsMetrics>()); HealthStatsMetrics inner = new HealthStatsMetrics(); metrics.stats.get(123).put("abc", inner); assertThat(metrics.toJSONOb...
public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } }
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
HealthStatsMetrics extends SystemMetrics<HealthStatsMetrics> { public JSONObject toJSONObject() throws JSONException { JSONObject output = new JSONObject(); output.put("type", dataType); addMeasurement(output); addTimer(output); addMeasurements(output); addTimers(output); addStats(output); return output; } HealthStatsM...
@Test public void testTimes() { ShadowSystemClock.setUptimeMillis(1234); ShadowSystemClock.setElapsedRealtime(9876); TimeMetrics snapshot = new TimeMetrics(); TimeMetricsCollector collector = new TimeMetricsCollector(); collector.getSnapshot(snapshot); assertThat(snapshot.uptimeMs).isEqualTo(1234); assertThat(snapshot....
@Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(TimeMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); snapshot.realtimeMs = SystemClock.elapsedRealtime(); snapshot.uptimeMs = SystemClock.uptimeMillis(); return true; }
TimeMetricsCollector extends SystemMetricsCollector<TimeMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(TimeMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); snapshot.realtimeMs = SystemClock.elapsedRealtime(); snapshot.uptimeMs = SystemClock.uptimeMillis...
TimeMetricsCollector extends SystemMetricsCollector<TimeMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(TimeMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); snapshot.realtimeMs = SystemClock.elapsedRealtime(); snapshot.uptimeMs = SystemClock.uptimeMillis...
TimeMetricsCollector extends SystemMetricsCollector<TimeMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(TimeMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); snapshot.realtimeMs = SystemClock.elapsedRealtime(); snapshot.uptimeMs = SystemClock.uptimeMillis...
TimeMetricsCollector extends SystemMetricsCollector<TimeMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(TimeMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); snapshot.realtimeMs = SystemClock.elapsedRealtime(); snapshot.uptimeMs = SystemClock.uptimeMillis...
@Test public void testEquals() { BluetoothMetrics metricsA = new BluetoothMetrics(); metricsA.bleScanDurationMs = 1000; metricsA.bleScanCount = 2; metricsA.bleOpportunisticScanDurationMs = 4000; metricsA.bleOpportunisticScanCount = 8; BluetoothMetrics metricsB = new BluetoothMetrics(); metricsB.bleScanDurationMs = 1000...
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } BluetoothMetrics that = (BluetoothMetrics) o; if (bleScanCount != that.bleScanCount || bleScanDurationMs != that.bleScanDurationMs || bleOpportunisticScanCount != that.bleOpportunis...
BluetoothMetrics extends SystemMetrics<BluetoothMetrics> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } BluetoothMetrics that = (BluetoothMetrics) o; if (bleScanCount != that.bleScanCount || bleScanDurationMs != that.bleScanDu...
BluetoothMetrics extends SystemMetrics<BluetoothMetrics> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } BluetoothMetrics that = (BluetoothMetrics) o; if (bleScanCount != that.bleScanCount || bleScanDurationMs != that.bleScanDu...
BluetoothMetrics extends SystemMetrics<BluetoothMetrics> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } BluetoothMetrics that = (BluetoothMetrics) o; if (bleScanCount != that.bleScanCount || bleScanDurationMs != that.bleScanDu...
BluetoothMetrics extends SystemMetrics<BluetoothMetrics> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } BluetoothMetrics that = (BluetoothMetrics) o; if (bleScanCount != that.bleScanCount || bleScanDurationMs != that.bleScanDu...
@Test public void testSet() { BluetoothMetrics metrics = new BluetoothMetrics(); metrics.bleScanDurationMs = 1000; metrics.bleScanCount = 10; metrics.bleOpportunisticScanDurationMs = 5000; metrics.bleOpportunisticScanCount = 3; BluetoothMetrics alternate = new BluetoothMetrics(); alternate.set(metrics); assertThat(alte...
@Override public BluetoothMetrics set(BluetoothMetrics b) { bleScanCount = b.bleScanCount; bleScanDurationMs = b.bleScanDurationMs; bleOpportunisticScanCount = b.bleOpportunisticScanCount; bleOpportunisticScanDurationMs = b.bleOpportunisticScanDurationMs; return this; }
BluetoothMetrics extends SystemMetrics<BluetoothMetrics> { @Override public BluetoothMetrics set(BluetoothMetrics b) { bleScanCount = b.bleScanCount; bleScanDurationMs = b.bleScanDurationMs; bleOpportunisticScanCount = b.bleOpportunisticScanCount; bleOpportunisticScanDurationMs = b.bleOpportunisticScanDurationMs; retur...
BluetoothMetrics extends SystemMetrics<BluetoothMetrics> { @Override public BluetoothMetrics set(BluetoothMetrics b) { bleScanCount = b.bleScanCount; bleScanDurationMs = b.bleScanDurationMs; bleOpportunisticScanCount = b.bleOpportunisticScanCount; bleOpportunisticScanDurationMs = b.bleOpportunisticScanDurationMs; retur...
BluetoothMetrics extends SystemMetrics<BluetoothMetrics> { @Override public BluetoothMetrics set(BluetoothMetrics b) { bleScanCount = b.bleScanCount; bleScanDurationMs = b.bleScanDurationMs; bleOpportunisticScanCount = b.bleOpportunisticScanCount; bleOpportunisticScanDurationMs = b.bleOpportunisticScanDurationMs; retur...
BluetoothMetrics extends SystemMetrics<BluetoothMetrics> { @Override public BluetoothMetrics set(BluetoothMetrics b) { bleScanCount = b.bleScanCount; bleScanDurationMs = b.bleScanDurationMs; bleOpportunisticScanCount = b.bleOpportunisticScanCount; bleOpportunisticScanDurationMs = b.bleOpportunisticScanDurationMs; retur...
@Test public void testDiff() { BluetoothMetrics metrics = new BluetoothMetrics(); metrics.bleScanDurationMs = 1000; metrics.bleScanCount = 10; metrics.bleOpportunisticScanDurationMs = 5000; metrics.bleOpportunisticScanCount = 3; BluetoothMetrics olderMetrics = new BluetoothMetrics(); olderMetrics.bleScanDurationMs = 80...
@Override public BluetoothMetrics diff(@Nullable BluetoothMetrics b, @Nullable BluetoothMetrics output) { if (output == null) { output = new BluetoothMetrics(); } if (b == null) { output.set(this); } else { output.bleScanCount = bleScanCount - b.bleScanCount; output.bleScanDurationMs = bleScanDurationMs - b.bleScanDura...
BluetoothMetrics extends SystemMetrics<BluetoothMetrics> { @Override public BluetoothMetrics diff(@Nullable BluetoothMetrics b, @Nullable BluetoothMetrics output) { if (output == null) { output = new BluetoothMetrics(); } if (b == null) { output.set(this); } else { output.bleScanCount = bleScanCount - b.bleScanCount; o...
BluetoothMetrics extends SystemMetrics<BluetoothMetrics> { @Override public BluetoothMetrics diff(@Nullable BluetoothMetrics b, @Nullable BluetoothMetrics output) { if (output == null) { output = new BluetoothMetrics(); } if (b == null) { output.set(this); } else { output.bleScanCount = bleScanCount - b.bleScanCount; o...
BluetoothMetrics extends SystemMetrics<BluetoothMetrics> { @Override public BluetoothMetrics diff(@Nullable BluetoothMetrics b, @Nullable BluetoothMetrics output) { if (output == null) { output = new BluetoothMetrics(); } if (b == null) { output.set(this); } else { output.bleScanCount = bleScanCount - b.bleScanCount; o...
BluetoothMetrics extends SystemMetrics<BluetoothMetrics> { @Override public BluetoothMetrics diff(@Nullable BluetoothMetrics b, @Nullable BluetoothMetrics output) { if (output == null) { output = new BluetoothMetrics(); } if (b == null) { output.set(this); } else { output.bleScanCount = bleScanCount - b.bleScanCount; o...
@Test public void testSum() { BluetoothMetrics metricsA = new BluetoothMetrics(); metricsA.bleScanDurationMs = 1000; metricsA.bleScanCount = 10; metricsA.bleOpportunisticScanDurationMs = 4000; metricsA.bleOpportunisticScanCount = 1; BluetoothMetrics metricsB = new BluetoothMetrics(); metricsB.bleScanDurationMs = 2000; ...
@Override public BluetoothMetrics sum(@Nullable BluetoothMetrics b, @Nullable BluetoothMetrics output) { if (output == null) { output = new BluetoothMetrics(); } if (b == null) { output.set(this); } else { output.bleScanCount = bleScanCount + b.bleScanCount; output.bleScanDurationMs = bleScanDurationMs + b.bleScanDurat...
BluetoothMetrics extends SystemMetrics<BluetoothMetrics> { @Override public BluetoothMetrics sum(@Nullable BluetoothMetrics b, @Nullable BluetoothMetrics output) { if (output == null) { output = new BluetoothMetrics(); } if (b == null) { output.set(this); } else { output.bleScanCount = bleScanCount + b.bleScanCount; ou...
BluetoothMetrics extends SystemMetrics<BluetoothMetrics> { @Override public BluetoothMetrics sum(@Nullable BluetoothMetrics b, @Nullable BluetoothMetrics output) { if (output == null) { output = new BluetoothMetrics(); } if (b == null) { output.set(this); } else { output.bleScanCount = bleScanCount + b.bleScanCount; ou...
BluetoothMetrics extends SystemMetrics<BluetoothMetrics> { @Override public BluetoothMetrics sum(@Nullable BluetoothMetrics b, @Nullable BluetoothMetrics output) { if (output == null) { output = new BluetoothMetrics(); } if (b == null) { output.set(this); } else { output.bleScanCount = bleScanCount + b.bleScanCount; ou...
BluetoothMetrics extends SystemMetrics<BluetoothMetrics> { @Override public BluetoothMetrics sum(@Nullable BluetoothMetrics b, @Nullable BluetoothMetrics output) { if (output == null) { output = new BluetoothMetrics(); } if (b == null) { output.set(this); } else { output.bleScanCount = bleScanCount + b.bleScanCount; ou...
@Test public void testEquals() { CpuFrequencyMetrics metricsA = new CpuFrequencyMetrics(); metricsA.timeInStateS[0].put(200, 2000); metricsA.timeInStateS[0].put(100, 1000); metricsA.timeInStateS[1].put(300, 3000); CpuFrequencyMetrics metricsB = new CpuFrequencyMetrics(); metricsB.timeInStateS[0].put(100, 1000); metrics...
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CpuFrequencyMetrics that = (CpuFrequencyMetrics) o; if (timeInStateS.length != that.timeInStateS.length) { return false; } for (int i = 0, size = timeInStateS.length; i < size; i++)...
CpuFrequencyMetrics extends SystemMetrics<CpuFrequencyMetrics> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CpuFrequencyMetrics that = (CpuFrequencyMetrics) o; if (timeInStateS.length != that.timeInStateS.length) { return fa...
CpuFrequencyMetrics extends SystemMetrics<CpuFrequencyMetrics> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CpuFrequencyMetrics that = (CpuFrequencyMetrics) o; if (timeInStateS.length != that.timeInStateS.length) { return fa...
CpuFrequencyMetrics extends SystemMetrics<CpuFrequencyMetrics> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CpuFrequencyMetrics that = (CpuFrequencyMetrics) o; if (timeInStateS.length != that.timeInStateS.length) { return fa...
CpuFrequencyMetrics extends SystemMetrics<CpuFrequencyMetrics> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CpuFrequencyMetrics that = (CpuFrequencyMetrics) o; if (timeInStateS.length != that.timeInStateS.length) { return fa...
@Test public void testSum() { CpuFrequencyMetrics metricsA = new CpuFrequencyMetrics(); metricsA.timeInStateS[0].put(100, 1); metricsA.timeInStateS[0].put(200, 2); metricsA.timeInStateS[1].put(1000, 1); CpuFrequencyMetrics metricsB = new CpuFrequencyMetrics(); metricsB.timeInStateS[0].put(200, 5); metricsB.timeInStateS...
@Override public CpuFrequencyMetrics sum( @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output) { if (output == null) { output = new CpuFrequencyMetrics(); } if (b == null) { output.set(this); } else { for (int i = 0; i < timeInStateS.length; i++) { SparseIntArray aCore = timeInStateS[i]; SparseIntArra...
CpuFrequencyMetrics extends SystemMetrics<CpuFrequencyMetrics> { @Override public CpuFrequencyMetrics sum( @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output) { if (output == null) { output = new CpuFrequencyMetrics(); } if (b == null) { output.set(this); } else { for (int i = 0; i < timeInStateS.len...
CpuFrequencyMetrics extends SystemMetrics<CpuFrequencyMetrics> { @Override public CpuFrequencyMetrics sum( @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output) { if (output == null) { output = new CpuFrequencyMetrics(); } if (b == null) { output.set(this); } else { for (int i = 0; i < timeInStateS.len...
CpuFrequencyMetrics extends SystemMetrics<CpuFrequencyMetrics> { @Override public CpuFrequencyMetrics sum( @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output) { if (output == null) { output = new CpuFrequencyMetrics(); } if (b == null) { output.set(this); } else { for (int i = 0; i < timeInStateS.len...
CpuFrequencyMetrics extends SystemMetrics<CpuFrequencyMetrics> { @Override public CpuFrequencyMetrics sum( @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output) { if (output == null) { output = new CpuFrequencyMetrics(); } if (b == null) { output.set(this); } else { for (int i = 0; i < timeInStateS.len...
@Test public void testDiff() { CpuFrequencyMetrics metricsA = new CpuFrequencyMetrics(); metricsA.timeInStateS[0].put(100, 100); metricsA.timeInStateS[0].put(200, 200); metricsA.timeInStateS[1].put(300, 300); metricsA.timeInStateS[2].put(400, 400); CpuFrequencyMetrics metricsB = new CpuFrequencyMetrics(); metricsB.time...
@Override public CpuFrequencyMetrics diff( @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output) { if (output == null) { output = new CpuFrequencyMetrics(); } if (b == null) { output.set(this); } else { for (int i = 0; i < timeInStateS.length; i++) { SparseIntArray aCore = timeInStateS[i]; SparseIntArr...
CpuFrequencyMetrics extends SystemMetrics<CpuFrequencyMetrics> { @Override public CpuFrequencyMetrics diff( @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output) { if (output == null) { output = new CpuFrequencyMetrics(); } if (b == null) { output.set(this); } else { for (int i = 0; i < timeInStateS.le...
CpuFrequencyMetrics extends SystemMetrics<CpuFrequencyMetrics> { @Override public CpuFrequencyMetrics diff( @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output) { if (output == null) { output = new CpuFrequencyMetrics(); } if (b == null) { output.set(this); } else { for (int i = 0; i < timeInStateS.le...
CpuFrequencyMetrics extends SystemMetrics<CpuFrequencyMetrics> { @Override public CpuFrequencyMetrics diff( @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output) { if (output == null) { output = new CpuFrequencyMetrics(); } if (b == null) { output.set(this); } else { for (int i = 0; i < timeInStateS.le...
CpuFrequencyMetrics extends SystemMetrics<CpuFrequencyMetrics> { @Override public CpuFrequencyMetrics diff( @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output) { if (output == null) { output = new CpuFrequencyMetrics(); } if (b == null) { output.set(this); } else { for (int i = 0; i < timeInStateS.le...
@Test public void testAttributedSum() { SensorMetrics a = createAttributedMetrics(); SensorMetrics b = createAttributedMetrics(); SensorMetrics result = a.sum(b); assertThat(result.total.powerMah).isEqualTo(a.total.powerMah * 2); assertThat(result.total.wakeUpTimeMs).isEqualTo(a.total.wakeUpTimeMs * 2); assertThat(resu...
@Override public SensorMetrics sum(@Nullable SensorMetrics b, @Nullable SensorMetrics output) { if (output == null) { output = new SensorMetrics(isAttributionEnabled); } if (b == null) { output.set(this); } else { total.sum(b.total, output.total); if (output.isAttributionEnabled) { op(+1, sensorConsumption, b.sensorCon...
SensorMetrics extends SystemMetrics<SensorMetrics> { @Override public SensorMetrics sum(@Nullable SensorMetrics b, @Nullable SensorMetrics output) { if (output == null) { output = new SensorMetrics(isAttributionEnabled); } if (b == null) { output.set(this); } else { total.sum(b.total, output.total); if (output.isAttrib...
SensorMetrics extends SystemMetrics<SensorMetrics> { @Override public SensorMetrics sum(@Nullable SensorMetrics b, @Nullable SensorMetrics output) { if (output == null) { output = new SensorMetrics(isAttributionEnabled); } if (b == null) { output.set(this); } else { total.sum(b.total, output.total); if (output.isAttrib...
SensorMetrics extends SystemMetrics<SensorMetrics> { @Override public SensorMetrics sum(@Nullable SensorMetrics b, @Nullable SensorMetrics output) { if (output == null) { output = new SensorMetrics(isAttributionEnabled); } if (b == null) { output.set(this); } else { total.sum(b.total, output.total); if (output.isAttrib...
SensorMetrics extends SystemMetrics<SensorMetrics> { @Override public SensorMetrics sum(@Nullable SensorMetrics b, @Nullable SensorMetrics output) { if (output == null) { output = new SensorMetrics(isAttributionEnabled); } if (b == null) { output.set(this); } else { total.sum(b.total, output.total); if (output.isAttrib...
@Test public void testDiffWithCoreReset() { CpuFrequencyMetrics metricsA = new CpuFrequencyMetrics(); metricsA.timeInStateS[0].put(100, 100); metricsA.timeInStateS[1].put(200, 50); metricsA.timeInStateS[1].put(250, 100); CpuFrequencyMetrics metricsB = new CpuFrequencyMetrics(); metricsB.timeInStateS[0].put(100, 50); me...
@Override public CpuFrequencyMetrics diff( @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output) { if (output == null) { output = new CpuFrequencyMetrics(); } if (b == null) { output.set(this); } else { for (int i = 0; i < timeInStateS.length; i++) { SparseIntArray aCore = timeInStateS[i]; SparseIntArr...
CpuFrequencyMetrics extends SystemMetrics<CpuFrequencyMetrics> { @Override public CpuFrequencyMetrics diff( @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output) { if (output == null) { output = new CpuFrequencyMetrics(); } if (b == null) { output.set(this); } else { for (int i = 0; i < timeInStateS.le...
CpuFrequencyMetrics extends SystemMetrics<CpuFrequencyMetrics> { @Override public CpuFrequencyMetrics diff( @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output) { if (output == null) { output = new CpuFrequencyMetrics(); } if (b == null) { output.set(this); } else { for (int i = 0; i < timeInStateS.le...
CpuFrequencyMetrics extends SystemMetrics<CpuFrequencyMetrics> { @Override public CpuFrequencyMetrics diff( @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output) { if (output == null) { output = new CpuFrequencyMetrics(); } if (b == null) { output.set(this); } else { for (int i = 0; i < timeInStateS.le...
CpuFrequencyMetrics extends SystemMetrics<CpuFrequencyMetrics> { @Override public CpuFrequencyMetrics diff( @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output) { if (output == null) { output = new CpuFrequencyMetrics(); } if (b == null) { output.set(this); } else { for (int i = 0; i < timeInStateS.le...
@Test public void testNullOutput() { CpuFrequencyMetrics metricsA = new CpuFrequencyMetrics(); CpuFrequencyMetrics metricsB = new CpuFrequencyMetrics(); assertThat(metricsA.diff(metricsB)).isNotNull(); }
@Override public CpuFrequencyMetrics diff( @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output) { if (output == null) { output = new CpuFrequencyMetrics(); } if (b == null) { output.set(this); } else { for (int i = 0; i < timeInStateS.length; i++) { SparseIntArray aCore = timeInStateS[i]; SparseIntArr...
CpuFrequencyMetrics extends SystemMetrics<CpuFrequencyMetrics> { @Override public CpuFrequencyMetrics diff( @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output) { if (output == null) { output = new CpuFrequencyMetrics(); } if (b == null) { output.set(this); } else { for (int i = 0; i < timeInStateS.le...
CpuFrequencyMetrics extends SystemMetrics<CpuFrequencyMetrics> { @Override public CpuFrequencyMetrics diff( @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output) { if (output == null) { output = new CpuFrequencyMetrics(); } if (b == null) { output.set(this); } else { for (int i = 0; i < timeInStateS.le...
CpuFrequencyMetrics extends SystemMetrics<CpuFrequencyMetrics> { @Override public CpuFrequencyMetrics diff( @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output) { if (output == null) { output = new CpuFrequencyMetrics(); } if (b == null) { output.set(this); } else { for (int i = 0; i < timeInStateS.le...
CpuFrequencyMetrics extends SystemMetrics<CpuFrequencyMetrics> { @Override public CpuFrequencyMetrics diff( @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output) { if (output == null) { output = new CpuFrequencyMetrics(); } if (b == null) { output.set(this); } else { for (int i = 0; i < timeInStateS.le...
@Test public void testNullSubtrahend() { CpuFrequencyMetrics metricsA = new CpuFrequencyMetrics(); metricsA.timeInStateS[0].put(100, 200); metricsA.timeInStateS[1].put(200, 300); CpuFrequencyMetrics output = new CpuFrequencyMetrics(); metricsA.diff(null, output); assertThat(metricsA).isEqualTo(output); }
@Override public CpuFrequencyMetrics diff( @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output) { if (output == null) { output = new CpuFrequencyMetrics(); } if (b == null) { output.set(this); } else { for (int i = 0; i < timeInStateS.length; i++) { SparseIntArray aCore = timeInStateS[i]; SparseIntArr...
CpuFrequencyMetrics extends SystemMetrics<CpuFrequencyMetrics> { @Override public CpuFrequencyMetrics diff( @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output) { if (output == null) { output = new CpuFrequencyMetrics(); } if (b == null) { output.set(this); } else { for (int i = 0; i < timeInStateS.le...
CpuFrequencyMetrics extends SystemMetrics<CpuFrequencyMetrics> { @Override public CpuFrequencyMetrics diff( @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output) { if (output == null) { output = new CpuFrequencyMetrics(); } if (b == null) { output.set(this); } else { for (int i = 0; i < timeInStateS.le...
CpuFrequencyMetrics extends SystemMetrics<CpuFrequencyMetrics> { @Override public CpuFrequencyMetrics diff( @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output) { if (output == null) { output = new CpuFrequencyMetrics(); } if (b == null) { output.set(this); } else { for (int i = 0; i < timeInStateS.le...
CpuFrequencyMetrics extends SystemMetrics<CpuFrequencyMetrics> { @Override public CpuFrequencyMetrics diff( @Nullable CpuFrequencyMetrics b, @Nullable CpuFrequencyMetrics output) { if (output == null) { output = new CpuFrequencyMetrics(); } if (b == null) { output.set(this); } else { for (int i = 0; i < timeInStateS.le...
@Test public void testBrokenFile() throws Exception { TestableCpuMetricsCollector collector = new TestableCpuMetricsCollector().setPath(createFile("I am a weird android manufacturer")); CpuMetrics snapshot = new CpuMetrics(); assertThat(collector.getSnapshot(snapshot)).isFalse(); }
@Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileReader(getPath()); mProcFileReader.set(reader); } reader.reset(); if ...
CpuMetricsCollector extends SystemMetricsCollector<CpuMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileRead...
CpuMetricsCollector extends SystemMetricsCollector<CpuMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileRead...
CpuMetricsCollector extends SystemMetricsCollector<CpuMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileRead...
CpuMetricsCollector extends SystemMetricsCollector<CpuMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileRead...
@Test public void testNegativeFields() throws Exception { StringBuilder testStringBuilder = new StringBuilder(); for (int i = 0; i < 20; i++) { testStringBuilder.append(-i * 100).append(' '); } TestableCpuMetricsCollector collector = new TestableCpuMetricsCollector().setPath(createFile(testStringBuilder.toString())); C...
@Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileReader(getPath()); mProcFileReader.set(reader); } reader.reset(); if ...
CpuMetricsCollector extends SystemMetricsCollector<CpuMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileRead...
CpuMetricsCollector extends SystemMetricsCollector<CpuMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileRead...
CpuMetricsCollector extends SystemMetricsCollector<CpuMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileRead...
CpuMetricsCollector extends SystemMetricsCollector<CpuMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileRead...
@Test public void testErrorOnDecreasing() throws Exception { SystemMetricsLogger.Delegate logger = mock(SystemMetricsLogger.Delegate.class); SystemMetricsLogger.setDelegate(logger); StringBuilder initialEntry = new StringBuilder(); for (int i = 0; i < 20; i++) { initialEntry.append(i * 2000).append(' '); } String path ...
@Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileReader(getPath()); mProcFileReader.set(reader); } reader.reset(); if ...
CpuMetricsCollector extends SystemMetricsCollector<CpuMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileRead...
CpuMetricsCollector extends SystemMetricsCollector<CpuMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileRead...
CpuMetricsCollector extends SystemMetricsCollector<CpuMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileRead...
CpuMetricsCollector extends SystemMetricsCollector<CpuMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileRead...
@Test public void testRealProcfile() throws Exception { String stat = "21031 (facebook.katana) S 354 354 0 0 -1 1077952832 227718 1446 318 0 9852 889 6 11 20 0 133 0 502496 2050461696 70553 4294967295 1 1 0 0 0 0 4608 0 1166120188 4294967295 0 0 17 0 0 0 0 0 0 0 0 0 0 0 0 0 0"; TestableCpuMetricsCollector collector = n...
@Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileReader(getPath()); mProcFileReader.set(reader); } reader.reset(); if ...
CpuMetricsCollector extends SystemMetricsCollector<CpuMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileRead...
CpuMetricsCollector extends SystemMetricsCollector<CpuMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileRead...
CpuMetricsCollector extends SystemMetricsCollector<CpuMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileRead...
CpuMetricsCollector extends SystemMetricsCollector<CpuMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileRead...
@Test public void testSaneProcFile() throws Exception { StringBuilder testStringBuilder = new StringBuilder(); for (int i = 0; i < 20; i++) { testStringBuilder.append(i * 100).append(' '); } TestableCpuMetricsCollector collector = new TestableCpuMetricsCollector().setPath(createFile(testStringBuilder.toString())); CpuM...
@Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileReader(getPath()); mProcFileReader.set(reader); } reader.reset(); if ...
CpuMetricsCollector extends SystemMetricsCollector<CpuMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileRead...
CpuMetricsCollector extends SystemMetricsCollector<CpuMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileRead...
CpuMetricsCollector extends SystemMetricsCollector<CpuMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileRead...
CpuMetricsCollector extends SystemMetricsCollector<CpuMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileRead...
@Test public void testUnreadableProcFile() throws Exception { TestableCpuMetricsCollector collector = new TestableCpuMetricsCollector().setPath(""); CpuMetrics snapshot = new CpuMetrics(); assertThat(collector.getSnapshot(snapshot)).isFalse(); }
@Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileReader(getPath()); mProcFileReader.set(reader); } reader.reset(); if ...
CpuMetricsCollector extends SystemMetricsCollector<CpuMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileRead...
CpuMetricsCollector extends SystemMetricsCollector<CpuMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileRead...
CpuMetricsCollector extends SystemMetricsCollector<CpuMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileRead...
CpuMetricsCollector extends SystemMetricsCollector<CpuMetrics> { @Override @ThreadSafe(enableChecks = false) public boolean getSnapshot(CpuMetrics snapshot) { checkNotNull(snapshot, "Null value passed to getSnapshot!"); try { ProcFileReader reader = mProcFileReader.get(); if (reader == null) { reader = new ProcFileRead...
@Test public void testEquals() { assertThat(new WakeLockMetrics()).isEqualTo(new WakeLockMetrics()); assertThat(createInitializedMetrics()).isEqualTo(createInitializedMetrics()); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } WakeLockMetrics that = (WakeLockMetrics) o; if (isAttributionEnabled != that.isAttributionEnabled || heldTimeMs != that.heldTimeMs || acquiredCount != that.acquiredCount) { return f...
WakeLockMetrics extends SystemMetrics<WakeLockMetrics> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } WakeLockMetrics that = (WakeLockMetrics) o; if (isAttributionEnabled != that.isAttributionEnabled || heldTimeMs != that.held...
WakeLockMetrics extends SystemMetrics<WakeLockMetrics> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } WakeLockMetrics that = (WakeLockMetrics) o; if (isAttributionEnabled != that.isAttributionEnabled || heldTimeMs != that.held...
WakeLockMetrics extends SystemMetrics<WakeLockMetrics> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } WakeLockMetrics that = (WakeLockMetrics) o; if (isAttributionEnabled != that.isAttributionEnabled || heldTimeMs != that.held...
WakeLockMetrics extends SystemMetrics<WakeLockMetrics> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } WakeLockMetrics that = (WakeLockMetrics) o; if (isAttributionEnabled != that.isAttributionEnabled || heldTimeMs != that.held...
@Test public void testAttributedDiff() { SensorMetrics a = createAttributedMetrics(); SensorMetrics b = createAttributedMetrics(); SensorMetrics result = a.diff(b); assertThat(result).isEqualTo(new SensorMetrics(true)); }
@Override public SensorMetrics diff(@Nullable SensorMetrics b, @Nullable SensorMetrics output) { if (output == null) { output = new SensorMetrics(isAttributionEnabled); } if (b == null) { output.set(this); } else { total.diff(b.total, output.total); if (output.isAttributionEnabled) { op(-1, sensorConsumption, b.sensorC...
SensorMetrics extends SystemMetrics<SensorMetrics> { @Override public SensorMetrics diff(@Nullable SensorMetrics b, @Nullable SensorMetrics output) { if (output == null) { output = new SensorMetrics(isAttributionEnabled); } if (b == null) { output.set(this); } else { total.diff(b.total, output.total); if (output.isAttr...
SensorMetrics extends SystemMetrics<SensorMetrics> { @Override public SensorMetrics diff(@Nullable SensorMetrics b, @Nullable SensorMetrics output) { if (output == null) { output = new SensorMetrics(isAttributionEnabled); } if (b == null) { output.set(this); } else { total.diff(b.total, output.total); if (output.isAttr...
SensorMetrics extends SystemMetrics<SensorMetrics> { @Override public SensorMetrics diff(@Nullable SensorMetrics b, @Nullable SensorMetrics output) { if (output == null) { output = new SensorMetrics(isAttributionEnabled); } if (b == null) { output.set(this); } else { total.diff(b.total, output.total); if (output.isAttr...
SensorMetrics extends SystemMetrics<SensorMetrics> { @Override public SensorMetrics diff(@Nullable SensorMetrics b, @Nullable SensorMetrics output) { if (output == null) { output = new SensorMetrics(isAttributionEnabled); } if (b == null) { output.set(this); } else { total.diff(b.total, output.total); if (output.isAttr...
@Test(expected=OptionAssignmentException.class) public void testCreateEndpointWithError() throws IOException { @SuppressWarnings("unchecked") final XEndpointListener<UndertowEndpoint> listener = mock(XEndpointListener.class); final UndertowEndpointManager mgr = new UndertowEndpointManager(null, 0, new DerivedEndpointCo...
UndertowEndpoint createEndpoint(WebSocketChannel channel) { final UndertowEndpoint endpoint = new UndertowEndpoint(this, channel); try { channel.setOption(Options.TCP_NODELAY, NODELAY); } catch (IOException e) { throw new OptionAssignmentException("Error setting option", e); } channel.getReceiveSetter().set(endpoint); ...
UndertowEndpointManager implements WebSocketConnectionCallback, XEndpointManager<UndertowEndpoint> { UndertowEndpoint createEndpoint(WebSocketChannel channel) { final UndertowEndpoint endpoint = new UndertowEndpoint(this, channel); try { channel.setOption(Options.TCP_NODELAY, NODELAY); } catch (IOException e) { throw n...
UndertowEndpointManager implements WebSocketConnectionCallback, XEndpointManager<UndertowEndpoint> { UndertowEndpoint createEndpoint(WebSocketChannel channel) { final UndertowEndpoint endpoint = new UndertowEndpoint(this, channel); try { channel.setOption(Options.TCP_NODELAY, NODELAY); } catch (IOException e) { throw n...
UndertowEndpointManager implements WebSocketConnectionCallback, XEndpointManager<UndertowEndpoint> { UndertowEndpoint createEndpoint(WebSocketChannel channel) { final UndertowEndpoint endpoint = new UndertowEndpoint(this, channel); try { channel.setOption(Options.TCP_NODELAY, NODELAY); } catch (IOException e) { throw n...
UndertowEndpointManager implements WebSocketConnectionCallback, XEndpointManager<UndertowEndpoint> { UndertowEndpoint createEndpoint(WebSocketChannel channel) { final UndertowEndpoint endpoint = new UndertowEndpoint(this, channel); try { channel.setOption(Options.TCP_NODELAY, NODELAY); } catch (IOException e) { throw n...
@Test public void testCallbackOnceOnlyComplete() { createEndpointManager(); final XSendCallback callback = mock(XSendCallback.class); final WebSocketCallback<Void> wsCallback = endpoint.wrapCallback(callback); wsCallback.complete(channel, null); verify(callback, times(1)).onComplete(eq(endpoint)); wsCallback.complete(c...
WebSocketCallback<Void> wrapCallback(XSendCallback callback) { return new WebSocketCallback<Void>() { private final AtomicBoolean onceOnly = new AtomicBoolean(); @Override public void complete(WebSocketChannel channel, Void context) { if (onceOnly.compareAndSet(false, true)) { backlog.decrementAndGet(); if (callback !=...
UndertowEndpoint extends AbstractReceiveListener implements XEndpoint { WebSocketCallback<Void> wrapCallback(XSendCallback callback) { return new WebSocketCallback<Void>() { private final AtomicBoolean onceOnly = new AtomicBoolean(); @Override public void complete(WebSocketChannel channel, Void context) { if (onceOnly....
UndertowEndpoint extends AbstractReceiveListener implements XEndpoint { WebSocketCallback<Void> wrapCallback(XSendCallback callback) { return new WebSocketCallback<Void>() { private final AtomicBoolean onceOnly = new AtomicBoolean(); @Override public void complete(WebSocketChannel channel, Void context) { if (onceOnly....
UndertowEndpoint extends AbstractReceiveListener implements XEndpoint { WebSocketCallback<Void> wrapCallback(XSendCallback callback) { return new WebSocketCallback<Void>() { private final AtomicBoolean onceOnly = new AtomicBoolean(); @Override public void complete(WebSocketChannel channel, Void context) { if (onceOnly....
UndertowEndpoint extends AbstractReceiveListener implements XEndpoint { WebSocketCallback<Void> wrapCallback(XSendCallback callback) { return new WebSocketCallback<Void>() { private final AtomicBoolean onceOnly = new AtomicBoolean(); @Override public void complete(WebSocketChannel channel, Void context) { if (onceOnly....
@Test public void testVersionReplacement() throws Exception { File outDir = Tests.copyPackageSources(getClass()); LOG.info("Updating poms in " + outDir); File[] files = outDir.listFiles(); assertNotNull("No output files!", files); assertTrue("No output files!", files.length > 0); List<PomUpdateStatus> pomsToChange = ne...
public static boolean updatePomVersions(List<PomUpdateStatus> pomsToChange, List<DependencyVersionChange> changes) throws IOException { Map<String, String> propertyChanges = new TreeMap<>(); for (PomUpdateStatus status : pomsToChange) { status.updateVersions(changes, propertyChanges); } if (!propertyChanges.isEmpty()) ...
PomHelper { public static boolean updatePomVersions(List<PomUpdateStatus> pomsToChange, List<DependencyVersionChange> changes) throws IOException { Map<String, String> propertyChanges = new TreeMap<>(); for (PomUpdateStatus status : pomsToChange) { status.updateVersions(changes, propertyChanges); } if (!propertyChanges...
PomHelper { public static boolean updatePomVersions(List<PomUpdateStatus> pomsToChange, List<DependencyVersionChange> changes) throws IOException { Map<String, String> propertyChanges = new TreeMap<>(); for (PomUpdateStatus status : pomsToChange) { status.updateVersions(changes, propertyChanges); } if (!propertyChanges...
PomHelper { public static boolean updatePomVersions(List<PomUpdateStatus> pomsToChange, List<DependencyVersionChange> changes) throws IOException { Map<String, String> propertyChanges = new TreeMap<>(); for (PomUpdateStatus status : pomsToChange) { status.updateVersions(changes, propertyChanges); } if (!propertyChanges...
PomHelper { public static boolean updatePomVersions(List<PomUpdateStatus> pomsToChange, List<DependencyVersionChange> changes) throws IOException { Map<String, String> propertyChanges = new TreeMap<>(); for (PomUpdateStatus status : pomsToChange) { status.updateVersions(changes, propertyChanges); } if (!propertyChanges...
@Test public void testSimple() throws DaoException { assertEquals(0, metric.distance(g("Minnesota"), g("Minnesota")), 0.01); assertEquals(1, metric.distance(g("Wisconsin"), g("Minnesota")), 0.01); assertEquals(1, metric.distance(g("North Dakota"), g("Minnesota")), 0.01); assertEquals(1, metric.distance(g("South Dakota"...
@Override public double distance(Geometry g1, Geometry g2) { if (adjacencyList.isEmpty()) { throw new UnsupportedOperationException(); } int srcId = getContainingGeometry(g1); int destId = getContainingGeometry(g2); if (srcId < 0) { throw new IllegalArgumentException("No containing geometry for source geometry"); } if ...
BorderingDistanceMetric implements SpatialDistanceMetric { @Override public double distance(Geometry g1, Geometry g2) { if (adjacencyList.isEmpty()) { throw new UnsupportedOperationException(); } int srcId = getContainingGeometry(g1); int destId = getContainingGeometry(g2); if (srcId < 0) { throw new IllegalArgumentExc...
BorderingDistanceMetric implements SpatialDistanceMetric { @Override public double distance(Geometry g1, Geometry g2) { if (adjacencyList.isEmpty()) { throw new UnsupportedOperationException(); } int srcId = getContainingGeometry(g1); int destId = getContainingGeometry(g2); if (srcId < 0) { throw new IllegalArgumentExc...
BorderingDistanceMetric implements SpatialDistanceMetric { @Override public double distance(Geometry g1, Geometry g2) { if (adjacencyList.isEmpty()) { throw new UnsupportedOperationException(); } int srcId = getContainingGeometry(g1); int destId = getContainingGeometry(g2); if (srcId < 0) { throw new IllegalArgumentExc...
BorderingDistanceMetric implements SpatialDistanceMetric { @Override public double distance(Geometry g1, Geometry g2) { if (adjacencyList.isEmpty()) { throw new UnsupportedOperationException(); } int srcId = getContainingGeometry(g1); int destId = getContainingGeometry(g2); if (srcId < 0) { throw new IllegalArgumentExc...
@Test public void testRuntimeParams() throws ConfigurationException, IOException { Configurator conf = new Configurator(new Configuration()); Integer i1 = conf.get(Integer.class, "foo"); assertEquals(i1, 42); Integer i2 = conf.get(Integer.class, "foo"); assertEquals(i1, i2); Map<String, String> args3 = new HashMap<Stri...
public <T> T get(Class<T> klass, String name) throws ConfigurationException { return get(klass, name, null); }
Configurator implements Cloneable { public <T> T get(Class<T> klass, String name) throws ConfigurationException { return get(klass, name, null); } }
Configurator implements Cloneable { public <T> T get(Class<T> klass, String name) throws ConfigurationException { return get(klass, name, null); } Configurator(Configuration conf); }
Configurator implements Cloneable { public <T> T get(Class<T> klass, String name) throws ConfigurationException { return get(klass, name, null); } Configurator(Configuration conf); Configuration getConf(); T get(Class<T> klass, String name); T get(Class<T> klass, String name, String runtimeKey, String runtimeValue); T ...
Configurator implements Cloneable { public <T> T get(Class<T> klass, String name) throws ConfigurationException { return get(klass, name, null); } Configurator(Configuration conf); Configuration getConf(); T get(Class<T> klass, String name); T get(Class<T> klass, String name, String runtimeKey, String runtimeValue); T ...
@Test public void testWrite() throws IOException { File tmp = File.createTempFile("matrix", null); SparseMatrixWriter.write(tmp, srcRows.iterator()); }
@Override public Iterator<SparseMatrixRow> iterator() { return new SparseMatrixIterator(); }
SparseMatrix implements Matrix<SparseMatrixRow> { @Override public Iterator<SparseMatrixRow> iterator() { return new SparseMatrixIterator(); } }
SparseMatrix implements Matrix<SparseMatrixRow> { @Override public Iterator<SparseMatrixRow> iterator() { return new SparseMatrixIterator(); } SparseMatrix(File path); }
SparseMatrix implements Matrix<SparseMatrixRow> { @Override public Iterator<SparseMatrixRow> iterator() { return new SparseMatrixIterator(); } SparseMatrix(File path); long lastModified(); @Override SparseMatrixRow getRow(int rowId); @Override int[] getRowIds(); @Override int getNumRows(); ValueConf getValueConf(); @Ov...
SparseMatrix implements Matrix<SparseMatrixRow> { @Override public Iterator<SparseMatrixRow> iterator() { return new SparseMatrixIterator(); } SparseMatrix(File path); long lastModified(); @Override SparseMatrixRow getRow(int rowId); @Override int[] getRowIds(); @Override int getNumRows(); ValueConf getValueConf(); @Ov...
@Test public void testReadWrite() throws IOException { File tmp = File.createTempFile("matrix", null); SparseMatrixWriter.write(tmp, srcRows.iterator()); Matrix m1 = new SparseMatrix(tmp); Matrix m2 = new SparseMatrix(tmp); }
@Override public Iterator<SparseMatrixRow> iterator() { return new SparseMatrixIterator(); }
SparseMatrix implements Matrix<SparseMatrixRow> { @Override public Iterator<SparseMatrixRow> iterator() { return new SparseMatrixIterator(); } }
SparseMatrix implements Matrix<SparseMatrixRow> { @Override public Iterator<SparseMatrixRow> iterator() { return new SparseMatrixIterator(); } SparseMatrix(File path); }
SparseMatrix implements Matrix<SparseMatrixRow> { @Override public Iterator<SparseMatrixRow> iterator() { return new SparseMatrixIterator(); } SparseMatrix(File path); long lastModified(); @Override SparseMatrixRow getRow(int rowId); @Override int[] getRowIds(); @Override int getNumRows(); ValueConf getValueConf(); @Ov...
SparseMatrix implements Matrix<SparseMatrixRow> { @Override public Iterator<SparseMatrixRow> iterator() { return new SparseMatrixIterator(); } SparseMatrix(File path); long lastModified(); @Override SparseMatrixRow getRow(int rowId); @Override int[] getRowIds(); @Override int getNumRows(); ValueConf getValueConf(); @Ov...
@Test public void testTranspose() throws IOException { for (int numOpenPages: new int[] { 1, Integer.MAX_VALUE}) { File tmp1 = File.createTempFile("matrix", null); File tmp2 = File.createTempFile("matrix", null); File tmp3 = File.createTempFile("matrix", null); SparseMatrixWriter.write(tmp1, srcRows.iterator()); Sparse...
@Override public Iterator<SparseMatrixRow> iterator() { return new SparseMatrixIterator(); }
SparseMatrix implements Matrix<SparseMatrixRow> { @Override public Iterator<SparseMatrixRow> iterator() { return new SparseMatrixIterator(); } }
SparseMatrix implements Matrix<SparseMatrixRow> { @Override public Iterator<SparseMatrixRow> iterator() { return new SparseMatrixIterator(); } SparseMatrix(File path); }
SparseMatrix implements Matrix<SparseMatrixRow> { @Override public Iterator<SparseMatrixRow> iterator() { return new SparseMatrixIterator(); } SparseMatrix(File path); long lastModified(); @Override SparseMatrixRow getRow(int rowId); @Override int[] getRowIds(); @Override int getNumRows(); ValueConf getValueConf(); @Ov...
SparseMatrix implements Matrix<SparseMatrixRow> { @Override public Iterator<SparseMatrixRow> iterator() { return new SparseMatrixIterator(); } SparseMatrix(File path); long lastModified(); @Override SparseMatrixRow getRow(int rowId); @Override int[] getRowIds(); @Override int getNumRows(); ValueConf getValueConf(); @Ov...
@Test public void testRows() throws IOException { for (int numOpenPages: new int[] { 1, Integer.MAX_VALUE}) { File tmp = File.createTempFile("matrix", null); SparseMatrixWriter.write(tmp, srcRows.iterator()); Matrix m = new SparseMatrix(tmp); verifyIsSourceMatrix(m); } }
@Override public Iterator<SparseMatrixRow> iterator() { return new SparseMatrixIterator(); }
SparseMatrix implements Matrix<SparseMatrixRow> { @Override public Iterator<SparseMatrixRow> iterator() { return new SparseMatrixIterator(); } }
SparseMatrix implements Matrix<SparseMatrixRow> { @Override public Iterator<SparseMatrixRow> iterator() { return new SparseMatrixIterator(); } SparseMatrix(File path); }
SparseMatrix implements Matrix<SparseMatrixRow> { @Override public Iterator<SparseMatrixRow> iterator() { return new SparseMatrixIterator(); } SparseMatrix(File path); long lastModified(); @Override SparseMatrixRow getRow(int rowId); @Override int[] getRowIds(); @Override int getNumRows(); ValueConf getValueConf(); @Ov...
SparseMatrix implements Matrix<SparseMatrixRow> { @Override public Iterator<SparseMatrixRow> iterator() { return new SparseMatrixIterator(); } SparseMatrix(File path); long lastModified(); @Override SparseMatrixRow getRow(int rowId); @Override int[] getRowIds(); @Override int getNumRows(); ValueConf getValueConf(); @Ov...
@Test public void testWrite() throws IOException { File tmp = File.createTempFile("matrix", null); DenseMatrixWriter.write(tmp, srcRows.iterator()); }
@Override public Iterator<DenseMatrixRow> iterator() { return new DenseMatrixIterator(); }
DenseMatrix implements Matrix<DenseMatrixRow> { @Override public Iterator<DenseMatrixRow> iterator() { return new DenseMatrixIterator(); } }
DenseMatrix implements Matrix<DenseMatrixRow> { @Override public Iterator<DenseMatrixRow> iterator() { return new DenseMatrixIterator(); } DenseMatrix(File path); }
DenseMatrix implements Matrix<DenseMatrixRow> { @Override public Iterator<DenseMatrixRow> iterator() { return new DenseMatrixIterator(); } DenseMatrix(File path); @Override DenseMatrixRow getRow(int rowId); @Override int[] getRowIds(); int[] getColIds(); @Override int getNumRows(); ValueConf getValueConf(); @Override I...
DenseMatrix implements Matrix<DenseMatrixRow> { @Override public Iterator<DenseMatrixRow> iterator() { return new DenseMatrixIterator(); } DenseMatrix(File path); @Override DenseMatrixRow getRow(int rowId); @Override int[] getRowIds(); int[] getColIds(); @Override int getNumRows(); ValueConf getValueConf(); @Override I...
@Test public void testReadWrite() throws IOException { File tmp = File.createTempFile("matrix", null); DenseMatrixWriter.write(tmp, srcRows.iterator()); DenseMatrix m1 = new DenseMatrix(tmp); DenseMatrix m2 = new DenseMatrix(tmp); }
@Override public Iterator<DenseMatrixRow> iterator() { return new DenseMatrixIterator(); }
DenseMatrix implements Matrix<DenseMatrixRow> { @Override public Iterator<DenseMatrixRow> iterator() { return new DenseMatrixIterator(); } }
DenseMatrix implements Matrix<DenseMatrixRow> { @Override public Iterator<DenseMatrixRow> iterator() { return new DenseMatrixIterator(); } DenseMatrix(File path); }
DenseMatrix implements Matrix<DenseMatrixRow> { @Override public Iterator<DenseMatrixRow> iterator() { return new DenseMatrixIterator(); } DenseMatrix(File path); @Override DenseMatrixRow getRow(int rowId); @Override int[] getRowIds(); int[] getColIds(); @Override int getNumRows(); ValueConf getValueConf(); @Override I...
DenseMatrix implements Matrix<DenseMatrixRow> { @Override public Iterator<DenseMatrixRow> iterator() { return new DenseMatrixIterator(); } DenseMatrix(File path); @Override DenseMatrixRow getRow(int rowId); @Override int[] getRowIds(); int[] getColIds(); @Override int getNumRows(); ValueConf getValueConf(); @Override I...
@Test public void testTranspose() throws IOException { for (int numOpenPages: new int[] { 1, Integer.MAX_VALUE}) { File tmp1 = File.createTempFile("matrix", null); File tmp2 = File.createTempFile("matrix", null); File tmp3 = File.createTempFile("matrix", null); DenseMatrixWriter.write(tmp1, srcRows.iterator()); DenseMa...
@Override public Iterator<DenseMatrixRow> iterator() { return new DenseMatrixIterator(); }
DenseMatrix implements Matrix<DenseMatrixRow> { @Override public Iterator<DenseMatrixRow> iterator() { return new DenseMatrixIterator(); } }
DenseMatrix implements Matrix<DenseMatrixRow> { @Override public Iterator<DenseMatrixRow> iterator() { return new DenseMatrixIterator(); } DenseMatrix(File path); }
DenseMatrix implements Matrix<DenseMatrixRow> { @Override public Iterator<DenseMatrixRow> iterator() { return new DenseMatrixIterator(); } DenseMatrix(File path); @Override DenseMatrixRow getRow(int rowId); @Override int[] getRowIds(); int[] getColIds(); @Override int getNumRows(); ValueConf getValueConf(); @Override I...
DenseMatrix implements Matrix<DenseMatrixRow> { @Override public Iterator<DenseMatrixRow> iterator() { return new DenseMatrixIterator(); } DenseMatrix(File path); @Override DenseMatrixRow getRow(int rowId); @Override int[] getRowIds(); int[] getColIds(); @Override int getNumRows(); ValueConf getValueConf(); @Override I...
@Test public void testRows() throws IOException { for (int numOpenPages: new int[] { 1, Integer.MAX_VALUE}) { File tmp = File.createTempFile("matrix", null); DenseMatrixWriter.write(tmp, srcRows.iterator()); DenseMatrix m = new DenseMatrix(tmp); verifyIsSourceMatrix(m); } }
@Override public Iterator<DenseMatrixRow> iterator() { return new DenseMatrixIterator(); }
DenseMatrix implements Matrix<DenseMatrixRow> { @Override public Iterator<DenseMatrixRow> iterator() { return new DenseMatrixIterator(); } }
DenseMatrix implements Matrix<DenseMatrixRow> { @Override public Iterator<DenseMatrixRow> iterator() { return new DenseMatrixIterator(); } DenseMatrix(File path); }
DenseMatrix implements Matrix<DenseMatrixRow> { @Override public Iterator<DenseMatrixRow> iterator() { return new DenseMatrixIterator(); } DenseMatrix(File path); @Override DenseMatrixRow getRow(int rowId); @Override int[] getRowIds(); int[] getColIds(); @Override int getNumRows(); ValueConf getValueConf(); @Override I...
DenseMatrix implements Matrix<DenseMatrixRow> { @Override public Iterator<DenseMatrixRow> iterator() { return new DenseMatrixIterator(); } DenseMatrix(File path); @Override DenseMatrixRow getRow(int rowId); @Override int[] getRowIds(); int[] getColIds(); @Override int getNumRows(); ValueConf getValueConf(); @Override I...
@Test public void testTstampsInRange() { long now = System.currentTimeMillis(); Random random = new Random(); for (int i = 0; i < 1000; i++) { long tstamp = (long) (random.nextDouble() * now); DateTime beg = new DateTime(tstamp); DateTime end = beg.plusHours(1); SortedSet<DateTime> tstamps = PageViewUtils.timestampsInI...
public static SortedSet<DateTime> timestampsInInterval(DateTime start, DateTime end) { if (start.isAfter(end)) { throw new IllegalArgumentException(); } DateTime current = new DateTime( start.year().get(), start.monthOfYear().get(), start.dayOfMonth().get(), start.hourOfDay().get(), 0); if (current.isBefore(start)) { c...
PageViewUtils { public static SortedSet<DateTime> timestampsInInterval(DateTime start, DateTime end) { if (start.isAfter(end)) { throw new IllegalArgumentException(); } DateTime current = new DateTime( start.year().get(), start.monthOfYear().get(), start.dayOfMonth().get(), start.hourOfDay().get(), 0); if (current.isBe...
PageViewUtils { public static SortedSet<DateTime> timestampsInInterval(DateTime start, DateTime end) { if (start.isAfter(end)) { throw new IllegalArgumentException(); } DateTime current = new DateTime( start.year().get(), start.monthOfYear().get(), start.dayOfMonth().get(), start.hourOfDay().get(), 0); if (current.isBe...
PageViewUtils { public static SortedSet<DateTime> timestampsInInterval(DateTime start, DateTime end) { if (start.isAfter(end)) { throw new IllegalArgumentException(); } DateTime current = new DateTime( start.year().get(), start.monthOfYear().get(), start.dayOfMonth().get(), start.hourOfDay().get(), 0); if (current.isBe...
PageViewUtils { public static SortedSet<DateTime> timestampsInInterval(DateTime start, DateTime end) { if (start.isAfter(end)) { throw new IllegalArgumentException(); } DateTime current = new DateTime( start.year().get(), start.monthOfYear().get(), start.dayOfMonth().get(), start.hourOfDay().get(), 0); if (current.isBe...
@Test public void testKnn() throws DaoException { List<SpatialDistanceMetric.Neighbor> neighbors = metric.getNeighbors(g("Minnesota"), 100); for (int i = 0; i < neighbors.size(); i++) { SpatialDistanceMetric.Neighbor n = neighbors.get(i); String name = n(n.conceptId); if (i == 0) { assertEquals(name, "Minnesota"); } el...
@Override public List<Neighbor> getNeighbors(Geometry g, int maxNeighbors) { return getNeighbors(g, maxNeighbors, Double.MAX_VALUE); }
BorderingDistanceMetric implements SpatialDistanceMetric { @Override public List<Neighbor> getNeighbors(Geometry g, int maxNeighbors) { return getNeighbors(g, maxNeighbors, Double.MAX_VALUE); } }
BorderingDistanceMetric implements SpatialDistanceMetric { @Override public List<Neighbor> getNeighbors(Geometry g, int maxNeighbors) { return getNeighbors(g, maxNeighbors, Double.MAX_VALUE); } BorderingDistanceMetric(SpatialDataDao dao, String layer); }
BorderingDistanceMetric implements SpatialDistanceMetric { @Override public List<Neighbor> getNeighbors(Geometry g, int maxNeighbors) { return getNeighbors(g, maxNeighbors, Double.MAX_VALUE); } BorderingDistanceMetric(SpatialDataDao dao, String layer); @Override void setValidConcepts(TIntSet concepts); @Override void e...
BorderingDistanceMetric implements SpatialDistanceMetric { @Override public List<Neighbor> getNeighbors(Geometry g, int maxNeighbors) { return getNeighbors(g, maxNeighbors, Double.MAX_VALUE); } BorderingDistanceMetric(SpatialDataDao dao, String layer); @Override void setValidConcepts(TIntSet concepts); @Override void e...
@Test(expected=IllegalArgumentException.class) public void testNonexistentByLangCode() { Language.getByLangCode("zz"); }
public static Language getByLangCode(String langCode) { langCode = langCode.replace('_', '-').toLowerCase(); if (WIKIDATA.getLangCode().equals(langCode)) { return WIKIDATA; } for (Language lang : LANGUAGES) { if (lang.langCode.equalsIgnoreCase(langCode)) { return lang; } } throw new IllegalArgumentException("unknown la...
Language implements Comparable<Language>, Serializable { public static Language getByLangCode(String langCode) { langCode = langCode.replace('_', '-').toLowerCase(); if (WIKIDATA.getLangCode().equals(langCode)) { return WIKIDATA; } for (Language lang : LANGUAGES) { if (lang.langCode.equalsIgnoreCase(langCode)) { return...
Language implements Comparable<Language>, Serializable { public static Language getByLangCode(String langCode) { langCode = langCode.replace('_', '-').toLowerCase(); if (WIKIDATA.getLangCode().equals(langCode)) { return WIKIDATA; } for (Language lang : LANGUAGES) { if (lang.langCode.equalsIgnoreCase(langCode)) { return...
Language implements Comparable<Language>, Serializable { public static Language getByLangCode(String langCode) { langCode = langCode.replace('_', '-').toLowerCase(); if (WIKIDATA.getLangCode().equals(langCode)) { return WIKIDATA; } for (Language lang : LANGUAGES) { if (lang.langCode.equalsIgnoreCase(langCode)) { return...
Language implements Comparable<Language>, Serializable { public static Language getByLangCode(String langCode) { langCode = langCode.replace('_', '-').toLowerCase(); if (WIKIDATA.getLangCode().equals(langCode)) { return WIKIDATA; } for (Language lang : LANGUAGES) { if (lang.langCode.equalsIgnoreCase(langCode)) { return...
@Test(expected=IllegalArgumentException.class) public void testNonexistentById() { Language.getById(-1); }
public static Language getById(int id) { if (0 < id && id <= LANGUAGES.length) { return LANGUAGES[id-1]; } else { throw new IllegalArgumentException("unknown language id: '" + id + "'"); } }
Language implements Comparable<Language>, Serializable { public static Language getById(int id) { if (0 < id && id <= LANGUAGES.length) { return LANGUAGES[id-1]; } else { throw new IllegalArgumentException("unknown language id: '" + id + "'"); } } }
Language implements Comparable<Language>, Serializable { public static Language getById(int id) { if (0 < id && id <= LANGUAGES.length) { return LANGUAGES[id-1]; } else { throw new IllegalArgumentException("unknown language id: '" + id + "'"); } } private Language(short id, String langCode, String enLangName, String n...
Language implements Comparable<Language>, Serializable { public static Language getById(int id) { if (0 < id && id <= LANGUAGES.length) { return LANGUAGES[id-1]; } else { throw new IllegalArgumentException("unknown language id: '" + id + "'"); } } private Language(short id, String langCode, String enLangName, String n...
Language implements Comparable<Language>, Serializable { public static Language getById(int id) { if (0 < id && id <= LANGUAGES.length) { return LANGUAGES[id-1]; } else { throw new IllegalArgumentException("unknown language id: '" + id + "'"); } } private Language(short id, String langCode, String enLangName, String n...
@Test public void testTitle(){ LanguageInfo lang = LanguageInfo.getByLangCode("en"); Title pokemon = new Title("Pokemon: The Movie",lang); assert (pokemon.getNamespaceString() == null); assert (pokemon.getNamespace()==NameSpace.ARTICLE); assert (pokemon.getTitleStringWithoutNamespace().equals("Pokemon: The Movie")); Ti...
public Title(String text, LanguageInfo language) { this(text, false, language); }
Title implements Externalizable { public Title(String text, LanguageInfo language) { this(text, false, language); } }
Title implements Externalizable { public Title(String text, LanguageInfo language) { this(text, false, language); } Title(String text, LanguageInfo language); Title(String text, boolean isCanonical, LanguageInfo lang); Title(String title, Language language); }
Title implements Externalizable { public Title(String text, LanguageInfo language) { this(text, false, language); } Title(String text, LanguageInfo language); Title(String text, boolean isCanonical, LanguageInfo lang); Title(String title, Language language); String getCanonicalTitle(); LanguageInfo getLanguageInfo();...
Title implements Externalizable { public Title(String text, LanguageInfo language) { this(text, false, language); } Title(String text, LanguageInfo language); Title(String text, boolean isCanonical, LanguageInfo lang); Title(String title, Language language); String getCanonicalTitle(); LanguageInfo getLanguageInfo();...
@Test public void testWikidataRawRecord() throws IOException, WpParseException { String json = WpIOUtils.resourceToString("/testPage.json"); WikidataParser parser = new WikidataParser(); WikidataEntity entity = parser.parse(json); assertEquals(entity.getType(), WikidataEntity.Type.ITEM); assertEquals(entity.getId(), 15...
public WikidataEntity parse(String json) throws WpParseException { JacksonTermedStatementDocument mwDoc; try { mwDoc = mapper.readValue(json, JacksonTermedStatementDocument.class); } catch (IOException e) { LOG.info("Error parsing: " + json); throw new WpParseException(e); } WikidataEntity record = new WikidataEntity(m...
WikidataParser { public WikidataEntity parse(String json) throws WpParseException { JacksonTermedStatementDocument mwDoc; try { mwDoc = mapper.readValue(json, JacksonTermedStatementDocument.class); } catch (IOException e) { LOG.info("Error parsing: " + json); throw new WpParseException(e); } WikidataEntity record = new...
WikidataParser { public WikidataEntity parse(String json) throws WpParseException { JacksonTermedStatementDocument mwDoc; try { mwDoc = mapper.readValue(json, JacksonTermedStatementDocument.class); } catch (IOException e) { LOG.info("Error parsing: " + json); throw new WpParseException(e); } WikidataEntity record = new...
WikidataParser { public WikidataEntity parse(String json) throws WpParseException { JacksonTermedStatementDocument mwDoc; try { mwDoc = mapper.readValue(json, JacksonTermedStatementDocument.class); } catch (IOException e) { LOG.info("Error parsing: " + json); throw new WpParseException(e); } WikidataEntity record = new...
WikidataParser { public WikidataEntity parse(String json) throws WpParseException { JacksonTermedStatementDocument mwDoc; try { mwDoc = mapper.readValue(json, JacksonTermedStatementDocument.class); } catch (IOException e) { LOG.info("Error parsing: " + json); throw new WpParseException(e); } WikidataEntity record = new...
@Test public void testUtils() { TIntFloatMap row1 = getMap(ROW1_IDS, ROW1_VALS); TIntFloatMap row2 = getMap(ROW2_IDS, ROW2_VALS); double expected = googleSimilarity(row1, row2); double actual = SimUtils.googleSimilarity(6, 5, 3, NUM_PAGES); assertEquals(expected, actual, 0.0001); }
public GoogleSimilarity(int numPages) { this.numPages = numPages; }
GoogleSimilarity implements VectorSimilarity { public GoogleSimilarity(int numPages) { this.numPages = numPages; } }
GoogleSimilarity implements VectorSimilarity { public GoogleSimilarity(int numPages) { this.numPages = numPages; } GoogleSimilarity(int numPages); }
GoogleSimilarity implements VectorSimilarity { public GoogleSimilarity(int numPages) { this.numPages = numPages; } GoogleSimilarity(int numPages); @Override synchronized void setMatrices(SparseMatrix features, SparseMatrix transpose, File dataDir); @Override double similarity(TIntFloatMap vector1, TIntFloatMap vector2)...
GoogleSimilarity implements VectorSimilarity { public GoogleSimilarity(int numPages) { this.numPages = numPages; } GoogleSimilarity(int numPages); @Override synchronized void setMatrices(SparseMatrix features, SparseMatrix transpose, File dataDir); @Override double similarity(TIntFloatMap vector1, TIntFloatMap vector2)...
@Test public void testMap() { TIntFloatMap row1 = getMap(ROW1_IDS, ROW1_VALS); TIntFloatMap row2 = getMap(ROW2_IDS, ROW2_VALS); double expected = cosineSimilarity(row1, row2); double actual = new CosineSimilarity().similarity(row1, row2); assertEquals(expected, actual, 0.0001); actual = new CosineSimilarity().similarit...
@Override public double similarity(MatrixRow a, MatrixRow b) { return SimUtils.cosineSimilarity(a, b); }
CosineSimilarity implements VectorSimilarity { @Override public double similarity(MatrixRow a, MatrixRow b) { return SimUtils.cosineSimilarity(a, b); } }
CosineSimilarity implements VectorSimilarity { @Override public double similarity(MatrixRow a, MatrixRow b) { return SimUtils.cosineSimilarity(a, b); } }
CosineSimilarity implements VectorSimilarity { @Override public double similarity(MatrixRow a, MatrixRow b) { return SimUtils.cosineSimilarity(a, b); } @Override synchronized void setMatrices(SparseMatrix features, SparseMatrix transpose, File dataDir); @Override double similarity(MatrixRow a, MatrixRow b); @Override ...
CosineSimilarity implements VectorSimilarity { @Override public double similarity(MatrixRow a, MatrixRow b) { return SimUtils.cosineSimilarity(a, b); } @Override synchronized void setMatrices(SparseMatrix features, SparseMatrix transpose, File dataDir); @Override double similarity(MatrixRow a, MatrixRow b); @Override ...
@Test public void testRows() { TIntFloatMap map1 = getMap(ROW1_IDS, ROW1_VALS); TIntFloatMap map2 = getMap(ROW2_IDS, ROW2_VALS); SparseMatrixRow row1 = getRow(ROW1_IDS, ROW1_VALS); SparseMatrixRow row2 = getRow(ROW2_IDS, ROW2_VALS); double expected = cosineSimilarity(map1, map2); double actual = new CosineSimilarity()....
@Override public double similarity(MatrixRow a, MatrixRow b) { return SimUtils.cosineSimilarity(a, b); }
CosineSimilarity implements VectorSimilarity { @Override public double similarity(MatrixRow a, MatrixRow b) { return SimUtils.cosineSimilarity(a, b); } }
CosineSimilarity implements VectorSimilarity { @Override public double similarity(MatrixRow a, MatrixRow b) { return SimUtils.cosineSimilarity(a, b); } }
CosineSimilarity implements VectorSimilarity { @Override public double similarity(MatrixRow a, MatrixRow b) { return SimUtils.cosineSimilarity(a, b); } @Override synchronized void setMatrices(SparseMatrix features, SparseMatrix transpose, File dataDir); @Override double similarity(MatrixRow a, MatrixRow b); @Override ...
CosineSimilarity implements VectorSimilarity { @Override public double similarity(MatrixRow a, MatrixRow b) { return SimUtils.cosineSimilarity(a, b); } @Override synchronized void setMatrices(SparseMatrix features, SparseMatrix transpose, File dataDir); @Override double similarity(MatrixRow a, MatrixRow b); @Override ...
@Ignore @Test public void benchmark() { int numOuter = 100; int numInner = 10000; long before = System.currentTimeMillis(); double sum = 0; Random random = new Random(); for (int i = 0; i < numOuter; i++) { int overlap[] = new int[10]; for (int j = 0; j < overlap.length; j++) { overlap[j] = random.nextInt(Integer.MAX_V...
@Override public double similarity(MatrixRow a, MatrixRow b) { return SimUtils.cosineSimilarity(a, b); }
CosineSimilarity implements VectorSimilarity { @Override public double similarity(MatrixRow a, MatrixRow b) { return SimUtils.cosineSimilarity(a, b); } }
CosineSimilarity implements VectorSimilarity { @Override public double similarity(MatrixRow a, MatrixRow b) { return SimUtils.cosineSimilarity(a, b); } }
CosineSimilarity implements VectorSimilarity { @Override public double similarity(MatrixRow a, MatrixRow b) { return SimUtils.cosineSimilarity(a, b); } @Override synchronized void setMatrices(SparseMatrix features, SparseMatrix transpose, File dataDir); @Override double similarity(MatrixRow a, MatrixRow b); @Override ...
CosineSimilarity implements VectorSimilarity { @Override public double similarity(MatrixRow a, MatrixRow b) { return SimUtils.cosineSimilarity(a, b); } @Override synchronized void setMatrices(SparseMatrix features, SparseMatrix transpose, File dataDir); @Override double similarity(MatrixRow a, MatrixRow b); @Override ...
@Test public void testCosineSimilarity() { TIntDoubleHashMap zeroVector = zeroVector(keyList1); TIntDoubleHashMap testVector1 = testVector(keyList2, 0); TIntDoubleHashMap testVector2 = testVector(keyList2, 1); assertEquals("Cosine similarity between a vector and itself must be 1", 1.0, SimUtils.cosineSimilarity(testVec...
public static double cosineSimilarity(TIntDoubleMap X, TIntDoubleMap Y) { double xDotX = 0.0; double yDotY = 0.0; double xDotY = 0.0; for (int id : X.keys()) { double x = X.get(id); xDotX += x * x; if (Y.containsKey(id)) { xDotY += x * Y.get(id); } } for (double y : Y.values()) { yDotY += y * y; } return xDotX * yDotY ...
SimUtils { public static double cosineSimilarity(TIntDoubleMap X, TIntDoubleMap Y) { double xDotX = 0.0; double yDotY = 0.0; double xDotY = 0.0; for (int id : X.keys()) { double x = X.get(id); xDotX += x * x; if (Y.containsKey(id)) { xDotY += x * Y.get(id); } } for (double y : Y.values()) { yDotY += y * y; } return xDo...
SimUtils { public static double cosineSimilarity(TIntDoubleMap X, TIntDoubleMap Y) { double xDotX = 0.0; double yDotY = 0.0; double xDotY = 0.0; for (int id : X.keys()) { double x = X.get(id); xDotX += x * x; if (Y.containsKey(id)) { xDotY += x * Y.get(id); } } for (double y : Y.values()) { yDotY += y * y; } return xDo...
SimUtils { public static double cosineSimilarity(TIntDoubleMap X, TIntDoubleMap Y) { double xDotX = 0.0; double yDotY = 0.0; double xDotY = 0.0; for (int id : X.keys()) { double x = X.get(id); xDotX += x * x; if (Y.containsKey(id)) { xDotY += x * Y.get(id); } } for (double y : Y.values()) { yDotY += y * y; } return xDo...
SimUtils { public static double cosineSimilarity(TIntDoubleMap X, TIntDoubleMap Y) { double xDotX = 0.0; double yDotY = 0.0; double xDotY = 0.0; for (int id : X.keys()) { double x = X.get(id); xDotX += x * x; if (Y.containsKey(id)) { xDotY += x * Y.get(id); } } for (double y : Y.values()) { yDotY += y * y; } return xDo...
@Test public void testNormalizeVector() { TIntDoubleHashMap zeroVector1 = zeroVector(keyList1); TIntDoubleHashMap testVector1 = testVector(keyList2, 0); TIntDoubleHashMap testVector2 = testVector(keyList2, 1); TIntDoubleMap zeroVector1Normalized = SimUtils.normalizeVector(zeroVector1); TIntDoubleMap testVector1Normaliz...
public static TIntDoubleMap normalizeVector(TIntDoubleMap X) { TIntDoubleHashMap Y = new TIntDoubleHashMap(); double sumSquares = 0.0; for (double x : X.values()) { sumSquares += x * x; } if (sumSquares != 0.0) { double norm = Math.sqrt(sumSquares); for (int id : X.keys()) { Y.put(id, X.get(id) / norm); } return Y; } r...
SimUtils { public static TIntDoubleMap normalizeVector(TIntDoubleMap X) { TIntDoubleHashMap Y = new TIntDoubleHashMap(); double sumSquares = 0.0; for (double x : X.values()) { sumSquares += x * x; } if (sumSquares != 0.0) { double norm = Math.sqrt(sumSquares); for (int id : X.keys()) { Y.put(id, X.get(id) / norm); } re...
SimUtils { public static TIntDoubleMap normalizeVector(TIntDoubleMap X) { TIntDoubleHashMap Y = new TIntDoubleHashMap(); double sumSquares = 0.0; for (double x : X.values()) { sumSquares += x * x; } if (sumSquares != 0.0) { double norm = Math.sqrt(sumSquares); for (int id : X.keys()) { Y.put(id, X.get(id) / norm); } re...
SimUtils { public static TIntDoubleMap normalizeVector(TIntDoubleMap X) { TIntDoubleHashMap Y = new TIntDoubleHashMap(); double sumSquares = 0.0; for (double x : X.values()) { sumSquares += x * x; } if (sumSquares != 0.0) { double norm = Math.sqrt(sumSquares); for (int id : X.keys()) { Y.put(id, X.get(id) / norm); } re...
SimUtils { public static TIntDoubleMap normalizeVector(TIntDoubleMap X) { TIntDoubleHashMap Y = new TIntDoubleHashMap(); double sumSquares = 0.0; for (double x : X.values()) { sumSquares += x * x; } if (sumSquares != 0.0) { double norm = Math.sqrt(sumSquares); for (int id : X.keys()) { Y.put(id, X.get(id) / norm); } re...
@Test public void testLattice() throws DaoException { GraphDistanceMetric metric = getLatticeMetric(); assertEquals(1.0, metric.distance(lattice[2][0], lattice[0][0]), 0.01); assertEquals(1.0, metric.distance(lattice[2][0], lattice[1][0]), 0.01); assertEquals(0.0, metric.distance(lattice[2][0], lattice[2][0]), 0.01); a...
@Override public double distance(Geometry g1, Geometry g2) { if (adjacencyList.isEmpty()) { throw new UnsupportedOperationException(); } List<ClosestPointIndex.Result> closest = index.query(g2, 1); int maxSteps = maxDistance; if (maxSteps == 0 || closest.isEmpty()) { return Double.POSITIVE_INFINITY; } if (g1 == g2 || g...
GraphDistanceMetric implements SpatialDistanceMetric { @Override public double distance(Geometry g1, Geometry g2) { if (adjacencyList.isEmpty()) { throw new UnsupportedOperationException(); } List<ClosestPointIndex.Result> closest = index.query(g2, 1); int maxSteps = maxDistance; if (maxSteps == 0 || closest.isEmpty())...
GraphDistanceMetric implements SpatialDistanceMetric { @Override public double distance(Geometry g1, Geometry g2) { if (adjacencyList.isEmpty()) { throw new UnsupportedOperationException(); } List<ClosestPointIndex.Result> closest = index.query(g2, 1); int maxSteps = maxDistance; if (maxSteps == 0 || closest.isEmpty())...
GraphDistanceMetric implements SpatialDistanceMetric { @Override public double distance(Geometry g1, Geometry g2) { if (adjacencyList.isEmpty()) { throw new UnsupportedOperationException(); } List<ClosestPointIndex.Result> closest = index.query(g2, 1); int maxSteps = maxDistance; if (maxSteps == 0 || closest.isEmpty())...
GraphDistanceMetric implements SpatialDistanceMetric { @Override public double distance(Geometry g1, Geometry g2) { if (adjacencyList.isEmpty()) { throw new UnsupportedOperationException(); } List<ClosestPointIndex.Result> closest = index.query(g2, 1); int maxSteps = maxDistance; if (maxSteps == 0 || closest.isEmpty())...
@Test public void testSortByValue() { int testMapSize = 1000; Random random = new Random(System.currentTimeMillis()); TIntDoubleHashMap testMap = new TIntDoubleHashMap(); for(int i = 0 ; i < testMapSize ; ++i) { testMap.put(random.nextInt(), random.nextDouble()); } Map<Integer, Double> sortedMap = SimUtils.sortByValue(...
public static Map sortByValue(TIntDoubleHashMap unsortMap) { if (unsortMap.isEmpty()) { return new HashMap(); } HashMap<Integer, Double> tempMap = new HashMap<Integer, Double>(); TIntDoubleIterator iterator = unsortMap.iterator(); for ( int i = unsortMap.size(); i-- > 0; ) { iterator.advance(); tempMap.put( iterator.ke...
SimUtils { public static Map sortByValue(TIntDoubleHashMap unsortMap) { if (unsortMap.isEmpty()) { return new HashMap(); } HashMap<Integer, Double> tempMap = new HashMap<Integer, Double>(); TIntDoubleIterator iterator = unsortMap.iterator(); for ( int i = unsortMap.size(); i-- > 0; ) { iterator.advance(); tempMap.put( ...
SimUtils { public static Map sortByValue(TIntDoubleHashMap unsortMap) { if (unsortMap.isEmpty()) { return new HashMap(); } HashMap<Integer, Double> tempMap = new HashMap<Integer, Double>(); TIntDoubleIterator iterator = unsortMap.iterator(); for ( int i = unsortMap.size(); i-- > 0; ) { iterator.advance(); tempMap.put( ...
SimUtils { public static Map sortByValue(TIntDoubleHashMap unsortMap) { if (unsortMap.isEmpty()) { return new HashMap(); } HashMap<Integer, Double> tempMap = new HashMap<Integer, Double>(); TIntDoubleIterator iterator = unsortMap.iterator(); for ( int i = unsortMap.size(); i-- > 0; ) { iterator.advance(); tempMap.put( ...
SimUtils { public static Map sortByValue(TIntDoubleHashMap unsortMap) { if (unsortMap.isEmpty()) { return new HashMap(); } HashMap<Integer, Double> tempMap = new HashMap<Integer, Double>(); TIntDoubleIterator iterator = unsortMap.iterator(); for ( int i = unsortMap.size(); i-- > 0; ) { iterator.advance(); tempMap.put( ...
@Test public void testInfos() throws DaoException { Collection<DatasetDao.Info> infos = DatasetDao.readInfos(); assertEquals(18, infos.size()); }
public static Collection<Info> readInfos() throws DaoException { try { return readInfos(WpIOUtils.openResource(RESOURCE_DATASET_INFO)); } catch (IOException e) { throw new DaoException(e); } }
DatasetDao { public static Collection<Info> readInfos() throws DaoException { try { return readInfos(WpIOUtils.openResource(RESOURCE_DATASET_INFO)); } catch (IOException e) { throw new DaoException(e); } } }
DatasetDao { public static Collection<Info> readInfos() throws DaoException { try { return readInfos(WpIOUtils.openResource(RESOURCE_DATASET_INFO)); } catch (IOException e) { throw new DaoException(e); } } DatasetDao(); DatasetDao(Collection<Info> info); }
DatasetDao { public static Collection<Info> readInfos() throws DaoException { try { return readInfos(WpIOUtils.openResource(RESOURCE_DATASET_INFO)); } catch (IOException e) { throw new DaoException(e); } } DatasetDao(); DatasetDao(Collection<Info> info); void setNormalize(boolean normalize); List<Dataset> getAllInLang...
DatasetDao { public static Collection<Info> readInfos() throws DaoException { try { return readInfos(WpIOUtils.openResource(RESOURCE_DATASET_INFO)); } catch (IOException e) { throw new DaoException(e); } } DatasetDao(); DatasetDao(Collection<Info> info); void setNormalize(boolean normalize); List<Dataset> getAllInLang...
@Test public void testDaoRead() throws DaoException { DatasetDao dao = new DatasetDao(); Dataset ds = dao.get(Language.getByLangCode("en"), "wordsim353.txt"); assertEquals(353, ds.getData().size()); assertEquals("en", ds.getLanguage().getLangCode()); double sim = Double.NaN; for (KnownSim ks : ds.getData()) { if (ks.ph...
public Dataset get(Language language, String name) throws DaoException { if (groups.containsKey(name)) { List<Dataset> members = new ArrayList<Dataset>(); for (String n : groups.get(name)) { members.add(get(language, n)); } return new Dataset(name, members); } if (name.contains("/") || name.contains("\\")) { throw new ...
DatasetDao { public Dataset get(Language language, String name) throws DaoException { if (groups.containsKey(name)) { List<Dataset> members = new ArrayList<Dataset>(); for (String n : groups.get(name)) { members.add(get(language, n)); } return new Dataset(name, members); } if (name.contains("/") || name.contains("\\"))...
DatasetDao { public Dataset get(Language language, String name) throws DaoException { if (groups.containsKey(name)) { List<Dataset> members = new ArrayList<Dataset>(); for (String n : groups.get(name)) { members.add(get(language, n)); } return new Dataset(name, members); } if (name.contains("/") || name.contains("\\"))...
DatasetDao { public Dataset get(Language language, String name) throws DaoException { if (groups.containsKey(name)) { List<Dataset> members = new ArrayList<Dataset>(); for (String n : groups.get(name)) { members.add(get(language, n)); } return new Dataset(name, members); } if (name.contains("/") || name.contains("\\"))...
DatasetDao { public Dataset get(Language language, String name) throws DaoException { if (groups.containsKey(name)) { List<Dataset> members = new ArrayList<Dataset>(); for (String n : groups.get(name)) { members.add(get(language, n)); } return new Dataset(name, members); } if (name.contains("/") || name.contains("\\"))...
@Test public void testNdgc() { double ndgc = ( (0.80 + 0.00 / Math.log(2+1) + 0.95 / Math.log(4+1) + 0.91 / Math.log(7+1)) / (0.95 + 0.91 / Math.log(2+1) + 0.80 / Math.log(4+1) + 0.00 / Math.log(7+1))); assertEquals(ndgc, guess.getNDGC(), 0.001); }
public double getNDGC() { if (observations.isEmpty()) { return 0.0; } TIntDoubleMap actual = new TIntDoubleHashMap(); for (KnownSim ks : known.getMostSimilar()) { actual.put(ks.wpId2, ks.similarity); } int ranks[] = new int[observations.size()]; double scores[] = new double[observations.size()]; double s = 0.0; for (in...
MostSimilarGuess { public double getNDGC() { if (observations.isEmpty()) { return 0.0; } TIntDoubleMap actual = new TIntDoubleHashMap(); for (KnownSim ks : known.getMostSimilar()) { actual.put(ks.wpId2, ks.similarity); } int ranks[] = new int[observations.size()]; double scores[] = new double[observations.size()]; doub...
MostSimilarGuess { public double getNDGC() { if (observations.isEmpty()) { return 0.0; } TIntDoubleMap actual = new TIntDoubleHashMap(); for (KnownSim ks : known.getMostSimilar()) { actual.put(ks.wpId2, ks.similarity); } int ranks[] = new int[observations.size()]; double scores[] = new double[observations.size()]; doub...
MostSimilarGuess { public double getNDGC() { if (observations.isEmpty()) { return 0.0; } TIntDoubleMap actual = new TIntDoubleHashMap(); for (KnownSim ks : known.getMostSimilar()) { actual.put(ks.wpId2, ks.similarity); } int ranks[] = new int[observations.size()]; double scores[] = new double[observations.size()]; doub...
MostSimilarGuess { public double getNDGC() { if (observations.isEmpty()) { return 0.0; } TIntDoubleMap actual = new TIntDoubleHashMap(); for (KnownSim ks : known.getMostSimilar()) { actual.put(ks.wpId2, ks.similarity); } int ranks[] = new int[observations.size()]; double scores[] = new double[observations.size()]; doub...
@Test public void testPrecisionRecall() { PrecisionRecallAccumulator pr = guess.getPrecisionRecall(1, 0.7); assertEquals(pr.getN(), 1); assertEquals(1.0, pr.getPrecision(), 0.001); assertEquals(0.333333, pr.getRecall(), 0.001); pr = guess.getPrecisionRecall(2, 0.7); assertEquals(0.5, pr.getPrecision(), 0.001); assertEq...
public PrecisionRecallAccumulator getPrecisionRecall(int n, double threshold) { PrecisionRecallAccumulator pr = new PrecisionRecallAccumulator(n, threshold); TIntDoubleMap actual = new TIntDoubleHashMap(); for (KnownSim ks : known.getMostSimilar()) { pr.observe(ks.similarity); actual.put(ks.wpId2, ks.similarity); } for...
MostSimilarGuess { public PrecisionRecallAccumulator getPrecisionRecall(int n, double threshold) { PrecisionRecallAccumulator pr = new PrecisionRecallAccumulator(n, threshold); TIntDoubleMap actual = new TIntDoubleHashMap(); for (KnownSim ks : known.getMostSimilar()) { pr.observe(ks.similarity); actual.put(ks.wpId2, ks...
MostSimilarGuess { public PrecisionRecallAccumulator getPrecisionRecall(int n, double threshold) { PrecisionRecallAccumulator pr = new PrecisionRecallAccumulator(n, threshold); TIntDoubleMap actual = new TIntDoubleHashMap(); for (KnownSim ks : known.getMostSimilar()) { pr.observe(ks.similarity); actual.put(ks.wpId2, ks...
MostSimilarGuess { public PrecisionRecallAccumulator getPrecisionRecall(int n, double threshold) { PrecisionRecallAccumulator pr = new PrecisionRecallAccumulator(n, threshold); TIntDoubleMap actual = new TIntDoubleHashMap(); for (KnownSim ks : known.getMostSimilar()) { pr.observe(ks.similarity); actual.put(ks.wpId2, ks...
MostSimilarGuess { public PrecisionRecallAccumulator getPrecisionRecall(int n, double threshold) { PrecisionRecallAccumulator pr = new PrecisionRecallAccumulator(n, threshold); TIntDoubleMap actual = new TIntDoubleHashMap(); for (KnownSim ks : known.getMostSimilar()) { pr.observe(ks.similarity); actual.put(ks.wpId2, ks...
@Test public void testDownloader() throws IOException, InterruptedException { URL url = new URL("http: File tmp1 = File.createTempFile("downloader-test", ".txt"); FileDownloader downloader = new FileDownloader(); downloader.download(url, tmp1); assertTrue(tmp1.isFile()); List<String> lines = FileUtils.readLines(tmp1); ...
public File download(URL url, File file) throws InterruptedException { LOG.info("beginning download of " + url + " to " + file); for (int i=1; i <= maxAttempts; i++) { try { AtomicBoolean stop = new AtomicBoolean(false); DownloadInfo info = new DownloadInfo(url); DownloadMonitor monitor = new DownloadMonitor(info); inf...
FileDownloader { public File download(URL url, File file) throws InterruptedException { LOG.info("beginning download of " + url + " to " + file); for (int i=1; i <= maxAttempts; i++) { try { AtomicBoolean stop = new AtomicBoolean(false); DownloadInfo info = new DownloadInfo(url); DownloadMonitor monitor = new DownloadM...
FileDownloader { public File download(URL url, File file) throws InterruptedException { LOG.info("beginning download of " + url + " to " + file); for (int i=1; i <= maxAttempts; i++) { try { AtomicBoolean stop = new AtomicBoolean(false); DownloadInfo info = new DownloadInfo(url); DownloadMonitor monitor = new DownloadM...
FileDownloader { public File download(URL url, File file) throws InterruptedException { LOG.info("beginning download of " + url + " to " + file); for (int i=1; i <= maxAttempts; i++) { try { AtomicBoolean stop = new AtomicBoolean(false); DownloadInfo info = new DownloadInfo(url); DownloadMonitor monitor = new DownloadM...
FileDownloader { public File download(URL url, File file) throws InterruptedException { LOG.info("beginning download of " + url + " to " + file); for (int i=1; i <= maxAttempts; i++) { try { AtomicBoolean stop = new AtomicBoolean(false); DownloadInfo info = new DownloadInfo(url); DownloadMonitor monitor = new DownloadM...
@Test public void testDownloaderMove() throws IOException, InterruptedException { URL url = new URL("http: File tmp1 = File.createTempFile("downloader-test", ".txt"); File tmp3 = File.createTempFile("downloader-test", ".txt"); tmp1.delete(); tmp3.delete(); tmp3.deleteOnExit(); FileDownloader downloader = new FileDownlo...
public File download(URL url, File file) throws InterruptedException { LOG.info("beginning download of " + url + " to " + file); for (int i=1; i <= maxAttempts; i++) { try { AtomicBoolean stop = new AtomicBoolean(false); DownloadInfo info = new DownloadInfo(url); DownloadMonitor monitor = new DownloadMonitor(info); inf...
FileDownloader { public File download(URL url, File file) throws InterruptedException { LOG.info("beginning download of " + url + " to " + file); for (int i=1; i <= maxAttempts; i++) { try { AtomicBoolean stop = new AtomicBoolean(false); DownloadInfo info = new DownloadInfo(url); DownloadMonitor monitor = new DownloadM...
FileDownloader { public File download(URL url, File file) throws InterruptedException { LOG.info("beginning download of " + url + " to " + file); for (int i=1; i <= maxAttempts; i++) { try { AtomicBoolean stop = new AtomicBoolean(false); DownloadInfo info = new DownloadInfo(url); DownloadMonitor monitor = new DownloadM...
FileDownloader { public File download(URL url, File file) throws InterruptedException { LOG.info("beginning download of " + url + " to " + file); for (int i=1; i <= maxAttempts; i++) { try { AtomicBoolean stop = new AtomicBoolean(false); DownloadInfo info = new DownloadInfo(url); DownloadMonitor monitor = new DownloadM...
FileDownloader { public File download(URL url, File file) throws InterruptedException { LOG.info("beginning download of " + url + " to " + file); for (int i=1; i <= maxAttempts; i++) { try { AtomicBoolean stop = new AtomicBoolean(false); DownloadInfo info = new DownloadInfo(url); DownloadMonitor monitor = new DownloadM...
@Test public void testSerialization() throws IOException, ClassNotFoundException { String hex = "aced0005757200025b460b9c818922e00c4202000078700000055b402a056a3ff3a176400797813ffba962401a234e3ff8e2093fef799d40369d60403ef48e4011aa844001c25240321b0a3fdd8e863ff8e599400d8398400a180240032f43402841f23fe5936d4016e1014010ffae3...
public static Serializable bytesToObject(byte input[]) throws IOException, ClassNotFoundException { return (Serializable) new ObjectInputStream( new ByteArrayInputStream(input)) .readObject(); }
WpIOUtils { public static Serializable bytesToObject(byte input[]) throws IOException, ClassNotFoundException { return (Serializable) new ObjectInputStream( new ByteArrayInputStream(input)) .readObject(); } }
WpIOUtils { public static Serializable bytesToObject(byte input[]) throws IOException, ClassNotFoundException { return (Serializable) new ObjectInputStream( new ByteArrayInputStream(input)) .readObject(); } }
WpIOUtils { public static Serializable bytesToObject(byte input[]) throws IOException, ClassNotFoundException { return (Serializable) new ObjectInputStream( new ByteArrayInputStream(input)) .readObject(); } static void mkdirsQuietly(File dir); static void writeObjectToFile(File file, Object o); static Object readObjec...
WpIOUtils { public static Serializable bytesToObject(byte input[]) throws IOException, ClassNotFoundException { return (Serializable) new ObjectInputStream( new ByteArrayInputStream(input)) .readObject(); } static void mkdirsQuietly(File dir); static void writeObjectToFile(File file, Object o); static Object readObjec...
@Test public void testFullClassName() { assertEquals("org.wikibrain.utils.JvmUtils", JvmUtils.getFullClassName("JvmUtils")); assertNull(JvmUtils.getFullClassName("Foozkjasdf")); }
public synchronized static String getFullClassName(String shortName) { if (NAME_TO_CLASS != null) { return NAME_TO_CLASS.get(shortName); } NAME_TO_CLASS = new HashMap<String, String>(); for (File file : getClassPathAsList()) { if (file.length() > MAX_FILE_SIZE) { LOG.debug("skipping looking for providers in large file ...
JvmUtils { public synchronized static String getFullClassName(String shortName) { if (NAME_TO_CLASS != null) { return NAME_TO_CLASS.get(shortName); } NAME_TO_CLASS = new HashMap<String, String>(); for (File file : getClassPathAsList()) { if (file.length() > MAX_FILE_SIZE) { LOG.debug("skipping looking for providers in ...
JvmUtils { public synchronized static String getFullClassName(String shortName) { if (NAME_TO_CLASS != null) { return NAME_TO_CLASS.get(shortName); } NAME_TO_CLASS = new HashMap<String, String>(); for (File file : getClassPathAsList()) { if (file.length() > MAX_FILE_SIZE) { LOG.debug("skipping looking for providers in ...
JvmUtils { public synchronized static String getFullClassName(String shortName) { if (NAME_TO_CLASS != null) { return NAME_TO_CLASS.get(shortName); } NAME_TO_CLASS = new HashMap<String, String>(); for (File file : getClassPathAsList()) { if (file.length() > MAX_FILE_SIZE) { LOG.debug("skipping looking for providers in ...
JvmUtils { public synchronized static String getFullClassName(String shortName) { if (NAME_TO_CLASS != null) { return NAME_TO_CLASS.get(shortName); } NAME_TO_CLASS = new HashMap<String, String>(); for (File file : getClassPathAsList()) { if (file.length() > MAX_FILE_SIZE) { LOG.debug("skipping looking for providers in ...
@Test public void testClassForShortName() { assertEquals(JvmUtils.class, JvmUtils.classForShortName("JvmUtils")); assertNull(JvmUtils.classForShortName("Foozkjasdf")); }
public static Class classForShortName(String shortName) { String fullName = getFullClassName(shortName); if (fullName == null) { return null; } try { return Class.forName(fullName); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } }
JvmUtils { public static Class classForShortName(String shortName) { String fullName = getFullClassName(shortName); if (fullName == null) { return null; } try { return Class.forName(fullName); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } }
JvmUtils { public static Class classForShortName(String shortName) { String fullName = getFullClassName(shortName); if (fullName == null) { return null; } try { return Class.forName(fullName); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } }
JvmUtils { public static Class classForShortName(String shortName) { String fullName = getFullClassName(shortName); if (fullName == null) { return null; } try { return Class.forName(fullName); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } static String getClassPath(); synchronized static List...
JvmUtils { public static Class classForShortName(String shortName) { String fullName = getFullClassName(shortName); if (fullName == null) { return null; } try { return Class.forName(fullName); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } static String getClassPath(); synchronized static List...
@Test public void testSimple() throws ConfigurationException { Configurator conf = new Configurator(new Configuration()); Integer i = conf.get(Integer.class, "foo"); assertEquals(i, 42); Integer j = conf.get(Integer.class, "bar"); assertEquals(j, 23); Integer k = conf.get(Integer.class, "baz"); assertEquals(k, 0); Inte...
public <T> T get(Class<T> klass, String name) throws ConfigurationException { return get(klass, name, null); }
Configurator implements Cloneable { public <T> T get(Class<T> klass, String name) throws ConfigurationException { return get(klass, name, null); } }
Configurator implements Cloneable { public <T> T get(Class<T> klass, String name) throws ConfigurationException { return get(klass, name, null); } Configurator(Configuration conf); }
Configurator implements Cloneable { public <T> T get(Class<T> klass, String name) throws ConfigurationException { return get(klass, name, null); } Configurator(Configuration conf); Configuration getConf(); T get(Class<T> klass, String name); T get(Class<T> klass, String name, String runtimeKey, String runtimeValue); T ...
Configurator implements Cloneable { public <T> T get(Class<T> klass, String name) throws ConfigurationException { return get(klass, name, null); } Configurator(Configuration conf); Configuration getConf(); T get(Class<T> klass, String name); T get(Class<T> klass, String name, String runtimeKey, String runtimeValue); T ...
@Test public void testNonExistentJar() throws ConfigurationException { String separator = System.getProperty("path.separator"); System.setProperty("java.class.path", System.getProperty("java.class.path") + separator + "foobarbaz.jar"); Configurator conf = new Configurator(new Configuration()); Integer i = conf.get(Inte...
public <T> T get(Class<T> klass, String name) throws ConfigurationException { return get(klass, name, null); }
Configurator implements Cloneable { public <T> T get(Class<T> klass, String name) throws ConfigurationException { return get(klass, name, null); } }
Configurator implements Cloneable { public <T> T get(Class<T> klass, String name) throws ConfigurationException { return get(klass, name, null); } Configurator(Configuration conf); }
Configurator implements Cloneable { public <T> T get(Class<T> klass, String name) throws ConfigurationException { return get(klass, name, null); } Configurator(Configuration conf); Configuration getConf(); T get(Class<T> klass, String name); T get(Class<T> klass, String name, String runtimeKey, String runtimeValue); T ...
Configurator implements Cloneable { public <T> T get(Class<T> klass, String name) throws ConfigurationException { return get(klass, name, null); } Configurator(Configuration conf); Configuration getConf(); T get(Class<T> klass, String name); T get(Class<T> klass, String name, String runtimeKey, String runtimeValue); T ...
@Test public void testGetProcessGroupStatusMetrics() { ProcessGroupStatus status = new ProcessGroupStatus(); status.setId("1234"); status.setFlowFilesReceived(5); status.setBytesReceived(10000); status.setFlowFilesSent(10); status.setBytesSent(20000); status.setQueuedCount(100); status.setQueuedContentSize(1024L); stat...
public Map<String, String> getMetrics(ProcessGroupStatus status, boolean appendPgId) { final Map<String, String> metrics = new HashMap<>(); metrics.put(appendPgId(MetricNames.FLOW_FILES_RECEIVED, status, appendPgId), String.valueOf(status.getFlowFilesReceived())); metrics.put(appendPgId(MetricNames.BYTES_RECEIVED, stat...
MetricsService { public Map<String, String> getMetrics(ProcessGroupStatus status, boolean appendPgId) { final Map<String, String> metrics = new HashMap<>(); metrics.put(appendPgId(MetricNames.FLOW_FILES_RECEIVED, status, appendPgId), String.valueOf(status.getFlowFilesReceived())); metrics.put(appendPgId(MetricNames.BYT...
MetricsService { public Map<String, String> getMetrics(ProcessGroupStatus status, boolean appendPgId) { final Map<String, String> metrics = new HashMap<>(); metrics.put(appendPgId(MetricNames.FLOW_FILES_RECEIVED, status, appendPgId), String.valueOf(status.getFlowFilesReceived())); metrics.put(appendPgId(MetricNames.BYT...
MetricsService { public Map<String, String> getMetrics(ProcessGroupStatus status, boolean appendPgId) { final Map<String, String> metrics = new HashMap<>(); metrics.put(appendPgId(MetricNames.FLOW_FILES_RECEIVED, status, appendPgId), String.valueOf(status.getFlowFilesReceived())); metrics.put(appendPgId(MetricNames.BYT...
MetricsService { public Map<String, String> getMetrics(ProcessGroupStatus status, boolean appendPgId) { final Map<String, String> metrics = new HashMap<>(); metrics.put(appendPgId(MetricNames.FLOW_FILES_RECEIVED, status, appendPgId), String.valueOf(status.getFlowFilesReceived())); metrics.put(appendPgId(MetricNames.BYT...
@Test public void testGetProcessGroupStatusMetricsWithID() { ProcessGroupStatus status = new ProcessGroupStatus(); String id = "1234"; status.setId(id); status.setFlowFilesReceived(5); status.setBytesReceived(10000); status.setFlowFilesSent(10); status.setBytesSent(20000); status.setQueuedCount(100); status.setQueuedCo...
public Map<String, String> getMetrics(ProcessGroupStatus status, boolean appendPgId) { final Map<String, String> metrics = new HashMap<>(); metrics.put(appendPgId(MetricNames.FLOW_FILES_RECEIVED, status, appendPgId), String.valueOf(status.getFlowFilesReceived())); metrics.put(appendPgId(MetricNames.BYTES_RECEIVED, stat...
MetricsService { public Map<String, String> getMetrics(ProcessGroupStatus status, boolean appendPgId) { final Map<String, String> metrics = new HashMap<>(); metrics.put(appendPgId(MetricNames.FLOW_FILES_RECEIVED, status, appendPgId), String.valueOf(status.getFlowFilesReceived())); metrics.put(appendPgId(MetricNames.BYT...
MetricsService { public Map<String, String> getMetrics(ProcessGroupStatus status, boolean appendPgId) { final Map<String, String> metrics = new HashMap<>(); metrics.put(appendPgId(MetricNames.FLOW_FILES_RECEIVED, status, appendPgId), String.valueOf(status.getFlowFilesReceived())); metrics.put(appendPgId(MetricNames.BYT...
MetricsService { public Map<String, String> getMetrics(ProcessGroupStatus status, boolean appendPgId) { final Map<String, String> metrics = new HashMap<>(); metrics.put(appendPgId(MetricNames.FLOW_FILES_RECEIVED, status, appendPgId), String.valueOf(status.getFlowFilesReceived())); metrics.put(appendPgId(MetricNames.BYT...
MetricsService { public Map<String, String> getMetrics(ProcessGroupStatus status, boolean appendPgId) { final Map<String, String> metrics = new HashMap<>(); metrics.put(appendPgId(MetricNames.FLOW_FILES_RECEIVED, status, appendPgId), String.valueOf(status.getFlowFilesReceived())); metrics.put(appendPgId(MetricNames.BYT...
@Test public void testGetVirtualMachineMetrics() { final VirtualMachineMetrics virtualMachineMetrics = VirtualMachineMetrics.getInstance(); final MetricsService service = new MetricsService(); final Map<String, String> metrics = service.getMetrics(virtualMachineMetrics); Assert.assertTrue(metrics.containsKey(MetricName...
public Map<String, String> getMetrics(ProcessGroupStatus status, boolean appendPgId) { final Map<String, String> metrics = new HashMap<>(); metrics.put(appendPgId(MetricNames.FLOW_FILES_RECEIVED, status, appendPgId), String.valueOf(status.getFlowFilesReceived())); metrics.put(appendPgId(MetricNames.BYTES_RECEIVED, stat...
MetricsService { public Map<String, String> getMetrics(ProcessGroupStatus status, boolean appendPgId) { final Map<String, String> metrics = new HashMap<>(); metrics.put(appendPgId(MetricNames.FLOW_FILES_RECEIVED, status, appendPgId), String.valueOf(status.getFlowFilesReceived())); metrics.put(appendPgId(MetricNames.BYT...
MetricsService { public Map<String, String> getMetrics(ProcessGroupStatus status, boolean appendPgId) { final Map<String, String> metrics = new HashMap<>(); metrics.put(appendPgId(MetricNames.FLOW_FILES_RECEIVED, status, appendPgId), String.valueOf(status.getFlowFilesReceived())); metrics.put(appendPgId(MetricNames.BYT...
MetricsService { public Map<String, String> getMetrics(ProcessGroupStatus status, boolean appendPgId) { final Map<String, String> metrics = new HashMap<>(); metrics.put(appendPgId(MetricNames.FLOW_FILES_RECEIVED, status, appendPgId), String.valueOf(status.getFlowFilesReceived())); metrics.put(appendPgId(MetricNames.BYT...
MetricsService { public Map<String, String> getMetrics(ProcessGroupStatus status, boolean appendPgId) { final Map<String, String> metrics = new HashMap<>(); metrics.put(appendPgId(MetricNames.FLOW_FILES_RECEIVED, status, appendPgId), String.valueOf(status.getFlowFilesReceived())); metrics.put(appendPgId(MetricNames.BYT...