예제 #1
0
 public function getObject(Spring\Object\Parser $parser, \SimpleXMLElement $element)
 {
     $object = new Common\Mutable\HashSet();
     $children = $parser->getElementChildren($element, null);
     foreach ($children as $child) {
         $object->putValue($parser->getObjectFromElement($child));
     }
     return $object;
 }
예제 #2
0
 /**
  * This method parses a "set" node.
  *
  * @access protected
  * @param \SimpleXMLElement $root                           a reference to the root node
  * @param \SimpleXMLElement $node                           a reference to the "set" node
  * @return Common\Mutable\ISet                              a set of values
  * @throws Throwable\Parse\Exception                        indicates that problem occurred while
  *                                                          parsing
  */
 protected function parseSetElement(\SimpleXMLElement $root, \SimpleXMLElement $node)
 {
     $set = new Common\Mutable\HashSet();
     $children = $node->children();
     foreach ($children as $child) {
         $name = $child->getName();
         switch ($name) {
             case 'array':
                 $set->putValue($this->parseArrayElement($root, $child));
                 break;
             case 'dictionary':
                 $set->putValue($this->parseDictionaryElement($root, $child));
                 break;
             case 'expression':
                 $set->putValue($this->parseExpressionElement($root, $child));
                 break;
             case 'idref':
                 $set->putValue($this->parseIdRefElement($root, $child));
                 break;
             case 'list':
                 $set->putValue($this->parseListElement($root, $child));
                 break;
             case 'map':
                 $set->putValue($this->parseMapElement($root, $child));
                 break;
             case 'null':
                 $set->putValue($this->parseNullElement($root, $child));
                 break;
             case 'object':
                 $set->putValue($this->parseInnerObjectElement($root, $child));
                 break;
             case 'ref':
                 $set->putValue($this->parseRefElement($root, $child));
                 break;
             case 'set':
                 $set->putValue($this->parseSetElement($root, $child));
                 break;
             case 'undefined':
                 $set->putValue($this->parseUndefinedElement($root, $child));
                 break;
             case 'value':
                 $set->putValue($this->parseValueElement($root, $child));
                 break;
             default:
                 throw new Throwable\Parse\Exception('Unable to process Spring XML. Tag ":tag" has invalid child node ":child".', array(':tag' => 'set', ':child' => $name));
                 break;
         }
     }
     return $set;
 }
예제 #3
0
파일: Set.php 프로젝트: bluesnowman/Chimera
 /**
  * This method returns a hash set which represents the union of the two specified
  * sets.
  *
  * @access public
  * @static
  * @param Common\ISet $s1                                   the first set
  * @param Common\ISet $s2                                   the second set
  * @return Common\ISet                                      a hash set which represents the union
  *                                                          of the two specified sets
  */
 public static function union(Common\ISet $s1, Common\ISet $s2)
 {
     $s0 = new Common\Mutable\HashSet($s1);
     $s0->putValues($s2);
     return $s0;
 }