Coverage Report - org.apache.johnzon.core.JsonLocationImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
JsonLocationImpl
70%
14/20
50%
6/12
2
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements. See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership. The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License. You may obtain a copy of the License at
 9  
  *
 10  
  * http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing,
 13  
  * software distributed under the License is distributed on an
 14  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 15  
  * KIND, either express or implied. See the License for the
 16  
  * specific language governing permissions and limitations
 17  
  * under the License.
 18  
  */
 19  
 package org.apache.johnzon.core;
 20  
 
 21  
 import java.io.Serializable;
 22  
 
 23  
 import javax.json.stream.JsonLocation;
 24  
 
 25  
 final class JsonLocationImpl implements JsonLocation, Serializable {
 26  
     
 27  1
     public static final JsonLocation UNKNOWN_LOCATION = new JsonLocationImpl(-1, -1, -1);
 28  
     
 29  
     private final long lineNumber;
 30  
     private final long columnNumber;
 31  
     private final long streamOffset;
 32  
 
 33  1936
     JsonLocationImpl(final long lineNumber, final long columnNumber, final long streamOffset) {
 34  1936
         this.lineNumber = lineNumber;
 35  1936
         this.columnNumber = columnNumber;
 36  1936
         this.streamOffset = streamOffset;
 37  1936
     }
 38  
 
 39  
     @Override
 40  
     public long getLineNumber() {
 41  28
         return lineNumber;
 42  
     }
 43  
 
 44  
     @Override
 45  
     public long getColumnNumber() {
 46  28
         return columnNumber;
 47  
     }
 48  
 
 49  
     @Override
 50  
     public long getStreamOffset() {
 51  28
         return streamOffset;
 52  
     }
 53  
 
 54  
     @Override
 55  
     public boolean equals(final Object o) {
 56  912
         if (this == o) {
 57  0
             return true;
 58  
         }
 59  912
         if (o == null || getClass() != o.getClass()) {
 60  0
             return false;
 61  
         }
 62  
 
 63  912
         final JsonLocationImpl that = JsonLocationImpl.class.cast(o);
 64  912
         return columnNumber == that.columnNumber && lineNumber == that.lineNumber && streamOffset == that.streamOffset;
 65  
 
 66  
     }
 67  
 
 68  
     @Override
 69  
     public int hashCode() {
 70  0
         int result = (int) (lineNumber ^ (lineNumber >>> 32));
 71  0
         result = 31 * result + (int) (columnNumber ^ (columnNumber >>> 32));
 72  0
         result = 31 * result + (int) (streamOffset ^ (streamOffset >>> 32));
 73  0
         return result;
 74  
     }
 75  
 
 76  
     @Override
 77  
     public String toString() {
 78  100
         return "[lineNumber=" + lineNumber + ", columnNumber=" + columnNumber + ", streamOffset=" + streamOffset + "]";
 79  
     }
 80  
 }