/rz-srv-pathcalc/src/com/readrz/pathcalc/ProgramOptions.java

https://github.com/akuz/readrz-public · Java · 56 lines · 45 code · 11 blank · 0 comment · 0 complexity · d72c88c68ed3c3b5d27df7d6c8942646 MD5 · raw file

  1. package com.readrz.pathcalc;
  2. import me.akuz.core.gson.GsonSerializers;
  3. import com.mongodb.BasicDBObject;
  4. public final class ProgramOptions {
  5. private final BasicDBObject _dbo;
  6. private static final String _stopWordsFile = "stopWordsFile";
  7. private static final String _liveFreqMs = "liveFreqMs";
  8. private static final String _threadCount = "threadCount";
  9. private static final String _logLevel = "logLevel";
  10. public ProgramOptions(String stopWordsFile, int liveFreqMs, int threadCount, String logLevel) {
  11. _dbo = new BasicDBObject();
  12. setStopWordsFile(stopWordsFile);
  13. setLiveFreqMs(liveFreqMs);
  14. setThreadCount(threadCount);
  15. setLogLevel(logLevel);
  16. }
  17. public int getThreadCount() {
  18. return _dbo.getInt(_threadCount);
  19. }
  20. public void setThreadCount(int threadCount) {
  21. _dbo.put(_threadCount, threadCount);
  22. }
  23. public String getStopWordsFile() {
  24. return _dbo.getString(_stopWordsFile);
  25. }
  26. public void setStopWordsFile(String fileName) {
  27. _dbo.put(_stopWordsFile, fileName);
  28. }
  29. public int getLiveFreqMs() {
  30. return _dbo.getInt(_liveFreqMs);
  31. }
  32. public void setLiveFreqMs(int ms) {
  33. _dbo.put(_liveFreqMs, ms);
  34. }
  35. public String getLogLevel() {
  36. return (String)_dbo.getString(_logLevel);
  37. }
  38. public void setLogLevel(String logLevel) {
  39. _dbo.put(_logLevel, logLevel);
  40. }
  41. @Override
  42. public String toString() {
  43. return GsonSerializers.NoHtmlEscapingPretty.toJson(_dbo);
  44. }
  45. }