Commit in hps-java/src/main/java/org/lcsim/hps/conditions/svt on MAIN | |||
ChannelData.java | -38 | 1.1 removed | |
ChannelLoader.java | -69 | 1.1 removed | |
ChannelMap.java | -30 | 1.1 removed | |
-137 |
remove classes that are not needed
diff -N ChannelData.java --- ChannelData.java 19 Sep 2013 01:27:15 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,38 +0,0 @@
-package org.lcsim.hps.conditions.svt; - -public class ChannelData { - - int fpga, hybrid, channel; - - ChannelData(int fpga, int hybrid, int channel) { - this.fpga = fpga; - this.hybrid = hybrid; - this.channel = channel; - } - - public int getFpga() { - return fpga; - } - - public int getHybrid() { - return hybrid; - } - - public int getChannel() { - return channel; - } - - /** - * Implementation of equals. - */ - public boolean equals(Object obj) { - if (obj == null) - return false; - if (obj == this) - return true; - if (!(obj instanceof ChannelData)) - return false; - ChannelData c = (ChannelData)obj; - return c.getFpga() == fpga && c.getHybrid() == hybrid && c.getChannel() == channel; - } -}
diff -N ChannelLoader.java --- ChannelLoader.java 19 Sep 2013 01:27:15 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,69 +0,0 @@
-package org.lcsim.hps.conditions.svt; - -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -import org.lcsim.hps.conditions.ConnectionManager; - -class ChannelLoader { - - private String channelTable = "svt_channels"; - ChannelMap channelMap = new ChannelMap(); - - ChannelLoader() { - } - - ChannelLoader(String channelTable) { - this.channelTable = channelTable; - } - - void loadChannels() { - Connection connection = ConnectionManager.createConnection(); - - Statement statement = null; - - try { - - statement = connection.createStatement(); - - String db = ConnectionManager.getConnectionParameters().getDatabase(); - - final String query = "SELECT id, fpga, hybrid, channel FROM " - + db + "." + channelTable; - - statement.executeQuery(query); - - ResultSet resultSet = statement.getResultSet(); - - while (resultSet.next()) { - int id = resultSet.getInt(1); - int fpga = resultSet.getInt(2); - int hybrid = resultSet.getInt(3); - int channel = resultSet.getInt(4); - ChannelData channelData = new ChannelData(fpga, hybrid, channel); - channelMap.addChannel(id, channelData); - } - } catch(SQLException x) { - throw new RuntimeException("Error querying database.", x); - } finally { - if (statement != null) { - try { - statement.close(); - } catch (SQLException x) { - throw new RuntimeException("Failed to close statement.", x); - } - } - try { - connection.close(); - } catch (SQLException x) { - throw new RuntimeException("Failed to close database.", x); - } - } - } - - ChannelMap getChannelMap() { - return channelMap; - } -}
\ No newline at end of file
diff -N ChannelMap.java --- ChannelMap.java 19 Sep 2013 01:27:15 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,30 +0,0 @@
-package org.lcsim.hps.conditions.svt; - -import java.util.HashMap; -import java.util.Map; - -public class ChannelMap { - - Map<Integer,ChannelData> channels = new HashMap<Integer,ChannelData>(); - - void addChannel(int id, ChannelData data) { - if (channels.get(id) != null) { - throw new IllegalArgumentException("ChannelData already exists with ID: " + id); - } - channels.put(id, data); - } - - ChannelData getChannelData(int id) { - return channels.get(id); - } - - ChannelData findChannelData(int fpga, int hybrid, int channel) { - ChannelData channelFind = new ChannelData(fpga, hybrid, channel); - for (ChannelData data : channels.values()) { - if (data.equals(channelFind)) { - return data; - } - } - return null; - } -}
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1