Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
NomadCommandSystem
Commits
e650f3ee
Commit
e650f3ee
authored
Apr 15, 2015
by
yannick legoc
Browse files
sort the SpyPropertyDescriptor
parent
5ed4c913
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/fr/ill/ics/nscclient/dataprovider/PropertyDatabase.java
View file @
e650f3ee
...
...
@@ -25,9 +25,11 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
java.util.Set
;
import
java.util.TreeSet
;
import
fr.ill.ics.nscclient.servant.DynamicPropertyDescriptor
;
import
fr.ill.ics.nscclient.servant.SpyPropertyDescriptor
;
import
fr.ill.ics.nscclient.servant.SpyPropertyDescriptorComparator
;
import
fr.ill.ics.nscclient.servant.StandardPropertyDescriptor
;
public
class
PropertyDatabase
{
...
...
@@ -102,16 +104,19 @@ public class PropertyDatabase {
public
void
addSpyPropertyDescriptor
(
int
servantId
,
SpyPropertyDescriptor
descriptor
)
{
if
(!
spyPropertiesByServant
.
containsKey
(
servantId
))
{
Set
<
SpyPropertyDescriptor
>
set
=
new
HashSet
<
SpyPropertyDescriptor
>();
// we chose to display:
// - properties with setpoint in the order of ID
// - properties without setpoint in the order of ID
Set
<
SpyPropertyDescriptor
>
set
=
new
TreeSet
<
SpyPropertyDescriptor
>(
new
SpyPropertyDescriptorComparator
());
spyPropertiesByServant
.
put
(
servantId
,
set
);
}
spyPropertiesByServant
.
get
(
servantId
).
add
(
descriptor
);
/*
if (descriptor.getSetpointID() != 0) {
System.out.println("spy property for servant " + servantId);
System.out.println(descriptor);
}
*/
//
if (descriptor.getSetpointID() != 0) {
//
System.out.println("spy property for servant " + servantId);
//
System.out.println(descriptor);
//
}
}
/**
...
...
src/fr/ill/ics/nscclient/servant/SpyPropertyDescriptorComparator.java
0 → 100644
View file @
e650f3ee
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
package
fr.ill.ics.nscclient.servant
;
import
java.util.Comparator
;
public
class
SpyPropertyDescriptorComparator
implements
Comparator
<
SpyPropertyDescriptor
>
{
@Override
public
int
compare
(
SpyPropertyDescriptor
d1
,
SpyPropertyDescriptor
d2
)
{
// first comparing set point ID before actual ID
if
(
d1
.
getSetpointID
()
==
d2
.
getSetpointID
())
{
return
Integer
.
compare
(
d1
.
getActualID
(),
d1
.
getActualID
());
}
return
Integer
.
compare
(
d1
.
getSetpointID
(),
d2
.
getSetpointID
());
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment