저는 델파이에 새로운 기능을 제공합니다. 자바로 작성된 코드가 있습니다. 그것은 내부 클래스 구조를 가지고 있습니다. 하지만 델파이로 변환하는 방법을 모른다.델파이의 자바 내부 클래스
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.
TResolutionLevel을 내부 클래스로 선언했지만 어떻게이 클래스의 메서드를 어디에서 구현할 수 있습니까?
이 구문은 Java 내부 클래스와 직접적으로 유사하지 않습니다. –
델파이를 처음 사용하기 때문에 문서를 추천 해 드릴 수 있습니다. http://docwiki.embarcadero.com/RADStudio/en/Nested_Type_Declarations –
감사합니다. there –