View Javadoc
1   package org.djunits.demo.website;
2   
3   import org.djunits.value.ValueRuntimeException;
4   import org.djunits.value.storage.StorageType;
5   import org.djunits.value.vdouble.vector.base.DoubleVector;
6   
7   /**
8    * <p>
9    * Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
10   * BSD-style license. See <a href="https://djunits.org/docs/license.html">DJUNITS License</a>.
11   * </p>
12   * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a>
13   * @author <a href="https://www.tudelft.nl/staff/p.knoppers/">Peter Knoppers</a>
14   * @author <a href="https://www.transport.citg.tudelft.nl">Wouter Schakel</a>
15   */
16  public final class JerkDemo
17  {
18      /** */
19      private JerkDemo()
20      {
21          // utility class
22      }
23  
24      /**
25       * @param args String[]; args
26       * @throws ValueRuntimeException on error
27       */
28      public static void main(final String[] args) throws ValueRuntimeException
29      {
30          JerkJerk.html#Jerk">Jerk jerk1 = new Jerk(1.2, JerkUnit.SI);
31          System.out.println("jerk1 = Jerk(1.2, JerkUnit.SI)       : " + jerk1);
32          Jerk jerk2 = jerk1.times(2.0);
33          System.out.println("jerk2 = jerk1.multiplyBy(2.0)        : " + jerk2);
34          JerkJerk.html#Jerk">Jerk jerk3 = new Jerk(4.0, JerkUnit.IN_PER_S3);
35          System.out.println("jerk3 = Jerk(4.0, JerkUnit.IN_PER_S3 : " + jerk3);
36          System.out.println("jerk3 expressed in JerkUnit.SI       : " + jerk3.toString(JerkUnit.SI));
37          System.out.println("jerk3 expressed in JerkUnit.FT_PER_S3: " + jerk3.toString(JerkUnit.FT_PER_S3));
38          
39          System.out.println();
40          
41          double[] sv = new double[] {1, 2, 3, 4, 5};
42          JerkVector jerkVector = DoubleVector.instantiate(sv, JerkUnit.SI, StorageType.DENSE, JerkVector.class);
43          System.out.println("jerkVector: " + jerkVector);
44          // FIXME why can't we multiply a JerkVector by a scalar Duration and get an AccelerationVector 
45  
46          double[][] data = new double[1000][1000];
47          for (int i = 0; i < 1000; i++)
48          {
49              for (int j = 0; j < 1000; j++)
50              {
51                  data[i][j] = 9 * i + 2 * j * 0.364;
52              }
53          }
54          // XXX Is this supposed to fill a JerkMatrix???
55      }
56  
57  }