File |
Line |
org\opentrafficsim\core\car\LaneBasedIndividualCar.java |
136 |
org\opentrafficsim\core\car\LaneBasedTemplateCar.java |
106 |
this.animation = (Renderable2D) constructor.newInstance(this, simulator);
}
catch (InstantiationException | IllegalAccessException | NoSuchMethodException | SecurityException
| IllegalArgumentException | InvocationTargetException exception)
{
throw new NetworkException("Could not instantiate car animation of type " + animationClass.getName(),
exception);
}
}
}
/** {@inheritDoc} */
@Override
@SuppressWarnings("checkstyle:designforextension")
public RelativePosition getFront()
{
return this.relativePositions.get(RelativePosition.FRONT);
}
/** {@inheritDoc} */
@Override
@SuppressWarnings("checkstyle:designforextension")
public RelativePosition getRear()
{
return this.relativePositions.get(RelativePosition.REAR);
}
/** {@inheritDoc} */
@Override
public final Map<TYPE, RelativePosition> getRelativePositions()
{
return this.relativePositions;
}
/** {@inheritDoc} */
@Override
public final void destroy()
{
if (this.animation != null)
{
try
{
this.animation.destroy();
}
catch (Exception e)
{
System.err.println("Car: " + this.getId());
e.printStackTrace();
}
}
super.destroy();
}
/** {@inheritDoc} */
public final String toString()
{
try
{
Map<Lane, DoubleScalar.Rel<LengthUnit>> frontPositions = positions(getFront());
Lane frontLane = frontPositions.keySet().iterator().next();
return String.format("Car %s front: %s[%s]", getId(), frontLane, frontPositions.get(frontLane)); |
File |
Line |
org\opentrafficsim\core\gtu\following\IDM.java |
70 |
org\opentrafficsim\core\gtu\following\IDMPlus.java |
77 |
public IDM(final DoubleScalar.Abs<AccelerationUnit> a, final DoubleScalar.Abs<AccelerationUnit> b,
final DoubleScalar.Rel<LengthUnit> s0, final DoubleScalar.Rel<TimeUnit> tSafe, final double delta)
{
this.a = a;
this.b = b;
this.s0 = s0;
this.tSafe = tSafe;
this.delta = delta;
}
/**
* Desired speed (taking into account the urge to drive a little faster or slower than the posted speed limit).
* @param speedLimit DoubleScalarAbs<SpeedUnit>; the speed limit
* @param followerMaximumSpeed DoubleScalar.Abs<SpeedUnit>; the maximum speed that the follower can drive
* @return DoubleScalarRel<SpeedUnit>; the desired speed
*/
private DoubleScalar.Rel<SpeedUnit> vDes(final DoubleScalar.Abs<SpeedUnit> speedLimit,
final DoubleScalar.Abs<SpeedUnit> followerMaximumSpeed)
{
return new DoubleScalar.Rel<SpeedUnit>(Math.min(this.delta * speedLimit.getSI(), followerMaximumSpeed.getSI()),
SpeedUnit.METER_PER_SECOND);
}
/** {@inheritDoc} */
public final DoubleScalar.Abs<AccelerationUnit> computeAcceleration(
final DoubleScalar.Abs<SpeedUnit> followerSpeed, final DoubleScalar.Abs<SpeedUnit> followerMaximumSpeed,
final DoubleScalar.Abs<SpeedUnit> leaderSpeed, final DoubleScalar.Rel<LengthUnit> headway,
final DoubleScalar.Abs<SpeedUnit> speedLimit)
{ |
File |
Line |
org\opentrafficsim\graphs\FundamentalDiagram.java |
337 |
org\opentrafficsim\graphs\TrajectoryPlot.java |
561 |
}
/** {@inheritDoc} */
@Override
public final Comparable<Integer> getSeriesKey(final int series)
{
return series;
}
/** {@inheritDoc} */
@SuppressWarnings("rawtypes")
@Override
public final int indexOf(final Comparable seriesKey)
{
if (seriesKey instanceof Integer)
{
return (Integer) seriesKey;
}
return -1;
}
/** {@inheritDoc} */
@Override
public final void addChangeListener(final DatasetChangeListener listener)
{
this.listenerList.add(DatasetChangeListener.class, listener);
}
/** {@inheritDoc} */
@Override
public final void removeChangeListener(final DatasetChangeListener listener)
{
this.listenerList.remove(DatasetChangeListener.class, listener);
}
/** {@inheritDoc} */
@Override
public final DatasetGroup getGroup()
{
return this.datasetGroup;
}
/** {@inheritDoc} */
@Override
public final void setGroup(final DatasetGroup group)
{
this.datasetGroup = group;
}
/** {@inheritDoc} */
@Override
public final DomainOrder getDomainOrder()
{
return DomainOrder.ASCENDING;
}
/** {@inheritDoc} */
@Override
public final int getItemCount(final int series)
{
return this.samples.size(); |
File |
Line |
org\opentrafficsim\core\network\factory\NetworkLaneParser.java |
398 |
org\opentrafficsim\core\network\factory\XmlNetworkLaneParser.java |
822 |
private Object makePoint(final Class<?> clazz, final Point3d p) throws NetworkException
{
Object point = null;
if (Point3d.class.isAssignableFrom(clazz))
{
point = p;
}
else if (Point2D.class.isAssignableFrom(clazz))
{
point = new Point2D.Double(p.x, p.y);
}
else if (Point2d.class.isAssignableFrom(clazz))
{
point = new Point2d(new double[] {p.x, p.y});
}
else if (Coordinate.class.isAssignableFrom(clazz))
{
point = new Coordinate(p.x, p.y, p.z);
}
else
{
throw new NetworkException("Parsing network. Point class " + clazz.getName() + ": cannot instantiate.");
}
return point;
}
/**
* @param clazz the node class
* @param id the id as an object
* @param point the point as an object
* @return a constructed node
* @throws NetworkException when point cannot be instantiated
*/
@SuppressWarnings({"unchecked", "rawtypes"}) |
File |
Line |
org\opentrafficsim\core\value\vdouble\matrix\DoubleMatrix.java |
580 |
org\opentrafficsim\core\value\vfloat\matrix\FloatMatrix.java |
580 |
throw new ValueException("DoubleMatrix.det -- matrix implements neither Sparse nor Dense");
}
catch (IllegalArgumentException exception)
{
if (!exception.getMessage().startsWith("Matrix must be square"))
{
exception.printStackTrace();
}
throw new ValueException(exception.getMessage()); // probably Matrix must be square
}
}
/** {@inheritDoc} */
@Override
public final String toString()
{
return toString(getUnit(), false, true);
}
/**
* Print this DoubleMatrix with the values expressed in the specified unit.
* @param displayUnit U; the unit into which the values are converted for display
* @return String; printable string with the matrix contents expressed in the specified unit
*/
public final String toString(final U displayUnit)
{
return toString(displayUnit, false, true);
}
/**
* Print this DoubleMatrix with optional type and unit information.
* @param verbose boolean; if true; include type info; if false; exclude type info
* @param withUnit boolean; if true; include the unit; of false; exclude the unit
* @return String; printable string with the matrix contents
*/
public final String toString(final boolean verbose, final boolean withUnit)
{
return toString(getUnit(), verbose, withUnit);
}
/**
* Print this DoubleMatrix with the values expressed in the specified unit.
* @param displayUnit U; the unit into which the values are converted for display
* @param verbose boolean; if true; include type info; if false; exclude type info
* @param withUnit boolean; if true; include the unit; of false; exclude the unit
* @return String; printable string with the matrix contents
*/
public final String toString(final U displayUnit, final boolean verbose, final boolean withUnit)
{
StringBuffer buf = new StringBuffer();
if (verbose)
{
if (this instanceof MutableDoubleMatrix) |
File |
Line |
org\opentrafficsim\core\network\geotools\LinkGeotools.java |
105 |
org\opentrafficsim\core\network\point2d\LinkPoint2D.java |
74 |
double minX = Math.min(getEndNode().getX(), getStartNode().getX());
double minY = Math.min(getEndNode().getY(), getStartNode().getY());
double maxX = Math.max(getEndNode().getX(), getStartNode().getX());
double maxY = Math.max(getEndNode().getY(), getStartNode().getY());
return new BoundingBox(new Point3d(minX - c.x, minY - c.y, 0.0d), new Point3d(maxX - c.x, maxY - c.y, 0.0d));
}
/**
* String ID implementation of the Point link.
* <p>
* Copyright (c) 2013-2014 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. <br>
* All rights reserved. <br>
* BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
* <p>
* @version Jan 4, 2015 <br>
* @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
* @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
*/
public static class STR extends LinkGeotools<String, String> |
File |
Line |
org\opentrafficsim\core\value\vdouble\matrix\DoubleMatrix.java |
67 |
org\opentrafficsim\core\value\vdouble\matrix\MutableDoubleMatrix.java |
91 |
public abstract static class Abs<U extends Unit<U>> extends DoubleMatrix<U> implements Absolute
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Absolute Immutable DoubleMatrix.
* @param unit U; the unit of the new Absolute Immutable DoubleMatrix
*/
protected Abs(final U unit)
{
super(unit);
// System.out.println("Created Abs");
}
/**
* @param <U> Unit
*/
public static class Dense<U extends Unit<U>> extends Abs<U> implements DenseData
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Absolute Dense Immutable DoubleMatrix.
* @param values double[][]; the values of the entries in the new Absolute Dense Immutable DoubleMatrix
* @param unit U; the unit of the new Absolute Dense Immutable DoubleMatrix
* @throws ValueException when values is null, or is not rectangular
*/
public Dense(final double[][] values, final U unit) throws ValueException
{
super(unit);
// System.out.println("Created Dense");
initialize(values);
}
/**
* Construct a new Absolute Dense Immutable DoubleMatrix.
* @param values DoubleScalar.Abs<U>[][]; the values of the entries in the new Absolute Dense
* Immutable DoubleMatrix
* @throws ValueException when values has zero entries, or is not rectangular
*/
public Dense(final DoubleScalar.Abs<U>[][] values) throws ValueException
{
super(checkNonEmpty(values)[0][0].getUnit());
// System.out.println("Created Dense");
initialize(values);
}
/**
* For package internal use only.
* @param values DoubleMatrix2D; the values of the entries in the new Absolute Dense Immutable DoubleMatrix
* @param unit U; the unit of the new Absolute Dense Immutable DoubleMatrix
*/
protected Dense(final DoubleMatrix2D values, final U unit)
{
super(unit); |
File |
Line |
org\opentrafficsim\core\value\vdouble\matrix\DoubleMatrix.java |
232 |
org\opentrafficsim\core\value\vdouble\matrix\MutableDoubleMatrix.java |
519 |
public abstract static class Rel<U extends Unit<U>> extends DoubleMatrix<U> implements Relative
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Relative Immutable DoubleMatrix.
* @param unit U; the unit of the new Relative Immutable DoubleMatrix
*/
protected Rel(final U unit)
{
super(unit);
// System.out.println("Created Rel");
}
/**
* @param <U> Unit
*/
public static class Dense<U extends Unit<U>> extends Rel<U> implements DenseData
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Relative Dense Immutable DoubleMatrix.
* @param values double[][]; the values of the entries in the new Relative Dense Immutable DoubleMatrix
* @param unit U; the unit of the new Relative Dense Immutable DoubleMatrix
* @throws ValueException when values is null, or is not rectangular
*/
public Dense(final double[][] values, final U unit) throws ValueException
{
super(unit);
// System.out.println("Created Dense");
initialize(values);
}
/**
* Construct a new Relative Dense Immutable DoubleMatrix.
* @param values DoubleScalar.Rel<U>[][]; the values of the entries in the new Relative Dense
* Immutable DoubleMatrix
* @throws ValueException when values has zero entries, or is not rectangular
*/
public Dense(final DoubleScalar.Rel<U>[][] values) throws ValueException
{
super(checkNonEmpty(values)[0][0].getUnit());
// System.out.println("Created Dense");
initialize(values);
}
/**
* For package internal use only.
* @param values DoubleMatrix2D; the values of the entries in the new Relative Dense Immutable DoubleMatrix
* @param unit U; the unit of the new Relative Dense Immutable DoubleMatrix
*/
protected Dense(final DoubleMatrix2D values, final U unit)
{
super(unit); |
File |
Line |
org\opentrafficsim\core\value\vfloat\matrix\FloatMatrix.java |
67 |
org\opentrafficsim\core\value\vfloat\matrix\MutableFloatMatrix.java |
91 |
public abstract static class Abs<U extends Unit<U>> extends FloatMatrix<U> implements Absolute
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Absolute Immutable FloatMatrix.
* @param unit U; the unit of the new Absolute Immutable FloatMatrix
*/
protected Abs(final U unit)
{
super(unit);
// System.out.println("Created Abs");
}
/**
* @param <U> Unit
*/
public static class Dense<U extends Unit<U>> extends Abs<U> implements DenseData
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Absolute Dense Immutable FloatMatrix.
* @param values float[][]; the values of the entries in the new Absolute Dense Immutable FloatMatrix
* @param unit U; the unit of the new Absolute Dense Immutable FloatMatrix
* @throws ValueException when values is null, or is not rectangular
*/
public Dense(final float[][] values, final U unit) throws ValueException
{
super(unit);
// System.out.println("Created Dense");
initialize(values);
}
/**
* Construct a new Absolute Dense Immutable FloatMatrix.
* @param values FloatScalar.Abs<U>[][]; the values of the entries in the new Absolute Dense Immutable
* FloatMatrix
* @throws ValueException when values has zero entries, or is not rectangular
*/
public Dense(final FloatScalar.Abs<U>[][] values) throws ValueException
{
super(checkNonEmpty(values)[0][0].getUnit());
// System.out.println("Created Dense");
initialize(values);
}
/**
* For package internal use only.
* @param values FloatMatrix2D; the values of the entries in the new Absolute Dense Immutable FloatMatrix
* @param unit U; the unit of the new Absolute Dense Immutable FloatMatrix
*/
protected Dense(final FloatMatrix2D values, final U unit)
{
super(unit); |
File |
Line |
org\opentrafficsim\core\value\vfloat\matrix\FloatMatrix.java |
232 |
org\opentrafficsim\core\value\vfloat\matrix\MutableFloatMatrix.java |
518 |
public abstract static class Rel<U extends Unit<U>> extends FloatMatrix<U> implements Relative
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Relative Immutable FloatMatrix.
* @param unit U; the unit of the new Relative Immutable FloatMatrix
*/
protected Rel(final U unit)
{
super(unit);
// System.out.println("Created Rel");
}
/**
* @param <U> Unit
*/
public static class Dense<U extends Unit<U>> extends Rel<U> implements DenseData
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Relative Dense Immutable FloatMatrix.
* @param values float[][]; the values of the entries in the new Relative Dense Immutable FloatMatrix
* @param unit U; the unit of the new Relative Dense Immutable FloatMatrix
* @throws ValueException when values is null, or is not rectangular
*/
public Dense(final float[][] values, final U unit) throws ValueException
{
super(unit);
// System.out.println("Created Dense");
initialize(values);
}
/**
* Construct a new Relative Dense Immutable FloatMatrix.
* @param values FloatScalar.Rel<U>[][]; the values of the entries in the new Relative Dense Immutable
* FloatMatrix
* @throws ValueException when values has zero entries, or is not rectangular
*/
public Dense(final FloatScalar.Rel<U>[][] values) throws ValueException
{
super(checkNonEmpty(values)[0][0].getUnit());
// System.out.println("Created Dense");
initialize(values);
}
/**
* For package internal use only.
* @param values FloatMatrix2D; the values of the entries in the new Relative Dense Immutable FloatMatrix
* @param unit U; the unit of the new Relative Dense Immutable FloatMatrix
*/
protected Dense(final FloatMatrix2D values, final U unit)
{
super(unit); |
File |
Line |
org\opentrafficsim\core\network\factory\NetworkLaneParser.java |
361 |
org\opentrafficsim\core\network\factory\XmlNetworkLaneParser.java |
785 |
private Object makeId(final Class<?> clazz, final String ids) throws NetworkException
{
Object id = null;
try
{
if (String.class.isAssignableFrom(clazz))
{
id = new String(ids);
}
else if (int.class.isAssignableFrom(clazz))
{
id = Integer.valueOf(ids);
}
else if (long.class.isAssignableFrom(clazz))
{
id = Long.valueOf(ids);
}
else
{
throw new NetworkException("Parsing network. ID class " + clazz.getName() + ": cannot instantiate.");
}
}
catch (NumberFormatException nfe)
{
throw new NetworkException("Parsing network. ID class " + clazz.getName() + ": cannot instantiate number: "
+ ids, nfe);
}
return id;
} |
File |
Line |
org\opentrafficsim\core\value\vdouble\vector\DoubleVector.java |
537 |
org\opentrafficsim\core\value\vfloat\vector\FloatVector.java |
537 |
public final double zSum()
{
return this.vectorSI.zSum();
}
/** {@inheritDoc} */
@Override
public final int cardinality()
{
return this.vectorSI.cardinality();
}
/** {@inheritDoc} */
@Override
public final String toString()
{
return toString(getUnit(), false, true);
}
/**
* Print this DoubleVector with the values expressed in the specified unit.
* @param displayUnit U; the unit into which the values are converted for display
* @return String; printable string with the vector contents expressed in the specified unit
*/
public final String toString(final U displayUnit)
{
return toString(displayUnit, false, true);
}
/**
* Print this DoubleVector with optional type and unit information.
* @param verbose boolean; if true; include type info; if false; exclude type info
* @param withUnit boolean; if true; include the unit; of false; exclude the unit
* @return String; printable string with the vector contents
*/
public final String toString(final boolean verbose, final boolean withUnit)
{
return toString(getUnit(), verbose, withUnit);
}
/**
* Print this DoubleVector with the values expressed in the specified unit.
* @param displayUnit U; the unit into which the values are converted for display
* @param verbose boolean; if true; include type info; if false; exclude type info
* @param withUnit boolean; if true; include the unit; of false; exclude the unit
* @return String; printable string with the vector contents
*/
public final String toString(final U displayUnit, final boolean verbose, final boolean withUnit)
{
StringBuffer buf = new StringBuffer();
if (verbose)
{
if (this instanceof MutableDoubleVector) |
File |
Line |
org\opentrafficsim\graphs\ContourPlot.java |
142 |
org\opentrafficsim\graphs\TrajectoryPlot.java |
131 |
this.path = new ArrayList<Lane>(path); // make a copy
double[] endLengths = new double[path.size()];
double cumulativeLength = 0;
DoubleVector.Rel.Dense<LengthUnit> lengths = null;
for (int i = 0; i < path.size(); i++)
{
Lane lane = path.get(i);
lane.addSampler(this);
cumulativeLength += lane.getLength().getSI();
endLengths[i] = cumulativeLength;
}
try
{
lengths = new DoubleVector.Rel.Dense<LengthUnit>(endLengths, LengthUnit.SI);
}
catch (ValueException exception)
{
exception.printStackTrace();
}
this.cumulativeLengths = lengths;
this.xAxis = xAxis; |
File |
Line |
org\opentrafficsim\core\value\vdouble\vector\DoubleVector.java |
61 |
org\opentrafficsim\core\value\vdouble\vector\MutableDoubleVector.java |
88 |
public abstract static class Abs<U extends Unit<U>> extends DoubleVector<U> implements Absolute
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Absolute Immutable DoubleVector.
* @param unit U; the unit of the new Absolute Immutable DoubleVector
*/
protected Abs(final U unit)
{
super(unit);
// System.out.println("Created Abs");
}
/**
* @param <U> Unit
*/
public static class Dense<U extends Unit<U>> extends Abs<U> implements DenseData
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Absolute Dense Immutable DoubleVector.
* @param values double[]; the values of the entries in the new Absolute Dense Immutable DoubleVector
* @param unit U; the unit of the new Absolute Dense Immutable DoubleVector
* @throws ValueException when values is null
*/
public Dense(final double[] values, final U unit) throws ValueException
{
super(unit);
// System.out.println("Created Dense");
initialize(values);
}
/**
* Construct a new Absolute Dense Immutable DoubleVector.
* @param values DoubleScalar.Abs<U>[]; the values of the entries in the new Absolute Dense Immutable
* DoubleVector
* @throws ValueException when values has zero entries
*/
public Dense(final DoubleScalar.Abs<U>[] values) throws ValueException
{
super(checkNonEmpty(values)[0].getUnit());
// System.out.println("Created Dense");
initialize(values);
}
/**
* For package internal use only.
* @param values DoubleMatrix1D; the values of the entries in the new Absolute Dense Immutable DoubleVector
* @param unit U; the unit of the new Absolute Dense Immutable DoubleVector
*/
protected Dense(final DoubleMatrix1D values, final U unit)
{
super(unit); |
File |
Line |
org\opentrafficsim\core\value\vdouble\vector\DoubleVector.java |
226 |
org\opentrafficsim\core\value\vdouble\vector\MutableDoubleVector.java |
515 |
public abstract static class Rel<U extends Unit<U>> extends DoubleVector<U> implements Relative
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Relative Immutable DoubleVector.
* @param unit U; the unit of the new Relative Immutable DoubleVector
*/
protected Rel(final U unit)
{
super(unit);
// System.out.println("Created Rel");
}
/**
* @param <U> Unit
*/
public static class Dense<U extends Unit<U>> extends Rel<U> implements DenseData
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Relative Dense Immutable DoubleVector.
* @param values double[]; the values of the entries in the new Relative Dense Immutable DoubleVector
* @param unit U; the unit of the new Relative Dense Immutable DoubleVector
* @throws ValueException when values is null
*/
public Dense(final double[] values, final U unit) throws ValueException
{
super(unit);
// System.out.println("Created Dense");
initialize(values);
}
/**
* Construct a new Relative Dense Immutable DoubleVector.
* @param values DoubleScalar.Rel<U>[]; the values of the entries in the new Relative Dense Immutable
* DoubleVector
* @throws ValueException when values has zero entries
*/
public Dense(final DoubleScalar.Rel<U>[] values) throws ValueException
{
super(checkNonEmpty(values)[0].getUnit());
// System.out.println("Created Dense");
initialize(values);
}
/**
* For package internal use only.
* @param values DoubleMatrix1D; the values of the entries in the new Relative Dense Immutable DoubleVector
* @param unit U; the unit of the new Relative Dense Immutable DoubleVector
*/
protected Dense(final DoubleMatrix1D values, final U unit)
{
super(unit); |
File |
Line |
org\opentrafficsim\core\value\vfloat\vector\FloatVector.java |
61 |
org\opentrafficsim\core\value\vfloat\vector\MutableFloatVector.java |
88 |
public abstract static class Abs<U extends Unit<U>> extends FloatVector<U> implements Absolute
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Absolute Immutable FloatVector.
* @param unit U; the unit of the new Absolute Immutable FloatVector
*/
protected Abs(final U unit)
{
super(unit);
// System.out.println("Created Abs");
}
/**
* @param <U> Unit
*/
public static class Dense<U extends Unit<U>> extends Abs<U> implements DenseData
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Absolute Dense Immutable FloatVector.
* @param values float[]; the values of the entries in the new Absolute Dense Immutable FloatVector
* @param unit U; the unit of the new Absolute Dense Immutable FloatVector
* @throws ValueException when values is null
*/
public Dense(final float[] values, final U unit) throws ValueException
{
super(unit);
// System.out.println("Created Dense");
initialize(values);
}
/**
* Construct a new Absolute Dense Immutable FloatVector.
* @param values FloatScalar.Abs<U>[]; the values of the entries in the new Absolute Dense Immutable
* FloatVector
* @throws ValueException when values has zero entries
*/
public Dense(final FloatScalar.Abs<U>[] values) throws ValueException
{
super(checkNonEmpty(values)[0].getUnit());
// System.out.println("Created Dense");
initialize(values);
}
/**
* For package internal use only.
* @param values FloatMatrix1D; the values of the entries in the new Absolute Dense Immutable FloatVector
* @param unit U; the unit of the new Absolute Dense Immutable FloatVector
*/
protected Dense(final FloatMatrix1D values, final U unit)
{
super(unit); |
File |
Line |
org\opentrafficsim\core\value\vfloat\vector\FloatVector.java |
226 |
org\opentrafficsim\core\value\vfloat\vector\MutableFloatVector.java |
515 |
public abstract static class Rel<U extends Unit<U>> extends FloatVector<U> implements Relative
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Relative Immutable FloatVector.
* @param unit U; the unit of the new Relative Immutable FloatVector
*/
protected Rel(final U unit)
{
super(unit);
// System.out.println("Created Rel");
}
/**
* @param <U> Unit
*/
public static class Dense<U extends Unit<U>> extends Rel<U> implements DenseData
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Relative Dense Immutable FloatVector.
* @param values float[]; the values of the entries in the new Relative Dense Immutable FloatVector
* @param unit U; the unit of the new Relative Dense Immutable FloatVector
* @throws ValueException when values is null
*/
public Dense(final float[] values, final U unit) throws ValueException
{
super(unit);
// System.out.println("Created Dense");
initialize(values);
}
/**
* Construct a new Relative Dense Immutable FloatVector.
* @param values FloatScalar.Rel<U>[]; the values of the entries in the new Relative Dense Immutable
* FloatVector
* @throws ValueException when values has zero entries
*/
public Dense(final FloatScalar.Rel<U>[] values) throws ValueException
{
super(checkNonEmpty(values)[0].getUnit());
// System.out.println("Created Dense");
initialize(values);
}
/**
* For package internal use only.
* @param values FloatMatrix1D; the values of the entries in the new Relative Dense Immutable FloatVector
* @param unit U; the unit of the new Relative Dense Immutable FloatVector
*/
protected Dense(final FloatMatrix1D values, final U unit)
{
super(unit); |
File |
Line |
org\opentrafficsim\core\value\vdouble\scalar\DoubleScalar.java |
46 |
org\opentrafficsim\core\value\vdouble\scalar\MutableDoubleScalar.java |
41 |
public static class Abs<U extends Unit<U>> extends DoubleScalar<U> implements Absolute, Comparable<Abs<U>>
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Absolute Immutable DoubleScalar.
* @param value double; the value of the new Absolute Immutable DoubleScalar
* @param unit U; the unit of the new Absolute Immutable DoubleScalar
*/
public Abs(final double value, final U unit)
{
super(unit);
// System.out.println("Created Abs");
initialize(value);
}
/**
* Construct a new Absolute Immutable DoubleScalar from an existing Absolute Immutable DoubleScalar.
* @param value DoubleScalar.Abs<U>; the reference
*/
public Abs(final DoubleScalar.Abs<U> value)
{
super(value.getUnit());
// System.out.println("Created Abs");
initialize(value);
}
/**
* Construct a new Absolute Immutable DoubleScalar from an existing Absolute MutableDoubleScalar.
* @param value MutableDoubleScalar.Abs<U>; the reference
*/
public Abs(final MutableDoubleScalar.Abs<U> value)
{
super(value.getUnit());
// System.out.println("Created Abs");
initialize(value);
}
/** {@inheritDoc} */
@Override
public final MutableDoubleScalar.Abs<U> mutable()
{
return new MutableDoubleScalar.Abs<U>(this);
}
/** {@inheritDoc} */
@Override
public final int compareTo(final Abs<U> o) |
File |
Line |
org\opentrafficsim\core\value\vdouble\scalar\DoubleScalar.java |
111 |
org\opentrafficsim\core\value\vdouble\scalar\MutableDoubleScalar.java |
345 |
public static class Rel<U extends Unit<U>> extends DoubleScalar<U> implements Relative, Comparable<Rel<U>>
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Relative Immutable DoubleScalar.
* @param value double; the value of the new Relative Immutable DoubleScalar
* @param unit U; the unit of the new Relative Immutable DoubleScalar
*/
public Rel(final double value, final U unit)
{
super(unit);
// System.out.println("Created Rel");
initialize(value);
}
/**
* Construct a new Relative Immutable DoubleScalar from an existing Relative Immutable DoubleScalar.
* @param value DoubleScalar.Rel<U>; the reference
*/
public Rel(final DoubleScalar.Rel<U> value)
{
super(value.getUnit());
// System.out.println("Created Rel");
initialize(value);
}
/**
* Construct a new Relative Immutable DoubleScalar from an existing Relative MutableDoubleScalar.
* @param value MutableDoubleScalar.Rel<U>; the reference
*/
public Rel(final MutableDoubleScalar.Rel<U> value)
{
super(value.getUnit());
// System.out.println("Created Rel");
initialize(value);
}
/** {@inheritDoc} */
@Override
public final MutableDoubleScalar.Rel<U> mutable()
{
return new MutableDoubleScalar.Rel<U>(this);
}
/** {@inheritDoc} */
@Override
public final int compareTo(final Rel<U> o) |
File |
Line |
org\opentrafficsim\core\value\vfloat\scalar\FloatScalar.java |
46 |
org\opentrafficsim\core\value\vfloat\scalar\MutableFloatScalar.java |
41 |
public static class Abs<U extends Unit<U>> extends FloatScalar<U> implements Absolute, Comparable<Abs<U>>
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Absolute Immutable FloatScalar.
* @param value float; the value of the new Absolute Immutable FloatScalar
* @param unit U; the unit of the new Absolute Immutable FloatScalar
*/
public Abs(final float value, final U unit)
{
super(unit);
// System.out.println("Created Abs");
initialize(value);
}
/**
* Construct a new Absolute Immutable FloatScalar from an existing Absolute Immutable FloatScalar.
* @param value FloatScalar.Abs<U>; the reference
*/
public Abs(final FloatScalar.Abs<U> value)
{
super(value.getUnit());
// System.out.println("Created Abs");
initialize(value);
}
/**
* Construct a new Absolute Immutable FloatScalar from an existing Absolute MutableFloatScalar.
* @param value MutableFloatScalar.Abs<U>; the reference
*/
public Abs(final MutableFloatScalar.Abs<U> value)
{
super(value.getUnit());
// System.out.println("Created Abs");
initialize(value);
}
/** {@inheritDoc} */
@Override
public final MutableFloatScalar.Abs<U> mutable()
{
return new MutableFloatScalar.Abs<U>(this);
}
/** {@inheritDoc} */
@Override
public final int compareTo(final Abs<U> o) |
File |
Line |
org\opentrafficsim\core\value\vfloat\scalar\FloatScalar.java |
111 |
org\opentrafficsim\core\value\vfloat\scalar\MutableFloatScalar.java |
345 |
public static class Rel<U extends Unit<U>> extends FloatScalar<U> implements Relative, Comparable<Rel<U>>
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Relative Immutable FloatScalar.
* @param value float; the value of the new Relative Immutable FloatScalar
* @param unit U; the unit of the new Relative Immutable FloatScalar
*/
public Rel(final float value, final U unit)
{
super(unit);
// System.out.println("Created Rel");
initialize(value);
}
/**
* Construct a new Relative Immutable FloatScalar from an existing Relative Immutable FloatScalar.
* @param value FloatScalar.Rel<U>; the reference
*/
public Rel(final FloatScalar.Rel<U> value)
{
super(value.getUnit());
// System.out.println("Created Rel");
initialize(value);
}
/**
* Construct a new Relative Immutable FloatScalar from an existing Relative MutableFloatScalar.
* @param value MutableFloatScalar.Rel<U>; the reference
*/
public Rel(final MutableFloatScalar.Rel<U> value)
{
super(value.getUnit());
// System.out.println("Created Rel");
initialize(value);
}
/** {@inheritDoc} */
@Override
public final MutableFloatScalar.Rel<U> mutable()
{
return new MutableFloatScalar.Rel<U>(this);
}
/** {@inheritDoc} */
@Override
public final int compareTo(final Rel<U> o) |
File |
Line |
org\opentrafficsim\importexport\osm\output\Convert.java |
383 |
org\opentrafficsim\importexport\osm\output\Convert.java |
405 |
lt = makeLaneType(org.opentrafficsim.importexport.osm.PredefinedGTUTypes.pedestrian);
if (osmlink.getLanes() == 1 && !osmlink.isOneway())
{
la = new LaneAttributes(lt, Color.GREEN, LongitudinalDirectionality.BOTH);
structure.put(0, la);
}
for (int i = 0 - backwards; i < forwards; i++)
{
if (i < 0)
{
la = new LaneAttributes(lt, Color.GREEN, LongitudinalDirectionality.BACKWARD);
structure.put(i, la);
}
if (i >= 0)
{
la = new LaneAttributes(lt, Color.GREEN, LongitudinalDirectionality.FORWARD);
structure.put(i, la);
}
}
} |
File |
Line |
org\opentrafficsim\importexport\osm\output\Convert.java |
285 |
org\opentrafficsim\importexport\osm\output\Convert.java |
384 |
org\opentrafficsim\importexport\osm\output\Convert.java |
406 |
if (osmlink.getLanes() == 1 && !osmlink.isOneway())
{
la = new LaneAttributes(lt, Color.GREEN, LongitudinalDirectionality.BOTH);
structure.put(0, la);
}
for (int i = 0 - backwards; i < forwards; i++)
{
if (i < 0)
{
la = new LaneAttributes(lt, Color.GREEN, LongitudinalDirectionality.BACKWARD);
structure.put(i, la);
}
if (i >= 0)
{
la = new LaneAttributes(lt, Color.GREEN, LongitudinalDirectionality.FORWARD);
structure.put(i, la);
}
}
} |
File |
Line |
org\opentrafficsim\core\value\vdouble\matrix\DoubleMatrix.java |
769 |
org\opentrafficsim\core\value\vfloat\matrix\FloatMatrix.java |
769 |
throw new ValueException("Cannot determine unit for DoubleMatrix from an empty array of DoubleScalar");
}
for (int row = values.length; --row >= 1;)
{
if (values[0].length != values[row].length)
{
throw new ValueException("Lengths of rows are not all the same");
}
}
}
/**
* Check that provided row and column indices are valid.
* @param row int; the row value to check
* @param column int; the column value to check
* @throws ValueException when row or column is invalid
*/
protected final void checkIndex(final int row, final int column) throws ValueException
{
if (row < 0 || row >= rows() || column < 0 || column >= columns())
{
throw new ValueException("index out of range (valid range is 0.." + (rows() - 1) + ", 0.."
+ (columns() - 1) + ", got " + row + ", " + column + ")");
}
}
/**
* Retrieve a value in matrixSI without checking validity of the indices.
* @param row int; the row where the value must be retrieved
* @param column int; the column where the value must be retrieved
* @return double; the value stored at the indicated row and column
*/
protected final double safeGet(final int row, final int column) |
File |
Line |
org\opentrafficsim\core\value\vdouble\scalar\DoubleScalar.java |
264 |
org\opentrafficsim\core\value\vfloat\scalar\FloatScalar.java |
264 |
return (float) getSI();
}
/** {@inheritDoc} */
@Override
public final double doubleValue()
{
return getSI();
}
/** {@inheritDoc} */
@Override
public final String toString()
{
return toString(getUnit(), false, true);
}
/**
* Print this DoubleScalar with the value expressed in the specified unit.
* @param displayUnit U; the unit into which the value is converted for display
* @return String; printable string with the scalar contents expressed in the specified unit
*/
public final String toString(final U displayUnit)
{
return toString(displayUnit, false, true);
}
/**
* Print this DoubleScalar with optional type and unit information.
* @param verbose boolean; if true; include type info; if false; exclude type info
* @param withUnit boolean; if true; include the unit; of false; exclude the unit
* @return String; printable string with the scalar contents
*/
public final String toString(final boolean verbose, final boolean withUnit)
{
return toString(getUnit(), verbose, withUnit);
}
/**
* Print this DoubleScalar with the value expressed in the specified unit.
* @param displayUnit U; the unit into which the value is converted for display
* @param verbose boolean; if true; include type info; if false; exclude type info
* @param withUnit boolean; if true; include the unit; of false; exclude the unit
* @return String; printable string with the scalar contents
*/
public final String toString(final U displayUnit, final boolean verbose, final boolean withUnit)
{
StringBuffer buf = new StringBuffer();
if (verbose)
{
if (this instanceof MutableDoubleScalar) |
File |
Line |
org\opentrafficsim\core\car\LaneBasedIndividualCar.java |
116 |
org\opentrafficsim\core\car\LaneBasedTemplateCar.java |
88 |
width, maximumVelocity, simulator);
// sensor positions.
// We take the rear position of the Car to be the reference point. So the front is the length
// of the Car away from the reference point in the positive (driving) X-direction.
DoubleScalar.Rel<LengthUnit> zero = new DoubleScalar.Rel<LengthUnit>(0.0d, LengthUnit.METER);
DoubleScalar.Rel<LengthUnit> dx = new DoubleScalar.Rel<LengthUnit>(getLength().getSI(), LengthUnit.METER);
this.relativePositions
.put(RelativePosition.FRONT, new RelativePosition(dx, zero, zero, RelativePosition.FRONT));
this.relativePositions
.put(RelativePosition.REAR, new RelativePosition(zero, zero, zero, RelativePosition.REAR));
this.relativePositions.put(RelativePosition.REFERENCE, RelativePosition.REFERENCE_POSITION);
// animation
if (simulator instanceof OTSAnimatorInterface && animationClass != null) |
File |
Line |
org\opentrafficsim\core\value\vdouble\matrix\DoubleMatrix.java |
147 |
org\opentrafficsim\core\value\vdouble\matrix\MutableDoubleMatrix.java |
185 |
}
}
/**
* @param <U> Unit
*/
public static class Sparse<U extends Unit<U>> extends Abs<U> implements SparseData
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Absolute Sparse Immutable DoubleMatrix.
* @param values double[][]; the values of the entries in the new Absolute Sparse Immutable DoubleMatrix
* @param unit U; the unit of the new Absolute Sparse Immutable DoubleMatrix
* @throws ValueException when values is null, or is not rectangular
*/
public Sparse(final double[][] values, final U unit) throws ValueException
{
super(unit);
// System.out.println("Created Sparse");
initialize(values);
}
/**
* Construct a new Absolute Sparse Immutable DoubleMatrix.
* @param values DoubleScalar.Abs<U>[][]; the values of the entries in the new Absolute Sparse
* Immutable DoubleMatrix
* @throws ValueException when values has zero entries, or is not rectangular
*/
public Sparse(final DoubleScalar.Abs<U>[][] values) throws ValueException
{
super(checkNonEmpty(values)[0][0].getUnit());
// System.out.println("Created Sparse");
initialize(values);
}
/**
* For package internal use only.
* @param values DoubleMatrix2D; the values of the entries in the new Absolute Sparse Immutable DoubleMatrix
* @param unit U; the unit of the new Absolute Sparse Immutable DoubleMatrix
*/
protected Sparse(final DoubleMatrix2D values, final U unit)
{
super(unit); |
File |
Line |
org\opentrafficsim\core\value\vdouble\matrix\DoubleMatrix.java |
312 |
org\opentrafficsim\core\value\vdouble\matrix\MutableDoubleMatrix.java |
613 |
}
}
/**
* @param <U> Unit
*/
public static class Sparse<U extends Unit<U>> extends Rel<U> implements SparseData
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Relative Sparse Immutable DoubleMatrix.
* @param values double[][]; the values of the entries in the new Relative Sparse Immutable DoubleMatrix
* @param unit U; the unit of the new Relative Sparse Immutable DoubleMatrix
* @throws ValueException when values is null, or is not rectangular
*/
public Sparse(final double[][] values, final U unit) throws ValueException
{
super(unit);
// System.out.println("Created Sparse");
initialize(values);
}
/**
* Construct a new Relative Sparse Immutable DoubleMatrix.
* @param values DoubleScalar.Rel<U>[][]; the values of the entries in the new Relative Sparse
* Immutable DoubleMatrix
* @throws ValueException when values has zero entries, or is not rectangular
*/
public Sparse(final DoubleScalar.Rel<U>[][] values) throws ValueException
{
super(checkNonEmpty(values)[0][0].getUnit());
// System.out.println("Created Sparse");
initialize(values);
}
/**
* For package internal use only.
* @param values DoubleMatrix2D; the values of the entries in the new Relative Sparse Immutable DoubleMatrix
* @param unit U; the unit of the new Relative Sparse Immutable DoubleMatrix
*/
protected Sparse(final DoubleMatrix2D values, final U unit)
{
super(unit); |
File |
Line |
org\opentrafficsim\core\value\vfloat\matrix\FloatMatrix.java |
147 |
org\opentrafficsim\core\value\vfloat\matrix\MutableFloatMatrix.java |
185 |
}
}
/**
* @param <U> Unit
*/
public static class Sparse<U extends Unit<U>> extends Abs<U> implements SparseData
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Absolute Sparse Immutable FloatMatrix.
* @param values float[][]; the values of the entries in the new Absolute Sparse Immutable FloatMatrix
* @param unit U; the unit of the new Absolute Sparse Immutable FloatMatrix
* @throws ValueException when values is null, or is not rectangular
*/
public Sparse(final float[][] values, final U unit) throws ValueException
{
super(unit);
// System.out.println("Created Sparse");
initialize(values);
}
/**
* Construct a new Absolute Sparse Immutable FloatMatrix.
* @param values FloatScalar.Abs<U>[][]; the values of the entries in the new Absolute Sparse
* Immutable FloatMatrix
* @throws ValueException when values has zero entries, or is not rectangular
*/
public Sparse(final FloatScalar.Abs<U>[][] values) throws ValueException
{
super(checkNonEmpty(values)[0][0].getUnit());
// System.out.println("Created Sparse");
initialize(values);
}
/**
* For package internal use only.
* @param values FloatMatrix2D; the values of the entries in the new Absolute Sparse Immutable FloatMatrix
* @param unit U; the unit of the new Absolute Sparse Immutable FloatMatrix
*/
protected Sparse(final FloatMatrix2D values, final U unit)
{
super(unit); |
File |
Line |
org\opentrafficsim\core\value\vfloat\matrix\FloatMatrix.java |
312 |
org\opentrafficsim\core\value\vfloat\matrix\MutableFloatMatrix.java |
612 |
}
}
/**
* @param <U> Unit
*/
public static class Sparse<U extends Unit<U>> extends Rel<U> implements SparseData
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Relative Sparse Immutable FloatMatrix.
* @param values float[][]; the values of the entries in the new Relative Sparse Immutable FloatMatrix
* @param unit U; the unit of the new Relative Sparse Immutable FloatMatrix
* @throws ValueException when values is null, or is not rectangular
*/
public Sparse(final float[][] values, final U unit) throws ValueException
{
super(unit);
// System.out.println("Created Sparse");
initialize(values);
}
/**
* Construct a new Relative Sparse Immutable FloatMatrix.
* @param values FloatScalar.Rel<U>[][]; the values of the entries in the new Relative Sparse
* Immutable FloatMatrix
* @throws ValueException when values has zero entries, or is not rectangular
*/
public Sparse(final FloatScalar.Rel<U>[][] values) throws ValueException
{
super(checkNonEmpty(values)[0][0].getUnit());
// System.out.println("Created Sparse");
initialize(values);
}
/**
* For package internal use only.
* @param values FloatMatrix2D; the values of the entries in the new Relative Sparse Immutable FloatMatrix
* @param unit U; the unit of the new Relative Sparse Immutable FloatMatrix
*/
protected Sparse(final FloatMatrix2D values, final U unit)
{
super(unit); |
File |
Line |
org\opentrafficsim\core\unit\ElectricalPotentialUnit.java |
138 |
org\opentrafficsim\core\unit\ElectricalResistanceUnit.java |
120 |
final ElectricalPotentialUnit referenceUnit, final double conversionFactorToReferenceUnit)
{
super(nameKey, abbreviationKey, unitSystem, referenceUnit, conversionFactorToReferenceUnit, true);
this.massUnit = referenceUnit.getMassUnit();
this.lengthUnit = referenceUnit.getLengthUnit();
this.electricalCurrentUnit = referenceUnit.getElectricalCurrentUnit();
this.timeUnit = referenceUnit.getTimeUnit();
}
/**
* @return massUnit
*/
public final MassUnit getMassUnit()
{
return this.massUnit;
}
/**
* @return lengthUnit
*/
public final LengthUnit getLengthUnit()
{
return this.lengthUnit;
}
/**
* @return electricalCurrentUnit
*/
public final ElectricalCurrentUnit getElectricalCurrentUnit()
{
return this.electricalCurrentUnit;
}
/**
* @return timeUnit
*/
public final TimeUnit getTimeUnit()
{
return this.timeUnit;
}
/** {@inheritDoc} */
@Override
public final ElectricalPotentialUnit getStandardUnit() |
File |
Line |
org\opentrafficsim\graphs\FlowContourPlot.java |
63 |
org\opentrafficsim\graphs\SpeedContourPlot.java |
70 |
this.cumulativeLengths.add(new MutableDoubleVector.Abs.Sparse<LengthUnit>(new double[this.getYAxis()
.getBinCount()], LengthUnit.METER));
}
catch (ValueException exception)
{
exception.printStackTrace();
}
}
}
/** {@inheritDoc} */
@Override
public final void incrementBinData(final int timeBin, final int distanceBin, final double duration,
final double distanceCovered, final double acceleration)
{
if (timeBin < 0 || distanceBin < 0 || 0 == duration || distanceBin >= this.getYAxis().getBinCount())
{
return;
} |
File |
Line |
org\opentrafficsim\core\network\animation\LaneAnimation.java |
54 |
org\opentrafficsim\core\network\animation\ShoulderAnimation.java |
49 |
Geometry g = lane.getContour();
Coordinate[] coordinates = g.getCoordinates();
Path2D.Double path = new Path2D.Double();
boolean start = false;
for (Coordinate c : coordinates)
{
if (!start)
{
start = true;
path.moveTo(c.x - p.x, -c.y + p.y);
}
else
{
path.lineTo(c.x - p.x, -c.y + p.y);
}
}
path.closePath();
graphics.fill(path);
}
} |
File |
Line |
org\opentrafficsim\core\value\vdouble\vector\DoubleVector.java |
141 |
org\opentrafficsim\core\value\vdouble\vector\MutableDoubleVector.java |
182 |
}
}
/**
* @param <U> Unit
*/
public static class Sparse<U extends Unit<U>> extends Abs<U> implements SparseData
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Absolute Sparse Immutable DoubleVector.
* @param values double[]; the values of the entries in the new Absolute Sparse Immutable DoubleVector
* @param unit U; the unit of the new Absolute Sparse Immutable DoubleVector
* @throws ValueException when values is null
*/
public Sparse(final double[] values, final U unit) throws ValueException
{
super(unit);
// System.out.println("Created Sparse");
initialize(values);
}
/**
* Construct a new Absolute Sparse Immutable DoubleVector.
* @param values DoubleScalar.Abs<U>[]; the values of the entries in the new Absolute Sparse Immutable
* DoubleVector
* @throws ValueException when values has zero entries
*/
public Sparse(final DoubleScalar.Abs<U>[] values) throws ValueException
{
super(checkNonEmpty(values)[0].getUnit());
// System.out.println("Created Sparse");
initialize(values);
}
/**
* For package internal use only.
* @param values DoubleMatrix1D; the values of the entries in the new Absolute Sparse Immutable DoubleVector
* @param unit U; the unit of the new Absolute Sparse Immutable DoubleVector
*/
protected Sparse(final DoubleMatrix1D values, final U unit)
{
super(unit); |
File |
Line |
org\opentrafficsim\core\value\vdouble\vector\DoubleVector.java |
306 |
org\opentrafficsim\core\value\vdouble\vector\MutableDoubleVector.java |
609 |
}
}
/**
* @param <U> Unit
*/
public static class Sparse<U extends Unit<U>> extends Rel<U> implements SparseData
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Relative Sparse Immutable DoubleVector.
* @param values double[]; the values of the entries in the new Relative Sparse Immutable DoubleVector
* @param unit U; the unit of the new Relative Sparse Immutable DoubleVector
* @throws ValueException when values is null
*/
public Sparse(final double[] values, final U unit) throws ValueException
{
super(unit);
// System.out.println("Created Sparse");
initialize(values);
}
/**
* Construct a new Relative Sparse Immutable DoubleVector.
* @param values DoubleScalar.Rel<U>[]; the values of the entries in the new Relative Sparse Immutable
* DoubleVector
* @throws ValueException when values has zero entries
*/
public Sparse(final DoubleScalar.Rel<U>[] values) throws ValueException
{
super(checkNonEmpty(values)[0].getUnit());
// System.out.println("Created Sparse");
initialize(values);
}
/**
* For package internal use only.
* @param values DoubleMatrix1D; the values of the entries in the new Relative Sparse Immutable DoubleVector
* @param unit U; the unit of the new Relative Sparse Immutable DoubleVector
*/
protected Sparse(final DoubleMatrix1D values, final U unit)
{
super(unit); |
File |
Line |
org\opentrafficsim\core\value\vfloat\vector\FloatVector.java |
141 |
org\opentrafficsim\core\value\vfloat\vector\MutableFloatVector.java |
182 |
}
}
/**
* @param <U> Unit
*/
public static class Sparse<U extends Unit<U>> extends Abs<U> implements SparseData
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Absolute Sparse Immutable FloatVector.
* @param values float[]; the values of the entries in the new Absolute Sparse Immutable FloatVector
* @param unit U; the unit of the new Absolute Sparse Immutable FloatVector
* @throws ValueException when values is null
*/
public Sparse(final float[] values, final U unit) throws ValueException
{
super(unit);
// System.out.println("Created Sparse");
initialize(values);
}
/**
* Construct a new Absolute Sparse Immutable FloatVector.
* @param values FloatScalar.Abs<U>[]; the values of the entries in the new Absolute Sparse Immutable
* FloatVector
* @throws ValueException when values has zero entries
*/
public Sparse(final FloatScalar.Abs<U>[] values) throws ValueException
{
super(checkNonEmpty(values)[0].getUnit());
// System.out.println("Created Sparse");
initialize(values);
}
/**
* For package internal use only.
* @param values FloatMatrix1D; the values of the entries in the new Absolute Sparse Immutable FloatVector
* @param unit U; the unit of the new Absolute Sparse Immutable FloatVector
*/
protected Sparse(final FloatMatrix1D values, final U unit)
{
super(unit); |
File |
Line |
org\opentrafficsim\core\value\vfloat\vector\FloatVector.java |
306 |
org\opentrafficsim\core\value\vfloat\vector\MutableFloatVector.java |
609 |
}
}
/**
* @param <U> Unit
*/
public static class Sparse<U extends Unit<U>> extends Rel<U> implements SparseData
{
/** */
private static final long serialVersionUID = 20150309L;
/**
* Construct a new Relative Sparse Immutable FloatVector.
* @param values float[]; the values of the entries in the new Relative Sparse Immutable FloatVector
* @param unit U; the unit of the new Relative Sparse Immutable FloatVector
* @throws ValueException when values is null
*/
public Sparse(final float[] values, final U unit) throws ValueException
{
super(unit);
// System.out.println("Created Sparse");
initialize(values);
}
/**
* Construct a new Relative Sparse Immutable FloatVector.
* @param values FloatScalar.Rel<U>[]; the values of the entries in the new Relative Sparse Immutable
* FloatVector
* @throws ValueException when values has zero entries
*/
public Sparse(final FloatScalar.Rel<U>[] values) throws ValueException
{
super(checkNonEmpty(values)[0].getUnit());
// System.out.println("Created Sparse");
initialize(values);
}
/**
* For package internal use only.
* @param values FloatMatrix1D; the values of the entries in the new Relative Sparse Immutable FloatVector
* @param unit U; the unit of the new Relative Sparse Immutable FloatVector
*/
protected Sparse(final FloatMatrix1D values, final U unit)
{
super(unit); |
File |
Line |
org\opentrafficsim\core\value\vdouble\matrix\DoubleMatrix.java |
424 |
org\opentrafficsim\core\value\vfloat\matrix\FloatMatrix.java |
424 |
protected final void initialize(final double[][] values) throws ValueException
{
ensureRectangular(values);
this.matrixSI = createMatrix2D(values.length, 0 == values.length ? 0 : values[0].length);
if (getUnit().equals(getUnit().getStandardUnit()))
{
this.matrixSI.assign(values);
}
else
{
for (int row = values.length; --row >= 0;)
{
for (int column = values[row].length; --column >= 0;)
{
safeSet(row, column, expressAsSIUnit(values[row][column])); |
File |
Line |
org\opentrafficsim\core\value\vdouble\scalar\DoubleScalar.java |
271 |
org\opentrafficsim\core\value\vdouble\vector\DoubleVector.java |
546 |
org\opentrafficsim\core\value\vfloat\scalar\FloatScalar.java |
271 |
org\opentrafficsim\core\value\vfloat\vector\FloatVector.java |
546 |
return getSI();
}
/** {@inheritDoc} */
@Override
public final String toString()
{
return toString(getUnit(), false, true);
}
/**
* Print this DoubleScalar with the value expressed in the specified unit.
* @param displayUnit U; the unit into which the value is converted for display
* @return String; printable string with the scalar contents expressed in the specified unit
*/
public final String toString(final U displayUnit)
{
return toString(displayUnit, false, true);
}
/**
* Print this DoubleScalar with optional type and unit information.
* @param verbose boolean; if true; include type info; if false; exclude type info
* @param withUnit boolean; if true; include the unit; of false; exclude the unit
* @return String; printable string with the scalar contents
*/
public final String toString(final boolean verbose, final boolean withUnit)
{
return toString(getUnit(), verbose, withUnit);
}
/**
* Print this DoubleScalar with the value expressed in the specified unit.
* @param displayUnit U; the unit into which the value is converted for display
* @param verbose boolean; if true; include type info; if false; exclude type info
* @param withUnit boolean; if true; include the unit; of false; exclude the unit
* @return String; printable string with the scalar contents
*/
public final String toString(final U displayUnit, final boolean verbose, final boolean withUnit)
{
StringBuffer buf = new StringBuffer();
if (verbose)
{
if (this instanceof MutableDoubleScalar) |
File |
Line |
org\opentrafficsim\core\network\factory\XmlNetworkLaneParser.java |
953 |
org\opentrafficsim\core\network\factory\XmlNetworkLaneParser.java |
1012 |
nodeTag.angle = new DoubleScalar.Abs<AnglePlaneUnit>(angle, AnglePlaneUnit.SI);
nodeTag.coordinate = coordinate;
nodeTag.slope = new DoubleScalar.Abs<AngleSlopeUnit>(slope, AngleSlopeUnit.SI);
@SuppressWarnings("rawtypes")
Node node = makeNode(this.nodeClass, nodeTag);
linkTag.nodeTo = node;
}
else if (linkTag.nodeFrom == null)
{
Point3d coordinate =
new Point3d(linkTag.nodeTo.getLocation().getX(), linkTag.nodeTo.getLocation().getY(), linkTag.nodeTo
.getLocation().getZ());
double angle = linkTag.nodeTo.getDirection().getSI(); |
File |
Line |
org\opentrafficsim\core\unit\SICoefficients.java |
224 |
org\opentrafficsim\core\unit\SICoefficients.java |
259 |
public static SICoefficients multiply(final SICoefficients a, final SICoefficients b)
{
EnumMap<SI, Integer> coefficients = new EnumMap<SI, Integer>(SI.class);
for (SI si : a.getCoefficientsMap().keySet())
{
coefficients.put(si, a.getCoefficientsMap().get(si));
}
for (SI si : b.getCoefficientsMap().keySet())
{
if (coefficients.containsKey(si))
{
coefficients.put(si, coefficients.get(si) + b.getCoefficientsMap().get(si)); |
File |
Line |
org\opentrafficsim\core\value\vdouble\matrix\DoubleMatrix.java |
590 |
org\opentrafficsim\core\value\vdouble\scalar\DoubleScalar.java |
272 |
org\opentrafficsim\core\value\vdouble\vector\DoubleVector.java |
547 |
org\opentrafficsim\core\value\vfloat\matrix\FloatMatrix.java |
590 |
org\opentrafficsim\core\value\vfloat\scalar\FloatScalar.java |
272 |
org\opentrafficsim\core\value\vfloat\vector\FloatVector.java |
547 |
}
/** {@inheritDoc} */
@Override
public final String toString()
{
return toString(getUnit(), false, true);
}
/**
* Print this DoubleMatrix with the values expressed in the specified unit.
* @param displayUnit U; the unit into which the values are converted for display
* @return String; printable string with the matrix contents expressed in the specified unit
*/
public final String toString(final U displayUnit)
{
return toString(displayUnit, false, true);
}
/**
* Print this DoubleMatrix with optional type and unit information.
* @param verbose boolean; if true; include type info; if false; exclude type info
* @param withUnit boolean; if true; include the unit; of false; exclude the unit
* @return String; printable string with the matrix contents
*/
public final String toString(final boolean verbose, final boolean withUnit)
{
return toString(getUnit(), verbose, withUnit);
}
/**
* Print this DoubleMatrix with the values expressed in the specified unit.
* @param displayUnit U; the unit into which the values are converted for display
* @param verbose boolean; if true; include type info; if false; exclude type info
* @param withUnit boolean; if true; include the unit; of false; exclude the unit
* @return String; printable string with the matrix contents
*/
public final String toString(final U displayUnit, final boolean verbose, final boolean withUnit)
{
StringBuffer buf = new StringBuffer();
if (verbose)
{
if (this instanceof MutableDoubleMatrix) |
File |
Line |
org\opentrafficsim\core\network\factory\NetworkLaneParser.java |
99 |
org\opentrafficsim\core\network\factory\XmlNetworkLaneParser.java |
218 |
SPEED_UNITS.put("m/s", SpeedUnit.METER_PER_SECOND);
LENGTH_UNITS.put("mm", LengthUnit.MILLIMETER);
LENGTH_UNITS.put("cm", LengthUnit.CENTIMETER);
LENGTH_UNITS.put("dm", LengthUnit.DECIMETER);
LENGTH_UNITS.put("dam", LengthUnit.DEKAMETER);
LENGTH_UNITS.put("hm", LengthUnit.HECTOMETER);
LENGTH_UNITS.put("m", LengthUnit.METER);
LENGTH_UNITS.put("km", LengthUnit.KILOMETER);
LENGTH_UNITS.put("mi", LengthUnit.MILE);
LENGTH_UNITS.put("y", LengthUnit.YARD);
LENGTH_UNITS.put("ft", LengthUnit.FOOT); |
File |
Line |
org\opentrafficsim\core\value\AbstractValue.java |
33 |
org\opentrafficsim\core\value\Scalar.java |
32 |
protected AbstractValue(final U unit)
{
this.unit = unit;
}
/** {@inheritDoc} */
@Override
public final U getUnit()
{
return this.unit;
}
/** {@inheritDoc} */
@Override
public final double expressAsSIUnit(final double value)
{
return ValueUtil.expressAsSIUnit(value, this.unit);
}
/**
* Convert a value in SI standard unit into the unit of this AbstractValue.
* @param value double; the value in the standard SI unit
* @return double; the value in the unit as specified for this AbstractValue
*/
protected final double expressAsSpecifiedUnit(final double value)
{
return ValueUtil.expressAsUnit(value, this.unit);
}
/** {@inheritDoc} */
@Override
public final boolean isAbsolute()
{
return this instanceof Absolute;
}
/** {@inheritDoc} */
@Override
public final boolean isRelative()
{
return this instanceof Relative;
}
} |
File |
Line |
org\opentrafficsim\graphs\AccelerationContourPlot.java |
59 |
org\opentrafficsim\graphs\SpeedContourPlot.java |
59 |
this.cumulativeAccelerations = new ArrayList<MutableDoubleVector.Abs<AccelerationUnit>>();
}
int highestBinNeeded =
(int) Math.floor(this.getXAxis().getRelativeBin(newUpperLimit) * this.getXAxis().getCurrentGranularity()
/ this.getXAxis().getGranularities()[0]);
while (highestBinNeeded >= this.cumulativeTimes.size())
{
try
{
this.cumulativeTimes.add(new MutableDoubleVector.Abs.Sparse<TimeUnit>(new double[this.getYAxis()
.getBinCount()], TimeUnit.SECOND));
this.cumulativeAccelerations.add(new MutableDoubleVector.Abs.Sparse<AccelerationUnit>(new double[this |