public static bool ConsonantCannotPrecedeUnlessDoubled(List<LetterSoundComponent> context, LetterSoundComponent l, int idxOfL) { if (idxOfL - 1 > -1) { LetterSoundComponent adj = context [idxOfL - 1]; return adj.IsConsonantConsonantDigraphOrBlend && !adj.LettersMatch (l); } return false; }
public static bool Plurals(List<LetterSoundComponent> context, LetterSoundComponent l, int idxOfL) { if (SuffixCannotBeAgainstY (context, l, idxOfL)) return true; return false; //some variation between s and es, but neither can be beside a y. //(i.e., "y" word plural forms use i, then "es". puppys no; pupp i es yes. }
public static bool SuffixCannotBeAgainstY(List<LetterSoundComponent> context, LetterSoundComponent l, int idxOfL) { return LastLetterSoundUnitCannotBe (context, "y"); }
//returns true if we are not beside a "u". public static bool Q(List<LetterSoundComponent> context, LetterSoundComponent l, int idxOfL) { bool result = !(IsAdjacentTo ("u", -1, idxOfL, context) || IsAdjacentTo ("u", 1, idxOfL, context)); return result; }
//assume that l is a consonant. //return true if l's neigbor is also a consonant type (this means, a con digraph, single con, or con blend) public static bool NoRestrictions(List<LetterSoundComponent> context, LetterSoundComponent l, int idxOfL) { return false; }
//returns true if we are last. (we are supposed to not be last) public static bool CannotBeLast(List<LetterSoundComponent> context, LetterSoundComponent l, int idxOfL) { return idxOfL == context.Count - 1 || BlankToRight (context, idxOfL); }
public static bool ConsonantCannotPrecede(List<LetterSoundComponent> context, LetterSoundComponent l, int idxOfL) { return idxOfL - 1 > -1 && context [idxOfL - 1].IsConsonantConsonantDigraphOrBlend; }
void UpdateInterfaceLetters(LetterSoundComponent lc, LetterGridController letterGridController, int indexOfLetterBarCell, bool flash) { InteractiveLetter i; if (SessionsDirector.instance.IsSyllableDivisionMode) { i = letterGridController.GetInteractiveLetter (indexOfLetterBarCell); i.UpdateDefaultColour (SessionsDirector.colourCodingScheme.GetColorsForWholeWord ()); i.SetSelectColour (lc.GetColour ()); } else { i = letterGridController.UpdateLetter (indexOfLetterBarCell, lc.GetColour ()); } char letter = lc.AsString[0]; bool flashInteractiveLetter = SessionsDirector.instance.IsMagicERule && IsVowel(lc.AsString[0]); flashInteractiveLetter&= flash && i.HasLetterOrSoundChanged (lc) && lc.GetColour () == i.CurrentColor (); i.LetterSoundComponentIsPartOf = lc; if (flashInteractiveLetter) { i.StartCoroutine ("Flash"); } }
//returns true if we are first. (we are supposed to not be first) public static bool CannotBeFirst(List<LetterSoundComponent> context, LetterSoundComponent l, int idxOfL) { return idxOfL == 0 || BlankToLeft (context, idxOfL); }
public void PhonotacticsWereFixed(LetterSoundComponent fix, int idxOfSelf) { //refreshes, since something changed (we still need to confirm that the others are not in error. //atm, this only really matters for the affixes. if an affix is placed erroneously, it violates the phonotactics of //the word, but none of its components. violatesPhonotactics = false; foreach (LetterSoundComponent l in letterSoundUnits) violatesPhonotactics = violatesPhonotactics || l.ViolatesPhonotactics; }
//discoveered while the components were being checked public void PhonotacticViolation(LetterSoundComponent perpetrator, int idxOfSelf) { violatesPhonotactics = true; }
public void Add(LetterSoundComponent l) { letterSoundUnits.Add (l); }
bool IsRControlled(LetterSoundComponent vowel, LetterSoundComponent consonant) { return consonant.AsString.Equals ("r"); }
List<LetterSoundComponent> Combine(List<LetterSoundComponent> pre, LetterSoundComponent pivot, List<LetterSoundComponent> post) { pre.Add (pivot); pre.AddRange (post); return pre; }
public void AddChild(LetterSoundComponent child) { if (children == null) children = new List<LetterSoundComponent> (); children.Add (child); }
public bool LettersMatch(LetterSoundComponent other) { return LettersAre (other.asString); }