PHPLinq
[ class tree: PHPLinq ] [ index: PHPLinq ] [ all elements ]

Source for file ILinqProvider.php

Documentation is available at ILinqProvider.php

  1. <?php
  2. /**
  3.  * PHPLinq
  4.  *
  5.  * Copyright (c) 2008 - 2009 PHPLinq
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Lesser General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2.1 of the License, or (at your option) any later version.
  11.  * 
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Lesser General Public License for more details.
  16.  * 
  17.  * You should have received a copy of the GNU Lesser General Public
  18.  * License along with this library; if not, write to the Free Software
  19.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  20.  *
  21.  * @category   PHPLinq
  22.  * @package    PHPLinq
  23.  * @copyright  Copyright (c) 2008 - 2009 PHPLinq (http://www.codeplex.com/PHPLinq)
  24.  * @license    http://www.gnu.org/licenses/lgpl.txt    LGPL
  25.  * @version    0.4.0, 2009-01-27
  26.  */
  27.  
  28.  
  29. /**
  30.  * PHPLinq_ILinqProvider
  31.  *
  32.  * @category   PHPLinq
  33.  * @package    PHPLinq
  34.  * @copyright  Copyright (c) 2008 - 2009 PHPLinq (http://www.codeplex.com/PHPLinq)
  35.  */
  36. interface PHPLinq_ILinqProvider {
  37.     /**
  38.      * Can this provider type handle data in $source?
  39.      *
  40.      * @param mixed $source 
  41.      * @return bool 
  42.      */
  43.     public static function handles($source);
  44.     
  45.     /**
  46.      * Create a new class instance
  47.      *
  48.      * @param string $name 
  49.      * @param PHPLinq_ILinqProvider $parentProvider Optional parent PHPLinq_ILinqProvider instance, used with join conditions
  50.      * @return PHPLinq_ILinqProvider 
  51.      */
  52.     public function __construct($namePHPLinq_ILinqProvider $parentProvider null);
  53.     
  54.     /**
  55.      * Class destructor
  56.      */
  57.     public function __destruct();
  58.  
  59.     /**
  60.      * Is object destructing?
  61.      *
  62.      * @return bool 
  63.      */
  64.     public function __isDestructing();
  65.  
  66.     /**
  67.      * Get join condition
  68.      *
  69.      * @return PHPLinq_Expression 
  70.      */
  71.     public function getJoinCondition();
  72.     
  73.     /**
  74.      * Add child provider, used with joins
  75.      *
  76.      * @param PHPLinq_ILinqProvider $provider 
  77.      */
  78.     public function addChildProvider(PHPLinq_ILinqProvider $provider);
  79.     
  80.     /**
  81.      * Retrieve "from" name
  82.      *
  83.      * @return string 
  84.      */
  85.     public function getFromName();
  86.     
  87.     /**
  88.      * Retrieve data in data source
  89.      *
  90.      * @return mixed 
  91.      */
  92.     public function getSource();
  93.     
  94.     /**
  95.      * Set source of data
  96.      *
  97.      * @param mixed $source 
  98.      * @return PHPLinq_ILinqProvider 
  99.      */
  100.     public function in($source);
  101.     
  102.     /**
  103.      * Select
  104.      *
  105.      * @param  string    $expression    Expression which creates a resulting element
  106.      * @return mixed 
  107.      */
  108.     public function select($expression null);
  109.     
  110.     /*
  111.     public function selectMany();
  112.     */
  113.     
  114.     /**
  115.      * Where
  116.      *
  117.      * @param  string    $expression    Expression checking if an element should be contained
  118.      * @return PHPLinq_ILinqProvider 
  119.      */
  120.     public function where($expression);
  121.     
  122.     /**
  123.      * Join
  124.      *
  125.      * @param string $name 
  126.      * @return PHPLinq_Initiator 
  127.      */
  128.     public function join($name);
  129.     
  130.     /**
  131.      * On
  132.      *
  133.      * @param  string    $expression    Expression representing join condition
  134.      * @return PHPLinq_ILinqProvider 
  135.      */
  136.     public function on($expression);
  137.     
  138.     /*
  139.     public function groupJoin();
  140.     */
  141.     
  142.     /**
  143.      * Take $n elements
  144.      *
  145.      * @param int $n 
  146.      * @return PHPLinq_ILinqProvider 
  147.      */
  148.     public function take($n);
  149.     
  150.     /**
  151.      * Take elements while $expression evaluates to true
  152.      *
  153.      * @param  string    $expression    Expression to evaluate
  154.      * @return PHPLinq_ILinqProvider 
  155.      */
  156.     public function takeWhile($expression);
  157.     
  158.     /**
  159.      * Skip $n elements
  160.      *
  161.      * @param int $n 
  162.      * @return PHPLinq_ILinqProvider 
  163.      */
  164.     public function skip($n);
  165.     
  166.     /**
  167.      * Skip elements while $expression evaluates to true
  168.      *
  169.      * @param  string    $expression    Expression to evaluate
  170.      * @return PHPLinq_ILinqProvider 
  171.      */
  172.     public function skipWhile($expression);
  173.     
  174.     /**
  175.      * Select the elements of a certain type
  176.      *
  177.      * @param string $type    Type name
  178.      */
  179.     public function ofType($type);
  180.     
  181.     /**
  182.      * Concatenate data
  183.      *
  184.      * @param mixed $source 
  185.      * @return PHPLinq_ILinqProvider 
  186.      */
  187.     public function concat($source);
  188.     
  189.     /**
  190.      * OrderBy
  191.      *
  192.      * @param  string    $expression    Expression to order elements by
  193.      * @param  string    $comparer    Comparer function (taking 2 arguments, returning -1, 0, 1)
  194.      * @return PHPLinq_ILinqProvider 
  195.      */
  196.     public function orderBy($expression$comparer null);
  197.     
  198.     /**
  199.      * OrderByDescending
  200.      *
  201.      * @param  string    $expression    Expression to order elements by
  202.      * @param  string    $comparer    Comparer function (taking 2 arguments, returning -1, 0, 1)
  203.      * @return PHPLinq_ILinqProvider 
  204.      */
  205.     public function orderByDescending($expression$comparer null);
  206.     
  207.     /**
  208.      * ThenBy
  209.      *
  210.      * @param  string    $expression    Expression to order elements by
  211.      * @param  string    $comparer    Comparer function (taking 2 arguments, returning -1, 0, 1)
  212.      * @return PHPLinq_ILinqProvider 
  213.      */
  214.     public function thenBy($expression$comparer null);
  215.     
  216.     /**
  217.      * ThenByDescending
  218.      *
  219.      * @param  string    $expression    Expression to order elements by
  220.      * @param  string    $comparer    Comparer function (taking 2 arguments, returning -1, 0, 1)
  221.      * @return PHPLinq_ILinqProvider 
  222.      */
  223.     public function thenByDescending($expression$comparer null);
  224.     
  225.     /**
  226.      * Reverse elements
  227.      *
  228.      * @param bool $preserveKeys Preserve keys?
  229.      * @return PHPLinq_ILinqProvider 
  230.      */
  231.     public function reverse($preserveKeys null);
  232.     
  233.     /*
  234.     public function groupBy(); 
  235.     */
  236.     
  237.     /**
  238.      * Distinct
  239.      *
  240.      * @param  string    $expression    Expression to retrieve the key value.
  241.      * @return PHPLinq_ILinqProvider 
  242.      */
  243.     public function distinct($expression)
  244.     
  245.     /*
  246.     public function union();
  247.     public function intersect();
  248.     public function except(); 
  249.     public function equalAll();
  250.     */
  251.     
  252.     /**
  253.      * First
  254.      *
  255.      * @param  string    $expression    Expression which creates a resulting element
  256.      * @return mixed 
  257.      */
  258.     public function first($expression null);
  259.     
  260.     /**
  261.      * FirstOrDefault
  262.      *
  263.      * @param  string    $expression    Expression which creates a resulting element
  264.      * @param  mixed    $defaultValue Default value to return if nothing is found
  265.      * @return mixed 
  266.      */
  267.     public function firstOrDefault ($expression null$defaultValue null);
  268.     
  269.     /**
  270.      * Last
  271.      *
  272.      * @param  string    $expression    Expression which creates a resulting element
  273.      * @return mixed 
  274.      */
  275.     public function last($expression null);
  276.     
  277.     /**
  278.      * LastOrDefault
  279.      *
  280.      * @param  string    $expression    Expression which creates a resulting element
  281.      * @param  mixed    $defaultValue Default value to return if nothing is found
  282.      * @return mixed 
  283.      */
  284.     public function lastOrDefault ($expression null$defaultValue null);
  285.     
  286.     /**
  287.      * Single
  288.      *
  289.      * @param  string    $expression    Expression which creates a resulting element
  290.      * @return mixed 
  291.      */
  292.     public function single($expression null);
  293.     
  294.     /**
  295.      * SingleOrDefault
  296.      *
  297.      * @param  string    $expression    Expression which creates a resulting element
  298.      * @param  mixed    $defaultValue Default value to return if nothing is found
  299.      * @return mixed 
  300.      */
  301.     public function singleOrDefault ($expression null$defaultValue null);
  302.     
  303.     /**
  304.      * Element at index
  305.      *
  306.      * @param mixed $index Index
  307.      * @return mixed Element at $index
  308.      */
  309.     public function elementAt($index null);
  310.     
  311.     /**
  312.      * Element at index or default
  313.      *
  314.      * @param mixed $index Index
  315.      * @param  mixed $defaultValue Default value to return if nothing is found
  316.      * @return mixed Element at $index
  317.      */
  318.     public function elementAtOrDefault($index null$defaultValue null);
  319.     
  320.     /**
  321.      * Any
  322.      *
  323.      * @param  string    $expression    Expression checking if an element is contained
  324.      * @return boolean 
  325.      */
  326.     public function any($expression);
  327.     
  328.     /**
  329.      * All
  330.      *
  331.      * @param  string    $expression    Expression checking if an all elements are contained
  332.      * @return boolean 
  333.      */
  334.     public function all($expression);
  335.  
  336.     /**
  337.      * Contains
  338.      *
  339.      * @param mixed $element Is the $element contained?
  340.      * @return boolean 
  341.      */
  342.     public function contains($element);
  343.     
  344.     /**
  345.      * Count elements
  346.      *
  347.      * @return int Element count
  348.      */
  349.     public function count();
  350.     
  351.     /**
  352.      * Sum elements
  353.      *
  354.      * @return mixed Sum of elements
  355.      */
  356.     public function sum();
  357.     
  358.     /**
  359.      * Minimum of elements
  360.      *
  361.      * @return mixed Minimum of elements
  362.      */
  363.     public function min();
  364.     
  365.     /**
  366.      * Maximum of elements
  367.      *
  368.      * @return mixed Maximum of elements
  369.      */
  370.     public function max();
  371.     
  372.     /**
  373.      * Average of elements
  374.      *
  375.      * @return mixed Average of elements
  376.      */
  377.     public function average();
  378.  
  379.     /**
  380.      * Aggregate
  381.      *
  382.      * @param int $seed    Seed
  383.      * @param string $expression    Expression defining the aggregate
  384.      * @return mixed aggregate
  385.      */
  386.     public function aggregate($seed 0$expression);
  387. }

Documentation generated on Tue, 27 Jan 2009 08:29:24 +0100 by phpDocumentor 1.4.1