Exemple #1
0
        /// <summary>
        /// Creates a copy of the current instance.
        /// </summary>
        /// <returns>Copy of the instance</returns>
        public object Clone()
        {
            SmartBufferDataOperation clone = new SmartBufferDataOperation();

            clone._relaxationFactor     = _relaxationFactor;
            clone._doExtendedValidation = _doExtendedValidation;
            clone._isActivated          = _isActivated;
            clone._arguments            = new Argument[ArgumentCount];
            for (int i = 0; i < ArgumentCount; i++)
            {
                clone._arguments[i]             = new HydroNumerics.OpenMI.Sdk.Backbone.Argument();
                clone._arguments[i].Description = _arguments[i].Description;
                clone._arguments[i].Key         = _arguments[i].Key;
                clone._arguments[i].ReadOnly    = _arguments[i].ReadOnly;
                clone._arguments[i].Value       = _arguments[i].Value;
            }
            return(clone);
        }
        /// <summary>
        /// get a output exchange item
        /// </summary>
        /// <param name="index">index number of the requested output exchange item</param>
        /// <returns>The requested exchange item</returns>
        public override IOutputExchangeItem GetOutputExchangeItem(int index)
        {
            OutputExchangeItem outputExchangeItem = ((IEngine)_engineApiAccess).GetOutputExchangeItem(index);

            //Add dataoperations to outputExchangeItems
            ElementMapper elementMapper  = new ElementMapper();
            ArrayList     dataOperations = new ArrayList();

            dataOperations = elementMapper.GetAvailableDataOperations(outputExchangeItem.ElementSet.ElementType);
            bool spatialDataOperationExists;
            bool linearConversionDataOperationExists;
            bool smartBufferDataOperationExists;

            foreach (IDataOperation dataOperation in dataOperations)
            {
                spatialDataOperationExists = false;
                foreach (IDataOperation existingDataOperation in outputExchangeItem.DataOperations)
                {
                    if (dataOperation.ID == existingDataOperation.ID)
                    {
                        spatialDataOperationExists = true;
                    }
                }

                if (!spatialDataOperationExists)
                {
                    outputExchangeItem.AddDataOperation(dataOperation);
                }
            }

            IDataOperation linearConversionDataOperation = new LinearConversionDataOperation();

            linearConversionDataOperationExists = false;
            foreach (IDataOperation existingDataOperation in outputExchangeItem.DataOperations)
            {
                if (linearConversionDataOperation.ID == existingDataOperation.ID)
                {
                    linearConversionDataOperationExists = true;
                }
            }

            if (!linearConversionDataOperationExists)
            {
                outputExchangeItem.AddDataOperation(new LinearConversionDataOperation());
            }

            IDataOperation smartBufferDataOperaion = new SmartBufferDataOperation();

            smartBufferDataOperationExists = false;
            foreach (IDataOperation existingDataOperation in outputExchangeItem.DataOperations)
            {
                if (smartBufferDataOperaion.ID == existingDataOperation.ID)
                {
                    smartBufferDataOperationExists = true;
                }
            }

            if (!smartBufferDataOperationExists)
            {
                outputExchangeItem.AddDataOperation(new SmartBufferDataOperation());
            }

            return((IOutputExchangeItem)outputExchangeItem);
        }
		/// <summary>
		/// get a output exchange item
		/// </summary>
		/// <param name="index">index number of the requested output exchange item</param>
		/// <returns>The requested exchange item</returns>
        public override IOutputExchangeItem GetOutputExchangeItem(int index)
		{
			OutputExchangeItem outputExchangeItem = ((IEngine)_engineApiAccess).GetOutputExchangeItem(index);

			//Add dataoperations to outputExchangeItems
			ElementMapper elementMapper = new ElementMapper();
			ArrayList dataOperations = new ArrayList();
			dataOperations = elementMapper.GetAvailableDataOperations(outputExchangeItem.ElementSet.ElementType);
			bool spatialDataOperationExists;
			bool linearConversionDataOperationExists;
			bool smartBufferDataOperationExists;
			foreach (IDataOperation dataOperation in dataOperations)
			{
				spatialDataOperationExists = false;
				foreach (IDataOperation existingDataOperation in outputExchangeItem.DataOperations)
				{
					if (dataOperation.ID == existingDataOperation.ID)
					{
						spatialDataOperationExists = true;
					}
				}

				if (!spatialDataOperationExists)
				{
					outputExchangeItem.AddDataOperation(dataOperation);
				}
			}

			IDataOperation linearConversionDataOperation = new LinearConversionDataOperation();
			linearConversionDataOperationExists = false;
			foreach (IDataOperation existingDataOperation in outputExchangeItem.DataOperations)
			{
				if (linearConversionDataOperation.ID == existingDataOperation.ID)
				{
					linearConversionDataOperationExists = true;
				}
			}

			if (!linearConversionDataOperationExists)
			{
				outputExchangeItem.AddDataOperation(new LinearConversionDataOperation());
			}

			IDataOperation smartBufferDataOperaion = new SmartBufferDataOperation();
			smartBufferDataOperationExists = false;
			foreach (IDataOperation existingDataOperation in outputExchangeItem.DataOperations)
			{
				if (smartBufferDataOperaion.ID == existingDataOperation.ID)
				{
					smartBufferDataOperationExists = true;
				}
			}

			if (!smartBufferDataOperationExists)
			{
				outputExchangeItem.AddDataOperation(new SmartBufferDataOperation());
			}

			return (IOutputExchangeItem) outputExchangeItem;
		}
 /// <summary>
 /// Creates a copy of the current instance.
 /// </summary>
 /// <returns>Copy of the instance</returns>
 public object Clone()
 {
   SmartBufferDataOperation clone = new SmartBufferDataOperation();
   clone._relaxationFactor = _relaxationFactor;
   clone._doExtendedValidation = _doExtendedValidation;
   clone._isActivated = _isActivated;
   clone._arguments = new Argument[ArgumentCount];
   for (int i = 0; i < ArgumentCount; i++)
   {
     clone._arguments[i] = new HydroNumerics.OpenMI.Sdk.Backbone.Argument();
     clone._arguments[i].Description = _arguments[i].Description;
     clone._arguments[i].Key = _arguments[i].Key;
     clone._arguments[i].ReadOnly = _arguments[i].ReadOnly;
     clone._arguments[i].Value = _arguments[i].Value;
   }
   return clone;
 }