root / trunk / web / dojo / dojox / lang / functional / linrec.js @ 12
History | View | Annotate | Download (1.38 KB)
| 1 |
/*
|
|---|---|
| 2 |
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
| 3 |
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
| 4 |
see: http://dojotoolkit.org/license for details
|
| 5 |
*/
|
| 6 |
|
| 7 |
|
| 8 |
if(!dojo._hasResource["dojox.lang.functional.linrec"]){ |
| 9 |
dojo._hasResource["dojox.lang.functional.linrec"]=true; |
| 10 |
dojo.provide("dojox.lang.functional.linrec");
|
| 11 |
dojo.require("dojox.lang.functional.lambda");
|
| 12 |
dojo.require("dojox.lang.functional.util");
|
| 13 |
(function(){
|
| 14 |
var df=dojox.lang.functional,_1=df.inlineLambda,_2="_x",_3=["_r","_y.a"]; |
| 15 |
df.linrec=function(_4,_5,_6,_7){ |
| 16 |
var c,t,b,a,cs,ts,bs,as,_8={},_9={},_a=function(x){ |
| 17 |
_8[x]=1;
|
| 18 |
}; |
| 19 |
if(typeof _4=="string"){ |
| 20 |
cs=_1(_4,_2,_a); |
| 21 |
}else{
|
| 22 |
c=df.lambda(_4); |
| 23 |
cs="_c.apply(this, _x)";
|
| 24 |
_9["_c=_t.c"]=1; |
| 25 |
} |
| 26 |
if(typeof _5=="string"){ |
| 27 |
ts=_1(_5,_2,_a); |
| 28 |
}else{
|
| 29 |
t=df.lambda(_5); |
| 30 |
ts="_t.t.apply(this, _x)";
|
| 31 |
} |
| 32 |
if(typeof _6=="string"){ |
| 33 |
bs=_1(_6,_2,_a); |
| 34 |
}else{
|
| 35 |
b=df.lambda(_6); |
| 36 |
bs="_b.apply(this, _x)";
|
| 37 |
_9["_b=_t.b"]=1; |
| 38 |
} |
| 39 |
if(typeof _7=="string"){ |
| 40 |
as=_1(_7,_3,_a); |
| 41 |
}else{
|
| 42 |
a=df.lambda(_7); |
| 43 |
as="_a.call(this, _r, _y.a)";
|
| 44 |
_9["_a=_t.a"]=1; |
| 45 |
} |
| 46 |
var _b=df.keys(_8),_c=df.keys(_9),f=new Function([],"var _x=arguments,_y,_r".concat(_b.length?","+_b.join(","):"",_c.length?",_t=_x.callee,"+_c.join(","):t?",_t=_x.callee":"",";for(;!",cs,";_x=",bs,"){_y={p:_y,a:_x}}_r=",ts,";for(;_y;_y=_y.p){_r=",as,"}return _r")); |
| 47 |
if(c){
|
| 48 |
f.c=c; |
| 49 |
} |
| 50 |
if(t){
|
| 51 |
f.t=t; |
| 52 |
} |
| 53 |
if(b){
|
| 54 |
f.b=b; |
| 55 |
} |
| 56 |
if(a){
|
| 57 |
f.a=a; |
| 58 |
} |
| 59 |
return f;
|
| 60 |
}; |
| 61 |
})(); |
| 62 |
} |