test_class.file: harahachibu/src/test/java/uk/co/flax/harahachibu/services/DiskSpaceThresholdTest.java
test_class.identifier: DiskSpaceThresholdTest
test_case.body: @Test(expected=uk.co.flax.harahachibu.services.DiskSpaceCheckerException.class)
  	public void throwsExceptionForBadString() throws Exception {
  		DiskSpaceThreshold.parse("abcd");
  	}
test_case.class_method_signature: DiskSpaceThresholdTest.throwsExceptionForBadString()
test_case.full_signature: @Test(expected=uk.co.flax.harahachibu.services.DiskSpaceCheckerException.class) public void throwsExceptionForBadString()
test_case.identifier: throwsExceptionForBadString
test_case.invocations: parse
test_case.modifiers: @Test(expected=uk.co.flax.harahachibu.services.DiskSpaceCheckerException.class) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void throwsExceptionForBadString()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(DiskSpaceThreshold.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(DiskSpaceThreshold.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: THRESHOLD_PATTERN = Pattern.compile("^(\\d+)\\s*([KMG%])?$", Pattern.CASE_INSENSITIVE)
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern THRESHOLD_PATTERN = Pattern.compile("^(\\d+)\\s*([KMG%])?$", Pattern.CASE_INSENSITIVE);
focal_class.type: Pattern
focal_class.var_name: THRESHOLD_PATTERN
focal_class.declarator: KILOBYTE = 1024
focal_class.modifier: private static final
focal_class.original_string: private static final int KILOBYTE = 1024;
focal_class.type: int
focal_class.var_name: KILOBYTE
focal_class.declarator: thresholdValue
focal_class.modifier: private
focal_class.original_string: private long thresholdValue;
focal_class.type: long
focal_class.var_name: thresholdValue
focal_class.declarator: percentage
focal_class.modifier: private
focal_class.original_string: private boolean percentage;
focal_class.type: boolean
focal_class.var_name: percentage
focal_class.file: harahachibu/src/main/java/uk/co/flax/harahachibu/services/DiskSpaceThreshold.java
focal_class.identifier: DiskSpaceThreshold
focal_class.class_method_signature: DiskSpaceThreshold.DiskSpaceThreshold(final long threshold, final boolean isPercentage)
focal_class.full_signature:   DiskSpaceThreshold(final long threshold, final boolean isPercentage)
focal_class.identifier: DiskSpaceThreshold
focal_class.parameters: (final long threshold, final boolean isPercentage)
focal_class.signature:  DiskSpaceThreshold(final long threshold, final boolean isPercentage)
focal_class.class_method_signature: DiskSpaceThreshold.parse(String thresholdString)
focal_class.full_signature: public static DiskSpaceThreshold parse(String thresholdString)
focal_class.identifier: parse
focal_class.modifiers: public static
focal_class.parameters: (String thresholdString)
focal_class.return: DiskSpaceThreshold
focal_class.signature: DiskSpaceThreshold parse(String thresholdString)
focal_class.class_method_signature: DiskSpaceThreshold.getThresholdValue()
focal_class.full_signature: public long getThresholdValue()
focal_class.identifier: getThresholdValue
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: long
focal_class.signature: long getThresholdValue()
focal_class.class_method_signature: DiskSpaceThreshold.isPercentage()
focal_class.full_signature: public boolean isPercentage()
focal_class.identifier: isPercentage
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isPercentage()
focal_class.class_method_signature: DiskSpaceThreshold.withinThreshold(DiskSpace diskSpace)
focal_class.full_signature: public boolean withinThreshold(DiskSpace diskSpace)
focal_class.identifier: withinThreshold
focal_class.modifiers: public
focal_class.parameters: (DiskSpace diskSpace)
focal_class.return: boolean
focal_class.signature: boolean withinThreshold(DiskSpace diskSpace)
focal_class.class_method_signature: DiskSpaceThreshold.withinThreshold(long freeSpace, long maxSpace)
focal_class.full_signature: public boolean withinThreshold(long freeSpace, long maxSpace)
focal_class.identifier: withinThreshold
focal_class.modifiers: public
focal_class.parameters: (long freeSpace, long maxSpace)
focal_class.return: boolean
focal_class.signature: boolean withinThreshold(long freeSpace, long maxSpace)
focal_method.body: public static DiskSpaceThreshold parse(String thresholdString) throws DiskSpaceCheckerException {
  		if (thresholdString.startsWith("-")) {
  			throw new DiskSpaceCheckerException("Negative threshold string not allowed: " + thresholdString);
  		}
  
  		Matcher m = THRESHOLD_PATTERN.matcher(thresholdString);
  		if (!m.matches()) {
  			throw new DiskSpaceCheckerException("Cannot parse threshold string " + thresholdString);
  		}
  
  		DiskSpaceThreshold t;
  
  		long value = Long.valueOf(m.group(1));
  		if (StringUtils.isBlank(m.group(2))) {
  			t = new DiskSpaceThreshold(value, false);
  		} else {
  			String unit = m.group(2).toUpperCase();
  
  			switch (unit) {
  				case "%":
  					if (value > 100) {
  						throw new DiskSpaceCheckerException("Percentage value higher than 100%: " + thresholdString);
  					} else {
  						t = new DiskSpaceThreshold(value, true);
  					}
  					break;
  				case "G":
  					value = value * KILOBYTE;
  					// FALL THROUGH
  				case "M":
  					value = value * KILOBYTE;
  					// FALL THROUGH
  				case "K":
  					value = value * KILOBYTE;
  					t = new DiskSpaceThreshold(value, false);
  					break;
  				default:
  					throw new DiskSpaceCheckerException("Unexpected unit value: " + unit);
  			}
  		}
  
  		return t;
  	}
focal_method.class_method_signature: DiskSpaceThreshold.parse(String thresholdString)
focal_method.full_signature: public static DiskSpaceThreshold parse(String thresholdString)
focal_method.identifier: parse
focal_method.invocations: startsWith matcher matches valueOf group isBlank group toUpperCase group
focal_method.modifiers: public static
focal_method.parameters: (String thresholdString)
focal_method.return: DiskSpaceThreshold
focal_method.signature: DiskSpaceThreshold parse(String thresholdString)