001/** 002 * Copyright (C) 2007 - 2016, Jens Lehmann 003 * 004 * This file is part of DL-Learner. 005 * 006 * DL-Learner is free software; you can redistribute it and/or modify 007 * it under the terms of the GNU General Public License as published by 008 * the Free Software Foundation; either version 3 of the License, or 009 * (at your option) any later version. 010 * 011 * DL-Learner is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 014 * GNU General Public License for more details. 015 * 016 * You should have received a copy of the GNU General Public License 017 * along with this program. If not, see <http://www.gnu.org/licenses/>. 018 */ 019package org.dllearner.core.ref; 020 021import java.util.ArrayList; 022import java.util.List; 023 024/** 025 * @author Lorenz Buehmann 026 * 027 */ 028public class SearchTreeNodeSimple<T> implements SearchTreeNode<T>{ 029 030 protected T data; 031 protected SearchTreeNode<T> parent; 032 protected List<SearchTreeNode<T>> children; 033 034 public SearchTreeNodeSimple(T data, SearchTreeNode<T> parent, List<SearchTreeNode<T>> children) { 035 this.data = data; 036 this.parent = parent; 037 this.children = children; 038 } 039 040 public SearchTreeNodeSimple(T data, SearchTreeNode<T> parent) { 041 this(data, parent, new ArrayList<>()); 042 } 043 044 /** 045 * @return the data 046 */ 047 @Override 048 public T getData() { 049 return data; 050 } 051 052 /* (non-Javadoc) 053 * @see org.dllearner.core.ref.SearchTreeNode#getParent() 054 */ 055 @Override 056 public SearchTreeNode<T> getParent() { 057 return parent; 058 } 059 060 /* (non-Javadoc) 061 * @see org.dllearner.core.ref.SearchTreeNode#getChildren() 062 */ 063 @Override 064 public List<SearchTreeNode<T>> getChildren() { 065 return children; 066 } 067 068 public boolean addChild(SearchTreeNode<T> child) { 069 return children.add(child); 070 } 071 072}