Example #1
0
		/// <summary>
		/// Returns a string representation of this IList.
		/// </summary>
		/// <remarks>
		/// The string representation is a list of the collection's elements in the order 
		/// they are returned by its IEnumerator, enclosed in square brackets ("[]").
		/// The separator is a comma followed by a space i.e. ", ".
		/// </remarks>
		/// <param name="coll">Collection whose string representation will be returned</param>
		/// <returns>A string representation of the specified collection or "null"</returns>
		public static string ListToString(IList coll)
		{
			StringBuilder sb = new StringBuilder();
		
			if (coll != null)
			{
				sb.Append("[");
				for (int i = 0; i < coll.Count; i++) 
				{
					if (i > 0)
						sb.Append(", ");

					object element = coll[i];
					if (element == null)
						sb.Append("null");
					else if (element is IDictionary)
						sb.Append(DictionaryToString((IDictionary)element));
					else if (element is IList)
						sb.Append(ListToString((IList)element));
					else
						sb.Append(element.ToString());

				}
				sb.Append("]");
			}
			else
				sb.Insert(0, "null");

			return sb.ToString();
		}
Example #2
0
		protected internal virtual void  AddOffCorrectMap(int off, int cumulativeDiff)
		{
			if (pcmList == null)
			{
				pcmList = new System.Collections.ArrayList();
			}
			pcmList.Add(new OffCorrectMap(off, cumulativeDiff));
		}
		public virtual NeoDatis.Odb.Core.IError AddParameter(object o)
		{
			if (parameters == null)
			{
				parameters = new System.Collections.ArrayList();
			}
			parameters.Add(o != null ? o.ToString() : "null");
			return this;
		}
Example #4
0
		public virtual void AddProfile(NeoDatis.Odb.Test.Update.Nullobject.Profile profile
			)
		{
			if (listProfile == null)
			{
				listProfile = new System.Collections.ArrayList();
			}
			listProfile.Add(profile);
		}
		public virtual NeoDatis.Odb.Core.IError AddParameter(long l)
		{
			if (parameters == null)
			{
				parameters = new System.Collections.ArrayList();
			}
			parameters.Add(l);
			return this;
		}
Example #6
0
 /// <summary>Construction from a list of integers </summary>
 public BitSet(IList items)
 	: this(BITS)
 {
     for (int i = 0; i < items.Count; i++)
     {
         int v = (int)items[i];
         Add(v);
     }
 }
Example #7
0
		public Student(int age, NeoDatis.Odb.Test.VO.School.Course course, System.DateTime
			 date, string id, string name)
		{
			this.age = age;
			this.course = course;
			firstDate = date;
			this.id = id;
			this.name = name;
			listHistory = new System.Collections.ArrayList();
		}
        public void find(out PasswordInfo mainAsmPassword, out PasswordInfo embedPassword)
        {
            var asmBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName("asm"), AssemblyBuilderAccess.Run);
            var moduleBuilder = asmBuilder.DefineDynamicModule("mod");
            var serializedTypes = new SerializedTypes(moduleBuilder);
            var allTypes = serializedTypes.deserialize(serializedData);
            asmTypes = toList(readField(allTypes, "Types"));

            mainAsmPassword = findMainAssemblyPassword();
            embedPassword = findEmbedPassword();
        }
		/// <summary>Construct a <code>DisjunctionScorer</code>.</summary>
		/// <param name="subScorers">A collection of at least two subscorers.
		/// </param>
		/// <param name="minimumNrMatchers">The positive minimum number of subscorers that should
		/// match to match this query.
		/// <br>When <code>minimumNrMatchers</code> is bigger than
		/// the number of <code>subScorers</code>,
		/// no matches will be produced.
		/// <br>When minimumNrMatchers equals the number of subScorers,
		/// it more efficient to use <code>ConjunctionScorer</code>.
		/// </param>
		public DisjunctionSumScorer(System.Collections.IList subScorers, int minimumNrMatchers) : base(null)
		{
			
			nrScorers = subScorers.Count;
			
			if (minimumNrMatchers <= 0)
			{
				throw new System.ArgumentException("Minimum nr of matchers must be positive");
			}
			if (nrScorers <= 1)
			{
				throw new System.ArgumentException("There must be at least 2 subScorers");
			}
			
			this.minimumNrMatchers = minimumNrMatchers;
			this.subScorers = subScorers;
		}
		public override Token Next()
		{
			if (cache == null)
			{
				// fill cache lazily
				cache = new System.Collections.ArrayList();
				FillCache();
				iterator = cache.GetEnumerator();
			}
			
			if (!iterator.MoveNext())
			{
				// the cache is exhausted, return null
				return null;
			}
			
			return (Token) iterator.Current;
		}
Example #11
0
		static private void GetUserPreferenceChangedList()
		{
			Type oSystemEventsType = typeof(SystemEvents);

			//Using reflection, get the FieldInfo object for the internal collection of handlers
			// we will use this collection to find the handler we want to unhook and remove it.
			// as you can guess by the naming convention it is a private member.
			System.Reflection.FieldInfo oFieldInfo = oSystemEventsType.GetField("_handlers",
								System.Reflection.BindingFlags.Static |
								System.Reflection.BindingFlags.GetField |
								System.Reflection.BindingFlags.FlattenHierarchy |
								System.Reflection.BindingFlags.NonPublic);

			//now, get a reference to the value of this field so that you can manipulate it.
			//pass null to GetValue() because we are working with a static member.
			object oFieldInfoValue = oFieldInfo.GetValue(null);

			//the returned object is of type Dictionary<object, List<SystemEventInvokeInfo>>
			//each of the Lists<> in the Dictionary<> is used to maintain a different event implementation.
			//It may be more efficient to figure out how the UserPreferenceChanged event is keyed here but a quick-and-dirty
			// method is to just scan them all the first time and then cache the List<> object once it's found.

			System.Collections.IDictionary dictFieldInfoValue = oFieldInfoValue as System.Collections.IDictionary;
			foreach (object oEvent in dictFieldInfoValue)
			{
				System.Collections.DictionaryEntry deEvent = (System.Collections.DictionaryEntry)oEvent;
				System.Collections.IList listEventListeners = deEvent.Value as System.Collections.IList;

				//unfortunately, SystemEventInvokeInfo is a private class so we can't declare a reference of that type.
				//we will use object and then use reflection to get what we need...
				List<Delegate> listDelegatesToRemove = new List<Delegate>();

				//we need to take the first item in the list, get it's delegate and check the type...
				if (listEventListeners.Count > 0 && listEventListeners[0] != null)
				{
					Delegate oDelegate = GetDelegateFromSystemEventInvokeInfo(listEventListeners[0]);
					if (oDelegate is UserPreferenceChangedEventHandler)
					{ _UserPreferenceChangedList = listEventListeners; }
				}
				//if we've found the list, no need to continue searching
				if (_UserPreferenceChangedList != null) break;
			}
		}
Example #12
0
		public override bool IncrementToken()
		{
			if (cache == null)
			{
				// fill cache lazily
				cache = new System.Collections.ArrayList();
				FillCache();
				iterator = cache.GetEnumerator();
			}
			
			if (!iterator.MoveNext())
			{
				// the cache is exhausted, return false
				return false;
			}
			// Since the TokenFilter can be reset, the tokens need to be preserved as immutable.
			RestoreState((AttributeSource.State) iterator.Current);
			return true;
		}
        public override Token Next(/* in */ Token reusableToken)
        {
            System.Diagnostics.Debug.Assert(reusableToken != null);
            if (cache == null)
            {
                // fill cache lazily
                cache = new System.Collections.ArrayList();
                FillCache(reusableToken);
                iterator = cache.GetEnumerator();
            }

            if (!iterator.MoveNext())
            {
                // the cache is exhausted, return null
                return null;
            }

            Token nextToken = (Token) iterator.Current;
            return (Token) nextToken.Clone();
        }
Example #14
0
        /// <summary>
        /// Returns a page of errors from the databse in descending order 
        /// of logged time.
        /// </summary>
        public override int GetErrors(int pageIndex, int pageSize, IList errorEntryList)
        {
            if (pageIndex < 0)
                throw new ArgumentOutOfRangeException("pageIndex", pageIndex, null);

            if (pageSize < 0)
                throw new ArgumentOutOfRangeException("pageSize", pageSize, null);

            using (OleDbConnection connection = new OleDbConnection(this.ConnectionString))
            using (OleDbCommand command = connection.CreateCommand())
            {
                command.CommandType = CommandType.Text;
                command.CommandText = "SELECT COUNT(*) FROM ELMAH_Error";

                connection.Open();
                int totalCount = (int)command.ExecuteScalar();

                if (errorEntryList != null && pageIndex * pageSize < totalCount)
                {
                    int maxRecords = pageSize * (pageIndex + 1);
                    if (maxRecords > totalCount)
                    {
                        maxRecords = totalCount;
                        pageSize = totalCount - pageSize * (totalCount / pageSize);
                    }

                    StringBuilder sql = new StringBuilder(1000);
                    sql.Append("SELECT e.* FROM (");
                    sql.Append("SELECT TOP ");
                    sql.Append(pageSize.ToString(CultureInfo.InvariantCulture));
                    sql.Append(" TimeUtc, ErrorId FROM (");
                    sql.Append("SELECT TOP ");
                    sql.Append(maxRecords.ToString(CultureInfo.InvariantCulture));
                    sql.Append(" TimeUtc, ErrorId FROM ELMAH_Error ");
                    sql.Append("ORDER BY TimeUtc DESC, ErrorId DESC) ");
                    sql.Append("ORDER BY TimeUtc ASC, ErrorId ASC) AS i ");
                    sql.Append("INNER JOIN Elmah_Error AS e ON i.ErrorId = e.ErrorId ");
                    sql.Append("ORDER BY e.TimeUtc DESC, e.ErrorId DESC");

                    command.CommandText = sql.ToString();

                    using (OleDbDataReader reader = command.ExecuteReader())
                    {
                        Debug.Assert(reader != null);

                        while (reader.Read())
                        {
                            string id = Convert.ToString(reader["ErrorId"], CultureInfo.InvariantCulture);

                            Error error = new Error();

                            error.ApplicationName = reader["Application"].ToString();
                            error.HostName = reader["Host"].ToString();
                            error.Type = reader["Type"].ToString();
                            error.Source = reader["Source"].ToString();
                            error.Message = reader["Message"].ToString();
                            error.User = reader["UserName"].ToString();
                            error.StatusCode = Convert.ToInt32(reader["StatusCode"]);
                            error.Time = Convert.ToDateTime(reader["TimeUtc"]).ToLocalTime();

                            errorEntryList.Add(new ErrorLogEntry(this, id, error));
                        }

                        reader.Close();
                    }
                }

                return totalCount;
            }
        }
 public StringTemplateToken(int type, string text, IList args)
     : base(type, text)
 {
     this.args = args;
 }
    private GameObject CreateSensor(GameObject agent, GameObject parent, GameObject prefab, JSONNode item, BaseLink baseLink)
    {
        if (baseLink != null)
        {
            parent = parent == gameObject ? baseLink.gameObject : parent; // replace baselink with the default gameObject parent
        }
        var position = parent.transform.position;
        var rotation = parent.transform.rotation;

        var transform = item["transform"];

        if (transform != null)
        {
            position = parent.transform.TransformPoint(transform.ReadVector3());
            rotation = parent.transform.rotation * Quaternion.Euler(transform.ReadVector3("pitch", "yaw", "roll"));
        }

        var sensor = Instantiate(prefab, position, rotation, agent.transform);

        var sb = sensor.GetComponent <SensorBase>();

        sb.ParentTransform = parent.transform;

        var sbType = sb.GetType();

        foreach (var param in item["params"])
        {
            var key   = param.Key;
            var value = param.Value;

            var field = sbType.GetField(key);
            if (field == null)
            {
                throw new Exception(
                          $"Unknown {key} parameter for {item["name"].Value} sensor on {gameObject.name} vehicle");
            }

            if (field.FieldType.IsEnum)
            {
                try
                {
                    var obj = Enum.Parse(field.FieldType, value.Value);
                    field.SetValue(sb, obj);
                }
                catch (ArgumentException ex)
                {
                    throw new Exception(
                              $"Failed to set {key} field to {value.Value} enum value for {gameObject.name} vehicle, {sb.Name} sensor",
                              ex);
                }
            }
            else if (field.FieldType == typeof(Color))
            {
                if (ColorUtility.TryParseHtmlString(value.Value, out var color))
                {
                    field.SetValue(sb, color);
                }
                else
                {
                    throw new Exception(
                              $"Failed to set {key} field to {value.Value} color for {gameObject.name} vehicle, {sb.Name} sensor");
                }
            }
            else if (field.FieldType == typeof(bool))
            {
                field.SetValue(sb, value.AsBool);
            }
            else if (field.FieldType == typeof(int))
            {
                field.SetValue(sb, value.AsInt);
            }
            else if (field.FieldType == typeof(float))
            {
                field.SetValue(sb, value.AsFloat);
            }
            else if (field.FieldType == typeof(string))
            {
                field.SetValue(sb, value.Value);
            }
            else if (field.FieldType.IsGenericType && field.FieldType.GetGenericTypeDefinition() == typeof(List <>))
            {
                var  type     = field.FieldType.GetGenericArguments()[0];
                Type listType = typeof(List <>).MakeGenericType(new[] { type });
                System.Collections.IList list = (System.Collections.IList)Activator.CreateInstance(listType);

                if (type.IsEnum)
                {
                    foreach (var elemValue in value)
                    {
                        object elem;
                        try
                        {
                            elem = Enum.Parse(type, elemValue.Value);
                        }
                        catch (ArgumentException ex)
                        {
                            throw new Exception(
                                      $"Failed to set {key} field to {value.Value} enum value for {gameObject.name} vehicle, {sb.Name} sensor",
                                      ex);
                        }
                        list.Add(elem);
                    }
                }
                else if (type == typeof(float))
                {
                    foreach (var elemValue in value)
                    {
                        float elem = elemValue.Value.AsFloat;
                        list.Add(elem);
                    }
                }
                else
                {
                    foreach (var elemValue in value)
                    {
                        var elem = Activator.CreateInstance(type);

                        foreach (var elemField in type.GetFields())
                        {
                            var name = elemField.Name;

                            if (elemValue.Value[name].IsNumber)
                            {
                                elemField.SetValue(elem, elemValue.Value[name].AsFloat);
                            }
                            else if (elemValue.Value[name].IsString)
                            {
                                elemField.SetValue(elem, elemValue.Value[name].Value);
                            }
                        }

                        list.Add(elem);
                    }
                }

                field.SetValue(sb, list);
            }
            else
            {
                throw new Exception(
                          $"Unknown {field.FieldType} type for {key} field for {gameObject.name} vehicle, {sb.Name} sensor");
            }
        }

        return(sensor);
    }
 public static System.Collections.IList Synchronized(System.Collections.IList list)
 {
     return(default(System.Collections.IList));
 }
 /** <summary>Create a stream, but feed off an existing list</summary> */
 public RewriteRuleSubtreeStream(ITreeAdaptor adaptor, string elementDescription, IList elements)
     : base(adaptor, elementDescription, elements)
 {
 }
Example #19
0
 /// <summary> Contructs a new Polymer to store the Monomers.</summary>
 public PDBStrand()
     : base()
 {
     sequentialListOfMonomers = new System.Collections.ArrayList();
 }
Example #20
0
 public abstract bool Match(System.Collections.IList r);
Example #21
0
        /// <summary>
        /// 批量插入
        /// </summary>
        /// <param name="details"></param>
        /// <param name="keepIdentity"></param>
        public override void BatchInsert(DbContext dbContext, System.Collections.IList details, bool keepIdentity = false)
        {
            if (details.Count == 0)
            {
                return;
            }
            var       type      = details[0].GetType();
            var       table     = TypeCache.GetTable(type);
            var       tableName = KeyWordFormat(table.TableName);
            var       helper    = dbContext.DBHelper;
            DataTable tempTable;

            if (!cacheTables.ContainsKey(type))
            {
                var sb = new StringBuilder();
                GetSelectTop(sb, "*", b =>
                {
                    b.Append(" from " + tableName + " where 1=0");
                }, "", 1);
                var sql        = sb.ToString();
                var tempTable2 = helper.ExecDataTable(sql);
                cacheTables.Add(type, tempTable2);
                tempTable = tempTable2.Clone();//创建一个副本
            }
            else
            {
                tempTable = cacheTables[type].Clone();
            }
            ////字段顺序得和表一至,不然插入出错
            //DataTable tempTable = new DataTable() { TableName = tableName };
            //foreach (var f in table.Fields)
            //{
            //    var column = new DataColumn() { ColumnName = f.MapingName, DataType = f.PropertyType, AllowDBNull = true };
            //    tempTable.Columns.Add(column);
            //}
            var typeArry = table.Fields;

            foreach (var item in details)
            {
                DataRow dr = tempTable.NewRow();
                foreach (Attribute.FieldAttribute info in typeArry)
                {
                    //if (info.FieldType != Attribute.FieldType.数据库字段)
                    //{
                    //    continue;
                    //}
                    string name  = info.MapingName;
                    object value = info.GetValue(item);
                    if (!keepIdentity)
                    {
                        if (info.IsPrimaryKey)
                        {
                            continue;
                        }
                    }
                    var value2 = ObjectConvert.CheckNullValue(value, info.PropertyType);
                    //if (info.PropertyType.FullName.StartsWith("System.Nullable"))//Nullable<T>类型为空值不插入
                    //{
                    //    if (value2 == null)
                    //    {
                    //        continue;
                    //    }
                    //}
                    dr[name] = value2;
                }
                tempTable.Rows.Add(dr);
            }
            helper.InsertFromDataTable(tempTable, tableName, keepIdentity);
        }
 public static void SetTestMode()
 {
     allInstances = new System.Collections.ArrayList();
 }
 public void loadGrid(System.Collections.IList list)
 {
     stockGrid.DataSource = list;
 }
Example #24
0
        public PurchaseHistoryViewModel(IUnitOfWork ctx)
        {
            this._context = ctx;

            stores    = new ObservableCollection <Store>(_context.Stores.GetAll());
            products  = new ObservableCollection <Product>(_context.Products.GetAll());
            NullStore = new Store()
            {
                id = -1, storeName = ""
            };
            NullProduct = new Product()
            {
                id = -1, reference = ""
            };
            stores.Insert(0, NullStore);
            products.Insert(0, NullProduct);

            ResetFeilds();

            populatePurchases();

            refreshCommand = new RelayCommand(() =>
            {
                populatePurchases();
            });
            resetCommand = new RelayCommand(() =>
            {
                ResetFeilds();
                populatePurchases();
            });
            saveChangesCommand = new RelayCommand(() =>
            {
                _context.Complete();
                saveChangesCommand.RaiseCanExecuteChanged();
            },
                                                  () =>
            {
                return(_context.hasPendingChanges());
            });
            DeleteSelectedCommand = new RelayCommand <object>(parameter =>
            {
                if (parameter != null)
                {
                    System.Collections.IList items = (System.Collections.IList)parameter;
                    var selection = items?.Cast <Purchase>().ToList();
                    _context.Purchases.RemoveRange(selection);
                    foreach (var purchase in selection)
                    {
                        Purchases.Remove(purchase);
                    }
                    saveChangesCommand.RaiseCanExecuteChanged();
                }
                //_context.Purchases.Remove(selectedPurchase);
                //Purchases.Remove(selectedPurchase);
                //selectedPurchase = null;
            }, parameter =>
            {
                if (parameter != null)
                {
                    System.Collections.IList items = (System.Collections.IList)parameter;
                    if (items.Count > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
                                                              );
            MessengerInstance.Register <Messages.ProductAddedMessage>(this, (msg) =>
            {
                products.Add(msg.product);
            });
            MessengerInstance.Register <Messages.StoreAddedMessage>(this, (msg) =>
            {
                stores.Add(msg.store);
            });
        }
Example #25
0
        /// <summary> Internal helper method used by check that iterates over
        /// the keys of readerFieldToValIds and generates a Collection
        /// of Insanity instances whenever two (or more) ReaderField instances are
        /// found that have an ancestery relationships.
        ///
        /// </summary>
        /// <seealso cref="InsanityType.SUBREADER">
        /// </seealso>
        private List <Insanity> CheckSubreaders(MapOfSets <int, CacheEntry> valIdToItems,
                                                MapOfSets <ReaderField, int> readerFieldToValIds)
        {
            List <Insanity> insanity = new List <Insanity>(23);

            Dictionary <ReaderField, HashSet <ReaderField> > badChildren = new Dictionary <ReaderField, HashSet <ReaderField> >(17);
            MapOfSets <ReaderField, ReaderField>             badKids     = new MapOfSets <ReaderField, ReaderField>(badChildren); // wrapper

            IDictionary <int, HashSet <CacheEntry> >  viToItemSets  = valIdToItems.Map;
            IDictionary <ReaderField, HashSet <int> > rfToValIdSets = readerFieldToValIds.Map;

            HashSet <ReaderField> seen = new HashSet <ReaderField>();

            foreach (ReaderField rf in rfToValIdSets.Keys)
            {
                if (seen.Contains(rf))
                {
                    continue;
                }

                System.Collections.IList kids = GetAllDecendentReaderKeys(rf.readerKey);
                foreach (object kidKey in kids)
                {
                    ReaderField kid = new ReaderField(kidKey, rf.fieldName);

                    if (badChildren.ContainsKey(kid))
                    {
                        // we've already process this kid as RF and found other problems
                        // track those problems as our own
                        badKids.Put(rf, kid);
                        badKids.PutAll(rf, badChildren[kid]);
                        badChildren.Remove(kid);
                    }
                    else if (rfToValIdSets.ContainsKey(kid))
                    {
                        // we have cache entries for the kid
                        badKids.Put(rf, kid);
                    }
                    seen.Add(kid);
                }
                seen.Add(rf);
            }

            // every mapping in badKids represents an Insanity
            foreach (ReaderField parent in badChildren.Keys)
            {
                HashSet <ReaderField> kids = badChildren[parent];

                List <CacheEntry> badEntries = new List <CacheEntry>(kids.Count * 2);

                // put parent entr(ies) in first
                {
                    foreach (int val in rfToValIdSets[parent])
                    {
                        badEntries.AddRange(viToItemSets[val]);
                    }
                }

                // now the entries for the descendants
                foreach (ReaderField kid in kids)
                {
                    foreach (int val in rfToValIdSets[kid])
                    {
                        badEntries.AddRange(viToItemSets[val]);
                    }
                }

                insanity.Add(new Insanity(InsanityType.SUBREADER, "Found caches for decendents of " + parent.ToString(), badEntries.ToArray()));
            }

            return(insanity);
        }
        private bool ProcessOptionWithMatchingField(string arg, string[] args, ref int index, string explicitArgument, ref System.Reflection.FieldInfo fi)
        {
            Type type   = fi.FieldType;
            bool isList = false;

            if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(List <>))
            {
                isList = true;
                type   = type.GetGenericArguments()[0];
            }
            if (isList && explicitArgument == "!!")
            {
                // way to set list to empty
                System.Collections.IList listhandle = (System.Collections.IList)fi.GetValue(this);
                listhandle.Clear();
                return(true);
            }
            string argument = AdvanceArgumentIfNoExplicitArg(type, explicitArgument, args, ref index);

            if (isList)
            {
                if (argument == null)
                {
                    AddError("option -{0} requires an argument", arg);
                    return(true);
                }
                string[] listargs = argument.Split(';');
                for (int i = 0; i < listargs.Length; i++)
                {
                    if (listargs[i].Length == 0)
                    {
                        continue;                // skip empty values
                    }
                    bool   remove  = listargs[i][0] == '!';
                    string listarg = remove ? listargs[i].Substring(1) : listargs[i];
                    object value   = ParseValue(type, listarg, arg);
                    if (value != null)
                    {
                        if (remove)
                        {
                            this.GetListField(fi).Remove(value);
                        }
                        else
                        {
                            this.GetListField(fi).Add(value);
                        }
                    }
                }
            }
            else
            {
                object value = ParseValue(type, argument, arg);
                if (value != null)
                {
                    fi.SetValue(this, value);

                    string argname;
                    if (value is Int32 && HasOptionForAttribute(fi, out argname))
                    {
                        this.Parse(DerivedOptionFor(argname, (Int32)value).Split(' '));
                    }
                }
            }
            return(true);
        }
 public static System.Collections.ArrayList Adapter(System.Collections.IList list)
 {
     return(default(System.Collections.ArrayList));
 }
 public static System.Collections.IList FixedSize(System.Collections.IList list)
 {
     return(default(System.Collections.IList));
 }
Example #29
0
			internal DebugScript(DebugEncoder enclosingInstance, System.String name, System.String text)
			{
				InitBlock(enclosingInstance);
				this.bitmap = 0;
				this.name = name;
				this.text = text;
				
				this.debugOffsets = new System.Collections.ArrayList();
			}
Example #30
0
        /// <summary>Returns a {@link Status} instance detailing
        /// the state of the index.
        ///
        /// </summary>
        /// <param name="onlySegments">list of specific segment names to check
        ///
        /// <p/>As this method checks every byte in the specified
        /// segments, on a large index it can take quite a long
        /// time to run.
        ///
        /// <p/><b>WARNING</b>: make sure
        /// you only call this when the index is not opened by any
        /// writer.
        /// </param>
        public virtual Status CheckIndex_Renamed_Method(System.Collections.IList onlySegments)
        {
            System.Globalization.NumberFormatInfo nf = System.Globalization.CultureInfo.CurrentCulture.NumberFormat;
            SegmentInfos sis    = new SegmentInfos();
            Status       result = new Status();

            result.dir = dir;
            try
            {
                sis.Read(dir);
            }
            catch (System.Exception t)
            {
                Msg("ERROR: could not read any segments file in directory");
                result.missingSegments = true;
                if (infoStream != null)
                {
                    infoStream.WriteLine(t.StackTrace);
                }
                return(result);
            }

            int numSegments = sis.Count;

            System.String segmentsFileName = sis.GetCurrentSegmentFileName();
            IndexInput    input            = null;

            try
            {
                input = dir.OpenInput(segmentsFileName);
            }
            catch (System.Exception t)
            {
                Msg("ERROR: could not open segments file in directory");
                if (infoStream != null)
                {
                    infoStream.WriteLine(t.StackTrace);
                }
                result.cantOpenSegments = true;
                return(result);
            }
            int format = 0;

            try
            {
                format = input.ReadInt();
            }
            catch (System.Exception t)
            {
                Msg("ERROR: could not read segment file version in directory");
                if (infoStream != null)
                {
                    infoStream.WriteLine(t.StackTrace);
                }
                result.missingSegmentVersion = true;
                return(result);
            }
            finally
            {
                if (input != null)
                {
                    input.Close();
                }
            }

            System.String sFormat = "";
            bool          skip    = false;

            if (format == SegmentInfos.FORMAT)
            {
                sFormat = "FORMAT [Lucene Pre-2.1]";
            }
            if (format == SegmentInfos.FORMAT_LOCKLESS)
            {
                sFormat = "FORMAT_LOCKLESS [Lucene 2.1]";
            }
            else if (format == SegmentInfos.FORMAT_SINGLE_NORM_FILE)
            {
                sFormat = "FORMAT_SINGLE_NORM_FILE [Lucene 2.2]";
            }
            else if (format == SegmentInfos.FORMAT_SHARED_DOC_STORE)
            {
                sFormat = "FORMAT_SHARED_DOC_STORE [Lucene 2.3]";
            }
            else
            {
                if (format == SegmentInfos.FORMAT_CHECKSUM)
                {
                    sFormat = "FORMAT_CHECKSUM [Lucene 2.4]";
                }
                else if (format == SegmentInfos.FORMAT_DEL_COUNT)
                {
                    sFormat = "FORMAT_DEL_COUNT [Lucene 2.4]";
                }
                else if (format == SegmentInfos.FORMAT_HAS_PROX)
                {
                    sFormat = "FORMAT_HAS_PROX [Lucene 2.4]";
                }
                else if (format == SegmentInfos.FORMAT_USER_DATA)
                {
                    sFormat = "FORMAT_USER_DATA [Lucene 2.9]";
                }
                else if (format == SegmentInfos.FORMAT_DIAGNOSTICS)
                {
                    sFormat = "FORMAT_DIAGNOSTICS [Lucene 2.9]";
                }
                else if (format < SegmentInfos.CURRENT_FORMAT)
                {
                    sFormat = "int=" + format + " [newer version of Lucene than this tool]";
                    skip    = true;
                }
                else
                {
                    sFormat = format + " [Lucene 1.3 or prior]";
                }
            }

            result.segmentsFileName = segmentsFileName;
            result.numSegments      = numSegments;
            result.segmentFormat    = sFormat;
            result.userData         = sis.GetUserData();
            System.String userDataString;
            if (sis.GetUserData().Count > 0)
            {
                userDataString = " userData=" + SupportClass.CollectionsHelper.CollectionToString(sis.GetUserData());
            }
            else
            {
                userDataString = "";
            }

            Msg("Segments file=" + segmentsFileName + " numSegments=" + numSegments + " version=" + sFormat + userDataString);

            if (onlySegments != null)
            {
                result.partial = true;
                if (infoStream != null)
                {
                    infoStream.Write("\nChecking only these segments:");
                }
                System.Collections.IEnumerator it = onlySegments.GetEnumerator();
                while (it.MoveNext())
                {
                    if (infoStream != null)
                    {
                        infoStream.Write(" " + it.Current);
                    }
                }
                System.Collections.IEnumerator e = onlySegments.GetEnumerator();
                while (e.MoveNext() == true)
                {
                    result.segmentsChecked.Add(e.Current);
                }
                Msg(":");
            }

            if (skip)
            {
                Msg("\nERROR: this index appears to be created by a newer version of Lucene than this tool was compiled on; please re-compile this tool on the matching version of Lucene; exiting");
                result.toolOutOfDate = true;
                return(result);
            }


            result.newSegments = (SegmentInfos)sis.Clone();
            result.newSegments.Clear();

            for (int i = 0; i < numSegments; i++)
            {
                SegmentInfo info = sis.Info(i);
                if (onlySegments != null && !onlySegments.Contains(info.name))
                {
                    continue;
                }
                Status.SegmentInfoStatus segInfoStat = new Status.SegmentInfoStatus();
                result.segmentInfos.Add(segInfoStat);
                Msg("  " + (1 + i) + " of " + numSegments + ": name=" + info.name + " docCount=" + info.docCount);
                segInfoStat.name     = info.name;
                segInfoStat.docCount = info.docCount;

                int toLoseDocCount = info.docCount;

                SegmentReader reader = null;

                try
                {
                    Msg("    compound=" + info.GetUseCompoundFile());
                    segInfoStat.compound = info.GetUseCompoundFile();
                    Msg("    hasProx=" + info.GetHasProx());
                    segInfoStat.hasProx = info.GetHasProx();
                    Msg("    numFiles=" + info.Files().Count);
                    segInfoStat.numFiles = info.Files().Count;
                    Msg(System.String.Format(nf, "    size (MB)={0:f}", new System.Object[] { (info.SizeInBytes() / (1024.0 * 1024.0)) }));
                    segInfoStat.sizeMB = info.SizeInBytes() / (1024.0 * 1024.0);
                    System.Collections.Generic.IDictionary <string, string> diagnostics = info.GetDiagnostics();
                    segInfoStat.diagnostics = diagnostics;
                    if (diagnostics.Count > 0)
                    {
                        Msg("    diagnostics = " + SupportClass.CollectionsHelper.CollectionToString(diagnostics));
                    }

                    int docStoreOffset = info.GetDocStoreOffset();
                    if (docStoreOffset != -1)
                    {
                        Msg("    docStoreOffset=" + docStoreOffset);
                        segInfoStat.docStoreOffset = docStoreOffset;
                        Msg("    docStoreSegment=" + info.GetDocStoreSegment());
                        segInfoStat.docStoreSegment = info.GetDocStoreSegment();
                        Msg("    docStoreIsCompoundFile=" + info.GetDocStoreIsCompoundFile());
                        segInfoStat.docStoreCompoundFile = info.GetDocStoreIsCompoundFile();
                    }
                    System.String delFileName = info.GetDelFileName();
                    if (delFileName == null)
                    {
                        Msg("    no deletions");
                        segInfoStat.hasDeletions = false;
                    }
                    else
                    {
                        Msg("    has deletions [delFileName=" + delFileName + "]");
                        segInfoStat.hasDeletions      = true;
                        segInfoStat.deletionsFileName = delFileName;
                    }
                    if (infoStream != null)
                    {
                        infoStream.Write("    test: open reader.........");
                    }
                    reader = SegmentReader.Get(info);

                    segInfoStat.openReaderPassed = true;

                    int numDocs = reader.NumDocs();
                    toLoseDocCount = numDocs;
                    if (reader.HasDeletions())
                    {
                        if (reader.deletedDocs.Count() != info.GetDelCount())
                        {
                            throw new System.SystemException("delete count mismatch: info=" + info.GetDelCount() + " vs deletedDocs.count()=" + reader.deletedDocs.Count());
                        }
                        if (reader.deletedDocs.Count() > reader.MaxDoc())
                        {
                            throw new System.SystemException("too many deleted docs: maxDoc()=" + reader.MaxDoc() + " vs deletedDocs.count()=" + reader.deletedDocs.Count());
                        }
                        if (info.docCount - numDocs != info.GetDelCount())
                        {
                            throw new System.SystemException("delete count mismatch: info=" + info.GetDelCount() + " vs reader=" + (info.docCount - numDocs));
                        }
                        segInfoStat.numDeleted = info.docCount - numDocs;
                        Msg("OK [" + (segInfoStat.numDeleted) + " deleted docs]");
                    }
                    else
                    {
                        if (info.GetDelCount() != 0)
                        {
                            throw new System.SystemException("delete count mismatch: info=" + info.GetDelCount() + " vs reader=" + (info.docCount - numDocs));
                        }
                        Msg("OK");
                    }
                    if (reader.MaxDoc() != info.docCount)
                    {
                        throw new System.SystemException("SegmentReader.maxDoc() " + reader.MaxDoc() + " != SegmentInfos.docCount " + info.docCount);
                    }

                    // Test getFieldNames()
                    if (infoStream != null)
                    {
                        infoStream.Write("    test: fields..............");
                    }
                    System.Collections.Generic.ICollection <string> fieldNames = reader.GetFieldNames(IndexReader.FieldOption.ALL);
                    Msg("OK [" + fieldNames.Count + " fields]");
                    segInfoStat.numFields = fieldNames.Count;

                    // Test Field Norms
                    segInfoStat.fieldNormStatus = TestFieldNorms(fieldNames, reader);

                    // Test the Term Index
                    segInfoStat.termIndexStatus = TestTermIndex(info, reader);

                    // Test Stored Fields
                    segInfoStat.storedFieldStatus = TestStoredFields(info, reader, nf);

                    // Test Term Vectors
                    segInfoStat.termVectorStatus = TestTermVectors(info, reader, nf);

                    // Rethrow the first exception we encountered
                    //  This will cause stats for failed segments to be incremented properly
                    if (segInfoStat.fieldNormStatus.error != null)
                    {
                        throw new System.SystemException("Field Norm test failed");
                    }
                    else if (segInfoStat.termIndexStatus.error != null)
                    {
                        throw new System.SystemException("Term Index test failed");
                    }
                    else if (segInfoStat.storedFieldStatus.error != null)
                    {
                        throw new System.SystemException("Stored Field test failed");
                    }
                    else if (segInfoStat.termVectorStatus.error != null)
                    {
                        throw new System.SystemException("Term Vector test failed");
                    }

                    Msg("");
                }
                catch (System.Exception t)
                {
                    Msg("FAILED");
                    System.String comment;
                    comment = "fixIndex() would remove reference to this segment";
                    Msg("    WARNING: " + comment + "; full exception:");
                    if (infoStream != null)
                    {
                        infoStream.WriteLine(t.StackTrace);
                    }
                    Msg("");
                    result.totLoseDocCount += toLoseDocCount;
                    result.numBadSegments++;
                    continue;
                }
                finally
                {
                    if (reader != null)
                    {
                        reader.Close();
                    }
                }

                // Keeper
                result.newSegments.Add(info.Clone());
            }

            if (0 == result.numBadSegments)
            {
                result.clean = true;
                Msg("No problems were detected with this index.\n");
            }
            else
            {
                Msg("WARNING: " + result.numBadSegments + " broken segments (containing " + result.totLoseDocCount + " documents) detected");
            }

            return(result);
        }
Example #31
0
        private void openRecord(T_SQLiteTable tTable, int rowId)
        {
            object rRecord             = null;
            int    iFirstFreeFormIndex = -1;

            // Searching for free/opened form
            for (int iForm = 0; iForm < arrRecordForms.Length; iForm++)
            {
                if (arrRecordForms[iForm] == null)
                {
                    if (iFirstFreeFormIndex < 0)
                    {
                        iFirstFreeFormIndex = iForm;
                    }
                    continue;
                }

                if (arrRecordForms[iForm].Tag.ToString() == tTable.Name + "." + rowId.ToString())
                {
                    arrRecordForms[iForm].Show();
                    arrRecordForms[iForm].Focus();
                    return;
                }
            }
            if (iFirstFreeFormIndex < 0)
            {
                return;
            }

            System.Collections.IList lstResult = null;
            if (rowId < 0)
            {
                MethodInfo newRowMethod = typeof(SQLite806xDB).GetMethod("newRow");
                if (newRowMethod == null)
                {
                    return;
                }

                MethodInfo newRowTypeMethod = newRowMethod.MakeGenericMethod(tTable.Type);
                lstResult = new List <object>()
                {
                    newRowTypeMethod.Invoke(sqlDB806x, null)
                };
            }
            else
            {
                MethodInfo readMethod = null;
                foreach (MethodInfo mInfo in typeof(SQLite806xDB).GetMethods())
                {
                    if (mInfo.Name != "Read")
                    {
                        continue;
                    }
                    if (mInfo.GetParameters().Length == 0)
                    {
                        continue;
                    }
                    readMethod = mInfo;
                    break;
                }
                if (readMethod == null)
                {
                    return;
                }

                MethodInfo readTypeMethod = readMethod.MakeGenericMethod(tTable.Type);
                lstResult = (System.Collections.IList)readTypeMethod.Invoke(sqlDB806x, new object[] { rowId, new List <string>()
                                                                                                      {
                                                                                                      }, string.Empty, string.Empty });
            }

            if (lstResult.Count != 1)
            {
                return;
            }

            rRecord   = lstResult[0];
            lstResult = null;

            arrRecordForms[iFirstFreeFormIndex]                = new SQLite806xRecordForm(ref sqlDB806x, ref tTable, ref rRecord);
            arrRecordForms[iFirstFreeFormIndex].FormClosed    += new FormClosedEventHandler(recordForm_FormClosed);
            arrRecordForms[iFirstFreeFormIndex].RecordUpdated += new EventHandler(recordForm_RecordUpdated);
            arrRecordForms[iFirstFreeFormIndex].RecordRemoved += new EventHandler(recordForm_RecordRemoved);
            arrRecordForms[iFirstFreeFormIndex].Show();
            arrRecordForms[iFirstFreeFormIndex].Focus();
        }
Example #32
0
        /// <summary>
        /// Sets up the data Vectors to display the location collection data in the GUI.
        /// </summary>
        private void setupData()
        {
            int?div = null;

            int[]            years        = null;
            int              yearArrayLen = 0;
            int              nculoc       = _data.size();
            int              nParts       = 0;
            int              nIdTypes     = 0;
            StateCU_Location culoc        = null;
            string           colType      = null;
            string           id           = null;
            string           partType     = null;

            System.Collections.IList ids     = null;
            System.Collections.IList idTypes = null;
            string idType = null;

            __data = new System.Collections.IList[__COLUMNS];
            for (int i = 0; i < __COLUMNS; i++)
            {
                __data[i] = new List <object>();
            }

            int rows = 0;

            for (int i = 0; i < nculoc; i++)
            {
                culoc = (StateCU_Location)_data.get(i);
                id    = culoc.getID();
                div   = new int?(culoc.getCollectionDiv());

                years    = culoc.getCollectionYears();
                colType  = culoc.getCollectionType();
                partType = culoc.getCollectionPartType();

                if (years == null)
                {
                    yearArrayLen = 1;             // Cause the loop below to go through once
                }
                else
                {
                    yearArrayLen = years.Length;
                }

                for (int j = 0; j < yearArrayLen; j++)
                {
                    // Part IDs for the year
                    if ((years == null) || (years.Length == 0))
                    {
                        ids = culoc.getCollectionPartIDsForYear(0);
                    }
                    else
                    {
                        ids = culoc.getCollectionPartIDsForYear(years[j]);
                    }
                    // Part ID types for the year.
                    idTypes = culoc.getCollectionPartIDTypes();
                    if (ids == null)
                    {
                        nParts = 0;
                    }
                    else
                    {
                        nParts = ids.Count;
                    }
                    if (idTypes == null)
                    {
                        nIdTypes = 0;
                    }
                    else
                    {
                        nIdTypes = idTypes.Count;
                    }

                    for (int k = 0; k < nParts; k++)
                    {
                        __data[__COL_ID].Add(id);
                        __data[__COL_DIV].Add(div);
                        __data[__COL_YEAR].Add(new int?(years[j]));
                        __data[__COL_COL_TYPE].Add(colType);
                        __data[__COL_PART_TYPE].Add(partType);
                        __data[__COL_PART_ID].Add(ids[k]);
                        idType = "";
                        if (nIdTypes != 0)
                        {
                            idType = (string)idTypes[k];                     // Should align with ids.get(k)
                        }
                        __data[__COL_PART_ID_TYPE].Add(idType);
                        rows++;
                    }
                }
            }
            _rows = rows;
        }
Example #33
0
 /// <summary> Builds a Set from an array of stop words,
 /// appropriate for passing into the StopFilter constructor.
 /// This permits this stopWords construction to be cached once when
 /// an Analyzer is constructed.
 ///
 /// </summary>
 /// <seealso cref="MakeStopSet(java.lang.String[], boolean)"> passing false to ignoreCase
 /// </seealso>
 public static System.Collections.Hashtable MakeStopSet(System.Collections.IList stopWords)
 {
     return(MakeStopSet(stopWords, false));
 }
Example #34
0
 public virtual void AddLinkedForms(System.Collections.IList linkedForms)
 {
 }
        public SimpleCycleBasis(System.Collections.IList cycles, System.Collections.IList edgeList, UndirectedGraph graph)
        {
            this.edgeList = edgeList;
            this.cycles_Renamed_Field = cycles;
            this.graph = graph;

            edgeIndexMap = createEdgeIndexMap(edgeList);
        }
 public static System.Collections.IList ReadOnly(System.Collections.IList list)
 {
     return(default(System.Collections.IList));
 }
Example #37
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="dataSource"></param>
        /// <param name="item"></param>
        /// <param name="parent"></param>
        /// <param name="level"></param>
        /// <param name="isCascade"></param>
        /// <returns></returns>
        TreeViewItemModel <T> digui <T>(IEnumerable <T> dataSource, T item, TreeViewItemModel <T> parent, System.Collections.IList flatList, int level, bool isCascade)
        {
            dynamic dItem = item;

            TreeViewItemModel <T> toAdd = new TreeViewItemModel <T>(item);

            toAdd.Level      = level;
            toAdd.Id         = dItem.Id.ToString();
            toAdd.IsCascade  = isCascade;
            toAdd.IsChecked  = false;
            toAdd.IsExpanded = this.ExpandedLevel >= level;
            toAdd.Children   = null;
            toAdd.Seq        = mSeq++;

            if (level == 1)
            {
                toAdd.Parent   = null;
                toAdd.ParentId = null;
            }
            else
            {
                toAdd.Parent   = parent;
                toAdd.ParentId = parent.Id.ToString();
            }

            toAdd.PropertyChanged += TreeViewItemModel_PropertyChanged;

            var children = dataSource.Where
                           (
                i => i.GetType().GetProperty("ParentId").GetValue(i, null) != null &&
                i.GetType().GetProperty("ParentId").GetValue(i, null).ToString() == dItem.Id.ToString()
                           );

            toAdd.IsBranch = false;
            foreach (var childItem in children)
            {
                if (toAdd.IsBranch == false)
                {
                    toAdd.Children = new System.Collections.ObjectModel.ObservableCollection <TreeViewItemModel <T> >();
                    toAdd.IsBranch = true;
                }

                var child = digui
                            (
                    dataSource: dataSource,
                    item: childItem,
                    parent: toAdd,
                    flatList: flatList,
                    level: level + 1,
                    isCascade: isCascade
                            );

                toAdd.Children.Add(child);
                flatList.Add(child);
            }

            return(toAdd);
        }
Example #38
0
 public NotifyCollectionChangedEventArgs(System.Collections.Specialized.NotifyCollectionChangedAction action, System.Collections.IList newItems, System.Collections.IList oldItems, int startingIndex)
 {
 }
Example #39
0
 public FindTreeWizardVisitor( IList nodes )
 {
     _nodes = nodes;
 }
Example #40
0
 /// <summary> Contructs a new Polymer to store the Monomers.</summary>
 public PDBPolymer()
     : base()
 {
     sequentialListOfMonomers = new System.Collections.ArrayList();
     secundairyStructures = new System.Collections.ArrayList();
 }
Example #41
0
 protected int[] ToArray(IList a)
 {
     int[] x = new int[a.Count];
     a.CopyTo(x, 0);
     return x;
 }
Example #42
0
		/// <summary>
		/// Add t as child of this node.
		/// </summary>
		/// <remarks>
		/// Warning: if t has no children, but child does and child isNil then 
		/// this routine moves children to t via t.children = child.children; 
		/// i.e., without copying the array.
		/// </remarks>
		/// <param name="t"></param>
		public virtual void AddChild(ITree t)
		{
			if (t == null)
			{
				return;
			}

			BaseTree childTree = (BaseTree)t;
			if (childTree.IsNil)	// t is an empty node possibly with children
			{
				if ((children != null) && (children == childTree.children))
				{
					throw new InvalidOperationException("attempt to add child list to itself");
				}
				// just add all of childTree's children to this
				if (childTree.children != null)
				{
					if (children != null) // must copy, this has children already
					{
						int n = childTree.children.Count;
						for (int i = 0; i < n; i++)
						{
							ITree c = (ITree)childTree.Children[i];
							children.Add(c);
							// handle double-link stuff for each child of nil root
							c.Parent = this;
							c.ChildIndex = children.Count - 1;
						}
					}
					else
					{
						// no children for this but t has children; just set pointer
						// call general freshener routine
						children = childTree.children;
						FreshenParentAndChildIndexes();
					}
				}
			}
			else
			{
				// child is not nil (don't care about children)
				if (children == null)
				{
					children = CreateChildrenList(); // create children list on demand
				}
				children.Add(t);
				childTree.Parent = this;
				childTree.ChildIndex = children.Count - 1;
			}
		}
Example #43
0
        /// <summary>
        /// Returns a page of errors from the application memory in
        /// descending order of logged time.
        /// </summary>
        public override int GetErrors(int pageIndex, int pageSize, IList errorEntryList)
        {
            if (pageIndex < 0)
                throw new ArgumentOutOfRangeException("pageIndex", pageIndex, null);

            if (pageSize < 0)
                throw new ArgumentOutOfRangeException("pageSize", pageSize, null);

            //
            // To minimize the time for which we hold the lock, we'll first
            // grab just references to the entries we need to return. Later,
            // we'll make copies and return those to the caller. Since Error
            // is mutable, we don't want to return direct references to our
            // internal versions since someone could change their state.
            //

            ErrorLogEntry[] selectedEntries = null;
            int totalCount;

            Lock.AcquireReaderLock(Timeout.Infinite);

            try
            {
                if (_entries == null)
                    return 0;

                totalCount = _entries.Count;

                int startIndex = pageIndex * pageSize;
                int endIndex = Math.Min(startIndex + pageSize, totalCount);
                int count = Math.Max(0, endIndex - startIndex);

                if (count > 0)
                {
                    selectedEntries = new ErrorLogEntry[count];

                    int sourceIndex = endIndex;
                    int targetIndex = 0;

                    while (sourceIndex > startIndex)
                        selectedEntries[targetIndex++] = _entries[--sourceIndex];
                }
            }
            finally
            {
                Lock.ReleaseReaderLock();
            }

            if (errorEntryList != null && selectedEntries != null)
            {
                //
                // Return copies of fetched entries. If the Error class would
                // be immutable then this step wouldn't be necessary.
                //

                foreach (ErrorLogEntry entry in selectedEntries)
                {
                    Error error = (Error)((ICloneable)entry.Error).Clone();
                    errorEntryList.Add(new ErrorLogEntry(this, entry.Id, error));
                }
            }

            return totalCount;
        }
Example #44
0
		public virtual void SetChild(int i, ITree t)
		{
			if (t == null)
			{
				return;
			}
			if (t.IsNil)
			{
				throw new ArgumentException("Can't set single child to a list");
			}
			if (children == null)
			{
				children = CreateChildrenList();
			}
			children[i] = t;
			t.Parent = this;
			t.ChildIndex = i;
		}
Example #45
0
 /// <summary>
 /// Constructor.  This builds the Model for displaying location data </summary>
 /// <param name="data"> the data that will be displayed in the table. </param>
 public StateCU_Location_Collection_TableModel(System.Collections.IList data) : this(data, false)
 {
 }
Example #46
0
 public NotifyCollectionChangedEventArgs(System.Collections.Specialized.NotifyCollectionChangedAction action, System.Collections.IList changedItems, int index, int oldIndex)
 {
 }
        public SimpleCycleBasis(UndirectedGraph graph)
        {
            this.cycles_Renamed_Field = new System.Collections.ArrayList();
            this.edgeList = new System.Collections.ArrayList();
            this.graph = graph;

            createMinimumCycleBasis();
        }
Example #48
0
 public System.Collections.IList TransformList(System.Collections.IList collection)
 {
     return(collection);
 }
Example #49
0
		public virtual void SetListHistory(System.Collections.IList listHistory)
		{
			this.listHistory = listHistory;
		}
Example #50
0
 /// <summary>
 /// CreateInstance a stream, but feed off an existing list
 /// </summary>
 public RewriteRuleElementStream(ITreeAdaptor adaptor, string elementDescription, IList elements)
     : this(adaptor, elementDescription)
 {
     this.singleElement = null;
     this.elements      = elements;
 }
Example #51
0
 public FindTreeWizardContextVisitor( TreeWizard outer, TreePattern tpattern, IList subtrees )
 {
     _outer = outer;
     _tpattern = tpattern;
     _subtrees = subtrees;
 }
Example #52
0
        /// <summary>
        /// Returns a page of errors from the application memory in
        /// descending order of logged time.
        /// </summary>

        public override int GetErrors(int pageIndex, int pageSize, IList errorEntryList)
        {
            if (pageIndex < 0)
            {
                throw new ArgumentOutOfRangeException("pageIndex", pageIndex, null);
            }

            if (pageSize < 0)
            {
                throw new ArgumentOutOfRangeException("pageSize", pageSize, null);
            }

            //
            // To minimize the time for which we hold the lock, we'll first
            // grab just references to the entries we need to return. Later,
            // we'll make copies and return those to the caller. Since Error
            // is mutable, we don't want to return direct references to our
            // internal versions since someone could change their state.
            //

            ErrorLogEntry[] selectedEntries = null;
            int             totalCount;

            _lock.AcquireReaderLock(Timeout.Infinite);

            try
            {
                if (_entries == null)
                {
                    return(0);
                }

                totalCount = _entries.Count;

                int startIndex = pageIndex * pageSize;
                int endIndex   = Math.Min(startIndex + pageSize, totalCount);
                int count      = Math.Max(0, endIndex - startIndex);

                if (count > 0)
                {
                    selectedEntries = new ErrorLogEntry[count];

                    int sourceIndex = endIndex;
                    int targetIndex = 0;

                    while (sourceIndex > startIndex)
                    {
                        selectedEntries[targetIndex++] = _entries[--sourceIndex];
                    }
                }
            }
            finally
            {
                _lock.ReleaseReaderLock();
            }

            if (errorEntryList != null && selectedEntries != null)
            {
                //
                // Return copies of fetched entries. If the Error class would
                // be immutable then this step wouldn't be necessary.
                //

                foreach (ErrorLogEntry entry in selectedEntries)
                {
                    Error error = (Error)((ICloneable)entry.Error).Clone();
                    errorEntryList.Add(new ErrorLogEntry(this, entry.Id, error));
                }
            }

            return(totalCount);
        }
Example #53
0
 private void InitBlock(Lucene.Net.Index.IndexReader reader, SpanOrQuery enclosingInstance)
 {
     this.reader = reader;
     this.enclosingInstance = enclosingInstance;
     all = new System.Collections.ArrayList(Enclosing_Instance.clauses.Count);
     queue = new SpanQueue(enclosingInstance, Enclosing_Instance.clauses.Count);
     System.Collections.IEnumerator i = Enclosing_Instance.clauses.GetEnumerator();
     while (i.MoveNext())
     {
         // initialize all
         all.Add(((SpanQuery) i.Current).GetSpans(reader));
     }
 }
        /// <summary>
        /// Routine outputs name and value for all properties.
        /// </summary>
        /// <returns>String containing names and values.</returns>
        public string PropertiesToString()
        {
            StringBuilder data = new StringBuilder();
            Type          t    = this.GetType();

            PropertyInfo[] props = t.GetProperties(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy);

            data.Append("Class type:");
            data.Append(t.FullName);
            data.Append("\r\nClass properties for");
            data.Append(t.FullName);
            data.Append("\r\n");


            int inx    = 0;
            int maxInx = props.Length - 1;

            for (inx = 0; inx <= maxInx; inx++)
            {
                PropertyInfo prop = props[inx];
                object       val  = prop.GetValue(this, null);

                /*
                 * //****************************************************************************************
                 * //use the following code if you class has an indexer or is derived from an indexed class
                 * //****************************************************************************************
                 * object val = null;
                 * StringBuilder temp = new StringBuilder();
                 * if (prop.GetIndexParameters().Length == 0)
                 * {
                 *  val = prop.GetValue(this, null);
                 * }
                 * else if (prop.GetIndexParameters().Length == 1)
                 * {
                 *  temp.Length = 0;
                 *  for (int i = 0; i < this.Count; i++)
                 *  {
                 *      temp.Append("Index ");
                 *      temp.Append(i.ToString());
                 *      temp.Append(" = ");
                 *      temp.Append(val = prop.GetValue(this, new object[] { i }));
                 *      temp.Append("  ");
                 *  }
                 *  val = temp.ToString();
                 * }
                 * else
                 * {
                 *  //this is an indexed property
                 *  temp.Length = 0;
                 *  temp.Append("Num indexes for property: ");
                 *  temp.Append(prop.GetIndexParameters().Length.ToString());
                 *  temp.Append("  ");
                 *  val = temp.ToString();
                 * }
                 * //****************************************************************************************
                 * // end code for indexed property
                 * //****************************************************************************************
                 */

                if (prop.GetGetMethod(true) != null)
                {
                    data.Append(" <");
                    if (prop.GetGetMethod(true).IsPublic)
                    {
                        data.Append(" public ");
                    }
                    if (prop.GetGetMethod(true).IsPrivate)
                    {
                        data.Append(" private ");
                    }
                    if (!prop.GetGetMethod(true).IsPublic&& !prop.GetGetMethod(true).IsPrivate)
                    {
                        data.Append(" internal ");
                    }
                    if (prop.GetGetMethod(true).IsStatic)
                    {
                        data.Append(" static ");
                    }
                    data.Append(" get ");
                    data.Append("> ");
                }
                if (prop.GetSetMethod(true) != null)
                {
                    data.Append(" <");
                    if (prop.GetSetMethod(true).IsPublic)
                    {
                        data.Append(" public ");
                    }
                    if (prop.GetSetMethod(true).IsPrivate)
                    {
                        data.Append(" private ");
                    }
                    if (!prop.GetSetMethod(true).IsPublic&& !prop.GetSetMethod(true).IsPrivate)
                    {
                        data.Append(" internal ");
                    }
                    if (prop.GetSetMethod(true).IsStatic)
                    {
                        data.Append(" static ");
                    }
                    data.Append(" set ");
                    data.Append("> ");
                }
                data.Append(" ");
                data.Append(prop.PropertyType.FullName);
                data.Append(" ");

                data.Append(prop.Name);
                data.Append(": ");
                if (val != null)
                {
                    data.Append(val.ToString());
                }
                else
                {
                    data.Append("<null value>");
                }
                data.Append("  ");

                if (prop.PropertyType.IsArray)
                {
                    System.Collections.IList valueList = (System.Collections.IList)prop.GetValue(this, null);
                    for (int i = 0; i < valueList.Count; i++)
                    {
                        data.Append("Index ");
                        data.Append(i.ToString("#,##0"));
                        data.Append(": ");
                        data.Append(valueList[i].ToString());
                        data.Append("  ");
                    }
                }

                data.Append("\r\n");
            }

            return(data.ToString());
        }
Example #55
0
		/// <summary>
		/// Add all elements of kids list as children of this node
		/// </summary>
		/// <param name="kids"></param>
		public void AddChildren(IList kids) 
		{
			for (int i = 0; i < kids.Count; i++) 
			{
				ITree t = (ITree) kids[i];
				AddChild(t);
			}
		}
        /// <summary>
        /// Routine outputs name and value for all fields.
        /// </summary>
        /// <returns>Strings containing names and values.</returns>
        public string FieldsToString()
        {
            StringBuilder data = new StringBuilder();
            Type          t    = this.GetType();

            FieldInfo[] finfos = t.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.SetProperty | BindingFlags.GetProperty | BindingFlags.FlattenHierarchy);
            bool        typeHasFieldsToStringMethod = false;

            data.Append("\r\nClass fields for ");
            data.Append(t.FullName);
            data.Append("\r\n");

            int inx    = 0;
            int maxInx = finfos.Length - 1;

            for (inx = 0; inx <= maxInx; inx++)
            {
                FieldInfo fld = finfos[inx];
                object    val = fld.GetValue(this);
                if (fld.IsPublic)
                {
                    data.Append(" public ");
                }
                if (fld.IsPrivate)
                {
                    data.Append(" private ");
                }
                if (!fld.IsPublic && !fld.IsPrivate)
                {
                    data.Append(" internal ");
                }
                if (fld.IsStatic)
                {
                    data.Append(" static ");
                }
                data.Append(" ");
                data.Append(fld.FieldType.FullName);
                data.Append(" ");
                data.Append(fld.Name);
                data.Append(": ");
                typeHasFieldsToStringMethod = UseFieldsToString(fld.FieldType);
                if (val != null)
                {
                    if (typeHasFieldsToStringMethod)
                    {
                        data.Append(GetFieldValues(val));
                    }
                    else
                    {
                        data.Append(val.ToString());
                    }
                }
                else
                {
                    data.Append("<null value>");
                }
                data.Append("  ");

                if (fld.FieldType.IsArray)
                //if (fld.Name == "TestStringArray" || "_testStringArray")
                {
                    System.Collections.IList valueList = (System.Collections.IList)fld.GetValue(this);
                    for (int i = 0; i < valueList.Count; i++)
                    {
                        data.Append("Index ");
                        data.Append(i.ToString("#,##0"));
                        data.Append(": ");
                        data.Append(valueList[i].ToString());
                        data.Append("  ");
                    }
                }

                data.Append("\r\n");
            }

            return(data.ToString());
        }
Example #57
0
		public Frame()
		{
			//UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMap'"
			exports = new System.Collections.Hashtable();
			exportDefs = new System.Collections.ArrayList();
			doActions = new System.Collections.ArrayList();
			controlTags = new System.Collections.ArrayList();
			imports = new System.Collections.ArrayList();
			fonts = new System.Collections.ArrayList();
			
			doABCs = new System.Collections.ArrayList();
			symbolClass = new SymbolClass();
		}
 public void DataSourceRefresh(DevExpress.Mvvm.Xpf.DataSourceRefreshArgs args)
 {
     _Users = null;
     RaisePropertyChanged(nameof(Users));
 }
Example #59
0
		public DebugEncoder()
		{
			debugScripts = new System.Collections.ArrayList();
			//UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMap'"
			debugScriptsByName = new System.Collections.Hashtable();
			debugBreakpoints = new System.Collections.ArrayList();
			debugRegisters = new System.Collections.ArrayList();
		}
Example #60
0
        private void removeRecord(T_SQLiteTable tTable, int rowId)
        {
            // Searching for opened form
            for (int iForm = 0; iForm < arrRecordForms.Length; iForm++)
            {
                if (arrRecordForms[iForm] == null)
                {
                    continue;
                }

                if (arrRecordForms[iForm].Tag.ToString() == tTable.Name + "." + rowId.ToString())
                {
                    arrRecordForms[iForm].Close();
                    break;
                }
            }

            MethodInfo newRowMethod = typeof(SQLite806xDB).GetMethod("newRow");

            if (newRowMethod == null)
            {
                return;
            }

            MethodInfo    newRowTypeMethod = newRowMethod.MakeGenericMethod(tTable.Type);
            object        recordForRowId   = newRowTypeMethod.Invoke(sqlDB806x, null);
            F_SQLiteField recordRowIdField = (F_SQLiteField)recordForRowId.GetType().GetProperty("RowId").GetValue(recordForRowId, null);

            recordRowIdField.Value = rowId;
            recordRowIdField       = null;

            MethodInfo deleteMethod = null;

            foreach (MethodInfo mInfo in typeof(SQLite806xDB).GetMethods())
            {
                if (mInfo.Name != "Delete")
                {
                    continue;
                }
                if (mInfo.GetParameters().Length != 1)
                {
                    continue;
                }
                deleteMethod = mInfo;
                break;
            }
            if (deleteMethod == null)
            {
                return;
            }

            MethodInfo deleteTypeMethod = deleteMethod.MakeGenericMethod(tTable.Type);

            try
            {
                System.Collections.IList rList = (System.Collections.IList)Activator.CreateInstance(typeof(List <>).MakeGenericType(recordForRowId.GetType()));
                rList.Add(recordForRowId);

                bool bResult = (bool)deleteTypeMethod.Invoke(sqlDB806x, new object[] { rList });
                rList = null;

                if (!bResult)
                {
                    throw new Exception("Removal has failed.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            // Refresh
            if (tTable == (T_SQLiteTable)dbListView.Tag)
            {
                readTable(tTable);
            }
        }