コード例 #1
0
        internal static ReductionAction <SYMBOL_ENUM, TREE_NODE> Create <SYMBOL_ENUM, TREE_NODE>(SingleState <SYMBOL_ENUM, TREE_NODE> state,
                                                                                                 CoverSets <SYMBOL_ENUM> coverSets,
                                                                                                 HorizonSets <SYMBOL_ENUM> horizonSets)
            where SYMBOL_ENUM : struct
            where TREE_NODE : class
        {
            SymbolChunkSet <SYMBOL_ENUM> cover   = coverSets[state.LhsSymbol];
            SymbolChunkSet <SYMBOL_ENUM> horizon = horizonSets[state.LhsSymbol];
            // if we have internal conflict between symbols, we cannot use horizon data (because we couldn't tell if we reached horizon)
            bool use_horizon = !horizon.IsEmpty && !cover.Overlaps(horizon);
            var  action      = new ReductionAction <SYMBOL_ENUM, TREE_NODE>(state.CreateCell(), use_horizon ? horizon : null,
                                                                            use_horizon ? new SymbolChunkSet <SYMBOL_ENUM>() : null);

            return(action);
        }
コード例 #2
0
 public void AddReduce(int sourceNodeId, SymbolChunk <SYMBOL_ENUM> inputChunk, SingleState <SYMBOL_ENUM, TREE_NODE> reductionItem)
 {
     setSingle(sourceNodeId, inputChunk, new ParseAction <SYMBOL_ENUM, TREE_NODE>(false, ReductionAction.Create(reductionItem.CreateCell())));
 }