blob: 82624f02bff6a8bfc3b7bce339fe639b9e15660a [file] [log] [blame]
using System.Collections.Generic;
using System.Linq;
namespace Apache.IoTDB
{
public class Utils
{
public bool IsSorted(IList<long> collection)
{
for (var i = 1; i < collection.Count; i++)
{
if (collection[i] < collection[i - 1])
{
return false;
}
}
return true;
}
public int VerifySuccess(TSStatus status, int successCode)
{
if (status.__isset.subStatus)
{
if (status.SubStatus.Any(subStatus => VerifySuccess(subStatus, successCode) != 0))
{
return -1;
}
return 0;
}
if (status.Code == successCode)
{
return 0;
}
return -1;
}
}
}