-
-
Save Bhargav-Rao/0986cfafb3b84dd43f331a722330429c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package in.bhargavrao.stackoverflow.natobot.filters; | |
import in.bhargavrao.stackoverflow.natobot.commands.Check; | |
import in.bhargavrao.stackoverflow.natobot.entities.NatoPost; | |
import in.bhargavrao.stackoverflow.natobot.utils.CheckUtils; | |
/** | |
* Created by bhargav.h on 12-Oct-16. | |
*/ | |
public class ReputationFilter implements Filter { | |
private NatoPost post; | |
private double value; | |
public ReputationFilter(NatoPost post) { | |
this.post = post; | |
value = 0; | |
userName = null; | |
} | |
@Override | |
public boolean filter() { | |
return true; | |
} | |
@Override | |
public double getValue() { | |
int rep = post.getReputation(); | |
if(rep < 51){ | |
return 1.0; | |
} | |
else if(rep < 1001){ | |
return 0.5; | |
} | |
else { | |
return 0.0; | |
} | |
} | |
@Override | |
public String description() { | |
return ""; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment