001 /* This file is part of the project "Hilbert II" - http://www.qedeq.org
002 *
003 * Copyright 2000-2013, Michael Meyling <mime@qedeq.org>.
004 *
005 * "Hilbert II" is free software; you can redistribute
006 * it and/or modify it under the terms of the GNU General Public
007 * License as published by the Free Software Foundation; either
008 * version 2 of the License, or (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
013 * GNU General Public License for more details.
014 */
015
016 package org.qedeq.kernel.bo.module;
017
018 import org.qedeq.base.utility.EqualsUtility;
019
020
021 /**
022 * A reference to a QEDEQ module or one of its parts.
023 *
024 * @author Michael Meyling
025 */
026 public class DefaultReference implements Reference {
027
028 /** In this node the reference is in. */
029 private final KernelNodeBo nodeCurrent;
030
031 /** To this QEDEQ module the reference points. */
032 private final KernelQedeqBo qedeqGoal;
033
034 /** Label for the external QEDEQ module the reference points to. */
035 private final String qedeqGoalLabel;
036
037 /** To this node the reference points to. */
038 private final KernelNodeBo nodeGoal;
039
040 /** Label for the node the reference points to. */
041 private final String nodeGoalLabel;
042
043 /** To this sub node label the reference points. */
044 private final String subLabel;
045
046 /** To this proof line label the reference points to. */
047 private final String proofLineLabel;
048
049 /**
050 * Constructor.
051 *
052 * @param nodeCurrent In this node the reference is in.
053 * @param qedeqGoal To this external QEDEQ module the reference points to.
054 * @param qedeqGoalLabel Label for the external QEDEQ module the reference points to.
055 * @param nodeGoal To this node the reference points to.
056 * @param nodeGoalLabel Label for the node the reference points to.
057 * @param subLabel To this sub node label the reference points.
058 * @param proofLineLabel To this proof line label the reference points to.
059 */
060 public DefaultReference(final KernelNodeBo nodeCurrent,
061 final KernelQedeqBo qedeqGoal, final String qedeqGoalLabel,
062 final KernelNodeBo nodeGoal, final String nodeGoalLabel,
063 final String subLabel, final String proofLineLabel) {
064 this.nodeCurrent = nodeCurrent;
065 this.qedeqGoal = qedeqGoal;
066 this.qedeqGoalLabel = qedeqGoalLabel;
067 this.nodeGoal = nodeGoal;
068 this.nodeGoalLabel = nodeGoalLabel;
069 this.subLabel = subLabel;
070 this.proofLineLabel = proofLineLabel;
071 }
072
073 public boolean isExternalModuleReference() {
074 return isExternal() && !isNodeReference();
075 }
076
077 public KernelQedeqBo getExternalQedeq() {
078 return qedeqGoal;
079 }
080
081 public String getExternalQedeqLabel() {
082 return qedeqGoalLabel;
083 }
084
085 public KernelNodeBo getNode() {
086 return nodeGoal;
087 }
088
089 public String getNodeLabel() {
090 return nodeGoalLabel;
091 }
092
093 public String getProofLineLabel() {
094 return proofLineLabel;
095 }
096
097 public String getSubLabel() {
098 return subLabel;
099 }
100
101 public boolean isExternal() {
102 return qedeqGoalLabel != null && qedeqGoalLabel.length() > 0;
103 }
104
105 public boolean isNodeLocalReference() {
106 return EqualsUtility.equals(nodeGoal, nodeCurrent);
107 }
108
109 public boolean isNodeReference() {
110 return nodeGoalLabel != null && nodeGoalLabel.length() > 0;
111 }
112
113 public boolean isSubReference() {
114 return subLabel != null && subLabel.length() > 0;
115 }
116
117 public boolean isProofLineReference() {
118 return proofLineLabel != null && proofLineLabel.length() > 0;
119 }
120
121 }
|