本文整理汇总了C#中INode类的典型用法代码示例。如果您正苦于以下问题:C# INode类的具体用法?C# INode怎么用?C# INode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
INode类属于命名空间,在下文中一共展示了INode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrintSolution
private static void PrintSolution(PathFinder pathFinder, INode result)
{
int steps = 0;
INode node = result;
if (node != null)
{
var stack = new Stack<INode>();
do
{
stack.Push(node);
} while ((node = node.Parent) != null);
Debug.WriteLine("8-Puzzle Solved in {0} Cycles", pathFinder.Cycles);
Debug.WriteLine("-------------------------------------------");
foreach (EightPuzzleNode solutionNode in stack)
{
string tiles = solutionNode.Tiles
.Aggregate("", (current, i) => current + i.ToString());
Debug.WriteLine("{0:00} - {1} - F: {2:00.0} G: {3:00.0} H: {4:00.0}",
steps++,
tiles,
solutionNode.F, solutionNode.G, solutionNode.H);
}
}
else
{
Debug.WriteLine("No solution");
}
}
示例2: SearcherResult
public SearcherResult(DateTime startTimeStamp, INode resultNode, string path, SearchOptions searchOptions)
{
StartTimestamp = startTimeStamp;
ResultNode = resultNode;
Path = path;
SearchOptions = searchOptions;
}
示例3: AStarNode
public AStarNode(Location location, INode parent,
decimal costFromStart, decimal costToGoal)
: base(location, parent)
{
CostFromStart = costFromStart;
CostToGoal = costToGoal;
}
示例4: Transition
public Transition(string identifier, bool isDefault, INode source, INode destination)
{
IsDefault = isDefault;
Source = source;
Destination = destination;
Identifier = identifier;
}
示例5: QuickRemove
public QuickRemove(ToolStripMenuItem menu, IGraph g, INode objNode, String file)
{
this._menu = menu;
this._g = g;
this._objNode = objNode;
this._file = file;
}
示例6: SetPropertyValueOperation
internal SetPropertyValueOperation(INode node, string name, object oldvalue, object newvalue)
{
this.node = node;
this.name = name;
this.oldvalue = oldvalue;
this.newvalue = newvalue;
}
示例7: Run
public void Run(INode typeDeclaration)
{
typeDeclaration.AcceptVisitor(this, null);
foreach (VariableDeclaration decl in fields) {
decl.Name = prefix + decl.Name;
}
}
示例8: GetUriStringForNode
public static string GetUriStringForNode(INode node)
{
if (node.IsEmpty()) return string.Empty;
return string.Format("{0}://{1}:{2}", GetProtocolStringForTransportType(node.TransportType),
GetHostStringForAddress(node.Host),
node.Port);
}
示例9: DoMatch
public override bool DoMatch(INode other, Match match)
{
if (other == null || other.IsNull)
return this.MinCount <= 0;
else
return this.MaxCount >= 1 && childNode.DoMatch(other, match);
}
示例10: AddNode
public override INode AddNode(INode currentParent, IConverter converter)
{
INode orNode = new OrNode(converter);
//// First element of a chain
//if (currentParent is RootNode)
// throw new NotImplementedException("Or cannot be the first element");
// Insert at root
if (currentParent is RootNode)
{
var root = (currentParent as RootNode);
var firstChild = root.Children.First();
firstChild.Parent = orNode;
(orNode as OrNode).Children.Add(firstChild);
orNode.Parent = root;
root.Children.Remove(firstChild);
}
// Insert before its parent
else if (currentParent.Parent != null && currentParent.Parent as IMotherNode != null)
{
var grandParent = currentParent.Parent as IMotherNode;
grandParent.Children.Remove(currentParent);
(orNode as OrNode).Children.Add(currentParent);
currentParent = currentParent.Parent;
}
this.LinkNodeToParent(currentParent, orNode);
return orNode;
}
示例11: ToText
public static string ToText(INode node)
{
var output = new CSharpOutputVisitor();
node.AcceptVisitor(output, null);
return output.Text;
}
示例12: EndVisit
protected override void EndVisit(INode node)
{
if (node is PropertyGetRegion || node is PropertySetRegion) {
this.currentContext = VisitorContext.Default;
}
base.EndVisit(node);
}
示例13: InvalidOperationException
INode INodeCreator.CreateNode(Session session, INode parent, string name, IEnumerable<Property> properties)
{
if (parent != null && parent.ChildNodes[name] != null)
throw new InvalidOperationException("Duplicated Child Node Name");
return new Node(session, parent, name, properties, this.store);
}
示例14: CreateNode
IExpressionNode CreateNode(INode node)
{
IExpressionNode expressionNode = null;
if (node is ExpressionStatement)
{
var statementNode = (ExpressionStatement)node;
expressionNode = new StatementExpressionNode
{
Expression = CreateNode(statementNode.Expression)
};
}
else if (node is BinaryOperatorExpression)
{
var binaryNode = ((BinaryOperatorExpression)node);
expressionNode = new BinaryExpressionNode
{
Operator = (BinaryExpressionNode.Operators)binaryNode.Op,
Left = CreateNode(binaryNode.Left),
Right = CreateNode(binaryNode.Right),
};
}
else if (node is PrimitiveExpression)
{
var primitiveNode = (PrimitiveExpression)node;
var valueType = primitiveNode.Value == null ? typeof(object) : primitiveNode.Value.GetType();
var value = (IValueNode)Activator.CreateInstance(typeof(ValueNode<>).MakeGenericType(valueType), primitiveNode.Value);
expressionNode = new ValueExpressionNode
{
Value = value,
};
}
return expressionNode;
}
示例15: OnFocusedNodeChanged
public void OnFocusedNodeChanged(INode inode)
{
if (focusedNodeChanged != null)
{
focusedNodeChanged(this, inode);
}
}