001: /*
002: * ====================================================================
003: * Copyright (c) 2004-2008 TMate Software Ltd. All rights reserved.
004: *
005: * This software is licensed as described in the file COPYING, which
006: * you should have received as part of this distribution. The terms
007: * are also available at http://svnkit.com/license.html
008: * If newer versions of this license are posted there, you may use a
009: * newer version instead, at your option.
010: * ====================================================================
011: */
012: package org.tmatesoft.svn.core.internal.io.fs;
013:
014: import org.tmatesoft.svn.core.SVNException;
015: import org.tmatesoft.svn.core.internal.util.SVNPathUtil;
016:
017: /**
018: * @version 1.1.1
019: * @author TMate Software Ltd.
020: */
021: public class FSParentPath {
022:
023: private FSRevisionNode myRevNode;
024:
025: private String myEntryName;
026:
027: private FSParentPath myParent;
028:
029: private FSCopyInheritance myCopyInheritance;
030:
031: public FSParentPath(FSParentPath newParentPath) {
032: myRevNode = newParentPath.myRevNode;
033: myEntryName = newParentPath.myEntryName;
034: myParent = newParentPath.myParent;
035: myCopyInheritance = newParentPath.myCopyInheritance;
036: }
037:
038: public FSParentPath(FSRevisionNode newRevNode, String newEntry,
039: FSParentPath newParentPath) {
040: myRevNode = newRevNode;
041: myEntryName = newEntry;
042: myParent = newParentPath;
043: if (newRevNode != null) {
044: myCopyInheritance = new FSCopyInheritance(
045: FSCopyInheritance.COPY_ID_INHERIT_UNKNOWN,
046: newRevNode.getCopyFromPath());
047: } else {
048: myCopyInheritance = new FSCopyInheritance(
049: FSCopyInheritance.COPY_ID_INHERIT_UNKNOWN, null);
050: }
051: }
052:
053: public FSRevisionNode getRevNode() {
054: return myRevNode;
055: }
056:
057: public void setRevNode(FSRevisionNode newRevNode) {
058: myRevNode = newRevNode;
059: }
060:
061: public String getNameEntry() {
062: return myEntryName;
063: }
064:
065: public void setNameEntry(String newNameEntry) {
066: myEntryName = newNameEntry;
067: }
068:
069: public FSParentPath getParent() {
070: return myParent;
071: }
072:
073: public int getCopyStyle() {
074: return myCopyInheritance.getStyle();
075: }
076:
077: public void setCopyStyle(int newCopyStyle) {
078: myCopyInheritance.setStyle(newCopyStyle);
079: }
080:
081: public String getCopySourcePath() {
082: return myCopyInheritance.getCopySourcePath();
083: }
084:
085: public void setCopySourcePath(String newCopyPath) {
086: myCopyInheritance.setCopySourcePath(newCopyPath);
087: }
088:
089: public void setParentPath(FSRevisionNode newRevNode,
090: String newEntry, FSParentPath newParentPath) {
091: myRevNode = newRevNode;
092: myEntryName = newEntry;
093: myParent = newParentPath;
094: myCopyInheritance = new FSCopyInheritance(
095: FSCopyInheritance.COPY_ID_INHERIT_UNKNOWN, null);
096: }
097:
098: public String getAbsPath() throws SVNException {
099: String pathSoFar = "/";
100: if (myParent != null) {
101: pathSoFar = myParent.getAbsPath();
102: }
103: return getNameEntry() != null ? SVNPathUtil.concatToAbs(
104: pathSoFar, getNameEntry()) : pathSoFar;
105: }
106:
107: }
|