refactor database class hierarchy
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database;
|
||||
|
||||
public class BitVector {
|
||||
public class BitVector implements IEvent {
|
||||
|
||||
private final int width;
|
||||
|
||||
@ -166,5 +166,20 @@ public class BitVector {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventKind getKind() {
|
||||
return EventKind.SINGLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getType() {
|
||||
return this.getClass();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEvent duplicate() throws CloneNotSupportedException {
|
||||
return (IEvent)this.clone();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,26 @@
|
||||
package com.minres.scviewer.database;
|
||||
|
||||
public class DoubleVal implements IEvent {
|
||||
|
||||
final double value;
|
||||
|
||||
public DoubleVal(double value) {
|
||||
this.value=value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventKind getKind() {
|
||||
return EventKind.SINGLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getType() {
|
||||
return this.getClass();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEvent duplicate() throws CloneNotSupportedException {
|
||||
return (IEvent) clone();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package com.minres.scviewer.database;
|
||||
|
||||
public enum EventKind {
|
||||
SINGLE, BEGIN, END
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.minres.scviewer.database;
|
||||
|
||||
public interface IEvent {
|
||||
|
||||
public IEvent duplicate() throws CloneNotSupportedException;
|
||||
|
||||
public EventKind getKind();
|
||||
|
||||
public Class<?> getType();
|
||||
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database;
|
||||
|
||||
import java.util.NavigableMap;
|
||||
|
||||
|
||||
public interface ISignal<T> extends IWaveform{
|
||||
|
||||
public NavigableMap<Long, T> getEvents();
|
||||
|
||||
public T getWaveformValueAtTime(Long time);
|
||||
|
||||
public T getWaveformValueBeforeTime(Long time);
|
||||
|
||||
public Class<?> getType();
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ public interface ITx extends Comparable<ITx>{
|
||||
|
||||
public Long getId();
|
||||
|
||||
public ITxStream<ITxEvent> getStream();
|
||||
public IWaveform getStream();
|
||||
|
||||
public ITxGenerator getGenerator();
|
||||
|
||||
|
@ -10,10 +10,9 @@
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database;
|
||||
|
||||
public interface ITxEvent extends IWaveformEvent {
|
||||
enum Type {BEGIN, END};
|
||||
public interface ITxEvent extends IEvent {
|
||||
|
||||
public Long getTime();
|
||||
|
||||
public ITx getTransaction();
|
||||
|
||||
public Type getType();
|
||||
public ITx getTransaction();
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import java.util.List;
|
||||
|
||||
public interface ITxGenerator {
|
||||
public Long getId();
|
||||
public ITxStream<ITxEvent> getStream();
|
||||
public IWaveform getStream();
|
||||
public String getName();
|
||||
public List<ITx> getTransactions();
|
||||
}
|
||||
|
@ -1,27 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.NavigableMap;
|
||||
|
||||
public interface ITxStream<T extends ITxEvent> extends IWaveform {
|
||||
|
||||
public List<ITxGenerator> getGenerators();
|
||||
|
||||
public int getMaxConcurrency();
|
||||
|
||||
public NavigableMap<Long, List<ITxEvent>> getEvents();
|
||||
|
||||
public Collection<T> getWaveformEventsAtTime(Long time);
|
||||
|
||||
}
|
@ -10,6 +10,7 @@
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database;
|
||||
|
||||
import java.util.NavigableMap;
|
||||
|
||||
public interface IWaveform extends IHierNode {
|
||||
|
||||
@ -21,4 +22,14 @@ public interface IWaveform extends IHierNode {
|
||||
|
||||
public Boolean equals(IWaveform other);
|
||||
|
||||
public NavigableMap<Long, IEvent[]> getEvents();
|
||||
|
||||
public IEvent[] getEventsAtTime(Long time);
|
||||
|
||||
public IEvent[] getEventsBeforeTime(Long time);
|
||||
|
||||
public Class<?> getType();
|
||||
|
||||
public int getMaxConcurrency();
|
||||
|
||||
}
|
||||
|
@ -1,20 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database;
|
||||
|
||||
|
||||
public interface IWaveformEvent extends Comparable<IWaveformEvent>{
|
||||
|
||||
public Long getTime();
|
||||
|
||||
public IWaveformEvent duplicate() throws CloneNotSupportedException;
|
||||
|
||||
}
|
Reference in New Issue
Block a user