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  March 2015

HPS-SVN March 2015

Subject:

r2441 - /java/trunk/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:

Sat, 14 Mar 2015 18:54:06 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (162 lines)

Author: [log in to unmask]
Date: Sat Mar 14 11:54:01 2015
New Revision: 2441

Log:
Add a parameterized constructor and setters for the fields 'feb_id' and 'feb_hybrid_id'.  Also added a couple of methods that check if the FEB and Hybrid ID's are within a valid range.

Modified:
    java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtChannel.java

Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtChannel.java
 =============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtChannel.java	(original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtChannel.java	Sat Mar 14 11:54:01 2015
@@ -20,12 +20,38 @@
 @Converter(multipleCollectionsAction = MultipleCollectionsAction.LAST_CREATED)
 public final class SvtChannel extends AbstractSvtChannel {
 
+    /**
+     * 
+     */
+    public SvtChannel() { 
+    }
+    
+    /**
+     *  Constructor 
+     *
+     *  @param channelID : The SVT channel ID
+     *  @param febID : The Front End Board (FEB) ID (0-9)
+     *  @param febHybridID : The hybrid ID (0-3)
+     *  @param channel : The channel number (0-639)
+     */
+    public SvtChannel(int channelID, int febID, int febHybridID, int channel) { 
+        if (!this.isValidFeb(febID) 
+                || !this.isValidFebHybridID(febHybridID) 
+                || !this.isValidPhysicalChannel(channel)) { 
+            throw new RuntimeException("Invalid FEB ID, FEB hybrid ID or physical channel number is being used.");
+        }
+        this.setChannelID(channelID);
+        this.setFebID(febID);
+        this.setFebHybridID(febHybridID);
+        this.setChannel(channel);
+    }
+    
     public static class SvtChannelCollection extends AbstractSvtChannel.AbstractSvtChannelCollection<SvtChannel> {
         /**
-         * Find channels that match a DAQ pair (FEB ID, FEB Hybrid ID).
+         *  Find channels that match a DAQ pair (FEB ID, FEB Hybrid ID).
          * 
-         * @param pair : The DAQ pair consiting of a FEB ID and FEB Hybrid ID.
-         * @return The channels matching the DAQ pair or null if ?not found.
+         *  @param pair : The DAQ pair consiting of a FEB ID and FEB Hybrid ID.
+         *  @return The channels matching the DAQ pair or null if ?not found.
          */
         @Override
         public Collection<SvtChannel> find(Pair<Integer, Integer> pair) {
@@ -41,13 +67,13 @@
         }
 
         /**
-         * Get the SVT channel ID associated with a given FEB ID/Hybrid ID/physical channel.
+         *  Get the SVT channel ID associated with a given FEB ID/Hybrid ID/physical channel.
          *
-         * @param febID : The FEB ID
-         * @param febHybridID : The FEB hybrid ID
-         * @param channel : The physical channel number
-         * @return The SVT channel ID
-         * @throws {@link RuntimeException} if the channel ID can't be found
+         *  @param febID : The FEB ID
+         *  @param febHybridID : The FEB hybrid ID
+         *  @param channel : The physical channel number
+         *  @return The SVT channel ID
+         *  @throws {@link RuntimeException} if the channel ID can't be found
          */
         public int findChannelID(int febID, int febHybridID, int channel) {
             for (SvtChannel svtChannel : this) {
@@ -61,9 +87,9 @@
     }
 
     /**
-     * Get the FEB ID associated with this SVT channel ID.
+     *  Get the FEB ID associated with this SVT channel ID.
      * 
-     * @return The FEB ID.
+     *  @return The FEB ID.
      */
     @Field(names = { "feb_id" })
     public int getFebID() {
@@ -71,9 +97,9 @@
     }
 
     /**
-     * Get the FEB hybrid ID associated with this SVT channel ID.
+     *  Get the FEB hybrid ID associated with this SVT channel ID.
      * 
-     * @return The FEB hybrid ID.
+     *  @return The FEB hybrid ID.
      */
     @Field(names = { "feb_hybrid_id" })
     public int getFebHybridID() {
@@ -81,8 +107,58 @@
     }
 
     /**
-     * Implementation of equals.
-     * @return True if the object equals this one; false if not.
+     *  Set the FEB ID associated with this SVT channel ID.
+     * 
+     *  @param febID : The FEB ID
+     */
+    public void setFebID(int febID) { 
+        this.setFieldValue("feb_id", febID);
+    }
+    
+    /**
+     *  Set the FEB hybrid ID associated with this SVT channel ID.
+     * 
+     *  @param febHybridID : The FEB hybrid ID
+     */
+    public void setFebHybridID(int febHybridID) {
+        this.setFieldValue("feb_hybrid_id", febHybridID);
+    }
+    
+    /**
+     *  Checks if a FEB ID is valid
+     * 
+     *  @param febID : The Front End Board (FEB) ID
+     *  @return True if the FEB ID lies within the range 0-9, false otherwise
+     */
+    public boolean isValidFeb(int febID) { 
+        return (febID >= 0 && febID <= 9) ? true : false; 
+    }
+    
+    /**
+     *  Checks if a Front End Board hybrid ID is valid
+     *  
+     *  @param febHybridID : The hybrid ID 
+     *  @return True if the hybrid ID lies within the range 0-3, false otherwise
+     */
+    public boolean isValidFebHybridID(int febHybridID) { 
+        return (febHybridID >= 0 && febHybridID <= 3) ? true : false; 
+    }
+    
+    /**
+     *  Checks if a physical channel number is valid
+     *  
+     *  @param channel : The physical channel number
+     *  @return True if the channel number lies within the range 0-639, false 
+     *          otherwise
+     */
+    public boolean isValidPhysicalChannel(int channel) { 
+        return (channel >= 0 && channel <= 639) ? true : false; 
+    }
+    
+    /**
+     *  Implementation of equals.
+     *  
+     *  @return True if the object equals this one; false if not.
      */
     public boolean equals(Object o) {
         if (o == null)

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