Example #1
0
    public static Voronoi Relax(Voronoi voronoi, Vector2 bounds1, Vector2 bounds2, int amount = 100)
    {
        Voronoi newVoronoi;
        HashSet<Vector2> sites = new HashSet<Vector2>();
        Vector2 centroidRemember;

        foreach (KeyValuePair<Vector2, Polygon> poly in voronoi.Polygons)
        {
            centroidRemember = PolygonCentroid(poly.Value);
            if (centroidRemember.x != -Mathf.Infinity && centroidRemember.y != -Mathf.Infinity && centroidRemember.x != Mathf.Infinity && centroidRemember.y != Mathf.Infinity && centroidRemember.x > bounds1.x && centroidRemember.y > bounds1.y && centroidRemember.x < bounds2.x && centroidRemember.y < bounds2.y)
            {
                sites.Add(centroidRemember);
            }
            else
            {
                sites.Add(poly.Value.MidPoint.Point);
            }
        }

        amount--;

        newVoronoi = Delaunay.DeriveVoronoi(sites.ToList(), Delaunay.Triangulate(sites.ToList()));

        if (amount <= 0)
        {
            return newVoronoi;
        }
        else
        {
            return Relax(newVoronoi, bounds1, bounds2, amount);
        }
    }
        private static Dictionary<string, string> Translate(HashSet<string> toTranslate, string fromCulture, string toCulture)
        {
            var translated = Translation.TranslationClient.Translator.TranslateBatch(toTranslate.ToList(), fromCulture, toCulture);

            Dictionary<string, string> dic = new Dictionary<string, string>();
            dic.AddRange(toTranslate.ToList(), translated);
            return dic;
        }
        public static List<XmlSchema> GetAllSchemas(this XmlSchemaSet schemaSet)
        {
            // The method XmlSchemaSet.Schemas() will only include all schemas
            // directly added to th schema set, it does not contain any schema
            // that is only indirectly included or imported.
            //
            // So the first thing is to recursively process all schemas and add
            // all schemas included or imported.

            var schemas = new HashSet<XmlSchema>();
            foreach (XmlSchema schema in schemaSet.Schemas())
            {
                schemas.Add(schema);
                AddIncludedSchemas(schemas, schema);
            }

            // However, now there are still schemas missing: so-called chameleon
            // schemas. A chameleon schema is a schema that does not declare
            // a target namespace. If such a schema is included into another
            // schema that declares a target namespace the included schema
            // "inherits" that target namespace. System.Xml.Schema accomplishes
            // that by cloning the schema object and updating all the
            // namespaces. The problem is that we don't find such a schema
            // via XmlSchemaSet.Schemas() or schema.Includes. Instead we have
            // to look at every declared entity and search up their parents
            // until we find the declaring schema. This is sad and ineffecient
            // but it seems to be the only possible option.

            var topLevelSchemas = schemas.ToList();
            foreach (var schema in topLevelSchemas)
            {
                var allItems = schema.Elements.Values.Cast<XmlSchemaObject>()
                       .Concat(schema.Attributes.Values.Cast<XmlSchemaObject>())
                       .Concat(schema.Groups.Values.Cast<XmlSchemaObject>())
                       .Concat(schema.AttributeGroups.Values.Cast<XmlSchemaObject>())
                       .Concat(schema.SchemaTypes.Values.Cast<XmlSchemaObject>())
                       .Concat(schema.Notations.Values.Cast<XmlSchemaObject>());

                foreach (var item in allItems)
                {
                    var declaredSchema = item.GetSchema();
                    if (declaredSchema != null)
                        schemas.Add(declaredSchema);
                }
            }

            return schemas.ToList();
        }
Example #4
0
        public int LadderLength(string start, string end, string[] dict)
        {
            int result = 0;

            HashSet<string> hashSet = new HashSet<string>(dict);
            HashSet<string> currentStarts = new HashSet<string>() { start }; // change to List will slow down perf

            while (currentStarts.Count > 0)
            {
                currentStarts.ToList().ForEach(x => hashSet.Remove(x));

                result++;

                HashSet<string> nextStarts = new HashSet<string>();
                foreach (string word in currentStarts)
                {
                    if (word == end)
                    {
                        return result;
                    }
                    GetAllValidMoves(word, hashSet, nextStarts);
                }

                currentStarts = nextStarts;
            }
            return 0;
        }
Example #5
0
        /// <summary>
        /// This method removes duplicates from tile connections. This includes connections
        /// which are a subset of another connection.
        /// </summary>
        /// <param name="tileConnections"></param>
        /// <returns></returns>
        public static List<TileConnection> CleanDuplicatesFromTileCollectionList(List<TileConnection> tileConnections)
        {
            var dupes = new HashSet<TileConnection>();

            //compare every tile connection against every other to find the duplicates. This is slow.
            for (var tci = 0; tci < tileConnections.Count; tci++) {
                var tc = tileConnections[tci];
                for (var tci2 = tci + 1; tci2 < tileConnections.Count; tci2++) {
                    var tc2 = tileConnections[tci2];
                    if (!dupes.Contains(tc2) && tc2.IsDuplicateOrSubsetOf(tc)) {
                        dupes.Add(tc2);

                    } else if (!dupes.Contains(tc) && tc.IsDuplicateOrSubsetOf(tc2)) {
                        //By using else if we ensure that we don't add both tileconnections
                        //if they are exact duplicates
                        dupes.Add(tc);
                    }
                }
            }

            //remove all the duplicates
            dupes.ToList().ForEach( dup => {
                tileConnections.Remove(dup);
            });

            return tileConnections;
        }
Example #6
0
        private static void Main()
        {
            var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var n = input[0];
            var coord0 = new Coord(input[1], input[2]);
            var rgcoord = new HashSet<Coord>();
            for (var i = 0; i < n; i++)
            {
                input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                rgcoord.Add(new Coord(input[0], input[1]));
            }

            var d = 0;
            while (rgcoord.Any())
            {
                d++;
                var coord = rgcoord.First();
                var vX = coord.x - coord0.x;
                var vY = coord.y - coord0.y;

                foreach (var coordT in rgcoord.ToList())
                {
                    if (vY*(coordT.x - coord0.x) == vX*(coordT.y - coord0.y))
                        rgcoord.Remove(coordT);
                }
            }

            Console.WriteLine(d);
        }
Example #7
0
    public static List<int> GenerateRandom(int count, int min = 27560000, int max = 27569999)
    {
        if (max <= min || count < 0 ||
                (count > max - min && max - min > 0))
        {
            throw new ArgumentOutOfRangeException("Range or count " + count + " is illegal");
        }

        HashSet<int> candidates = new HashSet<int>();

        for (int top = max - count; top < max; top++)
        {
            if (!candidates.Add(random.Next(min, top + 1)))
            {
                candidates.Add(top);
            }
        }

        List<int> result = candidates.ToList();

        for (int i = result.Count - 1; i > 0; i--)
        {
            int k = random.Next(i + 1);
            int tmp = result[k];
            result[k] = result[i];
            result[i] = tmp;
        }
        return result;
    }
Example #8
0
    private static string ParseFiles(IEnumerable<string> filePaths)
    {
        var classLines = new List<string>();
        var usingsSet = new HashSet<string>();

        Func<string, bool> isUsingStmt = (x) => x.StartsWith("using");

        var lines = filePaths.Select(x => File.ReadAllLines(x)).SelectMany(x => x).ToList();

        foreach (var line in filePaths.Select(x => File.ReadAllLines(x)).SelectMany(x => x)) {

            if (isUsingStmt(line)) {
                usingsSet.Add(line);

            } else {

                classLines.Add(line);
            }

        }

        var result = usingsSet.ToList();

        result.AddRange(classLines);

        var builder = new StringBuilder();

        result.ForEach(x => builder.AppendLine(x));

        return builder.ToString();
    }
Example #9
0
 public void UndoRedo(Board board)
 {
     HashSet<int> layersToRecheck = new HashSet<int>();
     foreach (UndoRedoAction action in Actions)
         action.UndoRedo(layersToRecheck);
     layersToRecheck.ToList().ForEach(x => board.Layers[x].RecheckTileSet());
 }
        public static void PrintAllTestFailures()
        {
            var directories = GetBuildDirectories();

            var tests = new HashSet<AggregateTestResult>();

            var totalBuilds = 0;
            var days = 1;

            foreach (var dir in directories.Where(x=>Directory.GetCreationTime(x) > DateTime.Now.AddDays(-1 * days)))
            {
                totalBuilds++;
                var files = Directory.GetFiles(dir, "junitResult.xml");
                if (files.Any())
                {
                    var fileName = files[0];
                    var iterator = GetTestCasesWithErrors(fileName);

                    while (iterator.MoveNext())
                    {
                        var failingTest = GetFailingTestName(iterator);

                        var testResult = GetTestResult(failingTest, tests);

                        UpdateResults(failingTest, dir, tests, testResult);
                    }
                }
            }
            foreach (var failingTest in tests.ToList().OrderBy(x=>x.FailureCount).Reverse())
            {
                Console.WriteLine(failingTest);
            }
            Console.WriteLine("Tests performed during last: " + days + " days");
            Console.WriteLine("Total Builds performed during test run: " + totalBuilds);
        }
Example #11
0
        public string[][] FindLadders(string start, string end, string[] dict)
        {
            HashSet<string> dictionary = new HashSet<string>(dict);
            HashSet<string> currentStarts = new HashSet<string>() { start };

            List<string[]> results = new List<string[]>();
            Dictionary<string, List<string>> backtrackMap = new Dictionary<string, List<string>>();

            while (currentStarts.Count > 0)
            {
                currentStarts.ToList().ForEach(x => dictionary.Remove(x));
                HashSet<string> nextStarts = new HashSet<string>();

                foreach (string word in currentStarts)
                {
                    if (word == end)
                    {
                        AddPathToResults(backtrackMap, start, end, results);
                    }
                    GetAllValidNextWords(word, dictionary, nextStarts, backtrackMap);
                }

                currentStarts = nextStarts;
            }

            return results.ToArray();
        }
Example #12
0
        public List<string> GenerateLicenseKeys(string rsaXmlString, LicenseBase scutexLicense, LicenseGenerationOptions generationOptions, int count)
        {
            HashSet<string> licenses = new HashSet<string>();
            int doupCount = 0;

            while (licenses.Count < count)
            {
                string key = GenerateLicenseKey(rsaXmlString, scutexLicense, generationOptions);

                if (licenses.Contains(key) == false)
                {
                    licenses.Add(key);
                    //Debug.WriteLine(string.Format("{0} of {1} keys generated", licenses.Count, count));
                }
                else
                {
                    doupCount++;
                    Debug.WriteLine(string.Format("Duplicate key was generated {0}", key));
                }
            }

            if (doupCount > 0)
                Debug.WriteLine(string.Format("{0} duplicate keys were generated at a {1}% chance", doupCount, doupCount * 100m / count));

            return licenses.ToList();
        }
        public UpshotControllerDescription(HttpControllerDescriptor controllerDescriptor)
        {
            HashSet<Type> entityTypes = new HashSet<Type>();

            _upshotControllerType = controllerDescriptor.ControllerType;

            IEnumerable<MethodInfo> enumerable =
            from p in _upshotControllerType.GetMethods(BindingFlags.Instance | BindingFlags.Public)
            where p.DeclaringType != typeof(UpshotController) && p.DeclaringType != typeof(object) && !p.IsSpecialName
            select p;
            foreach (MethodInfo current in enumerable)
            {
                if (current.GetCustomAttributes(typeof(NonActionAttribute), false).Length <= 0 && (!current.IsVirtual || !(current.GetBaseDefinition().DeclaringType == typeof(UpshotController))))
                {
                    if (current.ReturnType != typeof(void))
                    {
                        Type type = TypeUtility.UnwrapTaskInnerType(current.ReturnType);
                        Type elementType = TypeUtility.GetElementType(type);
                        if (LookUpIsEntityType(elementType))
                        {
                            if (!entityTypes.Contains(elementType))
                            {
                                entityTypes.Add(elementType);
                            }
                        }
                    }
                }
            }
            _entityTypes = new ReadOnlyCollection<Type>(entityTypes.ToList());
        }
        public void Can_Execute_Multiple_Times(int iterations)
        {
            var expectedMaxBuildNumber = iterations;

            // Using a set to store each generated build number instead of a list in order to detect duplicates.
            // If an attempt is made to store a duplicate build number in the HashSet instance, an exception will be thrown and the test will fail.
            var set = new HashSet<int>();

            var stopwatch = Stopwatch.StartNew();

            for (var i = 0; i < iterations; ++i)
            {
                var buildNumber = Can_Execute_Test();
                set.Add(buildNumber);
                Thread.Sleep(1); // <-- Used to smooth out race conditions regarding the Date property whereby fast machines can get the date out of order.
            }

            stopwatch.Stop();

            Console.WriteLine("Completed 100 iterations in {0} milliseconds.", stopwatch.ElapsedMilliseconds);

            var list = set.ToList();
            list.ForEach(bn => Console.WriteLine("Build Number: {0}", bn));

            // Assert for the whole set.
            int maxBuildNumber;

            using (var db = new BuildVersioningDataContext(GetConfiguredConnectionString()))
            {
                maxBuildNumber = db.VersionHistoryItems.Max(vhi => vhi.BuildNumber);
            }

            // If there are any duplicates, the max expected build number could not be generated.
            maxBuildNumber.ShouldEqual(expectedMaxBuildNumber);
        }
Example #15
0
        public static List<string> ParseAlbum(Uri albumUrl)
        {
            HashSet<string> uniqueImageUrls = new HashSet<string>();
            string xhtml = HttpUtils.RetrieveTextFromHttp(albumUrl);
            Regex regex = new Regex("\"//i.imgur.com/[^\"]+\"");
            MatchCollection matches = regex.Matches(xhtml);
            foreach (Match match in matches)
            {
                // Format URL's
                string url = match.Value;
                url = url.Trim('"');
                url = "http:" + url;

                // Eliminate small thumbnails
                char lastCharBeforeDot = url[url.LastIndexOf('.') - 1];
                if (lastCharBeforeDot == 's')
                {
                    continue;
                }

                // Eliminate badly-formatted images (e.g. from JavaScript)
                if (url.Remove(0, 19).IndexOf('.') < 1)
                {
                    continue;
                }

                uniqueImageUrls.Add(url);
            }
            return uniqueImageUrls.ToList<string>();
        }
Example #16
0
        public IList<int> GrayCode(int n)
        {
            //List<int> re = new List<int>();
            HashSet<int> re = new HashSet<int>();

            re.Add(0);
            while(true)
            {
                var val = re.Last();
                int i = 0;
                while(i < n)
                {
                    int nextval = val ^ (1 << i);
                    if (!re.Contains(nextval))
                    {
                        re.Add(nextval);
                        break;
                    }
                    i++;                 
                }
                if (i == n)
                    break;
            }
            
            return re.ToList();
        }
 private IList<Position> Init(char[,] board)
 {
     ISet<Position> res=new HashSet<Position>();
     // for(int i=0;i<board.GetLength(0);i++)
     // {
     //     for(int j=0;j<board.GetLength(1);j++)
     //     {
     //         if(board[i,j]=='O')
     //             res.Add(new Position(i,j));
     //     }
     // }
     for(int j=0;j<board.GetLength(1);j++)
     {
         if(board[0,j]=='O')
             res.Add(new Position(0,j));
         if(board[board.GetLength(0)-1,j]=='O')
             res.Add(new Position(board.GetLength(0)-1,j));
     }
     for(int i=0;i<board.GetLength(0);i++)
     {
         if(board[i,0]=='O')
             res.Add(new Position(i,0));
         if(board[i,board.GetLength(1)-1]=='O')
             res.Add(new Position(i,board.GetLength(1)-1));
     }
     return res.ToList();
 }
 public override IEnumerable<string> GetNamespacesToAdd(IConnectionInfo cxInfo)
 {
     var set = new HashSet<string>(base.GetNamespacesToAdd(cxInfo));
     var settings = GetCxSettings(cxInfo);
     set.UnionWith(settings.NamespacesToAdd);
     return set.ToList();
 }
 public void Test_set()
 {
     Assert.AreEqual(new Argument("N"), new Argument("N"));
     var l = new List<Pattern> {new Argument("N"), new Argument("N")};
     var s = new HashSet<Pattern>(l);
     Assert.AreEqual(new Pattern[] {new Argument("N"),}, s.ToList());
 }
		public static List<Device> GetRemoteForZone(Device parentPanel, Zone zone)
		{
			var devices = new HashSet<Device>();
			foreach (var device in GetDevicesInLogic(zone))
			{
				foreach (var clause in device.ZoneLogic.Clauses)
				{
					var allZonesAreRemote = true;
					foreach (var clauseZone in clause.Zones)
					{
						if (clauseZone.DevicesInZone.FirstOrDefault().ParentPanel.UID == device.ParentPanel.UID)
							allZonesAreRemote = false;
					}

					if (clause.Operation.Value == ZoneLogicOperation.Any || allZonesAreRemote)
					{
						foreach (var clauseZone in clause.Zones)
						{
							if (clauseZone.UID == zone.UID)
							{
								if (device.ParentPanel.UID != parentPanel.UID)
								{
									devices.Add(device);
								}
							}
						}
					}
				}
			}
			return devices.ToList();
		}
        public static List<HandwrittenWord> SymbolsToWords(List<HandwrittenSymbol> symbols)
        {
            int[] symbolWords = new int[symbols.Count]; // int = number of symbols word in words list
            for (int i = 0; i < symbols.Count; i++)
                symbolWords[i] = i;

            for (int i = 0; i < symbols.Count - 1; i++)
                for (int j = i + 1; j < symbols.Count; j++)
                    if (isSameWord(symbols[i].bounds, symbols[j].bounds))
                        symbolWords[j] = symbolWords[i];               //now each int in symbolWords contains correct number of symbols word

            HashSet<int> words = new HashSet<int>();
            foreach (int word in symbolWords)
                words.Add(word);                                     //delete duplicates

            //get rid of this block?
            List<List<int>> numbersOfSymbolsInWords = new List<List<int>>();
            foreach (int word in words)
                numbersOfSymbolsInWords.Add(new List<int>());
            for (int i = 0; i < symbolWords.Length; i++)
                numbersOfSymbolsInWords[words.ToList().IndexOf(symbolWords[i])].Add(i);

            // List<List<int>> to List<HandwrittenWord>
            List<HandwrittenWord> result = new List<HandwrittenWord>();
            for (int i = 0; i < numbersOfSymbolsInWords.Count;i++ )
            {
                result.Add(new HandwrittenWord());
                for(int j=0;j<numbersOfSymbolsInWords[i].Count;j++)
                    result[i].symbols.Add(symbols[numbersOfSymbolsInWords[i][j]]);
            }
            return result;
        }
        public async Task<SignatureHelp> GetSignatureHelp(Request request)
        {
            var invocations = new List<InvocationContext>();
            foreach (var document in _workspace.GetDocuments(request.FileName))
            {
                var invocation = await GetInvocation(document, request);
                if (invocation != null)
                {
                    invocations.Add(invocation);
                }
            }

            if (invocations.Count == 0)
            {
                return null;
            }

            var response = new SignatureHelp();

            // define active parameter by position
            foreach (var comma in invocations.First().ArgumentList.Arguments.GetSeparators())
            {
                if (comma.Span.Start > invocations.First().Position)
                {
                    break;
                }
                response.ActiveParameter += 1;
            }

            // process all signatures, define active signature by types
            var signaturesSet = new HashSet<SignatureHelpItem>();
            var bestScore = int.MinValue;
            SignatureHelpItem bestScoredItem = null;

            foreach (var invocation in invocations)
            {
                var types = invocation.ArgumentList.Arguments
                    .Select(argument => invocation.SemanticModel.GetTypeInfo(argument.Expression));

                foreach (var methodOverload in GetMethodOverloads(invocation.SemanticModel, invocation.Receiver))
                {
                    var signature = BuildSignature(methodOverload);
                    signaturesSet.Add(signature);

                    var score = InvocationScore(methodOverload, types);
                    if (score > bestScore)
                    {
                        bestScore = score;
                        bestScoredItem = signature;
                    }
                }
            }

            var signaturesList = signaturesSet.ToList();
            response.Signatures = signaturesList;
            response.ActiveSignature = signaturesList.IndexOf(bestScoredItem);

            return response;
        }
Example #23
0
		/// <summary>
		/// Initializes a new instance of the <see cref="MyMediaLite.Data.RatingScale"/> class,
		/// given a list of byte values
		/// </summary>
		/// <param name='rating_values'>the ratings dataset</param>
		public RatingScale (IList<byte> rating_values)
		{
			var levels = new HashSet<float>();
			foreach (float val in rating_values)
				levels.Add((float) val);

			Init(levels.ToList());
		}
        /// <summary>
        /// Starts the search for TV shows recursively starting from the specified path.
        /// </summary>
        /// <param name="path">The paths where to start the search.</param>
        /// <returns>
        /// The list of discovered TV shows.
        /// </returns>
        public List<string> DiscoverFromPath(string path)
        {
            _results = new HashSet<string>();

            ScanDirectoryForFile(path);

            return _results.ToList();
        }
 public override IEnumerable<string> GetAssembliesToAdd(IConnectionInfo cxInfo)
 {
     var set = new HashSet<string>(base.GetAssembliesToAdd(cxInfo));
     var settings = GetCxSettings(cxInfo);
     var paths = CxSettingsPathsHelper.Current.GetAssemblyLocations(settings);
     set.UnionWith(paths);
     return set.ToList();
 }
        private List<string> CreateHistory(HashSet<Domain.PartnerModule.History> histories)
        { 
            List<string> to = new List<string>();

            histories.ToList().ForEach(h => to.Add(h.Url));

            return to;
        }
Example #27
0
        public static string TrackTableBuilder(IList<IJukeboxTrack> tracks, TrackTableKind kind)
        {
            var table = new StringBuilder();

            var lettersHash = new HashSet<string>(tracks.Select(x => x.ArtistsAndName.Substring(0, 1)));
            var letters = lettersHash.ToList();
            letters.Sort((x, y) => string.Compare(x, y));

            var alternateRow = false;
            foreach (var letter in letters)
            {
                var currentLetterTracks = tracks.Where(x => x.ArtistsAndName.StartsWith(letter));

                table.Append("<h3>" + letter.ToUpper() + "</h3>");
                table.Append("<table class=\"" + GetTableCssClass(kind) + "\">");

                if (alternateRow)
                {
                    table.Append("<tr class=\"alternatedRow\">");
                    alternateRow = false;
                }
                else
                {
                    table.Append("<tr>");
                    alternateRow = true;
                }

                var columnsAdded = 0;
                foreach (var track in currentLetterTracks)
                {
                    if (columnsAdded == 3)
                    {
                        table.Append("</tr>");

                        if (alternateRow)
                        {
                            table.Append("<tr class=\"alternatedRow\">");
                            alternateRow = false;
                        }
                        else
                        {
                            table.Append("<tr>");
                            alternateRow = true;
                        }

                        columnsAdded = 0;
                    }

                    table.Append(AddNewColumns(track, track.Equals(currentLetterTracks.Last()), columnsAdded, kind));

                    columnsAdded++;
                }

                table.Append("</tr></table>");
            }

            return table.ToString();
        }
Example #28
0
		public static List<XStateClass> StateBitsToStateClasses(List<GKStateBit> stateBits)
		{
			var stateClasses = new HashSet<XStateClass>();
			foreach (var stateBit in stateBits)
			{
				switch (stateBit)
				{
					case GKStateBit.Fire2:
						stateClasses.Add(XStateClass.Fire2);
						break;
					case GKStateBit.Fire1:
						stateClasses.Add(XStateClass.Fire1);
						break;
					case GKStateBit.Attention:
						stateClasses.Add(XStateClass.Attention);
						break;
					case GKStateBit.Failure:
						stateClasses.Add(XStateClass.Failure);
						break;
					case GKStateBit.Ignore:
						stateClasses.Add(XStateClass.Ignore);
						break;
					case GKStateBit.On:
						stateClasses.Add(XStateClass.On);
						break;
					case GKStateBit.Off:
						stateClasses.Add(XStateClass.Off);
						break;
					case GKStateBit.TurningOn:
						stateClasses.Add(XStateClass.TurningOn);
						break;
					case GKStateBit.TurningOff:
						stateClasses.Add(XStateClass.TurningOff);
						break;
					case GKStateBit.Test:
						stateClasses.Add(XStateClass.Test);
						break;
				}
			}

			if (!stateBits.Contains(GKStateBit.Norm))
			{
				stateClasses.Add(XStateClass.AutoOff);
			}

			if (stateBits.Contains(GKStateBit.Ignore))
			{
				stateClasses.Remove(XStateClass.AutoOff);
			}

			if (stateClasses.Count == 0)
			{
				stateClasses.Add(XStateClass.Norm);
			}
			var result = stateClasses.ToList();
			result.OrderBy(x => x);
			return result;
		}
 /// <summary>
 ///     获得喂食任务获得所选猪舍
 /// </summary>
 /// <param name="taskPigsties">任务_猪栏集合</param>
 /// <returns>猪舍id号集合</returns>
 public List<long> GetPigHouseIds(List<task_pigsty> taskPigsties)
 {
     var pigHouseIds = new HashSet<long>();
     foreach (task_pigsty feedTaskPigsty in taskPigsties)
     {
         pigHouseIds.Add(feedTaskPigsty.pigsty.PigHouseId);
     }
     return pigHouseIds.ToList();
 }
 public List<Point> GetBasePoints()
 {
     var set = new HashSet<Point>();
     foreach (var point in _parent)
     {
         set.Add(FindBasePoint(point));
     }
     return set.ToList();
 }