test_class.file: unix4j-core/unix4j-base/src/test/java/org/unix4j/util/RelativePathBaseTest.java
test_class.identifier: RelativePathBaseTest
test_case.body: @Test
  	public void testRelativePath_3_indirectParent() {
  		final String actual = new RelativePathBase("/home/john").getRelativePathFor("/home/john/documents/important");
  		Assert.assertEquals("./documents/important", actual);
  	}
test_case.class_method_signature: RelativePathBaseTest.testRelativePath_3_indirectParent()
test_case.full_signature: @Test public void testRelativePath_3_indirectParent()
test_case.identifier: testRelativePath_3_indirectParent
test_case.invocations: getRelativePathFor assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testRelativePath_3_indirectParent()
focal_class.declarator: DEFAULT = new Settings() {
  		/**
  		 * Appends "." to {@code result} representing the base directory.
  		 */
  		@Override
  		public StringBuilder appendPathForBaseDir(StringBuilder result, File baseDir) {
  			return result.append('.');
  		}
  
  		/**
  		 * Appends "./" to {@code result} as prefix for child directories, but
  		 * only if {@code directChildOfBase==false} (no prefix for direct
  		 * children of the base directory).
  		 */
  		@Override
  		public StringBuilder appendPrefixForChildren(StringBuilder result, File baseDir, boolean directChildOfBase) {
  			if (directChildOfBase) {
  				return result;
  			}
  			return result.append("./");
  		}
  
  		/**
  		 * Appends one "../" element for every directory up to the common
  		 * ancestor ({@code n} elements where {@code n=levelsToCommonAncestor}).
  		 */
  		@Override
  		public StringBuilder appendPrefixToCommonAncestor(StringBuilder result, File baseDir, int levelsToCommonAncestor) {
  			for (int i = 0; i < levelsToCommonAncestor; i++) {
  				result.append("../");
  			}
  			return result;
  		}
  	}
focal_class.modifier: public static final
focal_class.original_string: public static final Settings DEFAULT = new Settings() {
  		/**
  		 * Appends "." to {@code result} representing the base directory.
  		 */
  		@Override
  		public StringBuilder appendPathForBaseDir(StringBuilder result, File baseDir) {
  			return result.append('.');
  		}
  
  		/**
  		 * Appends "./" to {@code result} as prefix for child directories, but
  		 * only if {@code directChildOfBase==false} (no prefix for direct
  		 * children of the base directory).
  		 */
  		@Override
  		public StringBuilder appendPrefixForChildren(StringBuilder result, File baseDir, boolean directChildOfBase) {
  			if (directChildOfBase) {
  				return result;
  			}
  			return result.append("./");
  		}
  
  		/**
  		 * Appends one "../" element for every directory up to the common
  		 * ancestor ({@code n} elements where {@code n=levelsToCommonAncestor}).
  		 */
  		@Override
  		public StringBuilder appendPrefixToCommonAncestor(StringBuilder result, File baseDir, int levelsToCommonAncestor) {
  			for (int i = 0; i < levelsToCommonAncestor; i++) {
  				result.append("../");
  			}
  			return result;
  		}
  	};
focal_class.type: Settings
focal_class.var_name: DEFAULT
focal_class.declarator: ALL_CHILDREN_WITH_DOT_PREFIX = new Settings() {
  		/**
  		 * Appends "." to {@code result} representing the base directory.
  		 */
  		@Override
  		public StringBuilder appendPathForBaseDir(StringBuilder result, File baseDir) {
  			return result.append('.');
  		}
  
  		/**
  		 * Appends "./" to {@code result} as prefix for child directories, but
  		 * only if {@code directChildOfBase==false} (no prefix for direct
  		 * children of the base directory).
  		 */
  		@Override
  		public StringBuilder appendPrefixForChildren(StringBuilder result, File baseDir, boolean directChildOfBase) {
  			return result.append("./");
  		}
  
  		/**
  		 * Appends one "../" element for every directory up to the common
  		 * ancestor ({@code n} elements where {@code n=levelsToCommonAncestor}).
  		 */
  		@Override
  		public StringBuilder appendPrefixToCommonAncestor(StringBuilder result, File baseDir, int levelsToCommonAncestor) {
  			for (int i = 0; i < levelsToCommonAncestor; i++) {
  				result.append("../");
  			}
  			return result;
  		}
  	}
focal_class.modifier: public static final
focal_class.original_string: public static final Settings ALL_CHILDREN_WITH_DOT_PREFIX = new Settings() {
  		/**
  		 * Appends "." to {@code result} representing the base directory.
  		 */
  		@Override
  		public StringBuilder appendPathForBaseDir(StringBuilder result, File baseDir) {
  			return result.append('.');
  		}
  
  		/**
  		 * Appends "./" to {@code result} as prefix for child directories, but
  		 * only if {@code directChildOfBase==false} (no prefix for direct
  		 * children of the base directory).
  		 */
  		@Override
  		public StringBuilder appendPrefixForChildren(StringBuilder result, File baseDir, boolean directChildOfBase) {
  			return result.append("./");
  		}
  
  		/**
  		 * Appends one "../" element for every directory up to the common
  		 * ancestor ({@code n} elements where {@code n=levelsToCommonAncestor}).
  		 */
  		@Override
  		public StringBuilder appendPrefixToCommonAncestor(StringBuilder result, File baseDir, int levelsToCommonAncestor) {
  			for (int i = 0; i < levelsToCommonAncestor; i++) {
  				result.append("../");
  			}
  			return result;
  		}
  	};
focal_class.type: Settings
focal_class.var_name: ALL_CHILDREN_WITH_DOT_PREFIX
focal_class.declarator: CHILDREN_WITHOUT_PREFIX = new Settings() {
  		/**
  		 * Appends "." to {@code result} representing the base directory.
  		 */
  		@Override
  		public StringBuilder appendPathForBaseDir(StringBuilder result, File baseDir) {
  			return result.append('.');
  		}
  
  		/**
  		 * Appends "./" to {@code result} as prefix for child directories, but
  		 * only if {@code directChildOfBase==false} (no prefix for direct
  		 * children of the base directory).
  		 */
  		@Override
  		public StringBuilder appendPrefixForChildren(StringBuilder result, File baseDir, boolean directChildOfBase) {
  			return result;
  		}
  
  		/**
  		 * Appends one "../" element for every directory up to the common
  		 * ancestor ({@code n} elements where {@code n=levelsToCommonAncestor}).
  		 */
  		@Override
  		public StringBuilder appendPrefixToCommonAncestor(StringBuilder result, File baseDir, int levelsToCommonAncestor) {
  			for (int i = 0; i < levelsToCommonAncestor; i++) {
  				result.append("../");
  			}
  			return result;
  		}
  	}
focal_class.modifier: public static final
focal_class.original_string: public static final Settings CHILDREN_WITHOUT_PREFIX = new Settings() {
  		/**
  		 * Appends "." to {@code result} representing the base directory.
  		 */
  		@Override
  		public StringBuilder appendPathForBaseDir(StringBuilder result, File baseDir) {
  			return result.append('.');
  		}
  
  		/**
  		 * Appends "./" to {@code result} as prefix for child directories, but
  		 * only if {@code directChildOfBase==false} (no prefix for direct
  		 * children of the base directory).
  		 */
  		@Override
  		public StringBuilder appendPrefixForChildren(StringBuilder result, File baseDir, boolean directChildOfBase) {
  			return result;
  		}
  
  		/**
  		 * Appends one "../" element for every directory up to the common
  		 * ancestor ({@code n} elements where {@code n=levelsToCommonAncestor}).
  		 */
  		@Override
  		public StringBuilder appendPrefixToCommonAncestor(StringBuilder result, File baseDir, int levelsToCommonAncestor) {
  			for (int i = 0; i < levelsToCommonAncestor; i++) {
  				result.append("../");
  			}
  			return result;
  		}
  	};
focal_class.type: Settings
focal_class.var_name: CHILDREN_WITHOUT_PREFIX
focal_class.declarator: base
focal_class.modifier: private final
focal_class.original_string: private final File base;
focal_class.type: File
focal_class.var_name: base
focal_class.declarator: settings
focal_class.modifier: private final
focal_class.original_string: private final Settings settings;
focal_class.type: Settings
focal_class.var_name: settings
focal_class.file: unix4j-core/unix4j-base/src/main/java/org/unix4j/util/RelativePathBase.java
focal_class.identifier: RelativePathBase
focal_class.class_method_signature: RelativePathBase.RelativePathBase(String base)
focal_class.full_signature: public  RelativePathBase(String base)
focal_class.identifier: RelativePathBase
focal_class.modifiers: public
focal_class.parameters: (String base)
focal_class.signature:  RelativePathBase(String base)
focal_class.class_method_signature: RelativePathBase.RelativePathBase(File base)
focal_class.full_signature: public  RelativePathBase(File base)
focal_class.identifier: RelativePathBase
focal_class.modifiers: public
focal_class.parameters: (File base)
focal_class.signature:  RelativePathBase(File base)
focal_class.class_method_signature: RelativePathBase.RelativePathBase(String base, Settings settings)
focal_class.full_signature: public  RelativePathBase(String base, Settings settings)
focal_class.identifier: RelativePathBase
focal_class.modifiers: public
focal_class.parameters: (String base, Settings settings)
focal_class.signature:  RelativePathBase(String base, Settings settings)
focal_class.class_method_signature: RelativePathBase.RelativePathBase(File base, Settings settings)
focal_class.full_signature: public  RelativePathBase(File base, Settings settings)
focal_class.identifier: RelativePathBase
focal_class.modifiers: public
focal_class.parameters: (File base, Settings settings)
focal_class.signature:  RelativePathBase(File base, Settings settings)
focal_class.class_method_signature: RelativePathBase.getBase()
focal_class.full_signature: public File getBase()
focal_class.identifier: getBase
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: File
focal_class.signature: File getBase()
focal_class.class_method_signature: RelativePathBase.getSettings()
focal_class.full_signature: public Settings getSettings()
focal_class.identifier: getSettings
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Settings
focal_class.signature: Settings getSettings()
focal_class.class_method_signature: RelativePathBase.getRelativePathFor(File file)
focal_class.full_signature: public String getRelativePathFor(File file)
focal_class.identifier: getRelativePathFor
focal_class.modifiers: public
focal_class.parameters: (File file)
focal_class.return: String
focal_class.signature: String getRelativePathFor(File file)
focal_class.class_method_signature: RelativePathBase.getRelativePathFor(String file)
focal_class.full_signature: public String getRelativePathFor(String file)
focal_class.identifier: getRelativePathFor
focal_class.modifiers: public
focal_class.parameters: (String file)
focal_class.return: String
focal_class.signature: String getRelativePathFor(String file)
focal_method.body: public String getRelativePathFor(File file) {
  		final StringBuilder path = new StringBuilder();
  		if (base.equals(file)) {
  			return settings.appendPathForBaseDir(path, file).toString();
  		}
  		if (base.equals(file.getParentFile())) {
  			return settings.appendPrefixForChildren(path, base, true).append(file.getName()).toString();
  		}
  		final List<String> baseParts = FileUtil.getPathElements(base);
  		final List<String> fileParts = FileUtil.getPathElements(file);
  
  		final int len = Math.min(baseParts.size(), fileParts.size());
  		int common = 0;
  		while (common < len && baseParts.get(common).equals(fileParts.get(common))) {
  			common++;
  		}
  		if (common == 0) {
  			return file.getAbsolutePath().replace('\\', '/');
  		}
  		if (common < baseParts.size()) {
  			settings.appendPrefixToCommonAncestor(path, base, baseParts.size() - common);
  		} else {
  			settings.appendPrefixForChildren(path, base, false);
  		}
  		for (int i = common; i < fileParts.size(); i++) {
  			path.append(fileParts.get(i)).append('/');
  		}
  		// cut off last '/' and return string
  		return path.deleteCharAt(path.length() - 1).toString();
  	}
focal_method.class_method_signature: RelativePathBase.getRelativePathFor(File file)
focal_method.full_signature: public String getRelativePathFor(File file)
focal_method.identifier: getRelativePathFor
focal_method.invocations: equals toString appendPathForBaseDir equals getParentFile toString append appendPrefixForChildren getName getPathElements getPathElements min size size equals get get replace getAbsolutePath size appendPrefixToCommonAncestor size appendPrefixForChildren size append append get toString deleteCharAt length
focal_method.modifiers: public
focal_method.parameters: (File file)
focal_method.return: String
focal_method.signature: String getRelativePathFor(File file)