public void Pass_Check_If_Value_Not_Already_In_Any_CellGroup() { //arrange var cellA1 = new Cell(1); var cellB1 = new Cell(2); var cellC1 = new Cell(3); var cellD1 = new Cell(4); var cellE1 = new Cell(5); var cellF1 = new Cell(6); var cellG1 = new Cell(7); var cellH1 = new Cell(8); var cellI1 = new Cell(9); var cellA2 = new Cell(4); var cellB2 = new Cell(5); var cellC2 = new Cell(6); var cellA3 = new Cell(7); var cellB3 = new Cell(8); var cellC3 = new Cell(9); var cellA4 = new Cell(4); var cellA5 = new Cell(5); var cellA6 = new Cell(6); var cellA7 = new Cell(7); var cellA8 = new Cell(8); var cellA9 = new Cell(9); var square = new CellGroup(cellA1, cellB1, cellC1, cellA2, cellB2, cellC2, cellA3, cellB3, cellC3); var row = new CellGroup(cellA1, cellB1, cellC1, cellD1, cellE1, cellF1, cellG1, cellH1, cellI1); var column = new CellGroup(cellA1, cellA2, cellA3, cellA4, cellA5, cellA6, cellA7, cellA8, cellA9); var }
public static float CalculateNeighborhoodWaterPresenceIn(CellGroup group) { float neighborhoodPresence; int groupCellBonus = 1; int cellCount = groupCellBonus; TerrainCell groupCell = group.Cell; float totalPresence = groupCell.WaterBiomePresence * groupCellBonus; foreach (TerrainCell c in groupCell.Neighbors.Values) { totalPresence += c.WaterBiomePresence; cellCount++; } neighborhoodPresence = totalPresence / cellCount; if ((neighborhoodPresence < 0) || (neighborhoodPresence > 1)) { throw new System.Exception("Neighborhood sea presence outside range: " + neighborhoodPresence); } return(neighborhoodPresence); }
public static void assignClusterHead(CellGroup Cell) { double offset = PublicParameters.cellRadius; Sensor holder = null; foreach (Sensor sen in Cell.clusterNodes) { double distance = Operations.DistanceBetweenTwoPoints(Cell.clusterCenterComputed, sen.CenterLocation); if (distance < offset) { offset = distance; holder = sen; } } try { Cell.CellTable = new CellTable(holder, holder.CenterLocation); } catch { holder = null; MessageBox.Show("Error in assiging Cluster Header"); return; } holder.Ellipse_HeaderAgent_Mark.Stroke = new SolidColorBrush(Colors.Red); PublicParameters.SinkNode.MainWindow.Dispatcher.Invoke(() => holder.Ellipse_HeaderAgent_Mark.Visibility = Visibility.Visible); PopulateHeaderInformation(Cell); }
/// <summary> /// This methods rotates hexagons. Rotate information comes from input manager /// </summary> /// <param name="clockwise"></param> /// <returns></returns> public IEnumerator CheckRotate(bool clockwise) { List <Hexagon> matchList = new List <Hexagon>(); // temporary group CellGroup tempGroup = selectedGroup; // Initialize our rotate command ICommand rotateCommand; for (int i = 0; i < selectedGroup.NeighbourGroup.Length; i++) { SetState(States.RotatingState); // create new rotate command for start rotating rotateCommand = new RotateCommand(clockwise); rotateCommand.Execute(); // adding new command to command buffer. It can be used for later events CommandManager.Instance.AddCommand(rotateCommand); yield return(new WaitForSeconds(HexMetrics.ROTATION_DELAY)); // calculation for matches matchList = CalculateMatches(hexagons); if (matchList.Count > 0) { OnMoveMade?.Invoke(); SetState(States.ExplosionState); StartCoroutine(HandleMatch(matchList)); break; } } // if everything is compleated we are going to take our next input SetState(States.InputState); }
public Faction(string type, Polity polity, CellGroup coreGroup, float influence, Faction parentFaction = null) { World = polity.World; LastUpdateDate = World.CurrentDate; long idOffset = 0; if (parentFaction != null) { idOffset = parentFaction.Id + 1; } PolityId = polity.Id; Polity = polity; CoreGroup = coreGroup; CoreGroupId = coreGroup.Id; long id = GenerateUniqueIdentifier(World.CurrentDate, 100L, idOffset); Info = new FactionInfo(type, id, this); Culture = new FactionCulture(this); CoreGroup.AddFactionCore(this); Influence = influence; GenerateName(parentFaction); IsInitialized = false; }
public static void chooseAgent() { if (myAgent != null) { //Changing the agent from to Sensor newAgent = groupNeighbors(); if (newAgent != null) { sendFollowUpToAgent(myAgent, newAgent); AgentViewsCell = CellGroup.getClusterWithID(Tree.rootClusterID); if (AgentViewsCell == null) { Console.WriteLine("View Cell is null"); } myAgent = newAgent; } else { Console.WriteLine("Agent Not Found"); return; } } else { //First time choice myAgent = groupNeighbors(); sendFollowUpToAgent(myAgent, myAgent); AgentViewsCell = CellGroup.getClusterWithID(Tree.rootClusterID); } }
public virtual void FinalizeLoad() { Name.World = World; Name.FinalizeLoad(); CoreGroup = World.GetGroup(CoreGroupId); Polity = World.GetPolity(PolityId); if (Polity == null) { throw new System.Exception("Missing Polity with Id " + PolityId); } Culture.World = World; Culture.Faction = this; Culture.FinalizeLoad(); foreach (FactionRelationship relationship in Relationships) { _relationships.Add(relationship.Id, relationship); relationship.Faction = World.GetFaction(relationship.Id); if (relationship.Faction == null) { throw new System.Exception("Faction is null, Id: " + relationship.Id); } } GenerateEventsFromData(); }
private static void sendFollowUpToAgent(Sensor oldAgent, Sensor newAgent) { if (AgentViewsCell != null) { //Console.WriteLine("Changing Agent from {0} to {1}", oldAgent.ID, newAgent.ID); if (newAgent.ID == oldAgent.ID && (AgentViewsCell.getID() != Tree.rootClusterID)) { PublicParameters.SinkNode.GenerateAS(oldAgent, newAgent, CellGroup.getClusterWithID(Tree.rootClusterID).CellTable.CellHeader); newAgent.AgentNode = new Agent(PublicParameters.SinkNode, CellGroup.getClusterWithID(Tree.rootClusterID).CellTable.CellHeader, oldAgent, newAgent); } else if (newAgent.ID != oldAgent.ID) { PublicParameters.SinkNode.GenerateAS(oldAgent, newAgent, CellGroup.getClusterWithID(Tree.rootClusterID).CellTable.CellHeader); PublicParameters.SinkNode.GenerateFM(oldAgent, newAgent); newAgent.AgentNode = new Agent(PublicParameters.SinkNode, CellGroup.getClusterWithID(Tree.rootClusterID).CellTable.CellHeader, oldAgent, newAgent); oldAgent.AgentNode.ChangeAgentFM(newAgent); } } else { PublicParameters.SinkNode.GenerateAS(oldAgent, newAgent, CellGroup.getClusterWithID(Tree.rootClusterID).CellTable.CellHeader); newAgent.AgentNode = new Agent(PublicParameters.SinkNode, CellGroup.getClusterWithID(Tree.rootClusterID).CellTable.CellHeader, oldAgent, newAgent); } }
private static void GetEncapsulatingCell() { CellGroup c = PublicParameters.networkCells[0]; double distance = Operations.DistanceBetweenTwoPoints(currentLocation, PublicParameters.networkCells[0].clusterActualCenter); foreach (CellGroup cell in PublicParameters.networkCells) { double dist = Operations.DistanceBetweenTwoPoints(currentLocation, cell.clusterActualCenter); if (dist < distance) { c = cell; } } if (EncapsulatingCell != null) { if (EncapsulatingCell.getID() != c.getID()) { EncapsulatingCell = c; InformNewCell(); } } else { EncapsulatingCell = c; InformNewCell(); } }
public static CellCulturalKnowledge CreateCellInstance(string id, CellGroup group, int initialValue, int initialLimit = -1) { switch (id) { case ShipbuildingKnowledge.KnowledgeId: if (initialLimit == -1) { initialLimit = ShipbuildingKnowledge.BaseLimit; } return(new ShipbuildingKnowledge(group, initialValue, initialLimit)); case AgricultureKnowledge.KnowledgeId: if (initialLimit == -1) { initialLimit = AgricultureKnowledge.BaseLimit; } return(new AgricultureKnowledge(group, initialValue, initialLimit)); case SocialOrganizationKnowledge.KnowledgeId: if (initialLimit == -1) { initialLimit = SocialOrganizationKnowledge.BaseLimit; } return(new SocialOrganizationKnowledge(group, initialValue, initialLimit)); } throw new System.Exception("Unexpected CulturalKnowledge type: " + id); }
public void RetryAssignAfterLoss(CellGroup group) { if (CanAssignEventTypeToGroup(group)) { GenerateAndAssignEvent(group); } }
// check the end of the game void CheckGameOver() { foreach (CellGroup group in groups.Values) { if (group.setted || group == nextGroup) { continue; } if (nextGroup == null) { nextGroup = group; break; } } if (nextGroup != null) { return; } // all the pieces in place gameover = true; pictOver.gameObject.SetActive(true); StartCoroutine(GameOver()); }
void BoardCreate() { groups = new Dictionary <int, CellGroup>(); Lib.RemoveObjects(rootCells); // create groups for each piece and places them in the starting position for (int y = 0; y < sizeBoardY; y++) { for (int x = 0; x < sizeBoardX; x++) { CellGroup group = Lib.AddObject <CellGroup>(prefGroup, rootCells, true); group.index = x + y * sizeBoardX; Cell cell = group.cells[0]; DC_Cell data = new DC_Cell(); data.posX = x; data.posY = y; data.sizeBoardX = sizeBoardX; data.sizeBoardY = sizeBoardY; data.sizePictX = pictBack.localScale.x; data.sizePictY = pictBack.localScale.y; data.sizeCellX = sizeCellX; data.sizeCellY = sizeCellY; cell.SetData(data); cell.draw.SetData(data); group.UpdateIndex(); groups.Add(group.index, group); cell.mesh.gameObject.SetActive(false); } } // generates texture with pieces of puzzle StartCoroutine(DrawingCells()); }
public void CellGroup_SetPossibleValues_Test() { // arrange Cell[] cells = new Cell[9]; for (int i = 0; i < 9; i++) { cells[i] = new Cell(); } cells[0].Value = 1; cells[1].Value = 9; cells[2].Value = 7; CellGroup group = new CellGroup(); group.Cells = cells; // act group.SetPossibleValues(); // assert Assert.AreEqual("", group.Cells[0].PossibleValues); Assert.AreEqual("", group.Cells[1].PossibleValues); Assert.AreEqual("", group.Cells[2].PossibleValues); Assert.AreEqual("234568", group.Cells[3].PossibleValues); Assert.AreEqual("234568", group.Cells[4].PossibleValues); Assert.AreEqual("234568", group.Cells[5].PossibleValues); Assert.AreEqual("234568", group.Cells[6].PossibleValues); Assert.AreEqual("234568", group.Cells[7].PossibleValues); Assert.AreEqual("234568", group.Cells[8].PossibleValues); }
private long CalculateTriggerDate(CellGroup group) { float randomFactor = group.GetNextLocalRandomFloat(IdHash); float dateSpan = randomFactor * EventTimeToTrigger; if (EventTimeToTriggerFactors != null) { foreach (Factor factor in EventTimeToTriggerFactors) { float factorValue = factor.Calculate(group); dateSpan *= Mathf.Clamp01(factorValue); } } long targetDate = group.World.CurrentDate + (long)dateSpan + 1; if ((targetDate <= group.World.CurrentDate) || (targetDate > World.MaxSupportedDate)) { // log details about invalid date Debug.LogWarning("Discovery+Event.CalculateTriggerDate - targetDate (" + targetDate + ") less than or equal to World.CurrentDate (" + group.World.CurrentDate + "), randomFactor: " + randomFactor + ", EventTimeToTrigger: " + EventTimeToTrigger + ", dateSpan: " + dateSpan); return(long.MinValue); } return(targetDate); }
public static bool CanSpawnIn(CellGroup group) { if (group.Population < Tribe.MinPopulationForTribeCore) { return(false); } if (!group.HasProperty(Polity.CanFormPolityAttribute + "tribe")) { return(false); } int value = 0; if (!group.Culture.TryGetKnowledgeValue(SocialOrganizationKnowledge.KnowledgeId, out value)) { return(false); } if (value < MinSocialOrganizationKnowledgeTribeFormation) { return(false); } return(true); }
public bool IsGroupValidCore(CellGroup group) { if (!CanBeClanCore(group)) { return(false); } if (!group.HasProperty(Polity.CanFormPolityAttribute + "tribe")) { return(false); } PolityProminence pi = group.GetPolityProminence(Polity); if (pi == null) { return(false); } if (pi.Value < MinCorePolityProminence) { return(false); } if (group.Population < MinCorePopulation) { return(false); } return(true); }
public void changeNewRootCellHeader(CellGroup RCell) { if (RCell.getID() != encapsulatingCell.getID()) { hasSinkPosition = false; SinkNode = null; isRootCellHeader = false; } else { isRootCellHeader = true; RootCell = null; } if (OuterNeighbors.Count > 0) { OuterNeighbors.Clear(); } OuterCycleSinkHeader = RCell.CellTable.CellHeader; this.RootCell = RCell; foreach (CellGroup cell in OuterCycleLinks) { if (cell.getID() != RCell.getID()) { OuterNeighbors.Add(cell.CellTable.CellHeader); } } }
public Agent(CellGroup birthGroup, long birthDate, long idOffset) { World = birthGroup.World; BirthCell = birthGroup.Cell; BirthCellPosition = BirthCell.Position; BirthRegionInfo = BirthCell.Region.Info; BirthRegionInfoId = BirthRegionInfo.Id; Language = birthGroup.Culture.Language; LanguageId = Language.Id; BirthDate = birthDate; idOffset += birthGroup.Id; Profiler.BeginSample("new Agent - GenerateUniqueIdentifier"); Id = birthGroup.GenerateUniqueIdentifier(birthDate, 1000L, idOffset); Profiler.EndSample(); Profiler.BeginSample("new Agent - GenerateBio"); GenerateBio(birthGroup); Profiler.EndSample(); }
// texture generation of puzzle pieces IEnumerator DrawingCells() { camDraw.enabled = true; // remove the texture, if was generated earlier if (texPuzzle != null) { DestroyImmediate(texPuzzle); } // exhibiting the pieces in the right position for generating camera int camPosX = (int)camDraw.transform.localPosition.x; foreach (CellGroup group in groups.Values) { DC_Cell data = group.cells[0].data; float posX = camPosX + data.posX * data.sizeCellX * 2 - (data.sizeBoardX - 1) * data.sizeCellX; float posY = -data.posY * data.sizeCellY * 2 + (data.sizeBoardY - 1) * data.sizeCellY; group.transform.localPosition = new Vector3(posX, posY, 0); } yield return(new WaitForSeconds(0.1f)); // save the resulting image in the texture RenderTexture.active = rTex; texPuzzle = new Texture2D(sizeBoardX * sizeCellX * 2, sizeBoardY * sizeCellY * 2, TextureFormat.ARGB32, false); texPuzzle.ReadPixels(new Rect(0, 0, sizeBoardX * sizeCellX * 2, sizeBoardY * sizeCellY * 2), 0, 0); texPuzzle.Apply(); RenderTexture.active = null; camDraw.enabled = false; // We remove the helper objects and assign-generated texture foreach (CellGroup group in groups.Values) { Destroy(group.cells[0].draw.gameObject); group.cells[0].mesh.gameObject.SetActive(true); group.cells[0].mesh.sharedMaterial.mainTexture = texPuzzle; } // mix pieces for (int i = 0; i < 100; i++) { curGroup = groups[Random.Range(0, groups.Count)]; SortgroupsUp(); } curGroup = null; // set in the received position for (int y = 0; y < sizeBoardY; y++) { for (int x = 0; x < sizeBoardX; x++) { groups [x + y * sizeBoardX].transform.localPosition = new Vector3( x * sizeCellX - (sizeBoardX - 0) * sizeCellX / 2 + sizeCellX / 2, y * sizeCellY - (sizeBoardY - 0) * sizeCellY / 2 + sizeCellY / 2, 0); } } }
public PolityProminence(CellGroup group, Polity polity, float value, bool isMigratingGroup = false) { Group = group; //_isMigratingGroup = isMigratingGroup; Set(polity, value); }
public PolityProminence(CellGroup group, PolityProminence polityProminence) { Group = group; //_isMigratingGroup = false; Set(polityProminence); }
public PolityProminence(PolityProminence polityProminence) { Group = polityProminence.Group; //_isMigratingGroup = true; Set(polityProminence); }
public static void ChangeOuterCycleFormation(CellGroup RootCell) { RootCell.CellTable.CellHeader.TuftNodeTable.CellHeaderTable.isRootCellHeader = true;; foreach (CellGroup cell in PublicParameters.networkCells) { cell.CellTable.CellHeader.TuftNodeTable.CellHeaderTable.changeNewRootCellHeader(RootCell); } }
public BiomeSurvivalSkill(CellGroup group, BiomeSurvivalSkill baseSkill) : base(group, baseSkill.Id, baseSkill.Name, baseSkill.RngOffset, baseSkill.Value) { BiomeId = baseSkill.BiomeId; Group.AddBiomeSurvivalSkill(this); CalculateNeighborhoodBiomePresence(); }
private void GenerateBio(CellGroup birthGroup) { int rngOffset = RngOffsets.AGENT_GENERATE_BIO + unchecked ((int)Id); IsFemale = birthGroup.GetLocalRandomFloat(BirthDate, rngOffset++) > 0.5f; BaseCharisma = MinAttributeValue + birthGroup.GetLocalRandomInt(BirthDate, rngOffset++, AttributeGenMax); BaseWisdom = MinAttributeValue + birthGroup.GetLocalRandomInt(BirthDate, rngOffset++, AttributeGenMax); }
public static void LeaderAllowsSplit(Clan clan, CellGroup newClanCoreGroup, long eventId) { CalculateMinMaxInfluence(clan, out float minInfluence, out float maxInfluence); newClanCoreGroup.SetToUpdate(); clan.SetToSplit(newClanCoreGroup, minInfluence, maxInfluence, eventId); }
public BiomeSurvivalSkill(CellGroup group, Biome biome, float value) : base(group, GenerateId(biome), GenerateName(biome), GenerateRngOffset(biome), value) { BiomeId = biome.Id; Group.AddBiomeSurvivalSkill(this); CalculateNeighborhoodBiomePresence(); }
public BiomeSurvivalSkill(CellGroup group, CulturalSkill baseSkill, float initialValue) : base(group, baseSkill.Id, baseSkill.Name, baseSkill.RngOffset, initialValue) { BiomeId = GetBiomeId(baseSkill.Id); Group.AddBiomeSurvivalSkill(this); CalculateNeighborhoodBiomePresence(); }
public override void FinalizeLoad() { base.FinalizeLoad(); TargetGroup = World.GetGroup(TargetGroupId); Polity = World.GetPolity(PolityId); Group.PolityExpansionEvent = this; }
// effects: Creates a ViewGenerator object that is capable of // producing query or update mapping views given the relevant schema // given the "cells" internal ViewGenerator(CellGroup cellGroup, ConfigViewGenerator config, List<ForeignConstraint> foreignKeyConstraints, StorageEntityContainerMapping entityContainerMapping) { m_cellGroup = cellGroup; m_config = config; m_queryRewriterCache = new Dictionary<EntitySetBase, QueryRewriter>(); m_foreignKeyConstraints = foreignKeyConstraints; m_entityContainerMapping = entityContainerMapping; Dictionary<EntityType, Set<EntityType>> inheritanceGraph = MetadataHelper.BuildUndirectedGraphOfTypes(entityContainerMapping.StorageMappingItemCollection.EdmItemCollection); SetConfiguration(entityContainerMapping); // We fix all the cells at this point m_queryDomainMap = new MemberDomainMap(ViewTarget.QueryView, m_config.IsValidationEnabled, cellGroup, entityContainerMapping.StorageMappingItemCollection.EdmItemCollection, m_config, inheritanceGraph); m_updateDomainMap = new MemberDomainMap(ViewTarget.UpdateView, m_config.IsValidationEnabled, cellGroup, entityContainerMapping.StorageMappingItemCollection.EdmItemCollection, m_config, inheritanceGraph); // We now go and fix the queryDomain map so that it has all the // values from the S-side as well -- this is needed for domain // constraint propagation, i.e., values from the S-side get // propagated to te oneOfConst on the C-side. So we better get // the "possiblveValues" stuff to contain those constants as well MemberDomainMap.PropagateUpdateDomainToQueryDomain(cellGroup, m_queryDomainMap, m_updateDomainMap); UpdateWhereClauseForEachCell(cellGroup, m_queryDomainMap, m_updateDomainMap, m_config); // We need to simplify cell queries, yet we don't want the conditions to disappear // So, add an extra value to the domain, temporarily MemberDomainMap queryOpenDomain = m_queryDomainMap.GetOpenDomain(); MemberDomainMap updateOpenDomain = m_updateDomainMap.GetOpenDomain(); // Make sure the WHERE clauses of the cells reflect the changes foreach (Cell cell in cellGroup) { cell.CQuery.WhereClause.FixDomainMap(queryOpenDomain); cell.SQuery.WhereClause.FixDomainMap(updateOpenDomain); cell.CQuery.WhereClause.ExpensiveSimplify(); cell.SQuery.WhereClause.ExpensiveSimplify(); cell.CQuery.WhereClause.FixDomainMap(m_queryDomainMap); cell.SQuery.WhereClause.FixDomainMap(m_updateDomainMap); } }
private static bool DoesCellGroupContainEntitySet(CellGroup group, EntitySetBase entity) { foreach (Cell cell in group) { if (cell.GetLeftQuery(ViewTarget.QueryView).Extent.Equals(entity)) { return true; } } return false; }
private void DisplayMulticellActions() { if (null == m_multiCelledRoutingTable) { throw new ArgumentException("Unsupported routing table type"); } List<CellGroup> cellgroups = new List<CellGroup>(); List<IRoutingItemCollection> recipients = new List<IRoutingItemCollection>(); List<IRoutingItemCollection> senders = new List<IRoutingItemCollection>(); foreach (IRoutingItemCollection sender in m_multiCelledRoutingTable.Sources) { foreach (IRoutingItemCollection recipient in m_multiCelledRoutingTable.Destinations) { CellGroup cellgroup = new CellGroup(); cellgroup.Sender = sender; cellgroup.Recipient = recipient; cellgroup.Cell = m_multiCelledRoutingTable[sender.Identifier, recipient.Identifier]; cellgroups.Add(cellgroup); IActionMatrixCell cell = m_channel.Actions[sender, recipient]; if (null == cell) continue; foreach (IActionConditionGroup group in cell.ActionConditionGroups) { routingTable.AddAction(sender.Name.Value, recipient.Name.Value, group.ActionGroup.Name.Value, group.ActionGroup, group.ActionGroup.Actions.Count > 0 ? false : true); } } } //Let's sort!! cellgroups.Sort(ComparePrecedence); List<IRoutingItemCollection> addedList = new List<IRoutingItemCollection>(); foreach (CellGroup group in cellgroups) { if (!addedList.Contains(group.Sender)) { if (RoutingHelper.CanEditRoutingItemCollections(m_multiCelledRoutingTable, true)) { routingTable.AddSender(group.Sender.Name.Value, group.Sender, AddressCollectionHelper.IsDefaultAddressCollection(group.Sender)); } else { routingTable.AddSender(group.Sender.Name.Value, group.Sender, true); } addedList.Add(group.Sender); } if (!addedList.Contains(group.Recipient)) { if (RoutingHelper.CanEditRoutingItemCollections(m_multiCelledRoutingTable, false)) { routingTable.AddRecipient(group.Recipient.Name.Value, group.Recipient, AddressCollectionHelper.IsDefaultAddressCollection(group.Recipient)); } else { routingTable.AddRecipient(group.Recipient.Name.Value, group.Recipient, true); } addedList.Add(group.Recipient); } } routingTable.RefreshUI(); ResizeVerticalShiftControls(); ResizeHorizontalShiftControls(); }
// effects: Given a graph of cell groups, returns a list of cellgroup // such that each cellgroup contains all the cells that are in the // same connected component private static List<CellGroup> GenerateConnectedComponents(UndirectedGraph<Cell> graph) { KeyToListMap<int, Cell> groupMap = graph.GenerateConnectedComponents(); // Run through the list of groups and generate the merged groups List<CellGroup> result = new List<CellGroup>(); foreach (int setNum in groupMap.Keys) { ReadOnlyCollection<Cell> cellsInComponent = groupMap.ListForKey(setNum); CellGroup component = new CellGroup(cellsInComponent); result.Add(component); } return result; }
private static int ComparePrecedence(CellGroup group1, CellGroup group2) { if (null == group1.Cell && null == group2.Cell) return 0; if (null == group2.Cell) return -1; if (null == group1.Cell) return 1; return (group2.Cell.Precedence - group1.Cell.Precedence); }