Add Sort and SortCustom to ArrayList methodmap (#1003)

This commit is contained in:
JoinedSenses 2019-05-09 13:44:31 -04:00 committed by Asher Baker
parent 9cd2a74271
commit 26462f2848
2 changed files with 28 additions and 8 deletions

View File

@ -591,5 +591,9 @@ REGISTER_NATIVES(sortNatives)
{"SortCustom2D", sm_SortCustom2D}, {"SortCustom2D", sm_SortCustom2D},
{"SortADTArray", sm_SortADTArray}, {"SortADTArray", sm_SortADTArray},
{"SortADTArrayCustom", sm_SortADTArrayCustom}, {"SortADTArrayCustom", sm_SortADTArrayCustom},
{"ArrayList.Sort", sm_SortADTArray},
{"ArrayList.SortCustom", sm_SortADTArrayCustom},
{NULL, NULL}, {NULL, NULL},
}; };

View File

@ -208,6 +208,22 @@ methodmap ArrayList < Handle {
// @error Invalid block index // @error Invalid block index
public native int FindValue(any item, int block=0); public native int FindValue(any item, int block=0);
/**
* Sort an ADT Array. Specify the type as Integer, Float, or String.
*
* @param order Sort order to use, same as other sorts.
* @param type Data type stored in the ADT Array
*/
public native void Sort(SortOrder order, SortType type);
/**
* Custom sorts an ADT Array. You must pass in a comparison function.
*
* @param sortfunc Sort comparison function to use
* @param hndl Optional Handle to pass through the comparison calls.
*/
public native void SortCustom(SortFuncADTArray sortfunc, Handle hndl=INVALID_HANDLE);
// Retrieve the size of the array. // Retrieve the size of the array.
property int Length { property int Length {
public native get(); public native get();