1 /*******************************************************************************
\r
2 * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.
\r
3 * All rights reserved. This program and the accompanying materials
\r
4 * are made available under the terms of the Eclipse Public License v1.0
\r
5 * which accompanies this distribution, and is available at
\r
6 * http://www.eclipse.org/legal/epl-v10.html
\r
9 * VTT Technical Research Centre of Finland - initial API and implementation
\r
10 *******************************************************************************/
\r
11 package org.simantics.modeling.subscription;
\r
13 import org.simantics.databoard.annotations.Identifier;
\r
14 import org.simantics.databoard.annotations.Optional;
\r
15 import org.simantics.databoard.util.Bean;
\r
16 import org.simantics.utils.strings.AlphanumComparator;
\r
19 * @author Antti Villberg
\r
21 public class SubscriptionItem extends Bean {
\r
23 // Normal Label (eg. The label in CSV file)
\r
24 public @Optional String simpleLabel;
\r
25 // Variable reference in user friendly format
\r
26 public @Optional String variableReference;
\r
28 // GroupId in the history
\r
29 public @Identifier String groupId;
\r
30 // ItemId in the group
\r
31 public @Identifier String groupItemId;
\r
32 // Variable id in format understood by org.simantics.simulation.data.Datasource
\r
33 public @Identifier String variableId;
\r
35 public @Optional String unit;
\r
37 public SubscriptionItem() {
\r
41 public int compareTo(Bean o) {
\r
42 if ( o instanceof SubscriptionItem == false ) return 0;
\r
43 SubscriptionItem other = (SubscriptionItem) o;
\r
45 String myLabel2 = simpleLabel!=null?simpleLabel:"";
\r
46 String otLabel2 = other.simpleLabel!=null?other.simpleLabel:"";
\r
47 int c = AlphanumComparator.CASE_INSENSITIVE_COMPARATOR.compare(myLabel2, otLabel2);
\r
48 if ( c!=0 ) return c;
\r
50 String mySid = groupId!=null?groupId:"";
\r
51 String otSid = other.groupId!=null?other.groupId:"";
\r
52 c = mySid.compareTo(otSid);
\r
53 if ( c!=0 ) return c;
\r
55 String myGiid = groupItemId!=null?groupItemId:"";
\r
56 String otGiid = other.groupItemId!=null?other.groupItemId:"";
\r
57 c = myGiid.compareTo(otGiid);
\r
58 if ( c!=0 ) return c;
\r
60 String myVid = variableId!=null?variableId:"";
\r
61 String otVid = other.variableId!=null?other.variableId:"";
\r
62 c = myVid.compareTo(otVid);
\r
63 if ( c!=0 ) return c;
\r