Skip to content

Commit

Permalink
Data point cloning (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjhawk committed Apr 29, 2024
1 parent eb34aa9 commit 3d6ced7
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public String getTagUnit() {
return tagUnit;
}

public void setTagUnit(String tagUnit) {
this.tagUnit = tagUnit;
}

/**
* Get the {@link String} representation of the time stamp.
*
Expand Down Expand Up @@ -145,4 +149,6 @@ public String toString() {
* @return data point value as an {@link Object}
*/
public abstract Object getValueObject();

public abstract Object clone(String tagName) throws CloneNotSupportedException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,8 @@ public String getValueString() {
public Object getValueObject() {
return Boolean.valueOf(value);
}

public Object clone(String tagName) throws CloneNotSupportedException {
return new DataPointBoolean(tagName, tagId, tagUnit, value, timestamp, quality);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,8 @@ public String getValueString() {
public Object getValueObject() {
return new Long(value);
}

public Object clone(String tagName) throws CloneNotSupportedException {
return new DataPointDword(tagName, tagId, tagUnit, value, timestamp, quality);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,8 @@ public String getValueString() {
public Object getValueObject() {
return new Double(value);
}

public Object clone(String tagName) throws CloneNotSupportedException {
return new DataPointFloat(tagName, tagId, tagUnit, value, timestamp, quality);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,8 @@ public String getValueString() {
public Object getValueObject() {
return new Integer(value);
}

public Object clone(String tagName) throws CloneNotSupportedException {
return new DataPointInteger(tagName, tagId, tagUnit, value, timestamp, quality);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,10 @@ public DataPointIntegerMappedString(
public DataType getType() {
return DataType.INTEGER_MAPPED_STRING;
}

public Object clone(String tagName) throws CloneNotSupportedException {
Object cloned = clone();
((DataPointIntegerMappedString) cloned).tagName = tagName;
return cloned;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,8 @@ public String getValueString() {
public Object getValueObject() {
return getValue();
}

public Object clone(String tagName) throws CloneNotSupportedException {
return new DataPointString(tagName, tagId, tagUnit, value, timestamp, quality);
}
}

0 comments on commit 3d6ced7

Please sign in to comment.