public Field(string name, Address address, Value.ValueType type = Value.ValueType.Text, Vocabulary vocabulary = null) { _name = name; _address = address; _type = type; _vocabulary = vocabulary; }
public Field(string name, Address address, Value.ValueType type = Value.ValueType.Text, Vocabulary vocabulary = null) { _name = name; _address = address; _type = type; _vocabulary = vocabulary; }
protected override Value GetValue(int row, int col, Value.ValueType type = Value.ValueType.Text) { if (_worksheet == null) { throw new CursorException("Worksheet is Null for Excel2007 Cursor"); } if (row <= 0 || col <= 0) { throw new CursorException("Row and Column Indexes should be positive (>=1)"); } var range = _worksheet.Cells[row, col]; if (range == null || range.Value == null) { return(""); } if (type == Value.ValueType.Date || range.Value is DateTime) { return(Convert.ToDateTime(range.Value)); } return(range.Value.ToString()); }
public InvalidIndexTypeException( string arrayOrTableType, Value.ValueType type, SourceRef location ) : base(arrayOrTableType + " cannot be indexed with type \"" + type + "\"", location) { }
public NoMethodForTypeException( Value.ValueType type, string methodName, SourceRef location ) : base("No method \"" + methodName + "\" exists for type \"" + type + "\"", location) { }
protected override Value GetValue(int row, int col, Value.ValueType type = Value.ValueType.Text) { if (_worksheet == null) { throw new CursorException("Worksheet is Null for Excel2003 Cursor"); } if (row <= 0 || col <= 0) { throw new CursorException("Row and Column Indexes should be positive (>=1)"); } var cell = _worksheet.Cells[row - 1, col - 1]; if (cell == null || cell.Value == null || cell.IsEmpty) { return(""); } //var cellType = cell.Format.FormatType; if (type == Value.ValueType.Date) { return(cell.DateTimeValue); } if (type == Value.ValueType.Number) { return(Convert.ToDouble(cell.Value)); } return(cell.StringValue); }
public UnexpectedRightTypeException( Value.ValueType got, Value.ValueType expected, SourceRef location ) : base("Expected right operand type \"" + expected + "\" but got \"" + got + "\"", location) { }
static public Value Convert(SXLexemValue value, Value.ValueType type) { if (value == null) { throw new ArgumentException("Can't convert null LexemValue to Value"); } switch (type) { case Value.ValueType.Date: { if (value.Type == SXLexemValue.ValueType.Date) { return((value as SXLexemDate).Value); } if (value.Type == SXLexemValue.ValueType.Text) { return(SXLexemDate.ParseDatetime((value as SXLexemText).Value)); } break; } case Value.ValueType.Number: { if (value.Type == SXLexemValue.ValueType.Number) { return((value as SXLexemNumber).Value); } if (value.Type == SXLexemValue.ValueType.Text) { return(SXLexemNumber.ParseDouble((value as SXLexemText).Value, true)); } break; } default: { if (value.Type == SXLexemValue.ValueType.Text) { return((value as SXLexemText).Value); } if (value.Type == SXLexemValue.ValueType.Number) { return((value as SXLexemNumber).Value.ToString()); } if (value.Type == SXLexemValue.ValueType.Date) { return((value as SXLexemDate).Value.ToString()); } break; } } throw new ReportGrabberException(String.Format("LexemValue {0} not recognized as Value", value.ToString())); }
public Text actionValueText; //行动数值 #endregion //初始化敌人 public bool CheckState(Value.ValueType stateType) //状态检测 { foreach (var state in stateList) { if (state.type == stateType && state.value > 0) { return(true); } } return(false); }
public override Value GetValue(Address address, Value.ValueType type = Value.ValueType.Text) { if (address == null || String.IsNullOrEmpty(address.Uri)) { return(""); } var adr = address.Uri; //calculate column index or RC value int row = _row, col = 0; if (Int32.TryParse(adr, out col) || CursorExcel.ParseExcelAddress(adr, ref row, ref col)) { return(this.GetValue(row, col, type)); } //calculate expression var expression = adr.StartsWith("=") ? adr.Substring(1) : adr; var calc = SXExpression.Calculate(expression, _environment); if (calc == null || calc.Value == null) { throw new CursorException("Can't evaluate expression"); } return(Value.Convert(calc.Value, type)); //calculate expression //if (adr.StartsWith("=") && adr.Length > 1) // return SXExpression.Calculate(adr.Substring(1), _environment); ////get '...' value //if (adr.Length >= 2 && adr.IndexOf('\'') == 0 && adr.IndexOf('\'', 1) == adr.Length - 1) // return Value.Convert(adr.Substring(1, adr.Length - 2), type); ////get concatination ... + ... + ... //if (adr.Contains('+')) //{ // var parts = adr.Split(new char[] { '+' }, StringSplitOptions.RemoveEmptyEntries); // return Value.Convert(String.Join("", parts.Select(part => this.GetValue(part).ToString())), type); //} //throw new CursorException(String.Format("Excel Address not recognized: {0}", adr)); }
static public Value Convert(Value value, Value.ValueType type) { if (value == null) { return(null); } if (value.Type == type) { return(value); } switch (type) { case Value.ValueType.Number: return(SXLexemNumber.ParseDouble(value.ToString(), true)); case Value.ValueType.Date: return(SXLexemDate.ParseDatetime(value.ToString())); default: return(value.ToString()); } }
public UnexpectedRightTypeException( Value.ValueType type, SourceRef location ) : base("Unexpected right operand type \"" + type + "\"", location) { }
public CannotGetIndexInTypeException( Value.ValueType type, SourceRef location ) : base("Cannot get a value from an index in type \"" + type + "\"", location) { }
public CannotIndexTypeException( Value.ValueType type, SourceRef location ) : base("Cannot index type \"" + type + "\"", location) { }
protected abstract Value GetValue(int row, int col, Value.ValueType type = Value.ValueType.Text);
public UnexpectedTypeException( Value.ValueType type, SourceRef location ) : base("Unexpected type \"" + type + "\"", location) { }
public abstract Value GetValue(Address address, Value.ValueType type = Value.ValueType.Text);
public CannotCallTypeException( Value.ValueType type, SourceRef location ) : base("Cannot call a value of type " + type, location) { }
public CannotThreadTypeException( Value.ValueType type, SourceRef location ) : base("Cannot start a thread with a value of type " + type, location) { }