public override void SetUp() { base.SetUp(); dir = NewDirectory(); var iw = new RandomIndexWriter(Random(), dir, Similarity, TimeZone); int numDocs = TestUtil.NextInt(Random(), 2049, 4000); for (int i = 0; i < numDocs; i++) { var document = new Document { NewTextField("english", English.IntToEnglish(i), Field.Store.NO), NewTextField("oddeven", (i % 2 == 0) ? "even" : "odd", Field.Store.NO ), NewStringField("byte", string.Empty + (unchecked ((byte)Random().Next ())), Field.Store.NO), NewStringField("short", string.Empty + ((short)Random().Next()), Field.Store .NO), new IntField("int", Random().Next(), Field.Store.NO), new LongField("long", Random().NextLong(), Field.Store.NO), new FloatField("float", Random().NextFloat(), Field.Store.NO), new DoubleField("double", Random().NextDouble(), Field.Store.NO), new NumericDocValuesField("intdocvalues", Random().Next()), new FloatDocValuesField("floatdocvalues", Random().NextFloat()) }; iw.AddDocument(document); } reader = iw.Reader; iw.Dispose(); searcher = NewSearcher(reader); }
public string ChangeFacebookId(string facebookid, string facebookprofilepictureurl, string userEmail) { var user1 = DependencyService.Get <IDBAccess.IBlobStorage>().GetUserByFacebookID(facebookid); if (user1 is null) { var user = DependencyService.Get <IDBAccess.IBlobStorage>().GetUserByFacebookID(userEmail); user.FacebookId = facebookid; user.ProfilePictureURL = facebookprofilepictureurl; var success = DependencyService.Get <IDBAccess.IBlobStorage>().UpdateUser(user.id, user); if (!success) { return(English.SomethingWentWrong()); } else { return(String.Empty); } } else { return(English.AlreadyHaveThisFacebookAcoount()); } }
public virtual void TestThousandDocuments() { Directory dir = NewDirectory(); RandomIndexWriter writer = new RandomIndexWriter( #if FEATURE_INSTANCE_TESTDATA_INITIALIZATION this, #endif Random, dir); for (int i = 0; i < 1000; i++) { Document doc = new Document(); doc.Add(NewStringField("field", English.Int32ToEnglish(i), Field.Store.NO)); writer.AddDocument(doc); } IndexReader reader = writer.GetReader(); writer.Dispose(); IndexSearcher searcher = NewSearcher(reader); for (int i = 0; i < 1000; i++) { TermQuery termQuery = new TermQuery(new Term("field", English.Int32ToEnglish(i))); QueryWrapperFilter qwf = new QueryWrapperFilter(termQuery); TopDocs td = searcher.Search(new MatchAllDocsQuery(), qwf, 10); Assert.AreEqual(1, td.TotalHits); } reader.Dispose(); dir.Dispose(); }
public void VerifySwapSourceEnLanguageAndTargetUkLanguage() { // select source and target languages var languageBar = HomePage.TranslationBlock.LanguageBar; languageBar.OpenSourceLanguageList().SelectSourceLanguage(English) .OpenTargetLanguageList().SelectTargetLanguage(Ukrainien); // verify that languages are selected correctly Assert.IsTrue(languageBar.GetSelectedSourceLanguage().ToLower(). Equals(English.GetString())); Assert.IsTrue(languageBar.GetSelectedTargetLanguage().ToLower(). Equals(Ukrainien.GetString())); // enter source text var sourceContainer = HomePage.TranslationBlock.SourceContainer; sourceContainer.SetSourceText(TestConstants.SundayInEnglish); // verify translation var targetContainer = HomePage.TranslationBlock.ResultContainer; Assert.AreEqual(TestConstants.SundayInUkrainien, targetContainer.GetResultText()); // swap languages languageBar.SwapLanguages(); // verify languages are swapped in language bar Assert.IsTrue(languageBar.GetSelectedSourceLanguage().ToLower(). Equals(Ukrainien.GetString())); Assert.IsTrue(languageBar.GetSelectedTargetLanguage().ToLower(). Equals(English.GetString())); // verify text is swapped Assert.AreEqual(TestConstants.SundayInUkrainien, sourceContainer.GetSourceText()); Assert.AreEqual(TestConstants.SundayInEnglish, targetContainer.GetResultText()); }
private async void galleryButton_ClickedAsync(object sender, EventArgs args) { if (!CrossMedia.Current.IsPickPhotoSupported) { await DisplayAlert(English.Failed(), English.NoPicking(), English.OK()); return; } var file = await CrossMedia.Current.PickPhotoAsync(); if (file == null) { return; } f = file.GetStream(); GlobalVariables.SourceSelectedImageFromGallery = file.Path; GlobalVariables.SelectedImageFromGallery = f; addedPhoto = true; profilePictureImage.Source = ImageSource.FromStream(() => f); }
private void loginButton_Clicked(object sender, EventArgs e) { Task.Run(() => { Device.BeginInvokeOnMainThread(() => { loginButton.IsEnabled = false; loginActivator.IsRunning = true; }); string success = GlobalVariables.loginPageViewModel.Login(emailEntry.Text, pwEntry.Text); if (!String.IsNullOrEmpty(success)) { Device.BeginInvokeOnMainThread(() => DisplayAlert(English.Failed(), success, English.OK()) ); } else { Device.BeginInvokeOnMainThread(() => { SecureStorage.SetAsync(GlobalVariables.EMAIL_TOKEN, emailEntry.Text.ToLower()); App.SetRootPage(new JustActivityIndicator("login")); }); } Device.BeginInvokeOnMainThread(() => { loginButton.IsEnabled = true; loginActivator.IsRunning = false; }); }); }
public string UpdatePetProfile(Pet pet) { bool success = GlobalVariables.databaseConnection.UpdatePet(pet.id, pet); if (!success) { return(English.SomethingWentWrong()); } else { int i = 0; foreach (var item in GlobalVariables.Mypetlist) { if (item.petid == pet.id) { GlobalVariables.Mypetlist[i].PetType = pet.PetType; GlobalVariables.Mypetlist[i].Age = pet.Age; GlobalVariables.Mypetlist[i].HaveAnOwner = pet.HaveAnOwner; GlobalVariables.Mypetlist[i].Name = pet.Name; GlobalVariables.MyPetsString[i] = pet.Name; break; } i++; } GlobalVariables.AddedPet = true; return(English.Empty()); } }
//1:üres mind a kettő //2:első üres //3:második üres //4:nem jó az email formátuma //5:a pw nem olyan hosszban van 6-16 //6:nem található ilyen email a DBben vagy rossz a jelszó //7:minden jó public string Login(string EMAIL, string PASSWORD) { if (String.IsNullOrEmpty(EMAIL) && String.IsNullOrEmpty(PASSWORD)) { return(English.YouHaveToFillAllEntries()); } if (String.IsNullOrEmpty(EMAIL)) { return(English.EmailIsEmpty()); } if (String.IsNullOrEmpty(PASSWORD)) { return(English.PasswordIsEmpty()); } if (!segédfüggvények.IsValidEmailAddress(EMAIL.ToLower())) { return(English.BadEmailFormat()); } if (PASSWORD.Length < 6 || PASSWORD.Length > 16) { return(English.BadPasswordLength()); } var user = DependencyService.Get <IDBAccess.IBlobStorage>().GetUserByEmail(EMAIL.ToLower()); if (user is null || user.Password != PASSWORD) { return(English.BadPasswordOrEmail()); } return(English.Empty()); }
public ActionResult DeleteConfirmed(int id) { English english = db.Englishs.Find(id); db.Englishs.Remove(english); db.SaveChanges(); return RedirectToAction("Index"); }
public override void Run() { try { for (int j = 0; j < NUM_ITER2; j++) { writerFinal.ForceMerge(1, false); for (int k = 0; k < 17 * (1 + iFinal); k++) { Document d = new Document(); d.Add(NewField("id", iterFinal + "_" + iFinal + "_" + j + "_" + k, customType)); d.Add(NewField("contents", English.Int32ToEnglish(iFinal + k), customType)); writerFinal.AddDocument(d); } for (int k = 0; k < 9 * (1 + iFinal); k++) { writerFinal.DeleteDocuments(new Term("id", iterFinal + "_" + iFinal + "_" + j + "_" + k)); } writerFinal.ForceMerge(1); } } catch (Exception t) { outerInstance.SetFailed(); Console.WriteLine(Thread.CurrentThread.Name + ": hit exception"); Console.WriteLine(t.StackTrace); } }
/// <summary> /// Nyilvántartásba vesz egy bogarat /// </summary> /// <param name="UnderlyingBug">A követendő bogár</param> public Bug(English.Bug UnderlyingBug) { this.Type = ItemType.Bug; this.UnderlyingBug = UnderlyingBug; if (BaseList.Contains(UnderlyingBug) || UnderlyingBug.CurrentEnergy <= 0) { return; } List.Add(this); }
public string DeleteAccount() { int i = 0; if (GlobalVariables.Mypetlist.Count != 0) { while (GlobalVariables.Mypetlist.Count != 0) { if (!string.IsNullOrEmpty(GlobalVariables.updatePetFragmentViewModel.DeletePet(GlobalVariables.Mypetlist[i].petid))) { return(English.SomethingWentWrong()); } i++; } } GlobalVariables.Mypetlist = new System.Collections.Generic.List <MyPetsList>(); if (!GlobalVariables.databaseConnection.DeleteAccount(GlobalVariables.ActualUser.id)) { return(English.SomethingWentWrong()); } else { return(English.Empty()); } }
public override void SetUp() { base.SetUp(); //IndexDir = CreateTempDir("RAMDirIndex"); string tempDir = Path.GetTempPath(); if (tempDir == null) { throw new IOException("java.io.tmpdir undefined, cannot run test"); } indexDir = new DirectoryInfo(Path.Combine(tempDir, "RAMDirIndex")); Directory dir = NewFSDirectory(indexDir); IndexWriter writer = new IndexWriter(dir, (new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random))).SetOpenMode(OpenMode.CREATE)); // add some documents Document doc = null; for (int i = 0; i < docsToAdd; i++) { doc = new Document(); doc.Add(NewStringField("content", English.Int32ToEnglish(i).Trim(), Field.Store.YES)); writer.AddDocument(doc); } Assert.AreEqual(docsToAdd, writer.MaxDoc); writer.Dispose(); dir.Dispose(); }
public async Task <string> SendEmailAsync(string EMAIL) { if (String.IsNullOrEmpty(EMAIL)) { return(English.GiveYourEmail()); } EMAIL = EMAIL.ToLower(); User user = GlobalVariables.databaseConnection.GetUserByEmail(EMAIL); if (user.Email is null) { return(English.NoAcoountFoundWithThisEmail()); } string passwordWithoutEncrypt = segédfüggvények.RandomString(8, false); user.Password = segédfüggvények.EncryptPassword(passwordWithoutEncrypt); bool success = GlobalVariables.databaseConnection.ForgotPasswordAsync(user.id, user); if (!success) { return(English.SomethingWentWrong()); } return(string.Empty); }
public static IReindexer Create() { var tokenizer = new FilteringTokenizer( new TransformingTokenizer(new Tokenizer(), x => new Token(English.Stem(x.Payload), x.Type)), x => English.IsStopWord(x.Payload) ); var queryParser = new VisitingQueryParser( new QueryParser(), new FilterTermVisitor(English.IsStopWord), new TransformTermVisitor(English.Stem) ); var fullTextIndex = new FullTextIndex(); var fileWatcherDispatcher = new FileWatcherDispatcher(); var fileWatcherService = new FileWatcherService(new FileWatcherFactory(fileWatcherDispatcher), TimeSpan.FromSeconds(1)); return(new Reindexer( fullTextIndex, queryParser, tokenizer, fileWatcherService, Disposable.Create(() => { fileWatcherService.Dispose(); fileWatcherDispatcher.Dispose(); fullTextIndex.Dispose(); }) )); }
private void deletePetButton_ClickedAsync(object sender, EventArgs e) { Task.Run(() => { DisableOrEnableButtons(false); string success = GlobalVariables.updatePetFragmentViewModel.DeletePet(petid); if (!string.IsNullOrEmpty(success)) { Device.BeginInvokeOnMainThread(() => { DisplayAlert(English.Failed(), success, English.OK()); }); } else { Device.BeginInvokeOnMainThread(() => { GlobalEvents.OnProfilePictureUpdated_Event(this, null); Navigation.PopToRootAsync(); }); } DisableOrEnableButtons(true); }); }
/// <summary> /// Sets up a RAMDirectory, and adds documents (using English.IntToEnglish()) with two fields: field and multiField /// and analyzes them using the PayloadAnalyzer </summary> /// <param name="similarity"> The Similarity class to use in the Searcher </param> /// <param name="numDocs"> The num docs to add </param> /// <returns> An IndexSearcher </returns> // TODO: randomize public virtual IndexSearcher SetUp(Random random, Similarity similarity, int numDocs) { Directory directory = new MockDirectoryWrapper(random, new RAMDirectory()); PayloadAnalyzer analyzer = new PayloadAnalyzer(this); // TODO randomize this IndexWriter writer = new IndexWriter(directory, (new IndexWriterConfig(LuceneTestCase.TEST_VERSION_CURRENT, analyzer)).SetSimilarity(similarity)); // writer.infoStream = System.out; for (int i = 0; i < numDocs; i++) { Document doc = new Document(); doc.Add(new TextField(FIELD, English.Int32ToEnglish(i), Field.Store.YES)); doc.Add(new TextField(MULTI_FIELD, English.Int32ToEnglish(i) + " " + English.Int32ToEnglish(i), Field.Store.YES)); doc.Add(new TextField(NO_PAYLOAD_FIELD, English.Int32ToEnglish(i), Field.Store.YES)); writer.AddDocument(doc); } Reader = DirectoryReader.Open(writer, true); writer.Dispose(); IndexSearcher searcher = LuceneTestCase.NewSearcher( #if FEATURE_INSTANCE_TESTDATA_INITIALIZATION null, // LUCENENET: Passing null allows us to bypass similarity, which we are setting here, anyway #endif Reader); searcher.Similarity = similarity; return(searcher); }
public void TestTransposition() { DirectSpellChecker spellChecker = new DirectSpellChecker(); Directory dir = NewDirectory(); RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, new MockAnalyzer(Random(), MockTokenizer.SIMPLE, true), Similarity, TimeZone); for (int i = 0; i < 20; i++) { Document doc = new Document(); doc.Add(NewTextField("numbers", English.IntToEnglish(i), Field.Store.NO)); writer.AddDocument(doc); } IndexReader ir = writer.Reader; SuggestWord[] similar = spellChecker.SuggestSimilar(new Term( "numbers", "fvie"), 1, ir, SuggestMode.SUGGEST_WHEN_NOT_IN_INDEX); assertEquals(1, similar.Length); assertEquals("five", similar[0].String); ir.Dispose(); writer.Dispose(); dir.Dispose(); }
public override void SetUp() { base.SetUp(); dir = NewDirectory(); var iw = new RandomIndexWriter( #if FEATURE_INSTANCE_TESTDATA_INITIALIZATION this, #endif Random, dir); int numDocs = TestUtil.NextInt32(Random, 2049, 4000); for (int i = 0; i < numDocs; i++) { var document = new Document { NewTextField("english", English.Int32ToEnglish(i), Field.Store.NO), NewTextField("oddeven", (i % 2 == 0) ? "even" : "odd", Field.Store.NO), NewStringField("byte", string.Empty + (unchecked ((byte)Random.Next())).ToString(CultureInfo.InvariantCulture), Field.Store.NO), NewStringField("short", string.Empty + ((short)Random.Next()).ToString(CultureInfo.InvariantCulture), Field.Store.NO), new Int32Field("int", Random.Next(), Field.Store.NO), new Int64Field("long", Random.NextInt64(), Field.Store.NO), new SingleField("float", Random.NextSingle(), Field.Store.NO), new DoubleField("double", Random.NextDouble(), Field.Store.NO), new NumericDocValuesField("intdocvalues", Random.Next()), new SingleDocValuesField("floatdocvalues", Random.NextSingle()) }; iw.AddDocument(document); } reader = iw.GetReader(); iw.Dispose(); searcher = NewSearcher(reader); }
private async void deleteAcoountPageButton_ClickedAsync(object sender, EventArgs e) { var action = await DisplayActionSheet("Delete account", "Are you sure?", "Cancel", "Delete"); if (action == "Delete") { loguotButton.IsEnabled = false; deleteAcoountPageButton.IsEnabled = false; deleteActivity.IsRunning = true; string success = GlobalVariables.otherFragmentViewModel.DeleteAccount(); if (!String.IsNullOrEmpty(success)) { await DisplayAlert(English.Failed(), success, English.OK()); } else { await SecureStorage.SetAsync(GlobalVariables.EMAIL_TOKEN, string.Empty); App.SetRootPage(new LoginPage()); } loguotButton.IsEnabled = true; deleteAcoountPageButton.IsEnabled = true; deleteActivity.IsRunning = false; } }
public string UpdatePetProfile(Pet pet) { bool success = DependencyService.Get <IDBAccess.IBlobStorage>().UpdatePet(pet.id, pet); if (!success) { return(English.SomethingWentWrong()); } else { int i = 0; foreach (var item in GlobalVariables.Mypetlist) { if (item.petid == pet.id) { GlobalVariables.Mypetlist[i].PetType = pet.PetType; GlobalVariables.Mypetlist[i].Age = pet.Age; GlobalVariables.Mypetlist[i].HaveAnOwner = pet.HaveAnOwner; GlobalVariables.Mypetlist[i].Name = pet.Name; GlobalVariables.MyPetsString[i] = pet.Name; break; } i++; } GlobalVariables.AddedPet = true; return(English.Empty()); } }
/// <summary> /// Test Position increments applied by TypeTokenFilter with and without enabling this option. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testStopPositons() throws java.io.IOException public virtual void testStopPositons() { StringBuilder sb = new StringBuilder(); for (int i = 10; i < 20; i++) { if (i % 3 != 0) { sb.Append(i).Append(" "); } else { string w = English.intToEnglish(i).trim(); sb.Append(w).Append(" "); } } log(sb.ToString()); string[] stopTypes = new string[] { "<NUM>" }; ISet <string> stopSet = asSet(stopTypes); // with increments StringReader reader = new StringReader(sb.ToString()); TypeTokenFilter typeTokenFilter = new TypeTokenFilter(TEST_VERSION_CURRENT, new StandardTokenizer(TEST_VERSION_CURRENT, reader), stopSet); testPositons(typeTokenFilter); // without increments reader = new StringReader(sb.ToString()); typeTokenFilter = new TypeTokenFilter(Version.LUCENE_43, false, new StandardTokenizer(TEST_VERSION_CURRENT, reader), stopSet); testPositons(typeTokenFilter); }
/// <summary> /// Sets up a RAMDirectory, and adds documents (using English.IntToEnglish()) with two fields: field and multiField /// and analyzes them using the PayloadAnalyzer </summary> /// <param name="similarity"> The Similarity class to use in the Searcher </param> /// <param name="numDocs"> The num docs to add </param> /// <returns> An IndexSearcher </returns> // TODO: randomize public virtual IndexSearcher SetUp(Random random, Similarity similarity, int numDocs) { Directory directory = new MockDirectoryWrapper(random, new RAMDirectory()); PayloadAnalyzer analyzer = new PayloadAnalyzer(this); // TODO randomize this IndexWriter writer = new IndexWriter(directory, (new IndexWriterConfig(LuceneTestCase.TEST_VERSION_CURRENT, analyzer)).SetSimilarity(similarity)); // writer.infoStream = System.out; for (int i = 0; i < numDocs; i++) { Document doc = new Document(); doc.Add(new TextField(FIELD, English.IntToEnglish(i), Field.Store.YES)); doc.Add(new TextField(MULTI_FIELD, English.IntToEnglish(i) + " " + English.IntToEnglish(i), Field.Store.YES)); doc.Add(new TextField(NO_PAYLOAD_FIELD, English.IntToEnglish(i), Field.Store.YES)); writer.AddDocument(doc); } Reader = DirectoryReader.Open(writer, true); writer.Dispose(); IndexSearcher searcher = LuceneTestCase.NewSearcher(Reader); searcher.Similarity = similarity; return(searcher); }
/// <summary> /// </summary> /// <param name="cultureInfo"> </param> public static Dictionary <string, string> Update(CultureInfo cultureInfo) { var culture = cultureInfo.TwoLetterISOLanguageName; ResourceDictionary dictionary; if (Constants.Supported.Contains(culture)) { switch (culture) { case "ja": dictionary = Japanese.Context(); break; case "de": dictionary = German.Context(); break; case "fr": dictionary = French.Context(); break; default: dictionary = English.Context(); break; } } else { dictionary = English.Context(); } return(dictionary.Cast <DictionaryEntry>() .ToDictionary(item => (string)item.Key, item => (string)item.Value)); }
public async Task <string> UpdateEmailAsync(string newEmail) { if (GlobalVariables.ActualUser.Email == newEmail) { return(English.ThisEmailIsYourEmail()); } if (!String.IsNullOrEmpty(newEmail)) { GlobalVariables.ActualUser.Email = newEmail; User checkEmailExist = DependencyService.Get <IDBAccess.IBlobStorage>().GetUserByEmail(newEmail); if (!String.IsNullOrEmpty(checkEmailExist.Email)) { return(English.ThisEmailIsExist()); } else { GlobalVariables.ActualUsersEmail = GlobalVariables.ActualUser.Email; string url = String.Format("http://petbellies.com/php/petbellieschangeemail.php?email={0}&nev={1}", GlobalVariables.ActualUser.Email, GlobalVariables.ActualUser.FirstName); Uri uri = new Uri(url); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "GET"; WebResponse res = await request.GetResponseAsync(); DependencyService.Get <IFileStoreAndLoad>().SaveText(GlobalVariables.logintxt, GlobalVariables.ActualUsersEmail); return(UpdateUser(GlobalVariables.ActualUser)); } } return(English.SomethingWentWrong()); }
public static List <string> GetRankedMonsters(string name = "ALL") { List <string> monsters; var culture = Constants.CultureInfo.TwoLetterISOLanguageName; switch (culture) { case "fr": monsters = French.GetRankedMonster(name); break; case "ja": monsters = Japanese.GetRankedMonster(name); break; case "de": monsters = German.GetRankedMonster(name); break; case "zh": monsters = Chinese.GetRankedMonster(name); break; default: monsters = English.GetRankedMonster(name); break; } return(monsters); }
public async Task <string> UpdateEmailAsync(string newEmail) { if (GlobalVariables.ActualUser.Email == newEmail) { return(English.ThisEmailIsYourEmail()); } if (!string.IsNullOrEmpty(newEmail)) { GlobalVariables.ActualUser.Email = newEmail; User checkEmailExist = GlobalVariables.databaseConnection.GetUserByEmail(newEmail); if (!string.IsNullOrEmpty(checkEmailExist.Email)) { return(English.ThisEmailIsExist()); } else { GlobalVariables.ActualUsersEmail = GlobalVariables.ActualUser.Email; await SecureStorage.SetAsync(GlobalVariables.EMAIL_TOKEN, GlobalVariables.ActualUsersEmail); return(UpdateUser(GlobalVariables.ActualUser)); } } return(English.SomethingWentWrong()); }
public void TestTransposition2() { DirectSpellChecker spellChecker = new DirectSpellChecker(); Directory dir = NewDirectory(); RandomIndexWriter writer = new RandomIndexWriter( #if FEATURE_INSTANCE_TESTDATA_INITIALIZATION this, #endif Random, dir, new MockAnalyzer(Random, MockTokenizer.SIMPLE, true)); for (int i = 0; i < 20; i++) { Document doc = new Document(); doc.Add(NewTextField("numbers", English.Int32ToEnglish(i), Field.Store.NO)); writer.AddDocument(doc); } IndexReader ir = writer.GetReader(); SuggestWord[] similar = spellChecker.SuggestSimilar(new Term( "numbers", "seevntene"), 2, ir, SuggestMode.SUGGEST_WHEN_NOT_IN_INDEX); assertEquals(1, similar.Length); assertEquals("seventeen", similar[0].String); ir.Dispose(); writer.Dispose(); dir.Dispose(); }
private void changeProfilePictureButton_Clicked(object sender, EventArgs e) { Task.Run(() => { DisableOrEnableButtons(false); string success = GlobalVariables.updatePetFragmentViewModel.UpdatePetProfilePictureAsync(addedPhoto, thisPet, f); if (!string.IsNullOrEmpty(success)) { Device.BeginInvokeOnMainThread(() => { DisplayAlert(English.Failed(), success, English.OK()); }); } else { addedPhoto = false; Device.BeginInvokeOnMainThread(() => { DisplayAlert(English.Successful(), English.Successful(), English.OK()); }); } DisableOrEnableButtons(true); }); }
public virtual void TestStopPositons() { StringBuilder sb = new StringBuilder(); for (int i = 10; i < 20; i++) { if (i % 3 != 0) { sb.Append(i).Append(" "); } else { string w = English.Int32ToEnglish(i).Trim(); sb.Append(w).Append(" "); } } log(sb.ToString()); string[] stopTypes = new string[] { "<NUM>" }; ISet <string> stopSet = AsSet(stopTypes); // with increments StringReader reader = new StringReader(sb.ToString()); TypeTokenFilter typeTokenFilter = new TypeTokenFilter(TEST_VERSION_CURRENT, new StandardTokenizer(TEST_VERSION_CURRENT, reader), stopSet); TestPositons(typeTokenFilter); // without increments reader = new StringReader(sb.ToString()); typeTokenFilter = #pragma warning disable 612, 618 new TypeTokenFilter(LuceneVersion.LUCENE_43, #pragma warning restore 612, 618 false, new StandardTokenizer(TEST_VERSION_CURRENT, reader), stopSet); TestPositons(typeTokenFilter); }
public override void SetUp() { base.SetUp(); dir = NewDirectory(); RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, true), Similarity, TimeZone); for (int i = 900; i < 1112; i++) { Document doc = new Document(); string num = Regex.Replace(Regex.Replace(English.IntToEnglish(i), "[-]", " "), "[,]", ""); doc.Add(NewTextField("numbers", num, Field.Store.NO)); writer.AddDocument(doc); } { Document doc = new Document(); doc.Add(NewTextField("numbers", "thou hast sand betwixt thy toes", Field.Store.NO)); writer.AddDocument(doc); } { Document doc = new Document(); doc.Add(NewTextField("numbers", "hundredeight eightyeight yeight", Field.Store.NO)); writer.AddDocument(doc); } { Document doc = new Document(); doc.Add(NewTextField("numbers", "tres y cinco", Field.Store.NO)); writer.AddDocument(doc); } writer.Commit(); writer.Dispose(); }
private void button1_Click(object sender, EventArgs e) { double number = Convert.ToDouble(txtAmount.Text); try { if (number < 0) { throw new NegativeNumberException(); } } catch (NegativeNumberException error) { MessageBox.Show(error.Message); } English english = new English(number); if (number >= 0) label3.Text = english.Converter(); }
/// <summary> /// Nyilvántartásba vesz egy cukorhegyet /// </summary> /// <param name="Sugar">A cukorhegy</param> /// <returns>A nyilvántartásba vett cukorhegy</returns> public static Sugar Track(English.Sugar Sugar) { return new Sugar(Sugar); }
/// <summary> /// Megkeres a nyilvántartásban egy gyümölcsöt /// </summary> /// <param name="Fruit">Ennek a nyilvántartott párját fogja megkeresni</param> /// <returns>A nyilvántartott gyümölcs</returns> public static Fruit FindBy(English.Fruit Fruit) { foreach (Fruit item in List) { if (item.UnderlyingFruit == Fruit) { return item; } } return null; }
/// <summary> /// Nyilvántartásba vesz egy bogarat /// </summary> /// <param name="Bug">A bogár</param> /// <returns>A nyilvántartásba vett bogár</returns> public static Bug Track(English.Bug Bug) { return new Bug(Bug); }
/// <summary> /// Megkeres a nyilvántartásban egy bogarat /// </summary> /// <param name="Bug">Ennek a nyilvántartott párját fogja megkeresni</param> /// <returns>A nyilvántartott bogár</returns> public static Bug FindBy(English.Bug Bug) { foreach (Bug item in List) { if (item.UnderlyingBug == Bug) { return item; } } return null; }
public string Greetings(English english) { return english.SayHello(); }
/// <summary> /// Nyilvántartásba vesz egy gyümölcsöt /// </summary> /// <param name="Fruit">A gyümölcs</param> /// <returns>A nyilvántartásba vett gyümölcs</returns> public static Fruit Track(English.Fruit Fruit) { return new Fruit(Fruit); }
/// <summary> /// Megkeres a nyilvántartásban egy cukorhegyet /// </summary> /// <param name="Sugar">Ennek a nyilvántartott párját fogja megkeresni</param> /// <returns>A nyilvántartott cukorhegy</returns> public static Sugar FindBy(English.Sugar Sugar) { foreach (Sugar item in List) { if (item.UnderlyingSugar == Sugar) { return item; } } return null; }
/// <summary> /// Megkeres a nyilvántartásban egy ellenséges hangyát /// </summary> /// <param name="EnemyAnt">Ennek a nyilvántartott párját fogja megkeresni</param> /// <returns>A nyilvántartott ellenges hangya</returns> public static EnemyAnt FindBy(English.Ant EnemyAnt) { foreach (EnemyAnt item in List) { if (item.UnderlyingAnt == EnemyAnt) { return item; } } return null; }
/// <summary> /// Nyilvántartásba vesz egy ellenséges hangyát /// </summary> /// <param name="EnemyAnt">A hangya</param> /// <returns>A nyilvántartásba vett hangya</returns> public static EnemyAnt Track(English.Ant EnemyAnt) { return new EnemyAnt(EnemyAnt); }