public bool CreateInstance(Guid userId, Guid assetId, string assetName, Guid assetTypeId, Guid instanceOfId) { if (this.bizLayer.CreateInstance(userId, assetId, assetName, assetTypeId, instanceOfId)) { XValue pv = new XValue(Constants.XPropertyIds.AssetName, assetId, assetName, userId); //if (isAutoApprove) //{ pv.Approved = pv.Created; pv.ApprovedBy = pv.CreatedBy; //} XSubmittal submittal = new XSubmittal(assetId, assetName, userId); submittal.PropertyValues.Add(pv); if (new XSubmittalLayer().Save(submittal, true, userId)) { ThreadPool.QueueUserWorkItem(o => new SqlDatabaseLayer().InsertIntoGenTables(assetId, true, assetTypeId)); return(true); } } return(false); }
public object Eval(XValue value, Dictionary<string, object> modules, ContextParameterList parameters) { if (value.Expression != null) return EvalScript(value.Expression, modules, parameters); else return value.Value; }
public IEnumerable <IDataPoint <TItem> > GenerateDataPoints(IEnumerable <TItem> items) { var data = items .Select(d => new ListPoint <TItem> { X = XValue.Invoke(d), Y = new List <decimal?> { Open.Invoke(d), High.Invoke(d), Low.Invoke(d), Close.Invoke(d) }, Items = new List <TItem> { d } }); if (OrderBy != null) { data = data.OrderBy(OrderBy); } else if (OrderByDescending != null) { data = data.OrderByDescending(OrderByDescending); } return(UpdateDataPoints(data, DataPointMutator)); }
/// <summary> /// Adds a value to the XSeries. /// </summary> public XValue Add(string value) { XValue xValue = new XValue(value); Add(xValue); return(xValue); }
private List <Range <XValue> > FindTCERanges(DataSeries tceSeries) { List <int> stateChanges = new List <int>(); List <Range <XValue> > ranges = new List <Range <XValue> >(); XValue start; XValue end; for (int i = 1; i < tceSeries.DataPoints.Count; i++) { if (tceSeries[i - 1].Value != tceSeries[i].Value) { stateChanges.Add(i); } } for (int i = 1; i < stateChanges.Count; i++) { int startIndex = stateChanges[i - 1]; int endIndex = stateChanges[i] - 1; if (tceSeries[startIndex].Value != 0.0D) { start = new XValue(startIndex, tceSeries[startIndex].Time); end = new XValue(endIndex, tceSeries[endIndex].Time); ranges.Add(new Range <XValue>(start, end)); } } return(ranges); }
public override PageDefinition Parse(string resourceLocation) { var result = new PageDefinition(); var action = new PageAction("GET"); var moduleDefinitionList = new ModuleDefinitionList(); var pageParameters = new PageParameterList(); var viewComponentDefinition = _viewCatalog.Get(typeof(XHtmlView).Name); if (viewComponentDefinition == null) throw new XrcException(string.Format("View '{0}' not found on catalog.", typeof(XHtmlView).Name)); var view = new ViewDefinition(viewComponentDefinition, null); string propertyName = "Content"; var viewProperty = viewComponentDefinition.Type.GetProperty(propertyName); if (viewProperty == null) throw new XrcException(string.Format("Property '{0}' for type '{1}' not found.", propertyName, viewComponentDefinition.Type.FullName)); XDocument content = _resourceProvider.ResourceToXml(resourceLocation); var propertyValue = new XValue(viewProperty.PropertyType, content); view.Properties.Add(new XProperty(viewProperty, propertyValue)); action.Views.Add(view); result.Actions.Add(action); return result; }
/* * Implementation of std::'. */ internal void NativeQuote(CPU cpu) { string t = NextToken(); XValue cv = ParseConst(t); if (!cv.IsUninitialized) { CurrentBuilder.Special(cpu2 => { cpu2.Interpreter.CurrentBuilder.Literal(cv); }); } else { t = CompleteName(t); CurrentBuilder.Special(cpu2 => { Function fi = Function.LookupImmediate(t); if (fi != null) { fi.Run(cpu2); } else { cpu2.Interpreter.CurrentBuilder.Call(t); } }); } }
/// <summary> /// Constructor for setting up the interval /// </summary> /// <param name="xInterval">parameter for X interval</param> /// <param name="xStep">parameter for number of X steps</param> /// <param name="yInterval">parameter for Y interval</param> /// <param name="yStep">parameter for number of Y steps</param> /// <param name="origo">parameter for Origo</param> public Interval(int xInterval, int xStep, int yInterval, int yStep, Point origo) { SetUpIntervals(xInterval, xStep, yInterval, yStep, origo); XValue.Add("0"); YValue.Add("0"); this.xMax = xInterval * xStep; this.yMax = yInterval * yStep; }
private void Remove(XValue value) { if (value == null) { return; } value.PropertyChanged -= ObserveValue; }
/// <summary> /// Serves as a hash function for a particular type. /// </summary> /// <returns> /// A hash code for the current <see cref="Object"/>. /// </returns> public override int GetHashCode() { unchecked { int hashCode = ((XValue != null) ? XValue.GetHashCode() : 0); hashCode = (hashCode * 397) ^ ((YValue != null) ? YValue.GetHashCode() : 0); return(hashCode); } }
internal override void Run(CPU cpu) { XValue v = cpu.Pop(); if (!v.Bool) { base.Run(cpu); } }
private void Add(XValue value) { if (value == null) { return; } value.PropertyChanged += ObserveValue; }
internal override void Run(CPU cpu) { XValue xv = cpu.Pop(); if (ltype != null && !xv.VType.IsSubTypeOf(ltype)) { throw new Exception(string.Format("write of value of type {0} into a local variable of type {1}", xv.VType.Name, ltype.Name)); } cpu.PutLocal(num, xv); }
protected override MutableObject Mutate(MutableObject mutable) { QuaternionTarget.SetValue(new Quaternion( XValue.GetFirstValue(mutable), YValue.GetFirstValue(mutable), ZValue.GetFirstValue(mutable), WValue.GetFirstValue(mutable)), mutable); return(mutable); }
internal void Put(CPU cpu) { XValue xv = cpu.Pop(); if (ltype != null && !xv.VType.IsSubTypeOf(ltype)) { throw new Exception(string.Format("write of value of type {0} into local variable {1} of type {2}", xv.VType.Name, debugName, ltype.Name)); } val = xv; }
private static void AddProperty(ComponentDefinition viewComponentDefinition, ViewDefinition view, string propertyName, object propertyValue) { var viewProperty = viewComponentDefinition.Type.GetProperty(propertyName); if (viewProperty == null) throw new XrcException(string.Format("Property '{0}' for type '{1}' not found.", propertyName, viewComponentDefinition.Type.FullName)); var propertyXValue = new XValue(viewProperty.PropertyType, propertyValue); view.Properties.Add(new XProperty(viewProperty, propertyXValue)); }
public void SetBase(double _dXStt, double _dXEnd, double _dXUnit, double _dYStt, double _dYEnd, double _dYUnit, XValue _eValue) { dXStt = _dXStt; dXEnd = _dXEnd; dXUnit = _dXUnit; dYStt = _dYStt; dYEnd = _dYEnd; dYUnit = _dYUnit; XUnit = _eValue; }
/* * Read a local variable (by index). */ internal XValue GetLocal(int num) { XValue v = rsp.localFields[num]; if (v.IsUninitialized) { throw new Exception(string.Format("reading uninitialized local value {0}", num)); } return(v); }
public VectorSlider(PropertyInfo prop, object owner, float min = 0, float max = 1, NodeType type = NodeType.Float4, bool isInt = false) { InitializeComponent(); property = prop; propertyOwner = owner; this.min = min; this.max = max; switch (type) { case NodeType.Float2: ZView.Visibility = Visibility.Collapsed; WView.Visibility = Visibility.Collapsed; break; case NodeType.Float3: ZView.Visibility = Visibility.Visible; WView.Visibility = Visibility.Collapsed; break; case NodeType.Float4: ZView.Visibility = Visibility.Visible; WView.Visibility = Visibility.Visible; break; } object b = prop.GetValue(owner); if (b == null) { pc = new VectorPropertyContainer(new MVector()); } else { MVector vec = (MVector)b; pc = new VectorPropertyContainer(vec); } pc.OnUpdate += Pc_OnUpdate; var xprop = pc.GetType().GetProperty("XProp"); var yprop = pc.GetType().GetProperty("YProp"); var zprop = pc.GetType().GetProperty("ZProp"); var wprop = pc.GetType().GetProperty("WProp"); XValue.IsInt = isInt; YValue.IsInt = isInt; ZValue.IsInt = isInt; WValue.IsInt = isInt; XValue.Set(min, max, xprop, pc); YValue.Set(min, max, yprop, pc); ZValue.Set(min, max, zprop, pc); WValue.Set(min, max, wprop, pc); }
public BreakerTiming(XValue timeEnergized, DataSeries statusChannel, double speed) { m_timeEnergized = timeEnergized; if ((object)statusChannel != null) { m_timeCleared = FindStatusBitSet(statusChannel, timeEnergized.Index); } m_speed = speed; }
internal void PutIndexed(CPU cpu) { int k = PopIndex(cpu); XValue xv = cpu.Pop(); if (ltype != null && !xv.VType.IsSubTypeOf(ltype)) { throw new Exception(string.Format("write of value of type {0} into local variable {1} (index: {2}) of type {3}", xv.VType.Name, debugName, k, ltype.Name)); } vals[k] = xv; }
protected override MutableObject Mutate(MutableObject mutable) { foreach (var entry in VectorScope.GetEntries(mutable)) { Vector3Target.SetValue(new Vector3( XValue.GetFirstValueBelowArrity(entry), YValue.GetFirstValueBelowArrity(entry), ZValue.GetFirstValueBelowArrity(entry)), entry); } return(mutable); }
public override int GetHashCode() { unchecked { var hashCode = XValue.GetHashCode(); hashCode = (hashCode * 397) ^ YValue.GetHashCode(); hashCode = (hashCode * 397) ^ ZValue.GetHashCode(); hashCode = (hashCode * 397) ^ Timestamp.GetHashCode(); return(hashCode); } }
/* * Push a value on the data stack. */ internal void Push(XValue v) { int len = stackBuf.Length; if (++stackPtr == len) { XValue[] nbuf = new XValue[len << 1]; Array.Copy(stackBuf, 0, nbuf, 0, len); stackBuf = nbuf; } stackBuf[stackPtr] = v; }
/* * Pop a value from the data stack. */ internal XValue Pop() { if (stackPtr <= topMarker) { throw new Exception("stack underflow"); } XValue v = stackBuf[stackPtr]; stackBuf[stackPtr].Clear(); stackPtr--; return(v); }
protected override MutableObject Mutate(MutableObject mutable) { foreach (var entry in Vector.GetEntries(mutable)) { var vector = Vector.GetValue(entry); XValue.SetValue(vector.x, entry); YValue.SetValue(vector.y, entry); ZValue.SetValue(vector.z, entry); } return(mutable); }
/* * Add the provided value, and get the index to use to reference * that value from generated code. If the value is uninitialized, * restricted, or virtual (i.e. std::int), then no extra bytes * will appear in the output, and this method returns -1. */ internal static int AddValue(XValue xv) { EmitInstance ei = AddValueInner(xv); if (ei == null) { return(-1); } int r = valueRefs.Count; valueRefs.Add(ei); return(r); }
static EmitInstance AddValueInner(XValue xv) { if (xv.IsUninitialized) { return(null); } XType vt = xv.VType; if (vt.IsRestricted || vt == XType.INT) { return(null); } return(AddInstance(xv.XObject)); }
internal XValue this[int index] { get { CheckIndex(index); XValue xv = dataBuf.Get(dataOff + index); if (xv.IsUninitialized) { throw new Exception("reading uninitialized array element"); } return(xv); } set { CheckIndex(index); dataBuf.Set(dataOff + index, value); } }
internal XStoredProcedureResponse(StoredProcedureResponse spResponse, BindableDynamicObject.XmlSettings xmlSettings) { if (xmlSettings == null) { xmlSettings = new BindableDynamicObject.XmlSettings(); } _OriginalResponse = spResponse ?? new StoredProcedureResponse(xmlSettings); _ResultSets = new XResultSets(_OriginalResponse.ResultSets); if (_OriginalResponse.ReturnValue != null) { _ReturnValue = new XValue(_OriginalResponse.ReturnValue, xmlSettings); } }
public PhaseTiming(DataSeries waveform, CycleDataGroup cycleDataGroup, BreakerTiming breakerTiming, double systemFrequency, double openBreakerThreshold) { m_waveform = waveform; m_cycleDataGroup = cycleDataGroup; m_systemFrequency = systemFrequency; m_timeCleared = FindBreakerOpen(breakerTiming.TimeEnergized.Index, openBreakerThreshold); if ((object)m_timeCleared != null) { m_timing = (m_timeCleared.Time - breakerTiming.TimeEnergized.Time).TotalSeconds * systemFrequency; } else { m_timing = double.NaN; } }
internal override void Run(CPU cpu) { int k = cpu.Pop().Int; if (k < 0 || k >= len) { throw new Exception(string.Format("local index out of bounds: {0} (max: {1})", k, len)); } XValue xv = cpu.Pop(); if (ltype != null && !xv.VType.IsSubTypeOf(ltype)) { throw new Exception(string.Format("write of value of type {0} into a local variable of type {1}", xv.VType.Name, ltype.Name)); } cpu.PutLocal(off + k, xv); }
/* * Inverse rotate the data stack. NRot(depth) undoes the effect * of Rot(depth). */ internal void NRot(int depth) { if (stackPtr <= (topMarker + depth) || depth < 0) { throw new Exception("stack underflow"); } if (depth == 0) { return; } XValue v = stackBuf[stackPtr]; Array.Copy(stackBuf, stackPtr - depth, stackBuf, stackPtr - (depth - 1), depth); stackBuf[stackPtr - depth] = v; }
private XProperty ParseProperty(XElement element, Type ownerType, PageDefinition parserResult) { string propertyName = element.Name.LocalName; var property = ownerType.GetProperty(propertyName, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance); if (property == null) { //XProperty propertyFile = ParsePropertyFile(item, ownerType, propertyName, element.Value); //if (propertyFile != null) // return propertyFile; throw new ApplicationException(string.Format("Property '{0}' not found on type '{1}.", propertyName, ownerType)); } if (element.HasElements) { if (property.PropertyType == typeof(XDocument)) { if (element.Elements().Count() > 1) throw new ApplicationException(string.Format("Element '{0}' not recognized for property '{1}', there is no root.", element.Name, property.Name)); else { // TODO Valutare se c'è un modo migliore per passare da un XElement a un XDocument // o valutare se usare invece XElement direttamente e non richiedere un XDocument string xmlContent = element.Elements().First().ToString(); var xValue = new XValue(property.PropertyType, XDocument.Parse(xmlContent)); return new XProperty(property, xValue); } } else throw new ApplicationException(string.Format("Element '{0}' not recognized for property '{1}'", element.Name, property.Name)); } else if (element.IsEmpty == false) { var xValue = _scriptService.Parse(element.Value, property.PropertyType, parserResult.Modules, parserResult.Parameters); return new XProperty(property, xValue); } else throw new ApplicationException(string.Format("Invalid element '{0}', value not defined.", element.Name)); }
/// <summary> /// Adds a value to the XSeries. /// </summary> public XValue Add(string value) { XValue xValue = new XValue(value); Add(xValue); return xValue; }