[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/libraries/antlr/ -> Set.php (source)

   1  <?php
   2      //Todo: find a decent set implementation for php
   3      class Set{
   4  		public function __construct($arr){
   5              $this->store = array();
   6              foreach($arr as $el){
   7                  $this->store[$el] = $el;
   8              }
   9          }
  10          
  11  		public function add($value){
  12              $this->store[$value] = $value;
  13          }
  14          
  15  		public function member($value){
  16              return array_key_exists($value, $this->store);
  17          }
  18          
  19  		public function union($otherSet){
  20              return new Set(array_merge($this->store, $otherSet->store));
  21          }
  22          
  23  		public function unionInPlace($otherSet){
  24              $this->store = $this->union($otherSet)->store;
  25          }
  26          
  27  		public function remove($value){
  28              unset($this->store[$value]);
  29          }
  30      }
  31      
  32      
  33  
  34  ?>


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1