Beispiel #1
0
        private static IRingSet toRingSet(IAtomContainer ac, System.Collections.ICollection cycles)
        {
            IRingSet ringSet = ac.Builder.newRingSet();

            System.Collections.IEnumerator cycleIterator = cycles.GetEnumerator();

            while (cycleIterator.MoveNext())
            {
                SimpleCycle cycle = (SimpleCycle)cycleIterator.Current;

                IRing ring = ac.Builder.newRing();

                System.Collections.IList vertices = cycle.vertexList();

                IAtom[] atoms = new IAtom[vertices.Count];
                atoms[0] = (IAtom)vertices[0];
                for (int i = 1; i < vertices.Count; i++)
                {
                    atoms[i] = (IAtom)vertices[i];
                    ring.addElectronContainer(ac.getBond(atoms[i - 1], atoms[i]));
                }
                ring.addElectronContainer(ac.getBond(atoms[vertices.Count - 1], atoms[0]));
                ring.Atoms = atoms;

                ringSet.addAtomContainer(ring);
            }

            return(ringSet);
        }
Beispiel #2
0
        private bool ContainsObject(Object obj, System.Collections.ICollection list)
        {
            System.Collections.IEnumerator e = list.GetEnumerator();
            while (e.MoveNext())
            {
                Object o = e.Current;
                if (o is System.IO.FileInfo)
                {
                    System.IO.FileInfo f1 = (System.IO.FileInfo)o;
                    if (obj is System.IO.FileInfo)
                    {
                        System.IO.FileInfo f2 = (System.IO.FileInfo)obj;
                        if (f1.FullName == f2.FullName &&
                            f1.GetType() == f2.GetType())
                        {
                            return(true);
                        }
                    }
                }
                else if (o.Equals(obj))
                {
                    return(true);
                }
            }

            return(false);
        }
 public override NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo CreateCopy
     (System.Collections.Generic.IDictionary <NeoDatis.Odb.OID, NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                              > cache, bool onlyData)
 {
     System.Collections.ICollection c = (System.Collections.ICollection)theObject;
     System.Collections.Generic.ICollection <NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                             > newCollection = new NeoDatis.Tool.Wrappers.List.OdbArrayList <NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                                                                                             >();
     // To keep track of non native objects
     NeoDatis.Tool.Wrappers.List.IOdbList <NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                           > nonNatives = new NeoDatis.Tool.Wrappers.List.OdbArrayList <NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                                                        >();
     System.Collections.IEnumerator iterator = c.GetEnumerator();
     while (iterator.MoveNext())
     {
         NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo aoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                                                        )iterator.Current;
         // create copy
         aoi = aoi.CreateCopy(cache, onlyData);
         newCollection.Add(aoi);
         if (aoi.IsNonNativeObject())
         {
             nonNatives.Add((NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo)aoi);
         }
     }
     NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo coi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo
                                                                         (newCollection, odbType, nonNatives);
     coi.SetRealCollectionClassName(realCollectionClassName);
     return(coi);
 }
Beispiel #4
0
        public override void  Flush(System.Collections.IDictionary threadsAndFields, SegmentWriteState state)
        {
            System.Collections.IDictionary oneThreadsAndFields = new System.Collections.Hashtable();
            System.Collections.IDictionary twoThreadsAndFields = new System.Collections.Hashtable();

            System.Collections.IEnumerator it = new System.Collections.Hashtable(threadsAndFields).GetEnumerator();
            while (it.MoveNext())
            {
                System.Collections.DictionaryEntry entry = (System.Collections.DictionaryEntry)it.Current;

                DocFieldConsumersPerThread perThread = (DocFieldConsumersPerThread)entry.Key;

                System.Collections.ICollection fields = (System.Collections.ICollection)entry.Value;

                System.Collections.IEnumerator fieldsIt  = fields.GetEnumerator();
                System.Collections.Hashtable   oneFields = new System.Collections.Hashtable();
                System.Collections.Hashtable   twoFields = new System.Collections.Hashtable();
                while (fieldsIt.MoveNext())
                {
                    DocFieldConsumersPerField perField = (DocFieldConsumersPerField)fieldsIt.Current;
                    SupportClass.CollectionsHelper.AddIfNotContains(oneFields, perField.one);
                    SupportClass.CollectionsHelper.AddIfNotContains(twoFields, perField.two);
                }

                oneThreadsAndFields[perThread.one] = oneFields;
                twoThreadsAndFields[perThread.two] = twoFields;
            }


            one.Flush(oneThreadsAndFields, state);
            two.Flush(twoThreadsAndFields, state);
        }
Beispiel #5
0
        //Rolls back index to a chosen ID
        private void  RollBackLast(int id)
        {
            // System.out.println("Attempting to rollback to "+id);
            System.String ids  = "-" + id;
            IndexCommit   last = null;

            System.Collections.ICollection commits = IndexReader.ListCommits(dir);
            for (System.Collections.IEnumerator iterator = commits.GetEnumerator(); iterator.MoveNext();)
            {
                IndexCommit commit = (IndexCommit)iterator.Current;
                System.Collections.Generic.IDictionary <string, string> ud = commit.GetUserData();
                if (ud.Count > 0)
                {
                    if (((System.String)ud["index"]).EndsWith(ids))
                    {
                        last = commit;
                    }
                }
            }

            if (last == null)
            {
                throw new System.SystemException("Couldn't find commit point " + id);
            }

            IndexWriter w = new IndexWriter(dir, new WhitespaceAnalyzer(), new RollbackDeletionPolicy(this, id), MaxFieldLength.UNLIMITED, last);

            System.Collections.Generic.IDictionary <string, string> data = new System.Collections.Generic.Dictionary <string, string>();
            data["index"] = "Rolled back to 1-" + id;
            w.Commit(data);
            w.Close();
        }
Beispiel #6
0
        public override void  Flush(System.Collections.IDictionary threadsAndFields, SegmentWriteState state)
        {
            System.Collections.IDictionary childThreadsAndFields    = new System.Collections.Hashtable();
            System.Collections.IDictionary endChildThreadsAndFields = new System.Collections.Hashtable();

            System.Collections.IEnumerator it = new System.Collections.Hashtable(threadsAndFields).GetEnumerator();
            while (it.MoveNext())
            {
                System.Collections.DictionaryEntry entry = (System.Collections.DictionaryEntry)it.Current;

                DocInverterPerThread perThread = (DocInverterPerThread)entry.Key;

                System.Collections.ICollection fields = (System.Collections.ICollection)entry.Value;

                System.Collections.IEnumerator fieldsIt       = fields.GetEnumerator();
                System.Collections.Hashtable   childFields    = new System.Collections.Hashtable();
                System.Collections.Hashtable   endChildFields = new System.Collections.Hashtable();
                while (fieldsIt.MoveNext())
                {
                    DocInverterPerField perField = (DocInverterPerField)((System.Collections.DictionaryEntry)fieldsIt.Current).Key;
                    childFields[perField.consumer]       = perField.consumer;
                    endChildFields[perField.endConsumer] = perField.endConsumer;
                }

                childThreadsAndFields[perThread.consumer]       = childFields;
                endChildThreadsAndFields[perThread.endConsumer] = endChildFields;
            }

            consumer.Flush(childThreadsAndFields, state);
            endConsumer.Flush(endChildThreadsAndFields, state);
        }
Beispiel #7
0
 //UPGRADE_ISSUE: Class hierarchy differences between 'java.io.Writer' and 'System.IO.StreamWriter' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1186'"
 public static void  writeSuspended(System.IO.StreamWriter output, System.Collections.ICollection c)
 {
     output.Write("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>");
     if (externalUrls != null)
     {
         output.Write("<?xml-stylesheet type=\"text/xsl\" href=\"" + externalUrls + "\"?>");
     }
     if (fixtureFile == null)
     {
         output.Write("<Suspended>");
     }
     else
     {
         output.Write("<Suspended competitionName=\"" + competitionName + "\">");
     }
     System.Collections.IEnumerator E = c.GetEnumerator();
     //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
     while (E.MoveNext())
     {
         //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
         PlayerWrapper t = (PlayerWrapper)E.Current;
         output.Write("<Player name=\"" + t.Player.Name + "\" team=\"" + t.Team + "\" weeks=\"" + t.Player.Suspension + "\"/>");
     }
     output.Write("</Suspended>");
     output.Flush();
 }
Beispiel #8
0
        public static void AreEqual(System.Collections.ICollection expected, System.Collections.ICollection actual)
        {
            if (expected == null && actual == null)
            {
                return;
            }

            if (expected == null || actual == null)
            {
                Assert.IsTrue(false, expected == null ? "expected" : "actual" + " is null");
            }

            Assert.AreEqual(expected.Count, actual.Count, "Count not equal");

            var ie = expected.GetEnumerator();
            var ia = actual.GetEnumerator();

            while (true)
            {
                bool b1 = ie.MoveNext();
                bool b2 = ia.MoveNext();
                Assert.AreEqual(b1, b2);

                if (!b1)
                {
                    break;
                }
                Assert.AreEqual(ie.Current, ia.Current);
            }
        }
Beispiel #9
0
        //
        // Compare two collections for equality (as implemented by the Equals() method of its elements).
        // Order is significant.
        //
        public static bool Equals(System.Collections.ICollection c1, System.Collections.ICollection c2)
        {
            try
            {
                bool result;
                if (cheapComparison(c1, c2, out result))
                {
                    return(result);
                }

                System.Collections.IEnumerator e = c2.GetEnumerator();
                foreach (object o in c1)
                {
                    e.MoveNext();
                    if (!Equals(o, e.Current))
                    {
                        return(false);
                    }
                }
                return(true);
            }
            catch (System.Exception)
            {
                return(false);
            }
        }
Beispiel #10
0
        /// <summary>
        /// Determines whether the collection contains all the elements in the specified collection.
        /// </summary>
        /// <param name="target">The collection to check.</param>
        /// <param name="c">Collection whose elements would be checked for containment.</param>
        /// <returns>true id the target collection contains all the elements of the specified collection.</returns>
        public static bool ContainsAll(System.Collections.ICollection target, System.Collections.ICollection c)
        {
            System.Collections.IEnumerator e = c.GetEnumerator();

            bool contains = false;

            //Reflection. Invoke "containsAll" method for proprietary classes or "Contains" method for each element in the collection
            System.Reflection.MethodInfo method;
            try
            {
                method = target.GetType().GetMethod("containsAll");

                if (method != null)
                {
                    contains = (bool)method.Invoke(target, new Object[] { c });
                }
                else
                {
                    method = target.GetType().GetMethod("Contains");
                    while (e.MoveNext() == true)
                    {
                        if ((contains = (bool)method.Invoke(target, new Object[] { e.Current })) == false)
                        {
                            break;
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                throw ex;
            }

            return(contains);
        }
Beispiel #11
0
 /// <exception cref="System.Exception"></exception>
 public virtual void Test2()
 {
     DeleteBase("map-with-collections");
     NeoDatis.Odb.ODB odb = null;
     odb = Open("map-with-collections");
     NeoDatis.Odb.Test.Arraycollectionmap.MyMapObject o = new NeoDatis.Odb.Test.Arraycollectionmap.MyMapObject
                                                              ("test");
     System.Collections.ICollection c = new System.Collections.ArrayList();
     c.Add(o);
     o.GetMap().Add("c", c);
     odb.Store(o);
     odb.Close();
     odb = Open("map-with-collections");
     NeoDatis.Odb.Objects os = odb.GetObjects(typeof(NeoDatis.Odb.Test.Arraycollectionmap.MyMapObject
                                                     ));
     NeoDatis.Odb.Test.Arraycollectionmap.MyMapObject mmo = (NeoDatis.Odb.Test.Arraycollectionmap.MyMapObject
                                                             )os.GetFirst();
     odb.Close();
     DeleteBase("map-with-collections");
     AssertEquals(o.GetName(), mmo.GetName());
     AssertEquals(o.GetMap().Count, mmo.GetMap().Count);
     System.Collections.ICollection c1 = (System.Collections.ICollection)o.GetMap()["c"
                                         ];
     System.Collections.ICollection c2 = (System.Collections.ICollection)mmo.GetMap()[
         "c"];
     AssertEquals(c1.Count, c2.Count);
     AssertEquals(mmo, c2.GetEnumerator().Current);
 }
 private System.Collections.Generic.IDictionary <AbstractObjectInfo, AbstractObjectInfo> IntrospectNonGenericMap(
     System.Collections.IDictionary map,
     bool introspect,
     IDictionary <object, NonNativeObjectInfo> alreadyReadObjects, IIntrospectionCallback callback)
 {
     System.Collections.Generic.IDictionary <AbstractObjectInfo, AbstractObjectInfo> mapCopy = new OdbHashMap <AbstractObjectInfo, AbstractObjectInfo>();
     System.Collections.ICollection keySet = map.Keys;
     System.Collections.IEnumerator keys   = keySet.GetEnumerator();
     NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo          ciKey       = null;
     NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo          ciValue     = null;
     NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo aoiForKey   = null;
     NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo aoiForValue = null;
     while (keys.MoveNext())
     {
         object key   = keys.Current;
         object value = map[key];
         if (key != null)
         {
             ciKey = GetClassInfo(OdbClassUtil.GetFullName(key.GetType()));
             if (value != null)
             {
                 ciValue = GetClassInfo(OdbClassUtil.GetFullName(value.GetType()));
             }
             aoiForKey   = GetObjectInfo(key, ciKey, introspect, alreadyReadObjects, callback);
             aoiForValue = GetObjectInfo(value, ciValue, introspect, alreadyReadObjects, callback
                                         );
             mapCopy.Add(aoiForKey, aoiForValue);
         }
     }
     return(mapCopy);
 }
Beispiel #13
0
 /// <summary>Create set from a Collection of char[] or String </summary>
 public CharArraySet(System.Collections.ICollection c, bool ignoreCase) : this(c.Count, ignoreCase)
 {
     System.Collections.IEnumerator e = c.GetEnumerator();
     while (e.MoveNext())
     {
         Add(e.Current);
     }
 }
        private NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo IntrospectCollection
            (System.Collections.ICollection collection, bool introspect, System.Collections.Generic.IDictionary
            <object, NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo> alreadyReadObjects
            , NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType type, NeoDatis.Odb.Core.Layers.Layer1.Introspector.IIntrospectionCallback
            callback)
        {
            if (collection == null)
            {
                return(new NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo());
            }
            // A collection that contain all meta representations of the collection
            // objects
            System.Collections.Generic.ICollection <NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                                    > collectionCopy = new System.Collections.Generic.List <NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                                                                                            >(collection.Count);
            // A collection to keep references all all non native objects of the
            // collection
            // This will be used later to get all non native objects contained in an
            // object
            System.Collections.Generic.ICollection <NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                    > nonNativesObjects = new System.Collections.Generic.List <NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                                                               >(collection.Count);
            NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo aoi = null;
            System.Collections.IEnumerator iterator = collection.GetEnumerator();
            while (iterator.MoveNext())
            {
                object o = iterator.Current;
                NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci = null;
                // Null objects are not inserted in list
                if (o != null)
                {
                    ci  = GetClassInfo(OdbClassUtil.GetFullName(o.GetType()));
                    aoi = GetObjectInfo(o, ci, introspect, alreadyReadObjects, callback);
                    collectionCopy.Add(aoi);
                    if (aoi.IsNonNativeObject())
                    {
                        // o is not null, call the callback with it
                        //callback.objectFound(o);
                        // This is a non native object
                        nonNativesObjects.Add((NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo)aoi
                                              );
                    }
                }
            }
            NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo coi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo
                                                                                (collectionCopy, nonNativesObjects);
            string realCollectionClassName = OdbClassUtil.GetFullName(collection.GetType());

            if (realCollectionClassName.IndexOf("$") != -1)
            {
                coi.SetRealCollectionClassName(type.GetDefaultInstanciationClass().FullName);
            }
            else
            {
                coi.SetRealCollectionClassName(realCollectionClassName);
            }
            return(coi);
        }
Beispiel #15
0
 /// <summary> Assumes the fields are not storing term vectors.
 ///
 /// </summary>
 /// <param name="names">The names of the fields
 /// </param>
 /// <param name="isIndexed">Whether the fields are indexed or not
 ///
 /// </param>
 /// <seealso cref="Add(String, boolean)">
 /// </seealso>
 public void  Add(System.Collections.ICollection names, bool isIndexed)
 {
     System.Collections.IEnumerator i = names.GetEnumerator();
     while (i.MoveNext())
     {
         System.Collections.DictionaryEntry t = (System.Collections.DictionaryEntry)i.Current;
         Add((System.String)t.Key, isIndexed);
     }
 }
Beispiel #16
0
 /// <summary> Add fields that are indexed. Whether they have termvectors has to be specified.
 ///
 /// </summary>
 /// <param name="names">The names of the fields
 /// </param>
 /// <param name="storeTermVectors">Whether the fields store term vectors or not
 /// </param>
 /// <param name="storePositionWithTermVector">treu if positions should be stored.
 /// </param>
 /// <param name="storeOffsetWithTermVector">true if offsets should be stored
 /// </param>
 public void  AddIndexed(System.Collections.ICollection names, bool storeTermVectors, bool storePositionWithTermVector, bool storeOffsetWithTermVector)
 {
     System.Collections.IEnumerator i = names.GetEnumerator();
     while (i.MoveNext())
     {
         System.Collections.DictionaryEntry t = (System.Collections.DictionaryEntry)i.Current;
         Add((System.String)t.Key, true, storeTermVectors, storePositionWithTermVector, storeOffsetWithTermVector);
     }
 }
Beispiel #17
0
 private void  AddIndexed(IndexReader reader, FieldInfos fieldInfos, System.Collections.ICollection names, bool storeTermVectors, bool storePositionWithTermVector, bool storeOffsetWithTermVector, bool storePayloads)
 {
     System.Collections.IEnumerator i = names.GetEnumerator();
     while (i.MoveNext())
     {
         System.String field = (System.String)i.Current;
         fieldInfos.Add(field, true, storeTermVectors, storePositionWithTermVector, storeOffsetWithTermVector, !reader.HasNorms(field), storePayloads);
     }
 }
Beispiel #18
0
 private bool CheckIfCollectionContainsValue(System.Collections.ICollection c)
 {
     NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine engine = GetQuery().GetStorageEngine
                                                                 ();
     if (engine == null)
     {
         throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.QueryEngineNotSet
                                                    );
     }
     NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo aoi = null;
     System.Collections.IEnumerator iterator = c.GetEnumerator();
     // If the object to compared is native
     if (objectIsNative)
     {
         while (iterator.MoveNext())
         {
             aoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo)iterator.Current;
             if (aoi == null && criterionValue == null)
             {
                 return(true);
             }
             if (aoi != null && criterionValue == null)
             {
                 return(false);
             }
             if (criterionValue.Equals(aoi.GetObject()))
             {
                 return(true);
             }
         }
         return(false);
     }
     // Object is not native
     while (iterator.MoveNext())
     {
         aoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo)iterator.Current;
         if (aoi.IsNull() && criterionValue == null && oid == null)
         {
             return(true);
         }
         if (aoi != null & oid != null)
         {
             if (aoi.IsNonNativeObject())
             {
                 NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi1 = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                                   )aoi;
                 bool isEqual = nnoi1.GetOid() != null && oid != null && nnoi1.GetOid().Equals(oid
                                                                                               );
                 if (isEqual)
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
Beispiel #19
0
 /// <summary>
 /// Converts an ICollection instance to an ArrayList instance.
 /// </summary>
 /// <param name="c">The ICollection instance to be converted.</param>
 /// <returns>An ArrayList instance in which its elements are the elements of the ICollection instance.</returns>
 public static System.Collections.ArrayList ToArrayList(System.Collections.ICollection c)
 {
     System.Collections.ArrayList   tempArrayList  = new System.Collections.ArrayList();
     System.Collections.IEnumerator tempEnumerator = c.GetEnumerator();
     while (tempEnumerator.MoveNext())
     {
         tempArrayList.Add(tempEnumerator.Current);
     }
     return(tempArrayList);
 }
Beispiel #20
0
        public virtual void  TestGetFieldNameVariations()
        {
            try
            {
                System.Collections.ICollection result = reader.GetFieldNames();
                Assert.IsTrue(result != null);
                Assert.IsTrue(result.Count == 7);
                for (System.Collections.IEnumerator iter = result.GetEnumerator(); iter.MoveNext();)
                {
                    System.Collections.DictionaryEntry fi = (System.Collections.DictionaryEntry)iter.Current;
                    System.String s = fi.Key.ToString();
                    //System.out.println("Name: " + s);
                    Assert.IsTrue(DocHelper.nameValues.Contains(s) == true || s.Equals(""));
                }
                result = reader.GetFieldNames(true);
                Assert.IsTrue(result != null);
                //      System.out.println("Size: " + result.size());
                Assert.IsTrue(result.Count == 5);
                for (System.Collections.IEnumerator iter = result.GetEnumerator(); iter.MoveNext();)
                {
                    System.Collections.DictionaryEntry fi = (System.Collections.DictionaryEntry)iter.Current;
                    System.String s = fi.Key.ToString();
                    Assert.IsTrue(DocHelper.nameValues.Contains(s) == true || s.Equals(""));
                }

                result = reader.GetFieldNames(false);
                Assert.IsTrue(result != null);
                Assert.IsTrue(result.Count == 2);
                //Get all indexed fields that are storing term vectors
                result = reader.GetIndexedFieldNames(true);
                Assert.IsTrue(result != null);
                Assert.IsTrue(result.Count == 2);

                result = reader.GetIndexedFieldNames(false);
                Assert.IsTrue(result != null);
                Assert.IsTrue(result.Count == 3);
            }
            catch (System.IO.IOException e)
            {
                System.Console.Error.WriteLine(e.StackTrace);
                Assert.IsTrue(false);
            }
        }
Beispiel #21
0
        public void CrashRdv_ocCurrent_InvalidOperation()
        {
            Setup();
            dary2.Add("CC", 3);

            System.Collections.ICollection oc   = objCol2.Values;
            System.Collections.IEnumerator etor = oc.GetEnumerator();

            object zz = etor.Current;
        }
Beispiel #22
0
        /// <summary>Computes a score factor for a phrase.
        ///
        /// <p>The default implementation sums the {@link #Idf(Term,Searcher)} factor
        /// for each term in the phrase.
        ///
        /// </summary>
        /// <param name="terms">the terms in the phrase
        /// </param>
        /// <param name="searcher">the document collection being searched
        /// </param>
        /// <returns> a score factor for the phrase
        /// </returns>
        public virtual float Idf(System.Collections.ICollection terms, Searcher searcher)
        {
            float idf = 0.0f;

            System.Collections.IEnumerator i = terms.GetEnumerator();
            while (i.MoveNext())
            {
                idf += Idf((Term)i.Current, searcher);
            }
            return(idf);
        }
Beispiel #23
0
 /// <summary> Add fields that are indexed. Whether they have termvectors has to be specified.
 ///
 /// </summary>
 /// <param name="names">The names of the fields
 /// </param>
 /// <param name="storeTermVectors">Whether the fields store term vectors or not
 /// </param>
 /// <param name="storePositionWithTermVector">true if positions should be stored.
 /// </param>
 /// <param name="storeOffsetWithTermVector">true if offsets should be stored
 /// </param>
 public void  AddIndexed(System.Collections.ICollection names, bool storeTermVectors, bool storePositionWithTermVector, bool storeOffsetWithTermVector)
 {
     lock (this)
     {
         System.Collections.IEnumerator i = names.GetEnumerator();
         while (i.MoveNext())
         {
             Add((System.String)i.Current, true, storeTermVectors, storePositionWithTermVector, storeOffsetWithTermVector);
         }
     }
 }
        public static void Display(string title, System.Collections.ICollection list)
        {
            System.Console.Out.WriteLine("***" + title);
            System.Collections.IEnumerator iterator = list.GetEnumerator();
            int i = 1;

            while (iterator.MoveNext())
            {
                System.Console.Out.WriteLine(i + "=" + iterator.Current);
                i++;
            }
        }
Beispiel #25
0
        /// <seealso cref="Graph.addAllVertices(Collection)">
        /// </seealso>
        public virtual bool addAllVertices(System.Collections.ICollection vertices)
        {
            bool modified = false;

            //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
            for (System.Collections.IEnumerator iter = vertices.GetEnumerator(); iter.MoveNext();)
            {
                //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
                modified |= addVertex(iter.Current);
            }

            return(modified);
        }
Beispiel #26
0
        /// <summary>Adds all of the elements in the specified collection to this collection </summary>
        public virtual bool AddAll(System.Collections.ICollection items)
        {
            bool added = false;

            System.Collections.IEnumerator iter = items.GetEnumerator();
            System.Object item;
            while (iter.MoveNext())
            {
                item  = iter.Current;
                added = Add(item);
            }
            return(added);
        }
Beispiel #27
0
            /// <summary>
            /// Verifies that all the elements of the specified collection are contained into the current collection.
            /// </summary>
            /// <param name="collection">The collection used to extract the elements that will be verified.</param>
            /// <returns>True if the collection contains all the given elements.</returns>
            public virtual bool ContainsAll(System.Collections.ICollection collection)
            {
                bool result = false;

                System.Collections.IEnumerator tempEnumerator = collection.GetEnumerator();
                while (tempEnumerator.MoveNext())
                {
                    if (!(result = this.Contains(tempEnumerator.Current)))
                    {
                        break;
                    }
                }
                return(result);
            }
Beispiel #28
0
        public static string CollectionToString(System.Collections.ICollection set_Renamed, string sep)
        {
            var buffer = new System.Text.StringBuilder();

            System.Collections.IEnumerator iter = set_Renamed.GetEnumerator();
            buffer.Append("{");
            while (iter.MoveNext())
            {
                buffer.Append(iter.Current).Append(sep);
            }
            buffer.Remove(buffer.Length - sep.Length, 1);
            buffer.Append("}");
            return(buffer.ToString());
        }
Beispiel #29
0
        /// <summary>
        /// Returns an array containing all the elements of the collection.
        /// </summary>
        /// <returns>The array containing all the elements of the collection.</returns>
        public static System.Object[] ToArray(System.Collections.ICollection c)
        {
            int index = 0;

            System.Object[] objects          = new System.Object[c.Count];
            System.Collections.IEnumerator e = c.GetEnumerator();

            while (e.MoveNext())
            {
                objects[index++] = e.Current;
            }

            return(objects);
        }
Beispiel #30
0
        private string GetUsername(PrincipalCollection principals)
        {
            string username = null;

            System.Collections.ICollection ldapPrincipals = principals.fromRealm(Name);
            if (ldapPrincipals.Count > 0)
            {
                username = ( string )ldapPrincipals.GetEnumerator().next();
            }
            else if (_useSystemAccountForAuthorization.Value)
            {
                username = ( string )principals.PrimaryPrincipal;
            }
            return(username);
        }