I am new on Delphi, i have some code writed with Java. It has an inner class structure. But i dont know how to convert to Delphi.
unit resolutionSet;
interface
uses
Winapi.Windows, System.Math;
type
TResolutionSet = class
type
TResolutionLevel = class
private
{ private declarations }
discardLayers : Integer;
dims : TRect;
function getZoomLevel : Integer;
function getZoomPercent : Double;
function getResolutionBounds : TRect;
constructor Create(_discardLayers : Integer; _dims : TRect) overload;
protected
{ protected declarations }
public
{ public declarations }
published
{ published declarations }
end;
private
{ private declarations }
resolutions : array of TResolutionLevel;
protected
{ protected declarations }
public
{ public declarations }
function getResolutionLevel(_currRes : TResolutionLevel; _delta : Integer) : TResolutionLevel overload;
function getResolutionLevel(_index : Integer) : TResolutionLevel overload;
function getClosestResolutionLevel(_source : Double; _target : Double) : TResolutionLevel;
procedure addResolutionLevel(_discardLayer : Integer; _dims : TRect);
constructor Create(_numResolutions : Integer) overload;
published
{ published declarations }
end;
implementation
constructor TResolutionSet.Create(_numResolutions : Integer) overload;
begin
SetLength(resolutions, _numResolutions);
end;
procedure TResolutionSet.addResolutionLevel(_discardLayer : Integer; _dims : TRect);
begin
resolutions[_discardLayer]:= TResolutionLevel.Create(_discardLayer, _dims);
end;
function TResolutionSet.getResolutionLevel(_currRes : TResolutionLevel; _delta : Integer) : TResolutionLevel overload;
begin
//Result:= resolutions
end;
function TResolutionSet.getResolutionLevel(_index : Integer) : TResolutionLevel overload;
begin
Result:= resolutions[_index];
end;
function TResolutionSet.getClosestResolutionLevel(_source : Double; _target : Double) : TResolutionLevel;
var
idx : Integer = 0;
i : Integer;
begin
for i := Length(resolutions)-1 downto 0 do
begin
idx:= i;
if (_source * Power(2, resolutions[i].getZoomLevel())) <= _target then
break;
end;
Result:= resolutions[idx];
end;
end.
I declared TResolutionLevel for inner class, but how can i implement this class' s method in where?