本文整理汇总了C#中NodeList类的典型用法代码示例。如果您正苦于以下问题:C# NodeList类的具体用法?C# NodeList怎么用?C# NodeList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NodeList类属于命名空间,在下文中一共展示了NodeList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Ruleset
protected Ruleset(NodeList<Selector> selectors, NodeList rules, Ruleset originalRuleset)
: this()
{
Selectors = selectors;
Rules = rules;
OriginalRuleset = originalRuleset ?? this;
}
示例2: Expression
public Expression(IEnumerable<Node> value)
{
if(value is NodeList)
Value = value as NodeList;
else
Value = new NodeList(value);
}
示例3: Build
public void Build()
{
NodeList<BuildAction> roots = new NodeList<BuildAction>();
NodeList<BuildAction> allgames = new NodeList<BuildAction>();
foreach (var replay in m_replays)
{
foreach (var player in replay.Players)
{
var actions = replay.Actions.Where(x => x.Player == player
&& x.ActionType == Entities.ActionType.Build)
.OrderBy(y => y.Sequence)
.Cast<BuildAction>();
if (actions.Count() > 0)
{
BuildAction action = actions.ElementAt(0);
Node<BuildAction> node = new Node<BuildAction>(1, action, buildTree(actions));
allgames.Add(node);
if (roots.Where(x => x.Value.ObjectType == action.ObjectType).Count() == 0)
{
roots.Add(node);
}
}
}
}
countOccurances(roots, allgames);
m_roots = roots;
m_allGames = allgames;
}
示例4: CartoSelector
public CartoSelector(IEnumerable<Element> elements, Env env)
: base(elements)
{
m_filters = new CartoFilterSet();
m_zooms = new NodeList<CartoZoomElement>();
m_elements = new NodeList<CartoElement>();
m_conditions = 0;
if (env == null)
env = new Env(); // TODO
foreach (Element elem in elements)
{
if (elem is CartoFilterElement)
{
m_filters.Add(elem as CartoFilterElement, env);
m_conditions++;
}
else if (elem is CartoZoomElement)
{
m_zooms.Add(elem as CartoZoomElement);
m_conditions++;
}
else if (elem is CartoAttachmentElement)
m_attachment = (elem as CartoAttachmentElement).Value;
else
m_elements.Add((CartoElement)elem);
}
}
示例5: AStar
public AStar(int width, int height)
{
w = width;
h = height;
//MAKE THE ARRAY OF COORDINATES SO THAT WE SEARCH THEM IN THE RIGHT ORDER
coords = new System.Collections.Generic.List<Vector2>();
coords.Add(new Vector2(0,-1)); // UP
coords.Add(new Vector2(1,0)); // RIGHT
coords.Add(new Vector2(0,1)); // DOWN
coords.Add(new Vector2(-1,0)); // LEFT
if(allowDiagonals)
{
coords.Add(new Vector2(-1,-1)); // UP-LEFT
coords.Add(new Vector2(1,-1)); // UP-RIGHT
coords.Add(new Vector2(1,1)); // DOWN-RIGHT
coords.Add(new Vector2(-1,1)); // DOWNLEFT
}
relCurrent = new Vector2();
relLast = new Vector2();
startNode = new GridNode();
endNode = new GridNode();
open = new NodeList(w*h);
closed = new NodeList(w*h);
createGrid(w,h);
r = new RandomSeed(THE_SEED);
}
示例6: ResourceNode
public ResourceNode(Game game, NodeList subNode, String name, ResourceNodeType type = ResourceNodeType.MESH)
{
m_game = game;
m_subNodes = subNode;
m_name = name;
m_type = type;
}
示例7: StartStep
public override PropertyTreeMetaObject StartStep(PropertyTreeMetaObject target, PropertyTreeNavigator self, NodeList children)
{
Predicate<PropertyTreeNavigator> predicate = ImplicitDirective(target, "source");
var node = children.FindAndRemove(predicate).FirstOrDefault();
if (node != null) {
IServiceProvider serviceProvider = Parent.GetBasicServices(node);
var uriContext = node as IUriContext;
TargetSourceDirective ss;
ss = this.DirectiveFactory.CreateTargetSource(node, uriContext);
if (ss != null) {
try {
target = target.BindStreamingSource(ss, serviceProvider);
} catch (Exception ex) {
if (ex.IsCriticalException())
throw;
Parent.errors.FailedToLoadFromSource(ss.Uri, ex, node.FileLocation);
}
}
}
return target;
}
示例8: LoopNode
public LoopNode(string initExpression, string iterExpression, string testExpression, NodeList nodes)
{
m_initExpression = initExpression;
m_iterExpression = iterExpression;
m_testExpression = testExpression;
m_nodes.AddRange(nodes);
}
示例9: Module
private NodeList SiteList; //List containing sites for this module
#endregion Fields
#region Constructors
/// <summary>
/// Create a new module
/// </summary>
public Module()
{
//Initialize list containers
SiteList = new NodeList();
ImportList = new NodeList();
FunctionDefinitionList = new NodeList();
}
示例10: Main
static void Main(string[] args)
{
for (int i = 0; i < 20; i++)
{
NodeList nodeList = new NodeList(20, 80, 15, 100, 100);
AlgorithmFunction.AlgorithmPreparation(nodeList, 15);
////质心算法
//AlgorithmFunction.CenterOfMass_algorithm(nodeList, 1);
//DataExport.DataExportToExcel(nodeList, @"d:/COM.xls");
////DV-Hop算法
List<Node> generalNodeList = nodeList.GetAllGeneralNode();
foreach (GeneralNode gn in generalNodeList)
{
gn.EstimatedX = gn.EstimatedY = 0d;
gn.IsLocatable = gn.IsAlreadyLocated = false;
}
AlgorithmFunction.DV_Hop_algorithm(nodeList);
DataExport.DataExportToExcel(nodeList, @"d:/DV-Hop.xls");
//Revised DV-Hop算法
foreach (GeneralNode gn in generalNodeList)
{
gn.EstimatedX = gn.EstimatedY = 0d;
gn.IsLocatable = gn.IsAlreadyLocated = false;
}
AlgorithmFunction.Revised_DV_Hop_algorithm(nodeList, 5);
DataExport.DataExportToExcel(nodeList, @"d:/Revised-DV-Hop.xls");
}
Console.WriteLine("==========Done==========");
Console.ReadKey();
}
示例11: StartStep
public override PropertyTreeMetaObject StartStep(
PropertyTreeMetaObject target,
PropertyTreeNavigator self,
NodeList children)
{
if (!(target is UntypedToTypedMetaObject))
return target;
if (!children.Any())
return target;
try {
// TODO Only supports one child (lame spec)
var rootType = target.Root.ComponentType;
var types = children.Select(t => ConvertToType(t, rootType)).ToArray();
target = target.BindGenericParameters(types);
} catch (Exception ex) {
if (ex.IsCriticalException())
throw;
Parent.errors.CouldNotBindGenericParameters(target.ComponentType, ex, self.FileLocation);
}
Parent.Bind(target, children.First(), null);
children.Clear();
return target;
}
示例12: OrderByClause
/// <summary>
/// Initializes order by clause.
/// </summary>
internal OrderByClause(NodeList<OrderByClauseItem> orderByClauseItem, Node skipExpr, Node limitExpr, uint methodCallCount)
{
_orderByClauseItem = orderByClauseItem;
_skipExpr = skipExpr;
_limitExpr = limitExpr;
_methodCallCount = methodCallCount;
}
示例13: CenterOfMass_algorithm
/// <summary>
/// 质心算法
/// </summary>
/// <param name="nodeList"></param>
/// <param name="j">质心算法中取j跳范围内的信标节点帮助计算</param>
public static void CenterOfMass_algorithm(NodeList nodeList, int j)
{
List<Node> generalNodeList = nodeList.GetAllGeneralNode();
foreach (GeneralNode gn in generalNodeList)
{
//循环,进行定位
List<Node> AssistLocateNodeList = new List<Node>();
//将信标节点加入到协助定位的节点列表中
foreach (int nodeId in gn.HopCountTable.Keys)
{
if (nodeList.GetNodeById(nodeId).IsBeaconNode && gn.HopCountTable[nodeId] <= j)
{
AssistLocateNodeList.Add(nodeList.GetNodeById(nodeId));
}
}
if (AssistLocateNodeList.Count >= 1)
{
double sumEstimatedX = 0d;
double sumEstimatedY = 0d;
foreach (BeaconNode bn in AssistLocateNodeList)
{
sumEstimatedX += bn.RealX;
sumEstimatedY += bn.RealY;
}
gn.IsLocatable = true;
gn.IsAlreadyLocated = true;
gn.EstimatedX = sumEstimatedX / AssistLocateNodeList.Count;
gn.EstimatedY = sumEstimatedY / AssistLocateNodeList.Count;
}
}
}
示例14: MethodExpr
/// <summary>
/// Initializes method ast node.
/// </summary>
internal MethodExpr(
Node expr,
DistinctKind distinctKind,
NodeList<Node> args)
: this(expr, distinctKind, args, null)
{
}
示例15: Cluster
public void Cluster(int k, NodeList<BuildAction> observations)
{
// Use random observations as centroids
//List<Centroid> centroids = initialCentroidRandom(k, observations);
List<Centroid> centroids = initialCentroidReasonable(observations); // OBS! Ignores k
foreach (Centroid c in centroids)
observations.Remove(c.Value);
assignToCentroid(observations, centroids);
// TODO: Check if stability has occured instead
// Im tired, no moar coffee....
for (int i = 0; i < 3; i++)
{
centroids = iterate(centroids);
assignToCentroid(observations, centroids);
}
foreach (var c in centroids)
{
var err = c.Observations.Where(x => x.Value.ObjectType != c.Value.Value.ObjectType);
System.Console.WriteLine("Error count: " + err.Count());
}
m_clusters = centroids;
}