openide.util/test/unit/src/org/openide/util/EnumerationsTest.java
author Jesse Glick <jglick@netbeans.org>
Fri, 09 Oct 2009 15:11:13 -0400
changeset 833 0e00857c5827
parent 829 3b2ed3e1f01b
child 876 efc7a0e42c5f
permissions -rw-r--r--
Warnings.
jglick@139
     1
/*
jtulach@302
     2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
jglick@139
     3
 *
mzlamal@829
     4
 * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
jglick@139
     5
 *
jtulach@302
     6
 * The contents of this file are subject to the terms of either the GNU
jtulach@302
     7
 * General Public License Version 2 only ("GPL") or the Common
jtulach@302
     8
 * Development and Distribution License("CDDL") (collectively, the
jtulach@302
     9
 * "License"). You may not use this file except in compliance with the
jtulach@302
    10
 * License. You can obtain a copy of the License at
jtulach@302
    11
 * http://www.netbeans.org/cddl-gplv2.html
jtulach@302
    12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
jtulach@302
    13
 * specific language governing permissions and limitations under the
jtulach@302
    14
 * License.  When distributing the software, include this License Header
jtulach@302
    15
 * Notice in each file and include the License file at
jtulach@302
    16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
jtulach@302
    17
 * particular file as subject to the "Classpath" exception as provided
jtulach@302
    18
 * by Sun in the GPL Version 2 section of the License file that
jtulach@302
    19
 * accompanied this code. If applicable, add the following below the
jtulach@302
    20
 * License Header, with the fields enclosed by brackets [] replaced by
jtulach@302
    21
 * your own identifying information:
jtulach@189
    22
 * "Portions Copyrighted [year] [name of copyright owner]"
jtulach@189
    23
 *
jtulach@302
    24
 * Contributor(s):
jtulach@302
    25
 *
jtulach@189
    26
 * The Original Software is NetBeans. The Initial Developer of the Original
jtulach@189
    27
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
jglick@139
    28
 * Microsystems, Inc. All Rights Reserved.
jtulach@302
    29
 *
jtulach@302
    30
 * If you wish your version of this file to be governed by only the CDDL
jtulach@302
    31
 * or only the GPL Version 2, indicate your decision by adding
jtulach@302
    32
 * "[Contributor] elects to include this software in this distribution
jtulach@302
    33
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
jtulach@302
    34
 * single choice of license, a recipient has the option to distribute
jtulach@302
    35
 * your version of this file under either the CDDL, the GPL Version 2 or
jtulach@302
    36
 * to extend the choice of license to its licensees as provided above.
jtulach@302
    37
 * However, if you add GPL Version 2 code and therefore, elected the GPL
jtulach@302
    38
 * Version 2 license, then the option applies only if the new code is
jtulach@302
    39
 * made subject to such option by the copyright holder.
jglick@139
    40
 */
jglick@139
    41
jglick@139
    42
package org.openide.util;
jglick@139
    43
jglick@139
    44
import java.util.ArrayList;
jglick@139
    45
import java.util.Arrays;
jglick@139
    46
import java.util.Collection;
jglick@139
    47
import java.util.Collections;
jglick@139
    48
import java.util.Enumeration;
jglick@139
    49
import java.util.Iterator;
jglick@833
    50
import java.util.List;
jglick@139
    51
import java.util.Map;
jglick@139
    52
import java.util.NoSuchElementException;
jglick@139
    53
import java.util.Set;
jglick@139
    54
import org.netbeans.junit.NbTestCase;
jglick@139
    55
jglick@139
    56
/** This is the base test for new and old enumerations. It contains
jglick@139
    57
 * factory methods for various kinds of enumerations and set of tests
jglick@139
    58
 * that use them. Factory methods are overriden in OldEnumerationsTest
jglick@139
    59
 *
jglick@139
    60
 * @author Jaroslav Tulach
jglick@139
    61
 */
jglick@139
    62
public class EnumerationsTest extends NbTestCase {
jglick@139
    63
    
jglick@139
    64
    /** Creates a new instance of EnumerationsTest */
jglick@139
    65
    public EnumerationsTest(String testName) {
jglick@139
    66
        super(testName);
jglick@139
    67
    }
jglick@139
    68
    
jglick@139
    69
    //
jglick@139
    70
    // Factory methods
jglick@139
    71
    //
jglick@139
    72
    
jglick@833
    73
    protected <T> Enumeration<T> singleton(T obj) {
jglick@139
    74
        return Enumerations.singleton(obj);
jglick@139
    75
    }
jglick@833
    76
    protected <T> Enumeration<T> concat(Enumeration<T> en1, Enumeration<T> en2) {
jglick@139
    77
        return Enumerations.concat(en1, en2);
jglick@139
    78
    }
jglick@833
    79
    protected <T> Enumeration<T> concat(Enumeration<Enumeration<T>> enumOfEnums) {
jglick@139
    80
        return Enumerations.concat(enumOfEnums);
jglick@139
    81
    }
jglick@833
    82
    protected <T> Enumeration<T> removeDuplicates(Enumeration<T> en) {
jglick@139
    83
        return Enumerations.removeDuplicates(en);
jglick@139
    84
    }
jglick@833
    85
    protected <T> Enumeration<T> empty() {
jglick@139
    86
        return Enumerations.empty();
jglick@139
    87
    }
jglick@833
    88
    protected <T> Enumeration<T> array(T[] arr) {
jglick@139
    89
        return Enumerations.array(arr);
jglick@139
    90
    }
jglick@833
    91
    protected <T,R> Enumeration<R> convert(Enumeration<T> en, final Map<T,R> map) {
jglick@833
    92
        class P implements Enumerations.Processor<T,R> {
jglick@833
    93
            public R process(T obj, Collection<T> nothing) {
jglick@139
    94
                return map.get(obj);
jglick@139
    95
            }
jglick@139
    96
        }
jglick@139
    97
        return Enumerations.convert(en, new P());
jglick@139
    98
    }
jglick@833
    99
    protected <T> Enumeration<T> removeNulls(Enumeration<T> en) {
jglick@139
   100
        return Enumerations.removeNulls(en);
jglick@139
   101
    }
jglick@833
   102
    protected <T> Enumeration<T> filter(Enumeration<T> en, final Set<T> filter) {
jglick@833
   103
        class P implements Enumerations.Processor<T,T> {
jglick@833
   104
            public T process(T obj, Collection<T> nothing) {
jglick@139
   105
                return filter.contains(obj) ? obj : null;
jglick@139
   106
            }
jglick@139
   107
        }
jglick@139
   108
        return Enumerations.filter(en, new P());
jglick@139
   109
    }
jglick@139
   110
    
jglick@833
   111
    protected <T,R> Enumeration<R> filter(Enumeration<T> en, final QueueProcess<T,R> filter) {
jglick@833
   112
        class P implements Enumerations.Processor<T,R> {
jglick@833
   113
            public R process(T obj, Collection<T> nothing) {
jglick@139
   114
                return filter.process(obj, nothing);
jglick@139
   115
            }
jglick@139
   116
        }
jglick@139
   117
        return Enumerations.filter(en, new P());
jglick@139
   118
    }
jglick@139
   119
    
jglick@139
   120
    /**
jglick@139
   121
     * @param filter the set.contains (...) is called before each object is produced
jglick@139
   122
     * @return Enumeration
jglick@139
   123
     */
jglick@833
   124
    protected <T,R> Enumeration<R> queue(Collection<T> initContent, final QueueProcess<T,R> process) {
jglick@833
   125
        class C implements Enumerations.Processor<T,R> {
jglick@833
   126
            public R process(T object, Collection<T> toAdd) {
jglick@139
   127
                return process.process(object, toAdd);
jglick@139
   128
            }
jglick@139
   129
        }
jglick@139
   130
        return Enumerations.queue(
jglick@139
   131
                Collections.enumeration(initContent),
jglick@139
   132
                new C()
jglick@139
   133
                );
jglick@139
   134
    }
jglick@139
   135
    
jglick@139
   136
    /** Processor interface.
jglick@139
   137
     */
jglick@833
   138
    public static interface QueueProcess<T,R> {
jglick@833
   139
        public R process(T object, Collection<T> toAdd);
jglick@139
   140
    }
jglick@139
   141
    
jglick@139
   142
    //
jglick@139
   143
    // The tests
jglick@139
   144
    //
jglick@139
   145
    
jglick@139
   146
    public void testEmptyIsEmpty() {
jglick@139
   147
        Enumeration e = empty();
jglick@139
   148
        assertFalse(e.hasMoreElements());
jglick@139
   149
        try {
jglick@139
   150
            e.nextElement();
jglick@139
   151
            fail("No elements");
jglick@139
   152
        } catch (NoSuchElementException ex) {
jglick@139
   153
            // ok
jglick@139
   154
        }
jglick@139
   155
    }
jglick@139
   156
    
jglick@139
   157
    public void testSingleIsSingle() {
jglick@139
   158
        Enumeration e = singleton(this);
jglick@139
   159
        assertTrue(e.hasMoreElements());
jglick@139
   160
        assertEquals("Returns me", this, e.nextElement());
jglick@139
   161
        assertFalse("Now it is empty", e.hasMoreElements());
jglick@139
   162
        try {
jglick@139
   163
            e.nextElement();
jglick@139
   164
            fail("No elements");
jglick@139
   165
        } catch (NoSuchElementException ex) {
jglick@139
   166
            // ok
jglick@139
   167
        }
jglick@139
   168
    }
jglick@139
   169
    
jglick@139
   170
    public void testConcatTwoAndArray() {
jglick@833
   171
        Object[] one = { 1, 2, 3 };
jglick@139
   172
        Object[] two = { "1", "2", "3" };
jglick@139
   173
        
jglick@833
   174
        List<Object> list = new ArrayList<Object>(Arrays.asList(one));
jglick@139
   175
        list.addAll(Arrays.asList(two));
jglick@139
   176
        
jglick@139
   177
        assertEnums(
jglick@139
   178
                concat(array(one), array(two)),
jglick@139
   179
                Collections.enumeration(list)
jglick@139
   180
                );
jglick@139
   181
    }
jglick@139
   182
    
jglick@139
   183
    public void testConcatTwoAndArrayAndTakeOnlyStrings() {
jglick@833
   184
        Object[] one = { 1, 2, 3 };
jglick@139
   185
        Object[] two = { "1", "2", "3" };
jglick@833
   186
        Object[] three = { 1L };
jglick@139
   187
        Object[] four = { "Kuk" };
jglick@139
   188
        
jglick@833
   189
        List<Object> list = new ArrayList<Object>(Arrays.asList(two));
jglick@139
   190
        list.addAll(Arrays.asList(four));
jglick@139
   191
        
jglick@833
   192
        @SuppressWarnings("unchecked")
jglick@833
   193
        Enumeration<Object>[] alls = (Enumeration<Object>[]) new Enumeration<?>[] {
jglick@139
   194
            array(one), array(two), array(three), array(four)
jglick@139
   195
        };
jglick@139
   196
        
jglick@139
   197
        assertEnums(
jglick@139
   198
                filter(concat(array(alls)), new OnlyStrings()),
jglick@139
   199
                Collections.enumeration(list)
jglick@139
   200
                );
jglick@139
   201
    }
jglick@139
   202
    
jglick@139
   203
    public void testRemoveDuplicates() {
jglick@833
   204
        Object[] one = { 1, 2, 3 };
jglick@139
   205
        Object[] two = { "1", "2", "3" };
jglick@833
   206
        Object[] three = { 1 };
jglick@139
   207
        Object[] four = { "2", "3", "4" };
jglick@139
   208
        
jglick@833
   209
        @SuppressWarnings("unchecked")
jglick@833
   210
        Enumeration<Object>[] alls = (Enumeration<Object>[]) new Enumeration<?>[] {
jglick@139
   211
            array(one), array(two), array(three), array(four)
jglick@139
   212
        };
jglick@139
   213
        
jglick@139
   214
        assertEnums(
jglick@139
   215
                removeDuplicates(concat(array(alls))),
jglick@833
   216
                array(new Object[] { 1, 2, 3, "1", "2", "3", "4" })
jglick@139
   217
                );
jglick@139
   218
        
jglick@139
   219
    }
jglick@139
   220
    
jglick@139
   221
    public void testRemoveDuplicatesAndGCWorks() {
jglick@139
   222
        
jglick@139
   223
        /*** Return { i1, "", "", "", i2 } */
jglick@833
   224
        class WeakEnum implements Enumeration<Object> {
jglick@139
   225
            public Object i1 = new Integer(1);
jglick@139
   226
            public Object i2 = new Integer(1);
jglick@139
   227
            
jglick@139
   228
            private int state;
jglick@139
   229
            
jglick@139
   230
            public boolean hasMoreElements() {
jglick@139
   231
                return state < 5;
jglick@139
   232
            }
jglick@139
   233
            
jglick@139
   234
            public Object nextElement() {
jglick@139
   235
                switch (state++) {
jglick@139
   236
                    case 0: return i1;
jglick@139
   237
                    case 1: case 2: case 3: return "";
jglick@139
   238
                    default: return i2;
jglick@139
   239
                }
jglick@139
   240
            }
jglick@139
   241
        }
jglick@139
   242
        
jglick@139
   243
        WeakEnum weak = new WeakEnum();
jglick@139
   244
        Enumeration en = removeDuplicates(weak);
jglick@139
   245
        
jglick@139
   246
        assertTrue("Has some elements", en.hasMoreElements());
jglick@139
   247
        assertEquals("And the first one is get", weak.i1, en.nextElement());
jglick@833
   248
jglick@833
   249
        /*
jglick@139
   250
        try {
jglick@833
   251
            Reference<?> ref = new WeakReference<Object>(weak.i1);
jglick@833
   252
         */
jglick@139
   253
            weak.i1 = null;
jglick@833
   254
        /*
jglick@139
   255
            assertGC("Try hard to GC the first integer", ref);
jglick@139
   256
            // does not matter whether it GCs or not
jglick@139
   257
        } catch (Throwable tw) {
jglick@139
   258
            // not GCed, but does not matter
jglick@139
   259
        }
jglick@833
   260
         */
jglick@139
   261
        assertTrue("Next object will be string", en.hasMoreElements());
jglick@139
   262
        assertEquals("is empty string", "", en.nextElement());
jglick@139
   263
        
jglick@139
   264
        assertFalse("The second integer is however equal to the original i1 and thus" +
jglick@139
   265
                " the enum should not be there", en.hasMoreElements());
jglick@139
   266
    }
jglick@139
   267
    
jglick@139
   268
    public void testQueueEnum() {
jglick@833
   269
        class Pr implements QueueProcess<Integer,Integer> {
jglick@833
   270
            public Integer process(Integer i, Collection<Integer> c) {
jglick@833
   271
                int plus = i + 1;
jglick@139
   272
                if (plus < 10) {
jglick@833
   273
                    c.add(plus);
jglick@139
   274
                }
jglick@139
   275
                return i;
jglick@139
   276
            }
jglick@139
   277
        }
jglick@139
   278
        Pr p = new Pr();
jglick@139
   279
        
jglick@139
   280
        Enumeration en = queue(
jglick@833
   281
                Collections.nCopies(1, 0), p
jglick@139
   282
                );
jglick@139
   283
        
jglick@139
   284
        for (int i = 0; i < 10; i++) {
jglick@139
   285
            assertTrue("has next", en.hasMoreElements());
jglick@139
   286
            en.nextElement();
jglick@139
   287
        }
jglick@139
   288
        
jglick@139
   289
        assertFalse("No next element", en.hasMoreElements());
jglick@139
   290
    }
jglick@139
   291
    
jglick@139
   292
    public void testFilteringAlsoDoesConvertions() throws Exception {
jglick@833
   293
        class Pr implements QueueProcess<Integer,Integer> {
jglick@833
   294
            public Integer process(Integer i, Collection<Integer> ignore) {
jglick@833
   295
                return i + 1;
jglick@139
   296
            }
jglick@139
   297
        }
jglick@139
   298
        Pr p = new Pr();
jglick@139
   299
        
jglick@833
   300
        Enumeration<Integer> onetwo = array(new Integer[] { 1, 2 });
jglick@833
   301
        Enumeration<Integer> twothree = array(new Integer[] { 2, 3 });
jglick@139
   302
        
jglick@139
   303
        assertEnums(
jglick@139
   304
                filter(onetwo, p), twothree
jglick@139
   305
                );
jglick@139
   306
    }
jglick@139
   307
    
jglick@139
   308
    
jglick@833
   309
    private static <T> void assertEnums(Enumeration<T> e1, Enumeration<T> e2) {
jglick@139
   310
        int indx = 0;
jglick@139
   311
        while (e1.hasMoreElements() && e2.hasMoreElements()) {
jglick@833
   312
            T i1 = e1.nextElement();
jglick@833
   313
            T i2 = e2.nextElement();
jglick@139
   314
            assertEquals(indx++ + "th: ", i1, i2);
jglick@139
   315
        }
jglick@139
   316
        
jglick@139
   317
        if (e1.hasMoreElements()) {
jglick@139
   318
            fail("first one contains another element: " + e1.nextElement());
jglick@139
   319
        }
jglick@139
   320
        if (e2.hasMoreElements()) {
jglick@139
   321
            fail("second one contains another element: " + e2.nextElement());
jglick@139
   322
        }
jglick@139
   323
        
jglick@139
   324
        try {
jglick@139
   325
            e1.nextElement();
jglick@139
   326
            fail("First one should throw exception, but nothing happend");
jglick@139
   327
        } catch (NoSuchElementException ex) {
jglick@139
   328
            // ok
jglick@139
   329
        }
jglick@139
   330
        
jglick@139
   331
        try {
jglick@139
   332
            e2.nextElement();
jglick@139
   333
            fail("Second one should throw exception, but nothing happend");
jglick@139
   334
        } catch (NoSuchElementException ex) {
jglick@139
   335
            // ok
jglick@139
   336
        }
jglick@139
   337
    }
jglick@139
   338
    
jglick@139
   339
    public void testConvertIntegersToStringRemoveNulls() {
jglick@833
   340
        Object[] garbage = { 1, "kuk", "hle", 5 };
jglick@139
   341
        
jglick@139
   342
        assertEnums(
jglick@139
   343
                removeNulls(convert(array(garbage), new MapIntegers())),
jglick@139
   344
                array(new Object[] { "1", "5" })
jglick@139
   345
                );
jglick@139
   346
    }
jglick@139
   347
    
jglick@139
   348
    public void testQueueEnumerationCanReturnNulls() {
jglick@139
   349
        Object[] nuls = { null, "NULL" };
jglick@139
   350
        
jglick@833
   351
        class P implements QueueProcess<Object,Object> {
jglick@833
   352
            public Object process(Object toRet, Collection<Object> toAdd) {
jglick@139
   353
                if (toRet == null) return null;
jglick@139
   354
                
jglick@139
   355
                if ("NULL".equals(toRet)) {
jglick@139
   356
                    toAdd.add(null);
jglick@139
   357
                    return null;
jglick@139
   358
                }
jglick@139
   359
                
jglick@139
   360
                return null;
jglick@139
   361
            }
jglick@139
   362
        }
jglick@139
   363
        
jglick@139
   364
        assertEnums(
jglick@139
   365
                array(new Object[] { null, null, null }),
jglick@139
   366
                queue(Arrays.asList(nuls), new P())
jglick@139
   367
                );
jglick@139
   368
    }
jglick@139
   369
    
jglick@139
   370
    /** Filters only strings.
jglick@139
   371
     */
jglick@833
   372
    private static final class OnlyStrings implements Set<Object> {
jglick@139
   373
        public boolean add(Object o) {
jglick@139
   374
            fail("Should not be every called");
jglick@139
   375
            return false;
jglick@139
   376
        }
jglick@139
   377
        
jglick@139
   378
        public boolean addAll(Collection c) {
jglick@139
   379
            fail("Should not be every called");
jglick@139
   380
            return false;
jglick@139
   381
        }
jglick@139
   382
        
jglick@139
   383
        public void clear() {
jglick@139
   384
            fail("Should not be every called");
jglick@139
   385
        }
jglick@139
   386
        
jglick@139
   387
        public boolean contains(Object o) {
jglick@139
   388
            return o instanceof String;
jglick@139
   389
        }
jglick@139
   390
        
jglick@139
   391
        public boolean containsAll(Collection c) {
jglick@139
   392
            fail("Should not be every called");
jglick@139
   393
            return false;
jglick@139
   394
        }
jglick@139
   395
        
jglick@139
   396
        public boolean isEmpty() {
jglick@139
   397
            fail("Should not be every called");
jglick@139
   398
            return false;
jglick@139
   399
        }
jglick@139
   400
        
jglick@833
   401
        public Iterator<Object> iterator() {
jglick@139
   402
            fail("Should not be every called");
jglick@139
   403
            return null;
jglick@139
   404
        }
jglick@139
   405
        
jglick@139
   406
        public boolean remove(Object o) {
jglick@139
   407
            fail("Should not be every called");
jglick@139
   408
            return false;
jglick@139
   409
        }
jglick@139
   410
        
jglick@139
   411
        public boolean removeAll(Collection c) {
jglick@139
   412
            fail("Should not be every called");
jglick@139
   413
            return false;
jglick@139
   414
        }
jglick@139
   415
        
jglick@139
   416
        public boolean retainAll(Collection c) {
jglick@139
   417
            fail("Should not be every called");
jglick@139
   418
            return false;
jglick@139
   419
        }
jglick@139
   420
        
jglick@139
   421
        public int size() {
jglick@139
   422
            fail("Should not be every called");
jglick@139
   423
            return 1;
jglick@139
   424
        }
jglick@139
   425
        
jglick@139
   426
        public Object[] toArray() {
jglick@139
   427
            fail("Should not be every called");
jglick@139
   428
            return null;
jglick@139
   429
        }
jglick@139
   430
        
jglick@833
   431
        public <T> T[] toArray(T[] a) {
jglick@139
   432
            fail("Should not be every called");
jglick@139
   433
            return null;
jglick@139
   434
        }
jglick@139
   435
    }
jglick@139
   436
    
jglick@139
   437
    /** Filters only strings.
jglick@139
   438
     */
jglick@833
   439
    private static final class MapIntegers implements Map<Object,Object> {
jglick@139
   440
        public boolean containsKey(Object key) {
jglick@139
   441
            fail("Should not be every called");
jglick@139
   442
            return false;
jglick@139
   443
        }
jglick@139
   444
        
jglick@139
   445
        public boolean containsValue(Object value) {
jglick@139
   446
            fail("Should not be every called");
jglick@139
   447
            return false;
jglick@139
   448
        }
jglick@139
   449
        
jglick@833
   450
        public Set<Map.Entry<Object,Object>> entrySet() {
jglick@139
   451
            fail("Should not be every called");
jglick@139
   452
            return null;
jglick@139
   453
        }
jglick@139
   454
        
jglick@139
   455
        public Object get(Object key) {
jglick@139
   456
            if (key instanceof Integer) {
jglick@139
   457
                return key.toString();
jglick@139
   458
            }
jglick@139
   459
            return null;
jglick@139
   460
        }
jglick@139
   461
        
jglick@833
   462
        public Set<Object> keySet() {
jglick@139
   463
            fail("Should not be every called");
jglick@139
   464
            return null;
jglick@139
   465
        }
jglick@139
   466
        
jglick@139
   467
        public Object put(Object key, Object value) {
jglick@139
   468
            fail("Should not be every called");
jglick@139
   469
            return null;
jglick@139
   470
        }
jglick@139
   471
        
jglick@139
   472
        public void putAll(Map t) {
jglick@139
   473
            fail("Should not be every called");
jglick@139
   474
        }
jglick@139
   475
        
jglick@833
   476
        public Collection<Object> values() {
jglick@139
   477
            fail("Should not be every called");
jglick@139
   478
            return null;
jglick@139
   479
        }
jglick@139
   480
        
jglick@139
   481
        public void clear() {
jglick@139
   482
            fail("Should not be every called");
jglick@139
   483
        }
jglick@139
   484
        
jglick@139
   485
        public boolean isEmpty() {
jglick@139
   486
            fail("Should not be every called");
jglick@139
   487
            return false;
jglick@139
   488
        }
jglick@139
   489
        
jglick@139
   490
        public Object remove(Object key) {
jglick@139
   491
            fail("Should not be every called");
jglick@139
   492
            return null;
jglick@139
   493
        }
jglick@139
   494
        
jglick@139
   495
        public int size() {
jglick@139
   496
            fail("Should not be every called");
jglick@139
   497
            return 1;
jglick@139
   498
        }
jglick@139
   499
        
jglick@139
   500
    }
jglick@139
   501
}