Created
November 30, 2010 18:22
-
-
Save squeedee/722117 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.visfleet.core { | |
public function chance(numerator:int = 50, denominator:int = 100):Boolean { | |
var odds:Number = Number(numerator)/denominator; | |
return Math.random() <= odds; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.visfleet.core { | |
public function defaultIfNull(value:*,defaultValue:*):* { | |
if (value == null) | |
return defaultValue; | |
return value; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.visfleet.core { | |
public function defaultIfNullOrEmpty(value:*, defaultValue:*):* { | |
if (isNull(value)) | |
return defaultValue; | |
if (value.toString() == "") | |
return defaultValue; | |
return value; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.visfleet.core { | |
public function isNotNull(value:*):Boolean { | |
return value != null; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.visfleet.core { | |
public function isNull(value:*):Boolean { | |
return value == null; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.visfleet.core { | |
public function isNullOrEmpty(value:*):Boolean { | |
return (value == null) || (value.toString() == ""); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.visfleet.core { | |
public function times(repeat:uint):Array { | |
return new Array(repeat); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment