public ValueTreeRow(ValueTree owner, ValueTreeRow parent, int level) { _owner = owner; _parent = parent; _level = level; _rows = new ValueTreeRowCollection(owner, this, level + 1); }
public ValueTreeRow Insert(int index) { ValueTreeRow row = new ValueTreeRow(Owner(), _parent, _level); _rows.Insert(index, row); return(row); }
public ValueTreeRow Add() { ValueTreeRow row = new ValueTreeRow(Owner(), _parent, _level); _rows.Add(row); return(row); }
internal void CopyFrom(ValueTreeRowCollection src) { _rows.Clear(); ValueTreeColumnCollection Columns = Owner().Columns; foreach (ValueTreeRow row in src._rows) { ValueTreeRow new_row = Add(); foreach (ValueTreeColumn Column in Columns) { new_row.Set(Column, row.Get(ValueFactory.Create(Column.Name))); } new_row.Rows.CopyFrom(row.Rows); } }
private bool CheckFilterCriteria(ValueTreeRow Row, StructureImpl Filter) { foreach (KeyAndValueImpl kv in Filter) { ValueTreeColumn Column = Columns.FindColumnByName(kv.Key.AsString()); if (Column == null) { throw RuntimeException.PropNotFoundException(kv.Key.AsString()); } IValue current = Row.Get(Column); if (!current.Equals(kv.Value)) { return(false); } } return(true); }
public void Move(IValue Row, int Offset) { Row = Row.GetRawValue(); int index_source; if (Row is ValueTreeRow) { index_source = _rows.IndexOf(Row as ValueTreeRow); } else if (Row.DataType == Machine.DataType.Number) { index_source = decimal.ToInt32(Row.AsNumber()); } else { throw RuntimeException.InvalidArgumentType(); } if (index_source < 0 || index_source >= _rows.Count()) { throw RuntimeException.InvalidArgumentValue(); } int index_dest = (index_source + Offset) % _rows.Count(); while (index_dest < 0) { index_dest += _rows.Count(); } ValueTreeRow tmp = _rows[index_source]; if (index_source < index_dest) { _rows.Insert(index_dest + 1, tmp); _rows.RemoveAt(index_source); } else { _rows.RemoveAt(index_source); _rows.Insert(index_dest, tmp); } }
public ValueTreeRowCollection(ValueTree owner, ValueTreeRow parent, int level) { _owner = owner; _parent = parent; _level = level; }