1 32 33 package com.jeantessier.commandline; 34 35 39 public class AtLeastParameterStrategy implements CountingParameterStrategy { 40 private int nbParameters; 41 private int count; 42 43 public AtLeastParameterStrategy(int nbParameters) { 44 this.nbParameters = nbParameters; 45 46 this.count = 0; 47 } 48 49 public boolean accept(String param) { 50 count++; 51 52 return true; 53 } 54 55 public boolean isSatisfied() { 56 return count >= nbParameters; 57 } 58 59 public int getNbParameters() { 60 return nbParameters; 61 } 62 63 public int getCount() { 64 return count; 65 } 66 67 public void accept(Visitor visitor) { 68 visitor.visitAtLeastParameterStrategy(this); 69 } 70 } 71 | Popular Tags |