X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.history%2Ftest%2Forg%2Fsimantics%2Fhistory%2Ftest%2FTestClassDistribution.java;h=a27f042091e81092bf23e50179853832b490228a;hp=f75bcd4489ab2a6cb6fa30610be7bd9d5e0aaee0;hb=refs%2Fchanges%2F38%2F238%2F2;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.history/test/org/simantics/history/test/TestClassDistribution.java b/bundles/org.simantics.history/test/org/simantics/history/test/TestClassDistribution.java index f75bcd448..a27f04209 100644 --- a/bundles/org.simantics.history/test/org/simantics/history/test/TestClassDistribution.java +++ b/bundles/org.simantics.history/test/org/simantics/history/test/TestClassDistribution.java @@ -1,67 +1,67 @@ -package org.simantics.history.test; - -import org.simantics.databoard.Bindings; -import org.simantics.databoard.serialization.Serializer; -import org.simantics.history.util.ClassDistribution; - -/******************************************************************************* - * 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 - *******************************************************************************/ - - - -public class TestClassDistribution { - - public static void main(String[] args) throws Exception { - - ClassDistribution ib = new ClassDistribution(1.1); - - System.out.println( ib.getClassIndex(0.001) ); - System.out.println( ib.getClassIndex(0.01) ); - System.out.println( ib.getClassIndex(0.1) ); - System.out.println( ib.getClassIndex(1) ); - System.out.println( ib.getClassIndex(10) ); - System.out.println( ib.getClassIndex(100) ); - - ib.addValue(0.00001); - ib.addValue(0.000015); - ib.addValue(0.001); - ib.addValue(0.001); - ib.addValue(0.001); - ib.addValue(0.01); - ib.addValue(0.1); - ib.addValue(1); -// ib.addInterval(10); - ib.addValue(100); - ib.addValue(1000); - - System.out.println(ib); - - System.out.println("Largest Class = "+ ib.getClassAvg( ib.getLargestClassIndex() ) ); - System.out.println("Median = "+ ib.getMedian() ); - - System.out.println( Math.log(2) ); - System.out.println( Math.sqrt(0.5) ); - - System.out.println("Test Serializer"); - Serializer s = Bindings.getSerializer( Bindings.getBinding( ClassDistribution.class ) ); - byte[] data = s.serialize( ib ); - ib = (ClassDistribution) s.deserialize(data); - - System.out.println(); - System.out.println("Deserialized:"); - System.out.println(ib); - System.out.println("Largest Class = "+ ib.getClassAvg( ib.getLargestClassIndex() ) ); - System.out.println("Median = "+ ib.getMedian() ); - - } - -} - +package org.simantics.history.test; + +import org.simantics.databoard.Bindings; +import org.simantics.databoard.serialization.Serializer; +import org.simantics.history.util.ClassDistribution; + +/******************************************************************************* + * 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 + *******************************************************************************/ + + + +public class TestClassDistribution { + + public static void main(String[] args) throws Exception { + + ClassDistribution ib = new ClassDistribution(1.1); + + System.out.println( ib.getClassIndex(0.001) ); + System.out.println( ib.getClassIndex(0.01) ); + System.out.println( ib.getClassIndex(0.1) ); + System.out.println( ib.getClassIndex(1) ); + System.out.println( ib.getClassIndex(10) ); + System.out.println( ib.getClassIndex(100) ); + + ib.addValue(0.00001); + ib.addValue(0.000015); + ib.addValue(0.001); + ib.addValue(0.001); + ib.addValue(0.001); + ib.addValue(0.01); + ib.addValue(0.1); + ib.addValue(1); +// ib.addInterval(10); + ib.addValue(100); + ib.addValue(1000); + + System.out.println(ib); + + System.out.println("Largest Class = "+ ib.getClassAvg( ib.getLargestClassIndex() ) ); + System.out.println("Median = "+ ib.getMedian() ); + + System.out.println( Math.log(2) ); + System.out.println( Math.sqrt(0.5) ); + + System.out.println("Test Serializer"); + Serializer s = Bindings.getSerializer( Bindings.getBinding( ClassDistribution.class ) ); + byte[] data = s.serialize( ib ); + ib = (ClassDistribution) s.deserialize(data); + + System.out.println(); + System.out.println("Deserialized:"); + System.out.println(ib); + System.out.println("Largest Class = "+ ib.getClassAvg( ib.getLargestClassIndex() ) ); + System.out.println("Median = "+ ib.getMedian() ); + + } + +} +