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


C# Set.add方法代码示例

本文整理汇总了C#中Set.add方法的典型用法代码示例。如果您正苦于以下问题:C# Set.add方法的具体用法?C# Set.add怎么用?C# Set.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Set的用法示例。


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

示例1: BooleanDomain

 static BooleanDomain()
 {
     // Keep consistent order
     _possibleValues = new Set<Boolean>();
     _possibleValues.add(true);
     _possibleValues.add(false);
     // Ensure cannot be modified
     //_possibleValues = Collections.unmodifiableSet(_possibleValues);
 }
开发者ID:PaulMineau,项目名称:AIMA.Net,代码行数:9,代码来源:BooleanDomain.cs

示例2: getPossibleValues

        // END-Domain
        //

        //
        // START-DiscreteDomain

        public override Set<object> getPossibleValues()
        {
            Set<object> set = new Set<object>();
            foreach(int i in possibleValues)
            {
                set.add(i);
            }
            return set;
        }
开发者ID:PaulMineau,项目名称:AIMA.Net,代码行数:15,代码来源:FiniteIntegerDomain.cs

示例3: getPossibleValues

        // END-Domain
        //

        //
        // START-DiscreteDomain
         

        public override Set<object> getPossibleValues()
        {
            Set<object> results = new Set<object>();
            foreach(bool b in _possibleValues)
            {
                results.add(b);

            }
            return results;
        }
开发者ID:PaulMineau,项目名称:AIMA.Net,代码行数:17,代码来源:BooleanDomain.cs

示例4: FiniteIntegerDomain

        public FiniteIntegerDomain(params int[] pValues)
        {
            // Keep consistent order
            possibleValues = new Set<int>();
            foreach (int v in pValues)
            {
                possibleValues.add(v);
            }

            indexPossibleValues(possibleValues);
        }
开发者ID:PaulMineau,项目名称:AIMA.Net,代码行数:11,代码来源:FiniteIntegerDomain.cs

示例5: FullJointDistributionModel

        public FullJointDistributionModel(double[] values, params RandomVariable[] vars)
        {
            if (null == vars)
            {
                throw new ArgumentException(
                    "Random Variables describing the model's representation of the World need to be specified.");
            }

            distribution = new ProbabilityTable(values, vars);

            representation = new Set<RandomVariable>();
            for (int i = 0; i < vars.Length; i++)
            {
                representation.add(vars[i]);
            }
            //representation = Collections.unmodifiableSet(representation);
        }
开发者ID:PaulMineau,项目名称:AIMA.Net,代码行数:17,代码来源:FullJointDistributionModel.cs

示例6: readPacketData

 public override void readPacketData(DataInputStream datainputstream)
 {
     explosionX = datainputstream.readDouble();
     explosionY = datainputstream.readDouble();
     explosionZ = datainputstream.readDouble();
     explosionSize = datainputstream.readFloat();
     int i = datainputstream.readInt();
     destroyedBlockPositions = new HashSet();
     var j = (int) explosionX;
     var k = (int) explosionY;
     var l = (int) explosionZ;
     for (int i1 = 0; i1 < i; i1++)
     {
         int j1 = datainputstream.readByte() + j;
         int k1 = datainputstream.readByte() + k;
         int l1 = datainputstream.readByte() + l;
         destroyedBlockPositions.add(new ChunkPosition(j1, k1, l1));
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:19,代码来源:Packet60.cs

示例7: checkIsDAGAndCollectVariablesInTopologicalOrder

        // END-BayesianNetwork
        //

        //
        // PRIVATE METHODS
        //
        private void checkIsDAGAndCollectVariablesInTopologicalOrder()
        {

            // Topological sort based on logic described at:
            // http://en.wikipedia.org/wiki/Topoligical_sorting
            Set<Node> seenAlready = new Set<Node>();
            Map<Node, List<Node>> incomingEdges = new Map<Node, List<Node>>();
            Set<Node> s = new Set<Node>();
            foreach (Node n in this.rootNodes)
            {
                walkNode(n, seenAlready, incomingEdges, s);
            }
            while (!(s.Count == 0))
            {
                HashSet<Node>.Enumerator enumerator = s.GetEnumerator();
                enumerator.MoveNext();
                Node n = enumerator.Current;
                s.remove(n);
                variables.Add(n.getRandomVariable());
                varToNodeMap.put(n.getRandomVariable(), n);
                foreach (Node m in n.getChildren())
                {
                    List<Node> edges = incomingEdges.get(m);
                    edges.Remove(n);
                    if (edges.Count == 0)
                    {
                        s.add(m);
                    }
                }
            }

            foreach (List<Node> edges in incomingEdges.values())
            {
                if (!(edges.Count == 0))
                {
                    throw new IllegalArgumentException(
                        "Network contains at least one cycle in it, must be a DAG.");
                }
            }
        }
开发者ID:PaulMineau,项目名称:AIMA.Net,代码行数:46,代码来源:BayesNet.cs

示例8: walkNode

 private void walkNode(Node n, Set<Node> seenAlready,
                       Map<Node, List<Node>> incomingEdges, Set<Node> rootNodes)
 {
     if (!seenAlready.Contains(n))
     {
         seenAlready.add(n);
         // Check if has no incoming edges
         if (n.isRoot())
         {
             rootNodes.add(n);
         }
         incomingEdges.put(n, new List<Node>(n.getParents()));
         foreach (Node c in n.getChildren())
         {
             walkNode(c, seenAlready, incomingEdges, rootNodes);
         }
     }
 }
开发者ID:PaulMineau,项目名称:AIMA.Net,代码行数:18,代码来源:BayesNet.cs

示例9: addChild

        //
        // PROTECTED METHODS
        //
        protected void addChild(Node childNode)
        {
            children = new LinkedHashSet<Node>(children);

            children.add(childNode);


        }
开发者ID:PaulMineau,项目名称:AIMA.Net,代码行数:11,代码来源:AbstractNode.cs

示例10: SetCellContents

    /// <summary>
    /// If text is null, throws an ArgumentNullException.
    /// 
    /// Otherwise, if name is null or invalid, throws an InvalidNameException.
    /// 
    /// Otherwise, the contents of the named cell becomes text.  The method returns a
    /// set consisting of name plus the names of all other cells whose value depends, 
    /// directly or indirectly, on the named cell.
    /// 
    /// For example, if name is A1, B1 contains A1*2, and C1 contains B1+A1, the
    /// set {A1, B1, C1} is returned.
    /// </summary>
    public ISet<String> SetCellContents(String name, String text)
    {
        Set<string> set = new Set<string>();
        if (text.Equals(null))
        {
            throw ArgumentNullException;

        }
        else if (name.Equals(null))
        {
            throw InvalidNameException;
        }
        else
        {
            DG[name] = text;

        }
        foreach (KeyValuePair<string, cell> c in DG)
        {
            if ((c.Value) == name)
            {
                set.add(c.Value);

            }
            if ((c.Key) == name)
            {
                set.add(c.Key);

            }

        }
        return set;
    }
开发者ID:GabeKenworthy,项目名称:Software-Practice-I,代码行数:45,代码来源:Class1.cs

示例11: visitReferencedTypes

		private void visitReferencedTypes(String typeName, Set<String> result) {
			if (result.add(typeName)) {
				foreach (var s in getReferencedTypes(typeName)) {
					visitReferencedTypes(s, result);
				}
			}
		}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:7,代码来源:DependencyInfo.stab.cs


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