Class EditDistance.GenericArrayWrapper<T>

  • Type Parameters:
    T - generic data type.
    All Implemented Interfaces:
    EditDistance.ArrayWrapper<T[]>
    Enclosing class:
    EditDistance

    protected static class EditDistance.GenericArrayWrapper<T>
    extends java.lang.Object
    implements EditDistance.ArrayWrapper<T[]>
    Implementation of ArrayWrapper for generic objects of type T. Allows the efficient and generic comparison of objects of type T, as long as T is not a primitive data type.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private T[] mObject
      Generic array of type T to be compared.
    • Constructor Summary

      Constructors 
      Constructor Description
      GenericArrayWrapper​(T[] object)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(EditDistance.ArrayWrapper<T[]> other, int posX, int posY)
      Compares the array contained in this instance at position X with the array contained in the other array wrapper at position Y.
      int length()
      Length of array to be compared.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • mObject

        private final T[] mObject
        Generic array of type T to be compared.
    • Constructor Detail

      • GenericArrayWrapper

        public GenericArrayWrapper​(T[] object)
        Constructor.
        Parameters:
        object - generic array of type T to be compared.
    • Method Detail

      • equals

        public boolean equals​(EditDistance.ArrayWrapper<T[]> other,
                              int posX,
                              int posY)
        Compares the array contained in this instance at position X with the array contained in the other array wrapper at position Y.
        Specified by:
        equals in interface EditDistance.ArrayWrapper<T>
        Parameters:
        other - the other generic array wrapper.
        posX - position in this array to be compared.
        posY - position in the other array to be compared.
        Returns:
        true if elements in both arrays at provided positions are considered to be equal, false otherwise.