public bool CanBeImplicitlyConvertedTo(StatePrimitive type) { var a = this.Order; var b = type.Order; return(Equals(LcaMap[a, b], type)); }
public void AddAncestor(StatePrimitive type) { if (!TryAddAncestor(type)) { throw new InvalidOperationException(); } }
public StatePrimitive GetLastCommonPrimitiveAncestor(StatePrimitive other) { var a = this.Order; var b = other.Order; return(LcaMap[a, b]); }
public void AddDescedant(StatePrimitive type) { if (type == null) { return; } if (Descedant == null) { Descedant = type; } else { var ancestor = Descedant.GetLastCommonAncestorOrNull(type); if (ancestor != null) { Descedant = ancestor; } } }
public bool TryAddAncestor(StatePrimitive type) { if (type == null) { return(true); } if (Ancestor == null) { Ancestor = type; } else { var res = Ancestor.GetFirstCommonDescendantOrNull(type); if (res == null) { return(false); } Ancestor = res; } return(true); }
public bool Fits(StatePrimitive primitiveState) { if (HasAncestor) { if (!primitiveState.CanBeImplicitlyConvertedTo(Ancestor)) { return(false); } } if (HasDescendant) { if (!Descedant.CanBeImplicitlyConvertedTo(primitiveState)) { return(false); } } if (IsComparable && !primitiveState.IsComparable) { return(false); } return(true); }
public bool CanBeImplicitlyConvertedTo(StatePrimitive type) => type.Equals(StatePrimitive.Any);
public bool Apply(IStateCombination2dimensionalVisitor visitor, TicNode ancestorNode, TicNode descendantNode, StatePrimitive ancestor) => visitor.Apply(ancestor, this, ancestorNode, descendantNode);
public StatePrimitive GetFirstCommonDescendantOrNull(StatePrimitive other) => FcdMap[this.Order, other.Order];
public ConstrainsState(ITypeState desc = null, StatePrimitive anc = null) { Descedant = desc; Ancestor = anc; }