# Common Data Structures#

## Geometric Types#

Defined in package com.scandit.datacapture.core.geometry

`MeasureUnit`#

Specifies in what units the value has been specified (fraction, device-independent pixels, pixels).

`DIP`#

Value is measured in device-independent pixels.

`PIXEL`#

Value is measured in pixels.

`FRACTION`#

Value is measured as a fraction. Valid values range from 0 to 1. This can be used to specify values in relative coordinates with respect to a reference, e.g. the view width or height.

`SizingMode`#

An enumeration of possible ways to define a rectangular size.

`WIDTH_AND_HEIGHT`#

This value will use a SizeWithUnit to determine width and the height.

`WIDTH_AND_ASPECT_RATIO`#

This value will use a FloatWithUnit to determine the width and a float multiplier to determine the height.

`HEIGHT_AND_ASPECT_RATIO`#

This value will use a FloatWithUnit to determine the height and a float multiplier to determine the width.

`Point`#
``class Point``

`Point()`#
````Point`(`float` x,
`float` x)```

Construct a new point at position x and y.

`x`#
````float` `getX`()
```

X coordinate of the point.

`y`#
````float` `getY`()
```

Y coordinate of the point.

`equals(obj)`#
``boolean` `equals`(@Nullable Object obj)`

Indicates whether some other object is equal to this one.

`hashCode()`#
``int` `hashCode`()`

Returns a hash code value for the object.

`PointWithUnit`#
``class PointWithUnit``

`PointWithUnit()`#
````PointWithUnit`(@NonNull FloatWithUnit x,
@NonNull FloatWithUnit y)```

Construct a new point at position x and y.

`x`#
```@NonNull FloatWithUnit `getX`()
```

X coordinate of the point.

`y`#
```@NonNull FloatWithUnit `getY`()
```

Y coordinate of the point.

`equals(obj)`#
``boolean` `equals`(@Nullable Object obj)`

Indicates whether some other object is equal to this one.

`hashCode()`#
``int` `hashCode`()`

Returns a hash code value for the object.

`Rect`#
``class Rect``

`Rect()`#
````Rect`(@NonNull Point origin,
@NonNull Size2 size)```

Construct a new rectangle.

`origin`#
```@NonNull Point `getOrigin`()
```

The origin (top-left corner) of the rectangle.

`size`#
```@NonNull Size2 `getSize`()
```

The size of the rectangle.

`equals(obj)`#
``boolean` `equals`(@Nullable Object obj)`

Indicates whether some other object is equal to this one.

`hashCode()`#
``int` `hashCode`()`

Returns a hash code value for the object.

`RectWithUnit`#
``class RectWithUnit``

`RectWithUnit()`#
````RectWithUnit`(@NonNull PointWithUnit point,
@NonNull SizeWithUnit size)```

Construct a new rectangle with unit.

`origin`#
```@NonNull PointWithUnit `getOrigin`()
```

The origin (top-left corner) of the rectangle.

`size`#
```@NonNull SizeWithUnit `getSize`()
```

The size of the rectangle.

`equals(obj)`#
``boolean` `equals`(@Nullable Object obj)`

Indicates whether some other object is equal to this one.

`hashCode()`#
``int` `hashCode`()`

Returns a hash code value for the object.

`Size2`#
``class Size2``

`Size2()`#
````Size2`(`float` width,
`float` height)```

Construct a new Size2 instance.

`width`#
````float` `getWidth`()
```

The width.

`height`#
````float` `getHeight`()
```

The height.

`equals(obj)`#
``boolean` `equals`(@Nullable Object obj)`

Indicates whether some other object is equal to this one.

`hashCode()`#
``int` `hashCode`()`

Returns a hash code value for the object.

`SizeWithUnit`#
``class SizeWithUnit``

`SizeWithUnit()`#
````SizeWithUnit`(@NonNull FloatWithUnit width,
@NonNull FloatWithUnit height)```

Construct a new size with unit.

`width`#
```@NonNull FloatWithUnit `getWidth`()
```

The width.

`height`#
```@NonNull FloatWithUnit `getHeight`()
```

The height.

`equals(obj)`#
``boolean` `equals`(@Nullable Object obj)`

Indicates whether some other object is equal to this one.

`hashCode()`#
``int` `hashCode`()`

Returns a hash code value for the object.

`SizeWithAspect`#
``class SizeWithAspect``

Holds values to define a rectangular size using a dimension and an aspect ratio multiplier.

`SizeWithAspect()`#
````SizeWithAspect`(@NonNull FloatWithUnit size,
`float` aspect)```

Construct a new size with aspect.

`size`#
```@NonNull FloatWithUnit `getSize`()
```

The size of one dimension.

`aspect`#
````float` `getAspect`()
```

The aspect ratio for the other dimension.

`equals(obj)`#
``boolean` `equals`(@Nullable Object obj)`

Indicates whether some other object is equal to this one.

`hashCode()`#
``int` `hashCode`()`

Returns a hash code value for the object.

`FloatWithUnit`#
``class FloatWithUnit``

Holds a floating-point value plus a measure unit.

`FloatWithUnit()`#
````FloatWithUnit`(`float` value,
MeasureUnit unit)```

Construct a new float with unit.

`value`#
````float` `getValue`()
```

`unit`#
```MeasureUnit `getUnit`()
```

`equals(obj)`#
``boolean` `equals`(@Nullable Object obj)`

Indicates whether some other object is equal to this one.

`hashCode()`#
``int` `hashCode`()`

Returns a hash code value for the object.

`MarginsWithUnit`#
``class MarginsWithUnit``

Holds margin values (left, top, right, bottom) that can each be expressed with a different measure unit.

`MarginsWithUnit()`#
````MarginsWithUnit`(@NonNull FloatWithUnit left,
@NonNull FloatWithUnit top,
@NonNull FloatWithUnit right,
@NonNull FloatWithUnit bottom)```

Constructs a new MarginsWithUnit instance.

`left`#
```@NonNull FloatWithUnit `getLeft`()
```

Left margin.

`right`#
```@NonNull FloatWithUnit `getRight`()
```

Right margin.

`top`#
```@NonNull FloatWithUnit `getTop`()
```

Top margin.

`bottom`#
```@NonNull FloatWithUnit `getBottom`()
```

Bottom margin.

`equals(obj)`#
``boolean` `equals`(@Nullable Object obj)`

Indicates whether some other object is equal to this one.

`hashCode()`#
``int` `hashCode`()`

Returns a hash code value for the object.

`Quadrilateral`#
``class Quadrilateral``

Polygon represented by 4 corners.

`Quadrilateral()`#
````Quadrilateral`(@NonNull Point topLeft,
@NonNull Point topRight,
@NonNull Point bottomRight,
@NonNull Point bottomLeft)```

`topLeft`#
```@NonNull Point `getTopLeft`()
```

`topRight`#
```@NonNull Point `getTopRight`()
```

`bottomRight`#
```@NonNull Point `getBottomRight`()
```

`bottomLeft`#
```@NonNull Point `getBottomLeft`()
```

`equals(obj)`#
``boolean` `equals`(@Nullable Object obj)`

Indicates whether some other object is equal to this one.

`hashCode()`#
``int` `hashCode`()`

Returns a hash code value for the object.

`SizeWithUnitAndAspect`#
``class SizeWithUnitAndAspect``

Holds a SizingMode - and corresponding required values - to define a rectangular size.

`widthAndHeight`#
```@Nullable SizeWithUnit `getWidthAndHeight`()
```

The values for width and height.

Note

This value will always be null unless sizingMode is SizingMode.WIDTH_AND_HEIGHT.

`widthAndAspectRatio`#
```@Nullable SizeWithAspect `getWidthAndAspectRatio`()
```

The value for width and the aspect ratio for height.

Note

This value will always be null unless sizingMode is SizingMode.WIDTH_AND_ASPECT_RATIO.

`heightAndAspectRatio`#
```@Nullable SizeWithAspect `getHeightAndAspectRatio`()
```

The value for height and the aspect ratio for width.

Note

This value will always be null unless sizingMode is SizingMode.HEIGHT_AND_ASPECT_RATIO.

`sizingMode`#
```SizingMode `getSizingMode`()
```

The sizing mode.

`toJson()`#
`@NonNull String `toJson`()`

## Misc Types#

Defined in package com.scandit.datacapture.core.common.async

`Callback`#
``interface Callback`<`T`>`

Interface for a callback/callable accepting a generic parameter of type T.

`run(value)`#
``void` `run`(@NonNull `T` value)`

Called when the callback is invoked.

Defined in package com.scandit.datacapture.core.common.buffer

`EncodingRange`#
``class EncodingRange``

Defines the encoding of a range of bytes.

`EncodingRange()`#
````EncodingRange`(@NonNull String ianaName,
`int` startIndex,
`int` endIndex)```

Construct a new encoding range.

`ianaName`#
```@NonNull String `getIanaName`()
```

Charset encoding name as defined by IANA.

`startIndex`#
````int` `getStartIndex`()
```

Start index of this encoding range.

`endIndex`#
````int` `getEndIndex`()
```

End index (first index after the last) of this encoding range.

`equals(obj)`#
``boolean` `equals`(@Nullable Object obj)`

Indicates whether some other object is equal to this one.

`hashCode()`#
``int` `hashCode`()`

Returns a hash code value for the object.

Defined in package com.scandit.datacapture.core.time

`TimeInterval`#
``class TimeInterval``

Represents a duration/time interval.

`millis(value)`#
`static @NonNull TimeInterval `millis`(`long` value)`

Returns a new time interval from the provided duration in milliseconds.

`seconds(value)`#
`static @NonNull TimeInterval `seconds`(`float` value)`

Returns a new time interval from the provided duration in seconds.

`asSeconds()`#
``float` `asSeconds`()`

Returns the duration in seconds.

`asMillis()`#
``long` `asMillis`()`

Returns the duration in milliseconds

`equals(obj)`#
``boolean` `equals`(@Nullable Object obj)`

`hashCode()`#
``int` `hashCode`()`