Author: [log in to unmask] Date: Wed Jul 29 17:30:12 2015 New Revision: 3299 Log: Change method name. Modified: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SampleZeroHVBiasChecker.java java/trunk/record-util/src/main/java/org/hps/record/epics/EpicsData.java java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/EpicsLog.java java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/RunSummaryUpdater.java Modified: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SampleZeroHVBiasChecker.java ============================================================================= --- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SampleZeroHVBiasChecker.java (original) +++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SampleZeroHVBiasChecker.java Wed Jul 29 17:30:12 2015 @@ -226,7 +226,7 @@ if (epicsData != null) { logger.info(epicsData.toString()); - if (epicsData.getUsedNames().contains("SVT:bias:top:0:v_sens")) { + if (epicsData.getKeys().contains("SVT:bias:top:0:v_sens")) { epicsBiasValue = epicsData.getValue("SVT:bias:top:0:v_sens"); logger.info("epicsBiasValue = " + Double.toString(epicsBiasValue)); Modified: java/trunk/record-util/src/main/java/org/hps/record/epics/EpicsData.java ============================================================================= --- java/trunk/record-util/src/main/java/org/hps/record/epics/EpicsData.java (original) +++ java/trunk/record-util/src/main/java/org/hps/record/epics/EpicsData.java Wed Jul 29 17:30:12 2015 @@ -12,8 +12,9 @@ import org.lcsim.event.GenericObject; /** - * This is an API for reading and writing EPICS data to LCIO events, as well as parsing the data from a CDATA section within an EVIO - * string data bank. The {@link #read(EventHeader)} method should be used to create one of these objects from an LCIO event. + * This is an API for reading and writing EPICS data to LCIO events, as well as parsing the data from a CDATA section + * within an EVIO string data bank. The {@link #read(EventHeader)} method should be used to create one of these objects + * from an LCIO event. * * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a> */ @@ -82,12 +83,12 @@ /** * Get the static list of all available EPICs variable names. * <p> - * This could be different than the variable names which were actually written into the collection header. For this, instead use the method - * {@link #getUsedNames()}. + * This could be different than the variable names which were actually written into the collection header. For this, + * instead use the method {@link #getKeys()}. * * @return the set of default EPICS variable names */ - public static Set<String> getDefaultNames() { + public static Set<String> getDefaultKeys() { return DESCRIPTIONS.keySet(); }; @@ -104,8 +105,8 @@ * <p> * Read data into this object from an LCIO event using the default collection name. * <p> - * This is the primary method for users to read the EPICS data into their Drivers in the {@link org.lcsim.util.Driver#process(EventHeader)} - * method. + * This is the primary method for users to read the EPICS data into their Drivers in the + * {@link org.lcsim.util.Driver#process(EventHeader)} method. * * @param event the LCIO event * @return the EPICS data from the event @@ -141,7 +142,8 @@ private final Map<String, Double> dataMap = new LinkedHashMap<String, Double>(); /** - * Given a list of names, read the double values from the {@link org.lcsim.event.GenericObject} into the data map of this object. + * Given a list of names, read the double values from the {@link org.lcsim.event.GenericObject} into the data map of + * this object. * * @param object the <code>GenericObject</code> with the data values * @param names The list of names. @@ -174,11 +176,12 @@ /** * Get the list of EPICS variables used by this object. * <p> - * This could potentially be different than the list of default names from {@link #getDefaultNames()} but it will usually be the same. + * This could potentially be different than the list of default names from {@link #getDefaultKeys()} but it will + * usually be the same. * * @return the list of used EPICS variable names */ - public Set<String> getUsedNames() { + public Set<String> getKeys() { return this.dataMap.keySet(); } @@ -189,6 +192,15 @@ */ public Double getValue(final String name) { return this.dataMap.get(name); + } + + /** + * Return <code>true</code> if the data has the given key. + * + * @return <code>true</code> if data has the given key + */ + public boolean hasKey(final String key) { + return this.getKeys().contains(key); } /** @@ -233,7 +245,8 @@ } /** - * Write this object's data into a <code>GenericObject</code> collection in the LCIO event using the default collection name. + * Write this object's data into a <code>GenericObject</code> collection in the LCIO event using the default + * collection name. * * @param event the LCIO event */ Modified: java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/EpicsLog.java ============================================================================= --- java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/EpicsLog.java (original) +++ java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/EpicsLog.java Wed Jul 29 17:30:12 2015 @@ -50,7 +50,7 @@ System.out.println(this.logData); // Compute means for all EPICS variables. - for (final String name : this.logData.getUsedNames()) { + for (final String name : this.logData.getKeys()) { final double total = this.logData.getValue(name); final double mean = total / this.counts.get(name); this.logData.setValue(name, mean); @@ -83,8 +83,8 @@ */ private void update() { if (this.currentEpicsData != null) { - for (final String name : this.currentEpicsData.getUsedNames()) { - if (!this.logData.getUsedNames().contains(name)) { + for (final String name : this.currentEpicsData.getKeys()) { + if (!this.logData.getKeys().contains(name)) { this.logData.setValue(name, 0.); } if (!this.counts.keySet().contains(name)) { Modified: java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/RunSummaryUpdater.java ============================================================================= --- java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/RunSummaryUpdater.java (original) +++ java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/RunSummaryUpdater.java Wed Jul 29 17:30:12 2015 @@ -197,7 +197,7 @@ .prepareStatement("INSERT INTO run_epics (run, variable_name, value) values (?, ?, ?)"); final EpicsData data = runSummary.getEpicsData(); if (data != null) { - for (final String variableName : data.getUsedNames()) { + for (final String variableName : data.getKeys()) { statement.setInt(1, this.run); statement.setString(2, variableName); statement.setDouble(3, data.getValue(variableName));