/** {@inheritDoc} */ public float[] toArray() { float[] result = new float[ size() ]; float[] set = _set; byte[] states = _states; for ( int i = states.length, j = 0; i-- > 0; ) { if ( states[i] == FULL ) { result[j++] = set[i]; } } return result; }
/** {@inheritDoc} */ public boolean equals( Object other ) { if ( ! ( other instanceof TFloatSet ) ) { return false; } TFloatSet that = ( TFloatSet ) other; if ( that.size() != this.size() ) { return false; } for ( int i = _states.length; i-- > 0; ) { if ( _states[i] == FULL ) { if ( ! that.contains( _set[i] ) ) { return false; } } } return true; }
/** {@inheritDoc} */ public float[] toArray() { float[] result = new float[ size() ]; float[] set = _set; byte[] states = _states; for ( int i = states.length, j = 0; i-- > 0; ) { if ( states[i] == FULL ) { result[j++] = set[i]; } } return result; }
/** {@inheritDoc} */ public float[] toArray() { float[] result = new float[ size() ]; float[] set = _set; byte[] states = _states; for ( int i = states.length, j = 0; i-- > 0; ) { if ( states[i] == FULL ) { result[j++] = set[i]; } } return result; }
/** {@inheritDoc} */ @Override public float[] toArray() { float[] result = new float[ size() ]; float[] set = _set; byte[] states = _states; for ( int i = states.length, j = 0; i-- > 0; ) { if ( states[i] == FULL ) { result[j++] = set[i]; } } return result; }
/** {@inheritDoc} */ public boolean equals( Object other ) { if ( ! ( other instanceof TFloatSet ) ) { return false; } TFloatSet that = ( TFloatSet ) other; if ( that.size() != this.size() ) { return false; } for ( int i = _states.length; i-- > 0; ) { if ( _states[i] == FULL ) { if ( ! that.contains( _set[i] ) ) { return false; } } } return true; }
/** {@inheritDoc} */ public boolean equals( Object other ) { if ( ! ( other instanceof TFloatSet ) ) { return false; } TFloatSet that = ( TFloatSet ) other; if ( that.size() != this.size() ) { return false; } for ( int i = _states.length; i-- > 0; ) { if ( _states[i] == FULL ) { if ( ! that.contains( _set[i] ) ) { return false; } } } return true; }
@Override public double compare(final float[] h1, final float[] h2) { TFloatHashSet union = new TFloatHashSet(h1); union.addAll(h2); TFloatHashSet intersection = new TFloatHashSet(h1); intersection.retainAll(h2.clone()); //retainAll sorts the input, so we need to make a copy return 1.0 - (((double)intersection.size()) / (double)union.size()); } },
@Override public double compare(final float[] h1, final float[] h2) { TFloatHashSet union = new TFloatHashSet(h1); union.addAll(h2); TFloatHashSet intersection = new TFloatHashSet(h1); intersection.retainAll(h2.clone()); //retainAll sorts the input, so we need to make a copy return 1.0 - (((double)intersection.size()) / (double)union.size()); } },
/** {@inheritDoc} */ @Override public boolean equals( Object other ) { if ( ! ( other instanceof TFloatSet ) ) { return false; } TFloatSet that = ( TFloatSet ) other; if ( that.size() != this.size() ) { return false; } for ( int i = _states.length; i-- > 0; ) { if ( _states[i] == FULL ) { if ( ! that.contains( _set[i] ) ) { return false; } } } return true; }
/** {@inheritDoc} */ public boolean equals( Object other ) { if ( ! ( other instanceof TFloatSet ) ) { return false; } TFloatSet that = ( TFloatSet ) other; if ( that.size() != this.size() ) { return false; } for ( int i = _states.length; i-- > 0; ) { if ( _states[i] == FULL ) { if ( ! that.contains( _set[i] ) ) { return false; } } } return true; }
@Override public double compare(final SparseFloatArray h1, final SparseFloatArray h2) { float[] h1v = h1.values(); float[] h2v = h2.values(); TFloatHashSet union = new TFloatHashSet(h1v); union.addAll(h2v); if (h1v.length != h1.length || h2v.length != h2.length) union.add((float)0); TFloatHashSet intersection = new TFloatHashSet(h1v); intersection.retainAll(h2v); if (h1v.length != h1.length && h2v.length != h2.length) union.add((float)0); return 1.0 - (((double)intersection.size()) / (double)union.size()); } },
@Override public double compare(final SparseFloatArray h1, final SparseFloatArray h2) { float[] h1v = h1.values(); float[] h2v = h2.values(); TFloatHashSet union = new TFloatHashSet(h1v); union.addAll(h2v); if (h1v.length != h1.length || h2v.length != h2.length) union.add((float)0); TFloatHashSet intersection = new TFloatHashSet(h1v); intersection.retainAll(h2v); if (h1v.length != h1.length && h2v.length != h2.length) union.add((float)0); return 1.0 - (((double)intersection.size()) / (double)union.size()); } },