Home | History | Annotate | Download | only in primitives
      1 /**
      2  * Copyright (c) 2008, http://www.snakeyaml.org
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *     http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 package org.yaml.snakeyaml.immutable.primitives;
     17 
     18 public class BunchOfPrimitives {
     19     private int primitiveInt;
     20     private double primitiveDouble;
     21     public boolean primitiveBoolean;
     22 
     23     public BunchOfPrimitives(int primitiveInt, double primitiveDouble, boolean primitiveBoolean) {
     24         this.primitiveInt = primitiveInt;
     25         this.primitiveDouble = primitiveDouble;
     26         this.primitiveBoolean = primitiveBoolean;
     27     }
     28 
     29     /**
     30      * The number of parameters is the same but the type is different
     31      */
     32     public BunchOfPrimitives(int i1, int i2, int i3) {
     33         this.primitiveInt = i1;
     34     }
     35 
     36     public BunchOfPrimitives(long i1, double i2, boolean i3) {
     37         this((int) i1, i2, i3);
     38     }
     39 
     40     public int getPrimitiveInt() {
     41         return primitiveInt;
     42     }
     43 
     44     public double getPrimitiveDouble() {
     45         return primitiveDouble;
     46     }
     47 
     48     @Override
     49     public boolean equals(Object obj) {
     50         if (obj instanceof BunchOfPrimitives) {
     51             BunchOfPrimitives bunch = (BunchOfPrimitives) obj;
     52             return primitiveInt == bunch.primitiveInt;
     53         } else {
     54             return false;
     55         }
     56     }
     57 
     58     @Override
     59     public int hashCode() {
     60         return primitiveInt;
     61     }
     62 
     63     @Override
     64     public String toString() {
     65         return "BunchOfPrimitives " + primitiveInt;
     66     }
     67 }
     68