LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  October 2014

HPS-SVN October 2014

Subject:

r1312 - /java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/SvtChannel.java

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Mon, 27 Oct 2014 18:30:26 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (134 lines)

Author: omoreno
Date: Mon Oct 27 11:30:24 2014
New Revision: 1312

Log:
Update to extend AbstracSvtChannel.

Modified:
    java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/SvtChannel.java

Modified: java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/SvtChannel.java
 =============================================================================
--- java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/SvtChannel.java	(original)
+++ java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/SvtChannel.java	Mon Oct 27 11:30:24 2014
@@ -2,13 +2,8 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
-import org.hps.conditions.AbstractConditionsObject;
-import org.hps.conditions.ConditionsObjectCollection;
-import org.hps.conditions.ConditionsObjectException;
 import org.hps.util.Pair;
 
 /**
@@ -18,38 +13,18 @@
  * @author Jeremy McCormick <[log in to unmask]>
  * @author Omar Moreno <[log in to unmask]>
  */
-public final class SvtChannel extends AbstractConditionsObject {
+public final class SvtChannel extends AbstractSvtChannel {
 
-	public static final int MAX_NUMBER_OF_SAMPLES = 6;
 
-	public static class SvtChannelCollection extends ConditionsObjectCollection<SvtChannel> {
-
-        Map<Integer, SvtChannel> channelMap = new HashMap<Integer, SvtChannel>();
-
-        public void add(SvtChannel channel) {
-            // Add to map.
-            if (channelMap.containsKey(channel.getChannelID())) {
-                throw new IllegalArgumentException("Channel ID already exists: " + channel.getChannelID());
-            }
-            channelMap.put(channel.getChannelID(), channel);
-
-            // Add to collection.
-            try {
-                super.add(channel);
-            } catch (ConditionsObjectException e) {
-                throw new RuntimeException(e);
-            }
-        }
-
-        public SvtChannel findChannel(int channelId) {
-            return channelMap.get(channelId);
-        }
+	public static class SvtChannelCollection 
+	    extends AbstractSvtChannel.AbstractSvtChannelCollection<SvtChannel> {
 
         /**
          * Find channels that match a DAQ pair (FEB ID, FEB Hybrid ID).
          * @param pair The DAQ pair.
          * @return The channels matching the DAQ pair or null if not found.
          */
+	    @Override
         public Collection<SvtChannel> find(Pair<Integer, Integer> pair) {
             List<SvtChannel> channels = new ArrayList<SvtChannel>();
             int febID = pair.getFirstElement();
@@ -61,26 +36,6 @@
             }
             return channels;
         }
-
-        /**
-         * Convert this object to a human readable string.
-         * @return This object converted to a string.
-         */
-        public String toString() {
-            StringBuffer buff = new StringBuffer();
-            for (SvtChannel channel : this.getObjects()) {
-                buff.append(channel.toString() + '\n');
-            }
-            return buff.toString();
-        }
-    }
-
-    /**
-     * Get the channel ID.
-     * @return The channel ID.
-     */
-    public int getChannelID() {
-        return getFieldValue("channel_id");
     }
 
     /**
@@ -100,19 +55,14 @@
     }
 
     /**
-     * Get the channel number. This is different from the ID.
-     * @return The channel number.
-     */
-    public int getChannel() {
-        return getFieldValue("channel");
-    }
-
-    /**
      * Convert this object to a human readable string.
      * @return This object as a string.
      */
     public String toString() {
-        return "channel_id: " + getChannelID() + ", feb_id: " + getFebID() + ", feb_hybrid_id: " + getFebHybridID() + ", channel: " + getChannel();
+        return "channel_id: " + getChannelID() +
+               ", feb_id: " + getFebID() + 
+               ", feb_hybrid_id: " + getFebHybridID() +
+               ", channel: " + getChannel();
     }
 
     /**
@@ -127,6 +77,9 @@
         if (o == this)
             return true;
         SvtChannel channel = (SvtChannel) o;
-        return getChannelID() == channel.getChannelID() && getFebID() == channel.getFebID() && getFebHybridID() == channel.getFebHybridID() && getChannel() == channel.getChannel();
+        return getChannelID() == channel.getChannelID() 
+                && getFebID() == channel.getFebID() 
+                && getFebHybridID() == channel.getFebHybridID() 
+                && getChannel() == channel.getChannel();
     }
 }

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use