当前位置: 首页>>代码示例>>C#>>正文


C# IModelSystemStructure类代码示例

本文整理汇总了C#中IModelSystemStructure的典型用法代码示例。如果您正苦于以下问题:C# IModelSystemStructure类的具体用法?C# IModelSystemStructure怎么用?C# IModelSystemStructure使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IModelSystemStructure类属于命名空间,在下文中一共展示了IModelSystemStructure类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetCorrespondingParameter

        private IModuleParameter GetCorrespondingParameter(IModuleParameter p, IModelSystemStructure mss, IModelSystemStructure newMSS)
        {
            if ( mss == p.BelongsTo )
            {
                foreach ( var param in newMSS.Parameters.Parameters )
                {
                    if ( param.Name == p.Name )
                    {
                        return param;
                    }
                }
                return null;
            }

            var list = mss.Children;
            var newList = newMSS.Children;
            if ( list == null | newList == null )
            {
                return null;
            }
            for ( int i = 0; i < list.Count; i++ )
            {
                var ret = GetCorrespondingParameter( p, list[i], newList[i] );
                if ( ret != null )
                {
                    return ret;
                }
            }
            return null;
        }
开发者ID:Cocotus,项目名称:XTMF,代码行数:30,代码来源:AddModelSystemToProject.cs

示例2: SetProjectRootCommand

 public SetProjectRootCommand(Action<IModelSystemStructure> updateRoot, IProject project, int index, IModelSystemStructure newRoot)
 {
     this.UpdateRoot = updateRoot;
     this.Project = project;
     this.Index = index;
     this.NewRoot = newRoot;
 }
开发者ID:Cocotus,项目名称:XTMF,代码行数:7,代码来源:SetProjectRootCommand.cs

示例3: ModuleSwapCommand

 public ModuleSwapCommand(List<ILinkedParameter> linkedParameters, IModelSystemStructure parent, int index, IModelSystemStructure newValue)
     : base(linkedParameters, parent.Children[index])
 {
     this.Parent = parent;
     this.NewValue = newValue;
     this.Index = index;
 }
开发者ID:Cocotus,项目名称:XTMF,代码行数:7,代码来源:ModuleSwapCommand.cs

示例4: CreateNewModelSystem

 public CreateNewModelSystem(IConfiguration config, string name, string description, IModelSystemStructure strucuture, List<ILinkedParameter> linkedParameters)
 {
     this.Config = config;
     this.Name = name;
     this.Description = description;
     this.Strucuture = strucuture;
     this.LinkedParameters = linkedParameters;
 }
开发者ID:Cocotus,项目名称:XTMF,代码行数:8,代码来源:CreateNewModelSystem.cs

示例5: ModelSystemDisplayStructure

 public ModelSystemDisplayStructure(IModelSystemStructure mss)
 {
     this.Structure = mss;
     this._Name = mss.Name;
     this._Description = mss.Description;
     this.Type = mss.Type;
     BuildChildren();
 }
开发者ID:Cocotus,项目名称:XTMF,代码行数:8,代码来源:ModelSystemDisplayStructure.cs

示例6: MapLinkedParameters

 /// <summary>
 /// Map the linked parameters to finish making a clone
 /// </summary>
 /// <param name="originalLinkedParameters"></param>
 /// <param name="newModelSystemStructure"></param>
 /// <param name="oldModelSystemStructure"></param>
 public static List<ILinkedParameter> MapLinkedParameters(List<ILinkedParameter> originalLinkedParameters,
     IModelSystemStructure newModelSystemStructure, IModelSystemStructure oldModelSystemStructure)
 {
     var ret = new List<ILinkedParameter>( originalLinkedParameters.Count );
     //first make a cloned copy of the original parameters
     for ( int i = 0; i < originalLinkedParameters.Count; i++ )
     {
         ret.Add( CopyLinkedParameter( originalLinkedParameters[i] ) );
     }
     // now that we have a copy we need to walk the model system and live translate it.
     WalkAndMoveParameters( ret, newModelSystemStructure, oldModelSystemStructure );
     return ret;
 }
开发者ID:Cocotus,项目名称:XTMF,代码行数:19,代码来源:LinkedParameter.cs

示例7: GetParameters

 private static Parameter[] GetParameters(IModelSystemStructure mss)
 {
     var list = mss.Parameters;
     if ( list == null )
     {
         return null;
     }
     var length = list.Parameters.Count;
     Parameter[] ret = new Parameter[length];
     for ( int i = 0; i < length; i++ )
     {
         ret[i] = new Parameter()
         {
             Type = list.Parameters[i].Type == null ? "No Type" : ConvertTypeName( list.Parameters[i].Type ),
             Name = list.Parameters[i].Name,
             Description = list.Parameters[i].Description
         };
     }
     return ret;
 }
开发者ID:Cocotus,项目名称:XTMF,代码行数:20,代码来源:DocumentationWindow.xaml.cs

示例8: RunTimeValidation

 /// <summary>
 /// Validate the model system before starting to execute it
 /// </summary>
 /// <param name="error">If there is an error, the error message will be stored in here</param>
 /// <param name="currentPoint">The current point through the tree we are testing</param>
 /// <returns></returns>
 private bool RunTimeValidation(ref string error, IModelSystemStructure currentPoint)
 {
     try
     {
         // if there is a module at this point
         if ( currentPoint.Module != null )
         {
             if ( !currentPoint.Module.RuntimeValidation( ref error ) )
             {
                 return false;
             }
         }
         // check to see if there are descendants that need to be checked
         if ( currentPoint.Children != null )
         {
             foreach ( var module in currentPoint.Children )
             {
                 if ( !this.RunTimeValidation( ref error, module ) )
                 {
                     Console.WriteLine( "Validation error in module " + module.Name + "\r\n" + error );
                     return false;
                 }
             }
         }
         // if all of our children are alright, and we are also alright this part of the tree is ready to run
         return true;
     }
     catch
     {
         return false;
     }
 }
开发者ID:Cocotus,项目名称:XTMF,代码行数:38,代码来源:Client.cs

示例9: CleanUp

 private void CleanUp(IModelSystemStructure mss)
 {
     if ( mss.Module != null )
     {
         var disp = mss.Module as IDisposable;
         if ( disp != null )
         {
             disp.Dispose();
         }
         mss.Module = null;
     }
     if ( mss.Children != null )
     {
         foreach ( var child in mss.Children )
         {
             CleanUp( child );
         }
     }
 }
开发者ID:Cocotus,项目名称:XTMF,代码行数:19,代码来源:Client.cs

示例10: LoadChildFromXTMF

 private bool LoadChildFromXTMF(ref string error)
 {
     IModelSystemStructure ourStructure = null;
     if(ModelSystemReflection.FindModuleStructure(Config, this, ref ourStructure))
     {
         foreach(var child in ourStructure.Children)
         {
             if(child.ParentFieldName == "Child")
             {
                 ChildStructure = child;
                 break;
             }
         }
     }
     if(ChildStructure == null)
     {
         error = "In '" + Name + "' we were unable to find the Client Model System!";
         return false;
     }
     return true;
 }
开发者ID:dianatle,项目名称:XTMF,代码行数:21,代码来源:MultiRunModelSystem.cs

示例11: FindModuleStructure

 /// <summary>
 /// Retrieve the model system structure from the given project
 /// </summary>
 /// <param name="project">The project to analyze</param>
 /// <param name="toFind">The module to find the structure of</param>
 /// <param name="modelSystemStructure">The model system structure of the module to find.</param>
 /// <returns>True if the module was found, false otherwise</returns>
 public static bool FindModuleStructure(IProject project, IModule toFind, ref IModelSystemStructure modelSystemStructure)
 {
     foreach(var ms in project.ModelSystemStructure)
     {
         if(FindModuleStructure(ms, toFind, ref modelSystemStructure))
         {
             return true;
         }
     }
     return false;
 }
开发者ID:Cocotus,项目名称:XTMF,代码行数:18,代码来源:ModelSystemReflection.cs

示例12: WalkAndMoveParameters

 private static void WalkAndMoveParameters(List<ILinkedParameter> ret, IModelSystemStructure newModelSystemStructure, IModelSystemStructure oldModelSystemStructure)
 {
     // we only need to walk if we are not a collection since collections can not have parameters
     if ( !oldModelSystemStructure.IsCollection )
     {
         // for each linked parameter
         for ( int i = 0; i < ret.Count; i++ )
         {
             //check the links to see if they are attached to the old system
             var parameters = ret[i].Parameters;
             for ( int k = 0; k < parameters.Count; k++ )
             {
                 if ( parameters[k].BelongsTo == oldModelSystemStructure )
                 {
                     var variableName = parameters[k].VariableName;
                     var newModuleParameters = newModelSystemStructure.Parameters.Parameters;
                     for ( int j = 0; j < newModuleParameters.Count; j++ )
                     {
                         if ( variableName == newModuleParameters[j].VariableName )
                         {
                             parameters[k] = newModuleParameters[j];
                             break;
                         }
                     }
                 }
             }
         }
     }
     var oldChildren = oldModelSystemStructure.Children;
     if ( oldChildren == null ) return;
     var newChildren = newModelSystemStructure.Children;
     // Now that we have finished mapping all of the variables inside of this we need to walk the children
     for ( int i = 0; i < oldModelSystemStructure.Children.Count; i++ )
     {
         WalkAndMoveParameters( ret, newChildren[i], oldChildren[i] );
     }
 }
开发者ID:Cocotus,项目名称:XTMF,代码行数:37,代码来源:LinkedParameter.cs

示例13: EditModelSystemTemplate

 private void EditModelSystemTemplate(IModelSystemStructure msscopy, int i)
 {
     IModuleParameters parameterList;
     // First edit our children
     foreach ( var child in msscopy.Children )
     {
         if ( child.ParentFieldType.Name == "INetworkEstimationAI" )
         {
             parameterList = child.Parameters;
             foreach ( var param in parameterList.Parameters )
             {
                 if ( param.Name == "Random Seed" )
                 {
                     param.Value = this.RandomNumberGenerator.Next();
                 }
             }
         }
         else if ( child.ParentFieldType.Name == "INetworkAssignment" )
         {
             parameterList = child.Parameters;
             foreach ( var param in parameterList.Parameters )
             {
                 if ( param.Name == "Emme Project Folder" )
                 {
                     param.Value = String.Format( "{0}-{1}/Database", this.NetworkBaseDirectory, ( i + 1 ) );
                 }
             }
         }
     }
     // after they are setup we just need to tune a couple of our parameters
     parameterList = msscopy.Parameters;
     foreach ( var param in parameterList.Parameters )
     {
         if ( param.Name == "Emme Input Output" )
         {
             param.Value = String.Format( "{0}-{1}/Database/cache/scalars.311", this.NetworkBaseDirectory, ( i + 1 ) );
         }
         else if ( param.Name == "Emme Macro Output" )
         {
             param.Value = String.Format( "{0}-{1}/Database/cache/boardings_predicted.621", this.NetworkBaseDirectory, ( i + 1 ) );
         }
     }
 }
开发者ID:Cocotus,项目名称:XTMF,代码行数:43,代码来源:NetworkEstimationServer.cs

示例14: IndexOf

 internal int IndexOf(ModelSystemDisplayStructure[] oldChildren, IModelSystemStructure modelSystemStructure)
 {
     for ( int i = 0; i < oldChildren.Length; i++ )
     {
         if ( oldChildren[i].Structure == modelSystemStructure )
         {
             return i;
         }
     }
     return -1;
 }
开发者ID:Cocotus,项目名称:XTMF,代码行数:11,代码来源:ModelSystemDisplayStructure.cs

示例15: BuildModelStructureChain

 /// <summary>
 /// Gets the ancestry of a module from the given root.
 /// </summary>
 /// <param name="root">The first node to look at.</param>
 /// <param name="toFind">The module to find</param>
 /// <param name="chain">The chain to store the results into.</param>
 /// <returns>True if we found the module, false otherwise</returns>
 public static bool BuildModelStructureChain(IModelSystemStructure root, IModule toFind, List<IModelSystemStructure> chain)
 {
     if(root.Module == toFind)
     {
         chain.Add(root);
         return true;
     }
     if(root.Children != null)
     {
         foreach(var child in root.Children)
         {
             if(BuildModelStructureChain(child, toFind, chain))
             {
                 chain.Insert(0, root);
                 return true;
             }
         }
     }
     // Then we didn't find it in this tree
     return false;
 }
开发者ID:Cocotus,项目名称:XTMF,代码行数:28,代码来源:ModelSystemReflection.cs


注:本文中的IModelSystemStructure类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。