Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function prepareAttributesCollection(AttributeCollection $collection)
 {
     parent::prepareAttributesCollection($collection);
     $collection->add(new Attribute('sAddLabel', $this->getOption('addLabel')));
     $collection->add(new Attribute('bSelectable', $this->getOption('selectable'), Attribute::TYPE_BOOLEAN));
     $collection->add(new Attribute('bChoosable', $this->getOption('choosable'), Attribute::TYPE_BOOLEAN));
     $collection->add(new Attribute('bClickable', $this->getOption('clickable'), Attribute::TYPE_BOOLEAN));
     $collection->add(new Attribute('bDeletable', $this->getOption('deletable'), Attribute::TYPE_BOOLEAN));
     $collection->add(new Attribute('bAddable', $this->getOption('addable'), Attribute::TYPE_BOOLEAN));
     $collection->add(new Attribute('iTotal', $this->getOption('total'), Attribute::TYPE_INTEGER));
     $collection->add(new Attribute('iRestrict', $this->getOption('restrict'), Attribute::TYPE_INTEGER));
     $collection->add(new Attribute('oItems', $this->getOption('items'), Attribute::TYPE_ARRAY));
     $collection->add(new Attribute('fOnClick', $this->getOption('onClick'), Attribute::TYPE_FUNCTION));
     $collection->add(new Attribute('fOnDuplicate', $this->getOption('onDuplicate'), Attribute::TYPE_FUNCTION));
     $collection->add(new Attribute('fOnAdd', $this->getOption('onAdd'), Attribute::TYPE_FUNCTION));
     $collection->add(new Attribute('fOnAfterAdd', $this->getOption('onAfterAdd'), Attribute::TYPE_FUNCTION));
     $collection->add(new Attribute('fOnDelete', $this->getOption('onDelete'), Attribute::TYPE_FUNCTION));
     $collection->add(new Attribute('fOnAfterDelete', $this->getOption('onAfterDelete'), Attribute::TYPE_FUNCTION));
     $collection->add(new Attribute('fOnSaveOrder', $this->getOption('onSaveOrder'), Attribute::TYPE_FUNCTION));
     $collection->add(new Attribute('sActive', $this->getOption('active')));
     $collection->add(new Attribute('sOnAfterDeleteId', $this->getOption('onAfterDeleteId')));
     $collection->add(new Attribute('sAddItemPrompt', $this->getOption('add_item_prompt')));
     $collection->add(new Attribute('bPreventDuplicates', $this->getOption('prevent_duplicates'), Attribute::TYPE_BOOLEAN));
     $collection->add(new Attribute('bPreventDuplicatesOnAllLevels', $this->getOption('prevent_duplicates_on_all_levels')));
 }
Exemplo n.º 2
0
 /**
  * Destructor.
  */
 public function __destruct()
 {
     parent::__destruct();
 }
Exemplo n.º 3
0
 /**
  * Main program.
  *
  * @param array $args Command-line arguments.
  * @return integer Zero on success; non-zero on failure.
  */
 public static function main($args)
 {
     printf("BinaryTree main program.\n");
     $status = 0;
     $bt = new BinaryTree(box(4));
     $bt->attachLeft(new BinaryTree(box(2)));
     $bt->attachRight(new BinaryTree(box(6)));
     AbstractTree::test($bt);
     return $status;
 }
Exemplo n.º 4
0
 /**
  * Main program.
  *
  * @param array $args Command-line arguments.
  * @return integer Zero on success; non-zero on failure.
  */
 public static function main($args)
 {
     printf("NaryTree main program.\n");
     $status = 0;
     $nt = new NaryTree(3, box(1));
     $nt->attachSubtree(0, new NaryTree(3, box(2)));
     $nt->attachSubtree(1, new NaryTree(3, box(3)));
     $nt->attachSubtree(2, new NaryTree(3, box(4)));
     AbstractTree::test($nt);
     return $status;
 }
Exemplo n.º 5
0
        printf("Preorder traversal\n");
        $tree->depthFirstTraversal(new PreOrder(new PrintingVisitor(STDOUT)));
        printf("Inorder traversal\n");
        $tree->depthFirstTraversal(new InOrder(new PrintingVisitor(STDOUT)));
        printf("Postorder traversal\n");
        $tree->depthFirstTraversal(new PostOrder(new PrintingVisitor(STDOUT)));
        printf("Using foreach\n");
        foreach ($tree as $obj) {
            printf("%s\n", str($obj));
        }
        printf("Using reduce\n");
        $tree->reduce(create_function('$sum,$obj', 'printf("%s\\n", str($obj));'), '');
        printf("Using accept\n");
        $tree->accept(new ReducingVisitor(create_function('$sum,$obj', 'printf("%s\\n", str($obj));'), ''));
    }
    /**
     * Main program.
     *
     * @param array $args Command-line arguments.
     * @return integer Zero on success; non-zero on failure.
     */
    public static function main($args)
    {
        printf("AbstractTree main program.\n");
        $status = 0;
        return $status;
    }
}
if (realpath($argv[0]) == realpath(__FILE__)) {
    exit(AbstractTree::main(array_slice($argv, 1)));
}
Exemplo n.º 6
0
 /**
  * Main program.
  *
  * @param array $args Command-line arguments.
  * @return integer Zero on success; non-zero on failure.
  */
 public static function main($args)
 {
     printf("GeneralTree main program.\n");
     $status = 0;
     $gt = new GeneralTree(box('A'));
     $gt->attachSubtree(new GeneralTree(box('B')));
     $gt->attachSubtree(new GeneralTree(box('C')));
     $gt->attachSubtree(new GeneralTree(box('D')));
     $gt->attachSubtree(new GeneralTree(box('E')));
     AbstractTree::test($gt);
     return $status;
 }