Skip to content

Commit 0fdca55

Browse files
committed
PVAlarm,PVTimeStamp,Display,Control: only update fields that have changed
2 parents 9cd47e2 + a70a83e commit 0fdca55

6 files changed

Lines changed: 100 additions & 18 deletions

File tree

pvDataJava/.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
sudo: required
2+
language: java
3+
jdk: oraclejdk8
4+
5+
script:
6+
- mvn clean verify
7+
8+
after_failure:
9+
- find ./ -type d -name "surefire-reports" -print0 | xargs -0 -I {} find {} -iname "*.txt" -type f | xargs cat
10+
- find . -type f -name "*.log" -print0 -exec cat {} \;

pvDataJava/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<<<<<<< HEAD
12
pvaDataJava
23
==========
34

@@ -40,3 +41,6 @@ e.g.
4041

4142
from the directory containing the jar.
4243

44+
=======
45+
# pvDataJava [![Build Status](https://travis-ci.org/epics-base/pvDataJava.svg?branch=master)](https://travis-ci.org/epics-base/pvDataJava)
46+
>>>>>>> 81ade9b8f2fdbfc1c12b415154e9b7808a35dc1a

pvDataJava/src/org/epics/pvdata/property/PVAlarmFactory.java

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,25 @@ public boolean set(Alarm alarm) {
9696
throw new IllegalStateException(notAttached);
9797
}
9898
if(pvSeverity.isImmutable() || pvMessage.isImmutable()) return false;
99-
pvSeverity.put(alarm.getSeverity().ordinal());
100-
pvStatus.put(alarm.getStatus().ordinal());
101-
pvMessage.put(alarm.getMessage());
102-
return true;
99+
Alarm current = new Alarm();
100+
get(current);
101+
boolean returnValue = false;
102+
if(current.getSeverity()!=alarm.getSeverity())
103+
{
104+
pvSeverity.put(alarm.getSeverity().ordinal());
105+
returnValue = true;
106+
}
107+
if(current.getStatus()!=alarm.getStatus())
108+
{
109+
pvStatus.put(alarm.getStatus().ordinal());
110+
returnValue = true;
111+
}
112+
if(current.getMessage()!=alarm.getMessage())
113+
{
114+
pvMessage.put(alarm.getMessage());
115+
returnValue = true;
116+
}
117+
return returnValue;
103118
}
104119

105120
}

pvDataJava/src/org/epics/pvdata/property/PVControlFactory.java

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,25 @@ public boolean set(Control control) {
9292
throw new IllegalStateException(notAttached);
9393
}
9494
if(pvLow.isImmutable() || pvHigh.isImmutable()) return false;
95-
pvLow.put(control.getLow());
96-
pvHigh.put(control.getHigh());
97-
pvMinStep.put(control.getMinStep());
98-
return true;
95+
Control current = new Control();
96+
get(current);
97+
boolean returnValue = false;
98+
if(current.getLow()!=control.getLow())
99+
{
100+
pvLow.put(control.getLow());
101+
returnValue = true;
102+
}
103+
if(current.getHigh()!=control.getHigh())
104+
{
105+
pvHigh.put(control.getHigh());
106+
returnValue = true;
107+
}
108+
if(current.getMinStep()!=control.getMinStep())
109+
{
110+
pvMinStep.put(control.getMinStep());
111+
returnValue = true;
112+
}
113+
return returnValue;
99114
}
100115

101116
}

pvDataJava/src/org/epics/pvdata/property/PVDisplayFactory.java

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,34 @@ public boolean set(Display display) {
108108
}
109109
if(pvDescription.isImmutable() || pvFormat.isImmutable() || pvUnits.isImmutable()) return false;
110110
if(pvLow.isImmutable() || pvHigh.isImmutable()) return false;
111-
pvDescription.put(display.getDescription());
112-
pvFormat.put(display.getFormat());
113-
pvUnits.put(display.getUnits());
114-
pvLow.put(display.getLow());
115-
pvHigh.put(display.getHigh());
116-
return true;
111+
Display current = new Display();
112+
get(current);
113+
boolean returnValue = false;
114+
if(current.getDescription()!=display.getDescription())
115+
{
116+
pvDescription.put(display.getDescription());
117+
returnValue = true;
118+
}
119+
if(current.getFormat()!=display.getFormat())
120+
{
121+
pvFormat.put(display.getFormat());
122+
returnValue = true;
123+
}
124+
if(current.getUnits()!=display.getUnits())
125+
{
126+
pvUnits.put(display.getUnits());
127+
returnValue = true;
128+
}
129+
if(current.getLow()!=display.getLow())
130+
{
131+
pvLow.put(display.getLow());
132+
returnValue = true;
133+
}
134+
if(current.getHigh()!=display.getHigh())
135+
{
136+
pvHigh.put(display.getHigh());
137+
returnValue = true;
138+
}
139+
return returnValue;
117140
}
118141
}

pvDataJava/src/org/epics/pvdata/property/PVTimeStampFactory.java

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,25 @@ public boolean set(TimeStamp timeStamp) {
9393
throw new IllegalStateException(notAttached);
9494
}
9595
if(pvSecs.isImmutable() || pvNano.isImmutable()) return false;
96-
pvSecs.put(timeStamp.getSecondsPastEpoch());
97-
pvUserTag.put(timeStamp.getUserTag());
98-
pvNano.put(timeStamp.getNanoseconds());
99-
return true;
96+
TimeStamp current = TimeStampFactory.create();
97+
get(current);
98+
boolean returnValue = false;
99+
if(current.getSecondsPastEpoch()!=timeStamp.getSecondsPastEpoch())
100+
{
101+
pvSecs.put(timeStamp.getSecondsPastEpoch());
102+
returnValue = true;
103+
}
104+
if(current.getNanoseconds()!=timeStamp.getNanoseconds())
105+
{
106+
pvSecs.put(timeStamp.getSecondsPastEpoch());
107+
returnValue = true;
108+
}
109+
if(current.getUserTag()!=timeStamp.getUserTag())
110+
{
111+
pvUserTag.put(timeStamp.getUserTag());
112+
returnValue = true;
113+
}
114+
return returnValue;
100115
}
101116

102117

0 commit comments

Comments
 (0)