Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 
 package org.apache.mahout.cf.taste.hadoop;
 
 import  org.apache.hadoop.io.WritableComparable;
 
A WritableComparable encapsulating two items.
 
 public final class ItemItemWritable implements WritableComparable<ItemItemWritable> {
 
   private long itemAID;
   private long itemBID;
 
   public ItemItemWritable() {
     // do nothing
   }
 
   public ItemItemWritable(long itemAIDlong itemBID) {
     this. = itemAID;
     this. = itemBID;
   }
 
   public long getItemAID() {
     return ;
   }
 
   public long getItemBID() {
     return ;
   }
 
   @Override
   public void write(DataOutput outthrows IOException {
     out.writeLong();
     out.writeLong();
   }
 
   @Override
   public void readFields(DataInput inthrows IOException {
      = in.readLong();
      = in.readLong();
   }
 
   public static ItemItemWritable read(DataInput inthrows IOException {
     ItemItemWritable writable = new ItemItemWritable();
     writable.readFields(in);
     return writable;
   }
 
   @Override
   public int compareTo(ItemItemWritable that) {
     if (this == that) {
       return 0;
     }
     if ( < that.getItemAID()) {
       return -1;
     } else if ( > that.getItemAID()) {
       return 1;
     } else {
       return  < that.getItemBID() ? -1 :  > that.getItemBID() ? 1 : 0;
     }
   }
 
   @Override
   public int hashCode() {
     return RandomUtils.hashLong() + 31 * RandomUtils.hashLong();
   }
 
   @Override
   public boolean equals(Object o) {
     if (o instanceof ItemItemWritable) {
       ItemItemWritable that = (ItemItemWritableo;
       return  == that.getItemAID() &&  == that.getItemBID();
     }
     return false;
   }
 
   @Override
   public String toString() {
     return  + "\t" + ;
   }
New to GrepCode? Check out our FAQ X