//constructor public KeyMonoid(Key <T, V> KeyObj) { this.KeyObj = KeyObj; this.theMonoid = new Monoid <V>(KeyObj.NoKey, new Monoid <V> .monOp(aNextKeyOp)); }
public Digit(Monoid <V> aMonoid, U u1, U u2) { theMonoid = aMonoid; digNodes.Add(u1); digNodes.Add(u2); }
ListOfNodes(Monoid <M> aMonoid, List <T> tList) { List <Node <T, M> > resultNodeList = new List <Node <T, M> >(); Node <T, M> nextNode = null; int tCount = tList.Count; if (tCount < 4) { nextNode = new Node <T, M>(aMonoid, tList); resultNodeList.Add(nextNode); return(resultNodeList); } //else List <T> nextTList = new List <T>(tList.GetRange(0, 3)); nextNode = new Node <T, M>(aMonoid, nextTList); resultNodeList.Add(nextNode); resultNodeList.AddRange (ListOfNodes(aMonoid, tList.GetRange(3, tCount - 3) ) ); return(resultNodeList); }
public List <U> theNodes = new List <U>(); // 2 or 3 elements in this list public Node(Monoid <V> aMonoid, U u1, U u2) { theMonoid = aMonoid; theNodes.Add(u1); theNodes.Add(u2); PreCalcMeasure = theMonoid.Operation(u1.Measure(), u2.Measure()); }
public Node(Monoid <V> aMonoid, List <U> listU) { theMonoid = aMonoid; theNodes = listU; PreCalcMeasure = theMonoid.Zero; foreach (U u in theNodes) { PreCalcMeasure = theMonoid.Operation(PreCalcMeasure, u.Measure()); } }
public static FTreeM <T, M> FromSequence(IEnumerable <T> sequence, Monoid <M> aMonoid) { IEnumerator <T> sequenceEnum = sequence.GetEnumerator(); FTreeM <T, M> ftResult = new EmptyFTreeM <T, M>(aMonoid); while (sequenceEnum.MoveNext()) { ftResult = ftResult.PushBack(sequenceEnum.Current); } return(ftResult); }
public Node(Monoid <V> aMonoid, U u1, U u2, U u3) { theMonoid = aMonoid; theNodes.Add(u1); theNodes.Add(u2); theNodes.Add(u3); PreCalcMeasure = theMonoid.Zero; foreach (U u in theNodes) { PreCalcMeasure = theMonoid.Operation(PreCalcMeasure, u.Measure()); } }
public static FTreeM <T, M> Create(List <T> frontList, //may be empty! FTreeM <Node <T, M>, M> innerFT, Digit <T, M> backDig ) { Monoid <M> theMonoid = backDig.theMonoid; if (frontList.Count > 0) { return(new DeepFTreeM <T, M> (theMonoid, new Digit <T, M>(theMonoid, frontList), innerFT, backDig )); } //else if (innerFT is EmptyFTreeM <Node <T, M>, M> ) { return(FromSequence(backDig.digNodes, theMonoid)); } //else we must create a new intermediate tree var innerLeft = innerFT.LeftView(); List <T> newlstFront = innerLeft.head.theNodes; DeepFTreeM <T, M> theNewDeepTree = new DeepFTreeM <T, M> (theMonoid, new Digit <T, M>(theMonoid, newlstFront), innerLeft.ftTail, backDig ); return(theNewDeepTree); }
public static FTreeM <T, M> CreateR(Digit <T, M> frontDig, FTreeM <Node <T, M>, M> innerFT, List <T> backList //may be empty! ) { Monoid <M> theMonoid = frontDig.theMonoid; if (backList.Count > 0) { return(new DeepFTreeM <T, M> (theMonoid, frontDig, innerFT, new Digit <T, M>(theMonoid, backList) )); } //else if (innerFT is EmptyFTreeM <Node <T, M>, M> ) { return(FromSequence(frontDig.digNodes, theMonoid)); } //else we must create a new intermediate tree var innerRight = innerFT.RightView(); List <T> newlstBack = innerRight.last.theNodes; DeepFTreeM <T, M> theNewDeepTree = new DeepFTreeM <T, M> (theMonoid, frontDig, innerRight.ftInit, new Digit <T, M>(theMonoid, newlstBack) ); return(theNewDeepTree); }
public DeepFTreeM(Monoid <M> aMonoid, Digit <T, M> frontDig, FTreeM <Node <T, M>, M> innerFT, Digit <T, M> backDig) { if (frontDig.digNodes.Count > 0) { theMonoid = aMonoid; this.frontDig = frontDig; this.innerFT = innerFT; this.backDig = backDig; PreCalcMeasure = theMonoid.Zero; PreCalcMeasure = theMonoid.Operation(PreCalcMeasure, frontDig.Measure()); PreCalcMeasure = theMonoid.Operation(PreCalcMeasure, innerFT.Measure()); PreCalcMeasure = theMonoid.Operation(PreCalcMeasure, backDig.Measure()); } else { throw new Exception("The DeepFTree() constructor is passed an empty frontDig !"); } }
public Digit(Monoid <V> aMonoid, List <U> listU) { theMonoid = aMonoid; digNodes = listU; }
public SingleFTreeM(Monoid <M> aMonoid, T t) { theMonoid = aMonoid; theSingle = t; }
public EmptyFTreeM(Monoid <M> aMonoid) { theMonoid = aMonoid; }