?? distinct.as
字號:
package flare.query
{
/**
* Aggregate (group-by) operator for counting the number of distinct
* values in a set of values.
*/
public class Distinct extends AggregateExpression
{
private var _map:Object;
private var _count:int;
/**
* Creates a new Distinct operator
* @param input the sub-expression of which to compute the distinct
* values
*/
public function Distinct(input:*) {
super(input);
}
/**
* @inheritDoc
*/
public override function reset():void
{
_map = {};
_count = 0;
}
/**
* @inheritDoc
*/
public override function eval(o:Object=null):*
{
return _count;
}
/**
* @inheritDoc
*/
public override function aggregate(value:Object):void
{
value = _expr.eval(value);
if (_map[value] == undefined) {
_count++;
_map[value] = 1;
}
}
} // end of class Distinct
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -