Something went wrong on our end
Forked from
EC504 / HW1 / hw1p1
16 commits behind the upstream repository.
-
Ari Trachtenberg authoredAri Trachtenberg authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
MyDistinctCounter.java 610 B
package edu.bu.ec504.hw1p1;
public class MyDistinctCounter extends DistinctCounter {
/**
* @inheritDoc
*/
public MyDistinctCounter(int memBits) {
super(memBits);
}
/**
* @inheritDoc
*/
@Override
void saw(String newElement) {
mem.set(Math.abs(newElement.hashCode()%(mem.len)));
}
/**
* @inheritDoc
*/
@Override
Integer numDistinct() {
return mem.bits.cardinality();
}
// NESTED CLASSES
/**
* A runtime exception indicating that a method has not yet been implemented.
*/
public static class NotYetImplemented extends RuntimeException {
}
}