private ForeignKeyViolationException ForeignKeyViolation(int keySurr) { Obj key = source.store.SurrToValue(keySurr); Obj[] fromTuple = new Obj[] { key, IntObj.Get(source.Lookup(keySurr)) }; return(ForeignKeyViolationException.BinaryUnary(source.relvarName, 1, target.relvarName, fromTuple, key)); }
static IntObj() { for (int i = 0; i < 384; i++) { smallIntObjs[i] = new IntObj(i - 128); } }
//public Transform parentToMoveInstead; private void Reset() { if (intObj == null) { intObj = GetComponent <IntObj>(); } }
public override void Copy(int first, int count, Obj[] array, int destOffset) { int srcOffset = offset + first; for (int i = 0; i < count; i++) { array[destOffset + i] = IntObj.Get(ints[srcOffset + i]); } }
private KeyViolationException Col1KeyViolation(int idx, long value, long otherValue, bool betweenNew) { //## BUG: Stores may contain only part of the value (id(5) -> 5) Obj key = store.SurrToValue(idx); Obj[] tuple1 = new Obj[] { key, IntObj.Get(value) }; Obj[] tuple2 = new Obj[] { key, IntObj.Get(otherValue) }; return(new KeyViolationException(relvarName, KeyViolationException.key_1, tuple1, tuple2, betweenNew)); }
//////////////////////////////////////////////////////////////////////////////// // If the function is successfull, it returns the index of the next token to consume // If it fails, it returns the location/index of the error, negated and decremented by one static long ParseObj(Token[] tokens, long offset, out Obj var) { int length = tokens.Length; if (offset >= length) { var = null; return(-offset - 1); } Token token = tokens[offset]; switch (token.type) { case TokenType.Comma: case TokenType.Colon: case TokenType.Semicolon: case TokenType.Arrow: case TokenType.ClosePar: case TokenType.CloseBracket: var = null; return(-offset - 1); case TokenType.Int: var = IntObj.Get((long)token.value); return(offset + 1); case TokenType.Float: var = new FloatObj((double)token.value); return(offset + 1); case TokenType.Symbol: return(ParseSymbOrTaggedObj(tokens, offset, out var)); case TokenType.OpenPar: if (IsRecord(tokens, offset)) { return(ParseRec(tokens, offset, out var)); } else { return(ParseSeq(tokens, offset, out var)); } case TokenType.OpenBracket: return(ParseUnordColl(tokens, offset, out var)); case TokenType.String: var = Miscellanea.StrToObj((string)token.value); return(offset + 1); default: var = null; throw new InvalidOperationException(); // Unreachable code } }
public static Obj At(long[] array, int size, long idx) { if (idx < size) { return(IntObj.Get(array[(int)idx])); } else { throw ErrorHandler.SoftFail(); } }
public static Obj BuildConstIntSeq(int[] vals) { int len = vals.Length; Obj[] objs = new Obj[len]; for (int i = 0; i < len; i++) { objs[i] = IntObj.Get(vals[i]); } return(new MasterSeqObj(objs)); }
// Inefficient, but used only for debugging public override Obj SurrToValue(int surr) { for (int i = 0; i < count; i++) { if (surrogates[i] == surr) { return(IntObj.Get(values[i])); } } return(IntObj.Get(store.SurrToValue(surr))); }
public static Obj StringToObj(string str) { int[] cps = Miscellanea.CodePoints(str); int len = cps.Length; Obj[] objs = new Obj[len]; for (int i = 0; i < len; i++) { objs[i] = IntObj.Get(cps[i]); } return(new TaggedObj(SymbTable.StringSymbId, new MasterSeqObj(objs))); }
public static Obj GetChar_P(object env) { int ch = Console.Read(); if (ch != -1) { return(new TaggedObj(SymbTable.JustSymbId, IntObj.Get(ch))); } else { return(SymbObj.Get(SymbTable.NothingSymbId)); } }
protected override void OnEnable() { base.OnEnable(); if (intObj == null) { intObj = GetComponent <IntObj>(); } if (intObj != null) { intObj.OnGraspBegin += onGraspBegin; intObj.OnGraspEnd += onGraspEnd; } }
public static Obj StrToObj(string str) { int len = str.Length; Obj[] chars = new Obj[len]; int count = 0; int i = 0; while (i < len) { int ch = Char.ConvertToUtf32(str, i); chars[count++] = IntObj.Get(ch); i += Char.IsSurrogatePair(str, i) ? 2 : 1; } return(new TaggedObj(SymbTable.StringSymbId, new MasterSeqObj(chars, count))); }
public static Obj Parse(Obj text) { byte[] bytes = text.GetInnerObj().GetByteArray(); Obj obj; long errorOffset; bool ok = Parse(bytes, out obj, out errorOffset); if (ok) { return(new TaggedObj(SymbTable.SuccessSymbId, obj)); } else { return(new TaggedObj(SymbTable.FailureSymbId, IntObj.Get(errorOffset))); } }
public override uint Hashcode() { if (hcode == Hashing.NULL_HASHCODE) { long code = 0; int len = GetSize(); for (int i = 0; i < len; i++) { code = 31 * code + IntObj.Hashcode(GetLongAt(i)); } hcode = Hashing.Hashcode64(code); if (hcode == Hashing.NULL_HASHCODE) { hcode++; } } return(hcode); }
public string CastActor(IntObj o) { string connectionString = @"Data Source=rpsdb.cgluvdnfm6uc.us-east-1.rds.amazonaws.com; Initial Catalog=Movies; User ID=admin; Password=password"; SqlConnection con = new SqlConnection(connectionString); string queryString = "insert into casting (castid, actorno, movieno) values (@id, @aNum, @mNum)"; SqlCommand command = new SqlCommand(queryString, con); command.Parameters.AddWithValue("@id", (int)o.ioId); command.Parameters.AddWithValue("@aNum", (int)o.ioAnum); command.Parameters.AddWithValue("@mNum", (int)o.ioMnum); con.Open(); var result = command.ExecuteNonQuery(); return(result.ToString() + " rows updated in Casting table in Movies.sql"); }
public override NeSeqObj Append(long value) { return(Append(IntObj.Get(value))); }
static void Run(int length, int repeat, bool report) { var data = new object[length]; int chk = 0; var watch = Stopwatch.StartNew(); for (int j = 0; j < repeat; j++) { for (int i = 0; i < data.Length; i++) { data[i] = i; chk += i; } } watch.Stop(); if (report) { Console.WriteLine("Box: {0}ms (chk: {1})", watch.ElapsedMilliseconds, chk); } chk = 0; watch = Stopwatch.StartNew(); for (int j = 0; j < repeat; j++) { for (int i = 0; i < data.Length; i++) { chk += (int)data[i]; } } watch.Stop(); if (report) { Console.WriteLine("Unbox: {0}ms (chk: {1})", watch.ElapsedMilliseconds, chk); } chk = 0; watch = Stopwatch.StartNew(); for (int j = 0; j < repeat; j++) { for (int i = 0; i < data.Length; i++) { data[i] = new IntObj(i); chk += i; } } watch.Stop(); if (report) { Console.WriteLine("Wrap: {0}ms (chk: {1})", watch.ElapsedMilliseconds, chk); } chk = 0; watch = Stopwatch.StartNew(); for (int j = 0; j < repeat; j++) { for (int i = 0; i < data.Length; i++) { chk += ((IntObj)data[i]).Value; } } watch.Stop(); if (report) { Console.WriteLine("Unwrap: {0}ms (chk: {1})", watch.ElapsedMilliseconds, chk); } }
public override Obj GetObjAt(long idx) { return(IntObj.Get(GetLongAt(idx))); }
////////////////////////////////////////////////////////////////////////////// private ForeignKeyViolationException ForeignKeyViolation(int keySurr, long value) { Obj[] tuple = new Obj[] { source.store.SurrToValue(keySurr), IntObj.Get(value) }; return(ForeignKeyViolationException.BinaryUnary(source.relvarName, 1, target.relvarName, tuple)); }
////////////////////////////////////////////////////////////////////////////// public static Obj Copy(ColumnBase[] columns, bool flipCols) { int totalSize = 0; for (int i = 0; i < columns.Length; i++) { totalSize += columns[i].count; } if (totalSize == 0) { return(EmptyRelObj.singleton); } Obj[] objs1 = new Obj[totalSize]; Obj[] objs2 = new Obj[totalSize]; int next = 0; for (int i = 0; i < columns.Length; i++) { ColumnBase col = columns[i]; if (col is IntColumn) { IntColumn intCol = (IntColumn)col; IntColumn.Iter it = intCol.GetIter(); while (!it.Done()) { objs1[next] = intCol.mapper(it.GetIdx()); objs2[next] = IntObj.Get(it.GetValue()); next++; it.Next(); } } else if (col is FloatColumn) { FloatColumn floatCol = (FloatColumn)col; FloatColumn.Iter it = floatCol.GetIter(); while (!it.Done()) { objs1[next] = floatCol.mapper(it.GetIdx()); objs2[next] = new FloatObj(it.GetValue()); next++; it.Next(); } } else { ObjColumn objCol = (ObjColumn)col; ObjColumn.Iter it = objCol.GetIter(); while (!it.Done()) { objs1[next] = objCol.mapper(it.GetIdx()); objs2[next] = it.GetValue(); next++; it.Next(); } } } Debug.Assert(next == totalSize); if (flipCols) { Obj[] tmp = objs1; objs1 = objs2; objs2 = tmp; } return(Builder.CreateBinRel(objs1, objs2)); }
public override uint Hashcode() { return(Hashing.Hashcode(SymbObj.Get(GetTagId()).Hashcode(), IntObj.Hashcode(GetInnerLong()))); }
public void Animate(IntObj a, IntObj b, AnimateFlag flag) { }
override public Obj AsObj() { return(IntObj.Get(value)); }
public void Animate(IntObj a, IntObj b, AnimateFlag flag) { throw new NotImplementedException(); }
public override Obj GetInnerObj() { return(IntObj.Get(GetInnerLong())); }