15 package com.cloudera.impala.common;
17 import java.util.ArrayList;
18 import java.util.List;
20 import com.google.common.base.Joiner;
21 import com.google.common.collect.Lists;
26 public class Id<IdType
extends Id<IdType>> implements
Comparable<Id<IdType>> {
27 static protected int INVALID_ID = -1;
28 protected final int id_;
34 public boolean isValid() {
return id_ != INVALID_ID; }
35 public int asInt() {
return id_; }
39 return Integer.valueOf(id_).hashCode();
44 return Integer.toString(id_);
49 if (obj == null)
return false;
51 if (obj.getClass() != this.getClass())
return false;
52 return ((Id)obj).id_ == id_;
61 ArrayList<IdType> list =
new ArrayList<IdType>();
62 list.add((IdType)
this);
66 public static <C extends Id> String
printIds(List<C> ids) {
67 ArrayList<String> l = Lists.newArrayList();
71 return "(" + Joiner.on(
" ").join(l) +
")";
int compareTo(Id< IdType > cmp)
static< CextendsId > String printIds(List< C > ids)
boolean equals(Object obj)
ArrayList< IdType > asList()