public Term(string op, Term t, OType ot, int prec) { _functor = op; args = new Term[1]; args[0] = t; arity = 1; fType = FType.comp; oType = ot; precedence = (short)prec; }
public Term(string op, OType ot, int prec) { _functor = op; fType = FType.atom; oType = ot; precedence = (short)prec; }
public Term(string s) { _functor = s; fType = FType.atom; }
public Term(string op, Term a1, Term a2, FType ft, OType ot, int prec) { _functor = op; args = new Term[2]; args[0] = a1; args[1] = a2; arity = 2; fType = ft; // comp or dcg oType = ot; precedence = (short)prec; }
// don't quote numbers if atomic public static string MakeAtom_ic(string a, bool atomic, out FType fType) { fType = FType.atom; if (a == null) PrologIO.Error("MakeAtom_ic -- got null-argument"); if (a == "") return ""; if (Char.IsLower(a[0])) { foreach (char c in a.ToCharArray()) if (!(c == '_' || Char.IsLetterOrDigit(c))) return '\'' + a + '\''; } else if (Char.IsDigit(a[0])) { { bool isNumber = true; bool hasDot = false; foreach (char c in a.ToCharArray()) { if (c == '.') { if (hasDot) { isNumber = false; break; } else hasDot = true; } else if (!Char.IsDigit(c)) { isNumber = false; break; } } if (isNumber) fType = FType.number; return (isNumber && atomic) ? a : '\'' + a + '\''; } } else { foreach (char d in a.ToCharArray()) if (!(Globals.SpecialAtomChars.IndexOf(d) >= 0)) return '\'' + a + '\''; } return a; }
private void typeDiff_Checked(object sender, RoutedEventArgs e) { searchType = FType.DIFF; }
public Term(TimeSpan ts) { _functor = ts; fType = FType.timespan; }
public Term(ClauseNode c) // Create a Term from a ClauseNode (= Head + Body) { if (c.NextNode == null) // fact { Term t = c.Term; _functor = t._functor; arity = t.arity; args = t.args; varNo = t.varNo; ULink = t.ULink; fType = t.fType; oType = t.oType; oDescr = t.oDescr; precedence = t.precedence; hasValue = t.hasValue; isUnified = t.isUnified; isPacked = t.isPacked; } else { _functor = Parser.IMPLIES; arity = 2; args = new Term[2]; args[0] = c.Term; fType = FType.comp; oType = OType.xfx; args[1] = TermSeq(c.NextNode); precedence = 1200; } }
public Term(OperandValue e) { _functor = e.Value; fType = e.FType; }
public Term(DateTime dt) { _functor = dt; fType = FType.datetime; }
public Term(string s, FType ft) { if (ft == FType.number) _functor = Decimal.Parse(s, Globals.CI); else _functor = s; fType = ft; }
public Term(object _f, short ar, FType ft, OType ot, short prec) // used only bye CleanCopy and CleanUpEx { _functor = _f; arity = ar; args = new Term[arity]; fType = ft; oType = ot; precedence = prec; }
private void doReflect() { // if the ftype is non-null, that means it was passed in non-hollow // ftype (in-memory compile), otherwise we need to read it from the pod if (m_ftype.m_hollow) { try { m_ftype.read(); } catch (IOException e) { Err.dumpStack(e); throw IOErr.make("Cannot read " + m_qname + " from pod", e).val; } } // these are working accumulators used to build the // data structures of my defined and inherited slots List slots = new List(Sys.SlotType, 64); Hashtable nameToSlot = new Hashtable(); // String -> Slot Hashtable nameToIndex = new Hashtable(); // String -> Long // merge in base class and mixin classes for (int i = 0; i < m_mixins.sz(); i++) { merge((Type)m_mixins.get(i), slots, nameToSlot, nameToIndex); } merge(m_base, slots, nameToSlot, nameToIndex); // merge in all my slots FPod fpod = this.m_pod.fpod; FType ftype = this.m_ftype; for (int i = 0; i < ftype.m_fields.Length; i++) { Field f = map(fpod, ftype.m_fields[i]); merge(f, slots, nameToSlot, nameToIndex); } for (int i = 0; i < ftype.m_methods.Length; i++) { Method m = map(fpod, ftype.m_methods[i]); merge(m, slots, nameToSlot, nameToIndex); } // break out into fields and methods List fields = new List(Sys.FieldType, slots.sz()); List methods = new List(Sys.MethodType, slots.sz()); for (int i = 0; i < slots.sz(); i++) { Slot slot = (Slot)slots.get(i); if (slot is Field) { fields.add(slot); } else { methods.add(slot); } } this.m_slots = slots.trim(); this.m_fields = fields.trim(); this.m_methods = methods.trim(); this.m_slotsByName = nameToSlot; this.m_facets = Facets.mapFacets(m_pod, ftype.m_attrs.m_facets); // facets this.m_lineNum = m_ftype.m_attrs.m_lineNum; this.m_sourceFile = m_ftype.m_attrs.m_sourceFile; }
public Term(OperatorDescr od) // Term consisting of an operator only (used at Term construction time only) { string op; int pr; OType ot; if (od.IsDefinedAsInfix(out op, out pr, out ot)) { _functor = od.Name; arity = 2; oType = ot; oDescr = od; precedence = (short)pr; } else if (od.IsDefinedAsPrefix(out op, out pr, out ot)) { _functor = od.Name; arity = 1; oType = ot; oDescr = od; precedence = (short)pr; } else if (od.IsDefinedAsPostfix(out op, out pr, out ot)) { _functor = od.Name; arity = 1; oType = ot; oDescr = od; precedence = (short)pr; } fType = FType.opr; }
public Term(string s, Term[] a) { _functor = s; args = a; arity = (short)a.Length; fType = (arity == 0) ? FType.atom : FType.comp; }
public Term(string op, Term[] terms, FType ft, OType ot, int prec) { _functor = op; arity = (short)terms.Length; args = terms; fType = ft; oType = ot; precedence = (short)prec; }
public Term(string s, Term a) { _functor = s; arity = 1; args = new Term[arity]; args[0] = a; fType = FType.comp; }
public void LoadConfig(FXmlNode config) { _name = config[PTY_NAME]; _className = config[PTY_CLASS]; _class = RClass.Find(_className); }
public Term(string s, OperatorDescr od, Term[] a, OType ot, int prec) { _functor = s; args = a; arity = (short)a.Length; oDescr = od; fType = (arity == 0) ? FType.atom : FType.comp; oType = ot; precedence = (short)prec; }
public static Term DbScalarToTerm(object scalar, FbDbType dbType, FType fType, string dbEntity) { switch (dbType) { case FbDbType.SmallInt: case FbDbType.Decimal: case FbDbType.Integer: case FbDbType.Float: case FbDbType.Numeric: case FbDbType.Double: case FbDbType.BigInt: return new Term (scalar.ToString (), FType.number); case FbDbType.Char: case FbDbType.VarChar: return new Term (Utils.AtomFromVarChar (scalar.ToString ()), FType.atom); case FbDbType.Date: case FbDbType.TimeStamp: return new Term (Convert.ToDateTime (scalar)); case FbDbType.Time: return new Term ((Convert.ToDateTime (scalar)).TimeOfDay); default: IO.Error ("Firebird data type {0} in table/view/stored procedure {1} not supported in Prolog", dbType, dbEntity); return null; } }
private void typeMatch_Checked(object sender, RoutedEventArgs e) { searchType = FType.MATCH; }