| 249 | } |
| 250 | |
| 251 | bool Sort(const int32 A, const int32 B) |
| 252 | { |
| 253 | if constexpr (bSoftMode) |
| 254 | { |
| 255 | int Result = 0; |
| 256 | for (const TSharedRef<FPCGExSortRule>& Rule : Rules) |
| 257 | { |
| 258 | const double ValueA = Rule->SoftCache->SoftGet(DataFacade->Source->GetInPointRef(A), 0); |
| 259 | const double ValueB = Rule->SoftCache->SoftGet(DataFacade->Source->GetInPointRef(B), 0); |
| 260 | Result = FMath::IsNearlyEqual(ValueA, ValueB, Rule->Tolerance) ? 0 : ValueA < ValueB ? -1 : 1; |
| 261 | if (Result != 0) |
| 262 | { |
| 263 | if (Rule->bInvertRule) { Result *= -1; } |
| 264 | break; |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | if (SortDirection == EPCGExSortDirection::Descending) { Result *= -1; } |
| 269 | return Result < 0; |
| 270 | } |
| 271 | else |
| 272 | { |
| 273 | int Result = 0; |
| 274 | for (const TSharedRef<FPCGExSortRule>& Rule : Rules) |
| 275 | { |
| 276 | const double ValueA = Rule->Cache->Read(A); |
| 277 | const double ValueB = Rule->Cache->Read(B); |
| 278 | Result = FMath::IsNearlyEqual(ValueA, ValueB, Rule->Tolerance) ? 0 : ValueA < ValueB ? -1 : 1; |
| 279 | if (Result != 0) |
| 280 | { |
| 281 | if (Rule->bInvertRule) { Result *= -1; } |
| 282 | break; |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | if (SortDirection == EPCGExSortDirection::Descending) { Result *= -1; } |
| 287 | return Result < 0; |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | bool Sort(const FPCGPoint& A, const FPCGPoint& B) |
| 292 | { |
no test coverage detected