{"action":"created","issue":{"url":"https://api.github.com/repos/marc-mabe/php-enum/issues/74","repository_url":"https://api.github.com/repos/marc-mabe/php-enum","labels_url":"https://api.github.com/repos/marc-mabe/php-enum/issues/74/labels{/name}","comments_url":"https://api.github.com/repos/marc-mabe/php-enum/issues/74/comments","events_url":"https://api.github.com/repos/marc-mabe/php-enum/issues/74/events","html_url":"https://github.com/marc-mabe/php-enum/issues/74","id":180728917,"number":74,"title":"provide different EnumSet implementations based on binary bitset and integer bitset","user":{"login":"marc-mabe","id":302689,"avatar_url":"https://avatars.githubusercontent.com/u/302689?v=3","gravatar_id":"","url":"https://api.github.com/users/marc-mabe","html_url":"https://github.com/marc-mabe","followers_url":"https://api.github.com/users/marc-mabe/followers","following_url":"https://api.github.com/users/marc-mabe/following{/other_user}","gists_url":"https://api.github.com/users/marc-mabe/gists{/gist_id}","starred_url":"https://api.github.com/users/marc-mabe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marc-mabe/subscriptions","organizations_url":"https://api.github.com/users/marc-mabe/orgs","repos_url":"https://api.github.com/users/marc-mabe/repos","events_url":"https://api.github.com/users/marc-mabe/events{/privacy}","received_events_url":"https://api.github.com/users/marc-mabe/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/marc-mabe/php-enum/labels/BC%20break","name":"BC break","color":"b60205"},{"url":"https://api.github.com/repos/marc-mabe/php-enum/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/marc-mabe/php-enum/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/marc-mabe/php-enum/milestones/12","html_url":"https://github.com/marc-mabe/php-enum/milestones/3.0.0","labels_url":"https://api.github.com/repos/marc-mabe/php-enum/milestones/12/labels","id":2041859,"number":12,"title":"3.0.0","description":"Next major release","creator":{"login":"marc-mabe","id":302689,"avatar_url":"https://avatars.githubusercontent.com/u/302689?v=3","gravatar_id":"","url":"https://api.github.com/users/marc-mabe","html_url":"https://github.com/marc-mabe","followers_url":"https://api.github.com/users/marc-mabe/followers","following_url":"https://api.github.com/users/marc-mabe/following{/other_user}","gists_url":"https://api.github.com/users/marc-mabe/gists{/gist_id}","starred_url":"https://api.github.com/users/marc-mabe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marc-mabe/subscriptions","organizations_url":"https://api.github.com/users/marc-mabe/orgs","repos_url":"https://api.github.com/users/marc-mabe/repos","events_url":"https://api.github.com/users/marc-mabe/events{/privacy}","received_events_url":"https://api.github.com/users/marc-mabe/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":0,"state":"open","created_at":"2016-10-01T21:07:00Z","updated_at":"2016-10-03T19:45:26Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2016-10-03T19:45:26Z","updated_at":"2016-10-05T02:34:14Z","closed_at":null,"body":"An integer bitset would drastically improve performance but can handle only up to 64 enumerators on 64 bit platform and up to 32 enumerators on 32 bit platform.\r\n\r\nBoth implementations should extend the `EnumSet` class which would be abstract:\r\n```php\r\nabstract class EnumSet implements Iterator, Countable\r\n{\r\n    private $enumeration;\r\n    private $ordinal;\r\n    private $ordinalMax;\r\n\r\n    public function __construct($enumeration) { /* ... */ }\r\n    public function getEnumeration() { /* ... */ }\r\n    public function attach($enumerator) { /* ... */ }\r\n    public function detach($enumerator) { /* ... */ }\r\n    public function contains($enumerator) { /* ... */ }\r\n    public function current() { /* ... */ }\r\n    public function key() { /* ... */ }\r\n    public function next() { /* ... */ }\r\n    public function rewind() { /* ... */ }\r\n    public function valid() { /* ... */ }\r\n    public function count() { /* ... */ }\r\n    abstract public function isEqual()\r\n    abstract public function isSubset()\r\n    abstract public function isSuperset()\r\n    abstract public function union()\r\n    abstract public function intersect()\r\n    abstract public function diff()\r\n    abstract public function symDiff()\r\n    abstract public function getOrdinals()\r\n    abstract public function getEnumerators()\r\n    abstract public function getValues()\r\n    abstract public function getNames()\r\n    abstract protected function getBit(int $ordinal) : bool\r\n    abstract protected function setBit(int $ordinal, bool $bit)\r\n}\r\n\r\nclass BinaryEnumSet extends EnumSet {\r\n    /** @var string */\r\n    private $bitset;\r\n    public function count() { /* optimized version of count */ }\r\n    public function isEqual() { /* ... */ }\r\n    public function isSubset() { /* ... */ }\r\n    public function isSuperset() { /* ... */ }\r\n    public function union() { /* ... */ }\r\n    public function intersect() { /* ... */ }\r\n    public function diff() { /* ... */ }\r\n    public function symDiff() { /* ... */ }\r\n    public function getOrdinals() { /* ... */ }\r\n    public function getEnumerators() { /* ... */ }\r\n    public function getValues() { /* ... */ }\r\n    public function getNames() { /* ... */ }\r\n    public function [get|set]BinaryBitset[Le|Be]() { /* ... */ }\r\n    protected function getBit(int $ordinal) : bool { /* ... */ }\r\n    protected function setBit(int $ordinal, bool $bit) { /* ... */ }\r\n}\r\n\r\nclass IntegerEnumSet extends EnumSet {\r\n    /** @var int */\r\n    private $bitset;\r\n    public function count() { /* optimized version of count */ }\r\n    public function isEqual() { /* ... */ }\r\n    public function isSubset() { /* ... */ }\r\n    public function isSuperset() { /* ... */ }\r\n    public function union() { /* ... */ }\r\n    public function intersect() { /* ... */ }\r\n    public function diff() { /* ... */ }\r\n    public function symDiff() { /* ... */ }\r\n    public function getOrdinals() { /* ... */ }\r\n    public function getEnumerators() { /* ... */ }\r\n    public function getValues() { /* ... */ }\r\n    public function getNames() { /* ... */ }\r\n    public function [get|set]IntegerBitset() { /* ... */ }\r\n    protected function getBit(int $ordinal) : bool { /* ... */ }\r\n    protected function setBit(int $ordinal, bool $bit) { /* ... */ }\r\n}\r\n```\r\n\r\nWe could also add a helper method to instantiate an `EnumSet` based on the number of enumerators but here I'm totally unsure of the name: `Enum::getEnumSet($fill = false)` or `Enum::getSet($fill = false)` or `Enum::set($fill = false)` or ?\r\n\r\nThoughts?\r\n\r\n@prolic \r\n"},"comment":{"url":"https://api.github.com/repos/marc-mabe/php-enum/issues/comments/251567221","html_url":"https://github.com/marc-mabe/php-enum/issues/74#issuecomment-251567221","issue_url":"https://api.github.com/repos/marc-mabe/php-enum/issues/74","id":251567221,"user":{"login":"prolic","id":394428,"avatar_url":"https://avatars.githubusercontent.com/u/394428?v=3","gravatar_id":"","url":"https://api.github.com/users/prolic","html_url":"https://github.com/prolic","followers_url":"https://api.github.com/users/prolic/followers","following_url":"https://api.github.com/users/prolic/following{/other_user}","gists_url":"https://api.github.com/users/prolic/gists{/gist_id}","starred_url":"https://api.github.com/users/prolic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prolic/subscriptions","organizations_url":"https://api.github.com/users/prolic/orgs","repos_url":"https://api.github.com/users/prolic/repos","events_url":"https://api.github.com/users/prolic/events{/privacy}","received_events_url":"https://api.github.com/users/prolic/received_events","type":"User","site_admin":false},"created_at":"2016-10-05T02:34:14Z","updated_at":"2016-10-05T02:34:14Z","body":"Question:\r\n\r\nAs far as I understand `Enum::set($fill = false)` should return an EnumSet instance (dependend on how many values are present and Integer- or BinaryEnumSet. But was does the `$fill` parameter do? Add the existing Enum to the set?\r\n\r\nAnother method name proposal would be: `Enum::createSet($fill = false)`"}}
{"actor":{"display_login":"prolic"}}