public static AggregationTreeNode CreateBranch() { var tn = new AggregationTreeNode(); tn.Children = new List <AggregationTreeNode>(); return(tn); }
public static AggregationTreeNode CreateBranch(int dimmension, int level) { var tn = new AggregationTreeNode(); tn.Dimmension = dimmension; tn.Level = level; tn.Children = new List <AggregationTreeNode>(); return(tn); }
public AggregationTreeNode GenerateXAggregationTree(SortedDictionary <FieldList, int> dicX) { // start with leaf nodes AggregationTreeNode attSeed = AggregationTreeNodeFactory.CreateBranch(); attSeed.Level = typeWrapper.XType.MaxDim; var seedState = new State() { attUpper = attSeed, level = typeWrapper.XType.IndexMaxDim, dictionary = dicX }; GenerateAggregationTreeRecursive(seedState, false); return(attSeed); }
private AggregationTreeNode GenerateAggregationTreeRecursive(State state, bool isYFork) { IEnumerable <AggregationTreeNode> q; q = GenerateLevelTree(state.level, state.dictionary); if (isYFork) { if (typeWrapper.YType.IndexMaxDim != state.level) { q = FilterOutExtra(state.attUpper, state.previous, q); } } else { if (typeWrapper.XType.IndexMaxDim != state.level) { q = FilterOutExtra(state.attUpper, state.previous, q); } } AggregationTreeNode previousAggregationTreeNode = state.previous; // establish starting point from upper level foreach (var aggregationTreeNode in q) { state.attUpper.Children.Add(aggregationTreeNode); if (state.level > 0) { var lowerState = new State() { attUpper = aggregationTreeNode, level = state.level - 1, dictionary = state.dictionary, previous = previousAggregationTreeNode }; GenerateAggregationTreeRecursive(lowerState, isYFork); } previousAggregationTreeNode = aggregationTreeNode; // establish starting point from the sibling } return(state.attUpper); }
private TransmissionState DrillDownBranchRecursive(AggregationTreeNode tnUpper, MatrixManipulator manipulator) { var stateUpperDesignated = new TransmissionState(); if (!tnUpper.IsLeaf) { foreach (var tn in tnUpper.Children) { var aggState = DrillDownBranchRecursive(tn, manipulator); var aggValue = manipulator.AggregationFunctionVector[tn.Level](aggState.LevelValues); stateUpperDesignated.LevelValues.Add(aggValue); // pass to upper stateUpperDesignated.TreeNodes.Add(tn); manipulator.setValue(tn.Dimmension, aggValue); } } else { stateUpperDesignated.LevelValues.Add(manipulator.getValue(tnUpper.Dimmension)); } return(stateUpperDesignated); }
private static IEnumerable <AggregationTreeNode> FilterOutExtra(AggregationTreeNode upperNode, AggregationTreeNode previousNode, IEnumerable <AggregationTreeNode> q) { q = q.Where(t1 => t1.Dimmension < upperNode.Dimmension) .Where(t1 => t1.Dimmension > (previousNode?.Dimmension ?? 0)); return(q); }
public DimmensionAggregator(AggregationTreeNode seedAggregationTree) { _seedAggregationTree = seedAggregationTree; }