implemented compare for BoolDataPoint
This commit is contained in:
parent
edcb890434
commit
ef27e33d03
@ -17,6 +17,7 @@ package org.thingsboard.server.edqs.data.dp;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.thingsboard.server.common.data.edqs.DataPoint;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@ -56,19 +57,7 @@ public abstract class AbstractDataPoint implements DataPoint {
|
||||
|
||||
@Override
|
||||
public int compareTo(DataPoint dataPoint) {
|
||||
String str1 = this.valueToString();
|
||||
String str2 = dataPoint.valueToString();
|
||||
|
||||
if (str1 == null && str2 == null) {
|
||||
return 0;
|
||||
}
|
||||
if (str1 == null) {
|
||||
return -1;
|
||||
}
|
||||
if (str2 == null) {
|
||||
return 1;
|
||||
}
|
||||
return str1.compareToIgnoreCase(str2);
|
||||
return StringUtils.compareIgnoreCase(valueToString(), dataPoint.valueToString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
package org.thingsboard.server.edqs.data.dp;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.thingsboard.server.common.data.edqs.DataPoint;
|
||||
import org.thingsboard.server.common.data.kv.DataType;
|
||||
|
||||
public class BoolDataPoint extends AbstractDataPoint {
|
||||
@ -43,4 +44,8 @@ public class BoolDataPoint extends AbstractDataPoint {
|
||||
return Boolean.toString(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(DataPoint dataPoint) {
|
||||
return Boolean.compare(value, dataPoint.getBool());
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user