KMoody
Member
I have two classes: maze_util and point_util (see below).
A maze_util contains a temp table (tt) of point_util instances stored as Progress.Lang.Object.
In maze_util:getTestValue, I want to find a tt record by looking up the x and y values of the tt's point. I tried to do this by CASTing tt.point as a point_util. However, this doesn't seem to work since you can't call functions (such as CAST) in a WHERE statement.
Is there some other way to search a temp-table by looking up a Progress.Lang.Object's original class instance property?
maze_util.cls
point_util.cls
A maze_util contains a temp table (tt) of point_util instances stored as Progress.Lang.Object.
In maze_util:getTestValue, I want to find a tt record by looking up the x and y values of the tt's point. I tried to do this by CASTing tt.point as a point_util. However, this doesn't seem to work since you can't call functions (such as CAST) in a WHERE statement.
Is there some other way to search a temp-table by looking up a Progress.Lang.Object's original class instance property?
maze_util.cls
Code:
USING Progress.Lang.*.
BLOCK-LEVEL ON ERROR UNDO, THROW.
CLASS maze_util:
DEFINE PUBLIC PROPERTY height AS INTEGER NO-UNDO
GET.
PRIVATE SET.
DEFINE PUBLIC PROPERTY width AS INTEGER NO-UNDO
GET.
PRIVATE SET.
DEF TEMP-TABLE tt
FIELD test AS CHAR
FIELD point AS Progress.Lang.Object
FIELD pointValue AS CHAR
.
METHOD PUBLIC CHARACTER generateMap(in_width AS integer, in_height AS INTEGER):
def var i AS INTEGER.
def var j AS INTEGER.
def var tempCourse AS CHAR.
DEF VAR tempPoint AS point_util.
width = in_width.
height = in_height.
DO j = 1 TO height:
DO i = 1 TO width:
tempPoint = new point_util(i,j).
CREATE tt.
tt.point = tempPoint.
tt.pointValue = "0".
tt.test = "testingvalue".
END.
END.
END METHOD.
METHOD PUBLIC CHARACTER getTestValue(in_x as integer, in_y as integer):
def var i AS INTEGER.
def var j AS INTEGER.
FIND TT WHERE cast(tt.point,point_util):x = in_x and cast(tt.point,point_util):y = in_y no-lock no-error.
if available tt then
return tt.test.
END METHOD.
END CLASS.
point_util.cls
Code:
USING Progress.Lang.*.
BLOCK-LEVEL ON ERROR UNDO, THROW.
CLASS point_util:
DEFINE PUBLIC PROPERTY x AS INTEGER NO-UNDO
GET.
PRIVATE SET.
DEFINE PUBLIC PROPERTY y AS INTEGER NO-UNDO
GET.
PRIVATE SET.
CONSTRUCTOR PUBLIC point_util (in_x as INTEGER, in_y AS INTEGER):
x = in_x.
y = in_y.
END CONSTRUCTOR.
END CLASS.