public override string ToString() { var s = ToStringInternal(); if (ChildSelector != null) { s += ChildSelector.ToStringInternal(); } return(s); }
protected override void CollisionEvent(Collider other) { if (other.CompareTag(Tags.PLAYER_COLLIDER)) { other.GetComponentInParent <PlayerController>().PlayerStumbled(); } else { ChildSelector childSelector = GetComponent <ChildSelector>(); if (childSelector != null) { childSelector.ResetChild(); } base.CollisionEvent(other); } }
public string ToString(int ident, InstanceModel model, int digits = -1) { // "-[2,3]\n -IntFeature<=4 [1,1]\n -IntFeature>4 [1,2]" StringBuilder builder = new StringBuilder(); builder.Append(Data.ToStringEx(digits)); if (!IsLeaf) { for (int i = 0; i < Children.Length; i++) { IDecisionTreeNode child = Children[i]; builder.Append("\n"); builder.Append(' ', (ident + 1) * 3); builder.Append("- "); builder.Append(ChildSelector.ToString(model, i)); builder.Append(' '); builder.Append(child.ToString(ident + 1, model)); } } return(builder.ToString()); }
Selector DoParseOne() { if (End) { return(null); } // todo : check the difference between "X::selector" and "X ::selector" or "X :hover" and "X:hover" or "X [condition]" and "X[condition]" and fix accordingly // => it has been assumed that they are the same... but i think i'm wrong var lst = new MultiConditionSelector { Conditions = new List <Selector>(), }; ResetWasWhitespace(); while (true) { ChildSelector chainWith = null; bool end = false; var pi = Index; switch (CurrentChar) { // ============ group list ============== // todo selector condtions case '[': lst.Conditions.Add(Parse <AttributeCondition>() ?? (Selector)Parse <InvalidSelector>()); break; default: if (WasWhitespace) { // aws a space before... that's still a chain chainWith = Parse <ChildSelector>(); if (chainWith == null) { throw new ParsingException("Expecting child selector"); // should never happen } break; } Selector sel = Parse <SimpleSelector>(); if (sel == null) { if (lst.Conditions.Count == 0) { return(null); } sel = Parse <InvalidSelector>(); } lst.Conditions.Add(sel); break; // ========= separators ================ case '>': case '~': case '+': chainWith = Parse <ChildSelector>(); if (chainWith == null) { AddError(ErrorCode.ExpectingToken, "child selector"); return(null); } break; case ',': case ';': case '{': case '}': case ')': // stooop ! (warn if ';') end = true; break; } // safety check if (!end && pi == Index) { AddError(ErrorCode.ExpectingToken, "valid selector"); end = true; } if (chainWith != null) { if (lst.Conditions.Count > 0) { if (lst.Conditions.Count == 1) { chainWith.Parent = lst.Conditions[0]; } else { chainWith.Parent = lst; } } return(chainWith); } if (End) { end = true; } if (end) { if (lst.Conditions.Count == 0) { return(null); } if (lst.Conditions.Count == 1) { return(lst.Conditions[0]); } return(lst); } } }