Coverage Report - org.crosswire.common.diff.CommonMiddle
 
Classes in this File Line Coverage Branch Coverage Complexity
CommonMiddle
0%
0/34
0%
0/26
2.556
 
 1  
 /**
 2  
  * Distribution License:
 3  
  * JSword is free software; you can redistribute it and/or modify it under
 4  
  * the terms of the GNU Lesser General Public License, version 2.1 or later
 5  
  * as published by the Free Software Foundation. This program is distributed
 6  
  * in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
 7  
  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 8  
  * See the GNU Lesser General Public License for more details.
 9  
  *
 10  
  * The License is available on the internet at:
 11  
  *      http://www.gnu.org/copyleft/lgpl.html
 12  
  * or by writing to:
 13  
  *      Free Software Foundation, Inc.
 14  
  *      59 Temple Place - Suite 330
 15  
  *      Boston, MA 02111-1307, USA
 16  
  *
 17  
  * © CrossWire Bible Society, 2007 - 2016
 18  
  *
 19  
  */
 20  
 package org.crosswire.common.diff;
 21  
 
 22  
 /**
 23  
  * A CommonMiddle represents an overlap between a baseline/source text and a
 24  
  * changed/target text.
 25  
  * 
 26  
  * @see gnu.lgpl.License The GNU Lesser General Public License for details.
 27  
  * @author DM Smith
 28  
  */
 29  
 public class CommonMiddle {
 30  
     /**
 31  
      * A CommonMiddle represents an overlap between a baseline/source text and a
 32  
      * changed/target text.
 33  
      * 
 34  
      * @param sourcePrefix
 35  
      *            The text before the commonality form the source
 36  
      * @param sourceSuffix
 37  
      *            The text after the commonality form the source
 38  
      * @param targetPrefix
 39  
      *            The text before the commonality form the target
 40  
      * @param targetSuffix
 41  
      *            The text after the commonality form the target
 42  
      * @param commonality
 43  
      *            The text in common
 44  
      */
 45  0
     public CommonMiddle(String sourcePrefix, String sourceSuffix, String targetPrefix, String targetSuffix, String commonality) {
 46  0
         this.sourcePrefix = sourcePrefix;
 47  0
         this.sourceSuffix = sourceSuffix;
 48  0
         this.targetPrefix = targetPrefix;
 49  0
         this.targetSuffix = targetSuffix;
 50  0
         this.commonality = commonality;
 51  0
     }
 52  
 
 53  
     /**
 54  
      * @return the source start
 55  
      */
 56  
     public String getSourcePrefix() {
 57  0
         return sourcePrefix;
 58  
     }
 59  
 
 60  
     /**
 61  
      * @return the target start
 62  
      */
 63  
     public String getTargetPrefix() {
 64  0
         return targetPrefix;
 65  
     }
 66  
 
 67  
     /**
 68  
      * @return the commonality
 69  
      */
 70  
     public String getCommonality() {
 71  0
         return commonality;
 72  
     }
 73  
 
 74  
     /**
 75  
      * @return the source end
 76  
      */
 77  
     public String getSourceSuffix() {
 78  0
         return sourceSuffix;
 79  
     }
 80  
 
 81  
     /**
 82  
      * @return the target end
 83  
      */
 84  
     public String getTargetSuffix() {
 85  0
         return targetSuffix;
 86  
     }
 87  
 
 88  
     /*
 89  
      * (non-Javadoc)
 90  
      * 
 91  
      * @see java.lang.Object#toString()
 92  
      */
 93  
     @Override
 94  
     public String toString() {
 95  0
         StringBuilder buf = new StringBuilder();
 96  0
         buf.append(sourcePrefix);
 97  0
         buf.append(',');
 98  0
         buf.append(sourceSuffix);
 99  0
         buf.append(',');
 100  0
         buf.append(targetPrefix);
 101  0
         buf.append(',');
 102  0
         buf.append(targetSuffix);
 103  0
         buf.append(',');
 104  0
         buf.append(commonality);
 105  0
         return buf.toString();
 106  
     }
 107  
 
 108  
     /*
 109  
      * (non-Javadoc)
 110  
      * 
 111  
      * @see java.lang.Object#hashCode()
 112  
      */
 113  
     @Override
 114  
     public int hashCode() {
 115  0
         int result = 31 + ((sourcePrefix == null) ? 0 : sourcePrefix.hashCode());
 116  0
         result = 31 * result + ((sourceSuffix == null) ? 0 : sourceSuffix.hashCode());
 117  0
         result = 31 * result + ((targetPrefix == null) ? 0 : targetPrefix.hashCode());
 118  0
         result = 31 * result + ((targetSuffix == null) ? 0 : targetSuffix.hashCode());
 119  0
         return 31 * result + ((commonality == null) ? 0 : commonality.hashCode());
 120  
     }
 121  
 
 122  
     /*
 123  
      * (non-Javadoc)
 124  
      * 
 125  
      * @see java.lang.Object#equals(java.lang.Object)
 126  
      */
 127  
     @Override
 128  
     public boolean equals(Object obj) {
 129  0
         if (this == obj) {
 130  0
             return true;
 131  
         }
 132  
 
 133  0
         if (obj == null || getClass() != obj.getClass()) {
 134  0
             return false;
 135  
         }
 136  
 
 137  0
         final CommonMiddle other = (CommonMiddle) obj;
 138  
 
 139  0
         return sourcePrefix.equals(other.sourcePrefix) && sourceSuffix.equals(other.sourceSuffix) && targetPrefix.equals(other.targetPrefix)
 140  
                 && targetSuffix.equals(other.targetSuffix) && commonality.equals(other.commonality);
 141  
     }
 142  
 
 143  
     private String sourcePrefix;
 144  
     private String sourceSuffix;
 145  
     private String targetPrefix;
 146  
     private String targetSuffix;
 147  
     private String commonality;
 148  
 }