Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the MembershipContainerPage class.
 /// </summary>
 public MembershipContainerPage()
 {
     ExternalContextId = LtiConstants.LisMembershipContainerContextId;
     Terms.Add("liss", "http://purl.imsglobal.org/vocab/lis/v2/status#");
     Terms.Add("lism", "http://purl.imsglobal.org/vocab/lis/v2/membership#");
     Type = LtiConstants.PageType;
 }
Exemple #2
0
        public void Parse(Tokenizer t)
        {
            if (t.CurrentToken == EToken.MINUS || t.CurrentToken == EToken.PLUS)
            {
                Operations.Add(t.CurrentToken == EToken.MINUS ? TermOperation.Negative : TermOperation.Positive);
                t.NextToken();
            }
            else
            {
                Operations.Add(TermOperation.None);
            }
            Term parent = new Term();

            Terms.Add(parent);
            parent.Parse(t);
            while (t.CurrentToken == EToken.MINUS || t.CurrentToken == EToken.PLUS)
            {
                Operations.Add(t.CurrentToken == EToken.MINUS ? TermOperation.Negative : TermOperation.Positive);
                t.NextToken();
                Term child = new Term();
                Terms.Add(child);
                child.Parse(t);
            }
            // optimization
            Terms.TrimExcess();
            Operations.TrimExcess();
        }
Exemple #3
0
        public async Task <IEnumerable <string> > GetCollegePaths(HtmlNode termNode, TMSContext context)
        {
            using (var client = new HttpClient())
            {
                Term term = context.Terms.FirstOrDefault(x => x.LookupLabel == termNode.InnerText.Replace(" ", ""));
                if (term == null)
                {
                    term = new Term()
                    {
                        TermName    = termNode.InnerText.Trim(),
                        LookupLabel = termNode.InnerText.Replace(" ", "")
                    };
                    Terms.Add(term);
                    LastTerm = term;
                }
                var termPath    = termNode.Attributes.First(x => x.Name == "href").Value.Replace("amp;", "");
                var termListing = await client.GetAsync(Constants.BASE_PATH + termPath);

                if (!termListing.IsSuccessStatusCode)
                {
                    throw new Exception("Failed to get College Paths (Step 2)");
                }
                var termContent = await termListing.Content.ReadAsStringAsync();

                var listingDocument = new HtmlDocument();
                listingDocument.LoadHtml(termContent);
                var collegeNodes = listingDocument.DocumentNode.SelectNodes(Constants.COLLEGE_PATHS);
                return(collegeNodes.Select(x => x.Attributes.First(x => x.Name == "href").Value.Replace("amp;", "")));
            }
        }
Exemple #4
0
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Terms.Clear();
                var items = await App.Database.GetTermsAsync();

                foreach (var item in items)
                {
                    Terms.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemple #5
0
        public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> suspensionState)
        {
            Set = null;

            if (suspensionState.ContainsKey(nameof(Set)))
            {
                Set = suspensionState[nameof(Set)] as Set;
            }
            if (parameter != null)
            {
                Set = parameter as Set;
            }

            if (_settingsService.AuthenticatedUser.Username == Set.CreatedBy)
            {
                Editable = true;
            }

            Title     = Set.Title;
            TermCount = Set.TermCount;
            CreatedBy = Set.CreatedBy;

            foreach (var term in Set.Terms)
            {
                var tvm = TermViewModel.Create(term);
                Terms.Add(tvm);
                AllTerms.Add(tvm);
            }

            await Task.CompletedTask;
        }
Exemple #6
0
 public void FromJson(JObject obj)
 {
     foreach (var property in obj)
     {
         if (property.Key == "@language")
         {
             Language = property.Value.Value <string>();
             continue;
         }
         if (property.Key == "@base")
         {
             Base = property.Value.Value <string>();
             continue;
         }
         if (property.Key == "@vocab")
         {
             Vocab = property.Value.Value <string>();
             continue;
         }
         if (property.Key == "@version")
         {
             Version = property.Value.Value <string>();
             continue;
         }
         Terms.Add(property.Key, TermDefinition.FromJson(property.Value));
     }
 }
 public void AddTerm(string key, string value)
 {
     if (!string.IsNullOrWhiteSpace(value))
     {
         Terms.Add(key, value);
     }
 }
        async Task LoadTerms()
        {
            IsBusy = true;
            try
            {
                var terms = await SqliteConn.Table <Term>().OrderBy(term => term.Start).ToListAsync();

                lock (termsLock)
                {
                    Terms.Clear();
                    foreach (var term in terms)
                    {
                        Terms.Add(term);
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.Write(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemple #9
0
 public void LisTerms()
 {
     for (int i = 0; i < Quiz.GetNumberOfQuestions(); i++)
     {
         Terms.Add(Quiz.GetTerm(i));
     }
 }
Exemple #10
0
        public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> suspensionState)
        {
            if (suspensionState.ContainsKey(nameof(NavigationParameter)))
            {
                NavigationParameter = suspensionState[nameof(NavigationParameter)] as MatchPageNavigationModel;

                foreach (var term in NavigationParameter.Terms)
                {
                    Terms.Add(term);
                }
            }

            if (parameter != null)
            {
                NavigationParameter = parameter as MatchPageNavigationModel;
                var observableCollection = NavigationParameter.Terms;
                foreach (var term in observableCollection)
                {
                    Terms.Add(term);
                }

                _gameSize = observableCollection.Count > 7 ? 7 : observableCollection.Count;
            }

            BuildGame();
            DispatcherTimerSetup();

            await Task.CompletedTask;
        }
        public AlphameticEquation(string input)
        {
            input = input.ToUpper();

            Match matchEquation = Regex.Match(input, @"^([A-Z]+[+\-/*])*[A-Z]+=[A-Z]+$"); // Check equation format.

            if (!matchEquation.Success)
            {
                throw new FormatException("Invalid math equation format.");
            }

            string[] equationSides = input.Split('='); // Split into left and right parts.
            EqualsPart = equationSides[1];

            MatchCollection termMatches = Regex.Matches(equationSides[0], @"[A-Z]+"); // Get all letter terms.

            foreach (Match termMatch in termMatches)
            {
                Terms.Add(termMatch.Value);
            }

            MatchCollection operatorMatches = Regex.Matches(equationSides[0], @"[+\-/*]"); // Get all operators.

            foreach (Match operatorMatch in operatorMatches)
            {
                Operators.Add(MathOperatorsMethods.GetOperatorFromString(operatorMatch.Value));
            }
        }
Exemple #12
0
        public MainPageViewModel()
        {
            Title            = "CourseKeeper";
            _terms           = new ObservableCollection <Term>();
            LoadItemsCommand = new Command(async() => await ExecuteLoadItemsCommand());
            AddTermCommand   = new Command(async() => await ExecuteAddTermCommand());
            if (App.Database.GetTermsAsync().Result.Count == 0)
            {
                DoSetup();
            }
            PopulateTerms();

            MessagingCenter.Subscribe <NewTermPageViewModel, Term>(this, "AddTerm", (sender, obj) =>
            {
                Terms.Add(obj);
            });
            MessagingCenter.Subscribe <TermDetailViewModel, Term>(this, "TermDelete", (sender, obj) =>
            {
                Terms.Remove(obj);
            });
            MessagingCenter.Subscribe <NewTermPageViewModel>(this, "TermUpdate", async(obj) =>
            {
                await ExecuteLoadItemsCommand();
            });
        }
Exemple #13
0
 private void RefreshTerms()
 {
     Terms.Clear();
     foreach (var term in AllTerms)
     {
         Terms.Add(term);
     }
 }
Exemple #14
0
        public void AddTerm <T>(string termText, LinkTypes linkType) where T : SearchTerm
        {
            var instance = (T)Activator.CreateInstance(typeof(T), termText);

            instance.LinkType = new SearchTermLinkType(linkType);
            instance.Term     = termText;
            Terms.Add(instance);
        }
 public void AddTerm(string role, DateTime startDate, DateTime endDate, int number)
 {
     Terms.Add(new Term()
     {
         Role   = role,
         Start  = startDate,
         End    = endDate,
         Number = number
     });
 }
Exemple #16
0
        /// <summary>
        /// Allows to add a new term entry to the dictionary index.
        /// </summary>
        /// <param name="termEntry">term entry to be added</param>
        private void AddTermEntry(TLTermEntry termEntry)
        {
            if (Terms.ContainsKey(termEntry.Term))
            {
                throw new ArgumentException("The dictionary already contains that term");
            }

            Terms.Add(termEntry.Term, termEntry);
            m_termEntries.Add(termEntry);
        }
Exemple #17
0
            // Adds new term
            internal Term AddTerm(string text)
            {
                Term term = new Term();

                term.Text = text;

                Terms.Add(term);

                return(term);
            }
        /// <summary>
        /// Add a term to the list. Enter it in lookup dictionary
        /// </summary>
        /// <param name="term"></param>
        public void Add(Term term)
        {
            if (GetIfPresent(term.Id) != null)
            {
                throw new ArgumentException("Biblical term already in list" + term.Id);
            }

            Terms.Add(term);
            idToIndexDictionary[term.Id] = Terms.Count - 1;
        }
        async Task ExecuteLoadTermsCommand()
        {
            Terms.Clear();
            var terms = await App.DB.ShowTerms();

            foreach (var term in terms)
            {
                Terms.Add(term);
            }
        }
Exemple #20
0
        private async void PopulateTerms()
        {
            List <Term> terms = await App.Database.GetTermsAsync();

            Terms.Clear();
            foreach (Term term in terms)
            {
                Terms.Add(term);
            }
        }
        public async void PopulateTermList()
        {
            List <Term> terms = await App.DB.ShowTerms();

            Terms.Clear();
            foreach (Term term in terms)
            {
                Terms.Add(term);
            }
        }
 /// <summary>
 /// Adds the specified key/value pair to replace in the template on ToString().
 /// </summary>
 /// <param name="key">The key.</param>
 /// <param name="value">The value.</param>
 public void Add(string key, string value)
 {
     if (!Terms.ContainsKey(key))
     {
         Terms.Add(key, value);
     }
     else
     {
         Terms[key] = value;
     }
 }
Exemple #23
0
        public override void Init(ParsingContext context, ParseTreeNode parseNode)
        {
            base.Init(context, parseNode);

            foreach (var node in parseNode.ChildNodes)
            {
                if (node.AstNode is AstNode)
                {
                    Terms.Add(node.AstNode as AstNode);
                }
            }
        }
Exemple #24
0
        private async Task Refresh()
        {
            IsBusy = true;
            Terms.Clear();
            var terms = await DBService.GetAllTerm();

            foreach (Models.Term term in terms)
            {
                Terms.Add(term);
            }
            IsBusy = false;
        }
        public CensusOperand Where(string field)
        {
            var newArg = new CensusArgument(field);

            if (Terms == null)
            {
                Terms = new List <CensusArgument>();
            }

            Terms.Add(newArg);
            return(newArg.Operand);
        }
        /// <summary>
        /// Adds a search term to the list of terms to use while parsing data.
        /// </summary>
        /// <param name="id">The ID of the term. This should match the 1-based number in the parameter array in Simpl+.</param>
        /// <param name="term">The string provided on the parameter in Simpl+.</param>
        public void AddSearchTerm(ushort id, string term)
        {
            if (Terms == null)
            {
                Terms = new List <Term>();
            }
            var t = new Term();

            t.ID           = id;
            t.SearchString = term.ToLower();
            Terms.Add(t);
            CrestronConsole.PrintLine("IFTTT: Added search term " + term.ToLower());
        }
Exemple #27
0
        /// <summary>
        /// The compositeschedule has terms, preconditions, and effects.
        /// All preconditions and effects are expected to be ground because they are created based on the ground decomposition
        /// Thus, unlike the parent class, there is no need to propagate bindings to terms, preconditions, and effects.
        /// </summary>
        /// <param name="td"></param>
        public void ApplyDecomposition(TimelineDecomposition td)
        {
            subSteps     = td.SubSteps;
            subOrderings = td.SubOrderings;
            subLinks     = td.SubLinks;

            foreach (var substep in subSteps)
            {
                foreach (var term in substep.Terms)
                {
                    if (!td.Terms.Contains(term))
                    {
                        //var termAsPredicate = term as Predicate;
                        //if (termAsPredicate != null)
                        //{

                        //}
                        Terms.Add(term);
                    }
                }
            }

            Cntgs = td.fabCntgs;

            // The way things are done round here is just to group in discourse stuff with fabula stuff. We have two plans... but they can go in one plan.
            foreach (var camplanstep in td.discourseSubSteps)
            {
                SubSteps.Add(camplanstep as IPlanStep);
            }
            foreach (var dordering in td.discOrderings)
            {
                SubOrderings.Add(new Tuple <IPlanStep, IPlanStep>(dordering.First, dordering.Second));
            }
            foreach (var discCntg in td.discCntgs)
            {
                Cntgs.Add(new Tuple <IPlanStep, IPlanStep>(discCntg.First, discCntg.Second));
            }
            foreach (var dlink in td.discLinks)
            {
                SubLinks.Add(new CausalLink <IPlanStep>(dlink.Predicate, dlink.Head, dlink.Tail));
            }

            // these should already be ground.
            InitialActionSeg = td.InitialActionSeg.Clone();
            FinalActionSeg   = td.FinalActionSeg.Clone();
            InitialAction    = td.InitialAction.Clone() as IPlanStep;
            FinalAction      = td.FinalAction.Clone() as IPlanStep;
            InitialCamAction = td.InitialCamAction.Clone() as CamPlanStep;
            FinalCamAction   = td.FinalCamAction.Clone() as CamPlanStep;
        }
 /// <summary>
 /// This will check if the key already exist in the collection. If it does not, then it will add it, else it will increment the frequency by 1
 /// </summary>
 /// <param name="term">The term to add or increment in the dictionary</param>
 /// <param name="position">The location of the word in the document</param>
 private void Add(string term, int position)
 {
     if (!Terms.ContainsKey(term))
     {
         Terms.Add(term, new List <int>()
         {
             position
         });
     }
     else
     {
         Terms[term].Add(position);
     }
     MainIndex.Add(term, Document.Name);
 }
Exemple #29
0
        /// <summary>
        /// Allows to add the new term entry to the dictionary index.
        /// </summary>
        /// <param name="term">term word</param>
        /// <param name="numberOfArtifactsContainingTerm">number of all artifacts of each text contain given term</param>
        /// <param name="totalFrequencyAcrossAllArtifacts">total frequency across all artifacts</param>
        /// <param name="weight">weight for the given term</param>
        /// <returns>just created term entry</returns>
        public TLTermEntry AddTermEntry(string term, int numberOfArtifactsContainingTerm, int totalFrequencyAcrossAllArtifacts, double weight)
        {
            // Integrity checks
            if (Terms.ContainsKey(term))
            {
                throw new ArgumentException("The dictionary already contains that term");
            }

            TLTermEntry termEntry = new TLTermEntry(term, numberOfArtifactsContainingTerm, totalFrequencyAcrossAllArtifacts, weight);

            Terms.Add(term, termEntry);
            m_termEntries.Add(termEntry);

            return(termEntry);
        }
Exemple #30
0
        private void loadTerms(UniqueEntityView item)
        {
            Terms.Clear();
            if (item is null)
            {
                return;
            }
            terms.FixedFilter = GetMember.Name <UnitTermData>(x => x.MasterId);
            terms.FixedValue  = item.Id;
            var list = terms.Get().GetAwaiter().GetResult();

            foreach (var e in list)
            {
                Terms.Add(UnitTermViewFactory.Create(e));
            }
        }