Primitive.class.php

Go to the documentation of this file.
00001 <?php
00002 /****************************************************************************
00003  *   Copyright (C) 2004-2007 by Konstantin V. Arkhipov, Anton E. Lebedevich *
00004  *                                                                          *
00005  *   This program is free software; you can redistribute it and/or modify   *
00006  *   it under the terms of the GNU Lesser General Public License as         *
00007  *   published by the Free Software Foundation; either version 3 of the     *
00008  *   License, or (at your option) any later version.                        *
00009  *                                                                          *
00010  ****************************************************************************/
00011 /* $Id: Primitive.class.php 4687 2007-12-09 18:57:18Z voxus $ */
00012 
00018     final class Primitive extends StaticFactory
00019     {
00023         public static function spawn($primitive, $name)
00024         {
00025             Assert::isTrue(class_exists($primitive, true));
00026             
00027             return new $primitive($name);
00028         }
00029         
00033         public static function integer($name)
00034         {
00035             return new PrimitiveInteger($name);
00036         }
00037         
00041         public static function float($name)
00042         {
00043             return new PrimitiveFloat($name);
00044         }
00045 
00049         public static function identifier($name)
00050         {
00051             return new PrimitiveIdentifier($name);
00052         }
00053         
00057         public static function identifierlist($name)
00058         {
00059             return new PrimitiveIdentifierList($name);
00060         }
00061 
00065         public static function enumeration($name)
00066         {
00067             return new PrimitiveEnumeration($name);
00068         }
00069         
00073         public static function date($name)
00074         {
00075             return new PrimitiveDate($name);
00076         }
00077         
00081         public static function timestamp($name)
00082         {
00083             return new PrimitiveTimestamp($name);
00084         }
00085         
00089         public static function time($name)
00090         {
00091             return new PrimitiveTime($name);
00092         }
00093         
00097         public static function string($name)
00098         {
00099             return new PrimitiveString($name);
00100         }
00101         
00105         public static function range($name)
00106         {
00107             return new PrimitiveRange($name);
00108         }
00109         
00113         public static function dateRange($name)
00114         {
00115             return new PrimitiveDateRange($name);
00116         }
00117         
00118         public static function timestampRange($name)
00119         {
00120             throw new UnimplementedFeatureException();
00121         }
00122         
00126         public static function choice($name)
00127         {
00128             return new PrimitiveList($name);
00129         }
00130         
00134         public static function set($name)
00135         {
00136             return new PrimitiveArray($name);
00137         }
00138 
00142         public static function multiChoice($name)
00143         {
00144             return new PrimitiveMultiList($name);
00145         }
00146         
00150         public static function plainChoice($name)
00151         {
00152             return new PrimitivePlainList($name);
00153         }
00154         
00158         public static function boolean($name)
00159         {
00160             return new PrimitiveBoolean($name);
00161         }
00162         
00166         public static function ternary($name)
00167         {
00168             return new PrimitiveTernary($name);
00169         }
00170         
00174         public static function file($name)
00175         {
00176             return new PrimitiveFile($name);
00177         }
00178         
00182         public static function image($name)
00183         {
00184             return new PrimitiveImage($name);
00185         }
00186         
00190         public static function exploded($name)
00191         {
00192             return new ExplodedPrimitive($name);
00193         }
00194         
00198         public static function inet($name)
00199         {
00200             return new PrimitiveInet($name);
00201         }
00202     }
00203 ?>

Generated on Sun Dec 9 21:56:23 2007 for onPHP by  doxygen 1.5.4