On Friday 04 April 2008 06:20, nextgens at freenetproject.org wrote:
> Author: nextgens
> Date: 2008-04-04 05:20:31 +0000 (Fri, 04 Apr 2008)
> New Revision: 18966
> 
> Modified:
>    trunk/freenet/src/freenet/crypt/SHA1.java
>    trunk/freenet/src/freenet/support/DoublyLinkedListImpl.java
>    trunk/freenet/src/freenet/support/math/DecayingKeyspaceAverage.java
>    trunk/freenet/src/freenet/support/math/RunningAverage.java
>    trunk/freenet/src/freenet/support/math/SimpleBinaryRunningAverage.java
> Log:
> implement Cloneable where we have a clone() method

Why?

public interface Cloneable

A class implements the Cloneable interface to indicate to the Object.clone() 
method that it is legal for that method to make a field-for-field copy of 
instances of that class.

Invoking Object's clone method on an instance that does not implement the 
Cloneable interface results in the exception CloneNotSupportedException being 
thrown.

By convention, classes that implement this interface should override 
Object.clone (which is protected) with a public method. See Object.clone() 
for details on overriding this method.

Note that this interface does not contain the clone method. Therefore, it is 
not possible to clone an object merely by virtue of the fact that it 
implements this interface. Even if the clone method is invoked reflectively, 
there is no guarantee that it will succeed. 

> 
> Modified: trunk/freenet/src/freenet/crypt/SHA1.java
> ===================================================================
> --- trunk/freenet/src/freenet/crypt/SHA1.java 2008-04-03 18:31:56 UTC (rev 
18965)
> +++ trunk/freenet/src/freenet/crypt/SHA1.java 2008-04-04 05:20:31 UTC (rev 
18966)
> @@ -33,7 +33,7 @@
>   * This is a simple port of Steve Reid's SHA-1 code into Java.
>   * I've run his test vectors through the code and they all pass.
>   */
> -public final class SHA1 implements Digest {
> +public final class SHA1 implements Digest, Cloneable {
>  
>      private static boolean alwaysThisOne = false;
>      
> 
> Modified: trunk/freenet/src/freenet/support/DoublyLinkedListImpl.java
> ===================================================================
> --- trunk/freenet/src/freenet/support/DoublyLinkedListImpl.java       
> 2008-04-03 
18:31:56 UTC (rev 18965)
> +++ trunk/freenet/src/freenet/support/DoublyLinkedListImpl.java       
> 2008-04-04 
05:20:31 UTC (rev 18966)
> @@ -10,7 +10,7 @@
>   * TODO: there are still some unimplemented methods
>   *       -- it remains to be seen if they are needed at all
>   */
> -public class DoublyLinkedListImpl implements DoublyLinkedList {
> +public class DoublyLinkedListImpl implements DoublyLinkedList, Cloneable {
>  
>      protected int size;
>      protected Item _headptr, _tailptr;
> 
> Modified: 
trunk/freenet/src/freenet/support/math/DecayingKeyspaceAverage.java
> ===================================================================
> --- trunk/freenet/src/freenet/support/math/DecayingKeyspaceAverage.java       
2008-04-03 18:31:56 UTC (rev 18965)
> +++ trunk/freenet/src/freenet/support/math/DecayingKeyspaceAverage.java       
2008-04-04 05:20:31 UTC (rev 18966)
> @@ -12,7 +12,7 @@
>   *
>   * A filter on BootstrappingDecayingRunningAverage which makes it aware of 
the circular keyspace.
>   */
> -public class DecayingKeyspaceAverage implements RunningAverage {
> +public class DecayingKeyspaceAverage implements RunningAverage, Cloneable {
>       private static final long serialVersionUID = 5129429614949179428L;
>       /**
>        'avg' is the normalized average location, note that the the reporting 
bounds are (-2.0, 2.0) however.
> 
> Modified: trunk/freenet/src/freenet/support/math/RunningAverage.java
> ===================================================================
> --- trunk/freenet/src/freenet/support/math/RunningAverage.java        
> 2008-04-03 
18:31:56 UTC (rev 18965)
> +++ trunk/freenet/src/freenet/support/math/RunningAverage.java        
> 2008-04-04 
05:20:31 UTC (rev 18966)
> @@ -5,7 +5,7 @@
>  
>  import java.io.Serializable;
>  
> -public interface RunningAverage extends Serializable {
> +public interface RunningAverage extends Serializable, Cloneable {
>      
>      public Object clone();
>      
> 
> Modified: 
trunk/freenet/src/freenet/support/math/SimpleBinaryRunningAverage.java
> ===================================================================
> --- trunk/freenet/src/freenet/support/math/SimpleBinaryRunningAverage.java    
2008-04-03 18:31:56 UTC (rev 18965)
> +++ trunk/freenet/src/freenet/support/math/SimpleBinaryRunningAverage.java    
2008-04-04 05:20:31 UTC (rev 18966)
> @@ -15,7 +15,7 @@
>   * @author amphibian
>   * Created on May 14, 2004
>   */
> -public class SimpleBinaryRunningAverage implements RunningAverage {
> +public class SimpleBinaryRunningAverage implements RunningAverage, 
Cloneable {
>       private static final long serialVersionUID = -1;
>  
>      public Object clone() {
> 
> _______________________________________________
> cvs mailing list
> cvs at freenetproject.org
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<https://emu.freenetproject.org/pipermail/cvs/attachments/20080404/94c640cc/attachment.pgp>

Reply via email to