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.algorithms.qtl.datastructures.impl;
020
021public class QueryTreeChange {
022        
023        public enum ChangeType{
024                REPLACE_LABEL,
025                REMOVE_NODE
026        }
027        
028        private int nodeId;
029        
030        private ChangeType type;
031        
032        private String object;
033        private String edge;
034        
035        public QueryTreeChange(int nodeId, ChangeType type){
036                this.nodeId = nodeId;
037                this.type = type;
038        }
039        
040        public int getNodeId() {
041                return nodeId;
042        }
043
044        public ChangeType getType() {
045                return type;
046        }
047        
048        public String getObject() {
049                return object;
050        }
051
052        public void setObject(String object) {
053                this.object = object;
054        }
055
056        public String getEdge() {
057                return edge;
058        }
059
060        public void setEdge(String edge) {
061                this.edge = edge;
062        }
063
064        @Override
065        public String toString() {
066//              return "nodeId" + (type==ChangeType.REPLACE_LABEL ? "Replace" : "Remove");
067                return nodeId + (type==ChangeType.REPLACE_LABEL ? "a" : "b");
068        }
069        
070        @Override
071        public boolean equals(Object obj) {
072                if(obj == this){
073                        return true;
074                }
075                if(obj == null || !(obj instanceof QueryTreeChange)){
076                        return false;
077                }
078                QueryTreeChange other = (QueryTreeChange)obj;
079                return nodeId == other.getNodeId() && type == other.getType();
080        }
081        
082        @Override
083        public int hashCode() {
084                return nodeId + type.hashCode() + 37;
085        }
086
087}