public void CreatingAi(int Ans) { string a = " ", m = " "; int b = 0; this.Ans = Ans; for (int i = 0; i < Feeling.Count(); i++) { W.Add(0); } TextReader tw = new StreamReader(Book[Ans]); for (int i = 0; i < 5; i++) { a = tw.ReadLine(); if (a != null) { for (int j = 0; j < a.Length - 1; j++) { if (a[j] != ' ') { m += a[j]; } else { W[b] = Convert.ToInt32(m); b++; m = " "; } } } } tw.Close(); }
public async Task <IActionResult> Edit(int id, [Bind("Id,UserId,MainEntry,Mood")] Feeling feeling) { if (id != feeling.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(feeling); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FeelingExists(feeling.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(feeling)); }
public bool EvaluateFeelings(out Feeling result) { result = 0; if (FeelingsCount == 0) { return(false); } if (FeelingsCount > 1) { Array.Copy(_Feelings, _FeelingsSorted, FeelingsCount); Array.Copy(_Order, _OrderSorted, FeelingsCount); Array.Sort(_FeelingsSorted, _OrderSorted); for (int i = 0; i < FeelingsCount; i++) { int index = _OrderSorted[i]; if (IsFeelingFelt(index)) { result = (Feeling)index; return(true); } } return(false); } return(IsFeelingFelt(0)); }
// POST api/feelings public void Post([FromBody] Feeling value) { var context = new Context(); context.FeelingDbSet.Add(value); context.SaveChanges(); }
public async Task <IActionResult> PutFeeling(Mood id, Feeling feeling) { if (id != feeling.FeelingId) { return(BadRequest()); } _context.Entry(feeling).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FeelingExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public FeelingReaction(Feeling feeling) { FindTargetActivity findTarget = new FindTargetActivity(feeling); _Activities.Add(findTarget); _Activities.Add(new GoToTargetActivity(findTarget)); _Activities.Add(new ActivateTargetActivity(findTarget)); }
public void DisplayMood(Feeling feeling) { if (!imageDisplay.enabled) { imageDisplay.enabled = true; imageDisplay.sprite = feelingDict[feeling]; StartCoroutine(ShowMood()); } }
public static string ToFeelingBackgroundColor(Feeling feeling) { return(feeling switch { Feeling.Bad => "bg-danger", Feeling.Neutral => "bg-warning", Feeling.Good => "bg-success", _ => "" });
public void Edit(int postId, Feeling feeling, string text, IFormFile photo) { var post = this.db.Posts.Find(postId); post.Feeling = feeling; post.Text = text; post.Photo = photo != null?this.photoService.PhotoAsBytes(photo) : null; this.db.SaveChanges(); }
public void React(Feeling feeling) { // DEBUG ActivityList debugActivityList = new ActivityList(); FindTargetActivity find = new FindTargetActivity(Feeling.Fun); debugActivityList.AddActivity(find); debugActivityList.AddActivity(new GoToTargetActivity(find)); debugActivityList.AddActivity(new ActivateTargetActivity(find)); _ActivityManager.AddActivityList(debugActivityList, this); }
public void Check(Chislo[,] Net) { Res = 0; for (int i = 0; i < Feeling.Count(); i++) { Feeling[i].Signalisation(Net); if (Feeling[i].Signal == true) { Res += W[i]; } } }
public async Task <IActionResult> Create([Bind("Id,UserId,MainEntry,Mood")] Feeling feeling) { if (ModelState.IsValid) { _context.Add(feeling); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["UserId"] = new SelectList(_context.Users, "Id", "Id", feeling.UserId); return(View(feeling)); }
public void Be_able_to_provide_always_different_values_of_Adjective(Feeling feeling) { var fuzzer = new Fuzzer(2023547856, avoidDuplication: true); var maxNumberOfAdjectives = Adjectives.PerFeeling[feeling].Distinct().Count(); CheckThatNoDuplicationIsMadeWhileGenerating(fuzzer, maxNumberOfAdjectives, () => { var adjective = fuzzer.GenerateAdjective(feeling); TestContext.WriteLine(adjective); return(adjective); }); }
// Only react if reaction to a feeling is: // - not being processed // - being unproductive // - another feeling has urgent priority public void React(Feeling feeling) { FeelingReaction reaction = _DefaultReactions[(int)feeling]; if (reaction == null || _ActiveReactionsStates[(int)feeling]) { return; } _ActiveReactions.Add(reaction); _ActiveReactionsStates[(int)feeling] = true; reaction.Activate(); }
public void Edit(int postId, Feeling feeling, string text, byte[] photo, int albumId) { var post = this.db.Posts.Find(postId); this.albumService.RemovePost(post.AlbumId, postId); post.Feeling = feeling; post.Text = text; post.Photo = photo ?? null; post.AlbumId = albumId; post.Album = db.Albums.Find(albumId); this.albumService.AddPost(albumId, postId); this.db.SaveChanges(); }
public IActionResult Update(string id, Feeling feelingIn) { var feeling = _feelingService.Get(id); if (feeling == null) { return(NotFound()); } _feelingService.Update(id, feelingIn); return(NoContent()); }
public void Create(string userId, Feeling feeling, string text, IFormFile photo) { var post = new Post { UserId = userId, Feeling = feeling, Text = text, Likes = 0, Date = DateTime.UtcNow, Photo = photo != null?this.photoService.PhotoAsBytes(photo) : null }; db.Posts.Add(post); db.SaveChanges(); }
public int Create(string userId, Feeling feeling, string text, byte[] photo, int albumId) { var post = new Post { UserId = userId, Feeling = feeling, Text = text, Likes = 0, Date = DateTime.UtcNow, Photo = photo ?? null, Album = db.Albums.Find(albumId) }; db.Posts.Add(post); db.SaveChanges(); return(post.Id); }
public async Task <ActionResult <FeelingDto> > CreateFeeling(int userId, CreateFeelingDto createFeelingDto) { var feeling = new Feeling { ActionOf = createFeelingDto.ActionOf, DoAction = (IPlanAction.ActionType)createFeelingDto.DoAction, Strength = createFeelingDto.Strength, ToWhat = createFeelingDto.ToWhat, Type = (IPlanAction.ReactionType)createFeelingDto.Type, User = await _unitOfWork.UserRepository.GetUserByIdAsync(userId) }; _unitOfWork.FeelingRepository.AddItem(feeling); if (await _unitOfWork.Complete()) { return(Ok(_mapper.Map <FeelingDto>(feeling))); } return(BadRequest("Unable to create Feeling")); }
public async Task <ActionResult <Feeling> > CreateFeelingForGame(int id, Feeling feeling) { var pet = await _context.Pets.FindAsync(id); if (pet == null) { return(NotFound()); } pet.HappyLevel -= 5; pet.HungerLevel += 3; feeling.When = DateTime.Now; feeling.PetId = pet.Id; _context.Feelings.Add(feeling); await _context.SaveChangesAsync(); return(Ok(feeling)); }
private async Task listen(TwitterContext twitterCtx, string words, Feeling feelingType) { //The list of words that we're going to look for needs to be separated by "," do { if (pool.Count < 100) { int count = 0; await(from strm in twitterCtx.Streaming where strm.Type == StreamingType.Filter && strm.Track == words select strm) .StartAsync(async strm => { processTweet(strm.Content, feelingType); //if (count++ >= 100) // strm.CloseStream(); }); } } while (true); }
public async Task <ActionResult <Feeling> > PostFeeling(Feeling feeling) { _context.Feeling.Add(feeling); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (FeelingExists(feeling.FeelingId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetFeeling", new { id = feeling.FeelingId }, feeling)); }
public WeatherForecast Get() { // 实例化一个对象实例 //WeatherForecast weather = WeatherForecast.GetInstance(); // 多线程去调用 for (int i = 0; i < 3; i++) { var th = new Thread( new ParameterizedThreadStart((state) => { //WeatherForecast.GetInstance(); // 此刻的心情 Feeling feeling = new Feeling(); Console.WriteLine(feeling.Date); }) ); th.Start(i); } return(null); }
private void processTweet(string tweet, Feeling feelingType) { dynamic json = JsonConvert.DeserializeObject(tweet); if (json.SelectToken("coordinates") != null) { mapPoint coords = new mapPoint(); coords.coordinates = json.SelectToken("coordinates.coordinates").ToObject <string[]>(); coords.color = "Red"; pool.Add(coords); } else { if (json.SelectToken("retweeted_status.coordinates") != null) { mapPoint coords = new mapPoint(); coords.coordinates = json.SelectToken("coordinates.coordinates").ToObject <string[]>(); coords.color = "Red"; pool.Add(coords); } } }
public void Remove(Feeling feelingIn) => _feeling.DeleteOne(phrase => phrase.Id == feelingIn.Id);
public void Update(string id, Feeling feelingIn) => _feeling.ReplaceOne(phrase => phrase.Id == id, feelingIn);
public Feeling Create(Feeling feeling) { _feeling.InsertOne(feeling); return(feeling); }
public Activity(Feeling feelingInvolved) { FeelingInvolved = feelingInvolved; }
protected override void Need() { _currentFeeling = GetRandomFeeling(); Sprite = _currentFeeling.Sprite; base.Need(); }
public Feeling(string name, float intensity, Feeling opposite) { _name = name; _intensity = intensity; _opposite = opposite; }