/*******************************************************************************
* Copyright (c) 2006, 2012 Alex Blewitt and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Alex Blewitt - initial API and implementation
*******************************************************************************/
package org.eclipse.vjet.eclipse.typespace.efs.internal;
import org.eclipse.core.runtime.IPath;
public abstract class GroupItem {
private String name;
private GroupPkgDirectoryItem parent;
protected GroupItem(String name, GroupPkgDirectoryItem parent) {
this.parent = parent;
this.name = name;
if (parent != null)
parent.addChild(this);
}
public GroupItem getItem(IPath path) {
return getItem(path, 0);
}
public GroupItem getItem(IPath path, int segment) {
if (segment == path.segmentCount()) {
return this;
} else {
GroupItem child = ((GroupPkgDirectoryItem) this).getItem(path
.segment(segment));
return child.getItem(path, ++segment);
}
}
public String getName() {
return name;
}
public GroupItem getParent() {
return parent;
}
protected GroupRootItem getRoot() {
if (parent == null) {
return (GroupRootItem) this;
} else {
return parent.getRoot();
}
}
public String toString() {
return name;
}
private Object getChildren() {
// TODO Auto-generated method stub
return null;
}
public long getLastModified() {
// TODO Auto-generated method stub
return 0;
}
}