public override IValue Evaluate() { var expr = _expression.Evaluate(); if (expr == null) { return null; } if (expr.ValueType == ValueType.Decimal) { return new DecimalValue(Math.Truncate(expr.AsDecimal)); } else if (expr.ValueType == ValueType.String) { return new DecimalValue(Math.Truncate(expr.AsDecimal)); } else if (expr.ValueType == ValueType.Date) { var truncated = new DecimalValue(Math.Truncate(expr.AsDecimal)); return new DateValue(truncated.AsDate); } else { return new DecimalValue(expr.AsDecimal); } }
public void TestMantissaAndExponent() { var value = new DecimalValue(9427.55); AssertEquals(942755, value.Mantissa); AssertEquals(-2, value.Exponent); value = new DecimalValue(942755, -2); AssertEquals(((decimal) 9427.55), value.ToBigDecimal()); }
public static void AssertStateIsValid(this BalanceDto balance) { balance.Should().NotBeNull(); balance.CurrencyType.Should().NotBeNull(); (balance.Available >= DecimalValue.FromDecimal(decimal.Zero)).Should().BeTrue(); (balance.Pending >= DecimalValue.FromDecimal(decimal.Zero)).Should().BeTrue(); }
public void TestMantissaAndExponent() { var value = new DecimalValue(9427.55); var ret = value.Mantissa.ToString(System.Globalization.CultureInfo.InvariantCulture); Assert.AreEqual("942755", ret); AssertEquals(-2, value.Exponent); value = new DecimalValue(942755, -2); AssertEquals(((decimal)9427.55), value.ToBigDecimal()); }
private static IValue convertDouble(string value) { try { return(DecimalValue.Parse(value)); } catch (FormatException) { return(convertBoolean(value)); } }
public override string ToString() { try { Type propType = !IsTie ? AnchorAttributePropertyInfo.PropertyType : TieValueType; if (propType.Equals(typeof(int)) || propType.Equals(typeof(long)) || propType.Equals(typeof(byte))) { return LongValue.ToString(); } else if (propType.Equals(typeof(float)) || propType.Equals(typeof(double))) { return DoubleValue.ToString(); } else if (propType.Equals(typeof(decimal))) { return DecimalValue.ToString(); } else if (propType.Equals(typeof(string))) { return StringValue; } else if (propType.Equals(typeof(bool))) { return BoolValue.ToString(); } else if (propType.Equals(typeof(DateTime))) { return TimeValue.ToString(); } else if (propType.Equals(typeof(Guid))) { return TimeValue.ToString(); } else { return base.ToString(); } } catch { //TODO : write to logger return null; } }
public void Decimal_Equals() // Faster: 1.01, 1.02, 1.01 { const decimal zero = 0.0m; for (var i = 0; i < NbIterations; i++) { _consumer.Consume(DecimalValue.Equals(DecimalValue)); _consumer.Consume(DecimalValue.Equals(zero)); _consumer.Consume(zero.Equals(zero)); _consumer.Consume(zero.Equals(DecimalValue)); } }
public void JsonResult_SerializeData_Good() { var data = new RowSetCollectionData(); var rowset1 = new RowSetData(); data.AddRowSet(rowset1); var row11 = new AtomCollectionData(); row11.AddAtom(new AtomData(Name11, StringValue)); rowset1.AddRow(row11); var row12 = new AtomCollectionData(); row12.AddAtom(new AtomData(Name11, DecimalValue)); rowset1.AddRow(row12); var row13 = new AtomCollectionData(); row13.AddAtom(new AtomData(Name11, IntegerValue)); rowset1.AddRow(row13); var rowset2 = new RowSetData(); data.AddRowSet(rowset2); var row21 = new AtomCollectionData(); row21.AddAtom(new AtomData(Name21, StringValue)); row21.AddAtom(new AtomData(Name22, DecimalValue)); row21.AddAtom(new AtomData(Name23, IntegerValue)); rowset2.AddRow(row21); using (var writer = new StringWriter()) { _serializer.SerializeData(writer, data); var text = writer.ToString(); Console.WriteLine(text); Assert.AreEqual("{:[[{:}{:}{:}][{:::}]]}", Skeletonize(text, "[]{}:")); Assert.AreEqual(1, GetOccurrenceCount(DataName, text)); Assert.AreEqual(0, GetOccurrenceCount(ErrorName, text)); Assert.AreEqual(3, GetOccurrenceCount(Name11, text)); Assert.AreEqual(1, GetOccurrenceCount(Name21, text)); Assert.AreEqual(1, GetOccurrenceCount(Name22, text)); Assert.AreEqual(1, GetOccurrenceCount(Name23, text)); Assert.AreEqual(2, GetOccurrenceCount(StringValue, text)); Assert.AreEqual(2, GetOccurrenceCount(DecimalValue.ToString(CultureInfo.InvariantCulture), text)); Assert.AreEqual(2, GetOccurrenceCount(IntegerValue.ToString(CultureInfo.InvariantCulture), text)); } }
public void TestDecimalConstructors() { var dec1 = new DecimalValue(1.2M); var dec2 = new DecimalValue(1.2D); var dec3 = new DecimalValue(12, -1); var dec4 = new DecimalValue(10000000000.00000000001M); Assert.AreEqual(1.2M, dec1.ToBigDecimal()); Assert.AreEqual(1.2M, dec2.ToBigDecimal()); Assert.AreEqual(1.2M, dec3.ToBigDecimal()); Assert.AreEqual(10000000000.00000000001M, dec4.ToBigDecimal()); }
public void Bug520719() { // the following test should pass without Assert() in debug version. var int8 = new SByteValue(); int8.InnerText = "+10"; Assert.Equal(10, int8.Value); Assert.Equal("+10", int8.InnerText); var int16 = new Int16Value(); int16.InnerText = "+10"; Assert.Equal(10, int16.Value); Assert.Equal("+10", int16.InnerText); var int32 = new Int32Value(); int32.InnerText = "+10"; Assert.Equal(10, int32.Value); Assert.Equal("+10", int32.InnerText); var int64 = new Int64Value(); int64.InnerText = "+10"; Assert.Equal(10, int64.Value); Assert.Equal("+10", int64.InnerText); var integer = new IntegerValue(); integer.InnerText = "+10"; Assert.Equal(10, integer.Value); Assert.Equal("+10", integer.InnerText); var dec = new DecimalValue(); dec.InnerText = "+10"; Assert.Equal(10, dec.Value); Assert.Equal("+10", dec.InnerText); var single = new SingleValue(); single.InnerText = "+10"; Assert.Equal(10, single.Value); Assert.Equal("+10", single.InnerText); var dble = new DoubleValue(); dble.InnerText = "+10"; Assert.Equal(10, dble.Value); Assert.Equal("+10", dble.InnerText); }
public override ScalarValue Decode(Stream inStream) { int exponent = ((IntegerValue)Integer.Decode(inStream)).Value; if (Math.Abs(exponent) > 63) { Global.ErrorHandler.OnError(null, RepError.LargeDecimal, "Encountered exponent of size {0}", exponent); } long mantissa = Integer.Decode(inStream).ToLong(); var decimalValue = new DecimalValue(mantissa, exponent); return(decimalValue); }
public override ScalarValue Decode(System.IO.Stream in_Renamed) { int exponent = ((IntegerValue)INTEGER.Decode(in_Renamed)).value_Renamed; if (Math.Abs(exponent) > 63) { Global.HandleError(Error.FastConstants.R1_LARGE_DECIMAL, "Encountered exponent of size " + exponent); } long mantissa = INTEGER.Decode(in_Renamed).ToLong(); var decimalValue = new DecimalValue(mantissa, exponent); return(decimalValue); }
public override ScalarValue Decode(System.IO.Stream in_Renamed) { int exponent = ((IntegerValue) INTEGER.Decode(in_Renamed)).value_Renamed; if (Math.Abs(exponent) > 63) { Global.HandleError(Error.FastConstants.R1_LARGE_DECIMAL, "Encountered exponent of size " + exponent); } long mantissa = INTEGER.Decode(in_Renamed).ToLong(); var decimalValue = new DecimalValue(mantissa, exponent); return decimalValue; }
public ObjectBase VisitNumberNode(NumberNode node) { if (node.token.value.GetType() == typeof(Int32)) { var intNumber = new Integer(node.token.value); intNumber.SetPosition(node.start, node.end); return(intNumber); } var number = new DecimalValue(node.token.value); number.SetPosition(node.start, node.end); return(number); }
public override ScalarValue Decode(Stream inStream) { int exponent = ((IntegerValue) Integer.Decode(inStream)).Value; if (Math.Abs(exponent) > 63) { Global.ErrorHandler.OnError(null, RepError.LargeDecimal, "Encountered exponent of size {0}", exponent); } long mantissa = Integer.Decode(inStream).ToLong(); var decimalValue = new DecimalValue(mantissa, exponent); return decimalValue; }
public override ScalarValue Decode(Stream inStream) { ScalarValue exp = NullableInteger.Decode(inStream); if ((exp == null) || exp.IsNull) { return(null); } int exponent = exp.ToInt(); long mantissa = Integer.Decode(inStream).ToLong(); var decimalValue = new DecimalValue(mantissa, exponent); return(decimalValue); }
public override ScalarValue Decode(System.IO.Stream in_Renamed) { ScalarValue exp = NULLABLE_INTEGER.Decode(in_Renamed); if ((exp == null) || exp.Null) { return null; } int exponent = exp.ToInt(); long mantissa = INTEGER.Decode(in_Renamed).ToLong(); var decimalValue = new DecimalValue(mantissa, exponent); return decimalValue; }
public override ScalarValue Decode(Stream inStream) { ScalarValue exp = NullableInteger.Decode(inStream); if ((exp == null) || exp.IsNull) { return null; } int exponent = exp.ToInt(); long mantissa = Integer.Decode(inStream).ToLong(); var decimalValue = new DecimalValue(mantissa, exponent); return decimalValue; }
public override ScalarValue Decode(System.IO.Stream in_Renamed) { ScalarValue exp = NULLABLE_INTEGER.Decode(in_Renamed); if ((exp == null) || exp.Null) { return(null); } int exponent = exp.ToInt(); long mantissa = INTEGER.Decode(in_Renamed).ToLong(); var decimalValue = new DecimalValue(mantissa, exponent); return(decimalValue); }
private ApplicantProfilePoco ToPoco(ApplicantProfileReply reply) { return(new ApplicantProfilePoco() { Id = Guid.Parse(reply.Id), Login = Guid.Parse(reply.Login), CurrentSalary = (DecimalValue.ToDecimal(reply.CurrentSalary)), CurrentRate = (DecimalValue.ToDecimal(reply.CurrentRate)), Currency = reply.Currency, Country = reply.Country, Province = reply.Province, Street = reply.Street, City = reply.City, PostalCode = reply.PostalCode }); }
public override int GetHashCode() { unchecked { var result = GuidValue.GetHashCode(); result = (result * 397) ^ (StringValue != null ? StringValue.GetHashCode() : 0); result = (result * 397) ^ IntValue; result = (result * 397) ^ LongValue.GetHashCode(); result = (result * 397) ^ BoolValue.GetHashCode(); result = (result * 397) ^ ByteValue.GetHashCode(); result = (result * 397) ^ DecimalValue.GetHashCode(); result = (result * 397) ^ DoubleValue.GetHashCode(); result = (result * 397) ^ DateTimeValue.GetHashCode(); result = (result * 397) ^ MaybeMoney.GetHashCode(); return(result); } }
public void TestLookupMultipleValuesForTemplate() { Dictionary dictionary = new TemplateDictionary(); Group template = new MessageTemplate("Position", new Field[] { new Scalar("exchange", FASTType.STRING, Operator.COPY, ScalarValue.UNDEFINED, false) }); ScalarValue value = new StringValue("NYSE"); ScalarValue marketValue = new DecimalValue(100000.00); dictionary.Store(template, FastConstants.ANY_TYPE, new QName("exchange"), value); dictionary.Store(template, FastConstants.ANY_TYPE, new QName("marketValue"), marketValue); Assert.IsFalse(value.Equals(ScalarValue.UNDEFINED)); Assert.AreEqual(value, dictionary.Lookup(template, new QName("exchange"), FastConstants.ANY_TYPE)); Assert.AreEqual(marketValue, dictionary.Lookup(template, new QName("marketValue"), FastConstants.ANY_TYPE)); }
public async Task HandleAsync_WhenChallengeParticipantRegisteredIntegrationEventIsValid_ShouldBeCompletedTask() { // Arrange var participantId = new ParticipantId(); TestMock.UserService.Setup(userService => userService.SendEmailAsync(It.IsAny <UserId>(), It.IsAny <string>(), It.IsAny <object>())) .Returns(Task.CompletedTask) .Verifiable(); var handler = new ChallengeParticipantRegisteredIntegrationEventHandler(TestMock.UserService.Object, TestMock.SendgridOptions.Object); var integrationEvent = new ChallengeParticipantRegisteredIntegrationEvent { Participant = new ChallengeParticipantDto { ChallengeId = new ChallengeId(), GamePlayerId = "testId", Id = participantId, Score = new DecimalValue(50.0m), SynchronizedAt = DateTime.UtcNow.ToTimestamp(), UserId = new UserId(), Matches = { new ChallengeMatchDto { Id = new MatchId(), ParticipantId = participantId, Score = DecimalValue.FromDecimal(10) }, new ChallengeMatchDto { Id = new MatchId(), ParticipantId = participantId, Score = DecimalValue.FromDecimal(10) } } } }; // Act await handler.HandleAsync(integrationEvent); // Assert TestMock.UserService.Verify(userService => userService.SendEmailAsync(It.IsAny <UserId>(), It.IsAny <string>(), It.IsAny <object>()), Times.Once); }
public void TestLookupMultipleValuesForTemplate() { IDictionary dictionary = new TemplateDictionary(); Group template = new MessageTemplate( "Position", new Field[] { new Scalar("exchange", FastType.String, Operator.Copy, ScalarValue.Undefined, false) }); ScalarValue value = new StringValue("NYSE"); ScalarValue marketValue = new DecimalValue(100000.00); dictionary.Store(template, new QName("exchange"), FastConstants.AnyType, value); dictionary.Store(template, new QName("marketValue"), FastConstants.AnyType, marketValue); Assert.AreNotEqual(ScalarValue.Undefined, value); Assert.AreEqual(value, dictionary.Lookup(template, new QName("exchange"), FastConstants.AnyType)); Assert.AreEqual(marketValue, dictionary.Lookup(template, new QName("marketValue"), FastConstants.AnyType)); }
public override string ToString() { switch (Type) { case PrimitiveType.IntegerLong: return(LongValue.ToString(CultureInfo.InvariantCulture)); case PrimitiveType.IntegerBig: return(BigIntegerValue.ToString(CultureInfo.InvariantCulture)); case PrimitiveType.Decimal: return(DecimalValue.ToString(CultureInfo.InvariantCulture)); default: Debug.Fail($"Cannot handle unknown primitive type {Type}."); return(null); } }
public void ReadRow_AutoMappedDecimal_Success() { using (var importer = Helpers.GetImporter("Doubles.xlsx")) { ExcelSheet sheet = importer.ReadSheet(); sheet.ReadHeading(); // Valid cell value. DecimalValue row1 = sheet.ReadRow <DecimalValue>(); Assert.Equal(2.2345m, row1.Value); // Empty cell value. Assert.Throws <ExcelMappingException>(() => sheet.ReadRow <DecimalValue>()); // Invalid cell value. Assert.Throws <ExcelMappingException>(() => sheet.ReadRow <DecimalValue>()); } }
private async Task <CartItemDTO> GenerateCartItemDto(CartItem cartItem) { var cartItemDto = new CartItemDTO { Id = cartItem.Id.ToString(), Quantity = (uint)cartItem.Quantity, AddedAt = cartItem.AddedAt.ToString(), ProductId = cartItem.ProductId.ToString() }; var productDto = await GetProductDtoFromProductId(Guid.Parse(cartItemDto.ProductId)); cartItemDto.Product = productDto; var itemSubTotalAmount = cartItemDto.Quantity * cartItemDto.Product.PriceValue.ToDecimal(); cartItemDto.ItemSubTotalAmount = DecimalValue.FromDecimal(itemSubTotalAmount); return(cartItemDto); }
public override string ToString() { switch (ValueType) { case (int)PropertyValueType.Boolean: return(BooleanValue.ToString()); case (int)PropertyValueType.DateTime: return(DateTimeValue.Value.ToString("d")); case (int)PropertyValueType.Number: return(DecimalValue.ToString()); case (int)PropertyValueType.LongText: return(LongTextValue); default: return(ShortTextValue); } }
private ApplicantProfileReply FromPoco(ApplicantProfilePoco poco) { return(new ApplicantProfileReply() { Id = poco.Id.ToString(), Login = poco.Login.ToString(), CurrentSalary = poco.CurrentSalary == null? DecimalValue.FromDecimal(0) : DecimalValue.FromDecimal((decimal)poco.CurrentSalary), CurrentRate = poco.CurrentRate == null? DecimalValue.FromDecimal(0) : DecimalValue.FromDecimal((decimal)poco.CurrentRate), Currency = poco.Currency, Country = poco.Country, Province = poco.Province, Street = poco.Street, City = poco.City, PostalCode = poco.PostalCode }); }
static Constants() { BoolValue = true; DateTimeValue = DateTime.Parse(DateTime.MaxValue.ToString(), CultureInfo.InvariantCulture); DecimalValue = Decimal.MaxValue; GuidValue = Guid.NewGuid(); Int16Value = Int16.MaxValue; Int32Value = Int32.MaxValue; Int64Value = Int64.MaxValue; StringValue = Guid.NewGuid().ToString(); NullableInt64Value = Int64.MaxValue; BoolStringValue = BoolValue.ToString(); DateTimeStringValue = DateTimeValue.ToString(); DecimalStringValue = DecimalValue.ToString(); GuidStringValue = GuidValue.ToString(); Int16StringValue = Int16Value.ToString(); Int32StringValue = Int32Value.ToString(); Int64StringValue = Int64Value.ToString(); NullableInt64StringValue = NullableInt64Value.ToString(); }
public override int GetHashCode() { unchecked { var hashCode = CharValue.GetHashCode(); hashCode = (hashCode * 397) ^ ByteValue.GetHashCode(); hashCode = (hashCode * 397) ^ SByteValue.GetHashCode(); hashCode = (hashCode * 397) ^ ShortValue.GetHashCode(); hashCode = (hashCode * 397) ^ UShortValue.GetHashCode(); hashCode = (hashCode * 397) ^ IntValue; hashCode = (hashCode * 397) ^ (int)UIntValue; hashCode = (hashCode * 397) ^ LongValue.GetHashCode(); hashCode = (hashCode * 397) ^ ULongValue.GetHashCode(); hashCode = (hashCode * 397) ^ FloatValue.GetHashCode(); hashCode = (hashCode * 397) ^ DoubleValue.GetHashCode(); hashCode = (hashCode * 397) ^ DecimalValue.GetHashCode(); hashCode = (hashCode * 397) ^ DateTimeValue.GetHashCode(); hashCode = (hashCode * 397) ^ GuidValue.GetHashCode(); hashCode = (hashCode * 397) ^ StringValue.GetHashCode(); return(hashCode); } }
public void ReadRow_CustomMappedDecimal_Success() { using (var importer = Helpers.GetImporter("Doubles.xlsx")) { importer.Configuration.RegisterClassMap <DecimalValueFallbackMap>(); ExcelSheet sheet = importer.ReadSheet(); sheet.ReadHeading(); // Valid cell value. DecimalValue row1 = sheet.ReadRow <DecimalValue>(); Assert.Equal(2.2345m, row1.Value); // Empty cell value. DecimalValue row2 = sheet.ReadRow <DecimalValue>(); Assert.Equal(-10, row2.Value); // Invalid cell value. DecimalValue row3 = sheet.ReadRow <DecimalValue>(); Assert.Equal(10, row3.Value); } }
public string GetFieldName() { string table = GetTableReferenceString(); switch (_type) { case HqlFieldType.STAR: return(table + "*"); case HqlFieldType.FIELDNUM: return(table + String.Format("field{0}", _start + 1)); case HqlFieldType.FIXEDWIDTH: return(table + String.Format("{0}({1}, {2})", _name, _start + 1, _length)); case HqlFieldType.LITERAL_STRING: return(String.Format("'{0}'", _name)); case HqlFieldType.FUNCTION: return(Func.GetFieldName()); case HqlFieldType.SCALAR: return(Scalar.GetFieldName()); case HqlFieldType.LITERAL_INT: return(IntValue.ToString()); case HqlFieldType.LITERAL_FLOAT: return(DecimalValue.ToString()); case HqlFieldType.ROWNUM: return(table + "rownum"); case HqlFieldType.FILENAME: return(table + "filename"); } return("UNKNOWN_FIELD"); }
public override Task <Empty> AddGetApplicantProfiles(ApplicantProfiles request, ServerCallContext context) { List <ApplicantProfilePoco> pocos = new List <ApplicantProfilePoco>(); foreach (ApplicantProfileReply reply in request.ApplicantProfileReplies) { pocos.Add( new ApplicantProfilePoco() { Login = Guid.Parse(reply.Login), CurrentSalary = (DecimalValue.ToDecimal(reply.CurrentSalary)), CurrentRate = (DecimalValue.ToDecimal(reply.CurrentRate)), Currency = reply.Currency, Country = reply.Country, Province = reply.Province, Street = reply.Street, City = reply.City, PostalCode = reply.PostalCode }); } _logic.Add(pocos.ToArray()); return(Task.FromResult <Empty>(null)); }
public override string ToString() { switch (ValueType) { case (int)PropertyValueType.Boolean: return(BooleanValue.ToString()); case (int)PropertyValueType.DateTime: return(DateTimeValue.ToString()); case (int)PropertyValueType.Decimal: return(DecimalValue.ToString()); case (int)PropertyValueType.Integer: return(IntegerValue.ToString()); case (int)PropertyValueType.LongString: return(LongTextValue); case (int)PropertyValueType.ShortString: return(ShortTextValue); } return(base.ToString()); }
/// <summary> /// Handles the Click event of the ConvertToDecimal control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void ConvertToDecimal_Click(object sender, EventArgs e) { ErrorLabel.Text = ""; //clears the error label Base = IntBaseBox.Text; //obtains base value to be converted BaseValue = (int)BaseUpDown.Value; //obtains base to be used in conversion //attempt the conversion try { //if the base box is empty, throw exception if (IntBaseBox.Text.Equals("")) { throw new Exception("Error! Must enter a base value in order to convert!"); } DecimalValue = BaseConverter.ToDecimal(); //converts to the appropriate decimal value DecimalBox.Text = DecimalValue.ToString(); //converts value to a string and sets the text field } catch (Exception ex) { ErrorLabel.Text = ex.Message; //display error if one is thrown } BaseValueLabel.Text = String.Format("Integer Value in Base {0}", BaseValue); //reset the base value label }
/** the generated parser. Maintains a state and a value stack, currently with fixed maximum size. @param yyLex scanner. @return result of the last reduction, if any. @throws yyException on irrecoverable parse error. */ public Object yyparse (yyParser.yyInput yyLex) { if (yyMax <= 0) yyMax = 256; // initial size int yyState = 0; // state stack ptr int [] yyStates = new int[yyMax]; // state stack Object yyVal = null; // value stack ptr Object [] yyVals = new Object[yyMax]; // value stack int yyToken = -1; // current input int yyErrorFlag = 0; // #tks to shift int yyTop = 0; goto skip; yyLoop: yyTop++; skip: for (;; ++ yyTop) { if (yyTop >= yyStates.Length) { // dynamically increase int[] i = new int[yyStates.Length+yyMax]; yyStates.CopyTo (i, 0); yyStates = i; Object[] o = new Object[yyVals.Length+yyMax]; yyVals.CopyTo (o, 0); yyVals = o; } yyStates[yyTop] = yyState; yyVals[yyTop] = yyVal; //t if (debug != null) debug.push(yyState, yyVal); yyDiscarded: for (;;) { // discarding a token does not change stack int yyN; if ((yyN = yyDefRed[yyState]) == 0) { // else [default] reduce (yyN) if (yyToken < 0) { yyToken = yyLex.advance() ? yyLex.token() : 0; //t if (debug != null) //t debug.lex(yyState, yyToken, yyname(yyToken), yyLex.value()); } if ((yyN = yySindex[yyState]) != 0 && ((yyN += yyToken) >= 0) && (yyN < yyTable.Length) && (yyCheck[yyN] == yyToken)) { //t if (debug != null) //t debug.shift(yyState, yyTable[yyN], yyErrorFlag-1); yyState = yyTable[yyN]; // shift to yyN yyVal = yyLex.value(); yyToken = -1; if (yyErrorFlag > 0) -- yyErrorFlag; goto yyLoop; } if ((yyN = yyRindex[yyState]) != 0 && (yyN += yyToken) >= 0 && yyN < yyTable.Length && yyCheck[yyN] == yyToken) yyN = yyTable[yyN]; // reduce (yyN) else switch (yyErrorFlag) { case 0: yyerror("syntax error", yyExpecting(yyState)); //t if (debug != null) debug.error("syntax error"); goto case 1; case 1: case 2: yyErrorFlag = 3; do { if ((yyN = yySindex[yyStates[yyTop]]) != 0 && (yyN += Token.yyErrorCode) >= 0 && yyN < yyTable.Length && yyCheck[yyN] == Token.yyErrorCode) { //t if (debug != null) //t debug.shift(yyStates[yyTop], yyTable[yyN], 3); yyState = yyTable[yyN]; yyVal = yyLex.value(); goto yyLoop; } //t if (debug != null) debug.pop(yyStates[yyTop]); } while (-- yyTop >= 0); //t if (debug != null) debug.reject(); throw new yyParser.yyException("irrecoverable syntax error"); case 3: if (yyToken == 0) { //t if (debug != null) debug.reject(); throw new yyParser.yyException("irrecoverable syntax error at end-of-file"); } //t if (debug != null) //t debug.discard(yyState, yyToken, yyname(yyToken), //t yyLex.value()); yyToken = -1; goto yyDiscarded; // leave stack alone } } int yyV = yyTop + 1-yyLen[yyN]; //t if (debug != null) //t debug.reduce(yyState, yyStates[yyV-1], yyN, yyRule[yyN], yyLen[yyN]); yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]); switch (yyN) { case 1: #line 345 "SQL92-min.y" { notation.ConfirmTag(Tag.Stmt, Descriptor.Root, yyVals[0+yyTop]); yyVal = notation.ResolveTag(Tag.Stmt); if (yyVals[-1+yyTop] != null) notation.Confirm((Symbol)yyVal, Descriptor.OptimizerHint, yyVals[-1+yyTop]); } break; case 2: #line 352 "SQL92-min.y" { notation.ConfirmTag(Tag.Stmt, Descriptor.Root, yyVals[-1+yyTop]); notation.ConfirmTag(Tag.Stmt, Descriptor.Order, yyVals[0+yyTop]); yyVal = notation.ResolveTag(Tag.Stmt); if (yyVals[-2+yyTop] != null) notation.Confirm((Symbol)yyVal, Descriptor.OptimizerHint, yyVals[-2+yyTop]); } break; case 3: #line 363 "SQL92-min.y" { yyVal = yyVals[0+yyTop]; } break; case 4: #line 371 "SQL92-min.y" { Symbol sym = new Symbol(Tag.Predicate); yyVal = notation.Confirm(sym, Descriptor.Between, yyVals[-5+yyTop], yyVals[-2+yyTop], yyVals[0+yyTop]); if (yyVals[-4+yyTop] != null) notation.Confirm(sym, Descriptor.Inverse); } break; case 5: #line 381 "SQL92-min.y" { yyVal = null; } break; case 10: #line 398 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Expr), Descriptor.NullIf, yyVals[-3+yyTop], yyVals[-1+yyTop]); } break; case 11: #line 406 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Expr), Descriptor.Coalesce, yyVals[-1+yyTop]); } break; case 12: #line 414 "SQL92-min.y" { yyVal = Lisp.Cons(yyVals[0+yyTop]); } break; case 13: #line 418 "SQL92-min.y" { yyVal = Lisp.Append(yyVals[-2+yyTop], Lisp.Cons(yyVals[0+yyTop])); } break; case 22: #line 449 "SQL92-min.y" { Symbol sym = new Symbol(Tag.CExpr); if (yyVals[-1+yyTop] == null) yyVal = notation.Confirm(sym, Descriptor.Substring, yyVals[-4+yyTop], yyVals[-2+yyTop]); else yyVal = notation.Confirm(sym, Descriptor.Substring, yyVals[-4+yyTop], yyVals[-2+yyTop], yyVals[-1+yyTop]); } break; case 23: #line 460 "SQL92-min.y" { yyVal = null; } break; case 24: #line 464 "SQL92-min.y" { yyVal = yyVals[0+yyTop]; } break; case 26: #line 472 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.CExpr), Descriptor.Concat, yyVals[-2+yyTop], yyVals[0+yyTop]); } break; case 31: #line 486 "SQL92-min.y" { yyVal = Lisp.Cons(yyVals[0+yyTop]); } break; case 32: #line 490 "SQL92-min.y" { yyVal = Lisp.Append(yyVals[-2+yyTop], Lisp.Cons(yyVals[0+yyTop])); } break; case 39: #line 507 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Predicate), Descriptor.Pred, yyVals[-2+yyTop], yyVals[-1+yyTop], yyVals[0+yyTop]); } break; case 44: #line 527 "SQL92-min.y" { yyVal = yyVals[-1+yyTop]; } break; case 45: #line 534 "SQL92-min.y" { yyVal = yyVals[0+yyTop]; } break; case 46: #line 541 "SQL92-min.y" { yyVal = yyVals[0+yyTop]; } break; case 47: #line 548 "SQL92-min.y" { yyVal = yyVals[0+yyTop]; if (yyVals[-2+yyTop] != null) notation.ConfirmTag(Tag.Join, Descriptor.JoinType, new TokenWrapper(yyVals[-2+yyTop])); } break; case 50: #line 562 "SQL92-min.y" { yyVal = yyVals[-1+yyTop]; notation.Confirm((Symbol)yyVal, Descriptor.Alias, yyVals[0+yyTop]); } break; case 52: #line 571 "SQL92-min.y" { yyVal = yyVals[0+yyTop]; notation.Confirm((Symbol)yyVal, Descriptor.Dynatable); } break; case 57: #line 592 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.CaseExpr), Descriptor.ElseBranch, yyVals[0+yyTop]); } break; case 59: #line 603 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Predicate), Descriptor.Exists, yyVals[0+yyTop]); } break; case 61: #line 618 "SQL92-min.y" { if (yyVals[-1+yyTop].Equals("-")) yyVal = notation.Confirm(new Symbol(Tag.Expr), Descriptor.UnaryMinus, yyVals[0+yyTop]); else yyVal = 2; } break; case 62: #line 629 "SQL92-min.y" { Symbol sym = new Symbol(Tag.CExpr); switch((int)yyVals[-3+yyTop]) { case Token.UPPER: yyVal = notation.Confirm(sym, Descriptor.StringUpper, yyVals[-1+yyTop]); break; case Token.LOWER: yyVal = notation.Confirm(sym, Descriptor.StringLower, yyVals[-1+yyTop]); break; } } break; case 65: #line 651 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.CExpr), Descriptor.StringConvert, yyVals[-3+yyTop], yyVals[-1+yyTop]); } break; case 67: #line 663 "SQL92-min.y" { notation.ConfirmTag(Tag.SQuery, Descriptor.From, yyVals[0+yyTop]); } break; case 68: #line 670 "SQL92-min.y" { yyVal = Lisp.Cons(yyVals[0+yyTop]); } break; case 69: #line 674 "SQL92-min.y" { yyVal = Lisp.Append(yyVals[-2+yyTop], Lisp.Cons(yyVals[0+yyTop])); } break; case 70: #line 682 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.AggExpr), Descriptor.Aggregate, new TokenWrapper(yyVals[-3+yyTop]), yyVals[-1+yyTop]); } break; case 71: #line 687 "SQL92-min.y" { Symbol sym = new Symbol(Tag.AggExpr); yyVal = notation.Confirm(sym, Descriptor.Aggregate, new TokenWrapper(yyVals[-4+yyTop]), yyVals[-1+yyTop]); if ((int)yyVals[-2+yyTop] == Token.DISTINCT) notation.Confirm(sym, Descriptor.Distinct); } break; case 72: #line 697 "SQL92-min.y" { yyVal = new Parameter(yyVals[0+yyTop].ToString()); } break; case 76: #line 710 "SQL92-min.y" { yyVal = yyVals[0+yyTop]; notation.ConfirmTag(Tag.SQuery, Descriptor.GroupingColumnRef, yyVals[0+yyTop]); } break; case 77: #line 718 "SQL92-min.y" { yyVal = Lisp.Cons(yyVals[0+yyTop]); } break; case 78: #line 722 "SQL92-min.y" { yyVal = Lisp.Append(yyVals[-2+yyTop], Lisp.Cons(yyVals[0+yyTop])); } break; case 80: #line 731 "SQL92-min.y" { notation.ConfirmTag(Tag.SQuery, Descriptor.GroupBy, yyVals[0+yyTop]); } break; case 82: #line 739 "SQL92-min.y" { notation.ConfirmTag(Tag.SQuery, Descriptor.Having, yyVals[0+yyTop]); } break; case 86: #line 756 "SQL92-min.y" { Symbol sym = new Symbol(Tag.Predicate); yyVal = notation.Confirm(sym, Descriptor.InSet, yyVals[-3+yyTop], yyVals[0+yyTop]); if (yyVals[-2+yyTop] != null) notation.Confirm(sym, Descriptor.Inverse); } break; case 88: #line 767 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.ValueList), Descriptor.ValueList, yyVals[-1+yyTop]); } break; case 89: #line 774 "SQL92-min.y" { yyVal = Lisp.Cons(yyVals[0+yyTop]); } break; case 90: #line 778 "SQL92-min.y" { yyVal = Lisp.Append(yyVals[-2+yyTop], Lisp.Cons(yyVals[0+yyTop])); } break; case 91: #line 785 "SQL92-min.y" { notation.ConfirmTag(Tag.Join, Descriptor.CrossJoin, yyVals[-1+yyTop], yyVals[0+yyTop]); yyVal = notation.ResolveTag(Tag.Join); } break; case 92: #line 790 "SQL92-min.y" { notation.ConfirmTag(Tag.Join, Descriptor.UnionJoin, yyVals[-1+yyTop], yyVals[0+yyTop]); yyVal = notation.ResolveTag(Tag.Join); } break; case 93: #line 795 "SQL92-min.y" { notation.ConfirmTag(Tag.Join, Descriptor.NaturalJoin, yyVals[-1+yyTop], yyVals[0+yyTop]); yyVal = notation.ResolveTag(Tag.Join); } break; case 94: #line 800 "SQL92-min.y" { notation.ConfirmTag(Tag.Join, Descriptor.QualifiedJoin, yyVals[-1+yyTop], yyVals[0+yyTop]); yyVal = notation.ResolveTag(Tag.Join); } break; case 95: #line 805 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Join), Descriptor.Branch, yyVals[-1+yyTop]); } break; case 97: #line 816 "SQL92-min.y" { yyVal = yyVals[0+yyTop]; } break; case 104: #line 835 "SQL92-min.y" { notation.ConfirmTag(Tag.Join, Descriptor.Outer); } break; case 105: #line 842 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Predicate), Descriptor.Like, yyVals[-2+yyTop], yyVals[0+yyTop]); } break; case 106: #line 847 "SQL92-min.y" { Symbol sym = new Symbol(Tag.Predicate); yyVal = notation.Confirm(sym, Descriptor.Like, yyVals[-2+yyTop], yyVals[0+yyTop]); notation.Confirm(sym, Descriptor.Inverse); } break; case 107: #line 853 "SQL92-min.y" { Symbol sym = new Symbol(Tag.Predicate); yyVal = notation.Confirm(sym, Descriptor.Like, yyVals[-4+yyTop], yyVals[-2+yyTop]); notation.Confirm(sym, Descriptor.Escape, yyVals[0+yyTop]); } break; case 108: #line 859 "SQL92-min.y" { Symbol sym = new Symbol(Tag.Predicate); yyVal = notation.Confirm(sym, Descriptor.Like, yyVals[-4+yyTop], yyVals[-2+yyTop]); notation.Confirm(sym, Descriptor.Inverse); notation.Confirm(sym, Descriptor.Escape, yyVals[0+yyTop]); } break; case 109: #line 871 "SQL92-min.y" { Symbol sym = new Symbol(Tag.Predicate); yyVal = notation.Confirm(sym, Descriptor.Match, yyVals[-4+yyTop], yyVals[0+yyTop]); if (yyVals[-2+yyTop] != null) notation.Confirm(sym, Descriptor.Unique); if (yyVals[-1+yyTop] != null) notation.Confirm(sym, Descriptor.MatchType, new TokenWrapper(yyVals[-1+yyTop])); } break; case 110: #line 883 "SQL92-min.y" { yyVal = null; } break; case 112: #line 891 "SQL92-min.y" { yyVal = null; } break; case 116: #line 904 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Join), Descriptor.Using, yyVals[-1+yyTop]); } break; case 117: #line 911 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Join), Descriptor.Constraint, new TokenWrapper(yyVals[-1+yyTop])); } break; case 118: #line 915 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Join), Descriptor.Constraint, new TokenWrapper(yyVals[-1+yyTop])); } break; case 119: #line 919 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Join), Descriptor.Constraint, yyVals[0+yyTop]); } break; case 121: #line 927 "SQL92-min.y" { Symbol sym = new Symbol(Tag.QueryExp); switch((int)yyVals[-3+yyTop]) { case Token.UNION: notation.Confirm(sym, Descriptor.Union, yyVals[-4+yyTop], yyVals[0+yyTop]); break; case Token.EXCEPT: notation.Confirm(sym, Descriptor.Except, yyVals[-4+yyTop], yyVals[0+yyTop]); break; } if (yyVals[-2+yyTop] != null) notation.Confirm(sym, Descriptor.Distinct); yyVal = sym; } break; case 124: #line 951 "SQL92-min.y" { yyVal = null; } break; case 126: #line 959 "SQL92-min.y" { yyVal = null; } break; case 129: #line 968 "SQL92-min.y" { Symbol sym = new Symbol(Tag.QueryTerm); notation.Confirm(sym, Descriptor.Intersect, yyVals[-4+yyTop], yyVals[0+yyTop]); if (yyVals[-2+yyTop] != null) notation.Confirm(sym, Descriptor.Distinct); yyVal = sym; } break; case 130: #line 980 "SQL92-min.y" { Symbol sym = new Symbol(Tag.Predicate); yyVal = notation.Confirm(sym, Descriptor.IsNull, yyVals[-3+yyTop]); if (yyVals[-1+yyTop] != null) notation.Confirm(sym, Descriptor.Inverse); } break; case 136: #line 1001 "SQL92-min.y" { Symbol sym = new Symbol(Tag.Expr); if (yyVals[-1+yyTop].Equals("+")) yyVal = notation.Confirm(sym, Descriptor.Add, yyVals[-2+yyTop], yyVals[0+yyTop]); else yyVal = notation.Confirm(sym, Descriptor.Sub, yyVals[-2+yyTop], yyVals[0+yyTop]); } break; case 141: #line 1022 "SQL92-min.y" { yyVal = yyVals[0+yyTop]; } break; case 145: #line 1036 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Predicate), Descriptor.Overlaps, yyVals[-2+yyTop], yyVals[0+yyTop]); } break; case 149: #line 1053 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Expr), Descriptor.PosString, yyVals[-1+yyTop], yyVals[-3+yyTop]); } break; case 160: #line 1073 "SQL92-min.y" { yyVal = yyVals[-1+yyTop]; if (yyVals[-3+yyTop] != null) notation.ConfirmTag(Tag.Join, Descriptor.JoinType, new TokenWrapper(yyVals[-3+yyTop])); notation.ConfirmTag(Tag.Join, Descriptor.JoinSpec, yyVals[0+yyTop]); } break; case 161: #line 1083 "SQL92-min.y" { yyVal = null; } break; case 163: #line 1092 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Predicate), Descriptor.QuantifiedPred, yyVals[-3+yyTop], yyVals[-2+yyTop], new TokenWrapper(yyVals[-1+yyTop]), yyVals[0+yyTop]); } break; case 167: #line 1107 "SQL92-min.y" { if ((int)yyVals[-2+yyTop] == Token.DISTINCT) notation.ConfirmTag(Tag.SQuery, Descriptor.Distinct); if (yyVals[-3+yyTop] != null) notation.ConfirmTag(Tag.SQuery, Descriptor.Top, yyVals[-3+yyTop]); yyVal = notation.ResolveTag(Tag.SQuery); notation.LeaveContext(); } break; case 168: #line 1119 "SQL92-min.y" { yyVal = null; } break; case 169: #line 1123 "SQL92-min.y" { yyVal = yyVals[-1+yyTop]; } break; case 174: #line 1141 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.RowValue), Descriptor.RowValue, Lisp.Append(Lisp.Cons(yyVals[-3+yyTop]), yyVals[-1+yyTop])); } break; case 176: #line 1151 "SQL92-min.y" { yyVal = new TokenWrapper(yyVals[0+yyTop]); } break; case 177: #line 1155 "SQL92-min.y" { yyVal = new TokenWrapper(yyVals[0+yyTop]); } break; case 178: #line 1162 "SQL92-min.y" { yyVal = Lisp.Cons(yyVals[0+yyTop]); } break; case 179: #line 1166 "SQL92-min.y" { yyVal = Lisp.Append(yyVals[-2+yyTop], Lisp.Cons(yyVals[0+yyTop])); } break; case 180: #line 1175 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.CaseExpr), Descriptor.Case, yyVals[-1+yyTop]); } break; case 181: #line 1182 "SQL92-min.y" { object clause_list = Lisp.Append(yyVals[-2+yyTop], Lisp.Cons(yyVals[-1+yyTop])); yyVal = notation.Confirm(new Symbol(Tag.CaseExpr), Descriptor.Case, clause_list); } break; case 182: #line 1190 "SQL92-min.y" { yyVal = Lisp.Cons(yyVals[0+yyTop]); } break; case 183: #line 1194 "SQL92-min.y" { yyVal = Lisp.Append(yyVals[-1+yyTop], Lisp.Cons(yyVals[0+yyTop])); } break; case 184: #line 1201 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.CaseExpr), Descriptor.CaseBranch, yyVals[-2+yyTop], yyVals[0+yyTop]); } break; case 187: #line 1213 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.BooleanExpr), Descriptor.LogicalOR, yyVals[-2+yyTop], yyVals[0+yyTop]); } break; case 190: #line 1225 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.BooleanExpr), Descriptor.LogicalAND, yyVals[-2+yyTop], yyVals[0+yyTop]); } break; case 193: #line 1237 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.BooleanExpr), Descriptor.Inverse, yyVals[0+yyTop]); } break; case 195: #line 1245 "SQL92-min.y" { Symbol sym = new Symbol(Tag.BooleanExpr); yyVal = notation.Confirm(sym, Descriptor.BooleanTest, new TokenWrapper(yyVals[0+yyTop]), yyVals[-3+yyTop]); if (yyVals[-1+yyTop] != null) notation.Confirm(sym, Descriptor.Inverse); } break; case 197: #line 1256 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.BooleanExpr), Descriptor.Branch, yyVals[-1+yyTop]); } break; case 201: #line 1270 "SQL92-min.y" { notation.ConfirmTag(Tag.SQuery, Descriptor.Select, null); } break; case 202: #line 1274 "SQL92-min.y" { notation.ConfirmTag(Tag.SQuery, Descriptor.Select, yyVals[0+yyTop]); } break; case 203: #line 1281 "SQL92-min.y" { yyVal = Lisp.Cons(yyVals[0+yyTop]); } break; case 204: #line 1285 "SQL92-min.y" { yyVal = Lisp.Append(yyVals[-2+yyTop], Lisp.Cons(yyVals[0+yyTop])); } break; case 205: #line 1292 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.TableFields), Descriptor.TableFields, yyVals[-1+yyTop]); } break; case 207: #line 1300 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.AggExpr), Descriptor.AggCount); } break; case 215: #line 1317 "SQL92-min.y" { notation.EnterContext(); yyVal = Token.ALL; } break; case 216: #line 1322 "SQL92-min.y" { notation.EnterContext(); yyVal = yyVals[0+yyTop]; } break; case 221: #line 1342 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.CaseExpr), Descriptor.Case, yyVals[-2+yyTop], yyVals[-1+yyTop]); } break; case 222: #line 1349 "SQL92-min.y" { object clause_list = Lisp.Append(yyVals[-2+yyTop], Lisp.Cons(yyVals[-1+yyTop])); yyVal = notation.Confirm(new Symbol(Tag.CaseExpr), Descriptor.Case, yyVals[-3+yyTop], clause_list); } break; case 223: #line 1357 "SQL92-min.y" { yyVal = Lisp.Cons(yyVals[0+yyTop]); } break; case 224: #line 1361 "SQL92-min.y" { yyVal = Lisp.Append(yyVals[-1+yyTop], Lisp.Cons(yyVals[0+yyTop])); } break; case 227: #line 1374 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.CaseExpr), Descriptor.CaseBranch, yyVals[-2+yyTop], yyVals[0+yyTop]); } break; case 229: #line 1382 "SQL92-min.y" { yyVal = new IntegerValue(yyVals[0+yyTop]); } break; case 230: #line 1390 "SQL92-min.y" { yyVal = yyVals[-1+yyTop]; if ((int)yyVals[0+yyTop] == Token.DESC) notation.Confirm((Symbol)yyVals[-1+yyTop], Descriptor.Desc); } break; case 231: #line 1399 "SQL92-min.y" { yyVal = Token.ASC; } break; case 233: #line 1407 "SQL92-min.y" { yyVal = Lisp.Cons(yyVals[0+yyTop]); } break; case 234: #line 1411 "SQL92-min.y" { yyVal = Lisp.Append(yyVals[-2+yyTop], Lisp.Cons(yyVals[0+yyTop])); } break; case 238: #line 1430 "SQL92-min.y" { yyVal = yyVals[-1+yyTop]; if (yyVals[-2+yyTop] != null) notation.Confirm((Symbol)yyVals[-1+yyTop], Descriptor.OptimizerHint, yyVals[-2+yyTop]); } break; case 239: #line 1436 "SQL92-min.y" { yyVal = yyVals[-2+yyTop]; notation.Confirm((Symbol)yyVals[-2+yyTop], Descriptor.Order, yyVals[-1+yyTop]); if (yyVals[-3+yyTop] != null) notation.Confirm((Symbol)yyVals[-2+yyTop], Descriptor.OptimizerHint, yyVals[-3+yyTop]); } break; case 245: #line 1460 "SQL92-min.y" { yyVal = yyVals[-1+yyTop]; notation.Confirm((Symbol)yyVal, Descriptor.Alias, yyVals[0+yyTop]); } break; case 249: #line 1474 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Dynatable), Descriptor.Dynatable, yyVals[0+yyTop]); } break; case 250: #line 1478 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Dynatable), Descriptor.Dynatable, yyVals[0+yyTop]); } break; case 251: #line 1482 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Dynatable), Descriptor.Dynatable, yyVals[-2+yyTop]); } break; case 252: #line 1486 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Dynatable), Descriptor.Dynatable, yyVals[0+yyTop]); } break; case 253: #line 1493 "SQL92-min.y" { yyVal = new Qname(yyVals[0+yyTop]); } break; case 254: #line 1498 "SQL92-min.y" { yyVal = new Qname(yyVals[-3+yyTop]); notation.Confirm((Symbol)yyVal, Descriptor.DerivedColumns, yyVals[-1+yyTop]); } break; case 255: #line 1506 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.TableConstructor), Descriptor.TableValue, yyVals[0+yyTop]); } break; case 256: #line 1514 "SQL92-min.y" { yyVal = Lisp.Cons(yyVals[0+yyTop]); } break; case 257: #line 1518 "SQL92-min.y" { yyVal = Lisp.Append(yyVals[-2+yyTop], Lisp.Cons(yyVals[0+yyTop])); } break; case 259: #line 1526 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Expr), Descriptor.Mul, yyVals[-2+yyTop], yyVals[0+yyTop]); } break; case 260: #line 1530 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Expr), Descriptor.Div, yyVals[-2+yyTop], yyVals[0+yyTop]); } break; case 261: #line 1537 "SQL92-min.y" { yyVal = yyVals[-1+yyTop]; } break; case 262: #line 1544 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.CExpr), Descriptor.StringTrim, new TokenWrapper(Token.BOTH), new Literal(" "), yyVals[0+yyTop]); } break; case 263: #line 1549 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.CExpr), Descriptor.StringTrim, new TokenWrapper(Token.BOTH), new Literal(" "), yyVals[0+yyTop]); } break; case 264: #line 1554 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.CExpr), Descriptor.StringTrim, new TokenWrapper(Token.BOTH), yyVals[-2+yyTop], yyVals[0+yyTop]); } break; case 265: #line 1559 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.CExpr), Descriptor.StringTrim, new TokenWrapper(yyVals[-2+yyTop]), new Literal(" "), yyVals[0+yyTop]); } break; case 266: #line 1564 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.CExpr), Descriptor.StringTrim, new TokenWrapper(yyVals[-3+yyTop]), yyVals[-2+yyTop], yyVals[0+yyTop]); } break; case 272: #line 1586 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Predicate), Descriptor.Unique, yyVals[0+yyTop]); } break; case 284: #line 1610 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Expr), Descriptor.Branch, yyVals[-1+yyTop]); } break; case 285: #line 1617 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Funcall), Descriptor.Funcall, new Qname(yyVals[-2+yyTop]), null); } break; case 286: #line 1621 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Funcall), Descriptor.Funcall, new Qname(yyVals[-3+yyTop]), yyVals[-1+yyTop]); } break; case 289: #line 1633 "SQL92-min.y" { notation.ConfirmTag(Tag.SQuery, Descriptor.Where, yyVals[0+yyTop]); } break; case 290: #line 1640 "SQL92-min.y" { yyVal = null; } break; case 292: #line 1648 "SQL92-min.y" { yyVal = Lisp.Cons(yyVals[0+yyTop]); } break; case 293: #line 1652 "SQL92-min.y" { yyVal = Lisp.Append(yyVals[-1+yyTop], Lisp.Cons(yyVals[0+yyTop])); } break; case 294: #line 1659 "SQL92-min.y" { yyVal = new Qname(yyVals[0+yyTop]); } break; case 295: #line 1666 "SQL92-min.y" { yyVal = yyVals[0+yyTop]; notation.ConfirmTag(Tag.SQuery, Descriptor.TableName, yyVals[0+yyTop]); } break; case 296: #line 1671 "SQL92-min.y" { notation.ConfirmTag(Tag.SQuery, Descriptor.TableName, yyVals[0+yyTop]); } break; case 297: #line 1678 "SQL92-min.y" { yyVal = yyVals[0+yyTop]; notation.Confirm((Symbol)yyVal, Descriptor.Prefix, new Literal(yyVals[-2+yyTop])); } break; case 299: #line 1687 "SQL92-min.y" { yyVal = yyVals[-2+yyTop]; ((Qname)yyVals[-2+yyTop]).Append((String)yyVals[0+yyTop]); } break; case 300: #line 1695 "SQL92-min.y" { yyVal = yyVals[0+yyTop]; notation.Confirm((Symbol)yyVals[0+yyTop], Descriptor.ColumnRef); } break; case 302: #line 1704 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Dref), Descriptor.Dref, yyVals[-2+yyTop], new Literal((String)yyVals[0+yyTop])); } break; case 303: #line 1708 "SQL92-min.y" { Notation.Record[] recs = notation.Select((Symbol)yyVals[0+yyTop], Descriptor.Funcall, 2); if (recs.Length > 0) { yyVal = notation.Confirm(new Symbol(Tag.Funcall), Descriptor.Funcall, recs[0].Arg0, Lisp.Append(Lisp.Cons(yyVals[-2+yyTop]), recs[0].args[1])); notation.Remove(recs); } else throw new InvalidOperationException(); } break; case 304: #line 1720 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Dref), Descriptor.At, yyVals[-3+yyTop], yyVals[-1+yyTop]); } break; case 305: #line 1724 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Dref), Descriptor.Wref, yyVals[-2+yyTop], new Literal((String)yyVals[0+yyTop])); } break; case 306: #line 1731 "SQL92-min.y" { yyVal = new Qname(yyVals[0+yyTop]); } break; case 307: #line 1738 "SQL92-min.y" { yyVal = new IntegerValue(yyVals[0+yyTop]); } break; case 308: #line 1742 "SQL92-min.y" { yyVal = new DecimalValue(yyVals[0+yyTop]); } break; case 309: #line 1746 "SQL92-min.y" { yyVal = new DoubleValue(yyVals[0+yyTop]); } break; case 310: #line 1750 "SQL92-min.y" { yyVal = new Literal(yyVals[0+yyTop]); } break; case 320: #line 1770 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.SQLX), Descriptor.XMLQuery, yyVals[-2+yyTop], null, yyVals[-1+yyTop]); } break; case 321: #line 1774 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.SQLX), Descriptor.XMLQuery, yyVals[-4+yyTop], yyVals[-2+yyTop], yyVals[-1+yyTop]); } break; case 322: #line 1778 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.SQLX), Descriptor.XMLQuery, yyVals[-6+yyTop], yyVals[-2+yyTop], yyVals[-1+yyTop]); } break; case 323: #line 1785 "SQL92-min.y" { yyVal = null; } break; case 324: #line 1789 "SQL92-min.y" { yyVal = new TokenWrapper(Token.RETURNING_CONTENT); } break; case 325: #line 1793 "SQL92-min.y" { yyVal = new TokenWrapper(Token.RETURNING_SEQUENCE); } break; case 326: #line 1800 "SQL92-min.y" { yyVal = Lisp.Cons(yyVals[0+yyTop]); } break; case 327: #line 1804 "SQL92-min.y" { yyVal = Lisp.Append(yyVals[-2+yyTop], Lisp.Cons(yyVals[0+yyTop])); } break; case 328: #line 1811 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.AggExpr), Descriptor.Aggregate, new TokenWrapper(Token.XMLAGG), yyVals[-1+yyTop]); } break; case 329: #line 1816 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.AggExpr), Descriptor.Aggregate, new TokenWrapper(Token.XMLAGG), yyVals[-2+yyTop]); notation.Confirm((Symbol)yyVal, Descriptor.Order, yyVals[-1+yyTop]); } break; case 330: #line 1825 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.SQLX), Descriptor.XMLConcat, yyVals[-1+yyTop]); } break; case 331: #line 1833 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.SQLX), Descriptor.XMLForestAll); } break; case 332: #line 1837 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.SQLX), Descriptor.XMLForest, yyVals[-1+yyTop]); } break; case 333: #line 1842 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.SQLX), Descriptor.XMLForest, yyVals[-1+yyTop]); notation.Confirm((Symbol)yyVal, Descriptor.XMLNamespaces, yyVals[-3+yyTop]); } break; case 334: #line 1851 "SQL92-min.y" { String spec = yyVals[-3+yyTop].ToString().ToUpperInvariant(); if (spec.Equals("DOCUMENT") || spec.Equals("CONTENT")) yyVal = notation.Confirm(new Symbol(Tag.SQLX), Descriptor.XMLParse, new Literal(spec), yyVals[-2+yyTop], yyVals[-1+yyTop]); else { yyerror(String.Format(Properties.Resources.SyntaxError, String.Format("XMLPARSE({0}...", spec))); throw new yyParser.yyException("Syntax error"); } } break; case 335: #line 1866 "SQL92-min.y" { String spec = (String)yyVals[-2+yyTop]; if (! spec.Equals("NAME", StringComparison.InvariantCultureIgnoreCase)) { yyerror(String.Format(Properties.Resources.SyntaxError, String.Format("XMLPI({0}...", spec))); throw new yyParser.yyException("Syntax error"); } yyVal = notation.Confirm(new Symbol(Tag.SQLX), Descriptor.XMLPI, yyVals[-1+yyTop], null); } break; case 336: #line 1877 "SQL92-min.y" { String spec = (String)yyVals[-4+yyTop]; if (! spec.Equals("NAME", StringComparison.InvariantCultureIgnoreCase)) { yyerror(String.Format(Properties.Resources.SyntaxError, String.Format("XMLPI({0}...", spec))); throw new yyParser.yyException("Syntax error"); } yyVal = notation.Confirm(new Symbol(Tag.SQLX), Descriptor.XMLPI, yyVals[-3+yyTop], yyVals[-1+yyTop]); } break; case 337: #line 1891 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.SQLX), Descriptor.XMLComment, yyVals[-1+yyTop]); } break; case 338: #line 1898 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.SQLX), Descriptor.XMLCDATA, yyVals[-1+yyTop]); } break; case 339: #line 1905 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.SQLX), Descriptor.XMLRoot, yyVals[-1+yyTop], null, null); } break; case 340: #line 1909 "SQL92-min.y" { String tok = (String)yyVals[-2+yyTop]; if (! tok.Equals("VERSION", StringComparison.InvariantCultureIgnoreCase)) { yyerror(String.Format(Properties.Resources.SyntaxError, String.Format("XMLRoot(... {0} ...", tok))); throw new yyParser.yyException("Syntax error"); } yyVal = notation.Confirm(new Symbol(Tag.SQLX), Descriptor.XMLRoot, yyVals[-4+yyTop], new Literal(yyVals[-1+yyTop]), null); } break; case 341: #line 1920 "SQL92-min.y" { String tok = (String)yyVals[-5+yyTop]; if (! tok.Equals("VERSION", StringComparison.InvariantCultureIgnoreCase)) { yyerror(String.Format(Properties.Resources.SyntaxError, String.Format("XMLRoot(... {0} ...", tok))); throw new yyParser.yyException("Syntax error"); } tok = (String)yyVals[-2+yyTop]; if (! tok.Equals("STANDALONE", StringComparison.InvariantCultureIgnoreCase)) { yyerror(String.Format(Properties.Resources.SyntaxError, String.Format("XMLRoot(... {0} ...", tok))); throw new yyParser.yyException("Syntax error"); } yyVal = notation.Confirm(new Symbol(Tag.SQLX), Descriptor.XMLRoot, yyVals[-7+yyTop], new Literal(yyVals[-4+yyTop]), yyVals[-1+yyTop]); } break; case 343: #line 1942 "SQL92-min.y" { yyVal = null; } break; case 344: #line 1949 "SQL92-min.y" { String tok = (String)yyVals[0+yyTop]; if (tok.Equals("NO", StringComparison.InvariantCultureIgnoreCase) || tok.Equals("YES", StringComparison.InvariantCultureIgnoreCase)) yyVal = new Qname(tok.ToUpperInvariant()); else throw new yyParser.yyException(String.Format(Properties.Resources.SyntaxError, "STANDALONE value must be YES|NO|NO VALUE")); } break; case 345: #line 1959 "SQL92-min.y" { yyVal = null; } break; case 346: #line 1966 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.SQLX), Descriptor.XMLElement, yyVals[-1+yyTop], null); } break; case 347: #line 1970 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.SQLX), Descriptor.XMLElement, yyVals[-3+yyTop], null); notation.Confirm((Symbol)yyVal, Descriptor.XMLNamespaces, yyVals[-1+yyTop]); } break; case 348: #line 1975 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.SQLX), Descriptor.XMLElement, yyVals[-3+yyTop], null); notation.Confirm((Symbol)yyVal, Descriptor.XMLAttributes, yyVals[-1+yyTop]); } break; case 349: #line 1981 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.SQLX), Descriptor.XMLElement, yyVals[-5+yyTop], null); notation.Confirm((Symbol)yyVal, Descriptor.XMLNamespaces, yyVals[-3+yyTop]); notation.Confirm((Symbol)yyVal, Descriptor.XMLAttributes, yyVals[-1+yyTop]); } break; case 350: #line 1987 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.SQLX), Descriptor.XMLElement, yyVals[-3+yyTop], yyVals[-1+yyTop]); } break; case 351: #line 1991 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.SQLX), Descriptor.XMLElement, yyVals[-5+yyTop], yyVals[-1+yyTop]); notation.Confirm((Symbol)yyVal, Descriptor.XMLNamespaces, yyVals[-3+yyTop]); } break; case 352: #line 1996 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.SQLX), Descriptor.XMLElement, yyVals[-5+yyTop], yyVals[-1+yyTop]); notation.Confirm((Symbol)yyVal, Descriptor.XMLAttributes, yyVals[-3+yyTop]); } break; case 353: #line 2002 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.SQLX), Descriptor.XMLElement, yyVals[-7+yyTop], yyVals[-1+yyTop]); notation.Confirm((Symbol)yyVal, Descriptor.XMLNamespaces, yyVals[-5+yyTop]); notation.Confirm((Symbol)yyVal, Descriptor.XMLAttributes, yyVals[-3+yyTop]); } break; case 354: #line 2011 "SQL92-min.y" { yyVal = yyVals[-1+yyTop]; } break; case 355: #line 2018 "SQL92-min.y" { yyVal = Lisp.Cons(yyVals[0+yyTop]); } break; case 356: #line 2022 "SQL92-min.y" { yyVal = Lisp.Append(yyVals[-2+yyTop], Lisp.Cons(yyVals[0+yyTop])); } break; case 359: #line 2034 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.SQLX), Descriptor.DeclNamespace, new Literal(yyVals[-2+yyTop]), yyVals[0+yyTop]); } break; case 360: #line 2042 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.SQLX), Descriptor.DeclNamespace, new Literal(yyVals[0+yyTop]), null); } break; case 361: #line 2047 "SQL92-min.y" { yyVal = null; } break; case 362: #line 2054 "SQL92-min.y" { yyVal = null; } break; case 363: #line 2058 "SQL92-min.y" { yyVal = yyVals[-1+yyTop]; } break; case 364: #line 2065 "SQL92-min.y" { yyVal = Lisp.Cons(yyVals[0+yyTop]); } break; case 365: #line 2069 "SQL92-min.y" { yyVal = Lisp.Append(yyVals[-2+yyTop], Lisp.Cons(yyVals[0+yyTop])); } break; case 367: #line 2077 "SQL92-min.y" { yyVal = yyVals[-1+yyTop]; notation.Confirm((Symbol)yyVal, Descriptor.ContentOption, yyVals[0+yyTop]); } break; case 368: #line 2082 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.TableFields), Descriptor.TableFields, yyVals[-1+yyTop]); } break; case 369: #line 2086 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.TableFields), Descriptor.TableFields, yyVals[-2+yyTop]); notation.Confirm((Symbol)yyVal, Descriptor.ContentOption, yyVals[0+yyTop]); } break; case 371: #line 2095 "SQL92-min.y" { yyVal = yyVals[-1+yyTop]; notation.Confirm((Symbol)yyVal, Descriptor.Alias, yyVals[0+yyTop]); } break; case 372: #line 2103 "SQL92-min.y" { yyVal = null; } break; case 374: #line 2111 "SQL92-min.y" { yyVal = new TokenWrapper(Token.PRESERVE_WHITESPACE); } break; case 375: #line 2115 "SQL92-min.y" { yyVal = new TokenWrapper(Token.STRIP_WHITESPACE); } break; case 376: #line 2122 "SQL92-min.y" { yyVal = new TokenWrapper(Token.OPTION_NULL); } break; case 377: #line 2126 "SQL92-min.y" { yyVal = new TokenWrapper(Token.OPTION_EMPTY); } break; case 378: #line 2130 "SQL92-min.y" { yyVal = new TokenWrapper(Token.OPTION_ABSENT); } break; case 379: #line 2134 "SQL92-min.y" { yyVal = new TokenWrapper(Token.OPTION_NIL); } break; case 380: #line 2138 "SQL92-min.y" { yyVal = new TokenWrapper(Token.NO_CONTENT); } break; case 383: #line 2150 "SQL92-min.y" { yyVal = notation.Confirm(new Symbol(Tag.Expr), Descriptor.Cast, yyVals[-3+yyTop], yyVals[-1+yyTop]); } break; case 384: #line 2158 "SQL92-min.y" { yyVal = null; } break; case 388: #line 2168 "SQL92-min.y" { yyVal = new TokenWrapper(yyVals[0+yyTop]); } break; case 390: #line 2176 "SQL92-min.y" { yyVal = new TokenWrapper(yyVals[0+yyTop]); } break; case 391: #line 2180 "SQL92-min.y" { yyVal = new TokenWrapper(yyVals[-3+yyTop]); notation.Confirm((Symbol)yyVal, Descriptor.Typelen, yyVals[-1+yyTop]); } break; case 399: #line 2198 "SQL92-min.y" { yyVal = new TokenWrapper(yyVals[0+yyTop]); } break; case 405: #line 2213 "SQL92-min.y" { yyVal = new TokenWrapper(yyVals[0+yyTop]); } break; case 406: #line 2217 "SQL92-min.y" { yyVal = new TokenWrapper(yyVals[-3+yyTop]); notation.Confirm((Symbol)yyVal, Descriptor.Typeprec, yyVals[-1+yyTop]); } break; case 407: #line 2222 "SQL92-min.y" { yyVal = new TokenWrapper(yyVals[-5+yyTop]); notation.Confirm((Symbol)yyVal, Descriptor.Typeprec, yyVals[-3+yyTop]); notation.Confirm((Symbol)yyVal, Descriptor.Typescale, yyVals[-1+yyTop]); } break; case 411: #line 2237 "SQL92-min.y" { yyVal = new TokenWrapper(Token.FLOAT); } break; case 412: #line 2241 "SQL92-min.y" { yyVal = new TokenWrapper(Token.FLOAT); notation.Confirm((Symbol)yyVal, Descriptor.Typeprec, yyVals[-1+yyTop]); } break; case 413: #line 2249 "SQL92-min.y" { yyVal = new Qname(yyVals[0+yyTop]); } break; #line default } yyTop -= yyLen[yyN]; yyState = yyStates[yyTop]; int yyM = yyLhs[yyN]; if (yyState == 0 && yyM == 0) { //t if (debug != null) debug.shift(0, yyFinal); yyState = yyFinal; if (yyToken < 0) { yyToken = yyLex.advance() ? yyLex.token() : 0; //t if (debug != null) //t debug.lex(yyState, yyToken,yyname(yyToken), yyLex.value()); } if (yyToken == 0) { //t if (debug != null) debug.accept(yyVal); return yyVal; } goto yyLoop; } if (((yyN = yyGindex[yyM]) != 0) && ((yyN += yyState) >= 0) && (yyN < yyTable.Length) && (yyCheck[yyN] == yyState)) yyState = yyTable[yyN]; else yyState = yyDgoto[yyM]; //t if (debug != null) debug.shift(yyStates[yyTop], yyState); goto yyLoop; } } }
private void Prepare(PropertyValueCollection propVals) { propVals.Clear(); currentValues.Clear(); // I do not trust the long-term stability of the PropertyValueCollection // // So what we do is load it up once with LiteralValue references and manipulate these // outside of the collection (via a cached dictionary). We cache everything from the wrapper API // that can be cached in the managed world so that we only have minimal contact with it // Omit read-only properties using (FdoFeatureService service = _conn.CreateFeatureService()) { ClassDefinition c = service.GetClassByName(this.ClassName); foreach (PropertyDefinition p in c.Properties) { string name = p.Name; PropertyValue pv = new PropertyValue(name, null); if (p.PropertyType == PropertyType.PropertyType_DataProperty) { DataPropertyDefinition d = p as DataPropertyDefinition; if (!d.ReadOnly && !d.IsAutoGenerated) { DataValue dv = null; switch (d.DataType) { case DataType.DataType_BLOB: dv = new BLOBValue(); break; case DataType.DataType_Boolean: dv = new BooleanValue(); break; case DataType.DataType_Byte: dv = new ByteValue(); break; case DataType.DataType_CLOB: dv = new CLOBValue(); break; case DataType.DataType_DateTime: dv = new DateTimeValue(); break; case DataType.DataType_Decimal: dv = new DecimalValue(); break; case DataType.DataType_Double: dv = new DoubleValue(); break; case DataType.DataType_Int16: dv = new Int16Value(); break; case DataType.DataType_Int32: dv = new Int32Value(); break; case DataType.DataType_Int64: dv = new Int64Value(); break; case DataType.DataType_Single: dv = new SingleValue(); break; case DataType.DataType_String: dv = new StringValue(); break; } if (dv != null) { pv.Value = dv; propVals.Add(pv); } } } else if (p.PropertyType == PropertyType.PropertyType_GeometricProperty) { GeometricPropertyDefinition g = p as GeometricPropertyDefinition; if (!g.ReadOnly) { GeometryValue gv = new GeometryValue(); pv.Value = gv; propVals.Add(pv); } } } c.Dispose(); } //Load property values into temp dictionary foreach (PropertyValue p in propVals) { currentValues[p.Name.Name] = p.Value as LiteralValue; } if (propertySnapshot == null) { propertySnapshot = new List<string>(); foreach (PropertyValue p in propVals) { propertySnapshot.Add(p.Name.Name); } } }
private static DataValue ConvertDecimal(DecimalValue src, DataType dataType, bool truncate) { switch (dataType) { case DataType.DataType_Byte: { double d = src.Decimal; try { byte b = Convert.ToByte(d); return new ByteValue(b); } catch (OverflowException) { if (truncate) { if (d > (double)byte.MaxValue) return new ByteValue(byte.MaxValue); else if (d < (double)byte.MinValue) return new ByteValue(byte.MinValue); else return new ByteValue((byte)d); } } return null; } case DataType.DataType_String: return new StringValue(src.Decimal.ToString()); case DataType.DataType_Single: { double d = src.Decimal; try { float f = Convert.ToSingle(d); return new SingleValue(f); } catch (OverflowException) { if (truncate) { if (d > (double)float.MaxValue) return new SingleValue(float.MaxValue); else if (d < (double)float.MinValue) return new SingleValue(float.MinValue); else return new SingleValue((float)d); } } return null; } case DataType.DataType_Double: return new DoubleValue(src.Decimal); case DataType.DataType_Int16: { double d = src.Decimal; try { short s = Convert.ToInt16(d); return new Int16Value(s); } catch (OverflowException) { if (truncate) { if (d > (double)Int16.MaxValue) return new Int16Value(Int16.MaxValue); else if (d < (double)Int16.MinValue) return new Int16Value(Int16.MinValue); else return new Int16Value((short)d); } } return null; } case DataType.DataType_Int32: { double d = src.Decimal; try { int i = Convert.ToInt32(d); return new Int32Value(i); } catch (OverflowException) { if (truncate) { if (d > (double)Int32.MaxValue) return new Int32Value(Int32.MaxValue); else if (d < (double)Int32.MinValue) return new Int32Value(Int32.MinValue); else return new Int32Value((int)d); } } return null; } case DataType.DataType_Int64: { double d = src.Decimal; try { long l = Convert.ToInt64(d); return new Int64Value(l); } catch (OverflowException) { if (truncate) { if (d > (double)Int64.MaxValue) return new Int64Value(Int64.MaxValue); else if (d < (double)Int16.MinValue) return new Int64Value(Int64.MinValue); else return new Int64Value((long)d); } } return null; } default: return null; } }
public void OpenXmlSimpleTypeConverterTest() { // 1. Base64BinaryValue Base64BinaryValue base64 = new Base64BinaryValue(); base64 = "AA3322"; Assert.True("AA3322" == base64); Assert.Equal("AA3322", base64.Value); base64 = Base64BinaryValue.FromString("1234"); Assert.Equal("1234", base64.ToString()); Assert.Equal("1234", Base64BinaryValue.ToString(base64)); // 2. BooleanValue BooleanValue booleanValue = new BooleanValue(); booleanValue = true; Assert.True(booleanValue); Assert.True(booleanValue.Value); booleanValue = BooleanValue.FromBoolean(false); Assert.False(booleanValue); Assert.Equal(false, BooleanValue.ToBoolean(booleanValue)); // 3. ByteValue ByteValue byteValue = new ByteValue(); Byte bt = 1; byteValue = bt; Assert.True(bt == byteValue); Assert.Equal(bt, byteValue.Value); bt = 2; byteValue = ByteValue.FromByte(bt); Assert.Equal(bt, ByteValue.ToByte(byteValue)); // 4. DateTimeValue DateTimeValue dtValue = new DateTimeValue(); DateTime dt = DateTime.Now; dtValue = dt; Assert.True(dt == dtValue); dt = DateTime.Now.AddDays(1); dtValue = DateTimeValue.FromDateTime(dt); Assert.Equal(dt, dtValue.Value); Assert.Equal(dt, DateTimeValue.ToDateTime(dt)); // 5. DecimalValue DecimalValue decimalValue = new DecimalValue(); decimal dcm = 10; decimalValue = dcm; Assert.True(dcm == decimalValue); decimalValue = DecimalValue.FromDecimal(20); Assert.Equal(20, decimalValue.Value); Assert.Equal(20, DecimalValue.ToDecimal(decimalValue)); // 6. DoubleValue DoubleValue doubleValue = new DoubleValue(); double dbl = 1.1; doubleValue = dbl; Assert.True(dbl == doubleValue); doubleValue = DoubleValue.FromDouble(2.2); Assert.Equal(2.2, doubleValue.Value); Assert.Equal(2.2, DoubleValue.ToDouble(doubleValue)); // 7. HexBinaryValue HexBinaryValue hexBinaryValue = new HexBinaryValue(); string hex = "0X99CCFF"; hexBinaryValue = hex; Assert.True(hex == hexBinaryValue); hex = "111111"; hexBinaryValue = HexBinaryValue.FromString(hex); Assert.Equal(hex, hexBinaryValue.Value); Assert.Equal(hex, HexBinaryValue.ToString(hexBinaryValue)); // 8. Int16 Int16Value int16Value = new Int16Value(); Int16 int16 = 16; int16Value = int16; Assert.True(int16 == int16Value); int16 = 17; int16Value = Int16Value.FromInt16(int16); Assert.Equal(int16, int16Value.Value); Assert.Equal(int16, Int16Value.ToInt16(int16Value)); // 9. Int32 Int32Value int32Value = new Int32Value(); Int32 int32 = 32; int32Value = int32; Assert.True(int32 == int32Value); int32 = 33; int32Value = Int32Value.FromInt32(int32); Assert.Equal(int32, int32Value.Value); Assert.Equal(int32, Int32Value.ToInt32(int32Value)); // 10. Int64 Int64Value int64Value = new Int64Value(); Int64 int64 = 64; int64Value = int64; Assert.True(int64 == int64Value); int64 = 17; int64Value = Int64Value.FromInt64(int64); Assert.Equal(int64, int64Value.Value); Assert.Equal(int64, Int64Value.ToInt64(int64Value)); // 11. IntegerValue IntegerValue integerValue = new IntegerValue(); int integer = 64; integerValue = integer; Assert.True(integer == integerValue); integer = 17; integerValue = IntegerValue.FromInt64(integer); Assert.Equal(integer, integerValue.Value); Assert.Equal(integer, IntegerValue.ToInt64(integerValue)); // 12. OnOffValue OnOffValue onOffValue = new OnOffValue(); onOffValue = true; Assert.True(onOffValue); onOffValue = OnOffValue.FromBoolean(false); Assert.Equal(false, onOffValue.Value); Assert.Equal(false, OnOffValue.ToBoolean(onOffValue)); // 13. SByteValue SByteValue sbyteValue = new SByteValue(); SByte sbt = SByte.MaxValue; sbyteValue = sbt; Assert.True(sbt == sbyteValue); sbt = SByte.MinValue; sbyteValue = SByteValue.FromSByte(sbt); Assert.Equal(sbt, sbyteValue.Value); Assert.Equal(sbt, SByteValue.ToSByte(sbt)); // 14. SingleValue SingleValue singleValue = new SingleValue(); Single single = Single.MaxValue; singleValue = single; Assert.True(single == singleValue); single = Single.NaN; singleValue = SingleValue.FromSingle(single); Assert.Equal(single, singleValue.Value); Assert.Equal(single, SingleValue.ToSingle(singleValue)); // 15. StringValue StringValue stringValue = new StringValue(); String str = "Ethan"; stringValue = str; Assert.True(str == stringValue); str = "Yin"; stringValue = StringValue.FromString(str); Assert.Equal(str, stringValue.Value); Assert.Equal(str, stringValue.ToString()); Assert.Equal(str, StringValue.ToString(stringValue)); // 16. TrueFalseBlankValue TrueFalseBlankValue tfbValue = new TrueFalseBlankValue(); tfbValue = true; Assert.True(tfbValue); tfbValue = TrueFalseBlankValue.FromBoolean(false); Assert.Equal(false, tfbValue.Value); Assert.Equal(false, TrueFalseBlankValue.ToBoolean(tfbValue)); // 17. TrueFalseValue TrueFalseValue tfValue = new TrueFalseValue(); tfValue = true; Assert.True(tfValue); tfValue = TrueFalseValue.FromBoolean(false); Assert.Equal(false, tfValue.Value); Assert.Equal(false, TrueFalseValue.ToBoolean(tfValue)); // 18. UInt16Value UInt16Value uint16Value = new UInt16Value(); UInt16 uint16 = UInt16.MaxValue; uint16Value = uint16; Assert.True(uint16 == uint16Value); uint16 = UInt16.MinValue; uint16Value = UInt16Value.FromUInt16(uint16); Assert.Equal(uint16, uint16Value.Value); Assert.Equal(uint16, UInt16Value.ToUInt16(uint16Value)); // 19. UInt32Value UInt32Value uint32Value = new UInt32Value(); UInt32 uint32 = UInt32.MaxValue; uint32Value = uint32; Assert.True(uint32 == uint32Value); uint32 = UInt32.MinValue; uint32Value = UInt32Value.FromUInt32(uint32); Assert.Equal(uint32, uint32Value.Value); Assert.Equal(uint32, UInt32Value.ToUInt32(uint32Value)); // 20. UInt64Value UInt64Value uint64Value = new UInt64Value(); UInt64 uint64 = UInt64.MaxValue; uint64Value = uint64; Assert.True(uint64 == uint64Value); uint64 = UInt64.MinValue; uint64Value = UInt64Value.FromUInt64(uint64); Assert.Equal(uint64, uint64Value.Value); Assert.Equal(uint64, UInt64Value.ToUInt64(uint64Value)); }
/// <summary> /// Gets the values. /// </summary> /// <returns></returns> public Dictionary<string, ValueExpression> GetValues() { Dictionary<string, ValueExpression> values = new Dictionary<string, ValueExpression>(); foreach (DataGridViewRow row in grdProperties.Rows) { string name = row.Cells[0].Value.ToString(); PropertyDefinition propDef = row.Cells[0].Tag as PropertyDefinition; if (row.Cells[1].Value != null) { string str = row.Cells[1].Value.ToString(); if (!string.IsNullOrEmpty(str)) { ValueExpression expr = null; if (propDef.PropertyType == PropertyType.PropertyType_DataProperty) { DataPropertyDefinition dp = propDef as DataPropertyDefinition; switch (dp.DataType) { case DataType.DataType_Boolean: expr = new BooleanValue(Convert.ToBoolean(str)); break; case DataType.DataType_Byte: expr = new ByteValue(Convert.ToByte(str)); break; case DataType.DataType_DateTime: expr = new DateTimeValue(Convert.ToDateTime(str)); break; case DataType.DataType_Decimal: expr = new DecimalValue(Convert.ToDouble(str)); break; case DataType.DataType_Double: expr = new DoubleValue(Convert.ToDouble(str)); break; case DataType.DataType_Int16: expr = new Int16Value(Convert.ToInt16(str)); break; case DataType.DataType_Int32: expr = new Int32Value(Convert.ToInt32(str)); break; case DataType.DataType_Int64: expr = new Int64Value(Convert.ToInt64(str)); break; case DataType.DataType_Single: expr = new SingleValue(Convert.ToSingle(str)); break; case DataType.DataType_String: expr = new StringValue(str); break; default: throw new NotSupportedException("Unsupported data type: " + dp.DataType); } } else if (propDef.PropertyType == PropertyType.PropertyType_GeometricProperty) { FdoGeometryFactory fact = FdoGeometryFactory.Instance; OSGeo.FDO.Geometry.IGeometry geom = fact.CreateGeometry(str); byte[] fgf = fact.GetFgf(geom); expr = new GeometryValue(fgf); geom.Dispose(); } if (expr != null) values.Add(name, expr); } } } return values; }
internal static OpenXmlSimpleType[] CreatePossibleMembers(UnionValueRestriction unionValueRestriction) { OpenXmlSimpleType[] simpleValues = new OpenXmlSimpleType[unionValueRestriction.UnionTypes.Length]; switch (unionValueRestriction.UnionId) { // ST_AnimationDgmBuildType case 25: simpleValues[0] = new EnumValue<DocumentFormat.OpenXml.Drawing.AnimationBuildValues>(); simpleValues[1] = new EnumValue<DocumentFormat.OpenXml.Drawing.AnimationDiagramOnlyBuildValues>(); break; // ST_AnimationChartBuildType case 27: simpleValues[0] = new EnumValue<DocumentFormat.OpenXml.Drawing.AnimationBuildValues>(); simpleValues[1] = new EnumValue<DocumentFormat.OpenXml.Drawing.AnimationChartOnlyBuildValues>(); break; // ST_AdjCoordinate case 45: simpleValues[0] = new Int64Value(); simpleValues[1] = new StringValue(); break; // ST_AdjAngle case 46: simpleValues[0] = new Int32Value(); simpleValues[1] = new StringValue(); break; // ST_LayoutShapeType case 145: simpleValues[0] = new EnumValue<DocumentFormat.OpenXml.Drawing.ShapeTypeValues>(); simpleValues[1] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.OutputShapeValues>(); break; // ST_ParameterVal case 183: simpleValues[0] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.HorizontalAlignmentValues>(); simpleValues[1] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.VerticalAlignmentValues>(); simpleValues[2] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.ChildDirectionValues>(); simpleValues[3] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.ChildAlignmentValues>(); simpleValues[4] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.SecondaryChildAlignmentValues>(); simpleValues[5] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.LinearDirectionValues>(); simpleValues[6] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.SecondaryLinearDirectionValues>(); simpleValues[7] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.StartingElementValues>(); simpleValues[8] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.BendPointValues>(); simpleValues[9] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.ConnectorRoutingValues>(); simpleValues[10] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.ArrowheadStyleValues>(); simpleValues[11] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.ConnectorDimensionValues>(); simpleValues[12] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.RotationPathValues>(); simpleValues[13] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.CenterShapeMappingValues>(); simpleValues[14] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.NodeHorizontalAlignmentValues>(); simpleValues[15] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.NodeVerticalAlignmentValues>(); simpleValues[16] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.FallbackDimensionValues>(); simpleValues[17] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.TextDirectionValues>(); simpleValues[18] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.PyramidAccentPositionValues>(); simpleValues[19] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.PyramidAccentTextMarginValues>(); simpleValues[20] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.TextBlockDirectionValues>(); simpleValues[21] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.TextAnchorHorizontalValues>(); simpleValues[22] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.TextAnchorVerticalValues>(); simpleValues[23] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.TextAlignmentValues>(); simpleValues[24] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.AutoTextRotationValues>(); simpleValues[25] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.GrowDirectionValues>(); simpleValues[26] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.FlowDirectionValues>(); simpleValues[27] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.ContinueDirectionValues>(); simpleValues[28] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.BreakpointValues>(); simpleValues[29] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.OffsetValues>(); simpleValues[30] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.HierarchyAlignmentValues>(); simpleValues[31] = new Int32Value(); simpleValues[32] = new DoubleValue(); simpleValues[33] = new BooleanValue(); simpleValues[34] = new StringValue(); simpleValues[35] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.ConnectorPointValues>(); break; // ST_ModelId case 184: simpleValues[0] = new Int32Value(); simpleValues[1] = new StringValue(); break; // ST_FunctionValue case 207: simpleValues[0] = new Int32Value(); simpleValues[1] = new BooleanValue(); simpleValues[2] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.DirectionValues>(); simpleValues[3] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.HierarchyBranchStyleValues>(); simpleValues[4] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.AnimateOneByOneValues>(); simpleValues[5] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.AnimationLevelStringValues>(); simpleValues[6] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.ResizeHandlesStringValues>(); break; // ST_FunctionArgument case 209: simpleValues[0] = new EnumValue<DocumentFormat.OpenXml.Drawing.Diagrams.VariableValues>(); break; // ST_NonZeroDecimalNumber case 368: simpleValues[0] = new Int32Value(); simpleValues[1] = new Int32Value(); break; // ST_MarkupId case 375: simpleValues[0] = new Int32Value(); simpleValues[1] = new Int32Value(); break; // ST_HexColor case 404: simpleValues[0] = new EnumValue<DocumentFormat.OpenXml.Wordprocessing.AutomaticColorValues>(); simpleValues[1] = new HexBinaryValue(); break; // ST_DecimalNumberOrPercent case 507: simpleValues[0] = new StringValue(); simpleValues[1] = new Int32Value(); break; // ST_SignedHpsMeasure_O14 case 525: simpleValues[0] = new IntegerValue(); simpleValues[1] = new StringValue(); break; // ST_HpsMeasure_O14 case 528: simpleValues[0] = new UInt32Value(); simpleValues[1] = new StringValue(); break; // ST_SignedTwipsMeasure_O14 case 531: simpleValues[0] = new IntegerValue(); simpleValues[1] = new StringValue(); break; // ST_TwipsMeasure_O14 case 534: simpleValues[0] = new UInt32Value(); simpleValues[1] = new StringValue(); break; // ST_TransitionEightDirectionType case 544: simpleValues[0] = new EnumValue<DocumentFormat.OpenXml.Presentation.TransitionSlideDirectionValues>(); simpleValues[1] = new EnumValue<DocumentFormat.OpenXml.Presentation.TransitionCornerDirectionValues>(); break; // ST_TLTimeAnimateValueTime case 561: simpleValues[0] = new Int32Value(); simpleValues[1] = new EnumValue<DocumentFormat.OpenXml.Presentation.IndefiniteTimeDeclarationValues>(); break; // ST_TLTime_O12 case 603: simpleValues[0] = new UInt32Value(); simpleValues[1] = new EnumValue<DocumentFormat.OpenXml.Presentation.IndefiniteTimeDeclarationValues>(); break; // ST_TLTime_O14 case 604: simpleValues[0] = new StringValue(); simpleValues[1] = new EnumValue<DocumentFormat.OpenXml.Presentation.IndefiniteTimeDeclarationValues>(); break; // ST_PublishDate case 689: simpleValues[0] = new DateTimeValue(); simpleValues[1] = new DateTimeValue(); simpleValues[2] = new StringValue(); break; // ST_ChannelDataPoint case 697: simpleValues[0] = new DecimalValue(); simpleValues[1] = new BooleanValue(); break; // ST_ChannelPropertyName case 701: simpleValues[0] = new EnumValue<DocumentFormat.OpenXml.InkML.StandardChannelPropertyNameValues>(); simpleValues[1] = new StringValue(); break; // ST_BrushPropertyName case 704: simpleValues[0] = new EnumValue<DocumentFormat.OpenXml.InkML.StandardBrushPropertyNameValues>(); simpleValues[1] = new StringValue(); break; // ST_ChannelName case 707: simpleValues[0] = new EnumValue<DocumentFormat.OpenXml.InkML.StandardChannelNameValues>(); simpleValues[1] = new StringValue(); break; // ST_Units case 719: simpleValues[0] = new EnumValue<DocumentFormat.OpenXml.InkML.StandardLengthUnitsValues>(); simpleValues[1] = new EnumValue<DocumentFormat.OpenXml.InkML.StandardPerLengthUnitsValues>(); simpleValues[2] = new EnumValue<DocumentFormat.OpenXml.InkML.StandardTimeUnitsValues>(); simpleValues[3] = new EnumValue<DocumentFormat.OpenXml.InkML.StandardPerTimeUnitsValues>(); simpleValues[4] = new EnumValue<DocumentFormat.OpenXml.InkML.StandardMassForceUnitsValues>(); simpleValues[5] = new EnumValue<DocumentFormat.OpenXml.InkML.StandardPerMassForceUnitsValues>(); simpleValues[6] = new EnumValue<DocumentFormat.OpenXml.InkML.StandardAngleUnitsValues>(); simpleValues[7] = new EnumValue<DocumentFormat.OpenXml.InkML.StandardPerAngleUnitsValues>(); simpleValues[8] = new EnumValue<DocumentFormat.OpenXml.InkML.StandardOtherUnitsValues>(); simpleValues[9] = new EnumValue<DocumentFormat.OpenXml.InkML.StandardPerOtherUnitsValues>(); simpleValues[10] = new StringValue(); break; // ST_BrushPropertyValue case 732: simpleValues[0] = new DecimalValue(); simpleValues[1] = new BooleanValue(); simpleValues[2] = new EnumValue<DocumentFormat.OpenXml.InkML.PenTipShapeValues>(); simpleValues[3] = new EnumValue<DocumentFormat.OpenXml.InkML.RasterOperationValues>(); simpleValues[4] = new StringValue(); break; // ST_Ref case 746: simpleValues[0] = new StringValue(); simpleValues[1] = new UInt32Value(); break; // ST_CtxNodeType case 747: simpleValues[0] = new EnumValue<DocumentFormat.OpenXml.Office2010.Ink.KnownContextNodeTypeValues>(); simpleValues[1] = new StringValue(); break; // ST_SemanticType case 750: simpleValues[0] = new EnumValue<DocumentFormat.OpenXml.Office2010.Ink.KnownSemanticTypeValues>(); simpleValues[1] = new UInt32Value(); break; // ST_PointsOrInt case 753: simpleValues[0] = new ListValue<StringValue>(); simpleValues[1] = new Int32Value(); break; default: Debug.Assert(false); break; } Debug.Assert(simpleValues.Length > 0); return simpleValues; }
public void TestMaxValue() { var max = new DecimalValue(int.MaxValue, 10); AssertEquals(new Decimal(2147483647e10), max.ToBigDecimal()); }