LISTSERV mailing list manager LISTSERV 16.5

Help for LCDET-SVN Archives


LCDET-SVN Archives

LCDET-SVN Archives


LCDET-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

LCDET-SVN Home

LCDET-SVN Home

LCDET-SVN  December 2014

LCDET-SVN December 2014

Subject:

r3441 - /projects/lcsim/sandbox/Identifier.java

From:

[log in to unmask]

Reply-To:

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

Date:

Mon, 8 Dec 2014 22:19:11 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (141 lines)

Author: [log in to unmask]
Date: Mon Dec  8 14:19:08 2014
New Revision: 3441

Log:
fix for not returning null

Added:
    projects/lcsim/sandbox/Identifier.java

Added: projects/lcsim/sandbox/Identifier.java
 =============================================================================
--- projects/lcsim/sandbox/Identifier.java	(added)
+++ projects/lcsim/sandbox/Identifier.java	Mon Dec  8 14:19:08 2014
@@ -0,0 +1,119 @@
+package org.lcsim.detector.identifier;
+
+/**
+ * Implementation of {@link IIdentifier}.
+ * 
+ * @author Jeremy McCormick
+ * @version $Id: Identifier.java,v 1.8 2007/11/20 20:30:03 jeremy Exp $
+ */
+public class Identifier
+implements IIdentifier
+{    
+    long value;
+    boolean valid = false;
+    boolean garbage = false;
+    
+    public Identifier()
+    {
+        garbage = true;
+    }
+    
+    public Identifier(IIdentifier id)
+    {
+    	value = id.getValue();
+    	valid = id.isValid();
+    }
+    
+    public Identifier(Identifier id)
+    {
+    	value = id.getValue();
+    	valid = id.isValid();
+    }
+    
+    public Identifier copy()
+    {
+    	return new Identifier(this);
+    }
+    
+    public Identifier(long value)
+    {
+        setValue(value);
+    }
+    
+    public Identifier(int value)
+    {
+    	setValue(value);
+    }
+    
+    public long getValue()
+    {
+        return value;
+    }
+    
+    public void setValue( long value )
+    {
+        this.value = value;       
+        valid = true;
+    }
+    
+    public void clear()
+    {
+         value = 0;
+         valid = false;
+    }
+ 
+    public String toHexString()
+    {
+        return Long.toHexString(value);
+    }
+    
+    public String toString()
+    {
+        return toHexString();
+    }
+    
+    public void fromHexString( String hexRep )
+    {
+        value = Long.parseLong(hexRep, 16);
+    }
+
+    public boolean isValid()
+    {
+        return valid;
+    }
+
+    public int compareTo( Object object )
+    {                
+        if ( object instanceof IIdentifier )
+        {
+            return Long.valueOf(((IIdentifier)object).getValue()).compareTo(getValue());
+        }
+        else if ( object instanceof Long)
+        {
+            return ((Long)object).compareTo(getValue());
+        }
+        else if ( object instanceof Integer )
+        {
+            return ((Long)object).compareTo(getValue());
+        }
+        else 
+        {
+            return -1;
+        }        
+    }    
+    
+    public int hashCode()
+    {
+        return Long.valueOf(value).hashCode();
+    }
+    
+    public boolean equals( Object object )
+    {
+        return compareTo( object ) == 0;
+    }
+    
+    public boolean getGarbage() {
+        return garbage;
+    }
+    
+}

########################################################################
Use REPLY-ALL to reply to list

To unsubscribe from the LCDET-SVN list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCDET-SVN&A=1

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

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