internal void Add(Serialisable before, Xformation action) { string file = before.FileName; plan[file] = action; input[file] = before; Files.Add(file); }
public void DeserialiseFromClonedObject(object clone) { Serialisable s = clone as Serialisable; Assert.IsNotNull(s); uid = s.uid; age = s.age; }
internal static void RegisterAction(string title, Serialisable input, Xformation action) { Recommender rec = recs.FirstOrDefault(r => r.Name == title); if (rec == null) { rec = new Recommender(title); recs.Add(rec); _recList.Items.Add(rec.Name); } rec.Add(input, action); }
Serialisable Call(Sym s, Serialisable a) { var f = SFunction.Func.Sum; switch (s) { case Sym.COUNT: f = SFunction.Func.Count; break; case Sym.MAX: f = SFunction.Func.Max; break; case Sym.MIN: f = SFunction.Func.Min; break; } return(new SFunction(f, a)); }
Serialisable CreateIndex(bool primary = false) { var id = MustBeID(); Mustbe(Sym.FOR); var tb = MustBeID(); var cols = Cols(); Serialisable rt = Serialisable.Null; if (lxr.tok == Sym.REFERENCES) { Next(); rt = MustBeID(); } return(new SCreateIndex(id, tb, SBoolean.For(primary), rt, cols)); // ok }
Serialisable[] StockVals(int siid, int wid) { util u = new util(26, 50); var r = new Serialisable[17]; r[0] = new SInteger(siid); r[1] = new SInteger(wid); r[2] = new SNumeric(util.random(10, 100), 4, 0); for (var i = 3; i < 13; i++) { r[i] = GetString(util.randchar(24)); } r[13] = SInteger.Zero; r[14] = SInteger.Zero; r[15] = SInteger.Zero; r[16] = GetString(util.fixStockData(u.NextAString())); return(r); }
Serialisable OneVal() { Serialisable a = Term(); while (lxr.tok == Sym.PLUS || lxr.tok == Sym.MINUS) { SExpression.Op op = SExpression.Op.Or; switch (lxr.tok) { case Sym.PLUS: op = SExpression.Op.Plus; break; case Sym.MINUS: op = SExpression.Op.Minus; break; } Next(); a = new SExpression(a, op, Term()); } return(a); }
public void ExecuteNonQuery(Serialisable s) { s.Put(asy); var b = asy.Receive(); if (b == Types.Exception) { inTransaction = false; } else { switch (s.type) { case Types.SBegin: inTransaction = true; break; case Types.SRollback: case Types.SCommit: inTransaction = false; break; } } }
public void OnAfterDeserialise(params object[] p) { // Reregister with the EntityManager Assert.IsTrue(p.Length > 0 && p[0] is EntityManager); (p[0] as EntityManager).Register(this); // Make sure serialised info is available, deserialise... Assert.IsNotNull(SerialisableInformation); Serialisable s = SerialisableInformation as Serialisable; PersonEntity e; Reset(); foreach (object o in s.entities) { e = new PersonEntity(); e.DeserialiseFromClonedObject(o); SetEntity(ref e); } SerialisableInformation = null; }
public DocArray Get(Serialisable tn) { asy.Write(Types.DescribedGet); tn.Put(asy); asy.Flush(); var b = asy.ReadByte(); if (b == (byte)Types.Exception) { inTransaction = false; asy.GetException(); } if (b == (byte)Types.Done) { description = SDict <int, string> .Empty; var n = asy.rbuf.GetInt(); for (var i = 0; i < n; i++) { description += (i, asy.rbuf.GetString()); } return(new DocArray(asy.rbuf.GetString())); } throw new Exception("??"); }
internal static string PureName(Serialisable thing) => Path.GetFileNameWithoutExtension(thing.FileName);
bool Relation(Serialisable s) { return((s is SExpression e) && e.op >= SExpression.Op.Eql && e.op <= SExpression.Op.Geq); }
public Serialisable Transform(Serialisable serialisable) => Transform(serialisable as Conference);
private static void OnGameStateChanged(IOnlineMultiplayerSessionUserId sessionUserId, Serialisable message) { _gameState = ((GameStateMessage)message).m_State; Main.Logger.Log($"GameState: {_gameState}"); ActionManager.GameStateChange(_gameState); }
public Serialisable Transform(Serialisable serialisable) => Transform(serialisable as Paper);
protected SOrder(SDatabase db, Reader f) : base(Types.SOrder) { col = f._Get(db); desc = f.ReadByte() == 1; }
public SOrder(Serialisable c, bool d) : base(Types.SOrder) { col = c; desc = d; }
internal Sym Next() { if (pushBack != Sym.Null) { tok = pushBack; pos = pushPos ?? 0; ch = pushCh ?? '\0'; pushBack = Sym.Null; return(tok); } while (char.IsWhiteSpace(ch)) { Advance(); } var st = pos; if (ch == '\0') { return(tok = Sym.Null); } if (char.IsDigit(ch)) { var n = Unsigned(); if (ch == '.') { var p = pos; var m = Unsigned(n); var q = pos; var e = 0; if (ch == 'e' || ch == 'E') { Advance(); var esg = 1; if (ch == '-') { esg = -1; } if (ch == '-' || ch == '+') { Advance(); } e = (int)Unsigned() * esg; } val = new SNumeric(m, q - p, q - p - 1 - e); } else { val = new SInteger(n); } return(tok = Sym.LITERAL); } else if (ch == '\'') { st++; for (Advance(); ch != '\0'; Advance()) { if (ch == '\'') { if (Peek() == '\'') { Advance(); } else { break; } } } if (ch == '\0') { throw new Exception("non-terminated string literal"); } Advance(); val = new SString(new string(input, st, pos - st - 1).Replace("''", "'")); return(tok = Sym.LITERAL); } else if (char.IsLetter(ch) || ch == '_') { for (Advance(); char.IsLetterOrDigit(ch) || ch == '_'; Advance()) { ; } var s = new string(input, st, pos - st); var su = s.ToUpper(); for (var t = Sym.ADD; t <= Sym.WHERE; t++) { if (su.CompareTo(t.ToString()) == 0) { switch (t) { case Sym.DATE: if (ch == '\'') { Advance(); val = DateTimeLiteral(); return(tok = Sym.LITERAL); } return(tok = t); case Sym.TIMESPAN: if (ch == '\'') { Advance(); var p = pos; while (ch != '\'') { Advance(); } Advance(); val = new STimeSpan(TimeSpan.Parse(new string(input, p, pos - p - 1))); return(tok = Sym.LITERAL); } return(tok = t); case Sym.FALSE: val = SBoolean.False; return(tok = Sym.LITERAL); case Sym.TRUE: val = SBoolean.True; return(tok = Sym.LITERAL); default: return(tok = t); } } } val = psr.SName(s); return(tok = Sym.ID); } else { switch (ch) { case '.': Advance(); return(tok = Sym.DOT); case '+': Advance(); return(tok = Sym.PLUS); case '-': Advance(); return(tok = Sym.MINUS); case '*': Advance(); return(tok = Sym.TIMES); case '/': Advance(); return(tok = Sym.DIVIDE); case '(': Advance(); return(tok = Sym.LPAREN); case ',': Advance(); return(tok = Sym.COMMA); case ')': Advance(); return(tok = Sym.RPAREN); case '=': Advance(); return(tok = Sym.EQUAL); case ':': Advance(); return(tok = Sym.COLON); case '!': Advance(); if (ch == '=') { Advance(); return(tok = Sym.NEQ); } else { break; } case '<': Advance(); if (ch == '=') { Advance(); return(tok = Sym.LEQ); } return(tok = Sym.LSS); case '>': Advance(); if (ch == '=') { Advance(); return(tok = Sym.GEQ); } return(tok = Sym.GTR); } } throw new Exception("Bad input " + ch + " at " + pos); }
void CheckResults(Serialisable c, string d) { Check(conn.Get(c), new DocArray(d)); }