code
stringlengths
67
466k
docstring
stringlengths
1
13.2k
public ApiResponse<DevicesEnvelope> getUserDevicesWithHttpInfo(String userId, Integer offset, Integer count, Boolean includeProperties, String owner, Boolean includeShareInfo, String dtid) throws ApiException { com.squareup.okhttp.Call call = getUserDevicesValidateBeforeCall(userId, offset, count, includeProperties, owner, includeShareInfo, dtid, null, null); Type localVarReturnType = new TypeToken<DevicesEnvelope>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
Get User Devices Retrieve User&#39;s Devices @param userId User ID (required) @param offset Offset for pagination. (optional) @param count Desired count of items in the result set (optional) @param includeProperties Optional. Boolean (true/false) - If false, only return the user&#39;s device types. If true, also return device types shared by other users. (optional) @param owner Return owned and/or shared devices. Default to ALL. (optional) @param includeShareInfo Include share info (optional) @param dtid Return only devices of this device type. If empty, assumes all device types allowed by the authorization. (optional) @return ApiResponse&lt;DevicesEnvelope&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public com.squareup.okhttp.Call getUserDevicesAsync(String userId, Integer offset, Integer count, Boolean includeProperties, String owner, Boolean includeShareInfo, String dtid, final ApiCallback<DevicesEnvelope> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getUserDevicesValidateBeforeCall(userId, offset, count, includeProperties, owner, includeShareInfo, dtid, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<DevicesEnvelope>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
Get User Devices (asynchronously) Retrieve User&#39;s Devices @param userId User ID (required) @param offset Offset for pagination. (optional) @param count Desired count of items in the result set (optional) @param includeProperties Optional. Boolean (true/false) - If false, only return the user&#39;s device types. If true, also return device types shared by other users. (optional) @param owner Return owned and/or shared devices. Default to ALL. (optional) @param includeShareInfo Include share info (optional) @param dtid Return only devices of this device type. If empty, assumes all device types allowed by the authorization. (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
public PropertiesEnvelope getUserProperties(String userId, String aid) throws ApiException { ApiResponse<PropertiesEnvelope> resp = getUserPropertiesWithHttpInfo(userId, aid); return resp.getData(); }
Get User application properties Get application properties of a user @param userId User Id (required) @param aid Application ID (optional) @return PropertiesEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public RulesEnvelope getUserRules(String userId, Boolean excludeDisabled, Integer count, Integer offset, String owner) throws ApiException { ApiResponse<RulesEnvelope> resp = getUserRulesWithHttpInfo(userId, excludeDisabled, count, offset, owner); return resp.getData(); }
Get User Rules Retrieve User&#39;s Rules @param userId User ID. (required) @param excludeDisabled Exclude disabled rules in the result. (optional) @param count Desired count of items in the result set. (optional) @param offset Offset for pagination. (optional) @param owner Rule owner (optional) @return RulesEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public ApiResponse<RulesEnvelope> getUserRulesWithHttpInfo(String userId, Boolean excludeDisabled, Integer count, Integer offset, String owner) throws ApiException { com.squareup.okhttp.Call call = getUserRulesValidateBeforeCall(userId, excludeDisabled, count, offset, owner, null, null); Type localVarReturnType = new TypeToken<RulesEnvelope>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
Get User Rules Retrieve User&#39;s Rules @param userId User ID. (required) @param excludeDisabled Exclude disabled rules in the result. (optional) @param count Desired count of items in the result set. (optional) @param offset Offset for pagination. (optional) @param owner Rule owner (optional) @return ApiResponse&lt;RulesEnvelope&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public DeviceSharingEnvelope listAllSharesForUser(String userId, String filter, Integer count, Integer offset) throws ApiException { ApiResponse<DeviceSharingEnvelope> resp = listAllSharesForUserWithHttpInfo(userId, filter, count, offset); return resp.getData(); }
Get User shares Get User shares @param userId User ID. (required) @param filter filter (required) @param count Desired count of items in the result set. (optional) @param offset Offset for pagination. (optional) @return DeviceSharingEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public ApiResponse<DeviceSharingEnvelope> listAllSharesForUserWithHttpInfo(String userId, String filter, Integer count, Integer offset) throws ApiException { com.squareup.okhttp.Call call = listAllSharesForUserValidateBeforeCall(userId, filter, count, offset, null, null); Type localVarReturnType = new TypeToken<DeviceSharingEnvelope>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
Get User shares Get User shares @param userId User ID. (required) @param filter filter (required) @param count Desired count of items in the result set. (optional) @param offset Offset for pagination. (optional) @return ApiResponse&lt;DeviceSharingEnvelope&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public PropertiesEnvelope updateUserProperties(String userId, AppProperties properties, String aid) throws ApiException { ApiResponse<PropertiesEnvelope> resp = updateUserPropertiesWithHttpInfo(userId, properties, aid); return resp.getData(); }
Update User Application Properties Updates application properties of a user @param userId User Id (required) @param properties Properties to be updated (required) @param aid Application ID (optional) @return PropertiesEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public ApiResponse<PropertiesEnvelope> updateUserPropertiesWithHttpInfo(String userId, AppProperties properties, String aid) throws ApiException { com.squareup.okhttp.Call call = updateUserPropertiesValidateBeforeCall(userId, properties, aid, null, null); Type localVarReturnType = new TypeToken<PropertiesEnvelope>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
Update User Application Properties Updates application properties of a user @param userId User Id (required) @param properties Properties to be updated (required) @param aid Application ID (optional) @return ApiResponse&lt;PropertiesEnvelope&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public static int fromYCbCr(int y, int cb, int cr, int alpha) { int cbc = cb - YUV_OFFSET; int crc = cr - YUV_OFFSET; int r = y + crc + (crc >> 2) + (crc >> 3) + (crc >> 5); int g = y - ((cbc >> 2) + (cbc >> 4) + (cbc >> 5)) - ((crc >> 1) + (crc >> 3) + (crc >> 4) + (crc >> 5)); int b = y + cbc + (cbc >> 1) + (cbc >> 2) + (cbc >> 6); /* Using float operations int r = (int) (y + 1.402 * (cr - YUV_OFFSET)); int g = (int) (y - 0.344 * (cb - YUV_OFFSET) - 0.714 * (cr - YUV_OFFSET)); int b = (int) (y + 1.772 * (cb - YUV_OFFSET)); r = clamp(r); g = clamp(g); b = clamp(b); */ return getARGB(r, g, b, alpha); }
YCbCr conversion from: https://en.wikipedia.org/wiki/YUV @param y - Y channel @param cb - CB channel @param cr - CR channel @return rgb
public static float[] getHSVArray(int r, int g, int b) { float[] hsv = new float[3]; float rf = r / MAX; float gf = g / MAX; float bf = b / MAX; float minRGB = Math.min(rf, Math.min(gf, bf)); float maxRGB = Math.max(rf, Math.max(gf, bf)); float computedH = 0; float computedS = 0; float computedV = minRGB; // Black-gray-white if (minRGB != maxRGB) { // Colors other than black-gray-white: float d = (rf == minRGB) ? gf - bf : ((bf == minRGB) ? rf - gf : bf - rf); float h = (rf == minRGB) ? 3 : ((bf == minRGB) ? 1 : 5); computedH = 60 * (h - d / (maxRGB - minRGB)); computedS = (maxRGB - minRGB) / maxRGB; computedV = maxRGB; } hsv[0] = computedH; hsv[1] = computedS; hsv[2] = computedV; return hsv; }
Code from: http://www.javascripter.net/faq/rgb2hsv.htm @param r @param g @param b @return
public static int fromHSV(float h, float s, float v) { int a = MAX_INT; return fromHSV(h, s, v, a); }
Method to transform from HSV to RGB (this method sets alpha as 0xff) @param h - hue @param s - saturation @param v - brightness @return rgb color
public static int fromHSV(float h, float s, float v, int a) { float r = v; float g = v; float b = v; int i; float f, p, q, t; if (s == 0) { // achromatic (grey) int ri = (int) (r * 0xff); int gi = (int) (g * 0xff); int bi = (int) (b * 0xff); return getRGB(ri, gi, bi); } h /= 60; // sector 0 to 5 i = (int) Math.floor(h); f = h - i; // factorial part of h p = v * (1 - s); q = v * (1 - s * f); t = v * (1 - s * (1 - f)); switch (i) { case 0: r = v; g = t; b = p; break; case 1: r = q; g = v; b = p; break; case 2: r = p; g = v; b = t; break; case 3: r = p; g = q; b = v; break; case 4: r = t; g = p; b = v; break; // case 5: default: r = v; g = p; b = q; break; } int ri = (int) (r * 0xff); int gi = (int) (g * 0xff); int bi = (int) (b * 0xff); return getARGB(ri, gi, bi, a); }
Method to transform from HSV to ARGB Source from: https://www.cs.rit.edu/~ncs/color/t_convert.html @param h - hue @param s - saturation @param v - brightness @param a - alpha @return rgb color
public static float[] getHSLArray(int r, int g, int b) { float[] hsl = new float[3]; float h, s, l; float rf = r / MAX; float gf = g / MAX; float bf = b / MAX; float minRGB = Math.min(rf, Math.min(gf, bf)); float maxRGB = Math.max(rf, Math.max(gf, bf)); float delta = maxRGB - minRGB; l = (maxRGB + minRGB) / 2; if (delta == 0) { h = 0; s = 0.0f; } else { s = (l <= 0.5) ? (delta / (maxRGB + minRGB)) : (delta / (2 - maxRGB - minRGB)); float hue; if (rf == maxRGB) { hue = ((gf - bf) / 6) / delta; } else if (gf == maxRGB) { hue = (1.0f / 3) + ((bf - rf) / 6) / delta; } else { hue = (2.0f / 3) + ((rf - gf) / 6) / delta; } if (hue < 0) { hue += 1; } else if (hue > 1) { hue -= 1; } h = (int) (hue * 360); } hsl[0] = h; hsl[1] = s; hsl[2] = l; return hsl; }
Get HSL Color from RGB https://www.programmingalgorithms.com/algorithm/rgb-to-hsl?lang=C%2B%2B @param r @param g @param b @return
public static int fromHSL(float h, float s, float l) { int alpha = MAX_INT; return fromHSL(h, s, l, alpha); }
Method to transform from HSL to RGB (this method sets alpha as 0xff) @param h - hue @param s - saturation @param l - lightness @return rgb
public static int fromHSL(float h, float s, float l, int a) { int r, g, b; if (s == 0) { r = g = b = (int) (l * MAX); } else { float v1, v2; float hue = h / 360f; v2 = (l < 0.5) ? (l * (1 + s)) : ((l + s) - (l * s)); v1 = 2 * l - v2; r = (int) (MAX * HueToRGB(v1, v2, hue + (1.0f / 3))); g = (int) (MAX * HueToRGB(v1, v2, hue)); b = (int) (MAX * HueToRGB(v1, v2, hue - (1.0f / 3))); } return getARGB(r, g, b, a); }
Method to transform from HSL to ARGB <p> Source from: https://www.programmingalgorithms.com/algorithm/hsl-to-rgb?lang=C%2B%2B @param h - hue @param s - saturation @param l - lightness @param a - alpha @return rgb
public static int mix(int base, int added) { float bAlpha = ColorHelper.getAlpha(base) / 255f; float aAlpha = ColorHelper.getAlpha(added) / 255f; float alpha = 1 - (1 - bAlpha) * (1 - aAlpha); // alpha int bR = ColorHelper.getRed(base); int bG = ColorHelper.getGreen(base); int bB = ColorHelper.getBlue(base); int aR = ColorHelper.getRed(added); int aG = ColorHelper.getGreen(added); int aB = ColorHelper.getBlue(added); int r = Math.round((aR * aAlpha / alpha) + (bR * bAlpha * (1 - aAlpha) / alpha)); // red int g = Math.round((aG * aAlpha / alpha) + (bG * bAlpha * (1 - aAlpha) / alpha)); // green int b = Math.round((aB * aAlpha / alpha) + (bB * bAlpha * (1 - aAlpha) / alpha)); // blue return getARGB(r, g, b, (int) clamp(alpha * MAX)); }
Alpha Blend Source from: https://gist.github.com/JordanDelcros/518396da1c13f75ee057 @param a @param b @return
protected <T extends Listener> Collection<T> copyList(Class<T> listenerClass, Stream<Object> listeners, int sizeHint) { if (sizeHint == 0) { return Collections.emptyList(); } return listeners .map(listenerClass::cast) .collect(Collectors.toCollection(() -> new ArrayList<>(sizeHint))); }
Creates a collection from the given stream, casting each object to the provided listener class. The returned collection must not necessarily be mutable. @param <T> Type of the listeners in the given list. @param listenerClass The class of the objects in the provided list. @param listeners The stream to obtain the listeners for the resulting collection from. @param sizeHint Expected size of the input stream. @return A typed copy of the list.
public ManifestVersionsEnvelope getAvailableManifestVersions(String deviceTypeId) throws ApiException { ApiResponse<ManifestVersionsEnvelope> resp = getAvailableManifestVersionsWithHttpInfo(deviceTypeId); return resp.getData(); }
Get Available Manifest Versions Get a Device Type&#39;s available manifest versions @param deviceTypeId deviceTypeId (required) @return ManifestVersionsEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public ApiResponse<ManifestVersionsEnvelope> getAvailableManifestVersionsWithHttpInfo(String deviceTypeId) throws ApiException { com.squareup.okhttp.Call call = getAvailableManifestVersionsValidateBeforeCall(deviceTypeId, null, null); Type localVarReturnType = new TypeToken<ManifestVersionsEnvelope>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
Get Available Manifest Versions Get a Device Type&#39;s available manifest versions @param deviceTypeId deviceTypeId (required) @return ApiResponse&lt;ManifestVersionsEnvelope&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public DeviceTypeEnvelope getDeviceType(String deviceTypeId) throws ApiException { ApiResponse<DeviceTypeEnvelope> resp = getDeviceTypeWithHttpInfo(deviceTypeId); return resp.getData(); }
Get Device Type Retrieves a Device Type @param deviceTypeId deviceTypeId (required) @return DeviceTypeEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public ApiResponse<DeviceTypeEnvelope> getDeviceTypeWithHttpInfo(String deviceTypeId) throws ApiException { com.squareup.okhttp.Call call = getDeviceTypeValidateBeforeCall(deviceTypeId, null, null); Type localVarReturnType = new TypeToken<DeviceTypeEnvelope>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
Get Device Type Retrieves a Device Type @param deviceTypeId deviceTypeId (required) @return ApiResponse&lt;DeviceTypeEnvelope&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public DeviceTypesEnvelope getDeviceTypes(String name, Integer offset, Integer count, String tags) throws ApiException { ApiResponse<DeviceTypesEnvelope> resp = getDeviceTypesWithHttpInfo(name, offset, count, tags); return resp.getData(); }
Get Device Types Retrieves Device Types @param name Device Type name (required) @param offset Offset for pagination. (optional) @param count Desired count of items in the result set (optional) @param tags Elements tagged with the list of tags. (comma separated) (optional) @return DeviceTypesEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public ApiResponse<DeviceTypesEnvelope> getDeviceTypesWithHttpInfo(String name, Integer offset, Integer count, String tags) throws ApiException { com.squareup.okhttp.Call call = getDeviceTypesValidateBeforeCall(name, offset, count, tags, null, null); Type localVarReturnType = new TypeToken<DeviceTypesEnvelope>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
Get Device Types Retrieves Device Types @param name Device Type name (required) @param offset Offset for pagination. (optional) @param count Desired count of items in the result set (optional) @param tags Elements tagged with the list of tags. (comma separated) (optional) @return ApiResponse&lt;DeviceTypesEnvelope&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public com.squareup.okhttp.Call getDeviceTypesAsync(String name, Integer offset, Integer count, String tags, final ApiCallback<DeviceTypesEnvelope> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getDeviceTypesValidateBeforeCall(name, offset, count, tags, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<DeviceTypesEnvelope>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
Get Device Types (asynchronously) Retrieves Device Types @param name Device Type name (required) @param offset Offset for pagination. (optional) @param count Desired count of items in the result set (optional) @param tags Elements tagged with the list of tags. (comma separated) (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
public DeviceTypesEnvelope getDeviceTypesByApplication(String appId, Boolean productInfo, Integer count, Integer offset) throws ApiException { ApiResponse<DeviceTypesEnvelope> resp = getDeviceTypesByApplicationWithHttpInfo(appId, productInfo, count, offset); return resp.getData(); }
Get Device Types by Application Get Device Types by Application @param appId Application ID. (required) @param productInfo Flag to include the associated ProductInfo if present (optional) @param count Desired count of items in the result set. (optional) @param offset Offset for pagination. (optional) @return DeviceTypesEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public ApiResponse<DeviceTypesEnvelope> getDeviceTypesByApplicationWithHttpInfo(String appId, Boolean productInfo, Integer count, Integer offset) throws ApiException { com.squareup.okhttp.Call call = getDeviceTypesByApplicationValidateBeforeCall(appId, productInfo, count, offset, null, null); Type localVarReturnType = new TypeToken<DeviceTypesEnvelope>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
Get Device Types by Application Get Device Types by Application @param appId Application ID. (required) @param productInfo Flag to include the associated ProductInfo if present (optional) @param count Desired count of items in the result set. (optional) @param offset Offset for pagination. (optional) @return ApiResponse&lt;DeviceTypesEnvelope&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public com.squareup.okhttp.Call getDeviceTypesByApplicationAsync(String appId, Boolean productInfo, Integer count, Integer offset, final ApiCallback<DeviceTypesEnvelope> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getDeviceTypesByApplicationValidateBeforeCall(appId, productInfo, count, offset, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<DeviceTypesEnvelope>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
Get Device Types by Application (asynchronously) Get Device Types by Application @param appId Application ID. (required) @param productInfo Flag to include the associated ProductInfo if present (optional) @param count Desired count of items in the result set. (optional) @param offset Offset for pagination. (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
public ManifestPropertiesEnvelope getManifestProperties(String deviceTypeId, String version) throws ApiException { ApiResponse<ManifestPropertiesEnvelope> resp = getManifestPropertiesWithHttpInfo(deviceTypeId, version); return resp.getData(); }
Get manifest properties Get a Device Type&#39;s manifest properties for a specific version. @param deviceTypeId Device Type ID. (required) @param version Manifest Version. (required) @return ManifestPropertiesEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public ApiResponse<ManifestPropertiesEnvelope> getManifestPropertiesWithHttpInfo(String deviceTypeId, String version) throws ApiException { com.squareup.okhttp.Call call = getManifestPropertiesValidateBeforeCall(deviceTypeId, version, null, null); Type localVarReturnType = new TypeToken<ManifestPropertiesEnvelope>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
Get manifest properties Get a Device Type&#39;s manifest properties for a specific version. @param deviceTypeId Device Type ID. (required) @param version Manifest Version. (required) @return ApiResponse&lt;ManifestPropertiesEnvelope&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
@Deprecated protected <T extends Listener> void removeInternal(Class<T> listenerClass, Iterator<Object> it) { final Object next = it.next(); final T listener = listenerClass.cast(next); it.remove(); final RegistrationEvent e = new RegistrationEvent(this, listenerClass); listener.onUnregister(e); }
Internal method for removing a single listener and notifying it about the removal. Prior to calling this method, the passed iterators {@link Iterator#hasNext() hasNext} method must hold <code>true</code>. @param <T> Type of the listener to remove @param listenerClass The class of the listener to remove. @param it Iterator which provides the next listener to remove. @deprecated Since 3.0.0 - Method not used anymore. Replaced by {@link #clearAll(Class, List, boolean)}.
@SuppressWarnings("unchecked") public <T> T deserialize(String body, Type returnType) { try { return gson.fromJson(body, returnType); } catch (JsonParseException e) { // Fallback processing when failed to parse JSON form response body: // return the response body string directly for the String return // type; // parse response body into date or datetime for the Date return // type. if (returnType.equals(String.class)) return (T) body; // else if (returnType.equals(Date.class)) // return (T) apiClient.parseDateOrDatetime(body); else throw (e); } }
Deserialize the given JSON string to Java object. @param body The JSON string @param returnType The type to deserialize inot @return The deserialized Java object
public List<Cluster> cluster(final Collection<Point2D> points) { final List<Cluster> clusters = new ArrayList<Cluster>(); final Map<Point2D, PointStatus> visited = new HashMap<Point2D, DBScan.PointStatus>(); KDTree<Point2D> tree = new KDTree<Point2D>(2); // Populate the kdTree for (final Point2D point : points) { double[] key = {point.x, point.y}; tree.insert(key, point); } for (final Point2D point : points) { if (visited.get(point) != null) { continue; } final List<Point2D> neighbors = getNeighbors(point, tree); if (neighbors.size() >= minPoints) { // DBSCAN does not care about center points final Cluster cluster = new Cluster(clusters.size()); clusters.add(expandCluster(cluster, point, neighbors, tree, visited)); } else { visited.put(point, PointStatus.NOISE); } } for (Cluster cluster : clusters) { cluster.calculateCentroid(); } return clusters; }
Performs DBSCAN cluster analysis. @param points the points to cluster @return the list of clusters @throws NullArgumentException if the data points are null
private Cluster expandCluster(final Cluster cluster, final Point2D point, final List<Point2D> neighbors, final KDTree<Point2D> points, final Map<Point2D, PointStatus> visited) { cluster.addPoint(point); visited.put(point, PointStatus.PART_OF_CLUSTER); List<Point2D> seeds = new ArrayList<Point2D>(neighbors); int index = 0; while (index < seeds.size()) { Point2D current = seeds.get(index); PointStatus pStatus = visited.get(current); // only check non-visited points if (pStatus == null) { final List<Point2D> currentNeighbors = getNeighbors(current, points); if (currentNeighbors.size() >= minPoints) { seeds = merge(seeds, currentNeighbors); } } if (pStatus != PointStatus.PART_OF_CLUSTER) { visited.put(current, PointStatus.PART_OF_CLUSTER); cluster.addPoint(current); } index++; } return cluster; }
Expands the cluster to include density-reachable items. @param cluster Cluster to expand @param point Point to add to cluster @param neighbors List of neighbors @param points the data set @param visited the set of already visited points @return the expanded cluster
private List<Point2D> getNeighbors(final Point2D point, KDTree<Point2D> points) { double[] key = {point.x, point.y}; final List<Point2D> neighbors = new ArrayList<Point2D>(); neighbors.addAll(points.nearestEuclidean(key, eps)); return neighbors; }
Returns a list of density-reachable neighbors of a {@code point}. @param point the point to look for @param points possible neighbors @return the List of neighbors
private List<Point2D> merge(final List<Point2D> one, final List<Point2D> two) { final Set<Point2D> oneSet = new HashSet<Point2D>(one); for (Point2D item : two) { if (!oneSet.contains(item)) { one.add(item); } } return one; }
Merges two lists together. @param one first list @param two second list @return merged lists
public ImageSource apply(ImageSource input) { ImageSource originalImage = input; int width = originalImage.getWidth(); int height = originalImage.getHeight(); boolean[][] matrix = new boolean[width][height]; // black n white boolean matrix; true = blck, false = white // Copy ImageSource filteredImage = new MatrixSource(input); int[] histogram = OtsuBinarize.imageHistogram(originalImage); int totalNumberOfpixels = height * width; int threshold = OtsuBinarize.threshold(histogram, totalNumberOfpixels); int black = 0; int white = 255; int gray; int alpha; int newColor; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { gray = originalImage.getGray(i, j); if (gray > threshold) { matrix[i][j] = false; } else { matrix[i][j] = true; } } } int blackTreshold = letterThreshold(originalImage, matrix); for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { gray = originalImage.getGray(i, j); alpha = originalImage.getA(i, j); if (gray > blackTreshold) { newColor = white; } else { newColor = black; } newColor = ColorHelper.getARGB(newColor, newColor, newColor, alpha); filteredImage.setRGB(i, j, newColor); } } return filteredImage; }
radi otsu da dobije spojena crna slova i ra @param input @return the processed image
public static int[] Argsort(final float[] array, final boolean ascending) { Integer[] indexes = new Integer[array.length]; for (int i = 0; i < indexes.length; i++) { indexes[i] = i; } Arrays.sort(indexes, new Comparator<Integer>() { @Override public int compare(final Integer i1, final Integer i2) { return (ascending ? 1 : -1) * Float.compare(array[i1], array[i2]); } }); return asArray(indexes); }
Returns the indices that would sort an array. @param array Array. @param ascending Ascending order. @return Array of indices.
public static int[] Concatenate(int[] array, int[] array2) { int[] all = new int[array.length + array2.length]; int idx = 0; //First array for (int i = 0; i < array.length; i++) all[idx++] = array[i]; //Second array for (int i = 0; i < array2.length; i++) all[idx++] = array2[i]; return all; }
Concatenate the arrays. @param array First array. @param array2 Second array. @return Concatenate between first and second array.
public static int[] ConcatenateInt(List<int[]> arrays) { int size = 0; for (int i = 0; i < arrays.size(); i++) { size += arrays.get(i).length; } int[] all = new int[size]; int idx = 0; for (int i = 0; i < arrays.size(); i++) { int[] v = arrays.get(i); for (int j = 0; j < v.length; j++) { all[idx++] = v[i]; } } return all; }
Concatenate all the arrays in the list into a vector. @param arrays List of arrays. @return Vector.
public static <T extends Number> int[] asArray(final T... array) { int[] b = new int[array.length]; for (int i = 0; i < b.length; i++) { b[i] = array[i].intValue(); } return b; }
Convert any number class to array of integer. @param <T> Type. @param array Array. @return Integer array.
public static void Shuffle(double[] array, long seed) { Random random = new Random(); if (seed != 0) random.setSeed(seed); for (int i = array.length - 1; i > 0; i--) { int index = random.nextInt(i + 1); double temp = array[index]; array[index] = array[i]; array[i] = temp; } }
Shuffle an array. @param array Array. @param seed Random seed.
public static float[] toFloat(int[] array) { float[] n = new float[array.length]; for (int i = 0; i < array.length; i++) { n[i] = (float) array[i]; } return n; }
1-D Integer array to float array. @param array Integer array. @return Float array.
public static float[][] toFloat(int[][] array) { float[][] n = new float[array.length][array[0].length]; for (int i = 0; i < array.length; i++) { for (int j = 0; j < array[0].length; j++) { n[i][j] = (float) array[i][j]; } } return n; }
2-D Integer array to float array. @param array Integer array. @return Float array.
public static int[] toInt(double[] array) { int[] n = new int[array.length]; for (int i = 0; i < array.length; i++) { n[i] = (int) array[i]; } return n; }
1-D Double array to integer array. @param array Double array. @return Integer array.
public static int[][] toInt(double[][] array) { int[][] n = new int[array.length][array[0].length]; for (int i = 0; i < array.length; i++) { for (int j = 0; j < array[0].length; j++) { n[i][j] = (int) array[i][j]; } } return n; }
2-D Double array to integer array. @param array Double array. @return Integer array.
public static double[] toDouble(int[] array) { double[] n = new double[array.length]; for (int i = 0; i < array.length; i++) { n[i] = (double) array[i]; } return n; }
1-D Integer array to double array. @param array Integer array. @return Double array.
public static double[][] toDouble(int[][] array) { double[][] n = new double[array.length][array[0].length]; for (int i = 0; i < array.length; i++) { for (int j = 0; j < array[0].length; j++) { n[i][j] = (double) array[i][j]; } } return n; }
2-D Integer array to double array. @param array Integer array. @return Double array.
public CheckTokenResponse checkToken(TokenRequest tokenInfo) throws ApiException { ApiResponse<CheckTokenResponse> resp = checkTokenWithHttpInfo(tokenInfo); return resp.getData(); }
Check Token (Deprecated) Check Token. See tokenInfo @param tokenInfo Token object to be checked (required) @return CheckTokenResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public ApiResponse<CheckTokenResponse> checkTokenWithHttpInfo(TokenRequest tokenInfo) throws ApiException { com.squareup.okhttp.Call call = checkTokenValidateBeforeCall(tokenInfo, null, null); Type localVarReturnType = new TypeToken<CheckTokenResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
Check Token (Deprecated) Check Token. See tokenInfo @param tokenInfo Token object to be checked (required) @return ApiResponse&lt;CheckTokenResponse&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public com.squareup.okhttp.Call checkTokenAsync(TokenRequest tokenInfo, final ApiCallback<CheckTokenResponse> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = checkTokenValidateBeforeCall(tokenInfo, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<CheckTokenResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
Check Token (asynchronously) (Deprecated) Check Token. See tokenInfo @param tokenInfo Token object to be checked (required) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
public RefreshTokenResponse refreshToken(String grantType, String refreshToken) throws ApiException { ApiResponse<RefreshTokenResponse> resp = refreshTokenWithHttpInfo(grantType, refreshToken); return resp.getData(); }
Refresh Token Refresh Token @param grantType Grant Type. (required) @param refreshToken Refresh Token. (required) @return RefreshTokenResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public ApiResponse<RefreshTokenResponse> refreshTokenWithHttpInfo(String grantType, String refreshToken) throws ApiException { com.squareup.okhttp.Call call = refreshTokenValidateBeforeCall(grantType, refreshToken, null, null); Type localVarReturnType = new TypeToken<RefreshTokenResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
Refresh Token Refresh Token @param grantType Grant Type. (required) @param refreshToken Refresh Token. (required) @return ApiResponse&lt;RefreshTokenResponse&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public ApiResponse<TokenInfoSuccessResponse> tokenInfoWithHttpInfo() throws ApiException { com.squareup.okhttp.Call call = tokenInfoValidateBeforeCall(null, null); Type localVarReturnType = new TypeToken<TokenInfoSuccessResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
Token Info Returns the Token Information @return ApiResponse&lt;TokenInfoSuccessResponse&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public static double Inverse(double y0) { if (y0 <= 0.0) { if (y0 == 0) return Double.NEGATIVE_INFINITY; try { throw new IllegalArgumentException("y0"); } catch (Exception e) { e.printStackTrace(); } } if (y0 >= 1.0) { if (y0 == 1) return Double.POSITIVE_INFINITY; try { throw new IllegalArgumentException("y0"); } catch (Exception e) { e.printStackTrace(); } } double s2pi = Math.sqrt(2.0 * Math.PI); int code = 1; double y = y0; double x; double[] P0 = { -59.963350101410789, 98.001075418599967, -56.676285746907027, 13.931260938727968, -1.2391658386738125 }; double[] Q0 = { 1.9544885833814176, 4.6762791289888153, 86.360242139089053, -225.46268785411937, 200.26021238006066, -82.037225616833339, 15.90562251262117, -1.1833162112133 }; double[] P1 = { 4.0554489230596245, 31.525109459989388, 57.162819224642128, 44.080507389320083, 14.684956192885803, 2.1866330685079025, -0.14025607917135449, -0.035042462682784818, -0.00085745678515468545 }; double[] Q1 = { 15.779988325646675, 45.390763512887922, 41.317203825467203, 15.04253856929075, 2.5046494620830941, -0.14218292285478779, -0.038080640769157827, -0.00093325948089545744 }; double[] P2 = { 3.2377489177694603, 6.9152288906898418, 3.9388102529247444, 1.3330346081580755, 0.20148538954917908, 0.012371663481782003, 0.00030158155350823543, 2.6580697468673755E-06, 6.2397453918498331E-09 }; double[] Q2 = { 6.02427039364742, 3.6798356385616087, 1.3770209948908132, 0.21623699359449663, 0.013420400608854318, 0.00032801446468212774, 2.8924786474538068E-06, 6.7901940800998127E-09 }; if (y > 0.8646647167633873) { y = 1.0 - y; code = 0; } if (y > 0.1353352832366127) { y -= 0.5; double y2 = y * y; x = y + y * ((y2 * Special.Polevl(y2, P0, 4)) / Special.P1evl(y2, Q0, 8)); x *= s2pi; return x; } x = Math.sqrt(-2.0 * Math.log(y)); double x0 = x - Math.log(x) / x; double z = 1.0 / x; double x1; if (x < 8.0) { x1 = (z * Special.Polevl(z, P1, 8)) / Special.P1evl(z, Q1, 8); } else { x1 = (z * Special.Polevl(z, P2, 8)) / Special.P1evl(z, Q2, 8); } x = x0 - x1; if (code != 0) x = -x; return x; }
Normal (Gaussian) inverse cumulative distribution function. @param y0 Value. @return Result.
public static double HighAccuracyFunction(double x) { if (x < -8 || x > 8) return 0; double sum = x; double term = 0; double nextTerm = x; double pwr = x * x; double i = 1; // Iterate until adding next terms doesn't produce // any change within the current numerical accuracy. while (sum != term) { term = sum; // Next term nextTerm *= pwr / (i += 2); sum += nextTerm; } return 0.5 + sum * Math.exp(-0.5 * pwr - 0.5 * Constants.Log2PI); }
High-accuracy Normal cumulative distribution function. @param x Value. @return Result.
public static double HighAccuracyComplemented(double x) { double[] R = { 1.25331413731550025, 0.421369229288054473, 0.236652382913560671, 0.162377660896867462, 0.123131963257932296, 0.0990285964717319214, 0.0827662865013691773, 0.0710695805388521071, 0.0622586659950261958 }; int j = (int) (0.5 * (Math.abs(x) + 1)); double a = R[j]; double z = 2 * j; double b = a * z - 1; double h = Math.abs(x) - z; double q = h * h; double pwr = 1; double sum = a + h * b; double term = a; for (int i = 2; sum != term; i += 2) { term = sum; a = (a + z * b) / (i); b = (b + z * a) / (i + 1); pwr *= q; sum = term + pwr * (a + h * b); } sum *= Math.exp(-0.5 * (x * x) - 0.5 * Constants.Log2PI); return (x >= 0) ? sum : (1.0 - sum); }
High-accuracy Complementary normal distribution function. @param x Value. @return Result.
public String toIPTC(SubjectReferenceSystem srs) { StringBuffer b = new StringBuffer(); b.append("IPTC:"); b.append(getNumber()); b.append(":"); if (getNumber().endsWith("000000")) { b.append(toIPTCHelper(srs.getName(this))); b.append("::"); } else if (getNumber().endsWith("000")) { b.append(toIPTCHelper(srs.getName(srs.get(getNumber().substring(0, 2) + "000000")))); b.append(":"); b.append(toIPTCHelper(srs.getName(this))); b.append(":"); } else { b.append(toIPTCHelper(srs.getName(srs.get(getNumber().substring(0, 2) + "000000")))); b.append(":"); b.append(toIPTCHelper(srs.getName(srs.get(getNumber().substring(0, 5) + "000")))); b.append(":"); b.append(toIPTCHelper(srs.getName(this))); } return b.toString(); }
Formats an IPTC string for this reference using information obtained from Subject Reference System. @param srs reference subject reference system @return IPTC formatted reference
public DataSetInfo create(int dataSet) throws InvalidDataSetException { DataSetInfo info = dataSets.get(createKey(dataSet)); if (info == null) { int recordNumber = (dataSet >> 8) & 0xFF; int dataSetNumber = dataSet & 0xFF; throw new UnsupportedDataSetException(recordNumber + ":" + dataSetNumber); // info = super.create(dataSet); } return info; }
Creates and caches dataset info object. Subsequent invocations will return same instance. @see IIM#DS(int, int) @param dataSet dataset record number @return dataset info instace
public double Function1D(double x) { double frequency = initFrequency; double amplitude = initAmplitude; double sum = 0; // octaves for (int i = 0; i < octaves; i++) { sum += SmoothedNoise(x * frequency) * amplitude; frequency *= 2; amplitude *= persistence; } return sum; }
1-D Perlin noise function. @param x X Value. @return Returns function's value at point x.
public double Function2D(double x, double y) { double frequency = initFrequency; double amplitude = initAmplitude; double sum = 0; // octaves for (int i = 0; i < octaves; i++) { sum += SmoothedNoise(x * frequency, y * frequency) * amplitude; frequency *= 2; amplitude *= persistence; } return sum; }
2-D Perlin noise function. @param x X Value. @param y Y Value. @return Returns function's value at point xy.
private double Noise(int x, int y) { int n = x + y * 57; n = (n << 13) ^ n; return (1.0 - ((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); }
Ordinary noise function. @param x X Value. @param y Y Value. @return
private double SmoothedNoise(double x) { int xInt = (int) x; double xFrac = x - xInt; return CosineInterpolate(Noise(xInt), Noise(xInt + 1), xFrac); }
Smoothed noise. @param x Value. @return Value.
private double SmoothedNoise(double x, double y) { int xInt = (int) x; int yInt = (int) y; double xFrac = x - xInt; double yFrac = y - yInt; // get four noise values double x0y0 = Noise(xInt, yInt); double x1y0 = Noise(xInt + 1, yInt); double x0y1 = Noise(xInt, yInt + 1); double x1y1 = Noise(xInt + 1, yInt + 1); // x interpolation double v1 = CosineInterpolate(x0y0, x1y0, xFrac); double v2 = CosineInterpolate(x0y1, x1y1, xFrac); // y interpolation return CosineInterpolate(v1, v2, yFrac); }
Smoothed noise. @param x X Value. @param y Y Value. @return Value.
private double CosineInterpolate(double x1, double x2, double a) { double f = (1 - Math.cos(a * Math.PI)) * 0.5; return x1 * (1 - f) + x2 * f; }
Cosine interpolation. @param x1 X1 Value. @param x2 X2 Value. @param a Value. @return Value.
public List<FailedEventInvocation> getFailedInvocations() { synchronized (this.mutex) { if (this.failedEvents == null) { return Collections.emptyList(); } return Collections.unmodifiableList(this.failedEvents); } }
Gets the list of failed invocations that has been collected by this collector. @return The failed invocations.
public static double BiCubicKernel(double x) { if (x < 0) { x = -x; } double biCoef = 0; if (x <= 1) { biCoef = (1.5 * x - 2.5) * x * x + 1; } else if (x < 2) { biCoef = ((-0.5 * x + 2.5) * x - 4) * x + 2; } return biCoef; }
Bicubic kernel. <p> <para>The function implements bicubic kernel W(x) as described on http://en.wikipedia.org/wiki/Bicubic_interpolation#Bicubic_convolution_algorithm (coefficient <b>a</b> is set to <b>-0.5</b>).</para> @param x X value. @return Bicubic cooefficient.
public void setEventStack(EventStack eventStack) { if (this.eventStack == null) { this.eventStack = eventStack; this.cause = eventStack.peek(); } }
Sets the EventStack which is used while this event is dispatched. This method will be called by the {@link SequentialEventProvider} right before dispatching this event. The stack is only set once, subsequent calls will have no effect. @param eventStack The current event stack.
public void addSuppressedEvent(SuppressedEvent e) { if (e == null) { throw new IllegalArgumentException("e is null"); } else if (this.suppressedEvents == null) { this.suppressedEvents = new HashSet<>(); } this.suppressedEvents.add(e); }
Adds a {@linkplain SuppressedEvent} to the set of suppressed events of this Event. If a capable EventProvider determines that a certain event has been prevented because its listener class has been registered on this event using {@link #preventCascade(Class)}, then the prevented event is registered here using this method. @param e The event to add. @throws IllegalArgumentException If the event is <code>null</code>.
public Set<SuppressedEvent> getSuppressedEvents() { if (this.suppressedEvents == null) { return Collections.emptySet(); } return Collections.unmodifiableSet(this.suppressedEvents); }
Gets a read-only set of the suppressed events that have been registered at this event using {@link #addSuppressedEvent(SuppressedEvent)}. @return The suppressed events.
public <E extends Listener> void preventCascade(Class<E> listenerClass) { if (listenerClass == null) { throw new IllegalArgumentException("listenerClass is null"); } else if (this.eventStack != null) { // this event is currently being dispatched, so adding a prevented // class has no effect. LOGGER.warn("'preventCascade' has been called on {} for listener class {} " + "while the event was being dispatched. preventCascade must be " + "called before dispatching the event.", this.getClass().getSimpleName(), getListenerClass().getSimpleName()); return; } else if (this.prevent == null) { this.prevent = new HashSet<>(); } this.prevent.add(listenerClass); }
Prevents to dispatch events to the given listener class while this event is being dispatched. This is only supported when dispatching this event with an EventProvider which supports the {@link EventStack}. <p> Note: this method has to be called before this event is being dispatched. If called during dispatch, it will have no effect. </p> @param <E> Type of the listener class. @param listenerClass The listener class to prevent being notified. @see #preventCascade()
public Set<Class<?>> getPrevented() { if (this.prevent == null) { return Collections.emptySet(); } return Collections.unmodifiableSet(this.prevent); }
Gets the listener classes to which dispatching should be prevented while this event is being dispatched. @return The listener classes marked to prevent. @see #preventCascade(Class)
public AggregatesHistogramResponse getAggregatesHistogram(Long startDate, Long endDate, String sdid, String field, String interval) throws ApiException { ApiResponse<AggregatesHistogramResponse> resp = getAggregatesHistogramWithHttpInfo(startDate, endDate, sdid, field, interval); return resp.getData(); }
Get Normalized Message Histogram Get Histogram on normalized messages. @param startDate Timestamp of earliest message (in milliseconds since epoch). (required) @param endDate Timestamp of latest message (in milliseconds since epoch). (required) @param sdid Source device ID of the messages being searched. (optional) @param field Message field being queried for building histogram. (optional) @param interval Interval of time for building histogram blocks. (Valid values: minute, hour, day, month, year) (optional) @return AggregatesHistogramResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public ApiResponse<AggregatesHistogramResponse> getAggregatesHistogramWithHttpInfo(Long startDate, Long endDate, String sdid, String field, String interval) throws ApiException { com.squareup.okhttp.Call call = getAggregatesHistogramValidateBeforeCall(startDate, endDate, sdid, field, interval, null, null); Type localVarReturnType = new TypeToken<AggregatesHistogramResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
Get Normalized Message Histogram Get Histogram on normalized messages. @param startDate Timestamp of earliest message (in milliseconds since epoch). (required) @param endDate Timestamp of latest message (in milliseconds since epoch). (required) @param sdid Source device ID of the messages being searched. (optional) @param field Message field being queried for building histogram. (optional) @param interval Interval of time for building histogram blocks. (Valid values: minute, hour, day, month, year) (optional) @return ApiResponse&lt;AggregatesHistogramResponse&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public FieldPresenceEnvelope getFieldPresence(Long startDate, Long endDate, String interval, String sdid, String fieldPresence) throws ApiException { ApiResponse<FieldPresenceEnvelope> resp = getFieldPresenceWithHttpInfo(startDate, endDate, interval, sdid, fieldPresence); return resp.getData(); }
Get normalized message presence Get normalized message presence. @param startDate startDate (required) @param endDate endDate (required) @param interval String representing grouping interval. One of: &#39;minute&#39; (1 hour limit), &#39;hour&#39; (1 day limit), &#39;day&#39; (31 days limit), &#39;month&#39; (1 year limit), or &#39;year&#39; (10 years limit). (required) @param sdid Source device ID of the messages being searched. (optional) @param fieldPresence String representing a field from the specified device ID. (optional) @return FieldPresenceEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public ApiResponse<FieldPresenceEnvelope> getFieldPresenceWithHttpInfo(Long startDate, Long endDate, String interval, String sdid, String fieldPresence) throws ApiException { com.squareup.okhttp.Call call = getFieldPresenceValidateBeforeCall(startDate, endDate, interval, sdid, fieldPresence, null, null); Type localVarReturnType = new TypeToken<FieldPresenceEnvelope>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
Get normalized message presence Get normalized message presence. @param startDate startDate (required) @param endDate endDate (required) @param interval String representing grouping interval. One of: &#39;minute&#39; (1 hour limit), &#39;hour&#39; (1 day limit), &#39;day&#39; (31 days limit), &#39;month&#39; (1 year limit), or &#39;year&#39; (10 years limit). (required) @param sdid Source device ID of the messages being searched. (optional) @param fieldPresence String representing a field from the specified device ID. (optional) @return ApiResponse&lt;FieldPresenceEnvelope&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public com.squareup.okhttp.Call getFieldPresenceAsync(Long startDate, Long endDate, String interval, String sdid, String fieldPresence, final ApiCallback<FieldPresenceEnvelope> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getFieldPresenceValidateBeforeCall(startDate, endDate, interval, sdid, fieldPresence, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<FieldPresenceEnvelope>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
Get normalized message presence (asynchronously) Get normalized message presence. @param startDate startDate (required) @param endDate endDate (required) @param interval String representing grouping interval. One of: &#39;minute&#39; (1 hour limit), &#39;hour&#39; (1 day limit), &#39;day&#39; (31 days limit), &#39;month&#39; (1 year limit), or &#39;year&#39; (10 years limit). (required) @param sdid Source device ID of the messages being searched. (optional) @param fieldPresence String representing a field from the specified device ID. (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
public NormalizedMessagesEnvelope getLastNormalizedMessages(Integer count, String sdids, String fieldPresence) throws ApiException { ApiResponse<NormalizedMessagesEnvelope> resp = getLastNormalizedMessagesWithHttpInfo(count, sdids, fieldPresence); return resp.getData(); }
Get Last Normalized Message Get last messages normalized. @param count Number of items to return per query. (optional) @param sdids Comma separated list of source device IDs (minimum: 1). (optional) @param fieldPresence String representing a field from the specified device ID. (optional) @return NormalizedMessagesEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public ApiResponse<NormalizedMessagesEnvelope> getLastNormalizedMessagesWithHttpInfo(Integer count, String sdids, String fieldPresence) throws ApiException { com.squareup.okhttp.Call call = getLastNormalizedMessagesValidateBeforeCall(count, sdids, fieldPresence, null, null); Type localVarReturnType = new TypeToken<NormalizedMessagesEnvelope>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
Get Last Normalized Message Get last messages normalized. @param count Number of items to return per query. (optional) @param sdids Comma separated list of source device IDs (minimum: 1). (optional) @param fieldPresence String representing a field from the specified device ID. (optional) @return ApiResponse&lt;NormalizedMessagesEnvelope&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public com.squareup.okhttp.Call getLastNormalizedMessagesAsync(Integer count, String sdids, String fieldPresence, final ApiCallback<NormalizedMessagesEnvelope> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getLastNormalizedMessagesValidateBeforeCall(count, sdids, fieldPresence, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<NormalizedMessagesEnvelope>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
Get Last Normalized Message (asynchronously) Get last messages normalized. @param count Number of items to return per query. (optional) @param sdids Comma separated list of source device IDs (minimum: 1). (optional) @param fieldPresence String representing a field from the specified device ID. (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
public AggregatesResponse getMessageAggregates(String sdid, String field, Long startDate, Long endDate) throws ApiException { ApiResponse<AggregatesResponse> resp = getMessageAggregatesWithHttpInfo(sdid, field, startDate, endDate); return resp.getData(); }
Get Normalized Message Aggregates Get Aggregates on normalized messages. @param sdid Source device ID of the messages being searched. (required) @param field Message field being queried for aggregates. (required) @param startDate Timestamp of earliest message (in milliseconds since epoch). (required) @param endDate Timestamp of latest message (in milliseconds since epoch). (required) @return AggregatesResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public ApiResponse<AggregatesResponse> getMessageAggregatesWithHttpInfo(String sdid, String field, Long startDate, Long endDate) throws ApiException { com.squareup.okhttp.Call call = getMessageAggregatesValidateBeforeCall(sdid, field, startDate, endDate, null, null); Type localVarReturnType = new TypeToken<AggregatesResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
Get Normalized Message Aggregates Get Aggregates on normalized messages. @param sdid Source device ID of the messages being searched. (required) @param field Message field being queried for aggregates. (required) @param startDate Timestamp of earliest message (in milliseconds since epoch). (required) @param endDate Timestamp of latest message (in milliseconds since epoch). (required) @return ApiResponse&lt;AggregatesResponse&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public SnapshotResponses getMessageSnapshots(String sdids, Boolean includeTimestamp) throws ApiException { ApiResponse<SnapshotResponses> resp = getMessageSnapshotsWithHttpInfo(sdids, includeTimestamp); return resp.getData(); }
Get Message Snapshots Get message snapshots. @param sdids Device IDs for which the snapshots are requested. Max 100 device ids per call. (required) @param includeTimestamp Indicates whether to return timestamps of the last update for each field. (optional) @return SnapshotResponses @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public ApiResponse<SnapshotResponses> getMessageSnapshotsWithHttpInfo(String sdids, Boolean includeTimestamp) throws ApiException { com.squareup.okhttp.Call call = getMessageSnapshotsValidateBeforeCall(sdids, includeTimestamp, null, null); Type localVarReturnType = new TypeToken<SnapshotResponses>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
Get Message Snapshots Get message snapshots. @param sdids Device IDs for which the snapshots are requested. Max 100 device ids per call. (required) @param includeTimestamp Indicates whether to return timestamps of the last update for each field. (optional) @return ApiResponse&lt;SnapshotResponses&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public NormalizedActionsEnvelope getNormalizedActions(String uid, String ddid, String mid, String offset, Integer count, Long startDate, Long endDate, String order) throws ApiException { ApiResponse<NormalizedActionsEnvelope> resp = getNormalizedActionsWithHttpInfo(uid, ddid, mid, offset, count, startDate, endDate, order); return resp.getData(); }
Get Normalized Actions Get the actions normalized @param uid User ID. If not specified, assume that of the current authenticated user. If specified, it must be that of a user for which the current authenticated user has read access to. (optional) @param ddid Destination device ID of the actions being searched. (optional) @param mid The message ID being searched. (optional) @param offset A string that represents the starting item, should be the value of &#39;next&#39; field received in the last response. (required for pagination) (optional) @param count count (optional) @param startDate startDate (optional) @param endDate endDate (optional) @param order Desired sort order: &#39;asc&#39; or &#39;desc&#39; (optional) @return NormalizedActionsEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public ApiResponse<NormalizedActionsEnvelope> getNormalizedActionsWithHttpInfo(String uid, String ddid, String mid, String offset, Integer count, Long startDate, Long endDate, String order) throws ApiException { com.squareup.okhttp.Call call = getNormalizedActionsValidateBeforeCall(uid, ddid, mid, offset, count, startDate, endDate, order, null, null); Type localVarReturnType = new TypeToken<NormalizedActionsEnvelope>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
Get Normalized Actions Get the actions normalized @param uid User ID. If not specified, assume that of the current authenticated user. If specified, it must be that of a user for which the current authenticated user has read access to. (optional) @param ddid Destination device ID of the actions being searched. (optional) @param mid The message ID being searched. (optional) @param offset A string that represents the starting item, should be the value of &#39;next&#39; field received in the last response. (required for pagination) (optional) @param count count (optional) @param startDate startDate (optional) @param endDate endDate (optional) @param order Desired sort order: &#39;asc&#39; or &#39;desc&#39; (optional) @return ApiResponse&lt;NormalizedActionsEnvelope&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public NormalizedMessagesEnvelope getNormalizedMessages(String uid, String sdid, String mid, String fieldPresence, String filter, String offset, Integer count, Long startDate, Long endDate, String order) throws ApiException { ApiResponse<NormalizedMessagesEnvelope> resp = getNormalizedMessagesWithHttpInfo(uid, sdid, mid, fieldPresence, filter, offset, count, startDate, endDate, order); return resp.getData(); }
Get Normalized Messages Get the messages normalized @param uid User ID. If not specified, assume that of the current authenticated user. If specified, it must be that of a user for which the current authenticated user has read access to. (optional) @param sdid Source device ID of the messages being searched. (optional) @param mid The message ID being searched. (optional) @param fieldPresence String representing a field from the specified device ID. (optional) @param filter Filter. (optional) @param offset A string that represents the starting item, should be the value of &#39;next&#39; field received in the last response. (required for pagination) (optional) @param count count (optional) @param startDate startDate (optional) @param endDate endDate (optional) @param order Desired sort order: &#39;asc&#39; or &#39;desc&#39; (optional) @return NormalizedMessagesEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public ApiResponse<NormalizedMessagesEnvelope> getNormalizedMessagesWithHttpInfo(String uid, String sdid, String mid, String fieldPresence, String filter, String offset, Integer count, Long startDate, Long endDate, String order) throws ApiException { com.squareup.okhttp.Call call = getNormalizedMessagesValidateBeforeCall(uid, sdid, mid, fieldPresence, filter, offset, count, startDate, endDate, order, null, null); Type localVarReturnType = new TypeToken<NormalizedMessagesEnvelope>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
Get Normalized Messages Get the messages normalized @param uid User ID. If not specified, assume that of the current authenticated user. If specified, it must be that of a user for which the current authenticated user has read access to. (optional) @param sdid Source device ID of the messages being searched. (optional) @param mid The message ID being searched. (optional) @param fieldPresence String representing a field from the specified device ID. (optional) @param filter Filter. (optional) @param offset A string that represents the starting item, should be the value of &#39;next&#39; field received in the last response. (required for pagination) (optional) @param count count (optional) @param startDate startDate (optional) @param endDate endDate (optional) @param order Desired sort order: &#39;asc&#39; or &#39;desc&#39; (optional) @return ApiResponse&lt;NormalizedMessagesEnvelope&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public com.squareup.okhttp.Call getNormalizedMessagesAsync(String uid, String sdid, String mid, String fieldPresence, String filter, String offset, Integer count, Long startDate, Long endDate, String order, final ApiCallback<NormalizedMessagesEnvelope> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getNormalizedMessagesValidateBeforeCall(uid, sdid, mid, fieldPresence, filter, offset, count, startDate, endDate, order, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<NormalizedMessagesEnvelope>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
Get Normalized Messages (asynchronously) Get the messages normalized @param uid User ID. If not specified, assume that of the current authenticated user. If specified, it must be that of a user for which the current authenticated user has read access to. (optional) @param sdid Source device ID of the messages being searched. (optional) @param mid The message ID being searched. (optional) @param fieldPresence String representing a field from the specified device ID. (optional) @param filter Filter. (optional) @param offset A string that represents the starting item, should be the value of &#39;next&#39; field received in the last response. (required for pagination) (optional) @param count count (optional) @param startDate startDate (optional) @param endDate endDate (optional) @param order Desired sort order: &#39;asc&#39; or &#39;desc&#39; (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
public MessageIDEnvelope sendActions(Actions data) throws ApiException { ApiResponse<MessageIDEnvelope> resp = sendActionsWithHttpInfo(data); return resp.getData(); }
Send Actions Send Actions @param data Actions that are passed in the body (required) @return MessageIDEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public ApiResponse<MessageIDEnvelope> sendActionsWithHttpInfo(Actions data) throws ApiException { com.squareup.okhttp.Call call = sendActionsValidateBeforeCall(data, null, null); Type localVarReturnType = new TypeToken<MessageIDEnvelope>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
Send Actions Send Actions @param data Actions that are passed in the body (required) @return ApiResponse&lt;MessageIDEnvelope&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public MessageIDEnvelope sendMessage(Message data) throws ApiException { ApiResponse<MessageIDEnvelope> resp = sendMessageWithHttpInfo(data); return resp.getData(); }
Send Message Send a message @param data Message object that is passed in the body (required) @return MessageIDEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public ApiResponse<MessageIDEnvelope> sendMessageWithHttpInfo(Message data) throws ApiException { com.squareup.okhttp.Call call = sendMessageValidateBeforeCall(data, null, null); Type localVarReturnType = new TypeToken<MessageIDEnvelope>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
Send Message Send a message @param data Message object that is passed in the body (required) @return ApiResponse&lt;MessageIDEnvelope&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
@Parameters public static final Collection<Object[]> getParameters() { return Arrays.asList( new Object[] { (Function<ListenerStore, ? extends EventProvider>) ParallelEventProvider::new, (Supplier<ListenerStore>) () -> DefaultListenerStore.create().synchronizedView() }, new Object[] { (Function<ListenerStore, ? extends EventProvider>) AsynchronousEventProvider::new, (Supplier<ListenerStore>) () -> DefaultListenerStore.create().synchronizedView() }, new Object[] { (Function<ListenerStore, ? extends EventProvider>) BlockingParallelEventProvider::new, (Supplier<ListenerStore>) () -> DefaultListenerStore.create().synchronizedView() }, new Object[] { (Function<ListenerStore, ? extends EventProvider>) store-> new StatisticsEventProvider<>(new ParallelEventProvider(store)), (Supplier<ListenerStore>) () -> DefaultListenerStore.create().synchronizedView() }, new Object[] { (Function<ListenerStore, ? extends EventProvider>) store-> new StatisticsEventProvider<>(new BlockingParallelEventProvider(store)), (Supplier<ListenerStore>) () -> DefaultListenerStore.create().synchronizedView() }, new Object[] { (Function<ListenerStore, ? extends EventProvider>) store-> new StatisticsEventProvider<>(new AsynchronousEventProvider(store)), (Supplier<ListenerStore>) () -> DefaultListenerStore.create().synchronizedView() }); }
Parameterizes the test instances. @return Collection of parameters for the constructor of {@link EventProviderTestBase}.
public TaskEnvelope createTasks(TaskRequest taskPayload) throws ApiException { ApiResponse<TaskEnvelope> resp = createTasksWithHttpInfo(taskPayload); return resp.getData(); }
Create a new task for one or more devices Create a new task for one or more devices @param taskPayload Task object to be created (required) @return TaskEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public ApiResponse<TaskEnvelope> createTasksWithHttpInfo(TaskRequest taskPayload) throws ApiException { com.squareup.okhttp.Call call = createTasksValidateBeforeCall(taskPayload, null, null); Type localVarReturnType = new TypeToken<TaskEnvelope>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
Create a new task for one or more devices Create a new task for one or more devices @param taskPayload Task object to be created (required) @return ApiResponse&lt;TaskEnvelope&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public com.squareup.okhttp.Call createTasksAsync(TaskRequest taskPayload, final ApiCallback<TaskEnvelope> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = createTasksValidateBeforeCall(taskPayload, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<TaskEnvelope>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
Create a new task for one or more devices (asynchronously) Create a new task for one or more devices @param taskPayload Task object to be created (required) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
public MetadataEnvelope deleteServerProperties(String did) throws ApiException { ApiResponse<MetadataEnvelope> resp = deleteServerPropertiesWithHttpInfo(did); return resp.getData(); }
Deletes a device&#39;s properties. Deletes a device&#39;s properties. @param did Device ID. (required) @return MetadataEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public ApiResponse<MetadataEnvelope> deleteServerPropertiesWithHttpInfo(String did) throws ApiException { com.squareup.okhttp.Call call = deleteServerPropertiesValidateBeforeCall(did, null, null); Type localVarReturnType = new TypeToken<MetadataEnvelope>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
Deletes a device&#39;s properties. Deletes a device&#39;s properties. @param did Device ID. (required) @return ApiResponse&lt;MetadataEnvelope&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
public TaskByDidListEnvelope getAllByDid(String did, Integer count, Integer offset, String status, String order, String sort) throws ApiException { ApiResponse<TaskByDidListEnvelope> resp = getAllByDidWithHttpInfo(did, count, offset, status, order, sort); return resp.getData(); }
Returns the list of tasks for a particular device id with optional status filter. Returns the list of tasks for a particular device id with optional status filter. @param did Device ID. (required) @param count Max results count. (optional) @param offset Result starting offset. (optional) @param status Status filter. Comma-separated statuses. (optional) @param order Sort results by a field. Valid fields: createdOn. (optional) @param sort Sort order. Valid values: asc or desc. (optional) @return TaskByDidListEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body