• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IModelSystemStructure类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: AssignValue

 private static void AssignValue(string fullPath, string variableName, IModelSystemStructure currentStructure, string value)
 {
     if(currentStructure == null)
     {
         throw new XTMFRuntimeException("Unable to assign '" + variableName + "', the module is null!");
     }
     var p = currentStructure.Parameters;
     if(p == null)
     {
         throw new XTMFRuntimeException("The structure '" + currentStructure.Name + "' has no parameters!");
     }
     var parameters = p.Parameters;
     bool any = false;
     if(parameters != null)
     {
         for(int i = 0; i < parameters.Count; i++)
         {
             if(parameters[i].Name == variableName)
             {
                 AssignValue(parameters[i], value);
                 any = true;
             }
         }
     }
     if(!any)
     {
         throw new XTMFRuntimeException("Unable to find a parameter named '" + variableName
             + "' for module '" + currentStructure.Name + "' in order to assign it a parameter!\r\nFull Path:'"+ fullPath + "'");
     }
 }
开发者ID:Cocotus,项目名称:XTMF,代码行数:30,代码来源:ModelSystemReflection.cs


示例17: GetModelSystemStructureFromPath

 /// <summary>
 /// Get a model system structure from a path string relative to the root
 /// </summary>
 /// <param name="root">The point to start the path relative to.</param>
 /// <param name="path">The path to explore</param>
 /// <param name="structure">The structure at the end of the path</param>
 /// <returns>True if a model system structure with that path was found, false otherwise</returns>
 public static bool GetModelSystemStructureFromPath(IModelSystemStructure root, string path, ref IModelSystemStructure structure)
 {
     var parts = SplitNameToParts(path);
     IModelSystemStructure current = root;
     for(int i = 0; i < parts.Length; i++)
     {
         var children = current.Children;
         if(children == null)
         {
             return false;
         }
         bool found = false;
         for(int j = 0; j < children.Count; j++)
         {
             if(children[j].Name == parts[i])
             {
                 current = children[j];
                 found = true;
                 break;
             }
         }
         if(!found)
         {
             return false;
         }
     }
     structure = current;
     return true;
 }
开发者ID:Cocotus,项目名称:XTMF,代码行数:36,代码来源:ModelSystemReflection.cs


示例18: GetSubmodules

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


示例19: AddToModuleListCommand

 public AddToModuleListCommand(IModelSystemStructure parent, IModelSystemStructure child)
 {
     this.Parent = parent;
     this.Child = child;
 }
开发者ID:Cocotus,项目名称:XTMF,代码行数:5,代码来源:AddToModuleListCommand.cs


示例20: ContainedModelSystemModel

 public ContainedModelSystemModel(IModelSystemStructure ms, IProject project)
 {
     Root = ms;
     RealIndex = project.ModelSystemStructure.IndexOf(ms);
 }
开发者ID:dianatle,项目名称:XTMF,代码行数:5,代码来源:ProjectDisplay.xaml.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IModule类代码示例发布时间:2022-05-24
下一篇:
C# IModelObject类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap