-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expanded the counting features in the schema and implemented the corresponding rules. This included adding specific counts for distinct, positive, negative, zero, even, odd, and prime values. This enhancement now allows greater flexibility for users working with different data sets.
- Loading branch information
Showing
25 changed files
with
868 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
/** | ||
* JBZoo Toolbox - Csv-Blueprint. | ||
* | ||
* This file is part of the JBZoo Toolbox project. | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @license MIT | ||
* @copyright Copyright (C) JBZoo.com, All rights reserved. | ||
* @see https://github.com/JBZoo/Csv-Blueprint | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace JBZoo\CsvBlueprint\Rules\Aggregate; | ||
|
||
use JBZoo\CsvBlueprint\Rules\AbstarctRule; | ||
|
||
final class ComboCountDistinct extends AbstarctAggregateRuleCombo | ||
{ | ||
public const INPUT_TYPE = AbstarctRule::INPUT_TYPE_STRINGS; | ||
|
||
protected const NAME = 'number of unique values'; | ||
|
||
public function getHelpMeta(): array | ||
{ | ||
return [['Number of unique values.'], []]; | ||
} | ||
|
||
protected function getActualAggregate(array $colValues): ?float | ||
{ | ||
if (\count($colValues) === 0) { | ||
return null; | ||
} | ||
|
||
return \count(\array_unique($colValues)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
/** | ||
* JBZoo Toolbox - Csv-Blueprint. | ||
* | ||
* This file is part of the JBZoo Toolbox project. | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @license MIT | ||
* @copyright Copyright (C) JBZoo.com, All rights reserved. | ||
* @see https://github.com/JBZoo/Csv-Blueprint | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace JBZoo\CsvBlueprint\Rules\Aggregate; | ||
|
||
use JBZoo\CsvBlueprint\Rules\AbstarctRule; | ||
|
||
final class ComboCountEven extends AbstarctAggregateRuleCombo | ||
{ | ||
public const INPUT_TYPE = AbstarctRule::INPUT_TYPE_FLOATS; | ||
|
||
protected const NAME = 'number of even values'; | ||
|
||
public function getHelpMeta(): array | ||
{ | ||
return [['Number of even values.'], []]; | ||
} | ||
|
||
protected function getActualAggregate(array $colValues): ?float | ||
{ | ||
if (\count($colValues) === 0) { | ||
return null; | ||
} | ||
|
||
return \count(\array_filter(self::stringsToFloat($colValues), static fn ($value) => $value % 2 === 0)); | ||
} | ||
} |
Oops, something went wrong.