| | 1 | | // Copyright (c) 2020-2024 dotBunny Inc. |
| | 2 | | // dotBunny licenses this file to you under the BSL-1.0 license. |
| | 3 | | // See the LICENSE file in the project root for more information. |
| | 4 | |
|
| | 5 | | using System; |
| | 6 | | using GDX.Collections; |
| | 7 | | using UnityEngine; |
| | 8 | | using Object = UnityEngine.Object; |
| | 9 | |
|
| | 10 | | namespace GDX.DataTables |
| | 11 | | { |
| | 12 | | [HelpURL("https://gdx-dev.dotbunny.com/manual/features/data-tables.html")] |
| | 13 | | [CreateAssetMenu(menuName = "GDX/Stable Data Table", fileName = "GDXStableDataTable")] |
| | 14 | | [Serializable] |
| | 15 | | public class StableDataTable : DataTableBase |
| | 16 | | { |
| | 17 | | #pragma warning disable IDE1006 |
| | 18 | | // ReSharper disable InconsistentNaming |
| | 19 | |
|
| | 20 | | [SerializeField] internal ArrayHolder<string>[] m_AllStringColumns; |
| | 21 | | [SerializeField] internal ArrayHolder<bool>[] m_AllBoolColumns; |
| | 22 | | [SerializeField] internal ArrayHolder<char>[] m_AllCharColumns; |
| | 23 | | [SerializeField] internal ArrayHolder<sbyte>[] m_AllSByteColumns; |
| | 24 | | [SerializeField] internal ArrayHolder<byte>[] m_AllByteColumns; |
| | 25 | | [SerializeField] internal ArrayHolder<short>[] m_AllShortColumns; |
| | 26 | | [SerializeField] internal ArrayHolder<ushort>[] m_AllUShortColumns; |
| | 27 | | [SerializeField] internal ArrayHolder<int>[] m_AllIntColumns; |
| | 28 | | [SerializeField] internal ArrayHolder<uint>[] m_AllUIntColumns; |
| | 29 | | [SerializeField] internal ArrayHolder<long>[] m_AllLongColumns; |
| | 30 | | [SerializeField] internal ArrayHolder<ulong>[] m_AllULongColumns; |
| | 31 | | [SerializeField] internal ArrayHolder<float>[] m_AllFloatColumns; |
| | 32 | | [SerializeField] internal ArrayHolder<double>[] m_AllDoubleColumns; |
| | 33 | | [SerializeField] internal ArrayHolder<Vector2>[] m_AllVector2Columns; |
| | 34 | | [SerializeField] internal ArrayHolder<Vector3>[] m_AllVector3Columns; |
| | 35 | | [SerializeField] internal ArrayHolder<Vector4>[] m_AllVector4Columns; |
| | 36 | | [SerializeField] internal ArrayHolder<Vector2Int>[] m_AllVector2IntColumns; |
| | 37 | | [SerializeField] internal ArrayHolder<Vector3Int>[] m_AllVector3IntColumns; |
| | 38 | | [SerializeField] internal ArrayHolder<Quaternion>[] m_AllQuaternionColumns; |
| | 39 | | [SerializeField] internal ArrayHolder<Rect>[] m_AllRectColumns; |
| | 40 | | [SerializeField] internal ArrayHolder<RectInt>[] m_AllRectIntColumns; |
| | 41 | | [SerializeField] internal ArrayHolder<Color>[] m_AllColorColumns; |
| | 42 | | [SerializeField] internal ArrayHolder<LayerMask>[] m_AllLayerMaskColumns; |
| | 43 | | [SerializeField] internal ArrayHolder<Bounds>[] m_AllBoundsColumns; |
| | 44 | | [SerializeField] internal ArrayHolder<BoundsInt>[] m_AllBoundsIntColumns; |
| | 45 | | [SerializeField] internal ArrayHolder<Hash128>[] m_AllHash128Columns; |
| | 46 | | [SerializeField] internal ArrayHolder<Gradient>[] m_AllGradientColumns; |
| | 47 | | [SerializeField] internal ArrayHolder<AnimationCurve>[] m_AllAnimationCurveColumns; |
| | 48 | | [SerializeField] internal ArrayHolder<Object>[] m_AllObjectRefColumns; |
| | 49 | | [SerializeField] internal ArrayHolder<int>[] m_AllEnumIntColumns; |
| | 50 | | [SerializeField] internal string[] m_AllObjectRefTypeNames; |
| | 51 | | [SerializeField] internal string[] m_AllEnumIntTypeNames; |
| | 52 | |
|
| | 53 | | /// <summary> |
| | 54 | | /// Contains the name of each column of each type. Ordered by Serializable.SerializableTypes |
| | 55 | | /// </summary> |
| | 56 | | [SerializeField] |
| 10 | 57 | | internal ArrayHolder<string>[] m_AllColumnNames = new ArrayHolder<string>[Serializable.SerializableTypesCount]; |
| | 58 | |
|
| | 59 | | [SerializeField] internal int[] m_RowIdentifierToDenseIndexMap; |
| | 60 | | [SerializeField] internal int[] m_RowDenseIndexToIDMap; |
| | 61 | | [SerializeField] internal string[] m_RowNames; |
| | 62 | | [SerializeField] internal int m_RowEntriesFreeListHead; |
| | 63 | | [SerializeField] internal int m_RowCount; |
| | 64 | | [SerializeField] internal ColumnEntry[] m_ColumnIdentifierToDenseIndexMap; |
| | 65 | | [SerializeField] internal int[] m_ColumnIdentifierToSortOrderMap; |
| | 66 | | [SerializeField] internal int[] m_SortedOrderToColumnIdentifierMap; |
| | 67 | |
|
| 10 | 68 | | [SerializeField] internal ArrayHolder<int>[] m_ColumnDenseIndexToIDMap = |
| | 69 | | new ArrayHolder<int>[Serializable.SerializableTypesCount]; |
| | 70 | |
|
| | 71 | | [SerializeField] internal int m_ColumnEntriesFreeListHead; |
| | 72 | | [SerializeField] internal int m_CombinedColumnCount; |
| 10 | 73 | | [SerializeField] internal ulong m_DataVersion = 1; |
| | 74 | |
|
| | 75 | | // ReSharper enable InconsistentNaming |
| | 76 | | #pragma warning restore IDE1006 |
| | 77 | |
|
| | 78 | |
|
| | 79 | | /// <summary> |
| | 80 | | /// Version of internal structure format. |
| | 81 | | /// </summary> |
| | 82 | | /// <remarks>Bump this if you make a change that requires resizing of arrays.</remarks> |
| 10 | 83 | | [SerializeField] internal int m_StructureVersion = 1; |
| | 84 | |
|
| | 85 | | /// <inheritdoc /> |
| | 86 | | public override ulong GetDataVersion() |
| 0 | 87 | | { |
| 0 | 88 | | return m_DataVersion; |
| 0 | 89 | | } |
| | 90 | |
|
| | 91 | | /// <inheritdoc /> |
| | 92 | | public override int GetStructureVersion() |
| 0 | 93 | | { |
| 0 | 94 | | return m_StructureVersion; |
| 0 | 95 | | } |
| | 96 | |
|
| | 97 | | /// <inheritdoc /> |
| | 98 | | public override int GetStructureCurrentVersion() |
| 0 | 99 | | { |
| 0 | 100 | | return 1; |
| 0 | 101 | | } |
| | 102 | |
|
| | 103 | | public override bool Migrate(int currentVersion) |
| 0 | 104 | | { |
| 0 | 105 | | switch (m_StructureVersion) |
| | 106 | | { |
| | 107 | | case 0: |
| | 108 | | // Pre EnumInt |
| 0 | 109 | | if (currentVersion >= 0) |
| 0 | 110 | | { |
| 0 | 111 | | Array.Resize(ref m_AllColumnNames, 30); |
| 0 | 112 | | Array.Resize(ref m_ColumnDenseIndexToIDMap, 30); |
| 0 | 113 | | } |
| | 114 | |
|
| 0 | 115 | | m_StructureVersion = currentVersion; |
| 0 | 116 | | break; |
| | 117 | | } |
| | 118 | |
|
| 0 | 119 | | return m_StructureVersion == currentVersion; |
| 0 | 120 | | } |
| | 121 | |
|
| | 122 | | /// <inheritdoc /> |
| | 123 | | public override int GetColumnCount() |
| 52 | 124 | | { |
| 52 | 125 | | return m_CombinedColumnCount; |
| 52 | 126 | | } |
| | 127 | |
|
| | 128 | | /// <inheritdoc /> |
| | 129 | | public override int GetRowCount() |
| 36 | 130 | | { |
| 36 | 131 | | return m_RowCount; |
| 36 | 132 | | } |
| | 133 | |
|
| | 134 | | /// <inheritdoc /> |
| | 135 | | public override RowDescription[] GetAllRowDescriptions() |
| 17 | 136 | | { |
| 17 | 137 | | if (m_CombinedColumnCount == 0 || m_RowCount == 0) |
| 1 | 138 | | { |
| 1 | 139 | | return null; |
| | 140 | | } |
| | 141 | |
|
| 16 | 142 | | RowDescription[] returnArray = new RowDescription[m_RowCount]; |
| 128 | 143 | | for (int i = 0; i < m_RowCount; i++) |
| 48 | 144 | | { |
| 48 | 145 | | returnArray[i].Identifier = m_RowDenseIndexToIDMap[i]; |
| 48 | 146 | | returnArray[i].Name = m_RowNames[i]; |
| 48 | 147 | | returnArray[i].SortOrder = i; |
| 48 | 148 | | } |
| | 149 | |
|
| 16 | 150 | | return returnArray; |
| 17 | 151 | | } |
| | 152 | |
|
| | 153 | | /// <inheritdoc /> |
| | 154 | | public override RowDescription GetRowDescription(int rowIdentifier) |
| 0 | 155 | | { |
| 0 | 156 | | RowDescription returnRowDescription = new RowDescription(); |
| | 157 | |
|
| 0 | 158 | | int rowDenseIndex = m_RowIdentifierToDenseIndexMap[rowIdentifier]; |
| | 159 | |
|
| 0 | 160 | | returnRowDescription.Identifier = rowIdentifier; |
| 0 | 161 | | returnRowDescription.Name = m_RowNames[rowDenseIndex]; |
| 0 | 162 | | returnRowDescription.SortOrder = rowDenseIndex; |
| | 163 | |
|
| 0 | 164 | | return returnRowDescription; |
| 0 | 165 | | } |
| | 166 | |
|
| | 167 | | /// <inheritdoc /> |
| | 168 | | public override RowDescription GetRowDescriptionByOrder(int order) |
| 1 | 169 | | { |
| 1 | 170 | | return new RowDescription |
| | 171 | | { |
| | 172 | | Identifier = m_RowDenseIndexToIDMap[order], Name = m_RowNames[order], SortOrder = order |
| | 173 | | }; |
| 1 | 174 | | } |
| | 175 | |
|
| | 176 | | /// <inheritdoc /> |
| | 177 | | public override ColumnDescription GetColumnDescription(int columnIdentifier) |
| 0 | 178 | | { |
| 0 | 179 | | ColumnDescription returnColumnDescription = new ColumnDescription(); |
| | 180 | |
|
| 0 | 181 | | ref ColumnEntry columnEntry = ref m_ColumnIdentifierToDenseIndexMap[columnIdentifier]; |
| | 182 | |
|
| 0 | 183 | | returnColumnDescription.Identifier = columnIdentifier; |
| 0 | 184 | | returnColumnDescription.Name = m_AllColumnNames[(int)columnEntry.ColumnType][columnEntry.ColumnDenseIndex]; |
| 0 | 185 | | returnColumnDescription.SortOrder = m_ColumnIdentifierToSortOrderMap[columnIdentifier]; |
| | 186 | |
|
| 0 | 187 | | return returnColumnDescription; |
| 0 | 188 | | } |
| | 189 | |
|
| | 190 | | /// <inheritdoc /> |
| | 191 | | public override ColumnDescription GetColumnDescriptionByOrder(int order) |
| 4 | 192 | | { |
| 4 | 193 | | int idAtOrderedIndex = m_SortedOrderToColumnIdentifierMap[order]; |
| 4 | 194 | | ref ColumnEntry columnEntry = ref m_ColumnIdentifierToDenseIndexMap[idAtOrderedIndex]; |
| | 195 | |
|
| 4 | 196 | | string columnName = m_AllColumnNames[(int)columnEntry.ColumnType][columnEntry.ColumnDenseIndex]; |
| | 197 | |
|
| 4 | 198 | | return new ColumnDescription |
| | 199 | | { |
| | 200 | | Identifier = idAtOrderedIndex, Name = columnName, Type = columnEntry.ColumnType, SortOrder = order |
| | 201 | | }; |
| 4 | 202 | | } |
| | 203 | |
|
| | 204 | | /// <inheritdoc /> |
| | 205 | | public override ColumnDescription[] GetAllColumnDescriptions() |
| 29 | 206 | | { |
| 29 | 207 | | if (m_CombinedColumnCount == 0) |
| 1 | 208 | | { |
| 1 | 209 | | return null; |
| | 210 | | } |
| | 211 | |
|
| 28 | 212 | | ColumnDescription[] returnArray = new ColumnDescription[m_CombinedColumnCount]; |
| | 213 | |
|
| 298 | 214 | | for (int i = 0; i < m_CombinedColumnCount; i++) |
| 121 | 215 | | { |
| 121 | 216 | | int columnID = m_SortedOrderToColumnIdentifierMap[i]; |
| 121 | 217 | | AssertColumnIdentifierValid(columnID); |
| 121 | 218 | | ref ColumnEntry entryForID = ref m_ColumnIdentifierToDenseIndexMap[columnID]; |
| 121 | 219 | | ref ArrayHolder<string> nameColumnsForType = ref m_AllColumnNames[(int)entryForID.ColumnType]; |
| | 220 | |
|
| 121 | 221 | | string name = nameColumnsForType[entryForID.ColumnDenseIndex]; |
| | 222 | |
|
| 121 | 223 | | returnArray[i] = new ColumnDescription |
| | 224 | | { |
| | 225 | | Name = name, Identifier = columnID, Type = entryForID.ColumnType, SortOrder = i |
| | 226 | | }; |
| 121 | 227 | | } |
| | 228 | |
|
| 28 | 229 | | return returnArray; |
| 29 | 230 | | } |
| | 231 | |
|
| | 232 | | internal void AssertColumnIdentifierValid(int columnID) |
| 1145 | 233 | | { |
| 1145 | 234 | | if (columnID < 0 || columnID >= m_ColumnIdentifierToDenseIndexMap.Length) |
| 0 | 235 | | { |
| 0 | 236 | | throw new ArgumentException("Invalid column outside valid ID range: " + columnID); |
| | 237 | | } |
| | 238 | |
|
| 1145 | 239 | | ref ColumnEntry columnEntry = ref m_ColumnIdentifierToDenseIndexMap[columnID]; |
| | 240 | |
|
| 1145 | 241 | | if (columnEntry.ColumnType == Serializable.SerializableTypes.Invalid) |
| 0 | 242 | | { |
| 0 | 243 | | throw new ArgumentException("Invalid column pointing to deallocated entry: " + columnID); |
| | 244 | | } |
| 1145 | 245 | | } |
| | 246 | |
|
| | 247 | | internal void AssertRowIdentifierValid(int rowID) |
| 921 | 248 | | { |
| 921 | 249 | | if (rowID < 0 || rowID >= m_RowIdentifierToDenseIndexMap.Length) |
| 0 | 250 | | { |
| 0 | 251 | | throw new ArgumentException("Invalid row outside valid ID range: " + rowID); |
| | 252 | | } |
| | 253 | |
|
| 921 | 254 | | int rowIndex = m_RowIdentifierToDenseIndexMap[rowID]; |
| | 255 | |
|
| 921 | 256 | | if (rowIndex >= m_RowCount || rowIndex < 0) |
| 0 | 257 | | { |
| 0 | 258 | | throw new ArgumentException("Invalid row outside valid ID range: " + rowID); |
| | 259 | | } |
| 921 | 260 | | } |
| | 261 | |
|
| | 262 | | /// <inheritdoc /> |
| | 263 | | public override void SetColumnName(int columnIdentifier, string columnName) |
| 30 | 264 | | { |
| 30 | 265 | | AssertColumnIdentifierValid(columnIdentifier); |
| 30 | 266 | | ref ColumnEntry columnEntry = ref m_ColumnIdentifierToDenseIndexMap[columnIdentifier]; |
| 30 | 267 | | m_AllColumnNames[(int)columnEntry.ColumnType][columnEntry.ColumnDenseIndex] = columnName; |
| 30 | 268 | | } |
| | 269 | |
|
| | 270 | | /// <inheritdoc /> |
| | 271 | | public override string GetColumnName(int columnIdentifier) |
| 60 | 272 | | { |
| 60 | 273 | | AssertColumnIdentifierValid(columnIdentifier); |
| 60 | 274 | | ref ColumnEntry columnEntry = ref m_ColumnIdentifierToDenseIndexMap[columnIdentifier]; |
| 60 | 275 | | return m_AllColumnNames[(int)columnEntry.ColumnType][columnEntry.ColumnDenseIndex]; |
| 60 | 276 | | } |
| | 277 | |
|
| | 278 | |
|
| | 279 | | /// <inheritdoc /> |
| | 280 | | public override void SetRowName(int rowIdentifier, string rowName) |
| 10 | 281 | | { |
| 10 | 282 | | AssertRowIdentifierValid(rowIdentifier); |
| 10 | 283 | | int rowDenseIndex = m_RowIdentifierToDenseIndexMap[rowIdentifier]; |
| 10 | 284 | | m_RowNames[rowDenseIndex] = rowName; |
| 10 | 285 | | } |
| | 286 | |
|
| | 287 | | /// <inheritdoc /> |
| | 288 | | public override string GetRowName(int rowIdentifier) |
| 21 | 289 | | { |
| 21 | 290 | | AssertRowIdentifierValid(rowIdentifier); |
| 21 | 291 | | int rowDenseIndex = m_RowIdentifierToDenseIndexMap[rowIdentifier]; |
| 21 | 292 | | return m_RowNames[rowDenseIndex]; |
| 21 | 293 | | } |
| | 294 | |
|
| | 295 | | public ref string GetRowNameRef(int rowIdentifier) |
| 20 | 296 | | { |
| 20 | 297 | | AssertRowIdentifierValid(rowIdentifier); |
| 20 | 298 | | int rowDenseIndex = m_RowIdentifierToDenseIndexMap[rowIdentifier]; |
| 20 | 299 | | return ref m_RowNames[rowDenseIndex]; |
| 20 | 300 | | } |
| | 301 | |
|
| | 302 | | public ref string GetColumnNameRef(int columnIdentifier) |
| 60 | 303 | | { |
| 60 | 304 | | AssertColumnIdentifierValid(columnIdentifier); |
| 60 | 305 | | ref ColumnEntry columnEntry = ref m_ColumnIdentifierToDenseIndexMap[columnIdentifier]; |
| 60 | 306 | | return ref m_AllColumnNames[(int)columnEntry.ColumnType][columnEntry.ColumnDenseIndex]; |
| 60 | 307 | | } |
| | 308 | |
|
| | 309 | | /// <inheritdoc /> |
| | 310 | | public override int AddRow(string rowName = null, int insertAtRowIdentifier = -1) |
| 56 | 311 | | { |
| 56 | 312 | | if (insertAtRowIdentifier >= 0) |
| 0 | 313 | | { |
| 0 | 314 | | AssertRowIdentifierValid(insertAtRowIdentifier); |
| 0 | 315 | | } |
| | 316 | |
|
| 56 | 317 | | int rowID = m_RowEntriesFreeListHead; |
| 56 | 318 | | int rowIDToDenseIndexMapLength = m_RowIdentifierToDenseIndexMap?.Length ?? 0; |
| 56 | 319 | | if (rowID >= rowIDToDenseIndexMapLength) |
| 21 | 320 | | { |
| 21 | 321 | | int newSize = rowID * 2; |
| 21 | 322 | | newSize = newSize == 0 ? 1 : newSize; |
| 21 | 323 | | Array.Resize(ref m_RowIdentifierToDenseIndexMap, newSize); |
| 188 | 324 | | for (int i = rowID; i < newSize; i++) |
| 73 | 325 | | { |
| 73 | 326 | | m_RowIdentifierToDenseIndexMap[i] = i + 1; |
| 73 | 327 | | } |
| 21 | 328 | | } |
| | 329 | |
|
| 56 | 330 | | int denseIndexToIDMapLength = m_RowDenseIndexToIDMap?.Length ?? 0; |
| 56 | 331 | | Array.Resize(ref m_RowDenseIndexToIDMap, denseIndexToIDMapLength + 1); |
| 56 | 332 | | Array.Resize(ref m_RowNames, denseIndexToIDMapLength + 1); |
| | 333 | |
|
| 56 | 334 | | int insertAt = insertAtRowIdentifier < 0 |
| | 335 | | ? m_RowCount |
| | 336 | | : m_RowIdentifierToDenseIndexMap[insertAtRowIdentifier]; |
| | 337 | |
|
| 112 | 338 | | for (int i = denseIndexToIDMapLength; i > insertAt; i--) |
| 0 | 339 | | { |
| 0 | 340 | | int currentRowID = m_RowDenseIndexToIDMap[i - 1]; |
| 0 | 341 | | m_RowDenseIndexToIDMap[i] = currentRowID; |
| | 342 | |
|
| 0 | 343 | | m_RowIdentifierToDenseIndexMap[currentRowID] = i; |
| | 344 | |
|
| 0 | 345 | | m_RowNames[i] = m_RowNames[i - 1]; |
| 0 | 346 | | } |
| | 347 | |
|
| 56 | 348 | | m_RowEntriesFreeListHead = m_RowIdentifierToDenseIndexMap[rowID]; |
| 56 | 349 | | m_RowIdentifierToDenseIndexMap[rowID] = insertAt; |
| 56 | 350 | | m_RowDenseIndexToIDMap[insertAt] = rowID; |
| 56 | 351 | | m_RowNames[insertAt] = rowName == null ? rowID.ToString() : rowName; |
| | 352 | |
|
| 56 | 353 | | InsertRowsOfTypeInternal(ref m_AllStringColumns, insertAt, 1); |
| 56 | 354 | | InsertRowsOfTypeInternal(ref m_AllBoolColumns, insertAt, 1); |
| 56 | 355 | | InsertRowsOfTypeInternal(ref m_AllCharColumns, insertAt, 1); |
| 56 | 356 | | InsertRowsOfTypeInternal(ref m_AllSByteColumns, insertAt, 1); |
| 56 | 357 | | InsertRowsOfTypeInternal(ref m_AllByteColumns, insertAt, 1); |
| 56 | 358 | | InsertRowsOfTypeInternal(ref m_AllShortColumns, insertAt, 1); |
| 56 | 359 | | InsertRowsOfTypeInternal(ref m_AllUShortColumns, insertAt, 1); |
| 56 | 360 | | InsertRowsOfTypeInternal(ref m_AllIntColumns, insertAt, 1); |
| 56 | 361 | | InsertRowsOfTypeInternal(ref m_AllUIntColumns, insertAt, 1); |
| 56 | 362 | | InsertRowsOfTypeInternal(ref m_AllLongColumns, insertAt, 1); |
| 56 | 363 | | InsertRowsOfTypeInternal(ref m_AllULongColumns, insertAt, 1); |
| 56 | 364 | | InsertRowsOfTypeInternal(ref m_AllFloatColumns, insertAt, 1); |
| 56 | 365 | | InsertRowsOfTypeInternal(ref m_AllDoubleColumns, insertAt, 1); |
| 56 | 366 | | InsertRowsOfTypeInternal(ref m_AllVector2Columns, insertAt, 1); |
| 56 | 367 | | InsertRowsOfTypeInternal(ref m_AllVector3Columns, insertAt, 1); |
| 56 | 368 | | InsertRowsOfTypeInternal(ref m_AllVector4Columns, insertAt, 1); |
| 56 | 369 | | InsertRowsOfTypeInternal(ref m_AllVector2IntColumns, insertAt, 1); |
| 56 | 370 | | InsertRowsOfTypeInternal(ref m_AllVector3IntColumns, insertAt, 1); |
| 56 | 371 | | InsertRowsOfTypeInternal(ref m_AllQuaternionColumns, insertAt, 1); |
| 56 | 372 | | InsertRowsOfTypeInternal(ref m_AllRectColumns, insertAt, 1); |
| 56 | 373 | | InsertRowsOfTypeInternal(ref m_AllRectIntColumns, insertAt, 1); |
| 56 | 374 | | InsertRowsOfTypeInternal(ref m_AllColorColumns, insertAt, 1); |
| 56 | 375 | | InsertRowsOfTypeInternal(ref m_AllLayerMaskColumns, insertAt, 1); |
| 56 | 376 | | InsertRowsOfTypeInternal(ref m_AllBoundsColumns, insertAt, 1); |
| 56 | 377 | | InsertRowsOfTypeInternal(ref m_AllBoundsIntColumns, insertAt, 1); |
| 56 | 378 | | InsertRowsOfTypeInternal(ref m_AllHash128Columns, insertAt, 1); |
| 56 | 379 | | InsertRowsOfTypeInternal(ref m_AllGradientColumns, insertAt, 1); |
| 56 | 380 | | InsertRowsOfTypeInternal(ref m_AllAnimationCurveColumns, insertAt, 1); |
| 56 | 381 | | InsertRowsOfTypeInternal(ref m_AllObjectRefColumns, insertAt, 1); |
| 56 | 382 | | InsertRowsOfTypeInternal(ref m_AllEnumIntColumns, insertAt, 1); |
| | 383 | |
|
| 56 | 384 | | ++m_RowCount; |
| 56 | 385 | | m_DataVersion++; |
| | 386 | |
|
| 56 | 387 | | return rowID; |
| 56 | 388 | | } |
| | 389 | |
|
| | 390 | | public void AddRows(int numberOfNewRows, string[] rowNames = null, int insertAtRowID = -1) |
| 0 | 391 | | { |
| 0 | 392 | | if (insertAtRowID >= 0) |
| 0 | 393 | | { |
| 0 | 394 | | AssertRowIdentifierValid(insertAtRowID); |
| 0 | 395 | | } |
| | 396 | |
|
| 0 | 397 | | int rowIDToDenseIndexMapLength = m_RowIdentifierToDenseIndexMap?.Length ?? 0; |
| 0 | 398 | | int newCount = m_RowCount + numberOfNewRows; |
| 0 | 399 | | if (newCount > rowIDToDenseIndexMapLength) |
| 0 | 400 | | { |
| 0 | 401 | | int newSize = newCount; |
| 0 | 402 | | --newSize; |
| 0 | 403 | | newSize |= newSize >> 1; |
| 0 | 404 | | newSize |= newSize >> 2; |
| 0 | 405 | | newSize |= newSize >> 4; |
| 0 | 406 | | newSize |= newSize >> 8; |
| 0 | 407 | | newSize |= newSize >> 16; |
| 0 | 408 | | ++newSize; |
| | 409 | |
|
| 0 | 410 | | newSize = newSize == 0 ? 1 : newSize; |
| 0 | 411 | | Array.Resize(ref m_RowIdentifierToDenseIndexMap, newSize); |
| 0 | 412 | | for (int i = rowIDToDenseIndexMapLength; i < newSize; i++) |
| 0 | 413 | | { |
| 0 | 414 | | m_RowIdentifierToDenseIndexMap[i] = i + 1; |
| 0 | 415 | | } |
| 0 | 416 | | } |
| | 417 | |
|
| 0 | 418 | | int denseIndexToIDMapLength = m_RowDenseIndexToIDMap?.Length ?? 0; |
| 0 | 419 | | Array.Resize(ref m_RowDenseIndexToIDMap, denseIndexToIDMapLength + numberOfNewRows); |
| 0 | 420 | | Array.Resize(ref rowNames, denseIndexToIDMapLength + numberOfNewRows); |
| | 421 | |
|
| 0 | 422 | | int insertAt = insertAtRowID < 0 ? m_RowCount : m_RowIdentifierToDenseIndexMap[insertAtRowID]; |
| | 423 | |
|
| 0 | 424 | | for (int i = denseIndexToIDMapLength; i > insertAt + numberOfNewRows - 1; i--) |
| 0 | 425 | | { |
| 0 | 426 | | int currentRowID = m_RowDenseIndexToIDMap[i - numberOfNewRows]; |
| 0 | 427 | | m_RowDenseIndexToIDMap[i] = currentRowID; |
| | 428 | |
|
| 0 | 429 | | m_RowIdentifierToDenseIndexMap[currentRowID] = i; |
| | 430 | |
|
| 0 | 431 | | rowNames[i] = rowNames[i - numberOfNewRows]; |
| 0 | 432 | | } |
| | 433 | |
|
| 0 | 434 | | int freeListHead = m_RowEntriesFreeListHead; |
| | 435 | |
|
| 0 | 436 | | for (int i = 0; i < numberOfNewRows; i++) |
| 0 | 437 | | { |
| 0 | 438 | | int rowID = freeListHead; |
| 0 | 439 | | freeListHead = m_RowIdentifierToDenseIndexMap[rowID]; |
| 0 | 440 | | m_RowIdentifierToDenseIndexMap[rowID] = insertAt + i; |
| 0 | 441 | | m_RowDenseIndexToIDMap[insertAt + i] = rowID; |
| 0 | 442 | | } |
| | 443 | |
|
| 0 | 444 | | int numberOfNewRowNames = rowNames?.Length ?? 0; |
| 0 | 445 | | string emptyString = string.Empty; |
| 0 | 446 | | for (int i = 0; i < numberOfNewRowNames; i++) |
| 0 | 447 | | { |
| 0 | 448 | | string currentRowName = rowNames[i]; |
| 0 | 449 | | int rowIDAt = m_RowDenseIndexToIDMap[insertAt + i]; |
| 0 | 450 | | rowNames[insertAt + i] = currentRowName == null ? rowIDAt.ToString() : currentRowName; |
| 0 | 451 | | } |
| | 452 | |
|
| 0 | 453 | | for (int i = numberOfNewRowNames; i < numberOfNewRows; i++) |
| 0 | 454 | | { |
| 0 | 455 | | int rowIDAt = m_RowDenseIndexToIDMap[insertAt + i]; |
| 0 | 456 | | rowNames[insertAt + i] = rowIDAt.ToString(); |
| 0 | 457 | | } |
| | 458 | |
|
| 0 | 459 | | m_RowEntriesFreeListHead = freeListHead; |
| | 460 | |
|
| 0 | 461 | | InsertRowsOfTypeInternal(ref m_AllStringColumns, insertAt, numberOfNewRows); |
| 0 | 462 | | InsertRowsOfTypeInternal(ref m_AllBoolColumns, insertAt, numberOfNewRows); |
| 0 | 463 | | InsertRowsOfTypeInternal(ref m_AllCharColumns, insertAt, numberOfNewRows); |
| 0 | 464 | | InsertRowsOfTypeInternal(ref m_AllSByteColumns, insertAt, numberOfNewRows); |
| 0 | 465 | | InsertRowsOfTypeInternal(ref m_AllByteColumns, insertAt, numberOfNewRows); |
| 0 | 466 | | InsertRowsOfTypeInternal(ref m_AllShortColumns, insertAt, numberOfNewRows); |
| 0 | 467 | | InsertRowsOfTypeInternal(ref m_AllUShortColumns, insertAt, numberOfNewRows); |
| 0 | 468 | | InsertRowsOfTypeInternal(ref m_AllIntColumns, insertAt, numberOfNewRows); |
| 0 | 469 | | InsertRowsOfTypeInternal(ref m_AllUIntColumns, insertAt, numberOfNewRows); |
| 0 | 470 | | InsertRowsOfTypeInternal(ref m_AllLongColumns, insertAt, numberOfNewRows); |
| 0 | 471 | | InsertRowsOfTypeInternal(ref m_AllULongColumns, insertAt, numberOfNewRows); |
| 0 | 472 | | InsertRowsOfTypeInternal(ref m_AllFloatColumns, insertAt, numberOfNewRows); |
| 0 | 473 | | InsertRowsOfTypeInternal(ref m_AllDoubleColumns, insertAt, numberOfNewRows); |
| 0 | 474 | | InsertRowsOfTypeInternal(ref m_AllVector2Columns, insertAt, numberOfNewRows); |
| 0 | 475 | | InsertRowsOfTypeInternal(ref m_AllVector3Columns, insertAt, numberOfNewRows); |
| 0 | 476 | | InsertRowsOfTypeInternal(ref m_AllVector4Columns, insertAt, numberOfNewRows); |
| 0 | 477 | | InsertRowsOfTypeInternal(ref m_AllVector2IntColumns, insertAt, numberOfNewRows); |
| 0 | 478 | | InsertRowsOfTypeInternal(ref m_AllVector3IntColumns, insertAt, numberOfNewRows); |
| 0 | 479 | | InsertRowsOfTypeInternal(ref m_AllQuaternionColumns, insertAt, numberOfNewRows); |
| 0 | 480 | | InsertRowsOfTypeInternal(ref m_AllRectColumns, insertAt, numberOfNewRows); |
| 0 | 481 | | InsertRowsOfTypeInternal(ref m_AllRectIntColumns, insertAt, numberOfNewRows); |
| 0 | 482 | | InsertRowsOfTypeInternal(ref m_AllColorColumns, insertAt, numberOfNewRows); |
| 0 | 483 | | InsertRowsOfTypeInternal(ref m_AllLayerMaskColumns, insertAt, numberOfNewRows); |
| 0 | 484 | | InsertRowsOfTypeInternal(ref m_AllBoundsColumns, insertAt, numberOfNewRows); |
| 0 | 485 | | InsertRowsOfTypeInternal(ref m_AllBoundsIntColumns, insertAt, numberOfNewRows); |
| 0 | 486 | | InsertRowsOfTypeInternal(ref m_AllHash128Columns, insertAt, numberOfNewRows); |
| 0 | 487 | | InsertRowsOfTypeInternal(ref m_AllGradientColumns, insertAt, numberOfNewRows); |
| 0 | 488 | | InsertRowsOfTypeInternal(ref m_AllAnimationCurveColumns, insertAt, numberOfNewRows); |
| 0 | 489 | | InsertRowsOfTypeInternal(ref m_AllObjectRefColumns, insertAt, numberOfNewRows); |
| 0 | 490 | | InsertRowsOfTypeInternal(ref m_AllEnumIntColumns, insertAt, numberOfNewRows); |
| | 491 | |
|
| 0 | 492 | | m_RowCount += numberOfNewRows; |
| 0 | 493 | | m_DataVersion++; |
| 0 | 494 | | } |
| | 495 | |
|
| | 496 | | public void AddRows(int numberOfNewRows, ref int[] rowIDs, string[] rowNames = null, int insertAtRowID = -1) |
| 0 | 497 | | { |
| 0 | 498 | | if (insertAtRowID >= 0) |
| 0 | 499 | | { |
| 0 | 500 | | AssertRowIdentifierValid(insertAtRowID); |
| 0 | 501 | | } |
| | 502 | |
|
| 0 | 503 | | int rowIDToDenseIndexMapLength = m_RowIdentifierToDenseIndexMap?.Length ?? 0; |
| 0 | 504 | | int newCount = m_RowCount + numberOfNewRows; |
| 0 | 505 | | if (newCount > rowIDToDenseIndexMapLength) |
| 0 | 506 | | { |
| 0 | 507 | | int newSize = newCount; |
| 0 | 508 | | --newSize; |
| 0 | 509 | | newSize |= newSize >> 1; |
| 0 | 510 | | newSize |= newSize >> 2; |
| 0 | 511 | | newSize |= newSize >> 4; |
| 0 | 512 | | newSize |= newSize >> 8; |
| 0 | 513 | | newSize |= newSize >> 16; |
| 0 | 514 | | ++newSize; |
| | 515 | |
|
| 0 | 516 | | newSize = newSize == 0 ? 1 : newSize; |
| 0 | 517 | | Array.Resize(ref m_RowIdentifierToDenseIndexMap, newSize); |
| 0 | 518 | | for (int i = rowIDToDenseIndexMapLength; i < newSize; i++) |
| 0 | 519 | | { |
| 0 | 520 | | m_RowIdentifierToDenseIndexMap[i] = i + 1; |
| 0 | 521 | | } |
| 0 | 522 | | } |
| | 523 | |
|
| 0 | 524 | | int denseIndexToIDMapLength = m_RowDenseIndexToIDMap?.Length ?? 0; |
| 0 | 525 | | Array.Resize(ref m_RowDenseIndexToIDMap, denseIndexToIDMapLength + numberOfNewRows); |
| | 526 | |
|
| 0 | 527 | | int insertAt = insertAtRowID < 0 ? m_RowCount : m_RowIdentifierToDenseIndexMap[insertAtRowID]; |
| | 528 | |
|
| 0 | 529 | | for (int i = denseIndexToIDMapLength; i > insertAt + numberOfNewRows - 1; i--) |
| 0 | 530 | | { |
| 0 | 531 | | int currentRowID = m_RowDenseIndexToIDMap[i - numberOfNewRows]; |
| 0 | 532 | | m_RowDenseIndexToIDMap[i] = currentRowID; |
| | 533 | |
|
| 0 | 534 | | m_RowIdentifierToDenseIndexMap[currentRowID] = i; |
| | 535 | |
|
| 0 | 536 | | rowNames[i] = rowNames[i - numberOfNewRows]; |
| 0 | 537 | | } |
| | 538 | |
|
| 0 | 539 | | int freeListHead = m_RowEntriesFreeListHead; |
| | 540 | |
|
| 0 | 541 | | for (int i = 0; i < numberOfNewRows; i++) |
| 0 | 542 | | { |
| 0 | 543 | | int rowID = freeListHead; |
| 0 | 544 | | freeListHead = m_RowIdentifierToDenseIndexMap[rowID]; |
| 0 | 545 | | m_RowIdentifierToDenseIndexMap[rowID] = insertAt + i; |
| 0 | 546 | | m_RowDenseIndexToIDMap[insertAt + i] = rowID; |
| 0 | 547 | | rowIDs[i] = rowID; |
| 0 | 548 | | } |
| | 549 | |
|
| 0 | 550 | | int numberOfNewRowNames = rowNames?.Length ?? 0; |
| 0 | 551 | | for (int i = 0; i < numberOfNewRowNames; i++) |
| 0 | 552 | | { |
| 0 | 553 | | string currentRowName = rowNames[i]; |
| 0 | 554 | | int rowIDAt = m_RowDenseIndexToIDMap[insertAt + i]; |
| 0 | 555 | | rowNames[insertAt + i] = currentRowName == null ? rowIDAt.ToString() : currentRowName; |
| 0 | 556 | | } |
| | 557 | |
|
| 0 | 558 | | for (int i = numberOfNewRowNames; i < numberOfNewRows; i++) |
| 0 | 559 | | { |
| 0 | 560 | | int rowIDAt = m_RowDenseIndexToIDMap[insertAt + i]; |
| 0 | 561 | | rowNames[insertAt + i] = rowIDAt.ToString(); |
| 0 | 562 | | } |
| | 563 | |
|
| 0 | 564 | | m_RowEntriesFreeListHead = freeListHead; |
| | 565 | |
|
| 0 | 566 | | InsertRowsOfTypeInternal(ref m_AllStringColumns, insertAt, numberOfNewRows); |
| 0 | 567 | | InsertRowsOfTypeInternal(ref m_AllBoolColumns, insertAt, numberOfNewRows); |
| 0 | 568 | | InsertRowsOfTypeInternal(ref m_AllCharColumns, insertAt, numberOfNewRows); |
| 0 | 569 | | InsertRowsOfTypeInternal(ref m_AllSByteColumns, insertAt, numberOfNewRows); |
| 0 | 570 | | InsertRowsOfTypeInternal(ref m_AllByteColumns, insertAt, numberOfNewRows); |
| 0 | 571 | | InsertRowsOfTypeInternal(ref m_AllShortColumns, insertAt, numberOfNewRows); |
| 0 | 572 | | InsertRowsOfTypeInternal(ref m_AllUShortColumns, insertAt, numberOfNewRows); |
| 0 | 573 | | InsertRowsOfTypeInternal(ref m_AllIntColumns, insertAt, numberOfNewRows); |
| 0 | 574 | | InsertRowsOfTypeInternal(ref m_AllUIntColumns, insertAt, numberOfNewRows); |
| 0 | 575 | | InsertRowsOfTypeInternal(ref m_AllLongColumns, insertAt, numberOfNewRows); |
| 0 | 576 | | InsertRowsOfTypeInternal(ref m_AllULongColumns, insertAt, numberOfNewRows); |
| 0 | 577 | | InsertRowsOfTypeInternal(ref m_AllFloatColumns, insertAt, numberOfNewRows); |
| 0 | 578 | | InsertRowsOfTypeInternal(ref m_AllDoubleColumns, insertAt, numberOfNewRows); |
| 0 | 579 | | InsertRowsOfTypeInternal(ref m_AllVector2Columns, insertAt, numberOfNewRows); |
| 0 | 580 | | InsertRowsOfTypeInternal(ref m_AllVector3Columns, insertAt, numberOfNewRows); |
| 0 | 581 | | InsertRowsOfTypeInternal(ref m_AllVector4Columns, insertAt, numberOfNewRows); |
| 0 | 582 | | InsertRowsOfTypeInternal(ref m_AllVector2IntColumns, insertAt, numberOfNewRows); |
| 0 | 583 | | InsertRowsOfTypeInternal(ref m_AllVector3IntColumns, insertAt, numberOfNewRows); |
| 0 | 584 | | InsertRowsOfTypeInternal(ref m_AllQuaternionColumns, insertAt, numberOfNewRows); |
| 0 | 585 | | InsertRowsOfTypeInternal(ref m_AllRectColumns, insertAt, numberOfNewRows); |
| 0 | 586 | | InsertRowsOfTypeInternal(ref m_AllRectIntColumns, insertAt, numberOfNewRows); |
| 0 | 587 | | InsertRowsOfTypeInternal(ref m_AllColorColumns, insertAt, numberOfNewRows); |
| 0 | 588 | | InsertRowsOfTypeInternal(ref m_AllLayerMaskColumns, insertAt, numberOfNewRows); |
| 0 | 589 | | InsertRowsOfTypeInternal(ref m_AllBoundsColumns, insertAt, numberOfNewRows); |
| 0 | 590 | | InsertRowsOfTypeInternal(ref m_AllBoundsIntColumns, insertAt, numberOfNewRows); |
| 0 | 591 | | InsertRowsOfTypeInternal(ref m_AllHash128Columns, insertAt, numberOfNewRows); |
| 0 | 592 | | InsertRowsOfTypeInternal(ref m_AllGradientColumns, insertAt, numberOfNewRows); |
| 0 | 593 | | InsertRowsOfTypeInternal(ref m_AllAnimationCurveColumns, insertAt, numberOfNewRows); |
| 0 | 594 | | InsertRowsOfTypeInternal(ref m_AllObjectRefColumns, insertAt, numberOfNewRows); |
| 0 | 595 | | InsertRowsOfTypeInternal(ref m_AllEnumIntColumns, insertAt, numberOfNewRows); |
| | 596 | |
|
| 0 | 597 | | m_RowCount += numberOfNewRows; |
| 0 | 598 | | m_DataVersion++; |
| 0 | 599 | | } |
| | 600 | |
|
| | 601 | | /// <inheritdoc /> |
| | 602 | | public override void RemoveRow(int rowIdentifier) |
| 0 | 603 | | { |
| 0 | 604 | | AssertRowIdentifierValid(rowIdentifier); |
| 0 | 605 | | int rowDenseIndex = m_RowIdentifierToDenseIndexMap[rowIdentifier]; |
| 0 | 606 | | for (int i = rowDenseIndex + 1; i < m_RowCount; i++) |
| 0 | 607 | | { |
| 0 | 608 | | int currentRowID = m_RowDenseIndexToIDMap[i]; |
| 0 | 609 | | m_RowIdentifierToDenseIndexMap[currentRowID] = i - 1; |
| 0 | 610 | | m_RowDenseIndexToIDMap[i - 1] = currentRowID; |
| 0 | 611 | | m_RowNames[i - 1] = m_RowNames[i]; |
| 0 | 612 | | } |
| | 613 | |
|
| 0 | 614 | | m_RowIdentifierToDenseIndexMap[rowIdentifier] = m_RowEntriesFreeListHead; |
| 0 | 615 | | m_RowEntriesFreeListHead = rowIdentifier; |
| 0 | 616 | | Array.Resize(ref m_RowDenseIndexToIDMap, m_RowCount - 1); |
| 0 | 617 | | Array.Resize(ref m_RowNames, m_RowCount - 1); |
| | 618 | |
|
| 0 | 619 | | DeleteRowsOfTypeInternal(ref m_AllStringColumns, rowDenseIndex, 1); |
| 0 | 620 | | DeleteRowsOfTypeInternal(ref m_AllBoolColumns, rowDenseIndex, 1); |
| 0 | 621 | | DeleteRowsOfTypeInternal(ref m_AllCharColumns, rowDenseIndex, 1); |
| 0 | 622 | | DeleteRowsOfTypeInternal(ref m_AllSByteColumns, rowDenseIndex, 1); |
| 0 | 623 | | DeleteRowsOfTypeInternal(ref m_AllByteColumns, rowDenseIndex, 1); |
| 0 | 624 | | DeleteRowsOfTypeInternal(ref m_AllShortColumns, rowDenseIndex, 1); |
| 0 | 625 | | DeleteRowsOfTypeInternal(ref m_AllUShortColumns, rowDenseIndex, 1); |
| 0 | 626 | | DeleteRowsOfTypeInternal(ref m_AllIntColumns, rowDenseIndex, 1); |
| 0 | 627 | | DeleteRowsOfTypeInternal(ref m_AllUIntColumns, rowDenseIndex, 1); |
| 0 | 628 | | DeleteRowsOfTypeInternal(ref m_AllLongColumns, rowDenseIndex, 1); |
| 0 | 629 | | DeleteRowsOfTypeInternal(ref m_AllULongColumns, rowDenseIndex, 1); |
| 0 | 630 | | DeleteRowsOfTypeInternal(ref m_AllFloatColumns, rowDenseIndex, 1); |
| 0 | 631 | | DeleteRowsOfTypeInternal(ref m_AllDoubleColumns, rowDenseIndex, 1); |
| 0 | 632 | | DeleteRowsOfTypeInternal(ref m_AllVector2Columns, rowDenseIndex, 1); |
| 0 | 633 | | DeleteRowsOfTypeInternal(ref m_AllVector3Columns, rowDenseIndex, 1); |
| 0 | 634 | | DeleteRowsOfTypeInternal(ref m_AllVector4Columns, rowDenseIndex, 1); |
| 0 | 635 | | DeleteRowsOfTypeInternal(ref m_AllVector2IntColumns, rowDenseIndex, 1); |
| 0 | 636 | | DeleteRowsOfTypeInternal(ref m_AllVector3IntColumns, rowDenseIndex, 1); |
| 0 | 637 | | DeleteRowsOfTypeInternal(ref m_AllQuaternionColumns, rowDenseIndex, 1); |
| 0 | 638 | | DeleteRowsOfTypeInternal(ref m_AllRectColumns, rowDenseIndex, 1); |
| 0 | 639 | | DeleteRowsOfTypeInternal(ref m_AllRectIntColumns, rowDenseIndex, 1); |
| 0 | 640 | | DeleteRowsOfTypeInternal(ref m_AllColorColumns, rowDenseIndex, 1); |
| 0 | 641 | | DeleteRowsOfTypeInternal(ref m_AllLayerMaskColumns, rowDenseIndex, 1); |
| 0 | 642 | | DeleteRowsOfTypeInternal(ref m_AllBoundsColumns, rowDenseIndex, 1); |
| 0 | 643 | | DeleteRowsOfTypeInternal(ref m_AllBoundsIntColumns, rowDenseIndex, 1); |
| 0 | 644 | | DeleteRowsOfTypeInternal(ref m_AllHash128Columns, rowDenseIndex, 1); |
| 0 | 645 | | DeleteRowsOfTypeInternal(ref m_AllGradientColumns, rowDenseIndex, 1); |
| 0 | 646 | | DeleteRowsOfTypeInternal(ref m_AllAnimationCurveColumns, rowDenseIndex, 1); |
| 0 | 647 | | DeleteRowsOfTypeInternal(ref m_AllObjectRefColumns, rowDenseIndex, 1); |
| 0 | 648 | | DeleteRowsOfTypeInternal(ref m_AllEnumIntColumns, rowDenseIndex, 1); |
| | 649 | |
|
| 0 | 650 | | --m_RowCount; |
| 0 | 651 | | m_DataVersion++; |
| 0 | 652 | | } |
| | 653 | |
|
| | 654 | | /// <inheritdoc /> |
| | 655 | | public override int AddColumn(Serializable.SerializableTypes columnType, string columnName, |
| | 656 | | int insertAtColumnIdentifier = -1) |
| 114 | 657 | | { |
| 114 | 658 | | switch (columnType) |
| | 659 | | { |
| | 660 | | case Serializable.SerializableTypes.String: |
| 13 | 661 | | return AddColumnInternal(columnName, ref m_AllStringColumns, Serializable.SerializableTypes.String, |
| | 662 | | insertAtColumnIdentifier); |
| | 663 | | case Serializable.SerializableTypes.Char: |
| 3 | 664 | | return AddColumnInternal(columnName, ref m_AllCharColumns, Serializable.SerializableTypes.Char, |
| | 665 | | insertAtColumnIdentifier); |
| | 666 | | case Serializable.SerializableTypes.Bool: |
| 4 | 667 | | return AddColumnInternal(columnName, ref m_AllBoolColumns, Serializable.SerializableTypes.Bool, |
| | 668 | | insertAtColumnIdentifier); |
| | 669 | | case Serializable.SerializableTypes.SByte: |
| 4 | 670 | | return AddColumnInternal(columnName, ref m_AllSByteColumns, Serializable.SerializableTypes.SByte, |
| | 671 | | insertAtColumnIdentifier); |
| | 672 | | case Serializable.SerializableTypes.Byte: |
| 3 | 673 | | return AddColumnInternal(columnName, ref m_AllByteColumns, Serializable.SerializableTypes.Byte, |
| | 674 | | insertAtColumnIdentifier); |
| | 675 | | case Serializable.SerializableTypes.Short: |
| 3 | 676 | | return AddColumnInternal(columnName, ref m_AllShortColumns, Serializable.SerializableTypes.Short, |
| | 677 | | insertAtColumnIdentifier); |
| | 678 | | case Serializable.SerializableTypes.UShort: |
| 3 | 679 | | return AddColumnInternal(columnName, ref m_AllUShortColumns, Serializable.SerializableTypes.UShort, |
| | 680 | | insertAtColumnIdentifier); |
| | 681 | | case Serializable.SerializableTypes.Int: |
| 3 | 682 | | return AddColumnInternal(columnName, ref m_AllIntColumns, Serializable.SerializableTypes.Int, |
| | 683 | | insertAtColumnIdentifier); |
| | 684 | | case Serializable.SerializableTypes.UInt: |
| 3 | 685 | | return AddColumnInternal(columnName, ref m_AllUIntColumns, Serializable.SerializableTypes.UInt, |
| | 686 | | insertAtColumnIdentifier); |
| | 687 | | case Serializable.SerializableTypes.Long: |
| 3 | 688 | | return AddColumnInternal(columnName, ref m_AllLongColumns, Serializable.SerializableTypes.Long, |
| | 689 | | insertAtColumnIdentifier); |
| | 690 | | case Serializable.SerializableTypes.ULong: |
| 3 | 691 | | return AddColumnInternal(columnName, ref m_AllULongColumns, Serializable.SerializableTypes.ULong, |
| | 692 | | insertAtColumnIdentifier); |
| | 693 | | case Serializable.SerializableTypes.Float: |
| 4 | 694 | | return AddColumnInternal(columnName, ref m_AllFloatColumns, Serializable.SerializableTypes.Float, |
| | 695 | | insertAtColumnIdentifier); |
| | 696 | | case Serializable.SerializableTypes.Double: |
| 4 | 697 | | return AddColumnInternal(columnName, ref m_AllDoubleColumns, Serializable.SerializableTypes.Double, |
| | 698 | | insertAtColumnIdentifier); |
| | 699 | | case Serializable.SerializableTypes.Vector2: |
| 5 | 700 | | return AddColumnInternal(columnName, ref m_AllVector2Columns, |
| | 701 | | Serializable.SerializableTypes.Vector2, |
| | 702 | | insertAtColumnIdentifier); |
| | 703 | | case Serializable.SerializableTypes.Vector3: |
| 3 | 704 | | return AddColumnInternal(columnName, ref m_AllVector3Columns, |
| | 705 | | Serializable.SerializableTypes.Vector3, |
| | 706 | | insertAtColumnIdentifier); |
| | 707 | | case Serializable.SerializableTypes.Vector4: |
| 3 | 708 | | return AddColumnInternal(columnName, ref m_AllVector4Columns, |
| | 709 | | Serializable.SerializableTypes.Vector4, |
| | 710 | | insertAtColumnIdentifier); |
| | 711 | | case Serializable.SerializableTypes.Vector2Int: |
| 3 | 712 | | return AddColumnInternal(columnName, ref m_AllVector2IntColumns, |
| | 713 | | Serializable.SerializableTypes.Vector2Int, insertAtColumnIdentifier); |
| | 714 | | case Serializable.SerializableTypes.Vector3Int: |
| 3 | 715 | | return AddColumnInternal(columnName, ref m_AllVector3IntColumns, |
| | 716 | | Serializable.SerializableTypes.Vector3Int, insertAtColumnIdentifier); |
| | 717 | | case Serializable.SerializableTypes.Quaternion: |
| 4 | 718 | | return AddColumnInternal(columnName, ref m_AllQuaternionColumns, |
| | 719 | | Serializable.SerializableTypes.Quaternion, insertAtColumnIdentifier); |
| | 720 | | case Serializable.SerializableTypes.Rect: |
| 3 | 721 | | return AddColumnInternal(columnName, ref m_AllRectColumns, Serializable.SerializableTypes.Rect, |
| | 722 | | insertAtColumnIdentifier); |
| | 723 | | case Serializable.SerializableTypes.RectInt: |
| 3 | 724 | | return AddColumnInternal(columnName, ref m_AllRectIntColumns, |
| | 725 | | Serializable.SerializableTypes.RectInt, |
| | 726 | | insertAtColumnIdentifier); |
| | 727 | | case Serializable.SerializableTypes.Color: |
| 3 | 728 | | return AddColumnInternal(columnName, ref m_AllColorColumns, Serializable.SerializableTypes.Color, |
| | 729 | | insertAtColumnIdentifier); |
| | 730 | | case Serializable.SerializableTypes.LayerMask: |
| 3 | 731 | | return AddColumnInternal(columnName, ref m_AllLayerMaskColumns, |
| | 732 | | Serializable.SerializableTypes.LayerMask, insertAtColumnIdentifier); |
| | 733 | | case Serializable.SerializableTypes.Bounds: |
| 9 | 734 | | return AddColumnInternal(columnName, ref m_AllBoundsColumns, Serializable.SerializableTypes.Bounds, |
| | 735 | | insertAtColumnIdentifier); |
| | 736 | | case Serializable.SerializableTypes.BoundsInt: |
| 3 | 737 | | return AddColumnInternal(columnName, ref m_AllBoundsIntColumns, |
| | 738 | | Serializable.SerializableTypes.BoundsInt, insertAtColumnIdentifier); |
| | 739 | | case Serializable.SerializableTypes.Hash128: |
| 3 | 740 | | return AddColumnInternal(columnName, ref m_AllHash128Columns, |
| | 741 | | Serializable.SerializableTypes.Hash128, |
| | 742 | | insertAtColumnIdentifier); |
| | 743 | | case Serializable.SerializableTypes.Gradient: |
| 3 | 744 | | return AddColumnInternal(columnName, ref m_AllGradientColumns, |
| | 745 | | Serializable.SerializableTypes.Gradient, insertAtColumnIdentifier); |
| | 746 | | case Serializable.SerializableTypes.AnimationCurve: |
| 3 | 747 | | return AddColumnInternal(columnName, ref m_AllAnimationCurveColumns, |
| | 748 | | Serializable.SerializableTypes.AnimationCurve, insertAtColumnIdentifier); |
| | 749 | | case Serializable.SerializableTypes.Object: |
| 4 | 750 | | return AddColumnInternal(columnName, ref m_AllObjectRefColumns, |
| | 751 | | Serializable.SerializableTypes.Object, |
| | 752 | | insertAtColumnIdentifier); |
| | 753 | | case Serializable.SerializableTypes.EnumInt: |
| 3 | 754 | | return AddColumnInternal(columnName, ref m_AllEnumIntColumns, |
| | 755 | | Serializable.SerializableTypes.EnumInt, |
| | 756 | | insertAtColumnIdentifier); |
| | 757 | | } |
| | 758 | |
|
| 0 | 759 | | return -1; |
| 114 | 760 | | } |
| | 761 | |
|
| | 762 | | /// <inheritdoc /> |
| | 763 | | public override void RemoveColumn(Serializable.SerializableTypes columnType, int columnIdentifier) |
| 4 | 764 | | { |
| 4 | 765 | | switch (columnType) |
| | 766 | | { |
| | 767 | | case Serializable.SerializableTypes.String: |
| 1 | 768 | | RemoveColumnInternal(ref m_AllStringColumns, Serializable.SerializableTypes.String, |
| | 769 | | columnIdentifier); |
| 1 | 770 | | break; |
| | 771 | | case Serializable.SerializableTypes.Char: |
| 0 | 772 | | RemoveColumnInternal(ref m_AllCharColumns, Serializable.SerializableTypes.Char, columnIdentifier); |
| 0 | 773 | | break; |
| | 774 | | case Serializable.SerializableTypes.Bool: |
| 0 | 775 | | RemoveColumnInternal(ref m_AllBoolColumns, Serializable.SerializableTypes.Bool, columnIdentifier); |
| 0 | 776 | | break; |
| | 777 | | case Serializable.SerializableTypes.SByte: |
| 0 | 778 | | RemoveColumnInternal(ref m_AllSByteColumns, Serializable.SerializableTypes.SByte, columnIdentifier); |
| 0 | 779 | | break; |
| | 780 | | case Serializable.SerializableTypes.Byte: |
| 0 | 781 | | RemoveColumnInternal(ref m_AllByteColumns, Serializable.SerializableTypes.Byte, columnIdentifier); |
| 0 | 782 | | break; |
| | 783 | | case Serializable.SerializableTypes.Short: |
| 0 | 784 | | RemoveColumnInternal(ref m_AllShortColumns, Serializable.SerializableTypes.Short, columnIdentifier); |
| 0 | 785 | | break; |
| | 786 | | case Serializable.SerializableTypes.UShort: |
| 0 | 787 | | RemoveColumnInternal(ref m_AllUShortColumns, Serializable.SerializableTypes.UShort, |
| | 788 | | columnIdentifier); |
| 0 | 789 | | break; |
| | 790 | | case Serializable.SerializableTypes.Int: |
| 0 | 791 | | RemoveColumnInternal(ref m_AllIntColumns, Serializable.SerializableTypes.Int, columnIdentifier); |
| 0 | 792 | | break; |
| | 793 | | case Serializable.SerializableTypes.UInt: |
| 0 | 794 | | RemoveColumnInternal(ref m_AllUIntColumns, Serializable.SerializableTypes.UInt, columnIdentifier); |
| 0 | 795 | | break; |
| | 796 | | case Serializable.SerializableTypes.Long: |
| 0 | 797 | | RemoveColumnInternal(ref m_AllLongColumns, Serializable.SerializableTypes.Long, columnIdentifier); |
| 0 | 798 | | break; |
| | 799 | | case Serializable.SerializableTypes.ULong: |
| 0 | 800 | | RemoveColumnInternal(ref m_AllULongColumns, Serializable.SerializableTypes.ULong, columnIdentifier); |
| 0 | 801 | | break; |
| | 802 | | case Serializable.SerializableTypes.Float: |
| 0 | 803 | | RemoveColumnInternal(ref m_AllFloatColumns, Serializable.SerializableTypes.Float, columnIdentifier); |
| 0 | 804 | | break; |
| | 805 | | case Serializable.SerializableTypes.Double: |
| 0 | 806 | | RemoveColumnInternal(ref m_AllDoubleColumns, Serializable.SerializableTypes.Double, |
| | 807 | | columnIdentifier); |
| 0 | 808 | | break; |
| | 809 | | case Serializable.SerializableTypes.Vector2: |
| 0 | 810 | | RemoveColumnInternal(ref m_AllVector2Columns, Serializable.SerializableTypes.Vector2, |
| | 811 | | columnIdentifier); |
| 0 | 812 | | break; |
| | 813 | | case Serializable.SerializableTypes.Vector3: |
| 0 | 814 | | RemoveColumnInternal(ref m_AllVector3Columns, Serializable.SerializableTypes.Vector3, |
| | 815 | | columnIdentifier); |
| 0 | 816 | | break; |
| | 817 | | case Serializable.SerializableTypes.Vector4: |
| 0 | 818 | | RemoveColumnInternal(ref m_AllVector4Columns, Serializable.SerializableTypes.Vector4, |
| | 819 | | columnIdentifier); |
| 0 | 820 | | break; |
| | 821 | | case Serializable.SerializableTypes.Vector2Int: |
| 0 | 822 | | RemoveColumnInternal(ref m_AllVector2IntColumns, Serializable.SerializableTypes.Vector2Int, |
| | 823 | | columnIdentifier); |
| 0 | 824 | | break; |
| | 825 | | case Serializable.SerializableTypes.Vector3Int: |
| 0 | 826 | | RemoveColumnInternal(ref m_AllVector3IntColumns, Serializable.SerializableTypes.Vector3Int, |
| | 827 | | columnIdentifier); |
| 0 | 828 | | break; |
| | 829 | | case Serializable.SerializableTypes.Quaternion: |
| 0 | 830 | | RemoveColumnInternal(ref m_AllQuaternionColumns, Serializable.SerializableTypes.Quaternion, |
| | 831 | | columnIdentifier); |
| 0 | 832 | | break; |
| | 833 | | case Serializable.SerializableTypes.Rect: |
| 0 | 834 | | RemoveColumnInternal(ref m_AllRectColumns, Serializable.SerializableTypes.Rect, columnIdentifier); |
| 0 | 835 | | break; |
| | 836 | | case Serializable.SerializableTypes.RectInt: |
| 0 | 837 | | RemoveColumnInternal(ref m_AllRectIntColumns, Serializable.SerializableTypes.RectInt, |
| | 838 | | columnIdentifier); |
| 0 | 839 | | break; |
| | 840 | | case Serializable.SerializableTypes.Color: |
| 0 | 841 | | RemoveColumnInternal(ref m_AllColorColumns, Serializable.SerializableTypes.Color, columnIdentifier); |
| 0 | 842 | | break; |
| | 843 | | case Serializable.SerializableTypes.LayerMask: |
| 0 | 844 | | RemoveColumnInternal(ref m_AllLayerMaskColumns, Serializable.SerializableTypes.LayerMask, |
| | 845 | | columnIdentifier); |
| 0 | 846 | | break; |
| | 847 | | case Serializable.SerializableTypes.Bounds: |
| 3 | 848 | | RemoveColumnInternal(ref m_AllBoundsColumns, Serializable.SerializableTypes.Bounds, |
| | 849 | | columnIdentifier); |
| 3 | 850 | | break; |
| | 851 | | case Serializable.SerializableTypes.BoundsInt: |
| 0 | 852 | | RemoveColumnInternal(ref m_AllBoundsIntColumns, Serializable.SerializableTypes.BoundsInt, |
| | 853 | | columnIdentifier); |
| 0 | 854 | | break; |
| | 855 | | case Serializable.SerializableTypes.Hash128: |
| 0 | 856 | | RemoveColumnInternal(ref m_AllHash128Columns, Serializable.SerializableTypes.Hash128, |
| | 857 | | columnIdentifier); |
| 0 | 858 | | break; |
| | 859 | | case Serializable.SerializableTypes.Gradient: |
| 0 | 860 | | RemoveColumnInternal(ref m_AllGradientColumns, Serializable.SerializableTypes.Gradient, |
| | 861 | | columnIdentifier); |
| 0 | 862 | | break; |
| | 863 | | case Serializable.SerializableTypes.AnimationCurve: |
| 0 | 864 | | RemoveColumnInternal(ref m_AllAnimationCurveColumns, Serializable.SerializableTypes.AnimationCurve, |
| | 865 | | columnIdentifier); |
| 0 | 866 | | break; |
| | 867 | | case Serializable.SerializableTypes.Object: |
| 0 | 868 | | RemoveColumnInternal(ref m_AllObjectRefColumns, Serializable.SerializableTypes.Object, |
| | 869 | | columnIdentifier); |
| 0 | 870 | | break; |
| | 871 | | case Serializable.SerializableTypes.EnumInt: |
| 0 | 872 | | RemoveColumnInternal(ref m_AllEnumIntColumns, Serializable.SerializableTypes.EnumInt, |
| | 873 | | columnIdentifier); |
| 0 | 874 | | break; |
| | 875 | | } |
| 4 | 876 | | } |
| | 877 | |
|
| | 878 | | // Set |
| | 879 | | /// <inheritdoc /> |
| | 880 | | public override ulong SetString(int rowIdentifier, int columnIdentifier, string newValue) |
| 10 | 881 | | { |
| 10 | 882 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllStringColumns, newValue); |
| 10 | 883 | | } |
| | 884 | |
|
| | 885 | | /// <inheritdoc /> |
| | 886 | | public override ulong SetBool(int rowIdentifier, int columnIdentifier, bool newValue) |
| 10 | 887 | | { |
| 10 | 888 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllBoolColumns, newValue); |
| 10 | 889 | | } |
| | 890 | |
|
| | 891 | | /// <inheritdoc /> |
| | 892 | | public override ulong SetChar(int rowIdentifier, int columnIdentifier, char newValue) |
| 10 | 893 | | { |
| 10 | 894 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllCharColumns, newValue); |
| 10 | 895 | | } |
| | 896 | |
|
| | 897 | | /// <inheritdoc /> |
| | 898 | | public override ulong SetSByte(int rowIdentifier, int columnIdentifier, sbyte newValue) |
| 10 | 899 | | { |
| 10 | 900 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllSByteColumns, newValue); |
| 10 | 901 | | } |
| | 902 | |
|
| | 903 | | /// <inheritdoc /> |
| | 904 | | public override ulong SetByte(int rowIdentifier, int columnIdentifier, byte newValue) |
| 10 | 905 | | { |
| 10 | 906 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllByteColumns, newValue); |
| 10 | 907 | | } |
| | 908 | |
|
| | 909 | | /// <inheritdoc /> |
| | 910 | | public override ulong SetEnumInt(int rowIdentifier, int columnIdentifier, int newValue) |
| 0 | 911 | | { |
| 0 | 912 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllEnumIntColumns, newValue); |
| 0 | 913 | | } |
| | 914 | |
|
| | 915 | | /// <inheritdoc /> |
| | 916 | | public override ulong SetShort(int rowIdentifier, int columnIdentifier, short newValue) |
| 10 | 917 | | { |
| 10 | 918 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllShortColumns, newValue); |
| 10 | 919 | | } |
| | 920 | |
|
| | 921 | | /// <inheritdoc /> |
| | 922 | | public override ulong SetUShort(int rowIdentifier, int columnIdentifier, ushort newValue) |
| 10 | 923 | | { |
| 10 | 924 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllUShortColumns, newValue); |
| 10 | 925 | | } |
| | 926 | |
|
| | 927 | | /// <inheritdoc /> |
| | 928 | | public override ulong SetInt(int rowIdentifier, int columnIdentifier, int newValue) |
| 10 | 929 | | { |
| 10 | 930 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllIntColumns, newValue); |
| 10 | 931 | | } |
| | 932 | |
|
| | 933 | | /// <inheritdoc /> |
| | 934 | | public override ulong SetUInt(int rowIdentifier, int columnIdentifier, uint newValue) |
| 10 | 935 | | { |
| 10 | 936 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllUIntColumns, newValue); |
| 10 | 937 | | } |
| | 938 | |
|
| | 939 | | /// <inheritdoc /> |
| | 940 | | public override ulong SetLong(int rowIdentifier, int columnIdentifier, long newValue) |
| 10 | 941 | | { |
| 10 | 942 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllLongColumns, newValue); |
| 10 | 943 | | } |
| | 944 | |
|
| | 945 | | /// <inheritdoc /> |
| | 946 | | public override ulong SetULong(int rowIdentifier, int columnIdentifier, ulong newValue) |
| 10 | 947 | | { |
| 10 | 948 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllULongColumns, newValue); |
| 10 | 949 | | } |
| | 950 | |
|
| | 951 | | /// <inheritdoc /> |
| | 952 | | public override ulong SetFloat(int rowIdentifier, int columnIdentifier, float newValue) |
| 10 | 953 | | { |
| 10 | 954 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllFloatColumns, newValue); |
| 10 | 955 | | } |
| | 956 | |
|
| | 957 | | /// <inheritdoc /> |
| | 958 | | public override ulong SetDouble(int rowIdentifier, int columnIdentifier, double newValue) |
| 10 | 959 | | { |
| 10 | 960 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllDoubleColumns, newValue); |
| 10 | 961 | | } |
| | 962 | |
|
| | 963 | | /// <inheritdoc /> |
| | 964 | | public override ulong SetVector2(int rowIdentifier, int columnIdentifier, Vector2 newStruct) |
| 10 | 965 | | { |
| 10 | 966 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllVector2Columns, newStruct); |
| 10 | 967 | | } |
| | 968 | |
|
| | 969 | | /// <inheritdoc /> |
| | 970 | | public override ulong SetVector3(int rowIdentifier, int columnIdentifier, Vector3 newStruct) |
| 10 | 971 | | { |
| 10 | 972 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllVector3Columns, newStruct); |
| 10 | 973 | | } |
| | 974 | |
|
| | 975 | | /// <inheritdoc /> |
| | 976 | | public override ulong SetVector4(int rowIdentifier, int columnIdentifier, Vector4 newStruct) |
| 10 | 977 | | { |
| 10 | 978 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllVector4Columns, newStruct); |
| 10 | 979 | | } |
| | 980 | |
|
| | 981 | | /// <inheritdoc /> |
| | 982 | | public override ulong SetVector2Int(int rowIdentifier, int columnIdentifier, Vector2Int newStruct) |
| 10 | 983 | | { |
| 10 | 984 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllVector2IntColumns, newStruct); |
| 10 | 985 | | } |
| | 986 | |
|
| | 987 | | /// <inheritdoc /> |
| | 988 | | public override ulong SetVector3Int(int rowIdentifier, int columnIdentifier, Vector3Int newStruct) |
| 10 | 989 | | { |
| 10 | 990 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllVector3IntColumns, newStruct); |
| 10 | 991 | | } |
| | 992 | |
|
| | 993 | | /// <inheritdoc /> |
| | 994 | | public override ulong SetQuaternion(int rowIdentifier, int columnIdentifier, Quaternion newStruct) |
| 10 | 995 | | { |
| 10 | 996 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllQuaternionColumns, newStruct); |
| 10 | 997 | | } |
| | 998 | |
|
| | 999 | | /// <inheritdoc /> |
| | 1000 | | public override ulong SetRect(int rowIdentifier, int columnIdentifier, Rect newStruct) |
| 10 | 1001 | | { |
| 10 | 1002 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllRectColumns, newStruct); |
| 10 | 1003 | | } |
| | 1004 | |
|
| | 1005 | | /// <inheritdoc /> |
| | 1006 | | public override ulong SetRectInt(int rowIdentifier, int columnIdentifier, RectInt newStruct) |
| 10 | 1007 | | { |
| 10 | 1008 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllRectIntColumns, newStruct); |
| 10 | 1009 | | } |
| | 1010 | |
|
| | 1011 | | /// <inheritdoc /> |
| | 1012 | | public override ulong SetColor(int rowIdentifier, int columnIdentifier, Color newStruct) |
| 10 | 1013 | | { |
| 10 | 1014 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllColorColumns, newStruct); |
| 10 | 1015 | | } |
| | 1016 | |
|
| | 1017 | | /// <inheritdoc /> |
| | 1018 | | public override ulong SetLayerMask(int rowIdentifier, int columnIdentifier, LayerMask newStruct) |
| 10 | 1019 | | { |
| 10 | 1020 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllLayerMaskColumns, newStruct); |
| 10 | 1021 | | } |
| | 1022 | |
|
| | 1023 | | /// <inheritdoc /> |
| | 1024 | | public override ulong SetBounds(int rowIdentifier, int columnIdentifier, Bounds newStruct) |
| 10 | 1025 | | { |
| 10 | 1026 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllBoundsColumns, newStruct); |
| 10 | 1027 | | } |
| | 1028 | |
|
| | 1029 | | /// <inheritdoc /> |
| | 1030 | | public override ulong SetBoundsInt(int rowIdentifier, int columnIdentifier, BoundsInt newStruct) |
| 10 | 1031 | | { |
| 10 | 1032 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllBoundsIntColumns, newStruct); |
| 10 | 1033 | | } |
| | 1034 | |
|
| | 1035 | | /// <inheritdoc /> |
| | 1036 | | public override ulong SetHash128(int rowIdentifier, int columnIdentifier, Hash128 newStruct) |
| 10 | 1037 | | { |
| 10 | 1038 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllHash128Columns, newStruct); |
| 10 | 1039 | | } |
| | 1040 | |
|
| | 1041 | | /// <inheritdoc /> |
| | 1042 | | public override ulong SetGradient(int rowIdentifier, int columnIdentifier, Gradient newObject) |
| 10 | 1043 | | { |
| 10 | 1044 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllGradientColumns, newObject); |
| 10 | 1045 | | } |
| | 1046 | |
|
| | 1047 | | /// <inheritdoc /> |
| | 1048 | | public override ulong SetAnimationCurve(int rowIdentifier, int columnIdentifier, AnimationCurve newObject) |
| 10 | 1049 | | { |
| 10 | 1050 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllAnimationCurveColumns, newObject); |
| 10 | 1051 | | } |
| | 1052 | |
|
| | 1053 | | /// <inheritdoc /> |
| | 1054 | | public override ulong SetObject(int rowIdentifier, int columnIdentifier, Object newObject) |
| 10 | 1055 | | { |
| 10 | 1056 | | return SetCell(rowIdentifier, columnIdentifier, ref m_AllObjectRefColumns, newObject); |
| 10 | 1057 | | } |
| | 1058 | |
|
| | 1059 | | /// <inheritdoc /> |
| | 1060 | | public override void SetTypeNameForColumn(int columnIdentifier, string assemblyQualifiedName) |
| 0 | 1061 | | { |
| 0 | 1062 | | ref ColumnEntry entry = ref m_ColumnIdentifierToDenseIndexMap[columnIdentifier]; |
| | 1063 | |
|
| 0 | 1064 | | if (entry.ColumnType == Serializable.SerializableTypes.Object) |
| 0 | 1065 | | { |
| 0 | 1066 | | m_AllObjectRefTypeNames[entry.ColumnDenseIndex] = assemblyQualifiedName; |
| 0 | 1067 | | } |
| 0 | 1068 | | else if (entry.ColumnType == Serializable.SerializableTypes.EnumInt) |
| 0 | 1069 | | { |
| 0 | 1070 | | m_AllEnumIntTypeNames[entry.ColumnDenseIndex] = assemblyQualifiedName; |
| 0 | 1071 | | } |
| | 1072 | | else |
| 0 | 1073 | | { |
| 0 | 1074 | | throw new NotSupportedException( |
| | 1075 | | "Type name overloads are only supported for types inheriting from UnityEngine.Object or from System. |
| | 1076 | | } |
| 0 | 1077 | | } |
| | 1078 | |
|
| | 1079 | | /// <inheritdoc /> |
| | 1080 | | public override string GetTypeNameForColumn(int columnIdentifier) |
| 0 | 1081 | | { |
| 0 | 1082 | | ref ColumnEntry entry = ref m_ColumnIdentifierToDenseIndexMap[columnIdentifier]; |
| 0 | 1083 | | int denseIndex = entry.ColumnDenseIndex; |
| | 1084 | |
|
| 0 | 1085 | | if (entry.ColumnType == Serializable.SerializableTypes.Object) |
| 0 | 1086 | | { |
| 0 | 1087 | | return m_AllObjectRefTypeNames[entry.ColumnDenseIndex]; |
| | 1088 | | } |
| | 1089 | |
|
| 0 | 1090 | | if (entry.ColumnType == Serializable.SerializableTypes.EnumInt) |
| 0 | 1091 | | { |
| 0 | 1092 | | return m_AllEnumIntTypeNames[entry.ColumnDenseIndex]; |
| | 1093 | | } |
| | 1094 | |
|
| 0 | 1095 | | throw new NotSupportedException( |
| | 1096 | | "Type name overloads are only supported for types inheriting from UnityEngine.Object or from System.Enum |
| 0 | 1097 | | } |
| | 1098 | |
|
| | 1099 | | // Get |
| | 1100 | | /// <inheritdoc /> |
| | 1101 | | public override string GetString(int rowIdentifier, int columnIdentifier) |
| 10 | 1102 | | { |
| 10 | 1103 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllStringColumns); |
| 10 | 1104 | | } |
| | 1105 | |
|
| | 1106 | | /// <inheritdoc /> |
| | 1107 | | public override bool GetBool(int rowIdentifier, int columnIdentifier) |
| 10 | 1108 | | { |
| 10 | 1109 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllBoolColumns); |
| 10 | 1110 | | } |
| | 1111 | |
|
| | 1112 | | /// <inheritdoc /> |
| | 1113 | | public override char GetChar(int rowIdentifier, int columnIdentifier) |
| 10 | 1114 | | { |
| 10 | 1115 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllCharColumns); |
| 10 | 1116 | | } |
| | 1117 | |
|
| | 1118 | | /// <inheritdoc /> |
| | 1119 | | public override int GetEnumInt(int rowIdentifier, int columnIdentifier) |
| 0 | 1120 | | { |
| 0 | 1121 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllEnumIntColumns); |
| 0 | 1122 | | } |
| | 1123 | |
|
| | 1124 | | /// <inheritdoc /> |
| | 1125 | | public override sbyte GetSByte(int rowIdentifier, int columnIdentifier) |
| 10 | 1126 | | { |
| 10 | 1127 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllSByteColumns); |
| 10 | 1128 | | } |
| | 1129 | |
|
| | 1130 | | /// <inheritdoc /> |
| | 1131 | | public override byte GetByte(int rowIdentifier, int columnIdentifier) |
| 10 | 1132 | | { |
| 10 | 1133 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllByteColumns); |
| 10 | 1134 | | } |
| | 1135 | |
|
| | 1136 | | /// <inheritdoc /> |
| | 1137 | | public override short GetShort(int rowIdentifier, int columnIdentifier) |
| 10 | 1138 | | { |
| 10 | 1139 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllShortColumns); |
| 10 | 1140 | | } |
| | 1141 | |
|
| | 1142 | | /// <inheritdoc /> |
| | 1143 | | public override ushort GetUShort(int rowIdentifier, int columnIdentifier) |
| 10 | 1144 | | { |
| 10 | 1145 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllUShortColumns); |
| 10 | 1146 | | } |
| | 1147 | |
|
| | 1148 | | /// <inheritdoc /> |
| | 1149 | | public override int GetInt(int rowIdentifier, int columnIdentifier) |
| 10 | 1150 | | { |
| 10 | 1151 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllIntColumns); |
| 10 | 1152 | | } |
| | 1153 | |
|
| | 1154 | | /// <inheritdoc /> |
| | 1155 | | public override uint GetUInt(int rowIdentifier, int columnIdentifier) |
| 10 | 1156 | | { |
| 10 | 1157 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllUIntColumns); |
| 10 | 1158 | | } |
| | 1159 | |
|
| | 1160 | | /// <inheritdoc /> |
| | 1161 | | public override long GetLong(int rowIdentifier, int columnIdentifier) |
| 10 | 1162 | | { |
| 10 | 1163 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllLongColumns); |
| 10 | 1164 | | } |
| | 1165 | |
|
| | 1166 | | /// <inheritdoc /> |
| | 1167 | | public override ulong GetULong(int rowIdentifier, int columnIdentifier) |
| 10 | 1168 | | { |
| 10 | 1169 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllULongColumns); |
| 10 | 1170 | | } |
| | 1171 | |
|
| | 1172 | | /// <inheritdoc /> |
| | 1173 | | public override float GetFloat(int rowIdentifier, int columnIdentifier) |
| 10 | 1174 | | { |
| 10 | 1175 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllFloatColumns); |
| 10 | 1176 | | } |
| | 1177 | |
|
| | 1178 | | /// <inheritdoc /> |
| | 1179 | | public override double GetDouble(int rowIdentifier, int columnIdentifier) |
| 10 | 1180 | | { |
| 10 | 1181 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllDoubleColumns); |
| 10 | 1182 | | } |
| | 1183 | |
|
| | 1184 | | /// <inheritdoc /> |
| | 1185 | | public override Vector2 GetVector2(int rowIdentifier, int columnIdentifier) |
| 10 | 1186 | | { |
| 10 | 1187 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllVector2Columns); |
| 10 | 1188 | | } |
| | 1189 | |
|
| | 1190 | | /// <inheritdoc /> |
| | 1191 | | public override Vector3 GetVector3(int rowIdentifier, int columnIdentifier) |
| 10 | 1192 | | { |
| 10 | 1193 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllVector3Columns); |
| 10 | 1194 | | } |
| | 1195 | |
|
| | 1196 | | /// <inheritdoc /> |
| | 1197 | | public override Vector4 GetVector4(int rowIdentifier, int columnIdentifier) |
| 10 | 1198 | | { |
| 10 | 1199 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllVector4Columns); |
| 10 | 1200 | | } |
| | 1201 | |
|
| | 1202 | | /// <inheritdoc /> |
| | 1203 | | public override Vector2Int GetVector2Int(int rowIdentifier, int columnIdentifier) |
| 10 | 1204 | | { |
| 10 | 1205 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllVector2IntColumns); |
| 10 | 1206 | | } |
| | 1207 | |
|
| | 1208 | | /// <inheritdoc /> |
| | 1209 | | public override Vector3Int GetVector3Int(int rowIdentifier, int columnIdentifier) |
| 10 | 1210 | | { |
| 10 | 1211 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllVector3IntColumns); |
| 10 | 1212 | | } |
| | 1213 | |
|
| | 1214 | | /// <inheritdoc /> |
| | 1215 | | public override Quaternion GetQuaternion(int rowIdentifier, int columnIdentifier) |
| 10 | 1216 | | { |
| 10 | 1217 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllQuaternionColumns); |
| 10 | 1218 | | } |
| | 1219 | |
|
| | 1220 | | /// <inheritdoc /> |
| | 1221 | | public override Rect GetRect(int rowIdentifier, int columnIdentifier) |
| 10 | 1222 | | { |
| 10 | 1223 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllRectColumns); |
| 10 | 1224 | | } |
| | 1225 | |
|
| | 1226 | | /// <inheritdoc /> |
| | 1227 | | public override RectInt GetRectInt(int rowIdentifier, int columnIdentifier) |
| 10 | 1228 | | { |
| 10 | 1229 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllRectIntColumns); |
| 10 | 1230 | | } |
| | 1231 | |
|
| | 1232 | | /// <inheritdoc /> |
| | 1233 | | public override Color GetColor(int rowIdentifier, int columnIdentifier) |
| 10 | 1234 | | { |
| 10 | 1235 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllColorColumns); |
| 10 | 1236 | | } |
| | 1237 | |
|
| | 1238 | | /// <inheritdoc /> |
| | 1239 | | public override LayerMask GetLayerMask(int rowIdentifier, int columnIdentifier) |
| 10 | 1240 | | { |
| 10 | 1241 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllLayerMaskColumns); |
| 10 | 1242 | | } |
| | 1243 | |
|
| | 1244 | | /// <inheritdoc /> |
| | 1245 | | public override Bounds GetBounds(int rowIdentifier, int columnIdentifier) |
| 10 | 1246 | | { |
| 10 | 1247 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllBoundsColumns); |
| 10 | 1248 | | } |
| | 1249 | |
|
| | 1250 | | /// <inheritdoc /> |
| | 1251 | | public override BoundsInt GetBoundsInt(int rowIdentifier, int columnIdentifier) |
| 10 | 1252 | | { |
| 10 | 1253 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllBoundsIntColumns); |
| 10 | 1254 | | } |
| | 1255 | |
|
| | 1256 | | /// <inheritdoc /> |
| | 1257 | | public override Hash128 GetHash128(int rowIdentifier, int columnIdentifier) |
| 10 | 1258 | | { |
| 10 | 1259 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllHash128Columns); |
| 10 | 1260 | | } |
| | 1261 | |
|
| | 1262 | | /// <inheritdoc /> |
| | 1263 | | public override Gradient GetGradient(int rowIdentifier, int columnIdentifier) |
| 10 | 1264 | | { |
| 10 | 1265 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllGradientColumns); |
| 10 | 1266 | | } |
| | 1267 | |
|
| | 1268 | | /// <inheritdoc /> |
| | 1269 | | public override AnimationCurve GetAnimationCurve(int rowIdentifier, int columnIdentifier) |
| 10 | 1270 | | { |
| 10 | 1271 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllAnimationCurveColumns); |
| 10 | 1272 | | } |
| | 1273 | |
|
| | 1274 | | /// <inheritdoc /> |
| | 1275 | | public override Object GetObject(int rowIdentifier, int columnIdentifier) |
| 10 | 1276 | | { |
| 10 | 1277 | | return GetCell(rowIdentifier, columnIdentifier, ref m_AllObjectRefColumns); |
| 10 | 1278 | | } |
| | 1279 | |
|
| | 1280 | | // Get ref |
| | 1281 | |
|
| | 1282 | | public ref string GetStringRef(int row, int column) |
| 10 | 1283 | | { |
| 10 | 1284 | | return ref GetCellRef(row, column, ref m_AllStringColumns); |
| 10 | 1285 | | } |
| | 1286 | |
|
| | 1287 | | public ref bool GetBoolRef(int row, int column) |
| 10 | 1288 | | { |
| 10 | 1289 | | return ref GetCellRef(row, column, ref m_AllBoolColumns); |
| 10 | 1290 | | } |
| | 1291 | |
|
| | 1292 | | public ref char GetCharRef(int row, int column) |
| 10 | 1293 | | { |
| 10 | 1294 | | return ref GetCellRef(row, column, ref m_AllCharColumns); |
| 10 | 1295 | | } |
| | 1296 | |
|
| | 1297 | | public ref sbyte GetSbyteRef(int row, int column) |
| 10 | 1298 | | { |
| 10 | 1299 | | return ref GetCellRef(row, column, ref m_AllSByteColumns); |
| 10 | 1300 | | } |
| | 1301 | |
|
| | 1302 | | public ref byte GetByteRef(int row, int columnID) |
| 10 | 1303 | | { |
| 10 | 1304 | | return ref GetCellRef(row, columnID, ref m_AllByteColumns); |
| 10 | 1305 | | } |
| | 1306 | |
|
| | 1307 | | public ref short GetShortRef(int row, int column) |
| 10 | 1308 | | { |
| 10 | 1309 | | return ref GetCellRef(row, column, ref m_AllShortColumns); |
| 10 | 1310 | | } |
| | 1311 | |
|
| | 1312 | | public ref ushort GetUshortRef(int row, int column) |
| 10 | 1313 | | { |
| 10 | 1314 | | return ref GetCellRef(row, column, ref m_AllUShortColumns); |
| 10 | 1315 | | } |
| | 1316 | |
|
| | 1317 | | public ref int GetIntRef(int row, int column) |
| 10 | 1318 | | { |
| 10 | 1319 | | return ref GetCellRef(row, column, ref m_AllIntColumns); |
| 10 | 1320 | | } |
| | 1321 | |
|
| | 1322 | | public ref uint GetUintRef(int row, int column) |
| 10 | 1323 | | { |
| 10 | 1324 | | return ref GetCellRef(row, column, ref m_AllUIntColumns); |
| 10 | 1325 | | } |
| | 1326 | |
|
| | 1327 | | public ref long GetLongRef(int row, int column) |
| 10 | 1328 | | { |
| 10 | 1329 | | return ref GetCellRef(row, column, ref m_AllLongColumns); |
| 10 | 1330 | | } |
| | 1331 | |
|
| | 1332 | | public ref ulong GetUlongRef(int row, int column) |
| 10 | 1333 | | { |
| 10 | 1334 | | return ref GetCellRef(row, column, ref m_AllULongColumns); |
| 10 | 1335 | | } |
| | 1336 | |
|
| | 1337 | | public ref float GetFloatRef(int row, int column) |
| 10 | 1338 | | { |
| 10 | 1339 | | return ref GetCellRef(row, column, ref m_AllFloatColumns); |
| 10 | 1340 | | } |
| | 1341 | |
|
| | 1342 | | public ref double GetDoubleRef(int row, int column) |
| 10 | 1343 | | { |
| 10 | 1344 | | return ref GetCellRef(row, column, ref m_AllDoubleColumns); |
| 10 | 1345 | | } |
| | 1346 | |
|
| | 1347 | | public ref Vector2 GetVector2Ref(int row, int column) |
| 10 | 1348 | | { |
| 10 | 1349 | | return ref GetCellRef(row, column, ref m_AllVector2Columns); |
| 10 | 1350 | | } |
| | 1351 | |
|
| | 1352 | | public ref Vector3 GetVector3Ref(int row, int column) |
| 10 | 1353 | | { |
| 10 | 1354 | | return ref GetCellRef(row, column, ref m_AllVector3Columns); |
| 10 | 1355 | | } |
| | 1356 | |
|
| | 1357 | | public ref Vector4 GetVector4Ref(int row, int column) |
| 10 | 1358 | | { |
| 10 | 1359 | | return ref GetCellRef(row, column, ref m_AllVector4Columns); |
| 10 | 1360 | | } |
| | 1361 | |
|
| | 1362 | | public ref Vector2Int GetVector2IntRef(int row, int column) |
| 10 | 1363 | | { |
| 10 | 1364 | | return ref GetCellRef(row, column, ref m_AllVector2IntColumns); |
| 10 | 1365 | | } |
| | 1366 | |
|
| | 1367 | | public ref Vector3Int GetVector3IntRef(int row, int column) |
| 10 | 1368 | | { |
| 10 | 1369 | | return ref GetCellRef(row, column, ref m_AllVector3IntColumns); |
| 10 | 1370 | | } |
| | 1371 | |
|
| | 1372 | | public ref Quaternion GetQuaternionRef(int row, int column) |
| 10 | 1373 | | { |
| 10 | 1374 | | return ref GetCellRef(row, column, ref m_AllQuaternionColumns); |
| 10 | 1375 | | } |
| | 1376 | |
|
| | 1377 | | public ref Rect GetRectRef(int row, int column) |
| 10 | 1378 | | { |
| 10 | 1379 | | return ref GetCellRef(row, column, ref m_AllRectColumns); |
| 10 | 1380 | | } |
| | 1381 | |
|
| | 1382 | | public ref RectInt GetRectIntRef(int row, int column) |
| 10 | 1383 | | { |
| 10 | 1384 | | return ref GetCellRef(row, column, ref m_AllRectIntColumns); |
| 10 | 1385 | | } |
| | 1386 | |
|
| | 1387 | | public ref Color GetColorRef(int row, int column) |
| 10 | 1388 | | { |
| 10 | 1389 | | return ref GetCellRef(row, column, ref m_AllColorColumns); |
| 10 | 1390 | | } |
| | 1391 | |
|
| | 1392 | | public ref LayerMask GetLayerMaskRef(int row, int column) |
| 10 | 1393 | | { |
| 10 | 1394 | | return ref GetCellRef(row, column, ref m_AllLayerMaskColumns); |
| 10 | 1395 | | } |
| | 1396 | |
|
| | 1397 | | public ref Bounds GetBoundsRef(int row, int column) |
| 10 | 1398 | | { |
| 10 | 1399 | | return ref GetCellRef(row, column, ref m_AllBoundsColumns); |
| 10 | 1400 | | } |
| | 1401 | |
|
| | 1402 | | public ref BoundsInt GetBoundsIntRef(int row, int column) |
| 10 | 1403 | | { |
| 10 | 1404 | | return ref GetCellRef(row, column, ref m_AllBoundsIntColumns); |
| 10 | 1405 | | } |
| | 1406 | |
|
| | 1407 | | public ref Hash128 GetHash128Ref(int row, int column) |
| 10 | 1408 | | { |
| 10 | 1409 | | return ref GetCellRef(row, column, ref m_AllHash128Columns); |
| 10 | 1410 | | } |
| | 1411 | |
|
| | 1412 | | public ref Gradient GetGradientRef(int row, int column) |
| 10 | 1413 | | { |
| 10 | 1414 | | return ref GetCellRef(row, column, ref m_AllGradientColumns); |
| 10 | 1415 | | } |
| | 1416 | |
|
| | 1417 | | public ref AnimationCurve GetAnimationCurveRef(int row, int column) |
| 10 | 1418 | | { |
| 10 | 1419 | | return ref GetCellRef(row, column, ref m_AllAnimationCurveColumns); |
| 10 | 1420 | | } |
| | 1421 | |
|
| | 1422 | | public ref Object GetObjectRef(int row, int column) |
| 10 | 1423 | | { |
| 10 | 1424 | | return ref GetCellRef(row, column, ref m_AllObjectRefColumns); |
| 10 | 1425 | | } |
| | 1426 | |
|
| | 1427 | | // Get Column |
| | 1428 | |
|
| | 1429 | | public string[] GetStringColumn(int column) |
| 0 | 1430 | | { |
| 0 | 1431 | | return GetColumn(column, ref m_AllStringColumns); |
| 0 | 1432 | | } |
| | 1433 | |
|
| | 1434 | | public bool[] GetBoolColumn(int column) |
| 0 | 1435 | | { |
| 0 | 1436 | | return GetColumn(column, ref m_AllBoolColumns); |
| 0 | 1437 | | } |
| | 1438 | |
|
| | 1439 | | public char[] GetCharColumn(int column) |
| 0 | 1440 | | { |
| 0 | 1441 | | return GetColumn(column, ref m_AllCharColumns); |
| 0 | 1442 | | } |
| | 1443 | |
|
| | 1444 | | public sbyte[] GetSbyteColumn(int column) |
| 0 | 1445 | | { |
| 0 | 1446 | | return GetColumn(column, ref m_AllSByteColumns); |
| 0 | 1447 | | } |
| | 1448 | |
|
| | 1449 | | public byte[] GetByteColumn(int column) |
| 0 | 1450 | | { |
| 0 | 1451 | | return GetColumn(column, ref m_AllByteColumns); |
| 0 | 1452 | | } |
| | 1453 | |
|
| | 1454 | | public short[] GetShortColumn(int column) |
| 0 | 1455 | | { |
| 0 | 1456 | | return GetColumn(column, ref m_AllShortColumns); |
| 0 | 1457 | | } |
| | 1458 | |
|
| | 1459 | | public ushort[] GetUshortColumn(int column) |
| 0 | 1460 | | { |
| 0 | 1461 | | return GetColumn(column, ref m_AllUShortColumns); |
| 0 | 1462 | | } |
| | 1463 | |
|
| | 1464 | | public int[] GetIntColumn(int column) |
| 0 | 1465 | | { |
| 0 | 1466 | | return GetColumn(column, ref m_AllIntColumns); |
| 0 | 1467 | | } |
| | 1468 | |
|
| | 1469 | | public uint[] GetUintColumn(int column) |
| 0 | 1470 | | { |
| 0 | 1471 | | return GetColumn(column, ref m_AllUIntColumns); |
| 0 | 1472 | | } |
| | 1473 | |
|
| | 1474 | | public long[] GetLongColumn(int column) |
| 0 | 1475 | | { |
| 0 | 1476 | | return GetColumn(column, ref m_AllLongColumns); |
| 0 | 1477 | | } |
| | 1478 | |
|
| | 1479 | | public ulong[] GetUlongColumn(int column) |
| 0 | 1480 | | { |
| 0 | 1481 | | return GetColumn(column, ref m_AllULongColumns); |
| 0 | 1482 | | } |
| | 1483 | |
|
| | 1484 | | public float[] GetFloatColumn(int column) |
| 0 | 1485 | | { |
| 0 | 1486 | | return GetColumn(column, ref m_AllFloatColumns); |
| 0 | 1487 | | } |
| | 1488 | |
|
| | 1489 | | public double[] GetDoubleColumn(int column) |
| 0 | 1490 | | { |
| 0 | 1491 | | return GetColumn(column, ref m_AllDoubleColumns); |
| 0 | 1492 | | } |
| | 1493 | |
|
| | 1494 | | public Vector2[] GetVector2Column(int column) |
| 0 | 1495 | | { |
| 0 | 1496 | | return GetColumn(column, ref m_AllVector2Columns); |
| 0 | 1497 | | } |
| | 1498 | |
|
| | 1499 | | public Vector3[] GetVector3Column(int column) |
| 0 | 1500 | | { |
| 0 | 1501 | | return GetColumn(column, ref m_AllVector3Columns); |
| 0 | 1502 | | } |
| | 1503 | |
|
| | 1504 | | public Vector4[] GetVector4Column(int column) |
| 0 | 1505 | | { |
| 0 | 1506 | | return GetColumn(column, ref m_AllVector4Columns); |
| 0 | 1507 | | } |
| | 1508 | |
|
| | 1509 | | public Vector2Int[] GetVector2IntColumn(int column) |
| 0 | 1510 | | { |
| 0 | 1511 | | return GetColumn(column, ref m_AllVector2IntColumns); |
| 0 | 1512 | | } |
| | 1513 | |
|
| | 1514 | | public Vector3Int[] GetVector3IntColumn(int column) |
| 0 | 1515 | | { |
| 0 | 1516 | | return GetColumn(column, ref m_AllVector3IntColumns); |
| 0 | 1517 | | } |
| | 1518 | |
|
| | 1519 | | public Quaternion[] GetQuaternionColumn(int column) |
| 0 | 1520 | | { |
| 0 | 1521 | | return GetColumn(column, ref m_AllQuaternionColumns); |
| 0 | 1522 | | } |
| | 1523 | |
|
| | 1524 | | public Rect[] GetRectColumn(int column) |
| 0 | 1525 | | { |
| 0 | 1526 | | return GetColumn(column, ref m_AllRectColumns); |
| 0 | 1527 | | } |
| | 1528 | |
|
| | 1529 | | public RectInt[] GetRectIntColumn(int column) |
| 0 | 1530 | | { |
| 0 | 1531 | | return GetColumn(column, ref m_AllRectIntColumns); |
| 0 | 1532 | | } |
| | 1533 | |
|
| | 1534 | | public Color[] GetColorColumn(int column) |
| 0 | 1535 | | { |
| 0 | 1536 | | return GetColumn(column, ref m_AllColorColumns); |
| 0 | 1537 | | } |
| | 1538 | |
|
| | 1539 | | public LayerMask[] GetLayerMaskColumn(int column) |
| 0 | 1540 | | { |
| 0 | 1541 | | return GetColumn(column, ref m_AllLayerMaskColumns); |
| 0 | 1542 | | } |
| | 1543 | |
|
| | 1544 | | public Bounds[] GetBoundsColumn(int column) |
| 0 | 1545 | | { |
| 0 | 1546 | | return GetColumn(column, ref m_AllBoundsColumns); |
| 0 | 1547 | | } |
| | 1548 | |
|
| | 1549 | | public BoundsInt[] GetBoundsIntColumn(int column) |
| 0 | 1550 | | { |
| 0 | 1551 | | return GetColumn(column, ref m_AllBoundsIntColumns); |
| 0 | 1552 | | } |
| | 1553 | |
|
| | 1554 | | public Hash128[] GetHash128Column(int column) |
| 0 | 1555 | | { |
| 0 | 1556 | | return GetColumn(column, ref m_AllHash128Columns); |
| 0 | 1557 | | } |
| | 1558 | |
|
| | 1559 | | public Gradient[] GetGradientColumn(int column) |
| 0 | 1560 | | { |
| 0 | 1561 | | return GetColumn(column, ref m_AllGradientColumns); |
| 0 | 1562 | | } |
| | 1563 | |
|
| | 1564 | | public AnimationCurve[] GetAnimationCurveColumn(int column) |
| 0 | 1565 | | { |
| 0 | 1566 | | return GetColumn(column, ref m_AllAnimationCurveColumns); |
| 0 | 1567 | | } |
| | 1568 | |
|
| | 1569 | | public Object[] GetObjectColumn(int column) |
| 0 | 1570 | | { |
| 0 | 1571 | | return GetColumn(column, ref m_AllObjectRefColumns); |
| 0 | 1572 | | } |
| | 1573 | |
|
| | 1574 | | // SetOrder |
| | 1575 | |
|
| | 1576 | | /// <inheritdoc /> |
| | 1577 | | public override int GetColumnOrder(int columnIdentifier) |
| 0 | 1578 | | { |
| 0 | 1579 | | return m_ColumnIdentifierToSortOrderMap[columnIdentifier]; |
| 0 | 1580 | | } |
| | 1581 | |
|
| | 1582 | | /// <inheritdoc /> |
| | 1583 | | public override void SetColumnOrder(int columnIdentifier, int newSortOrder) |
| 0 | 1584 | | { |
| 0 | 1585 | | AssertColumnIdentifierValid(columnIdentifier); |
| 0 | 1586 | | AssertColumnSortOrderValid(newSortOrder); |
| 0 | 1587 | | int oldSortOrder = m_ColumnIdentifierToSortOrderMap[columnIdentifier]; |
| 0 | 1588 | | int iterDirection = newSortOrder > oldSortOrder ? 1 : -1; |
| 0 | 1589 | | for (int i = oldSortOrder; i != newSortOrder; i += iterDirection) |
| 0 | 1590 | | { |
| 0 | 1591 | | int columnIDAt = m_SortedOrderToColumnIdentifierMap[i + iterDirection]; |
| 0 | 1592 | | m_ColumnIdentifierToSortOrderMap[columnIDAt] = i; |
| 0 | 1593 | | m_SortedOrderToColumnIdentifierMap[i] = m_SortedOrderToColumnIdentifierMap[i + iterDirection]; |
| 0 | 1594 | | } |
| | 1595 | |
|
| 0 | 1596 | | m_SortedOrderToColumnIdentifierMap[newSortOrder] = columnIdentifier; |
| 0 | 1597 | | m_ColumnIdentifierToSortOrderMap[columnIdentifier] = newSortOrder; |
| 0 | 1598 | | } |
| | 1599 | |
|
| | 1600 | | /// <inheritdoc /> |
| | 1601 | | public override void SetAllColumnOrders(int[] orderedColumnIdentifiers) |
| 0 | 1602 | | { |
| 0 | 1603 | | AssertSortedColumnsArgValid(orderedColumnIdentifiers); |
| 0 | 1604 | | for (int i = 0; i < m_SortedOrderToColumnIdentifierMap.Length; i++) |
| 0 | 1605 | | { |
| 0 | 1606 | | int columnID = orderedColumnIdentifiers[i]; |
| 0 | 1607 | | m_SortedOrderToColumnIdentifierMap[i] = columnID; |
| 0 | 1608 | | m_ColumnIdentifierToSortOrderMap[columnID] = i; |
| 0 | 1609 | | } |
| 0 | 1610 | | } |
| | 1611 | |
|
| | 1612 | | /// <inheritdoc /> |
| | 1613 | | public override int GetRowOrder(int rowIdentifier) |
| 0 | 1614 | | { |
| 0 | 1615 | | return m_RowIdentifierToDenseIndexMap[rowIdentifier]; |
| 0 | 1616 | | } |
| | 1617 | |
|
| | 1618 | | /// <inheritdoc /> |
| | 1619 | | public override void SetRowOrder(int rowIdentifier, int newSortOrder) |
| 0 | 1620 | | { |
| 0 | 1621 | | AssertRowIdentifierValid(rowIdentifier); |
| 0 | 1622 | | AssertRowSortOrderValid(newSortOrder); |
| | 1623 | |
|
| 0 | 1624 | | int oldSortOrder = m_RowIdentifierToDenseIndexMap[rowIdentifier]; |
| 0 | 1625 | | int iterDirection = newSortOrder > oldSortOrder ? 1 : -1; |
| 0 | 1626 | | string rowName = m_RowNames[oldSortOrder]; |
| | 1627 | |
|
| 0 | 1628 | | for (int i = oldSortOrder; i != newSortOrder; i += iterDirection) |
| 0 | 1629 | | { |
| 0 | 1630 | | int rowIDAt = m_RowDenseIndexToIDMap[i + iterDirection]; |
| 0 | 1631 | | m_RowIdentifierToDenseIndexMap[rowIDAt] = i; |
| 0 | 1632 | | m_RowDenseIndexToIDMap[i] = rowIDAt; |
| 0 | 1633 | | m_RowNames[i] = m_RowNames[i + iterDirection]; |
| 0 | 1634 | | } |
| | 1635 | |
|
| 0 | 1636 | | m_RowDenseIndexToIDMap[newSortOrder] = rowIdentifier; |
| 0 | 1637 | | m_RowIdentifierToDenseIndexMap[rowIdentifier] = newSortOrder; |
| 0 | 1638 | | m_RowNames[newSortOrder] = rowName; |
| | 1639 | |
|
| 0 | 1640 | | SetRowOrderForColumns(m_AllStringColumns, oldSortOrder, newSortOrder); |
| 0 | 1641 | | SetRowOrderForColumns(m_AllBoolColumns, oldSortOrder, newSortOrder); |
| 0 | 1642 | | SetRowOrderForColumns(m_AllCharColumns, oldSortOrder, newSortOrder); |
| 0 | 1643 | | SetRowOrderForColumns(m_AllSByteColumns, oldSortOrder, newSortOrder); |
| 0 | 1644 | | SetRowOrderForColumns(m_AllByteColumns, oldSortOrder, newSortOrder); |
| 0 | 1645 | | SetRowOrderForColumns(m_AllShortColumns, oldSortOrder, newSortOrder); |
| 0 | 1646 | | SetRowOrderForColumns(m_AllUShortColumns, oldSortOrder, newSortOrder); |
| 0 | 1647 | | SetRowOrderForColumns(m_AllIntColumns, oldSortOrder, newSortOrder); |
| 0 | 1648 | | SetRowOrderForColumns(m_AllUIntColumns, oldSortOrder, newSortOrder); |
| 0 | 1649 | | SetRowOrderForColumns(m_AllLongColumns, oldSortOrder, newSortOrder); |
| 0 | 1650 | | SetRowOrderForColumns(m_AllULongColumns, oldSortOrder, newSortOrder); |
| 0 | 1651 | | SetRowOrderForColumns(m_AllFloatColumns, oldSortOrder, newSortOrder); |
| 0 | 1652 | | SetRowOrderForColumns(m_AllDoubleColumns, oldSortOrder, newSortOrder); |
| 0 | 1653 | | SetRowOrderForColumns(m_AllVector2Columns, oldSortOrder, newSortOrder); |
| 0 | 1654 | | SetRowOrderForColumns(m_AllVector3Columns, oldSortOrder, newSortOrder); |
| 0 | 1655 | | SetRowOrderForColumns(m_AllVector4Columns, oldSortOrder, newSortOrder); |
| 0 | 1656 | | SetRowOrderForColumns(m_AllVector2IntColumns, oldSortOrder, newSortOrder); |
| 0 | 1657 | | SetRowOrderForColumns(m_AllVector3IntColumns, oldSortOrder, newSortOrder); |
| 0 | 1658 | | SetRowOrderForColumns(m_AllQuaternionColumns, oldSortOrder, newSortOrder); |
| 0 | 1659 | | SetRowOrderForColumns(m_AllRectColumns, oldSortOrder, newSortOrder); |
| 0 | 1660 | | SetRowOrderForColumns(m_AllRectIntColumns, oldSortOrder, newSortOrder); |
| 0 | 1661 | | SetRowOrderForColumns(m_AllColorColumns, oldSortOrder, newSortOrder); |
| 0 | 1662 | | SetRowOrderForColumns(m_AllLayerMaskColumns, oldSortOrder, newSortOrder); |
| 0 | 1663 | | SetRowOrderForColumns(m_AllBoundsColumns, oldSortOrder, newSortOrder); |
| 0 | 1664 | | SetRowOrderForColumns(m_AllBoundsIntColumns, oldSortOrder, newSortOrder); |
| 0 | 1665 | | SetRowOrderForColumns(m_AllHash128Columns, oldSortOrder, newSortOrder); |
| 0 | 1666 | | SetRowOrderForColumns(m_AllGradientColumns, oldSortOrder, newSortOrder); |
| 0 | 1667 | | SetRowOrderForColumns(m_AllAnimationCurveColumns, oldSortOrder, newSortOrder); |
| 0 | 1668 | | SetRowOrderForColumns(m_AllObjectRefColumns, oldSortOrder, newSortOrder); |
| 0 | 1669 | | SetRowOrderForColumns(m_AllEnumIntColumns, oldSortOrder, newSortOrder); |
| 0 | 1670 | | } |
| | 1671 | |
|
| | 1672 | | /// <inheritdoc /> |
| | 1673 | | public override void SetAllRowOrders(int[] orderedRowIdentifiers) |
| 0 | 1674 | | { |
| 0 | 1675 | | AssertSortRowsArgValid(orderedRowIdentifiers); |
| | 1676 | |
|
| 0 | 1677 | | ReSortRows(m_AllStringColumns, orderedRowIdentifiers); |
| 0 | 1678 | | ReSortRows(m_AllBoolColumns, orderedRowIdentifiers); |
| 0 | 1679 | | ReSortRows(m_AllCharColumns, orderedRowIdentifiers); |
| 0 | 1680 | | ReSortRows(m_AllSByteColumns, orderedRowIdentifiers); |
| 0 | 1681 | | ReSortRows(m_AllByteColumns, orderedRowIdentifiers); |
| 0 | 1682 | | ReSortRows(m_AllShortColumns, orderedRowIdentifiers); |
| 0 | 1683 | | ReSortRows(m_AllUShortColumns, orderedRowIdentifiers); |
| 0 | 1684 | | ReSortRows(m_AllIntColumns, orderedRowIdentifiers); |
| 0 | 1685 | | ReSortRows(m_AllUIntColumns, orderedRowIdentifiers); |
| 0 | 1686 | | ReSortRows(m_AllLongColumns, orderedRowIdentifiers); |
| 0 | 1687 | | ReSortRows(m_AllULongColumns, orderedRowIdentifiers); |
| 0 | 1688 | | ReSortRows(m_AllFloatColumns, orderedRowIdentifiers); |
| 0 | 1689 | | ReSortRows(m_AllDoubleColumns, orderedRowIdentifiers); |
| 0 | 1690 | | ReSortRows(m_AllVector2Columns, orderedRowIdentifiers); |
| 0 | 1691 | | ReSortRows(m_AllVector3Columns, orderedRowIdentifiers); |
| 0 | 1692 | | ReSortRows(m_AllVector4Columns, orderedRowIdentifiers); |
| 0 | 1693 | | ReSortRows(m_AllVector2IntColumns, orderedRowIdentifiers); |
| 0 | 1694 | | ReSortRows(m_AllVector3IntColumns, orderedRowIdentifiers); |
| 0 | 1695 | | ReSortRows(m_AllQuaternionColumns, orderedRowIdentifiers); |
| 0 | 1696 | | ReSortRows(m_AllRectColumns, orderedRowIdentifiers); |
| 0 | 1697 | | ReSortRows(m_AllRectIntColumns, orderedRowIdentifiers); |
| 0 | 1698 | | ReSortRows(m_AllColorColumns, orderedRowIdentifiers); |
| 0 | 1699 | | ReSortRows(m_AllLayerMaskColumns, orderedRowIdentifiers); |
| 0 | 1700 | | ReSortRows(m_AllBoundsColumns, orderedRowIdentifiers); |
| 0 | 1701 | | ReSortRows(m_AllBoundsIntColumns, orderedRowIdentifiers); |
| 0 | 1702 | | ReSortRows(m_AllHash128Columns, orderedRowIdentifiers); |
| 0 | 1703 | | ReSortRows(m_AllGradientColumns, orderedRowIdentifiers); |
| 0 | 1704 | | ReSortRows(m_AllAnimationCurveColumns, orderedRowIdentifiers); |
| 0 | 1705 | | ReSortRows(m_AllObjectRefColumns, orderedRowIdentifiers); |
| 0 | 1706 | | ReSortRows(m_AllEnumIntColumns, orderedRowIdentifiers); |
| | 1707 | |
|
| 0 | 1708 | | int namesCount = m_RowNames?.Length ?? 0; |
| 0 | 1709 | | string[] newNames = new string[namesCount]; |
| 0 | 1710 | | for (int i = 0; i < namesCount; i++) |
| 0 | 1711 | | { |
| 0 | 1712 | | int rowID = orderedRowIdentifiers[i]; |
| 0 | 1713 | | int oldRowIndex = m_RowIdentifierToDenseIndexMap[rowID]; |
| | 1714 | |
|
| 0 | 1715 | | newNames[i] = m_RowNames[oldRowIndex]; |
| 0 | 1716 | | } |
| | 1717 | |
|
| 0 | 1718 | | m_RowNames = newNames; |
| | 1719 | |
|
| 0 | 1720 | | for (int i = 0; i < orderedRowIdentifiers.Length; i++) |
| 0 | 1721 | | { |
| 0 | 1722 | | int rowID = orderedRowIdentifiers[i]; |
| 0 | 1723 | | m_RowDenseIndexToIDMap[i] = rowID; |
| 0 | 1724 | | m_RowIdentifierToDenseIndexMap[rowID] = i; |
| 0 | 1725 | | } |
| 0 | 1726 | | } |
| | 1727 | |
|
| | 1728 | | internal void ReSortRows<T>(ArrayHolder<T>[] columns, int[] sortedRowIDs) |
| 0 | 1729 | | { |
| 0 | 1730 | | int columnCount = columns?.Length ?? 0; |
| 0 | 1731 | | for (int i = 0; i < columnCount; i++) |
| 0 | 1732 | | { |
| 0 | 1733 | | T[] column = columns[i].TArray; |
| 0 | 1734 | | T[] newColumn = new T[column.Length]; |
| 0 | 1735 | | for (int j = 0; j < sortedRowIDs.Length; j++) |
| 0 | 1736 | | { |
| 0 | 1737 | | int rowID = sortedRowIDs[j]; |
| 0 | 1738 | | int oldRowIndex = m_RowIdentifierToDenseIndexMap[rowID]; |
| | 1739 | |
|
| 0 | 1740 | | newColumn[j] = column[oldRowIndex]; |
| 0 | 1741 | | } |
| | 1742 | |
|
| 0 | 1743 | | columns[i].TArray = newColumn; |
| 0 | 1744 | | } |
| 0 | 1745 | | } |
| | 1746 | |
|
| | 1747 | | // Internal |
| | 1748 | |
|
| | 1749 | | internal void AddTypeNameEntry(ref string[] typeNames, string defaultString) |
| 7 | 1750 | | { |
| 7 | 1751 | | int nameArrayLength = typeNames?.Length ?? 0; |
| 7 | 1752 | | Array.Resize(ref typeNames, nameArrayLength + 1); |
| 7 | 1753 | | typeNames[nameArrayLength] = defaultString; |
| 7 | 1754 | | } |
| | 1755 | |
|
| | 1756 | | internal void RemoveTypeNameEntry(int columnDenseIndex, ref string[] typeNames) |
| 0 | 1757 | | { |
| 0 | 1758 | | int nameArrayLength = typeNames?.Length ?? 0; |
| 0 | 1759 | | typeNames[columnDenseIndex] = typeNames[nameArrayLength - 1]; |
| 0 | 1760 | | Array.Resize(ref typeNames, nameArrayLength - 1); |
| 0 | 1761 | | } |
| | 1762 | |
|
| | 1763 | | internal int AddColumnInternal<T>(string columnName, ref ArrayHolder<T>[] allColumnsOfType, |
| | 1764 | | Serializable.SerializableTypes typeIndex, int insertAtColumnIdentifier) |
| 114 | 1765 | | { |
| 114 | 1766 | | if (insertAtColumnIdentifier >= 0) |
| 0 | 1767 | | { |
| 0 | 1768 | | AssertColumnIdentifierValid(insertAtColumnIdentifier); |
| 0 | 1769 | | } |
| | 1770 | |
|
| 114 | 1771 | | int columnCount = allColumnsOfType?.Length ?? 0; |
| 114 | 1772 | | Array.Resize(ref allColumnsOfType, columnCount + 1); |
| 114 | 1773 | | allColumnsOfType[columnCount].TArray = new T[m_RowCount]; |
| | 1774 | |
|
| 114 | 1775 | | int columnID = m_ColumnEntriesFreeListHead; |
| 114 | 1776 | | string[] columnNamesForType = m_AllColumnNames[(int)typeIndex].TArray; |
| 114 | 1777 | | int columnNamesCount = columnNamesForType?.Length ?? 0; |
| 114 | 1778 | | Array.Resize(ref columnNamesForType, columnNamesCount + 1); |
| 114 | 1779 | | columnNamesForType[columnNamesCount] = columnName == null ? columnID.ToString() : columnName; |
| 114 | 1780 | | m_AllColumnNames[(int)typeIndex].TArray = columnNamesForType; |
| | 1781 | |
|
| | 1782 | |
|
| 114 | 1783 | | int columnIDToDenseIndexMapLength = m_ColumnIdentifierToDenseIndexMap?.Length ?? 0; |
| 114 | 1784 | | if (columnID >= columnIDToDenseIndexMapLength) |
| 31 | 1785 | | { |
| 31 | 1786 | | int newSize = columnIDToDenseIndexMapLength * 2; |
| 31 | 1787 | | newSize = newSize == 0 ? 1 : newSize; |
| 31 | 1788 | | Array.Resize(ref m_ColumnIdentifierToDenseIndexMap, newSize); |
| 312 | 1789 | | for (int i = columnIDToDenseIndexMapLength; i < newSize; i++) |
| 125 | 1790 | | { |
| 125 | 1791 | | ref ColumnEntry entry = ref m_ColumnIdentifierToDenseIndexMap[i]; |
| 125 | 1792 | | entry.ColumnDenseIndex = i + 1; |
| 125 | 1793 | | entry.ColumnType = Serializable.SerializableTypes.Invalid; |
| 125 | 1794 | | } |
| | 1795 | |
|
| 31 | 1796 | | Array.Resize(ref m_ColumnIdentifierToSortOrderMap, newSize); |
| 312 | 1797 | | for (int i = columnIDToDenseIndexMapLength; i < newSize; i++) |
| 125 | 1798 | | { |
| 125 | 1799 | | m_ColumnIdentifierToSortOrderMap[i] = -1; |
| 125 | 1800 | | } |
| 31 | 1801 | | } |
| | 1802 | |
|
| 114 | 1803 | | m_ColumnEntriesFreeListHead = m_ColumnIdentifierToDenseIndexMap[columnID].ColumnDenseIndex; |
| | 1804 | |
|
| 114 | 1805 | | ref int[] denseIndexToIDMap = ref m_ColumnDenseIndexToIDMap[(int)typeIndex].TArray; |
| 114 | 1806 | | int denseIndexToIDMapLength = denseIndexToIDMap?.Length ?? 0; |
| 114 | 1807 | | Array.Resize(ref denseIndexToIDMap, denseIndexToIDMapLength + 1); |
| 114 | 1808 | | denseIndexToIDMap[denseIndexToIDMapLength] = columnID; |
| | 1809 | |
|
| 114 | 1810 | | ref ColumnEntry newEntry = ref m_ColumnIdentifierToDenseIndexMap[columnID]; |
| 114 | 1811 | | newEntry.ColumnDenseIndex = denseIndexToIDMapLength; |
| 114 | 1812 | | newEntry.ColumnType = typeIndex; |
| | 1813 | |
|
| 114 | 1814 | | int insertAtSortedIndex = |
| | 1815 | | insertAtColumnIdentifier < 0 |
| | 1816 | | ? m_CombinedColumnCount |
| | 1817 | | : m_ColumnIdentifierToSortOrderMap[insertAtColumnIdentifier]; |
| 114 | 1818 | | Array.Resize(ref m_SortedOrderToColumnIdentifierMap, m_CombinedColumnCount + 1); |
| 228 | 1819 | | for (int i = m_CombinedColumnCount; i > insertAtSortedIndex; i--) |
| 0 | 1820 | | { |
| 0 | 1821 | | int currentColumnID = m_SortedOrderToColumnIdentifierMap[i - 1]; |
| 0 | 1822 | | m_SortedOrderToColumnIdentifierMap[i] = currentColumnID; |
| 0 | 1823 | | m_ColumnIdentifierToSortOrderMap[currentColumnID] = i; |
| 0 | 1824 | | } |
| | 1825 | |
|
| 114 | 1826 | | if (typeIndex == Serializable.SerializableTypes.Object) |
| 4 | 1827 | | { |
| 4 | 1828 | | AddTypeNameEntry(ref m_AllObjectRefTypeNames, Reflection.UnityObjectName); |
| 4 | 1829 | | } |
| | 1830 | |
|
| 114 | 1831 | | if (typeIndex == Serializable.SerializableTypes.EnumInt) |
| 3 | 1832 | | { |
| 3 | 1833 | | AddTypeNameEntry(ref m_AllEnumIntTypeNames, Reflection.SerializedTypesName); |
| 3 | 1834 | | } |
| | 1835 | |
|
| 114 | 1836 | | m_ColumnIdentifierToSortOrderMap[columnID] = insertAtSortedIndex; |
| 114 | 1837 | | m_SortedOrderToColumnIdentifierMap[insertAtSortedIndex] = columnID; |
| | 1838 | |
|
| 114 | 1839 | | ++m_CombinedColumnCount; |
| 114 | 1840 | | m_DataVersion++; |
| | 1841 | |
|
| 114 | 1842 | | return columnID; |
| 114 | 1843 | | } |
| | 1844 | |
|
| | 1845 | | internal void RemoveColumnInternal<T>(ref ArrayHolder<T>[] allColumnsOfType, |
| | 1846 | | Serializable.SerializableTypes typeIndex, int columnID) |
| 4 | 1847 | | { |
| 4 | 1848 | | AssertColumnIdentifierValid(columnID); |
| 4 | 1849 | | int columnLocation = m_ColumnIdentifierToDenseIndexMap[columnID].ColumnDenseIndex; |
| | 1850 | |
|
| 4 | 1851 | | int lastIndex = allColumnsOfType.Length - 1; |
| 4 | 1852 | | allColumnsOfType[columnLocation] = allColumnsOfType[lastIndex]; |
| 4 | 1853 | | Array.Resize(ref allColumnsOfType, lastIndex); |
| | 1854 | |
|
| 4 | 1855 | | ref string[] columnNamesOfType = ref m_AllColumnNames[(int)typeIndex].TArray; |
| 4 | 1856 | | columnNamesOfType[columnLocation] = columnNamesOfType[lastIndex]; |
| 4 | 1857 | | Array.Resize(ref columnNamesOfType, lastIndex); |
| | 1858 | |
|
| 4 | 1859 | | int columnOrder = m_ColumnIdentifierToSortOrderMap[columnID]; |
| | 1860 | |
|
| 4 | 1861 | | ref int[] denseIndicesOfType = ref m_ColumnDenseIndexToIDMap[(int)typeIndex].TArray; |
| 4 | 1862 | | int sparseIndexToSwap = denseIndicesOfType[lastIndex]; |
| | 1863 | |
|
| 4 | 1864 | | m_ColumnIdentifierToDenseIndexMap[sparseIndexToSwap].ColumnDenseIndex = columnLocation; |
| 4 | 1865 | | ref ColumnEntry sparseIndexToFree = ref m_ColumnIdentifierToDenseIndexMap[columnID]; |
| 4 | 1866 | | sparseIndexToFree.ColumnType = Serializable.SerializableTypes.Invalid; |
| 4 | 1867 | | sparseIndexToFree.ColumnDenseIndex = m_ColumnEntriesFreeListHead; |
| | 1868 | |
|
| 4 | 1869 | | m_ColumnEntriesFreeListHead = columnID; |
| | 1870 | |
|
| 4 | 1871 | | denseIndicesOfType[columnLocation] = sparseIndexToSwap; |
| 4 | 1872 | | Array.Resize(ref denseIndicesOfType, lastIndex); |
| | 1873 | |
|
| 4 | 1874 | | if (typeIndex == Serializable.SerializableTypes.Object) |
| 0 | 1875 | | { |
| 0 | 1876 | | RemoveTypeNameEntry(columnLocation, ref m_AllObjectRefTypeNames); |
| 0 | 1877 | | } |
| | 1878 | |
|
| 4 | 1879 | | if (typeIndex == Serializable.SerializableTypes.EnumInt) |
| 0 | 1880 | | { |
| 0 | 1881 | | RemoveTypeNameEntry(columnLocation, ref m_AllEnumIntTypeNames); |
| 0 | 1882 | | } |
| | 1883 | |
|
| 16 | 1884 | | for (int i = columnOrder + 1; i < m_CombinedColumnCount; i++) |
| 4 | 1885 | | { |
| 4 | 1886 | | int currentColumnID = m_SortedOrderToColumnIdentifierMap[i]; |
| 4 | 1887 | | m_SortedOrderToColumnIdentifierMap[i - 1] = currentColumnID; |
| 4 | 1888 | | m_ColumnIdentifierToSortOrderMap[currentColumnID] = i - 1; |
| 4 | 1889 | | } |
| | 1890 | |
|
| 4 | 1891 | | m_ColumnIdentifierToSortOrderMap[columnID] = -1; |
| | 1892 | |
|
| 4 | 1893 | | Array.Resize(ref m_SortedOrderToColumnIdentifierMap, m_CombinedColumnCount - 1); |
| | 1894 | |
|
| 4 | 1895 | | --m_CombinedColumnCount; |
| 4 | 1896 | | m_DataVersion++; |
| 4 | 1897 | | } |
| | 1898 | |
|
| | 1899 | | internal void InsertRowsOfTypeInternal<T>(ref ArrayHolder<T>[] allColumnsOfType, int insertAt, |
| | 1900 | | int numberOfNewRows) |
| 1680 | 1901 | | { |
| 1680 | 1902 | | int columnCount = allColumnsOfType?.Length ?? 0; |
| 4948 | 1903 | | for (int i = 0; i < columnCount; i++) |
| 794 | 1904 | | { |
| 794 | 1905 | | ref T[] rows = ref allColumnsOfType[i].TArray; |
| 794 | 1906 | | int newRowCount = m_RowCount + numberOfNewRows; |
| 794 | 1907 | | Array.Resize(ref rows, newRowCount); |
| 1588 | 1908 | | for (int j = newRowCount - 1; j > insertAt + numberOfNewRows - 1; j--) |
| 0 | 1909 | | { |
| 0 | 1910 | | rows[j] = rows[j - numberOfNewRows]; |
| 0 | 1911 | | } |
| | 1912 | |
|
| 3176 | 1913 | | for (int j = 0; j < numberOfNewRows; j++) |
| 794 | 1914 | | { |
| 794 | 1915 | | rows[insertAt + j] = default; |
| 794 | 1916 | | } |
| 794 | 1917 | | } |
| 1680 | 1918 | | } |
| | 1919 | |
|
| | 1920 | | internal void DeleteRowsOfTypeInternal<T>(ref ArrayHolder<T>[] allColumnsOfType, int removeAt, |
| | 1921 | | int numberOfRowsToDelete) |
| 0 | 1922 | | { |
| 0 | 1923 | | int columnCount = allColumnsOfType?.Length ?? 0; |
| | 1924 | |
|
| 0 | 1925 | | for (int i = 0; i < columnCount; i++) |
| 0 | 1926 | | { |
| 0 | 1927 | | ref T[] rows = ref allColumnsOfType[i].TArray; |
| 0 | 1928 | | int newRowCount = m_RowCount - numberOfRowsToDelete; |
| | 1929 | |
|
| 0 | 1930 | | for (int j = removeAt + numberOfRowsToDelete; j < m_RowCount; j++) |
| 0 | 1931 | | { |
| 0 | 1932 | | rows[j - numberOfRowsToDelete] = rows[j]; |
| 0 | 1933 | | } |
| | 1934 | |
|
| 0 | 1935 | | Array.Resize(ref rows, newRowCount); |
| 0 | 1936 | | } |
| 0 | 1937 | | } |
| | 1938 | |
|
| | 1939 | | internal ref T GetCellRef<T>(int rowID, int columnID, ref ArrayHolder<T>[] allColumnsOfType) |
| 290 | 1940 | | { |
| 290 | 1941 | | AssertColumnIdentifierValid(columnID); |
| 290 | 1942 | | AssertRowIdentifierValid(rowID); |
| 290 | 1943 | | int column = m_ColumnIdentifierToDenseIndexMap[columnID].ColumnDenseIndex; |
| 290 | 1944 | | int row = m_RowIdentifierToDenseIndexMap[rowID]; |
| 290 | 1945 | | return ref allColumnsOfType[column][row]; |
| 290 | 1946 | | } |
| | 1947 | |
|
| | 1948 | | internal T GetCell<T>(int rowID, int columnID, ref ArrayHolder<T>[] allColumnsOfType) |
| 290 | 1949 | | { |
| 290 | 1950 | | AssertColumnIdentifierValid(columnID); |
| 290 | 1951 | | AssertRowIdentifierValid(rowID); |
| 290 | 1952 | | int column = m_ColumnIdentifierToDenseIndexMap[columnID].ColumnDenseIndex; |
| 290 | 1953 | | int row = m_RowIdentifierToDenseIndexMap[rowID]; |
| 290 | 1954 | | return allColumnsOfType[column][row]; |
| 290 | 1955 | | } |
| | 1956 | |
|
| | 1957 | | internal ulong SetCell<T>(int rowID, int columnID, ref ArrayHolder<T>[] allColumnsOfType, T value) |
| 290 | 1958 | | { |
| 290 | 1959 | | AssertColumnIdentifierValid(columnID); |
| 290 | 1960 | | AssertRowIdentifierValid(rowID); |
| 290 | 1961 | | int column = m_ColumnIdentifierToDenseIndexMap[columnID].ColumnDenseIndex; |
| 290 | 1962 | | int row = m_RowIdentifierToDenseIndexMap[rowID]; |
| 290 | 1963 | | allColumnsOfType[column][row] = value; |
| 290 | 1964 | | m_DataVersion++; |
| 290 | 1965 | | return m_DataVersion; |
| 290 | 1966 | | } |
| | 1967 | |
|
| | 1968 | | internal T[] GetColumn<T>(int columnID, ref ArrayHolder<T>[] allColumnsOfType) |
| 0 | 1969 | | { |
| 0 | 1970 | | AssertColumnIdentifierValid(columnID); |
| 0 | 1971 | | int column = m_ColumnIdentifierToDenseIndexMap[columnID].ColumnDenseIndex; |
| 0 | 1972 | | return allColumnsOfType[column].TArray; |
| 0 | 1973 | | } |
| | 1974 | |
|
| | 1975 | | internal void SetRowOrderForColumns<T>(ArrayHolder<T>[] columns, int oldSortOrder, int newSortOrder) |
| 0 | 1976 | | { |
| 0 | 1977 | | int columnCount = columns?.Length ?? 0; |
| 0 | 1978 | | int iterDirection = newSortOrder > oldSortOrder ? 1 : -1; |
| 0 | 1979 | | for (int i = 0; i < columnCount; i++) |
| 0 | 1980 | | { |
| 0 | 1981 | | T[] column = columns[i].TArray; |
| | 1982 | |
|
| 0 | 1983 | | T value = column[oldSortOrder]; |
| | 1984 | |
|
| 0 | 1985 | | for (int j = oldSortOrder; j != newSortOrder; j += iterDirection) |
| 0 | 1986 | | { |
| 0 | 1987 | | column[j] = column[j + iterDirection]; |
| 0 | 1988 | | } |
| | 1989 | |
|
| 0 | 1990 | | column[newSortOrder] = value; |
| 0 | 1991 | | } |
| 0 | 1992 | | } |
| | 1993 | |
|
| | 1994 | | internal void AssertSortedColumnsArgValid(int[] sortedColumnIDs) |
| 0 | 1995 | | { |
| 0 | 1996 | | if (sortedColumnIDs == null) |
| 0 | 1997 | | { |
| 0 | 1998 | | throw new ArgumentException("sortedColumnIDs array cannot be null."); |
| | 1999 | | } |
| | 2000 | |
|
| 0 | 2001 | | if (sortedColumnIDs.Length != m_SortedOrderToColumnIdentifierMap.Length) |
| 0 | 2002 | | { |
| 0 | 2003 | | throw new ArgumentException("sortedColumnIDs array must be the same length as GetColumnCount."); |
| | 2004 | | } |
| | 2005 | |
|
| 0 | 2006 | | for (int i = 0; i < sortedColumnIDs.Length; i++) |
| 0 | 2007 | | { |
| 0 | 2008 | | AssertColumnIdentifierValid(sortedColumnIDs[i]); |
| 0 | 2009 | | } |
| 0 | 2010 | | } |
| | 2011 | |
|
| | 2012 | | internal void AssertColumnSortOrderValid(int sortedOrder) |
| 0 | 2013 | | { |
| 0 | 2014 | | if (sortedOrder >= m_CombinedColumnCount || sortedOrder < 0) |
| 0 | 2015 | | { |
| 0 | 2016 | | throw new ArgumentException("Invalid column sort order argument: " + sortedOrder); |
| | 2017 | | } |
| 0 | 2018 | | } |
| | 2019 | |
|
| | 2020 | | internal void AssertRowSortOrderValid(int sortedOrder) |
| 0 | 2021 | | { |
| 0 | 2022 | | if (sortedOrder >= m_RowCount || sortedOrder < 0) |
| 0 | 2023 | | { |
| 0 | 2024 | | throw new ArgumentException("Invalid row sort order argument: " + sortedOrder); |
| | 2025 | | } |
| 0 | 2026 | | } |
| | 2027 | |
|
| | 2028 | | internal void AssertSortRowsArgValid(int[] sortedRowIDs) |
| 0 | 2029 | | { |
| 0 | 2030 | | if (sortedRowIDs == null) |
| 0 | 2031 | | { |
| 0 | 2032 | | throw new ArgumentException("sortedRowIDs array cannot be null."); |
| | 2033 | | } |
| | 2034 | |
|
| 0 | 2035 | | if (sortedRowIDs.Length != m_RowDenseIndexToIDMap.Length) |
| 0 | 2036 | | { |
| 0 | 2037 | | throw new ArgumentException("sortedRowIDs array must be the same length as GetRowCount."); |
| | 2038 | | } |
| | 2039 | |
|
| 0 | 2040 | | for (int i = 0; i < sortedRowIDs.Length; i++) |
| 0 | 2041 | | { |
| 0 | 2042 | | AssertRowIdentifierValid(sortedRowIDs[i]); |
| 0 | 2043 | | } |
| 0 | 2044 | | } |
| | 2045 | |
|
| | 2046 | | [Serializable] |
| | 2047 | | internal struct ColumnEntry |
| | 2048 | | { |
| | 2049 | | public Serializable.SerializableTypes ColumnType; |
| | 2050 | | public int ColumnDenseIndex; |
| | 2051 | | } |
| | 2052 | | } |
| | 2053 | | } |