ECOBUL ;BP/CMF - List Utility object
;;2.0;EVENT CAPTURE;**100**;8 May 96;Build 21
;@author - Chris Flegel
;@date - 17 May 2009
;@version - 1.0
;;
Q
;;protected methods
ADD(RESULT,HANDLE,PARAMS) ; add simple list item
D METHOD(.RESULT,HANDLE_".List.Add."_PARAMS)
Q
;;
CLEAR(RESULT,HANDLE,PARAMS) ; restore object to default state
D CLEAR^ECOBU(.RESULT,HANDLE,PARAMS) ; parent method
D METHOD(.RESULT,HANDLE_".List.Clear")
Q
;;
COLLECT(RESULT,HANDLE,CHILD) ; add a child object to the list
N ITEM
D ADD(.ITEM,HANDLE,CHILD)
S @HANDLE@("Pr","list","Handle",CHILD)=ITEM
S RESULT=ITEM
Q
;;
FIRST(RESULT,HANDLE,PARAMS) ;
D METHOD(.RESULT,HANDLE_".List.Criteria.First")
Q
;;
FIND(RESULT,HANDLE,PARAMS) ;
D METHOD(.RESULT,HANDLE_".List.Criteria.Find."_PARAMS)
Q
;;
FIND1(RESULT,HANDLE,PARAMS) ;
D METHOD(.RESULT,HANDLE_".List.Criteria.Find1."_PARAMS)
Q
;;
GET(RESULT,HANDLE,SCOPE,PROPERTY) ;
; if unique get methods, call them first, else call parent
D GET^ECOB(.RESULT,HANDLE,SCOPE,PROPERTY)
Q
;;
GETITEM(RESULT,HANDLE,ITEM) ; get simple list item
D METHOD(.RESULT,HANDLE_".List.GetItem."_ITEM)
Q
;;
INFO(RESULT,HANDLE,PARAMS) ;
N LIST,JUSTIFY,OFFSET
D PARSE("Offset",PARAMS)
D INFO^ECOBU(.RESULT,HANDLE,PARAMS) ; parent method
D METHOD^ECOB2(.LIST,HANDLE_".GetList")
D METHOD^ECOBL(.RESULT,LIST_".Info."_JUSTIFY)
Q
;;
ISHANDLE(RESULT,HANDLE,PARAMS) ; is value a collected handle
D METHOD(.RESULT,HANDLE_".List.IsHandle."_PARAMS)
Q
;
LAST(RESULT,HANDLE,PARAMS) ; get the last referenced item from the list
D METHOD(.RESULT,HANDLE_".List.Criteria.Last")
Q
;
NEXT(RESULT,HANDLE,PARAMS) ; get the next item from the list
D METHOD(.RESULT,HANDLE_".List.Criteria.Next")
Q
;;
SETITEM(RESULT,HANDLE,PARAMS) ; set simple list item
D METHOD(.RESULT,HANDLE_".List.SetItem."_PARAMS)
Q
;;
PARSE(PARSE,VALUE) ;
D PARSE^ECOBL(PARSE,VALUE)
Q
;;
ECOBL(RESULT,HANDLE,ARGUMENT) ; handler for the actual list object
N CHILD
D METHOD(.CHILD,HANDLE_".GetList")
D METHOD^ECOBL(.RESULT,CHILD_"."_ARGUMENT)
Q
;;
OB2(RESULT,ARGUMENT) ;short cut to primitive object
D METHOD^ECOB2(.RESULT,ARGUMENT) Q
;;
OBM(RESULT,ARGUMENT) ;short cut to method object
D METHOD^ECOBM(.RESULT,ARGUMENT) Q
;;
;; public methods
CREATE(NAME) ; call parent first
N HANDLE,CHILD,X
S HANDLE=$$CREATE^ECOBU(NAME)
;;
D METHOD(.X,HANDLE_".of.Set_name.List Utility")
D METHOD(.X,HANDLE_".of.Set_class.EC OBU UTILITY LIST")
D METHOD(.X,HANDLE_".of.Set_routine.METHOD^ECOBUL(.RESULT,ARGUMENT)")
D METHOD(.X,HANDLE_".Root.Add.EC OBU UTILITY LIST")
;;
D METHOD(.CHILD,HANDLE_".Methods.Add.Add")
D METHOD(.X,CHILD_".mf.SetAddedByClass.List Utility")
D METHOD(.X,CHILD_".mf.SetDescription.Default Add for list objects.")
D METHOD(.X,CHILD_".mf.SetHandler.ADD^ECOBUL(.RESULT,HANDLE,PARAMS)")
D METHOD(.X,CHILD_".mf.SetParams.Value ... to be added")
D METHOD(.X,CHILD_".mf.SetReturns.Item # added to the list")
;;
D METHOD(.CHILD,HANDLE_".Methods.Override.Clear")
D METHOD(.X,CHILD_".mf.SetAddedByClass.List Utility")
D METHOD(.X,CHILD_".mf.SetDescription.Restore object to default state.")
D METHOD(.X,CHILD_".mf.SetHandler.CLEAR^ECOBUL(.RESULT,HANDLE,PARAMS)")
D METHOD(.X,CHILD_".mf.SetParams.")
D METHOD(.X,CHILD_".mf.SetReturns.1")
;;
D METHOD(.CHILD,HANDLE_".Methods.Add.Find")
D METHOD(.X,CHILD_".mf.SetAddedByClass.List Utility")
D METHOD(.X,CHILD_".mf.SetDescription.Default Find for list objects.")
D METHOD(.X,CHILD_".mf.SetHandler.FIND^ECOBUL(.RESULT,HANDLE,PARAMS)")
D METHOD(.X,CHILD_".mf.SetParams.Value ... what to look for")
D METHOD(.X,CHILD_".mf.SetReturns.Array of matches")
;
D METHOD(.CHILD,HANDLE_".Methods.Add.Find1")
D METHOD(.X,CHILD_".mf.SetAddedByClass.List Utility")
D METHOD(.X,CHILD_".mf.SetDescription.Default Find1 for list objects.")
D METHOD(.X,CHILD_".mf.SetHandler.FIND1^ECOBUL(.RESULT,HANDLE,PARAMS)")
D METHOD(.X,CHILD_".mf.SetParams.Value ... what to look for")
D METHOD(.X,CHILD_".mf.SetReturns.First matching value")
;
D METHOD(.CHILD,HANDLE_".Methods.Add.First")
D METHOD(.X,CHILD_".mf.SetAddedByClass.List Utility")
D METHOD(.X,CHILD_".mf.SetDescription.Default First for list objects.")
D METHOD(.X,CHILD_".mf.SetHandler.FIRST^ECOBUL(.RESULT,HANDLE,PARAMS)")
D METHOD(.X,CHILD_".mf.SetParams.")
D METHOD(.X,CHILD_".mf.SetReturns.Handle, Item or Value of first object")
;
D METHOD(.CHILD,HANDLE_".Methods.Add.GetItem")
D METHOD(.X,CHILD_".mf.SetAddedByClass.List Utility")
D METHOD(.X,CHILD_".mf.SetDescription.Default GetItem for list objects.")
D METHOD(.X,CHILD_".mf.SetHandler.GETITEM^ECOBUL(.RESULT,HANDLE,PARAMS)")
D METHOD(.X,CHILD_".mf.SetParams.Item #")
D METHOD(.X,CHILD_".mf.SetReturns.Value of item")
;;
D METHOD(.CHILD,HANDLE_".Methods.Override.Info")
D METHOD(.X,CHILD_".mf.SetAddedByClass.List Utility")
D METHOD(.X,CHILD_".mf.SetDescription.Displays business information.")
D METHOD(.X,CHILD_".mf.SetHandler.INFO^ECOBUL(.RESULT,HANDLE,PARAMS)")
D METHOD(.X,CHILD_".mf.SetParams.[Justify]")
D METHOD(.X,CHILD_".mf.SetReturns.1")
;;
D METHOD(.CHILD,HANDLE_".Methods.Add.Last")
D METHOD(.X,CHILD_".mf.SetAddedByClass.List Utility")
D METHOD(.X,CHILD_".mf.SetDescription.Default Last for list objects.")
D METHOD(.X,CHILD_".mf.SetHandler.LAST^ECOBUL(.RESULT,HANDLE,PARAMS)")
D METHOD(.X,CHILD_".mf.SetParams.")
D METHOD(.X,CHILD_".mf.SetReturns.Handle, Item or Value of most recent object")
;;
D METHOD(.CHILD,HANDLE_".Methods.Add.Next")
D METHOD(.X,CHILD_".mf.SetAddedByClass.List Utility")
D METHOD(.X,CHILD_".mf.SetDescription.Default Next for list objects.")
D METHOD(.X,CHILD_".mf.SetHandler.NEXT^ECOBUL(.RESULT,HANDLE,PARAMS)")
D METHOD(.X,CHILD_".mf.SetParams.")
D METHOD(.X,CHILD_".mf.SetReturns.Handle, Item or Value of next object")
;;
D METHOD(.CHILD,HANDLE_".Methods.Add.SetItem")
D METHOD(.X,CHILD_".mf.SetAddedByClass.List Utility")
D METHOD(.X,CHILD_".mf.SetDescription.Default SetItem for list objects.")
D METHOD(.X,CHILD_".mf.SetHandler.SETITEM^ECOBUL(.RESULT,HANDLE,PARAMS)")
D METHOD(.X,CHILD_".mf.SetParams.Item #.Value ... to be stored")
D METHOD(.X,CHILD_".mf.SetReturns.1 if successful")
;;
S CHILD=$$CREATE^ECOBL(NAME)
D METHOD(.X,HANDLE_".Collect.SetChild."_CHILD)
D METHOD(.X,HANDLE_".Collect.SetName.List")
D METHOD(.X,HANDLE_".Collect.SetHandler.ECOBL^ECOBUL(.RESULT,HANDLE,PARAMS)")
D METHOD(.X,HANDLE_".Collect.Execute")
;
Q HANDLE
;;
DESTROY(HANDLE) ; call parent last
N CHILD
D METHOD(.CHILD,HANDLE_".GetList")
D DESTROY^ECOBL(CHILD)
Q $$DESTROY^ECOBU(HANDLE)
;;
METHOD(RESULT,ARGUMENT) ; argument=[handle].[method].(additional.params...)
D METHOD^ECOBU(.RESULT,ARGUMENT) Q
;;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HECOBUL 6859 printed Oct 16, 2024@17:58:54 Page 2
ECOBUL ;BP/CMF - List Utility 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 ;;protected methods
ADD(RESULT,HANDLE,PARAMS) ; add simple list item
+1 DO METHOD(.RESULT,HANDLE_".List.Add."_PARAMS)
+2 QUIT
+3 ;;
CLEAR(RESULT,HANDLE,PARAMS) ; restore object to default state
+1 ; parent method
DO CLEAR^ECOBU(.RESULT,HANDLE,PARAMS)
+2 DO METHOD(.RESULT,HANDLE_".List.Clear")
+3 QUIT
+4 ;;
COLLECT(RESULT,HANDLE,CHILD) ; add a child object to the list
+1 NEW ITEM
+2 DO ADD(.ITEM,HANDLE,CHILD)
+3 SET @HANDLE@("Pr","list","Handle",CHILD)=ITEM
+4 SET RESULT=ITEM
+5 QUIT
+6 ;;
FIRST(RESULT,HANDLE,PARAMS) ;
+1 DO METHOD(.RESULT,HANDLE_".List.Criteria.First")
+2 QUIT
+3 ;;
FIND(RESULT,HANDLE,PARAMS) ;
+1 DO METHOD(.RESULT,HANDLE_".List.Criteria.Find."_PARAMS)
+2 QUIT
+3 ;;
FIND1(RESULT,HANDLE,PARAMS) ;
+1 DO METHOD(.RESULT,HANDLE_".List.Criteria.Find1."_PARAMS)
+2 QUIT
+3 ;;
GET(RESULT,HANDLE,SCOPE,PROPERTY) ;
+1 ; if unique get methods, call them first, else call parent
+2 DO GET^ECOB(.RESULT,HANDLE,SCOPE,PROPERTY)
+3 QUIT
+4 ;;
GETITEM(RESULT,HANDLE,ITEM) ; get simple list item
+1 DO METHOD(.RESULT,HANDLE_".List.GetItem."_ITEM)
+2 QUIT
+3 ;;
INFO(RESULT,HANDLE,PARAMS) ;
+1 NEW LIST,JUSTIFY,OFFSET
+2 DO PARSE("Offset",PARAMS)
+3 ; parent method
DO INFO^ECOBU(.RESULT,HANDLE,PARAMS)
+4 DO METHOD^ECOB2(.LIST,HANDLE_".GetList")
+5 DO METHOD^ECOBL(.RESULT,LIST_".Info."_JUSTIFY)
+6 QUIT
+7 ;;
ISHANDLE(RESULT,HANDLE,PARAMS) ; is value a collected handle
+1 DO METHOD(.RESULT,HANDLE_".List.IsHandle."_PARAMS)
+2 QUIT
+3 ;
LAST(RESULT,HANDLE,PARAMS) ; get the last referenced item from the list
+1 DO METHOD(.RESULT,HANDLE_".List.Criteria.Last")
+2 QUIT
+3 ;
NEXT(RESULT,HANDLE,PARAMS) ; get the next item from the list
+1 DO METHOD(.RESULT,HANDLE_".List.Criteria.Next")
+2 QUIT
+3 ;;
SETITEM(RESULT,HANDLE,PARAMS) ; set simple list item
+1 DO METHOD(.RESULT,HANDLE_".List.SetItem."_PARAMS)
+2 QUIT
+3 ;;
PARSE(PARSE,VALUE) ;
+1 DO PARSE^ECOBL(PARSE,VALUE)
+2 QUIT
+3 ;;
ECOBL(RESULT,HANDLE,ARGUMENT) ; handler for the actual list object
+1 NEW CHILD
+2 DO METHOD(.CHILD,HANDLE_".GetList")
+3 DO METHOD^ECOBL(.RESULT,CHILD_"."_ARGUMENT)
+4 QUIT
+5 ;;
OB2(RESULT,ARGUMENT) ;short cut to primitive object
+1 DO METHOD^ECOB2(.RESULT,ARGUMENT)
QUIT
+2 ;;
OBM(RESULT,ARGUMENT) ;short cut to method object
+1 DO METHOD^ECOBM(.RESULT,ARGUMENT)
QUIT
+2 ;;
+3 ;; public methods
CREATE(NAME) ; call parent first
+1 NEW HANDLE,CHILD,X
+2 SET HANDLE=$$CREATE^ECOBU(NAME)
+3 ;;
+4 DO METHOD(.X,HANDLE_".of.Set_name.List Utility")
+5 DO METHOD(.X,HANDLE_".of.Set_class.EC OBU UTILITY LIST")
+6 DO METHOD(.X,HANDLE_".of.Set_routine.METHOD^ECOBUL(.RESULT,ARGUMENT)")
+7 DO METHOD(.X,HANDLE_".Root.Add.EC OBU UTILITY LIST")
+8 ;;
+9 DO METHOD(.CHILD,HANDLE_".Methods.Add.Add")
+10 DO METHOD(.X,CHILD_".mf.SetAddedByClass.List Utility")
+11 DO METHOD(.X,CHILD_".mf.SetDescription.Default Add for list objects.")
+12 DO METHOD(.X,CHILD_".mf.SetHandler.ADD^ECOBUL(.RESULT,HANDLE,PARAMS)")
+13 DO METHOD(.X,CHILD_".mf.SetParams.Value ... to be added")
+14 DO METHOD(.X,CHILD_".mf.SetReturns.Item # added to the list")
+15 ;;
+16 DO METHOD(.CHILD,HANDLE_".Methods.Override.Clear")
+17 DO METHOD(.X,CHILD_".mf.SetAddedByClass.List Utility")
+18 DO METHOD(.X,CHILD_".mf.SetDescription.Restore object to default state.")
+19 DO METHOD(.X,CHILD_".mf.SetHandler.CLEAR^ECOBUL(.RESULT,HANDLE,PARAMS)")
+20 DO METHOD(.X,CHILD_".mf.SetParams.")
+21 DO METHOD(.X,CHILD_".mf.SetReturns.1")
+22 ;;
+23 DO METHOD(.CHILD,HANDLE_".Methods.Add.Find")
+24 DO METHOD(.X,CHILD_".mf.SetAddedByClass.List Utility")
+25 DO METHOD(.X,CHILD_".mf.SetDescription.Default Find for list objects.")
+26 DO METHOD(.X,CHILD_".mf.SetHandler.FIND^ECOBUL(.RESULT,HANDLE,PARAMS)")
+27 DO METHOD(.X,CHILD_".mf.SetParams.Value ... what to look for")
+28 DO METHOD(.X,CHILD_".mf.SetReturns.Array of matches")
+29 ;
+30 DO METHOD(.CHILD,HANDLE_".Methods.Add.Find1")
+31 DO METHOD(.X,CHILD_".mf.SetAddedByClass.List Utility")
+32 DO METHOD(.X,CHILD_".mf.SetDescription.Default Find1 for list objects.")
+33 DO METHOD(.X,CHILD_".mf.SetHandler.FIND1^ECOBUL(.RESULT,HANDLE,PARAMS)")
+34 DO METHOD(.X,CHILD_".mf.SetParams.Value ... what to look for")
+35 DO METHOD(.X,CHILD_".mf.SetReturns.First matching value")
+36 ;
+37 DO METHOD(.CHILD,HANDLE_".Methods.Add.First")
+38 DO METHOD(.X,CHILD_".mf.SetAddedByClass.List Utility")
+39 DO METHOD(.X,CHILD_".mf.SetDescription.Default First for list objects.")
+40 DO METHOD(.X,CHILD_".mf.SetHandler.FIRST^ECOBUL(.RESULT,HANDLE,PARAMS)")
+41 DO METHOD(.X,CHILD_".mf.SetParams.")
+42 DO METHOD(.X,CHILD_".mf.SetReturns.Handle, Item or Value of first object")
+43 ;
+44 DO METHOD(.CHILD,HANDLE_".Methods.Add.GetItem")
+45 DO METHOD(.X,CHILD_".mf.SetAddedByClass.List Utility")
+46 DO METHOD(.X,CHILD_".mf.SetDescription.Default GetItem for list objects.")
+47 DO METHOD(.X,CHILD_".mf.SetHandler.GETITEM^ECOBUL(.RESULT,HANDLE,PARAMS)")
+48 DO METHOD(.X,CHILD_".mf.SetParams.Item #")
+49 DO METHOD(.X,CHILD_".mf.SetReturns.Value of item")
+50 ;;
+51 DO METHOD(.CHILD,HANDLE_".Methods.Override.Info")
+52 DO METHOD(.X,CHILD_".mf.SetAddedByClass.List Utility")
+53 DO METHOD(.X,CHILD_".mf.SetDescription.Displays business information.")
+54 DO METHOD(.X,CHILD_".mf.SetHandler.INFO^ECOBUL(.RESULT,HANDLE,PARAMS)")
+55 DO METHOD(.X,CHILD_".mf.SetParams.[Justify]")
+56 DO METHOD(.X,CHILD_".mf.SetReturns.1")
+57 ;;
+58 DO METHOD(.CHILD,HANDLE_".Methods.Add.Last")
+59 DO METHOD(.X,CHILD_".mf.SetAddedByClass.List Utility")
+60 DO METHOD(.X,CHILD_".mf.SetDescription.Default Last for list objects.")
+61 DO METHOD(.X,CHILD_".mf.SetHandler.LAST^ECOBUL(.RESULT,HANDLE,PARAMS)")
+62 DO METHOD(.X,CHILD_".mf.SetParams.")
+63 DO METHOD(.X,CHILD_".mf.SetReturns.Handle, Item or Value of most recent object")
+64 ;;
+65 DO METHOD(.CHILD,HANDLE_".Methods.Add.Next")
+66 DO METHOD(.X,CHILD_".mf.SetAddedByClass.List Utility")
+67 DO METHOD(.X,CHILD_".mf.SetDescription.Default Next for list objects.")
+68 DO METHOD(.X,CHILD_".mf.SetHandler.NEXT^ECOBUL(.RESULT,HANDLE,PARAMS)")
+69 DO METHOD(.X,CHILD_".mf.SetParams.")
+70 DO METHOD(.X,CHILD_".mf.SetReturns.Handle, Item or Value of next object")
+71 ;;
+72 DO METHOD(.CHILD,HANDLE_".Methods.Add.SetItem")
+73 DO METHOD(.X,CHILD_".mf.SetAddedByClass.List Utility")
+74 DO METHOD(.X,CHILD_".mf.SetDescription.Default SetItem for list objects.")
+75 DO METHOD(.X,CHILD_".mf.SetHandler.SETITEM^ECOBUL(.RESULT,HANDLE,PARAMS)")
+76 DO METHOD(.X,CHILD_".mf.SetParams.Item #.Value ... to be stored")
+77 DO METHOD(.X,CHILD_".mf.SetReturns.1 if successful")
+78 ;;
+79 SET CHILD=$$CREATE^ECOBL(NAME)
+80 DO METHOD(.X,HANDLE_".Collect.SetChild."_CHILD)
+81 DO METHOD(.X,HANDLE_".Collect.SetName.List")
+82 DO METHOD(.X,HANDLE_".Collect.SetHandler.ECOBL^ECOBUL(.RESULT,HANDLE,PARAMS)")
+83 DO METHOD(.X,HANDLE_".Collect.Execute")
+84 ;
+85 QUIT HANDLE
+86 ;;
DESTROY(HANDLE) ; call parent last
+1 NEW CHILD
+2 DO METHOD(.CHILD,HANDLE_".GetList")
+3 DO DESTROY^ECOBL(CHILD)
+4 QUIT $$DESTROY^ECOBU(HANDLE)
+5 ;;
METHOD(RESULT,ARGUMENT) ; argument=[handle].[method].(additional.params...)
+1 DO METHOD^ECOBU(.RESULT,ARGUMENT)
QUIT
+2 ;;