Exemplo n.º 1
0
        public static ILabel MakeTreeChain(
            this IEnumerable <Node> nodes, ILabelFactory labelFactory, ControlFlowInstruction controlFlow)
        {
            var nodesList = nodes.Reverse().ToList();

            return(MakeTreeChain(nodesList.Skip(1).Reverse(), labelFactory, labelFactory.GetLabel(new Tree(nodesList.First(), controlFlow))));
        }
Exemplo n.º 2
0
 public ViewCategoryMenu
     (ILabelFactory labelFactory, IPostService postService, ICommandFactory commandFactory)
 {
     this.labelFactory   = labelFactory;
     this.postService    = postService;
     this.commandFactory = commandFactory;
 }
Exemplo n.º 3
0
 public MainMenu(ISession session, ILabelFactory labelFactory, ICommandFactory commandFactory)
 {
     this.session        = session;
     this.labelFactory   = labelFactory;
     this.commandFactory = commandFactory;
     this.Open();
 }
        public MenuController(ILabelFactory labelFactory, IForumViewEngine viewEngine)
        {
            this.viewEngine = viewEngine;

            this.CurrentMenu = new MainMenu(null, labelFactory, null);
            this.RenderCurrentView();
        }
Exemplo n.º 5
0
 public AddReplyMenu(ILabelFactory labelFactory, ITextAreaFactory textAreaFactory, IForumReader reader, ICommandFactory commandFactory, IPostService postService)
 {
     this.labelFactory    = labelFactory;
     this.textAreaFactory = textAreaFactory;
     this.reader          = reader;
     this.commandFactory  = commandFactory;
     this.postService     = postService;
 }
Exemplo n.º 6
0
        public LogInMenu(ILabelFactory labelFactory, IForumReader forumReader, ICommandFactory commandFactroy)
        {
            this.labelFactory   = labelFactory;
            this.forumReader    = forumReader;
            this.commandFactory = commandFactroy;

            this.Open();
        }
Exemplo n.º 7
0
        public LogInMenu(ILabelFactory labelFactory, ICommandFactory commandFactory, IForumReader reader)
        {
            this.labelFactory   = labelFactory;
            this.commandFactory = commandFactory;
            this.reader         = reader;

            Open();
        }
 public ViewPostMenu(IPostService postService, ILabelFactory labelFactory, ISession session, ICommandFactory commandFactory, IForumViewEngine viewEngine)
 {
     this.postService    = postService;
     this.labelFactory   = labelFactory;
     this.session        = session;
     this.commandFactory = commandFactory;
     this.viewEngine     = viewEngine;
 }
Exemplo n.º 9
0
        public SignUpMenu(ILabelFactory labelFactory, ICommandFactory commandFactory, IForumReader forumReader)
        {
            this.labelFactory   = labelFactory;
            this.forumReader    = forumReader;
            this.commandFactory = commandFactory;

            Open();
        }
        public CategoriesMenu(ILabelFactory labelFactory, IPostService postService, ICommandFactory commandFactory)
        {
            this.labelFactory   = labelFactory;
            this.postService    = postService;
            this.commandFactory = commandFactory;

            this.Open();
        }
Exemplo n.º 11
0
        public SignUpMenu(ILabelFactory labelFactory, IForumReader reader, ICommandFactory commandFactory)
        {
            this.labelFactory   = labelFactory;
            this.commandFactory = commandFactory;
            this.reader         = reader;

            Open();
        }
Exemplo n.º 12
0
        public ViewCategoryMenu(ICommandFactory commandFactory, ILabelFactory labelFactory, IPostService postService)
        {
            this.commandFactory = commandFactory;
            this.labelFactory   = labelFactory;
            this.postService    = postService;

            this.SetId(1);
            this.Open();
        }
Exemplo n.º 13
0
        public ViewCategoryMenu(ILabelFactory labelFactory, IPostService postService, ICommandFactory commandFactory)
        {
            this.labelFactory   = labelFactory;
            this.postService    = postService;
            this.commandFactory = commandFactory;

            // TODO: Uncomment this
            // this.Open();
        }
Exemplo n.º 14
0
 public CallGenerator(
     ILabelFactory labelFactory,
     CallingSiblingFinder callingSiblingFinder,
     ReadWriteGenerator readWriteGenerator)
 {
     this.labelFactory         = labelFactory;
     this.callingSiblingFinder = callingSiblingFinder;
     this.readWriteGenerator   = readWriteGenerator;
 }
Exemplo n.º 15
0
        //TODO: Inject Dependencies
        public LogInMenu(ILabelFactory labelFactory, ICommandFactory commandFactory, ISession session, IUserService userService, IForumReader forumReader)
        {
            this.labelFactory   = labelFactory;
            this.commandFactory = commandFactory;
            this.session        = session;
            this.userService    = userService;
            this.forumReader    = forumReader;

            this.Open();
        }
 public AddReplyMenu(ILabelFactory labelFactory, ITextAreaFactory textAreaFactory,
                     IForumReader reader, ICommandFactory commandFactory, IPostService postServive, ISession session)
 {
     this.labelFactory    = labelFactory;
     this.textAreaFactory = textAreaFactory;
     this.reader          = reader;
     this.commandFactory  = commandFactory;
     this.postServive     = postServive;
     this.session         = session;
 }
        public AddPostMenu(ILabelFactory labelFactory, ITextAreaFactory textAreaFactory, IForumReader reader, ICommandFactory commandFactory)
        {
            this.labelFactory    = labelFactory;
            this.textAreaFactory = textAreaFactory;
            this.reader          = reader;
            this.commandFactory  = commandFactory;

            this.InitializeTextArea();
            this.Open();
        }
Exemplo n.º 18
0
 public FunctionBodyGenerator(
     ILabelFactory labelFactory,
     ReadWriteGenerator readWriteGenerator,
     PrologueEpilogueGenerator prologueEpilogueGenerator,
     CallGenerator callGenerator)
 {
     this.labelFactory              = labelFactory;
     this.readWriteGenerator        = readWriteGenerator;
     this.prologueEpilogueGenerator = prologueEpilogueGenerator;
     this.callGenerator             = callGenerator;
 }
Exemplo n.º 19
0
        public ViewPostMenu(IPostService postService, ILabelFactory labelFactory, ISession session, ICommandFactory commandFactory, IForumViewEngine forumViewEngine)
        {
            this.postService    = postService;
            this.labelFactory   = labelFactory;
            this.session        = session;
            this.commandFactory = commandFactory;
            this.viewEngine     = forumViewEngine;

            // TODO: uncomment if its still not working
            // this.Open();
        }
Exemplo n.º 20
0
 public static ILabel MakeTreeChain(this IEnumerable <Node> nodes, ILabelFactory labelFactory, ILabel after)
 {
     return(nodes
            .Reverse()
            .Aggregate(after, (next, node) =>
     {
         var controlFlow = new UnconditionalJump(next);
         var tree = new Tree(node, controlFlow);
         return labelFactory.GetLabel(tree);
     }));
 }
Exemplo n.º 21
0
        internal static ILabel ConcatTrees(this IEnumerable <Node> trees, ILabelFactory labelFactory, ControlFlowInstruction next)
        {
            var treesReversed = trees.Reverse().ToList();
            var resultTree    = treesReversed
                                .Skip(1)
                                .Aggregate(
                new Tree(treesReversed.First(), next),
                (tree, node) => new Tree(node, new UnconditionalJump(labelFactory.GetLabel(tree))));

            return(labelFactory.GetLabel(resultTree));
        }
Exemplo n.º 22
0
 public ViewPostMenu(ILabelFactory labelFactory, ISession session,
                     IForumViewEngine forumViewEngine, IPostViewModel postViewModel,
                     ICommandFactory commandFactory, IPostService postService)
 {
     this.labelFactory   = labelFactory;
     this.session        = session;
     this.viewEngine     = forumViewEngine;
     this.post           = postViewModel;
     this.commandFactory = commandFactory;
     this.postService    = postService;
 }
        // private IUserService userService;

        public SignUpMenu(ILabelFactory labelFactory, ICommandFactory commandFactory,
                          ISession session, IForumReader forumReader)// IUserService userService)

        {
            this.labelFactory   = labelFactory;
            this.commandFactory = commandFactory;
            this.session        = session;
            this.forumReader    = forumReader;
            // this.userService = userService;

            Open();
        }
Exemplo n.º 24
0
 public PrologueEpilogueGenerator(
     ILabelFactory labelFactory,
     CallGenerator callGenerator,
     ReadWriteGenerator readWriteGenerator)
 {
     this.labelFactory       = labelFactory;
     this.readWriteGenerator = readWriteGenerator;
     this.callGenerator      = callGenerator;
     // RBP is handled separately, since it has a set place on the stack frame
     this.calleeSavedMapping = HardwareRegisterUtils.CalleeSavedRegisters
                               .Where(reg => reg != HardwareRegister.RBP)
                               .ToDictionary(register => register, register => new VirtualRegister());
 }
Exemplo n.º 25
0
 public GenerateProcess(
     ILabelFactory labelFactory,
     ReadWriteGenerator readWriteGenerator,
     PrologueEpilogueGenerator prologueEpilogueGenerator,
     CallGenerator callGenerator,
     Function.Function function)
 {
     this.labelFactory              = labelFactory;
     this.readWriteGenerator        = readWriteGenerator;
     this.prologueEpilogueGenerator = prologueEpilogueGenerator;
     this.callGenerator             = callGenerator;
     this.function = function;
 }
Exemplo n.º 26
0
 public FunctionToAsmGenerator(
     ILivenessAnalyzer livenessAnalyzer,
     IRegisterAllocator registerAllocator,
     IInstructionSelector instructionSelector,
     ICfgLinearizer cfgLinearizer,
     ILabelFactory labelFactory,
     ReadWriteGenerator readWriteGenerator)
 {
     this.livenessAnalyzer    = livenessAnalyzer;
     this.registerAllocator   = registerAllocator;
     this.instructionSelector = instructionSelector;
     this.cfgLinearizer       = cfgLinearizer;
     this.labelFactory        = labelFactory;
     this.readWriteGenerator  = readWriteGenerator;
 }
Exemplo n.º 27
0
        public MenuController(
            ILabelFactory labelFactory,
            IServiceProvider serviceProvider,
            IForumViewEngine viewEngine,
            ISession session,
            ICommandFactory commandFactory)
        {
            this.serviceProvider = serviceProvider;
            this.viewEngine      = viewEngine;
            this.session         = session;
            this.commandFactory  = commandFactory;
            this.labelFactory    = labelFactory;

            //this.CurrentMenu = new MainMenu(session, labelFactory, commandFactory);

            this.InitializeSession();

            //this.RenderCurrentView();
        }
Exemplo n.º 28
0
        /// <summary>Turns a sentence into a flat phrasal tree.</summary>
        /// <remarks>
        /// Turns a sentence into a flat phrasal tree.
        /// The structure is S -&gt; tag*.  And then each tag goes to a word.
        /// The tag is either found from the label or made "WD".
        /// The tag and phrasal node have a StringLabel.
        /// </remarks>
        /// <param name="s">The Sentence to make the Tree from</param>
        /// <param name="lf">The LabelFactory with which to create the new Tree labels</param>
        /// <returns>The one phrasal level Tree</returns>
        public static Tree ToFlatTree <_T0>(IList <_T0> s, ILabelFactory lf)
            where _T0 : IHasWord
        {
            IList <Tree> daughters = new List <Tree>(s.Count);

            foreach (IHasWord word in s)
            {
                Tree wordNode = new LabeledScoredTreeNode(lf.NewLabel(word.Word()));
                if (word is TaggedWord)
                {
                    TaggedWord taggedWord = (TaggedWord)word;
                    wordNode = new LabeledScoredTreeNode(new StringLabel(taggedWord.Tag()), Java.Util.Collections.SingletonList(wordNode));
                }
                else
                {
                    wordNode = new LabeledScoredTreeNode(lf.NewLabel("WD"), Java.Util.Collections.SingletonList(wordNode));
                }
                daughters.Add(wordNode);
            }
            return(new LabeledScoredTreeNode(new StringLabel("S"), daughters));
        }
Exemplo n.º 29
0
 /// <summary>
 /// Return a <code>TreeFactory</code> that produces trees of type
 /// <code>TreeGraphNode</code>, with the <code>Label</code> made
 /// by the supplied <code>LabelFactory</code>.  The factory
 /// returned is a different one each time.
 /// </summary>
 /// <param name="lf">The <code>LabelFactory</code> to use</param>
 /// <returns>a factory to produce treegraphs</returns>
 public static ITreeFactory Factory(ILabelFactory lf)
 {
     return new TreeGraphNodeFactory(lf);
 }
 /// <summary>
 /// Create a new TreeReaderFactory with CoreLabel labels.
 /// </summary>
 public LabeledScoredTreeReaderFactory()
 {
     lf = CoreLabel.Factory();
     tm = new BobChrisTreeNormalizer();
 }
Exemplo n.º 31
0
        /// <summary>Add -TMP when not present within an NP</summary>
        /// <param name="tree">The tree to add temporal info to.</param>
        private void AddTMP9(Tree tree)
        {
            // do the head chain under it
            Tree ht = headFinder.DetermineHead(tree);

            // special fix for possessives! -- make noun before head
            if (ht.Value().Equals("POS"))
            {
                int j = tree.ObjectIndexOf(ht);
                if (j > 0)
                {
                    ht = tree.GetChild(j - 1);
                }
            }
            // Note: this next bit changes the tree label, rather
            // than creating a new tree node.  Beware!
            if (ht.IsPreTerminal() || ht.Value().StartsWith("NP") || ht.Value().StartsWith("PP") || ht.Value().StartsWith("ADVP"))
            {
                if (!TmpPattern.Matcher(ht.Value()).Matches())
                {
                    ILabelFactory lf = ht.LabelFactory();
                    // log.info("TMP: Changing " + ht.value() + " to " +
                    //                   ht.value() + "-TMP");
                    ht.SetLabel(lf.NewLabel(ht.Value() + "-TMP"));
                }
                if (ht.Value().StartsWith("NP") || ht.Value().StartsWith("PP") || ht.Value().StartsWith("ADVP"))
                {
                    AddTMP9(ht);
                }
            }
            // do the NPs under it (which may or may not be the head chain
            Tree[] kidlets = tree.Children();
            foreach (Tree kidlet in kidlets)
            {
                ht = kidlet;
                ILabelFactory lf;
                if (tree.IsPrePreTerminal() && !TmpPattern.Matcher(ht.Value()).Matches())
                {
                    // log.info("TMP: Changing " + ht.value() + " to " +
                    //                   ht.value() + "-TMP");
                    lf = ht.LabelFactory();
                    // Note: this next bit changes the tree label, rather
                    // than creating a new tree node.  Beware!
                    ht.SetLabel(lf.NewLabel(ht.Value() + "-TMP"));
                }
                else
                {
                    if (ht.Value().StartsWith("NP"))
                    {
                        // don't add -TMP twice!
                        if (!TmpPattern.Matcher(ht.Value()).Matches())
                        {
                            lf = ht.LabelFactory();
                            // log.info("TMP: Changing " + ht.value() + " to " +
                            //                   ht.value() + "-TMP");
                            // Note: this next bit changes the tree label, rather
                            // than creating a new tree node.  Beware!
                            ht.SetLabel(lf.NewLabel(ht.Value() + "-TMP"));
                        }
                        AddTMP9(ht);
                    }
                }
            }
        }
Exemplo n.º 32
0
 public Debinarizer(bool forceCNF, ILabelFactory lf)
 {
     this.forceCNF   = forceCNF;
     tf              = new LabeledScoredTreeFactory(lf);
     boundaryRemover = new BoundaryRemover();
 }
 public LabeledScoredTreeReaderFactory(ILabelFactory lf)
 {
     this.lf = lf;
     tm = new BobChrisTreeNormalizer();
 }
 public LabeledScoredTreeReaderFactory(ILabelFactory lf, TreeNormalizer tm)
 {
     this.lf = lf;
     this.tm = tm;
 }
Exemplo n.º 35
0
 public TreeGraphNodeFactory(ILabelFactory mlf)
 {
     this.mlf = mlf;
 }
Exemplo n.º 36
0
 /// <summary>
 /// Return a <code>TreeFactory</code> that produces trees of the
 /// <code>LabeledScoredTree{Node|Leaf}</code> type, with
 /// the <code>Label</code> made with the supplied <code>LabelFactory</code>.
 /// The factory returned is a different one each time
 /// </summary>
 /// <param name="lf">The LabelFactory to use</param>
 /// <returns>a factory to produce labeled, scored trees</returns>
 public static ITreeFactory Factory(ILabelFactory lf)
 {
     return new LabeledScoredTreeFactory(lf);
 }
 public LabeledScoredTreeReaderFactory(TreeNormalizer tm)
 {
     lf = CoreLabel.Factory();
     this.tm = tm;
 }
Exemplo n.º 38
0
 public ParseTreeFactory(ILabelFactory lf) : base(lf)
 {
 }