protected void Init(RelNode value) { var equal = value.Heading.IsEqual(Heading); var compat = equal || value.Heading.IsCompatible(Heading); if (!compat) { throw Error.Fatal($"headings are not compatible: <{value.Heading}> and <{Heading}>"); } var map = Heading.CreateMap(value.Heading); Value = Rel.Create(value.Select(t => RelStatic.CreateByMap <T>(t, map))); }
public RelVarST(RelValueST <T> tuples) { Value = Rel.Create(tuples); Heading = RelBaseST <T> .Heading; }
public RelVarST() { Value = Rel.Create(new T[0]); Heading = RelBaseST <T> .Heading; }
// remove tuples that satisfy predicate public void Delete(Func <T, bool> selfunc) { Value = Rel.Create(Value.Where(t => !selfunc(t))); }
// update tuples that satisfy predicate public void Update(Func <T, bool> selfunc, Func <T, T> upfunc) { Value = Rel.Create(Value.Select(t => selfunc(t) ? upfunc(t) : t)); }
// insert tuples, discard duplicates public void Insert(RelValueST <T> value) { Value = Rel.Create(RelOpsST.Union(Value, value)); }
// relational assignment public void Assign(RelValueST <T> value) { Value = Rel.Create(value); }