static OrderedHashSetPerformanceTest() { m_warmHashSet.Clear(); m_warmOrderedSet.Clear(); new OrderedHashSetPerformanceTest().TestAddHashSet(); new OrderedHashSetPerformanceTest().TestAddOrderedHashSet(); }
public void SetDatabseObjects(Session session, ParserDQL.CompileContext compileContext) { this.Parameters = compileContext.GetParameters(); this.SetParameters(); this.SetParameterMetaData(); this.Subqueries = this.GetSubqueries(session); this.RangeIteratorCount = compileContext.GetRangeVarCount(); this.RangeVariables = compileContext.GetRangeVariables(); this.Sequences = compileContext.GetSequences(); this.Routines = compileContext.GetRoutines(); OrderedHashSet <QNameManager.QName> set = new OrderedHashSet <QNameManager.QName>(); this.CollectTableNamesForWrite(set); if (set.Size() > 0) { base.WriteTableNames = new QNameManager.QName[set.Size()]; set.ToArray(base.WriteTableNames); set.Clear(); } this.CollectTableNamesForRead(set); set.RemoveAll(base.WriteTableNames); if (set.Size() > 0) { base.ReadTableNames = new QNameManager.QName[set.Size()]; set.ToArray(base.ReadTableNames); } base.References = compileContext.GetSchemaObjectNames(); if (this.TargetTable != null) { base.References.Add(this.TargetTable.GetName()); } }
private static void SetColumns(Table t, OrderedHashSet <string> set) { int num = 0; bool[] newColumnCheckList = t.GetNewColumnCheckList(); for (int i = 0; i < set.Size(); i++) { string name = set.Get(i); int index = t.FindColumn(name); if (index == -1) { throw Error.GetError(0x157d, name); } newColumnCheckList[index] = true; num++; } if (num == 0) { throw Error.GetError(0x157d); } set.Clear(); for (int j = 0; j < newColumnCheckList.Length; j++) { if (newColumnCheckList[j]) { set.Add(t.GetColumn(j).GetName().Name); } } }
public void ListHashSetTest() { OrderedHashSet <string> set = new OrderedHashSet <string>(); Assert.AreEqual(set.Count(), 0); CollectionAssert.AreEqual(new string[] { }, set.ToArray()); Assert.IsFalse(set.Contains("a")); Assert.IsFalse(set.Contains("b")); set.Add("b"); Assert.AreEqual(set.Count(), 1); Assert.IsFalse(set.Contains("a")); Assert.IsTrue(set.Contains("b")); CollectionAssert.AreEqual(new string[] { "b" }, set.ToArray()); set.Add("a"); Assert.AreEqual(set.Count(), 2); Assert.IsTrue(set.Contains("a")); Assert.IsTrue(set.Contains("b")); CollectionAssert.AreEqual(new string[] { "b", "a" }, set.ToArray()); set.Add("b"); Assert.AreEqual(set.Count(), 2); Assert.IsTrue(set.Contains("a")); Assert.IsTrue(set.Contains("b")); CollectionAssert.AreEqual(new string[] { "b", "a" }, set.ToArray()); Assert.AreEqual(set[0], "b"); Assert.AreEqual(set[1], "a"); set.Remove("b"); CollectionAssert.AreEqual(new string[] { "a" }, set.ToArray()); Assert.IsTrue(set.Contains("a")); Assert.IsFalse(set.Contains("b")); set.Clear(); CollectionAssert.AreEqual(new string[] {}, set.ToArray()); Assert.IsFalse(set.Contains("a")); Assert.IsFalse(set.Contains("b")); }
private static void DropDomain(Session session, QNameManager.QName name, bool cascade) { SqlType schemaObject = (SqlType)session.database.schemaManager.GetSchemaObject(name); OrderedHashSet <QNameManager.QName> referencingObjectNames = session.database.schemaManager.GetReferencingObjectNames(schemaObject.GetName()); if (!cascade && (referencingObjectNames.Size() > 0)) { QNameManager.QName name2 = referencingObjectNames.Get(0); throw Error.GetError(0x157e, name2.GetSchemaQualifiedStatementName()); } Constraint[] constraints = schemaObject.userTypeModifier.GetConstraints(); referencingObjectNames.Clear(); for (int i = 0; i < constraints.Length; i++) { referencingObjectNames.Add(constraints[i].GetName()); } session.database.schemaManager.RemoveSchemaObjects(referencingObjectNames); session.database.schemaManager.RemoveSchemaObject(schemaObject.GetName(), cascade); schemaObject.userTypeModifier = null; }
public void PoolHashSet(OrderedHashSet <Vector3> dedHashSet) { dedHashSet.Clear(); poolingHashSets.Add(dedHashSet); }
public void DropColumn(int colIndex, bool cascade) { OrderedHashSet <QNameManager.QName> dropConstraintSet = new OrderedHashSet <QNameManager.QName>(); OrderedHashSet <Constraint> dependentConstraints = this._table.GetDependentConstraints(colIndex); OrderedHashSet <Constraint> containingConstraints = this._table.GetContainingConstraints(colIndex); OrderedHashSet <QNameManager.QName> containingIndexNames = this._table.GetContainingIndexNames(colIndex); ColumnSchema column = this._table.GetColumn(colIndex); QNameManager.QName name = column.GetName(); OrderedHashSet <QNameManager.QName> referencingObjectNames = this._database.schemaManager.GetReferencingObjectNames(this._table.GetName(), name); this.CheckModifyTable(); if (!cascade) { if (!containingConstraints.IsEmpty()) { QNameManager.QName name2 = containingConstraints.Get(0).GetName(); throw Error.GetError(0x15a0, name2.GetSchemaQualifiedStatementName()); } if (!referencingObjectNames.IsEmpty()) { for (int j = 0; j < referencingObjectNames.Size(); j++) { QNameManager.QName name3 = referencingObjectNames.Get(j); if (name3 != name) { for (int k = 0; k < dependentConstraints.Size(); k++) { if (dependentConstraints.Get(k).GetName() == name3) { continue; } } throw Error.GetError(0x15a0, name3.GetSchemaQualifiedStatementName()); } } } } dependentConstraints.AddAll(containingConstraints); containingConstraints.Clear(); OrderedHashSet <Table> tableSet = new OrderedHashSet <Table>(); for (int i = 0; i < dependentConstraints.Size(); i++) { Constraint constraint = dependentConstraints.Get(i); if (constraint.ConstType == 0) { tableSet.Add(constraint.GetMain()); dropConstraintSet.Add(constraint.GetMainName()); dropConstraintSet.Add(constraint.GetRefName()); containingIndexNames.Add(constraint.GetRefIndex().GetName()); } if (constraint.ConstType == 1) { tableSet.Add(constraint.GetRef()); dropConstraintSet.Add(constraint.GetMainName()); dropConstraintSet.Add(constraint.GetRefName()); containingIndexNames.Add(constraint.GetRefIndex().GetName()); } dropConstraintSet.Add(constraint.GetName()); } tableSet = this.MakeNewTables(tableSet, dropConstraintSet, containingIndexNames); Table newTable = this._table.MoveDefinition(this._session, this._table.TableType, null, null, null, colIndex, -1, dropConstraintSet, containingIndexNames); this.MoveData(this._table, newTable, colIndex, -1); this._database.schemaManager.RemoveSchemaObjects(referencingObjectNames); this._database.schemaManager.RemoveSchemaObjects(dropConstraintSet); this._database.schemaManager.RemoveSchemaObject(name); this.SetNewTableInSchema(newTable); this.SetNewTablesInSchema(tableSet); this.UpdateConstraints(newTable, this.EmptySetQName); this.UpdateConstraints(tableSet, dropConstraintSet); this._database.schemaManager.RecompileDependentObjects(tableSet); this._database.schemaManager.RecompileDependentObjects(newTable); newTable.Compile(this._session, null); if (column.GetDataType().IsLobType()) { IRowIterator rowIterator = this._table.GetRowIterator(this._session); while (rowIterator.HasNext()) { object[] rowData = rowIterator.GetNextRow().RowData; if (rowData[colIndex] != null) { this._session.sessionData.AdjustLobUsageCount(rowData[colIndex], -1); } } } this._table = newTable; }
public void ListHashSetTest() { OrderedHashSet<string> set = new OrderedHashSet<string>(); Assert.AreEqual(set.Count(), 0); CollectionAssert.AreEqual(new string[] { }, set.ToArray()); Assert.IsFalse(set.Contains("a")); Assert.IsFalse(set.Contains("b")); set.Add("b"); Assert.AreEqual(set.Count(), 1); Assert.IsFalse(set.Contains("a")); Assert.IsTrue(set.Contains("b")); CollectionAssert.AreEqual(new string[] { "b" }, set.ToArray()); set.Add("a"); Assert.AreEqual(set.Count(), 2); Assert.IsTrue(set.Contains("a")); Assert.IsTrue(set.Contains("b")); CollectionAssert.AreEqual(new string[] { "b", "a" }, set.ToArray()); set.Add("b"); Assert.AreEqual(set.Count(), 2); Assert.IsTrue(set.Contains("a")); Assert.IsTrue(set.Contains("b")); CollectionAssert.AreEqual(new string[] { "b", "a" }, set.ToArray()); Assert.AreEqual(set[0], "b"); Assert.AreEqual(set[1], "a"); set.Remove("b"); CollectionAssert.AreEqual(new string[] { "a" }, set.ToArray()); Assert.IsTrue(set.Contains("a")); Assert.IsFalse(set.Contains("b")); set.Clear(); CollectionAssert.AreEqual(new string[] {}, set.ToArray()); Assert.IsFalse(set.Contains("a")); Assert.IsFalse(set.Contains("b")); }
internal static void SetupForNewGame(IEnumerable <Action> initialExplorations) { allTriggers.Clear(); allTriggers.UnionWith(initialExplorations.Select(x => new OneOffTrigger(x))); allTriggers.UnionWith(areaUnlocks); }