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