X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fsubscription%2FSubscriptionItem.java;h=2b1ead2deb41de7e79a9726ddc719da6fef0bda6;hp=6703933935665c99657e830039f7953ab0215463;hb=refs%2Fchanges%2F38%2F238%2F2;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/subscription/SubscriptionItem.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/subscription/SubscriptionItem.java index 670393393..2b1ead2de 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/subscription/SubscriptionItem.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/subscription/SubscriptionItem.java @@ -1,69 +1,69 @@ -/******************************************************************************* - * Copyright (c) 2007 VTT Technical Research Centre of Finland and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.modeling.subscription; - -import org.simantics.databoard.annotations.Identifier; -import org.simantics.databoard.annotations.Optional; -import org.simantics.databoard.util.Bean; -import org.simantics.utils.strings.AlphanumComparator; - -/** - * @author Antti Villberg - */ -public class SubscriptionItem extends Bean { - - // Normal Label (eg. The label in CSV file) - public @Optional String simpleLabel; - // Variable reference in user friendly format - public @Optional String variableReference; - - // GroupId in the history - public @Identifier String groupId; - // ItemId in the group - public @Identifier String groupItemId; - // Variable id in format understood by org.simantics.simulation.data.Datasource - public @Identifier String variableId; - - public @Optional String unit; - - public SubscriptionItem() { - } - - @Override - public int compareTo(Bean o) { - if ( o instanceof SubscriptionItem == false ) return 0; - SubscriptionItem other = (SubscriptionItem) o; - - String myLabel2 = simpleLabel!=null?simpleLabel:""; - String otLabel2 = other.simpleLabel!=null?other.simpleLabel:""; - int c = AlphanumComparator.CASE_INSENSITIVE_COMPARATOR.compare(myLabel2, otLabel2); - if ( c!=0 ) return c; - - String mySid = groupId!=null?groupId:""; - String otSid = other.groupId!=null?other.groupId:""; - c = mySid.compareTo(otSid); - if ( c!=0 ) return c; - - String myGiid = groupItemId!=null?groupItemId:""; - String otGiid = other.groupItemId!=null?other.groupItemId:""; - c = myGiid.compareTo(otGiid); - if ( c!=0 ) return c; - - String myVid = variableId!=null?variableId:""; - String otVid = other.variableId!=null?other.variableId:""; - c = myVid.compareTo(otVid); - if ( c!=0 ) return c; - - return c; - } - -} - +/******************************************************************************* + * Copyright (c) 2007 VTT Technical Research Centre of Finland and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.modeling.subscription; + +import org.simantics.databoard.annotations.Identifier; +import org.simantics.databoard.annotations.Optional; +import org.simantics.databoard.util.Bean; +import org.simantics.utils.strings.AlphanumComparator; + +/** + * @author Antti Villberg + */ +public class SubscriptionItem extends Bean { + + // Normal Label (eg. The label in CSV file) + public @Optional String simpleLabel; + // Variable reference in user friendly format + public @Optional String variableReference; + + // GroupId in the history + public @Identifier String groupId; + // ItemId in the group + public @Identifier String groupItemId; + // Variable id in format understood by org.simantics.simulation.data.Datasource + public @Identifier String variableId; + + public @Optional String unit; + + public SubscriptionItem() { + } + + @Override + public int compareTo(Bean o) { + if ( o instanceof SubscriptionItem == false ) return 0; + SubscriptionItem other = (SubscriptionItem) o; + + String myLabel2 = simpleLabel!=null?simpleLabel:""; + String otLabel2 = other.simpleLabel!=null?other.simpleLabel:""; + int c = AlphanumComparator.CASE_INSENSITIVE_COMPARATOR.compare(myLabel2, otLabel2); + if ( c!=0 ) return c; + + String mySid = groupId!=null?groupId:""; + String otSid = other.groupId!=null?other.groupId:""; + c = mySid.compareTo(otSid); + if ( c!=0 ) return c; + + String myGiid = groupItemId!=null?groupItemId:""; + String otGiid = other.groupItemId!=null?other.groupItemId:""; + c = myGiid.compareTo(otGiid); + if ( c!=0 ) return c; + + String myVid = variableId!=null?variableId:""; + String otVid = other.variableId!=null?other.variableId:""; + c = myVid.compareTo(otVid); + if ( c!=0 ) return c; + + return c; + } + +} +