protected SimpleExchangeItem(string locationID, string quantityID, SimpleLinkableComponent linkableComponent) { _id = locationID + "." + quantityID; _linkableComponent = linkableComponent; _values = new ValueSet <Double>(Double.NaN); _valueDefinition = new SimpleQuantity(quantityID); }
public TimeSeriesOutputItem(string id, IValueDefinition valueDefinition, IElementSet elementSet, TimeSeriesComponent timeSeriesComponent) : base(id, valueDefinition, elementSet) { _timeSeriesComponent = timeSeriesComponent; _timeSet = timeSeriesComponent._buffer.TimeSet; _values = timeSeriesComponent._buffer.ValueSet; }
public override IEnumerable <IValidationAction> BuildValidationActions(IValidationAction condition) { IValidationAction fieldCondition = null; foreach (IValidationAction action in base.BuildValidationActions(condition)) { if (fieldCondition == null) { fieldCondition = action; } yield return(action); } Debug.Assert(fieldCondition != null); fieldCondition = new VerifySelectListPresenceAction(fieldCondition, this); yield return(fieldCondition); IValueDefinition previousValue = null; IValidationAction valueCondition = null; foreach (IValueDefinition value in Values) { foreach (IValidationAction action in value.BuildValidationActions(fieldCondition)) { if (valueCondition == null) { valueCondition = action; } if (action != fieldCondition) { yield return(action); } } valueCondition = new VerifySelectOptionPresenceAction(valueCondition, value); yield return(valueCondition); yield return(new VerifySelectOptionTitleAction(valueCondition, value)); yield return(new VerifySelectOptionParentAction(valueCondition, value, this)); yield return(new VerifySelectOptionOrderAction(valueCondition, value, previousValue)); previousValue = value; valueCondition = fieldCondition; } Debug.Assert((previousValue == null) == (valueCondition == null)); // ReSharper disable ConditionIsAlwaysTrueOrFalse if (previousValue != null) { yield return(new VerifySelectOptionOrderAction(fieldCondition, null, previousValue)); } // ReSharper restore ConditionIsAlwaysTrueOrFalse }
public InputSpace(IValueDefinition valueDefinition, ISpatialDefinition spatialDefinition, IBaseLinkableComponent component, IValueSetConverter valueSetConverter) : base(valueDefinition, spatialDefinition, component) { _valueSetConverter = valueSetConverter; if (_valueSetConverter != null) _valueSetConverter.ExchangeItem = this; }
public InputSpaceTime(IIdentifiable identity, IValueDefinition valueDefinition, ISpatialDefinition spatialDefinition, IBaseLinkableComponent component, IValueSetConverterTime valueSetConverterTime) : base(identity, valueDefinition, spatialDefinition, component) { _valueSetConverterTime = valueSetConverterTime; if (_valueSetConverterTime != null) _valueSetConverterTime.ExchangeItem = this; }
public EngineExchangeItem(string id, IValueDefinition valueDefinition, IElementSet elementSet, LinkableEngine linkableEngine) : base(id, valueDefinition, elementSet) { _linkableEngine = linkableEngine; _storeValuesInExchangeItem = linkableEngine.DefaultForStoringValuesInExchangeItem; _component = linkableEngine; _timeSet = new TimeSet(); }
public Output(IIdentifiable identity, IValueDefinition valueDefinition, IBaseLinkableComponent component, IValueSetConverter valueSetConverter) : base(identity, valueDefinition, component) { _valueSetConverter = valueSetConverter; if (_valueSetConverter != null) _valueSetConverter.ExchangeItem = this; }
public void Initialise(ITimeSpaceComponent iLC, IValueDefinition iVD, IElementSet iES) { _iValueDefinition = iVD; _iElementSet = iES; _iComponent = iLC; _iDescribable = new Describable( string.Format("{0}, {1}", _iValueDefinition.Caption, _iElementSet.Caption), string.Format("{0}, {1}", _iValueDefinition.Description, _iElementSet.Description)); }
public BaseExchangeItem(IIdentifiable identity, IBaseLinkableComponent component, IValueDefinition iValueDefinition, IValueSetConverter iValueSetConverter) : base(identity, component, iValueDefinition) { // _componentId = _component != null ? _component.Id : string.Empty; _valueSetConverter = iValueSetConverter; if (_valueSetConverter != null) _valueSetConverter.ExchangeItem = this; }
protected EngineOutputItem(string id, IValueDefinition valueDefinition, IElementSet elementSet, LinkableEngine linkableEngine) : base(id, valueDefinition, elementSet) { _linkableEngine = linkableEngine; _component = linkableEngine; _timeSet = new TimeSet { HasDurations = false }; _storeValuesInExchangeItem = linkableEngine.DefaultForStoringValuesInExchangeItem; }
public static bool DescribesSameAs(IValueDefinition valueDefinition1, IValueDefinition valueDefinition2) { if (((valueDefinition1 is IQuality) && (valueDefinition2 is IQuantity)) || ((valueDefinition1 is IQuantity) && (valueDefinition2 is IQuality))) { return(false); } if (valueDefinition1 is IQuantity) { return(Dimension.DescribesSameAs(((IQuantity)valueDefinition1).Unit.Dimension, ((IQuantity)valueDefinition2).Unit.Dimension)); } return(true); }
private Type GetNewType(Type targetPropertyType, IValueDefinition valueDefinition) { var type = targetPropertyType ?? typeof(IInputValue); var genericParams = new[] { valueDefinition.Type }; if (type.IsGenericType) { genericParams = type.GetGenericArguments(); type = type.GetGenericTypeDefinition(); } if (TypeHelper.ContainsCompatibleType(type, typeof(IActivity<>), typeof(IInputValue), typeof(IInputValue<>), typeof(IOutputValue), typeof(IOutputValue<>))) { return typeof(VariableReference<>).MakeGenericType(genericParams); } throw new InvalidCastException(); }
protected override Type GetNewType(Type targetPropertyType, IValueDefinition valueDefinition) { var type = targetPropertyType ?? typeof(IInputValue); var genericParams = new[] { valueDefinition.Type }; if (type.IsGenericType) { genericParams = type.GetGenericArguments(); type = type.GetGenericTypeDefinition(); } var argumentDefinition = valueDefinition as IArgumentDefinition; if (argumentDefinition != null) { switch (argumentDefinition.Direction) { case Direction.In: if (TypeHelper.ContainsCompatibleType(type, typeof(IActivity<>), typeof(IInputValue), typeof(IInputValue<>))) { return typeof(InArgumentReference<>).MakeGenericType(genericParams); } break; case Direction.Out: if (TypeHelper.ContainsCompatibleType(type, typeof(IOutputValue), typeof(IOutputValue<>))) { return typeof(OutArgumentReference<>).MakeGenericType(genericParams); } break; case Direction.InOut: if (TypeHelper.ContainsCompatibleType(type, typeof(IActivity<>), typeof(IInputValue), typeof(IInputValue<>))) { return typeof(InArgumentReference<>).MakeGenericType(genericParams); } if (TypeHelper.ContainsCompatibleType(type, typeof(IOutputValue), typeof(IOutputValue<>))) { return typeof(OutArgumentReference<>).MakeGenericType(genericParams); } break; } } throw new InvalidCastException(); }
public BufferedOutputItem(string id, IValueDefinition quantity, IElementSet elementSet, ILinkableComponent component) : base(id, quantity, elementSet) { Component = component; }
public VerifySelectOptionTitleAction(IValidationAction condition, IValueDefinition value) : base(condition, value) { }
public InputExchangeItem(string id, IValueDefinition valueDefinition, IElementSet elementSet) : base(id, valueDefinition, elementSet) { }
public VerifySelectOptionParentAction(IValidationAction condition, IValueDefinition value, IFieldDefinition field) : base(condition, value) { }
public EngineDInputItem(string id, IValueDefinition valueDefinition, IElementSet elementSet, LinkableEngine comp) : base(id, valueDefinition, elementSet, comp) { _component = comp; }
protected ExchangeItem(string id, IValueDefinition valueDefinition, ISpatialDefinition spatialDefinition) : this(id) { _valueDefinition = valueDefinition; _spatialDefinition = spatialDefinition; }
void updateSourcesTreeView() { treeViewSources.SuspendLayout(); treeViewSources.Nodes.Clear(); fastLookUpOutputs = new Dictionary <UIOutputItem, TreeNode>(); UIModel sourceModel = connection.SourceModel; Dictionary <string, TreeNode> quantities = new Dictionary <string, TreeNode>(); foreach (IBaseOutput output in sourceModel.LinkableComponent.Outputs) { IValueDefinition value = output.ValueDefinition; TreeNode node = null; if (!quantities.ContainsKey(value.Caption)) { node = new TreeNode(value.Caption); node.ImageKey = "valueDef"; quantities.Add(value.Caption, node); treeViewSources.Nodes.Add(node); } else { node = quantities[value.Caption]; } TreeNode item = new TreeNode(output.Id); item.ImageKey = "id"; item.Tag = output; node.Nodes.Add(item); if (output is ITimeSpaceOutput) { ITimeSpaceOutput tspaceOutput = (ITimeSpaceOutput)output; UIOutputItem uitem = (from n in connection.Links where n.FindInChain(tspaceOutput) != null select n.FindInChain(tspaceOutput)).FirstOrDefault(); if (uitem != null) { item.Tag = uitem; fastLookUpOutputs.Add(uitem, item); expandOutputItem(item, uitem); } else { uitem = new UIOutputItem(tspaceOutput); item.Tag = uitem; fastLookUpOutputs.Add(uitem, item); } if (tspaceOutput.SpatialDefinition is IElementSet) { IElementSet eSet = (IElementSet)tspaceOutput.SpatialDefinition; switch (eSet.ElementType) { case ElementType.IdBased: item.ImageKey = "id"; break; case ElementType.Point: if (!eSet.HasZ) { item.ImageKey = "point2d"; item.SelectedImageKey = "point2d"; } else { item.ImageKey = "point3d"; item.SelectedImageKey = "point3d"; } break; case ElementType.Polygon: if (!eSet.HasZ) { item.ImageKey = "polygon2d"; item.SelectedImageKey = "polygon2d"; } else { item.ImageKey = "polygon3d"; item.SelectedImageKey = "polygon3d"; } break; case ElementType.Polyhedron: item.ImageKey = "polyhedra"; item.SelectedImageKey = "polyhedra"; break; case ElementType.PolyLine: if (!eSet.HasZ) { item.ImageKey = "mline2d"; item.SelectedImageKey = "mline2d"; } else { item.ImageKey = "mline3d"; item.SelectedImageKey = "mline3d"; } break; } } } } treeViewSources.ExpandAll(); treeViewSources.ResumeLayout(); }
public VerifySelectOptionOrderAction(IValidationAction condition, IValueDefinition value, IValueDefinition previousValue) : base(condition, value) { }
public ValueDefinition(IValueDefinition iValueDefinition) : base(iValueDefinition) { _valueType = iValueDefinition.ValueType.ToString(); }
public ValueValidationAction(IValidationAction condition, IValueDefinition value) : base(condition) { Value = value; }
public OutputSpaceTimeComponent1(IIdentifiable identity, IBaseLinkableComponent component, IValueDefinition iValueDefinition, ISpatialDefinition iSpatialDefinition, string engineVariable, Vector3d<double> missingValue, int elementCount) : base(identity, iValueDefinition, iSpatialDefinition, component, new ValueSetConverterTimeEngineDoubleVector3dStandard1(engineVariable, missingValue, elementCount)) { }
protected ExchangeItem(string id, IValueDefinition valueDefinition, ISpatialDefinition spatialDefinition) : this(id) { _valueDefinition = valueDefinition; _spatialDefinition = spatialDefinition; }
public InputSpaceTimeUserVariables(IIdentifiable identity, IBaseLinkableComponent component, IValueDefinition iValueDefinition, ISpatialDefinition iSpatialDefinition, string engineVariable, double missingValue, int elementCount) : base(identity, iValueDefinition, iSpatialDefinition, component, new ValueSetConverterTimeEngineDouble(engineVariable, missingValue, elementCount, ValueSetConverterTimeRecordBase<double>.InterpolationTemporal.Linear)) { UserVariables = new Dictionary<string, string>(); }
public SimpleOutput(string id, IValueDefinition valueDefinition, IElementSet elementSet) : base(id, valueDefinition, elementSet) { }
public static bool DescribesSameAs(IValueDefinition valueDefinition1, IValueDefinition valueDefinition2) { if ( ((valueDefinition1 is IQuality) && (valueDefinition2 is IQuantity)) || ((valueDefinition1 is IQuantity) && (valueDefinition2 is IQuality)) ) return false; if (valueDefinition1 is IQuantity) { return Dimension.DescribesSameAs(((IQuantity)valueDefinition1).Unit.Dimension, ((IQuantity)valueDefinition2).Unit.Dimension); } return true; }
public EngineSInputItem(string id, IValueDefinition valueDefinition, IElementSet elementSet, LinkableEngine linkableEngine) : base(id, valueDefinition, elementSet, linkableEngine) { }
public OutputSpaceTimeUserVariables(IIdentifiable identity, IBaseLinkableComponent component, IValueDefinition iValueDefinition, ISpatialDefinition iSpatialDefinition, string engineVariable, Vector3d<double> missingValue, int elementCount) : base(identity, iValueDefinition, iSpatialDefinition, component, new ValueSetConverterTimeEngineDoubleVector3d(engineVariable, missingValue, elementCount, ValueSetConverterTimeRecordBase<Vector3d<double>>.InterpolationTemporal.Linear)) { }
public Output(string id, IValueDefinition valueDefinition, IElementSet elementSet) : base(id, valueDefinition, elementSet) { }
public Object GetValue(IValueDefinition valueDefinition) { CheckValueDefinitionRegistered(valueDefinition); return _values[valueDefinition].Value; }
public EngineEOutputItem(string id, IValueDefinition valueDefinition, IElementSet elementSet, LinkableGetSetEngine linkableEngine) : base(id, valueDefinition, elementSet, linkableEngine) { _getSetEngine = linkableEngine; }
public void SetValue(IValueDefinition valueDefinition, Object value) { CheckValueDefinitionRegistered(valueDefinition); _values[valueDefinition].Value = TypeHelper.Convert(value, valueDefinition.Type); }
private void CheckValueDefinitionRegistered(IValueDefinition valueDefinition) { var argumentDefinition = valueDefinition as IArgumentDefinition; if (argumentDefinition != null) { if (_values.ContainsKey(argumentDefinition)) { return; } throw new InvalidOperationException("Argument not registered"); } var variableDefinition = valueDefinition as IVariableDefinition; if (variableDefinition != null) { if (_values.ContainsKey(variableDefinition)) { return; } throw new InvalidOperationException("Variable not registered"); } throw new ArgumentException("Value definition could not be found"); }
public OutputItem(string id, IValueDefinition valueDefinition, IElementSet elementSet, LinkableEngine component) : base(id, valueDefinition, elementSet, component) { // no additional action needed }