Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Interface to avoid useless warning with store objects
- Loading branch information
1 parent
bd3b86a
commit a42dcd4
Showing
19 changed files
with
166 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package jrds; | ||
|
||
import java.util.Date; | ||
import java.util.Map; | ||
|
||
public interface JrdsSample extends Map<String, Number>{ | ||
public Date getTime(); | ||
public void setTime(Date time); | ||
public void put(Map.Entry<String, Double> e); | ||
public Probe<?, ?> getProbe(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package jrds.store; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.rrd4j.data.Plottable; | ||
|
||
public abstract class AbstractExtractor<Source> implements Extractor { | ||
private final Map<Integer, Source> plotted = new HashMap<Integer, Source>(); | ||
|
||
public AbstractExtractor() { | ||
super(); | ||
} | ||
|
||
/* (non-Javadoc) | ||
* @see jrds.store.ExtractorInterface#getNames() | ||
*/ | ||
@Override | ||
public abstract String[] getNames(); | ||
|
||
/* (non-Javadoc) | ||
* @see jrds.store.ExtractorInterface#getDsNames() | ||
*/ | ||
@Override | ||
public abstract String[] getDsNames(); | ||
|
||
/* (non-Javadoc) | ||
* @see jrds.store.ExtractorInterface#getValues(jrds.store.ExtractInfo) | ||
*/ | ||
@Override | ||
public abstract double[][] getValues(ExtractInfo ei); | ||
|
||
/* (non-Javadoc) | ||
* @see jrds.store.ExtractorInterface#getSourceValues(jrds.store.ExtractInfo) | ||
*/ | ||
@Override | ||
public abstract double[] getSourceValues(ExtractInfo ei); | ||
|
||
protected Source getSource(ExtractInfo ei) { | ||
int signature = getSignature(ei); | ||
if(! plotted.containsKey(signature) ) { | ||
plotted.put(signature, newPlottableSource(ei)); | ||
} | ||
return plotted.get(signature); | ||
} | ||
|
||
/* (non-Javadoc) | ||
* @see jrds.store.ExtractorInterface#getPlottable(jrds.store.ExtractInfo) | ||
*/ | ||
@Override | ||
public final Plottable getPlottable(ExtractInfo ei) { | ||
Source s = getSource(ei); | ||
return newPlottable(s, ei); | ||
} | ||
|
||
protected abstract Source newPlottableSource(ExtractInfo ei); | ||
|
||
protected abstract Plottable newPlottable(Source s, ExtractInfo ei); | ||
|
||
/* (non-Javadoc) | ||
* @see jrds.store.ExtractorInterface#getTimestamps(jrds.store.ExtractInfo) | ||
*/ | ||
@Override | ||
public abstract long[] getTimestamps(ExtractInfo ei); | ||
|
||
/* (non-Javadoc) | ||
* @see jrds.store.ExtractorInterface#getColumnCount() | ||
*/ | ||
@Override | ||
public abstract int getColumnCount(); | ||
|
||
protected abstract int getSignature(ExtractInfo ei); | ||
|
||
/* (non-Javadoc) | ||
* @see jrds.store.ExtractorInterface#getValue(jrds.store.ExtractInfo) | ||
*/ | ||
@Override | ||
public abstract double getValue(ExtractInfo ei); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,17 @@ | ||
package jrds.store; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.rrd4j.data.Plottable; | ||
|
||
public abstract class Extractor<Source> { | ||
private final Map<Integer, Source> plotted = new HashMap<Integer, Source>(); | ||
|
||
public Extractor() { | ||
super(); | ||
} | ||
|
||
public abstract String[] getNames(); | ||
|
||
public abstract String[] getDsNames(); | ||
|
||
public abstract double[][] getValues(ExtractInfo ei); | ||
|
||
public abstract double[] getSourceValues(ExtractInfo ei); | ||
public interface Extractor { | ||
|
||
protected Source getSource(ExtractInfo ei) { | ||
int signature = getSignature(ei); | ||
if(! plotted.containsKey(signature) ) { | ||
plotted.put(signature, newPlottableSource(ei)); | ||
} | ||
return plotted.get(signature); | ||
} | ||
public String[] getNames(); | ||
public String[] getDsNames(); | ||
public double[][] getValues(ExtractInfo ei); | ||
public double[] getSourceValues(ExtractInfo ei); | ||
public Plottable getPlottable(ExtractInfo ei); | ||
public long[] getTimestamps(ExtractInfo ei); | ||
public int getColumnCount(); | ||
public double getValue(ExtractInfo ei); | ||
|
||
public final Plottable getPlottable(ExtractInfo ei) { | ||
Source s = getSource(ei); | ||
return newPlottable(s, ei); | ||
} | ||
|
||
protected abstract Source newPlottableSource(ExtractInfo ei); | ||
|
||
protected abstract Plottable newPlottable(Source s, ExtractInfo ei); | ||
|
||
public abstract long[] getTimestamps(ExtractInfo ei); | ||
|
||
public abstract int getColumnCount(); | ||
|
||
protected abstract int getSignature(ExtractInfo ei); | ||
|
||
public abstract double getValue(ExtractInfo ei); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.