X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fsubscription%2FSubscriptionItem.java;fp=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fsubscription%2FSubscriptionItem.java;h=6703933935665c99657e830039f7953ab0215463;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git 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 new file mode 100644 index 000000000..670393393 --- /dev/null +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/subscription/SubscriptionItem.java @@ -0,0 +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; + } + +} +