protected ColumnMapping Column <T>(Expression <Func <TDocument, T> > property) { var column = new ColumnMapping(GetPropertyInfo(property)); IndexedColumns.Add(column); return(column); }
protected ColumnMapping VirtualColumn <TProperty>(string name, DbType databaseType, Func <TDocument, TProperty> reader, Action <TDocument, TProperty> writer = null, int?maxLength = null, bool nullable = false) { var column = new ColumnMapping(name, databaseType, new DelegateReaderWriter <TDocument, TProperty>(reader, writer)); IndexedColumns.Add(column); if (maxLength != null) { column.MaxLength = maxLength.Value; } column.IsNullable = nullable; return(column); }
public IndexedColumn AddColumn(IndexedColumn column) { if (column == null) { throw new ArgumentNullException(nameof(column)); } if (IndexedColumns == null) { IndexedColumns = new List <IndexedColumn>(); } column.OrdinalPosition = IndexedColumns.Count + 1; IndexedColumns.Add(column); return(column); }
private static bool IsIndexedColumn(IColumnDescriptor column) { return(IndexedColumns.Contains(column)); }
private static bool IsIndexedColumn(ILogFileColumn column) { return(IndexedColumns.Contains(column)); }
public static List <Maintainance> Fixation(List <Maintainance> schedules) { //List<ColumnRank> cImproved = null; //while (cImproved == null || cImproved.Count > 0) //{ // cImproved = GetRankedColumns(schedules).Where(f => f.MustImprove).ToList(); // if (cImproved.Count != 0) // { // for (int i = 0; i < schedules.Count; i++) // { // List<ColumnRank> iColRank = GetRankedColumns(schedules); // schedules[i] = SwapSlot(schedules[i], cImproved, iColRank); // } // } //} List <KeyValuePair <int, Air> > cLog = new List <KeyValuePair <int, Air> >(); int count = 0; foreach (Maintainance i in schedules) { for (int j = 0; j < i.Slot.Length; j++) { if (IndexedColumns.Contains(j) && i.Slot[j] != null) { IndexedColumns.Remove(j); } else { if (i.Slot[j] != null) { cLog.Add(new KeyValuePair <int, Air>( count, Program.Clone(i.Slot[j]) )); i.Slot[j] = null; } } } count++; } while (IndexedColumns.Count != 0 || cLog.Count != 0) { if (IndexedColumns.Count == 0) { break; } int ran = IndexedColumns[0]; foreach (var i in cLog) { schedules[i.Key].Slot[ran] = i.Value; IndexedColumns.Remove(ran); break; } if (cLog.Count > 0) { cLog.RemoveAt(0); } } List <int> cRandom = new List <int>(); for (int i = 0; i < Program.MAX_AIR; i++) { cRandom.Add(i); } cRandom = new List <int>(RandomizeInt(cRandom.ToArray())); foreach (var i in schedules) { if (cRandom.Count != 0) { for (int j = 0; j < i.Slot.Length; j++) { Air jAir = i.Slot[j]; int jNewPosition = cRandom[0]; Air jNewAirPosition = i.Slot[jNewPosition]; if (jAir != null && j != jNewPosition && jNewAirPosition != null) { i.Slot[jNewPosition] = Program.Clone(jAir); i.Slot[j] = null; cRandom.Remove(jNewPosition); break; } else if (j == jNewPosition) { cRandom.Remove(j); break; } } } } return(schedules); }