Packagecom.google.analytics.utils
Classpublic class Version

A basic Version class which is composed by four fields: major, minor, build and revision.



Public Properties
 PropertyDefined by
  build : uint
Indicates the build value of this version.
Version
  major : uint
Indicates the major value of this version.
Version
  minor : uint
Indicates the minor value of this version.
Version
  revision : uint
Indicates the revision value of this version.
Version
Public Methods
 MethodDefined by
  
Version(major:uint = 0, minor:uint = 0, build:uint = 0, revision:uint = 0)
Creates a new Version instance.
Version
  
equals(o:*):Boolean
We don't really need an equals method as we override the valueOf, we can do something as
         var v1:Version = new Version( 1,0,0,0 );
         var v2:Version = new Version( 1,0,0,0 );
         trace( int(v1) == int(v2) ); //true
         
A cast to Number/int force the valueOf, not ideal but sufficient, and the same for any other operators.
Version
  
fromNumber(value:Number = 0):Version
[static] Constructs a Version object from a number.
Version
  
fromString(value:String = "", separator:String = "."):Version
[static] Constructs a Version object from a string.
Version
  
toString(fields:int = 0):String
Returns a string representation of the object.
Version
  
valueOf():uint
Returns the primitive value of the object.
Version
Property detail
buildproperty
build:uint  [read-write]

Indicates the build value of this version.

Implementation
    public function get build():uint
    public function set build(value:uint):void
majorproperty 
major:uint  [read-write]

Indicates the major value of this version.

Implementation
    public function get major():uint
    public function set major(value:uint):void
minorproperty 
minor:uint  [read-write]

Indicates the minor value of this version.

Implementation
    public function get minor():uint
    public function set minor(value:uint):void
revisionproperty 
revision:uint  [read-write]

Indicates the revision value of this version.

Implementation
    public function get revision():uint
    public function set revision(value:uint):void
Constructor detail
Version()constructor
public function Version(major:uint = 0, minor:uint = 0, build:uint = 0, revision:uint = 0)

Creates a new Version instance.

Parameters
major:uint (default = 0) — The major value of the version.
 
minor:uint (default = 0) — The minor value of the version.
 
build:uint (default = 0) — The build value of the version.
 
revision:uint (default = 0) — The revision value of the version.
Method detail
equals()method
public function equals(o:*):Boolean

We don't really need an equals method as we override the valueOf, we can do something as

         var v1:Version = new Version( 1,0,0,0 );
         var v2:Version = new Version( 1,0,0,0 );
         trace( int(v1) == int(v2) ); //true
         
A cast to Number/int force the valueOf, not ideal but sufficient, and the same for any other operators. But as we keep IEquatable for now, then we have no reason to not use it.

Parameters
o:*

Returns
Boolean
fromNumber()method 
public static function fromNumber(value:Number = 0):Version

Constructs a Version object from a number. If the number is zero or negative, or is NaN or Infity returns an empty version object.

Parameters
value:Number (default = 0)

Returns
Version
fromString()method 
public static function fromString(value:String = "", separator:String = "."):Version

Constructs a Version object from a string.

Parameters
value:String (default = "")
 
separator:String (default = ".")

Returns
Version
toString()method 
public function toString(fields:int = 0):String

Returns a string representation of the object. By default, the format returned will include only the fields greater than zero

         var v:Version = new Version( 1, 5 );
         trace( v ); // "1.5"
         
note : the fields parameter allow you to force or limit the output format
         var v:Version = new Version( 1, 5 );
         trace( v.toString( 1 ) ); // "1"
         trace( v.toString( 4 ) ); // "1.5.0.0"
         

format :

  • major.minor.build.revision
  • major.minor.build
  • major.minor
  • major
  • Parameters
    fields:int (default = 0)

    Returns
    String
    valueOf()method 
    public function valueOf():uint

    Returns the primitive value of the object.

    Returns
    uint — the primitive value of the object.