phing-types-selectors

# Class: SizeSelector Source Location: /types/selectors/SizeSelector.php
### Class Overview
    ProjectComponent
       |
       --DataType
          |
          --BaseSelector
             |
             --BaseExtendSelector
                |
                --SizeSelector
Selector that filters files based on their size. #### Author(s): Bruce Atherton <bruce@callenish.com> (Ant) Hans Lellelid <hans@xmpl.org> (Phing) #### Version: $Revision: 526 $ | ### Constants SIZE_KEY UNITS_KEY WHEN_KEY | ### Methods isSelected setParameters setUnits setValue setWhen toString verifySettings
### Inherited Variables #### Class: BaseExtendSelector BaseExtendSelector::$parameters #### Class: DataType DataType::$checked DataType::$description DataType::$ref #### Class: ProjectComponent ProjectComponent::$project | ### Inherited Methods #### Class: BaseExtendSelector BaseExtendSelector::getParameters() Allows access to the parameters gathered and set within the &lt;custom&gt; tag. BaseExtendSelector::setParameters() Set all the Parameters for this custom selector, collected by the ExtendSelector class. #### Class: BaseSelector BaseSelector::getError() Returns any error messages that have been set. BaseSelector::setError() Allows all selectors to indicate a setup error. Note that only the first error message is recorded. BaseSelector::validate() Subclasses can use this to throw the requisite exception in isSelected() in the case of an error condition. BaseSelector::verifySettings() <p>Subclasses can override this method to provide checking of their #### Class: DataType DataType::circularReference() Creates an exception that indicates the user has generated a loop of data types referencing each other. DataType::dieOnCircularReference() Check to see whether any DataType we hold references to is included in the Stack (which holds all DataType instances that directly or indirectly reference this instance, including this instance itself). DataType::getCheckedRef() Performs the check for circular references and returns the referenced object. DataType::getDescription() Return the description for the current data type. DataType::isReference() Has the refid attribute of this element been set? DataType::noChildrenAllowed() Creates an exception that indicates that this XML element must not have child elements if the refid attribute is set. DataType::parsingComplete() Template method being called when the data type has been parsed completely. DataType::setDescription() Sets a description of the current data type. It will be useful in commenting what we are doing. DataType::setRefid() Set the value of the refid attribute. DataType::tooManyAttributes() Creates an exception that indicates that refid has to be the only attribute if it is set. #### Class: ProjectComponent ProjectComponent::getProject() Returns a reference to current project ProjectComponent::log() Logs a message with the given priority. ProjectComponent::setProject() References the project to the current component.
### Class Details [line 31] Selector that filters files based on their size. #### Tags:
author: | Bruce Atherton <bruce@callenish.com> (Ant)
author: | Hans Lellelid <hans@xmpl.org> (Phing)
version: | $Revision: 526 $
[ Top ] ### Class Methods ### method isSelected [line 210]
`whether isSelected( $basedir, filename $filename, $file)`
The heart of the matter. This is where the selector gets to decide on the inclusion of a file in a particular fileset. #### Tags:
return: | the file should be selected or not
access: | public
#### Parameters:
basedir | $basedir | A PhingFile object for the base directory
filename | $filename | The name of the file to check
file | $file | A PhingFile object for this filename
[ Top ] ### method setParameters [line 154]
`void setParameters( parameters $parameters)`
When using this as a custom selector, this method will be called. It translates each parameter into the appropriate setXXX() call. #### Tags:
access: | public
Overrides BaseExtendSelector::setParameters() (Set all the Parameters for this custom selector, collected by the ExtendSelector class.) #### Parameters:
parameters | $parameters | the complete set of parameters for this selector
[ Top ] ### method setUnits [line 107]
`void setUnits( $units $units)`
Sets the units to use for the comparison. This is a little complicated because common usage has created standards that play havoc with capitalization rules. Thus, some people will use "K" for indicating 1000's, when the SI standard calls for "k". Others have tried to introduce "K" as a multiple of 1024, but that falls down when you reach "M", since "m" is already defined as 0.001. <p> To get around this complexity, a number of standards bodies have proposed the 2^10 standard, and at least one has adopted it. But we are still left with a populace that isn't clear on how capitalization should work. <p> We therefore ignore capitalization as much as possible. Completely mixed case is not possible, but all upper and lower forms are accepted for all long and short forms. Since we have no need to work with the 0.001 case, this practice works here. <p> This function translates all the long and short forms that a unit prefix can occur in and translates them into a single multiplier. #### Tags:
access: | public
#### Parameters:
$units | $units | The units to compare the size to.
[ Top ] ### method setValue [line 74]
`void setValue( size $size)`
A size selector needs to know what size to base its selecting on. This will be further modified by the multiplier to get an actual size limit. #### Tags:
access: | public
#### Parameters:
size | $size | the size to select against expressed in units
[ Top ] ### method setWhen [line 141]
`void setWhen( cmp $cmp)`
This specifies when the file should be selected, whether it be when the file matches a particular size, when it is smaller, or whether it is larger. #### Tags:
access: | public
#### Parameters:
cmp | $cmp | The comparison to perform, an EnumeratedAttribute
[ Top ] ### method toString [line 52]
`void toString( )`
#### Tags:
access: | public
[ Top ] ### method verifySettings [line 191]
`void verifySettings( )`
<p>Checks to make sure all settings are kosher. In this case, it means that the size attribute has been set (to a positive value), that the multiplier has a valid setting, and that the size limit is valid. Since the latter is a calculated value, this can only fail due to a programming error. </p> <p>If a problem is detected, the setError() method is called. </p> #### Tags:
access: | public
Overrides BaseSelector::verifySettings() (<p>Subclasses can override this method to provide checking of their) [ Top ] ### Class Constants #### SIZE_KEY = "value" [line 37] [ Top ] #### UNITS_KEY = "units" [line 38] [ Top ] #### WHEN_KEY = "when" [line 39] [ Top ] Documentation generated on Mon, 19 Oct 2009 10:52:01 +0200 by phpDocumentor 1.4.3