# Print output for @column tags ?> OisSample - Android SDK | Android Developers

Most visited

Recently visited

OisSample

public final class OisSample
extends Object

java.lang.Object
   ↳ android.hardware.camera2.params.OisSample


Immutable class to store an optical image stabilization sample.

Summary

Public constructors

OisSample(long timestamp, float xShift, float yShift)

Create a new OisSample.

Public methods

boolean equals(Object obj)

Check if this OisSample is equal to another OisSample.

long getTimestamp()

Get the timestamp in nanoseconds.

float getXshift()

Get the shift in x direction.

float getYshift()

Get the shift in y direction.

int hashCode()

Returns a hash code value for the object.

String toString()

Return the OisSample as a string representation.

Inherited methods

Public constructors

OisSample

public OisSample (long timestamp, 
                float xShift, 
                float yShift)

Create a new OisSample.

OisSample contains the timestamp and the amount of shifts in x and y direction, in pixels, of the OIS sample.

A positive value for a shift in x direction is a shift from left to right in active array coordinate system. For example, if the optical center is (1000, 500) in active array coordinates, a shift of (3, 0) puts the new optical center at (1003, 500).

A positive value for a shift in y direction is a shift from top to bottom in active array coordinate system. For example, if the optical center is (1000, 500) in active array coordinates, a shift of (0, 5) puts the new optical center at (1000, 505).

xShift and yShift must be finite; NaN and infinity is not allowed.

Parameters
timestamp long: timestamp of the OIS sample.

xShift float: shift of the OIS sample in x direction.

yShift float: shift of the OIS sample in y direction.

Throws
IllegalArgumentException if xShift or yShift is not finite

Public methods

equals

public boolean equals (Object obj)

Check if this OisSample is equal to another OisSample.

Two samples are only equal if and only if each of the OIS information is equal.

Parameters
obj Object: the reference object with which to compare.

Returns
boolean true if the objects were equal, false otherwise

getTimestamp

public long getTimestamp ()

Get the timestamp in nanoseconds.

The timestamps are in the same timebase as and comparable to android.sensor.timestamp.

Returns
long a long value (guaranteed to be finite)

getXshift

public float getXshift ()

Get the shift in x direction.

Returns
float a floating point value (guaranteed to be finite)

getYshift

public float getYshift ()

Get the shift in y direction.

Returns
float a floating point value (guaranteed to be finite)

hashCode

public int hashCode ()

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals(java.lang.Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the Java™ programming language.)

Returns
int a hash code value for this object.

toString

public String toString ()

Return the OisSample as a string representation.

"OisSample{timestamp:%l, shift_x:%f, shift_y:%f}" represents the OIS sample's timestamp, shift in x direction, and shift in y direction.

Returns
String string representation of OisSample