diff dwtx/jface/text/link/TabStopIterator.d @ 162:1a5b8f8129df

...
author Frank Benoit <benoit@tionex.de>
date Mon, 08 Sep 2008 00:51:37 +0200
parents f70d9508c95c
children
line wrap: on
line diff
--- a/dwtx/jface/text/link/TabStopIterator.d	Wed Aug 27 14:49:30 2008 +0200
+++ b/dwtx/jface/text/link/TabStopIterator.d	Mon Sep 08 00:51:37 2008 +0200
@@ -24,13 +24,8 @@
 
 
 import dwt.dwthelper.utils;
-
 import dwtx.dwtxhelper.Collection;
-
-
-
-
-import java.util.NoSuchElementException;
+import tango.core.Exception;
 
 import dwtx.core.runtime.Assert;
 import dwtx.jface.text.Position;
@@ -70,7 +65,17 @@
     }
 
     /** The comparator to sort the list of positions. */
-    private static const Comparator fComparator= new SequenceComparator();
+    private static Comparator fComparator_;
+    private static Comparator fComparator(){
+        if( fComparator_ is null ){
+            synchronized( TabStopIterator.classinfo ){
+                if( fComparator_ is null ){
+                    fComparator_ = new SequenceComparator();
+                }
+            }
+        }
+        return fComparator_;
+    }
 
     /** The iteration sequence. */
     private const ArrayList fList;
@@ -82,7 +87,7 @@
     private bool fIsCycling= false;
 
     this(List positionSequence) {
-        Assert.isNotNull(positionSequence);
+        Assert.isNotNull(cast(Object)positionSequence);
         fList= new ArrayList(positionSequence);
         Collections.sort(fList, fComparator);
         fSize= fList.size();
@@ -192,13 +197,13 @@
 
     LinkedPosition next(LinkedPosition current) {
         if (!hasNext(current))
-            throw new NoSuchElementException();
+            throw new NoSuchElementException(null);
         return cast(LinkedPosition) fList.get(fIndex= getNextIndex(current));
     }
 
     LinkedPosition previous(LinkedPosition current) {
         if (!hasPrevious(current))
-            throw new NoSuchElementException();
+            throw new NoSuchElementException(null);
         return cast(LinkedPosition) fList.get(fIndex= getPreviousIndex(current));
     }
 
@@ -224,6 +229,6 @@
     }
 
     LinkedPosition[] getPositions() {
-        return (LinkedPosition[]) fList.toArray(new LinkedPosition[fSize]);
+        return arraycast!(LinkedPosition)( fList.toArray());
     }
 }