本文整理汇总了C#中NodeFactory类的典型用法代码示例。如果您正苦于以下问题:C# NodeFactory类的具体用法?C# NodeFactory怎么用?C# NodeFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NodeFactory类属于命名空间,在下文中一共展示了NodeFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SetUp
public void SetUp()
{
nodeFactory = new NodeFactory(ModelType.Truss2D);
node1 = nodeFactory.CreateFor2DTruss(0, 0);
node2 = nodeFactory.CreateFor2DTruss(0, 1);
SUT = new ElementFactory(ModelType.Truss2D);
}
开发者ID:iainsproat,项目名称:SharpFE,代码行数:7,代码来源:ElementFactoryTest.cs
示例2: GetData
public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
{
ObjectDataBuilder objData = new ObjectDataBuilder(factory);
objData.RequirePointerAlignment();
objData.DefinedSymbols.Add(this);
ObjectAndOffsetSymbolNode startNode = new ObjectAndOffsetSymbolNode(this, 0, "__modules_a");
ObjectAndOffsetSymbolNode endNode = new ObjectAndOffsetSymbolNode(this, 0, "__modules_z");
if (factory.Target.OperatingSystem != Internal.TypeSystem.TargetOS.Windows)
{
// Temporary work-around for Linux / OSX until CLI is updated
objData.DefinedSymbols.Add(startNode);
}
objData.EmitPointerReloc(factory.ReadyToRunHeader);
if (factory.Target.OperatingSystem != Internal.TypeSystem.TargetOS.Windows)
{
// Temporary work-around for Linux / OSX until CLI is updated
endNode.SetSymbolOffset(objData.CountBytes);
objData.DefinedSymbols.Add(endNode);
objData.EmitZeroPointer();
}
return objData.ToObjectData();
}
开发者ID:schellap,项目名称:corert,代码行数:26,代码来源:ModulesSectionNode.cs
示例3: Main
public static int Main()
{
NodeFactory f = new NodeFactory();
Node notNode = new Node("NotNode");
notNode.NodeType = NodeType.Not;
notNode.Child = new Node("otherNode");
notNode.Child.NodeType = NodeType.Other;
Node trueNode = new Node("True");
Node falseNode = new Node("False");
Node resultNode = f.Conditional(notNode, trueNode, falseNode);
if (resultNode.name == "True")
{
System.Console.WriteLine("pass");
return 100;
}
else
{
System.Console.WriteLine("Failed");
return -1;
}
}
开发者ID:l1183479157,项目名称:coreclr,代码行数:25,代码来源:simple-repro.cs
示例4: UpdateNode
public void UpdateNode(NodeFactory.Node node) {
lock (this) {
// validate sitemap
BuildSiteMap();
SiteMapNode n;
if (!m_nodes.ContainsKey(node.Id.ToString())) {
n = createNode(node.Id.ToString(),
node.Name,
node.GetProperty(m_defaultDescriptionAlias) != null ? node.GetProperty(m_defaultDescriptionAlias).Value : "",
node.Url,
findRoles(node.Id, node.Path));
string parentNode = node.Parent == null ? "-1" : node.Parent.Id.ToString();
try {
AddNode(n, m_nodes[parentNode]);
} catch (Exception ex) {
BusinessLogic.Log.Add(
LogTypes.Error,
-1,
String.Format("Error adding node with url '{0}' to SiteMapProvider: {1}", node.Name, ex));
}
} else {
n = m_nodes[node.Id.ToString()];
n.Url = node.Url;
n.Description = node.GetProperty(m_defaultDescriptionAlias) != null ? node.GetProperty(m_defaultDescriptionAlias).Value : "";
n.Title = node.Name;
n.Roles = findRoles(node.Id, node.Path).Split(",".ToCharArray());
}
}
}
开发者ID:elrute,项目名称:Triphulcas,代码行数:31,代码来源:UmbracoSiteMapProvider.cs
示例5: LoadWorkspaceFromJson
/// <summary>
/// Load a WorkspaceModel from json. If the WorkspaceModel is a HomeWorkspaceModel
/// it will be set as the current workspace.
/// </summary>
/// <param name="json"></param>
public static WorkspaceModel LoadWorkspaceFromJson(string json, LibraryServices libraryServices,
EngineController engineController, DynamoScheduler scheduler, NodeFactory factory,
bool isTestMode, bool verboseLogging, CustomNodeManager manager)
{
var settings = new JsonSerializerSettings
{
Error = (sender, args) =>
{
args.ErrorContext.Handled = true;
Console.WriteLine(args.ErrorContext.Error);
},
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
TypeNameHandling = TypeNameHandling.Auto,
Formatting = Formatting.Indented,
Converters = new List<JsonConverter>{
new ConnectorConverter(),
new AnnotationConverter(),
new WorkspaceConverter(engineController, scheduler, factory, isTestMode, verboseLogging),
new NodeModelConverter(manager, libraryServices),
},
ReferenceResolverProvider = () => { return new IdReferenceResolver(); }
};
var result = ReplaceTypeDeclarations(json, true);
var ws = JsonConvert.DeserializeObject<WorkspaceModel>(result, settings);
return ws;
}
开发者ID:Conceptual-Design,项目名称:Dynamo,代码行数:33,代码来源:Workspaces.cs
示例6: CreateFiniteElement1D
private void CreateFiniteElement1D(double startX, double startY, double startZ, double endX, double endY, double endZ)
{
nodeFactory = new NodeFactory(ModelType.Truss3D);
start = nodeFactory.Create(startX, startY, startZ);
end = nodeFactory.Create(endX, endY, endZ);
elementFactory = new ElementFactory(ModelType.Truss3D);
SUT = elementFactory.CreateLinearConstantSpring(start, end, 0);
}
开发者ID:iainsproat,项目名称:SharpFE,代码行数:8,代码来源:FiniteElement1DTest.cs
示例7: CustomNodeWorkspaceModel
/// <summary>
/// Initializes a new instance of the <see cref="CustomNodeWorkspaceModel"/> class
/// by given information about it and node factory
/// </summary>
/// <param name="info">Information for creating custom node workspace</param>
/// <param name="factory">Node factory to create nodes</param>
public CustomNodeWorkspaceModel(WorkspaceInfo info, NodeFactory factory)
: this(factory,
Enumerable.Empty<NodeModel>(),
Enumerable.Empty<NoteModel>(),
Enumerable.Empty<AnnotationModel>(),
Enumerable.Empty<PresetModel>(),
new ElementResolver(),
info) { }
开发者ID:sh4nnongoh,项目名称:Dynamo,代码行数:14,代码来源:CustomNodeWorkspaceModel.cs
示例8: Calc
public Calc()
{
m_NodeFactory = new NodeFactory();
m_NodeFactory.Register("+", typeof(AdditionNode));
m_NodeFactory.Register("*", typeof(MultiplicationNode));
m_NodeFactory.Register("-", typeof(SubtractionNode));
m_NodeFactory.Register("/", typeof(DivisionNode));
}
开发者ID:SoftwareDojo,项目名称:Katas,代码行数:8,代码来源:Calc.cs
示例9: LoadNodesFromXml
private static IEnumerable<NodeModel> LoadNodesFromXml(XmlDocument xmlDoc, NodeFactory nodeFactory, ElementResolver resolver)
{
XmlNodeList elNodes = xmlDoc.GetElementsByTagName("Elements");
if (elNodes.Count == 0)
elNodes = xmlDoc.GetElementsByTagName("dynElements");
XmlNode elNodesList = elNodes[0];
return from XmlElement elNode in elNodesList.ChildNodes
select LoadNodeFromXml(elNode, SaveContext.File, nodeFactory, resolver);
}
开发者ID:norbertzsiros,项目名称:Dynamo,代码行数:9,代码来源:NodeGraph.cs
示例10: CustomNodeWorkspaceModel
public CustomNodeWorkspaceModel(
WorkspaceInfo info,
NodeFactory factory)
: this(
factory,
Enumerable.Empty<NodeModel>(),
Enumerable.Empty<NoteModel>(),
Enumerable.Empty<AnnotationModel>(),
info) { }
开发者ID:junmendoza,项目名称:Dynamo,代码行数:9,代码来源:CustomNodeWorkspaceModel.cs
示例11: SetUp
public void SetUp()
{
this.nodeFactory = new NodeFactory(ModelType.Truss1D);
this.start = nodeFactory.Create(0);
this.end = nodeFactory.Create(1);
this.elementFactory = new ElementFactory(ModelType.Truss1D);
this.spring = elementFactory.CreateLinearConstantSpring(start, end, 2);
this.SUT = new LinearTrussStiffnessMatrixBuilder(spring);
}
开发者ID:iainsproat,项目名称:SharpFE,代码行数:9,代码来源:LinearConstantSpringStiffnessMatrixBuilderTestBase.cs
示例12: CanCreateAndAddtoTheRepository
public void CanCreateAndAddtoTheRepository()
{
NodeRepository repository = new NodeRepository(ModelType.Truss1D);
this.SUT = new NodeFactory(ModelType.Truss1D, repository);
Assert.AreEqual(0, repository.Count);
this.SUT.Create(0);
Assert.AreEqual(1, repository.Count);
}
开发者ID:iainsproat,项目名称:SharpFE,代码行数:9,代码来源:NodeFactoryTest.cs
示例13: CreateAndStore2DSpringFromOriginTo
protected void CreateAndStore2DSpringFromOriginTo(double x, double z)
{
this.nodeFactory = new NodeFactory(ModelType.Truss2D);
this.start = nodeFactory.CreateFor2DTruss(0, 0);
this.end = nodeFactory.CreateFor2DTruss(x, z);
this.elementFactory = new ElementFactory(ModelType.Truss2D);
this.spring = elementFactory.CreateLinearConstantSpring(this.start, this.end, 1);
this.SUT = new LinearTrussStiffnessMatrixBuilder(this.spring);
}
开发者ID:iainsproat,项目名称:SharpFE,代码行数:10,代码来源:LinearConstantSpringStiffnessMatrixBuilderTestBase.cs
示例14: CreateAndStore3DSpringFromOriginTo
protected void CreateAndStore3DSpringFromOriginTo(double x, double y, double z)
{
nodeFactory = new NodeFactory(ModelType.Truss3D);
start = nodeFactory.Create(0, 0, 0);
end = nodeFactory.Create(x, y, z);
elementFactory = new ElementFactory(ModelType.Truss3D);
this.spring = elementFactory.CreateLinearConstantSpring(start, end, 1);
this.SUT = new LinearTrussStiffnessMatrixBuilder(this.spring);
}
开发者ID:iainsproat,项目名称:SharpFE,代码行数:10,代码来源:LinearConstantSpringStiffnessMatrixBuilderTestBase.cs
示例15: SetUp
public void SetUp()
{
nodeFactory = new NodeFactory(ModelType.Frame2D);
start = nodeFactory.CreateFor2DTruss(0, 0);
end = nodeFactory.CreateFor2DTruss(1, 0);
elementFactory = new ElementFactory(ModelType.Frame2D);
material = new GenericElasticMaterial(0, 1, 0, 1);
section = new GenericCrossSection(1, 1, 1, 1);
beam = elementFactory.CreateLinear3DBeam(start, end, material, section);
SUT = new Linear3DBernoulliBeamStiffnessMatrixBuilder(beam);
}
开发者ID:iainsproat,项目名称:SharpFE,代码行数:11,代码来源:Linear3DBeamStiffnessMatrixBuilderTest.cs
示例16: BuildTree
private static Tree BuildTree(IEnumerable<Type> types, string rootName)
{
var nodeFactory = new NodeFactory();
var tree = new Tree(nodeFactory, rootName);
foreach (var type in types)
{
var fullName = type.FullName;
tree.Add(fullName);
}
return tree;
}
开发者ID:jklipp,项目名称:codegravity,代码行数:12,代码来源:Analyzer.cs
示例17: TestWriteToStoreDatasetsHandler
private void TestWriteToStoreDatasetsHandler(IGenericIOManager manager)
{
NodeFactory factory = new NodeFactory();
INode a = factory.CreateUriNode(new Uri("http://example.org/a"));
INode b = factory.CreateUriNode(new Uri("http://example.org/b"));
INode c = factory.CreateUriNode(new Uri("http://example.org/c"));
INode d = factory.CreateUriNode(new Uri("http://example.org/d"));
Uri graphB = new Uri("http://example.org/graphs/b");
Uri graphD = new Uri("http://example.org/graphs/d");
//Try to ensure that the target Graphs do not exist
if (manager.DeleteSupported)
{
manager.DeleteGraph(TestGraphUri);
manager.DeleteGraph(graphB);
manager.DeleteGraph(graphD);
}
else
{
Graph g = new Graph();
g.BaseUri = TestGraphUri;
manager.SaveGraph(g);
g.BaseUri = graphB;
manager.SaveGraph(g);
g.BaseUri = graphD;
manager.SaveGraph(g);
}
//Do the parsing and thus the loading
WriteToStoreHandler handler = new WriteToStoreHandler(manager, TestGraphUri);
NQuadsParser parser = new NQuadsParser();
parser.Load(handler, new StreamParams("writetostore.nq"));
//Load the expected Graphs
Graph def = new Graph();
manager.LoadGraph(def, TestGraphUri);
Graph gB = new Graph();
manager.LoadGraph(gB, graphB);
Graph gD = new Graph();
manager.LoadGraph(gD, graphD);
Assert.AreEqual(2, def.Triples.Count, "Should be two triples in the default Graph");
Assert.IsTrue(def.ContainsTriple(new Triple(a, a, a)), "Default Graph should have the a triple");
Assert.AreEqual(1, gB.Triples.Count, "Should be one triple in the b Graph");
Assert.IsTrue(gB.ContainsTriple(new Triple(b, b, b)), "b Graph should have the b triple");
Assert.IsTrue(def.ContainsTriple(new Triple(c, c, c)), "Default Graph should have the c triple");
Assert.AreEqual(1, gD.Triples.Count, "Should be one triple in the d Graph");
Assert.IsTrue(gD.ContainsTriple(new Triple(d, d, d)), "d Graph should have the d triple");
}
开发者ID:almostEric,项目名称:DotNetRDF-4.0,代码行数:50,代码来源:WriteToStoreHandlerTests.cs
示例18: GetData
public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
{
ObjectDataBuilder objData = new ObjectDataBuilder(factory);
objData.RequirePointerAlignment();
objData.DefinedSymbols.Add(this);
if (factory.Target.OperatingSystem == Internal.TypeSystem.TargetOS.OSX)
{
objData.EmitPointerReloc(factory.JumpThunk((ExternSymbolNode)factory.ExternSymbol("RegisterReadyToRunModule"), factory.ReadyToRunHeader));
}
else
{
objData.EmitPointerReloc(factory.ReadyToRunHeader);
}
return objData.ToObjectData();
}
开发者ID:nguerrera,项目名称:corert,代码行数:16,代码来源:ModulesSectionNode.cs
示例19: CustomNodeWorkspaceModel
public CustomNodeWorkspaceModel(
NodeFactory factory,
IEnumerable<NodeModel> e,
IEnumerable<NoteModel> n,
IEnumerable<AnnotationModel> a,
IEnumerable<PresetModel> presets,
ElementResolver elementResolver,
WorkspaceInfo info)
: base(e, n,a, info, factory,presets, elementResolver)
{
HasUnsavedChanges = false;
CustomNodeId = Guid.Parse(info.ID);
Category = info.Category;
Description = info.Description;
PropertyChanged += OnPropertyChanged;
}
开发者ID:VinitShukla,项目名称:Dynamo,代码行数:17,代码来源:CustomNodeWorkspaceModel.cs
示例20: CustomNodeWorkspaceModel
public CustomNodeWorkspaceModel(
NodeFactory factory,
IEnumerable<NodeModel> nodes,
IEnumerable<NoteModel> notes,
IEnumerable<AnnotationModel> annotations,
IEnumerable<PresetModel> presets,
ElementResolver elementResolver,
WorkspaceInfo info)
: base(nodes, notes,annotations, info, factory,presets, elementResolver)
{
HasUnsavedChanges = false;
CustomNodeId = Guid.Parse(info.ID);
Category = info.Category;
Description = info.Description;
IsVisibleInDynamoLibrary = info.IsVisibleInDynamoLibrary;
PropertyChanged += OnPropertyChanged;
}
开发者ID:AutodeskFractal,项目名称:Dynamo,代码行数:18,代码来源:CustomNodeWorkspaceModel.cs
注:本文中的NodeFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论