ECOBC ;BP/CMF - Criteria Object
;;2.0;EVENT CAPTURE;**100**;8 May 96;Build 21
;@author - Chris Flegel
;@date - 17 May 2009
;@version - 1.0
;;
Q
;; private methods
CLEAR(RESULT,HANDLE,PARAMS) ; restore criteria to default values
D METHOD(.RESULT,HANDLE_".SetLastItem.0")
D METHOD(.RESULT,HANDLE_".SetLastValue.")
K @HANDLE@("CriteriaItem")
K @HANDLE@("CriteriaValue")
Q
;;
FIND(RESULT,HANDLE,PARAMS) ; return list that matches params
;be certain to set 'last' property to last found result
;RESULT.Count = # of matching items found
;RESULT.Search = actual string searched for
;RESULT.Pattern = the piece pattern used for result.item
;RESULT.Item.1 = 1st item found
;RESULT.Item.2 = 2nd item found...
N EQUALS,ITEM,ITEMS,VALUE,NAME,OUT,RETURN,X ;,CONTAINS,BEGINS
;;;D PARSE("Handle",HANDLE)
S VALUE=$S($G(PARAMS)'="":PARAMS,1:"~nil~")
D METHOD(.NAME,HANDLE_".Get_namespace")
S OUT=$$CREATE^ECOBL(NAME)
S RESULT=OUT
D PROPERTY^ECOBL(OUT,"Pu","Search",VALUE)
D PROPERTY^ECOBL(OUT,"Pu","Result","0^No items found.")
D METHOD(.EQUALS,HANDLE_".GetEquals")
D:EQUALS="true" Q
.Q:'$D(@HANDLE@("CriteriaValue",VALUE))
.S ITEM=0
.S ITEMS=0
.F S ITEM=$O(@HANDLE@("CriteriaValue",VALUE,ITEM)) Q:ITEM="" D
..S ITEMS=ITEMS+1
..S RETURN=$$ONRETURN(ITEM,VALUE)
..D METHOD^ECOBL(.X,OUT_".Add."_RETURN)
..D METHOD(.X,HANDLE_".SetLastItem."_ITEM)
..D METHOD(.X,HANDLE_".SetLastValue."_VALUE)
..Q
.D METHOD(.X,OUT_".SetResult."_ITEMS_"^Item(s) found")
.S RESULT=OUT
.Q
.;;
;;D METHOD(.CONTAINS,HANDLE_".GetContains")
;;D:CONTAINS="true"
;;.Q
;;.;;
;;D METHOD(.BEGINS,HANDLE_".GetBeginsWith")
;;D:BEGINS="true"
;;.Q
;;.;;
S RESULT="-1^'Find' method not fully implemented yet"
Q
;;
FIND1(RESULT,HANDLE,PARAMS) ; return first value that matches params
N ITEM,VALUE
S RESULT=""
S VALUE=$G(PARAMS)
Q:VALUE=""
Q:'$D(@HANDLE@("CriteriaValue",VALUE))
S ITEM=$O(@HANDLE@("CriteriaValue",VALUE,""))
S RESULT=$$ONRETURN(ITEM,VALUE)
Q
;;
FIRST(RESULT,HANDLE,PARAMS) ; return first item in sequence
N X
D METHOD(.X,HANDLE_".SetLastItem.0")
D METHOD(.X,HANDLE_".SetLastValue.")
D NEXT(.RESULT,HANDLE,PARAMS)
Q
;;
INDEX(RESULT,HANDLE,PARAMS) ; params are item of parent collector
N PARENT,ITEM,VALUE,NAME,COUNT,ARGUMENT,INDEXOF,CHILD
;;;D PARSE("Handle",HANDLE)
D GET^ECOBL(.PARENT,HANDLE,"Pr","_collector")
S ITEM=+PARAMS
I ITEM<1 S RESULT="-1^Invalid item "_ITEM_" for index" Q
;kill old indices
D
.Q:'$D(@HANDLE@("CriteriaItem",ITEM))
.S VALUE=$O(@HANDLE@("CriteriaItem",ITEM,""))
.S VALUE=$S(VALUE="":"~nil~",1:VALUE)
.K @HANDLE@("CriteriaItem",ITEM)
.K @HANDLE@("CriteriaValue",VALUE,ITEM)
;set new indices
D METHOD(.INDEXOF,HANDLE_".GetIndexOf")
I INDEXOF="list" D
.D GETITEM^ECOBL(.VALUE,PARENT,ITEM)
.S VALUE=$S(VALUE="":"~nil~",1:VALUE)
.Q
E D
.D METHOD(.ARGUMENT,HANDLE_".GetArgument")
.D GETITEM^ECOBL(.CHILD,PARENT,ITEM)
.D METHOD^ECOB(.VALUE,CHILD_"."_ARGUMENT) ;generic call
.S VALUE=$S(VALUE="":"~nil~",1:VALUE)
.Q
S @HANDLE@("CriteriaItem",ITEM,VALUE)=""
S @HANDLE@("CriteriaValue",VALUE,ITEM)=""
Q
;;
INFO(RESULT,HANDLE,PARAMS) ;
D INFO^ECOB2(.RESULT,HANDLE,PARAMS)
Q
;;
LAST(RESULT,HANDLE,PARAMS) ; return last referenced item
;to do: implement .object argument method calls
N LASTITEM,LASTVALU,ONRETURN
D METHOD(.LASTITEM,HANDLE_".GetLastItem")
D METHOD(.LASTVALU,HANDLE_".GetLastValue")
S RESULT=$$ONRETURN(LASTITEM,LASTVALU) ;NEXT_"^"_VALUE
Q
;;
NEXT(RESULT,HANDLE,PARAMS) ; return next item^value in sequence
;be certain to set 'last' property to result
N ARGUMENT,INDEXOF,LASTITEM,LASTVALU
N NAME,COUNT,NEXT,VALUE,X
D METHOD(.ARGUMENT,HANDLE_".GetArgument")
D METHOD(.INDEXOF,HANDLE_".GetIndexOf")
D METHOD(.LASTITEM,HANDLE_".GetLastItem")
D METHOD(.LASTVALU,HANDLE_".GetLastValue")
;D METHOD(.LVALITEM,HANDLE_".GetLastValueItem")
;;;D PARSE("Handle",HANDLE)
I INDEXOF="list" D Q
.S NEXT=$O(@HANDLE@("CriteriaItem",LASTITEM))
.I NEXT="" S RESULT="-1^End of list" Q
.S VALUE=$O(@HANDLE@("CriteriaItem",NEXT,""))
.S RESULT=$$ONRETURN(NEXT,VALUE) ;NEXT_"^"_VALUE
.D METHOD(.X,HANDLE_".SetLastItem."_NEXT)
.D METHOD(.X,HANDLE_".SetLastValue."_VALUE)
.;D METHOD(.X,HANDLE_".SetLastValueItem.")
;;
I INDEXOF="value" D Q
.S VALUE=$O(@HANDLE@("CriteriaValue",LASTVALU))
.;S VALUE=$O(@HANDLE@("CriteriaValue",LASTVALU,LVALITEM))
.I VALUE="" S RESULT="-1^End of list" Q
.S NEXT=$O(@HANDLE@("CriteriaValue",VALUE,""))
.;S NEXT=$O(@HANDLE@("CriteriaValue",VALUE,LVALITEM))
.S RESULT=$$ONRETURN(NEXT,VALUE) ;NEXT_"^"_VALUE
.D METHOD(.X,HANDLE_".SetLastItem."_NEXT)
.D METHOD(.X,HANDLE_".SetLastValue."_VALUE)
.;D METHOD(.X,HANDLE_".SetLastValueItem."_LVALITEM)
.Q
;;
I INDEXOF="object" D
.;to do: Get object handle (use _collector),
.; then call method represented by PARAMS
.Q
S RESULT="-1^'Next' method not fully implemented"
Q
;;
ONRETURN(ITEM,VALUE) ;
N ONRETURN,RESULT,PARENT
S RESULT=ITEM_"^"_VALUE
D METHOD(.ONRETURN,HANDLE_".GetOnReturn")
I ONRETURN="value" Q VALUE
I ONRETURN="item" Q ITEM
I ONRETURN="handle" D Q RESULT
.D GET^ECOBL(.PARENT,HANDLE,"Pr","_collector")
.D METHOD^ECOBL(.RESULT,PARENT_".GetItem."_ITEM)
.Q
;;
PARSE(PARSE,VALUE) ;
D PARSE^ECOBL(PARSE,VALUE)
Q
;;
PROPERTY(HANDLE,SCOPE,PROPERTY,VALUE) ;
D PROPERTY^ECOBL(HANDLE,SCOPE,PROPERTY,VALUE)
Q
;;
REINDEX(RESULT,HANDLE) ; Reindex collection
N PARENT,ITEM
D GET^ECOBL(.PARENT,HANDLE,"Pr","_collector")
;;;D PARSE("Handle",PARENT)
S ITEM=0
F S ITEM=$O(@HANDLE@("Pr","list",ITEM)) Q:+ITEM=0 D
.D INDEX(.RESULT,HANDLE,ITEM)
.Q
Q
;;
SETARG(RESULT,HANDLE,PARAMS) ;set argument
N VALUE,INDEXOF
S VALUE=$G(PARAMS)
S INDEXOF=$S(VALUE="":"list",1:"value")
D SET^ECOBL(.RESULT,HANDLE,"Pu","Argument",VALUE)
D SET^ECOBL(.RESULT,HANDLE,"Pu","IndexOf",INDEXOF)
D REINDEX(.RESULT,HANDLE)
Q
;;
SETIND(RESULT,HANDLE,PARAMS) ;set indexOf
N VALUE,ARGUMENT
S VALUE=$G(PARAMS)
S VALUE=$S(VALUE="value":VALUE,1:"list")
D SET^ECOBL(.RESULT,HANDLE,"Pu","IndexOf",VALUE)
I VALUE="list" D SET^ECOBL(.RESULT,HANDLE,"Pu","Argument","~nil~")
D REINDEX(.RESULT,HANDLE)
Q
;;
SETRET(RESULT,HANDLE,PARAMS) ;set OnReturn
N VALUE
S VALUE=$G(PARAMS)
S VALUE=$S(VALUE="value":VALUE,VALUE="handle":VALUE,1:"item")
D SET^ECOBL(.RESULT,HANDLE,"Pu","OnReturn",VALUE)
Q
;; protected methods
CREATE(NAME) ;
; call parent first
N HANDLE,X
S HANDLE=$$CREATE^ECOB(NAME)
;;
D SELF^ECOB(.X,HANDLE,"ECOBC","Criteria","METHOD^ECOBC(.RESULT,ARGUMENT)","ECOBC")
;;
D PROPERTY(HANDLE,"Pr","_collector","")
D PROPERTY(HANDLE,"Pu","Argument","~nil~")
D PROPERTY(HANDLE,"Pu","BeginsWith","false")
D PROPERTY(HANDLE,"Pu","Contains","false")
D PROPERTY(HANDLE,"Pu","Equals","true")
D PROPERTY(HANDLE,"Pu","IndexOf","list")
D PROPERTY(HANDLE,"Pu","LastItem",0)
D PROPERTY(HANDLE,"Pu","LastValue","")
D PROPERTY(HANDLE,"Pu","LastValueItem","")
D PROPERTY(HANDLE,"Pu","OnReturn","value")
D PROPERTY(HANDLE,"Pu","Unique","false")
; complex properties last
Q HANDLE
;;
DESTROY(HANDLE) ;
; call parent last
Q $$DESTROY^ECOB(HANDLE)
;;
METHOD(RESULT,ARGUMENT) ;
N HANDLE,METHOD,PARAMS
D PARSE("Handle",ARGUMENT)
D PARSE("Method",ARGUMENT)
D PARSE("Params",ARGUMENT)
I METHOD="Clear" D CLEAR(.RESULT,HANDLE,PARAMS) Q
I METHOD="Find" D FIND(.RESULT,HANDLE,PARAMS) Q
I METHOD="Find1" D FIND1(.RESULT,HANDLE,PARAMS) Q
I METHOD="First" D FIRST(.RESULT,HANDLE,PARAMS) Q
I METHOD="Index" D INDEX(.RESULT,HANDLE,PARAMS) Q
I METHOD="Last" D LAST(.RESULT,HANDLE,PARAMS) Q
I METHOD="Next" D NEXT(.RESULT,HANDLE,PARAMS) Q
I METHOD="SetOnReturn" D SETRET(.RESULT,HANDLE,PARAMS) Q
I METHOD="SetArgument" D SETARG(.RESULT,HANDLE,PARAMS) Q
I METHOD="SetIndexOf" D SETIND(.RESULT,HANDLE,PARAMS) Q
D METHOD^ECOB2(.RESULT,ARGUMENT)
Q
;;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HECOBC 8026 printed Dec 13, 2024@01:58:03 Page 2
ECOBC ;BP/CMF - Criteria Object
+1 ;;2.0;EVENT CAPTURE;**100**;8 May 96;Build 21
+2 ;@author - Chris Flegel
+3 ;@date - 17 May 2009
+4 ;@version - 1.0
+5 ;;
+6 QUIT
+7 ;; private methods
CLEAR(RESULT,HANDLE,PARAMS) ; restore criteria to default values
+1 DO METHOD(.RESULT,HANDLE_".SetLastItem.0")
+2 DO METHOD(.RESULT,HANDLE_".SetLastValue.")
+3 KILL @HANDLE@("CriteriaItem")
+4 KILL @HANDLE@("CriteriaValue")
+5 QUIT
+6 ;;
FIND(RESULT,HANDLE,PARAMS) ; return list that matches params
+1 ;be certain to set 'last' property to last found result
+2 ;RESULT.Count = # of matching items found
+3 ;RESULT.Search = actual string searched for
+4 ;RESULT.Pattern = the piece pattern used for result.item
+5 ;RESULT.Item.1 = 1st item found
+6 ;RESULT.Item.2 = 2nd item found...
+7 ;,CONTAINS,BEGINS
NEW EQUALS,ITEM,ITEMS,VALUE,NAME,OUT,RETURN,X
+8 ;;;D PARSE("Handle",HANDLE)
+9 SET VALUE=$SELECT($GET(PARAMS)'="":PARAMS,1:"~nil~")
+10 DO METHOD(.NAME,HANDLE_".Get_namespace")
+11 SET OUT=$$CREATE^ECOBL(NAME)
+12 SET RESULT=OUT
+13 DO PROPERTY^ECOBL(OUT,"Pu","Search",VALUE)
+14 DO PROPERTY^ECOBL(OUT,"Pu","Result","0^No items found.")
+15 DO METHOD(.EQUALS,HANDLE_".GetEquals")
+16 if EQUALS="true"
Begin DoDot:1
+17 if '$DATA(@HANDLE@("CriteriaValue",VALUE))
QUIT
+18 SET ITEM=0
+19 SET ITEMS=0
+20 FOR
SET ITEM=$ORDER(@HANDLE@("CriteriaValue",VALUE,ITEM))
if ITEM=""
QUIT
Begin DoDot:2
+21 SET ITEMS=ITEMS+1
+22 SET RETURN=$$ONRETURN(ITEM,VALUE)
+23 DO METHOD^ECOBL(.X,OUT_".Add."_RETURN)
+24 DO METHOD(.X,HANDLE_".SetLastItem."_ITEM)
+25 DO METHOD(.X,HANDLE_".SetLastValue."_VALUE)
+26 QUIT
End DoDot:2
+27 DO METHOD(.X,OUT_".SetResult."_ITEMS_"^Item(s) found")
+28 SET RESULT=OUT
+29 QUIT
+30 ;;
End DoDot:1
QUIT
+31 ;;D METHOD(.CONTAINS,HANDLE_".GetContains")
+32 ;;D:CONTAINS="true"
+33 ;;.Q
+34 ;;.;;
+35 ;;D METHOD(.BEGINS,HANDLE_".GetBeginsWith")
+36 ;;D:BEGINS="true"
+37 ;;.Q
+38 ;;.;;
+39 SET RESULT="-1^'Find' method not fully implemented yet"
+40 QUIT
+41 ;;
FIND1(RESULT,HANDLE,PARAMS) ; return first value that matches params
+1 NEW ITEM,VALUE
+2 SET RESULT=""
+3 SET VALUE=$GET(PARAMS)
+4 if VALUE=""
QUIT
+5 if '$DATA(@HANDLE@("CriteriaValue",VALUE))
QUIT
+6 SET ITEM=$ORDER(@HANDLE@("CriteriaValue",VALUE,""))
+7 SET RESULT=$$ONRETURN(ITEM,VALUE)
+8 QUIT
+9 ;;
FIRST(RESULT,HANDLE,PARAMS) ; return first item in sequence
+1 NEW X
+2 DO METHOD(.X,HANDLE_".SetLastItem.0")
+3 DO METHOD(.X,HANDLE_".SetLastValue.")
+4 DO NEXT(.RESULT,HANDLE,PARAMS)
+5 QUIT
+6 ;;
INDEX(RESULT,HANDLE,PARAMS) ; params are item of parent collector
+1 NEW PARENT,ITEM,VALUE,NAME,COUNT,ARGUMENT,INDEXOF,CHILD
+2 ;;;D PARSE("Handle",HANDLE)
+3 DO GET^ECOBL(.PARENT,HANDLE,"Pr","_collector")
+4 SET ITEM=+PARAMS
+5 IF ITEM<1
SET RESULT="-1^Invalid item "_ITEM_" for index"
QUIT
+6 ;kill old indices
+7 Begin DoDot:1
+8 if '$DATA(@HANDLE@("CriteriaItem",ITEM))
QUIT
+9 SET VALUE=$ORDER(@HANDLE@("CriteriaItem",ITEM,""))
+10 SET VALUE=$SELECT(VALUE="":"~nil~",1:VALUE)
+11 KILL @HANDLE@("CriteriaItem",ITEM)
+12 KILL @HANDLE@("CriteriaValue",VALUE,ITEM)
End DoDot:1
+13 ;set new indices
+14 DO METHOD(.INDEXOF,HANDLE_".GetIndexOf")
+15 IF INDEXOF="list"
Begin DoDot:1
+16 DO GETITEM^ECOBL(.VALUE,PARENT,ITEM)
+17 SET VALUE=$SELECT(VALUE="":"~nil~",1:VALUE)
+18 QUIT
End DoDot:1
+19 IF '$TEST
Begin DoDot:1
+20 DO METHOD(.ARGUMENT,HANDLE_".GetArgument")
+21 DO GETITEM^ECOBL(.CHILD,PARENT,ITEM)
+22 ;generic call
DO METHOD^ECOB(.VALUE,CHILD_"."_ARGUMENT)
+23 SET VALUE=$SELECT(VALUE="":"~nil~",1:VALUE)
+24 QUIT
End DoDot:1
+25 SET @HANDLE@("CriteriaItem",ITEM,VALUE)=""
+26 SET @HANDLE@("CriteriaValue",VALUE,ITEM)=""
+27 QUIT
+28 ;;
INFO(RESULT,HANDLE,PARAMS) ;
+1 DO INFO^ECOB2(.RESULT,HANDLE,PARAMS)
+2 QUIT
+3 ;;
LAST(RESULT,HANDLE,PARAMS) ; return last referenced item
+1 ;to do: implement .object argument method calls
+2 NEW LASTITEM,LASTVALU,ONRETURN
+3 DO METHOD(.LASTITEM,HANDLE_".GetLastItem")
+4 DO METHOD(.LASTVALU,HANDLE_".GetLastValue")
+5 ;NEXT_"^"_VALUE
SET RESULT=$$ONRETURN(LASTITEM,LASTVALU)
+6 QUIT
+7 ;;
NEXT(RESULT,HANDLE,PARAMS) ; return next item^value in sequence
+1 ;be certain to set 'last' property to result
+2 NEW ARGUMENT,INDEXOF,LASTITEM,LASTVALU
+3 NEW NAME,COUNT,NEXT,VALUE,X
+4 DO METHOD(.ARGUMENT,HANDLE_".GetArgument")
+5 DO METHOD(.INDEXOF,HANDLE_".GetIndexOf")
+6 DO METHOD(.LASTITEM,HANDLE_".GetLastItem")
+7 DO METHOD(.LASTVALU,HANDLE_".GetLastValue")
+8 ;D METHOD(.LVALITEM,HANDLE_".GetLastValueItem")
+9 ;;;D PARSE("Handle",HANDLE)
+10 IF INDEXOF="list"
Begin DoDot:1
+11 SET NEXT=$ORDER(@HANDLE@("CriteriaItem",LASTITEM))
+12 IF NEXT=""
SET RESULT="-1^End of list"
QUIT
+13 SET VALUE=$ORDER(@HANDLE@("CriteriaItem",NEXT,""))
+14 ;NEXT_"^"_VALUE
SET RESULT=$$ONRETURN(NEXT,VALUE)
+15 DO METHOD(.X,HANDLE_".SetLastItem."_NEXT)
+16 DO METHOD(.X,HANDLE_".SetLastValue."_VALUE)
+17 ;D METHOD(.X,HANDLE_".SetLastValueItem.")
End DoDot:1
QUIT
+18 ;;
+19 IF INDEXOF="value"
Begin DoDot:1
+20 SET VALUE=$ORDER(@HANDLE@("CriteriaValue",LASTVALU))
+21 ;S VALUE=$O(@HANDLE@("CriteriaValue",LASTVALU,LVALITEM))
+22 IF VALUE=""
SET RESULT="-1^End of list"
QUIT
+23 SET NEXT=$ORDER(@HANDLE@("CriteriaValue",VALUE,""))
+24 ;S NEXT=$O(@HANDLE@("CriteriaValue",VALUE,LVALITEM))
+25 ;NEXT_"^"_VALUE
SET RESULT=$$ONRETURN(NEXT,VALUE)
+26 DO METHOD(.X,HANDLE_".SetLastItem."_NEXT)
+27 DO METHOD(.X,HANDLE_".SetLastValue."_VALUE)
+28 ;D METHOD(.X,HANDLE_".SetLastValueItem."_LVALITEM)
+29 QUIT
End DoDot:1
QUIT
+30 ;;
+31 IF INDEXOF="object"
Begin DoDot:1
+32 ;to do: Get object handle (use _collector),
+33 ; then call method represented by PARAMS
+34 QUIT
End DoDot:1
+35 SET RESULT="-1^'Next' method not fully implemented"
+36 QUIT
+37 ;;
ONRETURN(ITEM,VALUE) ;
+1 NEW ONRETURN,RESULT,PARENT
+2 SET RESULT=ITEM_"^"_VALUE
+3 DO METHOD(.ONRETURN,HANDLE_".GetOnReturn")
+4 IF ONRETURN="value"
QUIT VALUE
+5 IF ONRETURN="item"
QUIT ITEM
+6 IF ONRETURN="handle"
Begin DoDot:1
+7 DO GET^ECOBL(.PARENT,HANDLE,"Pr","_collector")
+8 DO METHOD^ECOBL(.RESULT,PARENT_".GetItem."_ITEM)
+9 QUIT
End DoDot:1
QUIT RESULT
+10 ;;
PARSE(PARSE,VALUE) ;
+1 DO PARSE^ECOBL(PARSE,VALUE)
+2 QUIT
+3 ;;
PROPERTY(HANDLE,SCOPE,PROPERTY,VALUE) ;
+1 DO PROPERTY^ECOBL(HANDLE,SCOPE,PROPERTY,VALUE)
+2 QUIT
+3 ;;
REINDEX(RESULT,HANDLE) ; Reindex collection
+1 NEW PARENT,ITEM
+2 DO GET^ECOBL(.PARENT,HANDLE,"Pr","_collector")
+3 ;;;D PARSE("Handle",PARENT)
+4 SET ITEM=0
+5 FOR
SET ITEM=$ORDER(@HANDLE@("Pr","list",ITEM))
if +ITEM=0
QUIT
Begin DoDot:1
+6 DO INDEX(.RESULT,HANDLE,ITEM)
+7 QUIT
End DoDot:1
+8 QUIT
+9 ;;
SETARG(RESULT,HANDLE,PARAMS) ;set argument
+1 NEW VALUE,INDEXOF
+2 SET VALUE=$GET(PARAMS)
+3 SET INDEXOF=$SELECT(VALUE="":"list",1:"value")
+4 DO SET^ECOBL(.RESULT,HANDLE,"Pu","Argument",VALUE)
+5 DO SET^ECOBL(.RESULT,HANDLE,"Pu","IndexOf",INDEXOF)
+6 DO REINDEX(.RESULT,HANDLE)
+7 QUIT
+8 ;;
SETIND(RESULT,HANDLE,PARAMS) ;set indexOf
+1 NEW VALUE,ARGUMENT
+2 SET VALUE=$GET(PARAMS)
+3 SET VALUE=$SELECT(VALUE="value":VALUE,1:"list")
+4 DO SET^ECOBL(.RESULT,HANDLE,"Pu","IndexOf",VALUE)
+5 IF VALUE="list"
DO SET^ECOBL(.RESULT,HANDLE,"Pu","Argument","~nil~")
+6 DO REINDEX(.RESULT,HANDLE)
+7 QUIT
+8 ;;
SETRET(RESULT,HANDLE,PARAMS) ;set OnReturn
+1 NEW VALUE
+2 SET VALUE=$GET(PARAMS)
+3 SET VALUE=$SELECT(VALUE="value":VALUE,VALUE="handle":VALUE,1:"item")
+4 DO SET^ECOBL(.RESULT,HANDLE,"Pu","OnReturn",VALUE)
+5 QUIT
+6 ;; protected methods
CREATE(NAME) ;
+1 ; call parent first
+2 NEW HANDLE,X
+3 SET HANDLE=$$CREATE^ECOB(NAME)
+4 ;;
+5 DO SELF^ECOB(.X,HANDLE,"ECOBC","Criteria","METHOD^ECOBC(.RESULT,ARGUMENT)","ECOBC")
+6 ;;
+7 DO PROPERTY(HANDLE,"Pr","_collector","")
+8 DO PROPERTY(HANDLE,"Pu","Argument","~nil~")
+9 DO PROPERTY(HANDLE,"Pu","BeginsWith","false")
+10 DO PROPERTY(HANDLE,"Pu","Contains","false")
+11 DO PROPERTY(HANDLE,"Pu","Equals","true")
+12 DO PROPERTY(HANDLE,"Pu","IndexOf","list")
+13 DO PROPERTY(HANDLE,"Pu","LastItem",0)
+14 DO PROPERTY(HANDLE,"Pu","LastValue","")
+15 DO PROPERTY(HANDLE,"Pu","LastValueItem","")
+16 DO PROPERTY(HANDLE,"Pu","OnReturn","value")
+17 DO PROPERTY(HANDLE,"Pu","Unique","false")
+18 ; complex properties last
+19 QUIT HANDLE
+20 ;;
DESTROY(HANDLE) ;
+1 ; call parent last
+2 QUIT $$DESTROY^ECOB(HANDLE)
+3 ;;
METHOD(RESULT,ARGUMENT) ;
+1 NEW HANDLE,METHOD,PARAMS
+2 DO PARSE("Handle",ARGUMENT)
+3 DO PARSE("Method",ARGUMENT)
+4 DO PARSE("Params",ARGUMENT)
+5 IF METHOD="Clear"
DO CLEAR(.RESULT,HANDLE,PARAMS)
QUIT
+6 IF METHOD="Find"
DO FIND(.RESULT,HANDLE,PARAMS)
QUIT
+7 IF METHOD="Find1"
DO FIND1(.RESULT,HANDLE,PARAMS)
QUIT
+8 IF METHOD="First"
DO FIRST(.RESULT,HANDLE,PARAMS)
QUIT
+9 IF METHOD="Index"
DO INDEX(.RESULT,HANDLE,PARAMS)
QUIT
+10 IF METHOD="Last"
DO LAST(.RESULT,HANDLE,PARAMS)
QUIT
+11 IF METHOD="Next"
DO NEXT(.RESULT,HANDLE,PARAMS)
QUIT
+12 IF METHOD="SetOnReturn"
DO SETRET(.RESULT,HANDLE,PARAMS)
QUIT
+13 IF METHOD="SetArgument"
DO SETARG(.RESULT,HANDLE,PARAMS)
QUIT
+14 IF METHOD="SetIndexOf"
DO SETIND(.RESULT,HANDLE,PARAMS)
QUIT
+15 DO METHOD^ECOB2(.RESULT,ARGUMENT)
+16 QUIT
+17 ;;