PageRenderTime 27ms CodeModel.GetById 23ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/release-0.1-rc2/hive/external/ql/src/java/org/apache/hadoop/hive/ql/exec/persistence/DCLLItem.java

#
Java | 105 lines | 37 code | 11 blank | 57 comment | 0 complexity | 11424419e5d8b612f5702e6c5c8ea7cd MD5 | raw file
  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, software
 13 * distributed under the License is distributed on an "AS IS" BASIS,
 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15 * See the License for the specific language governing permissions and
 16 * limitations under the License.
 17 */
 18
 19package org.apache.hadoop.hive.ql.exec.persistence;
 20
 21/**
 22 * Doubly circular linked list item.
 23 */
 24public class DCLLItem {
 25
 26  DCLLItem prev;
 27  DCLLItem next;
 28
 29  DCLLItem() {
 30    prev = next = this;
 31  }
 32
 33  /**
 34   * Get the next item.
 35   * 
 36   * @return the next item.
 37   */
 38  public DCLLItem getNext() {
 39    return next;
 40  }
 41
 42  /**
 43   * Get the previous item.
 44   * 
 45   * @return the previous item.
 46   */
 47  public DCLLItem getPrev() {
 48    return prev;
 49  }
 50
 51  /**
 52   * Set the next item as itm.
 53   * 
 54   * @param itm
 55   *          the item to be set as next.
 56   */
 57  public void setNext(DCLLItem itm) {
 58    next = itm;
 59  }
 60
 61  /**
 62   * Set the previous item as itm.
 63   * 
 64   * @param itm
 65   *          the item to be set as previous.
 66   */
 67  public void setPrev(DCLLItem itm) {
 68    prev = itm;
 69  }
 70
 71  /**
 72   * Remove the current item from the doubly circular linked list.
 73   */
 74  public void remove() {
 75    next.prev = prev;
 76    prev.next = next;
 77    prev = next = null;
 78  }
 79
 80  /**
 81   * Add v as the previous of the current list item.
 82   * 
 83   * @param v
 84   *          inserted item.
 85   */
 86  public void insertBefore(DCLLItem v) {
 87    prev.next = v;
 88    v.prev = prev;
 89    v.next = this;
 90    prev = v;
 91  }
 92
 93  /**
 94   * Add v as the previous of the current list item.
 95   * 
 96   * @param v
 97   *          inserted item.
 98   */
 99  public void insertAfter(DCLLItem v) {
100    next.prev = v;
101    v.next = next;
102    v.prev = this;
103    next = v;
104  }
105}