Home | History | Annotate | Download | only in util
      1 /*
      2  * Copyright 2012 AndroidPlot.com
      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 
     17 package com.androidplot.util;
     18 
     19 import java.util.List;
     20 
     21 /**
     22  * Encapsulates the concept of z-indexable objects;  Each object is stored above or below each other object and may
     23  * be moved up and down in the queue relative to other elements in the hash or absolutely to the front or back of the queue.
     24  *
     25  * Note that the method names correspond to the order of items drawn directly on top of one another using an iterator;
     26  * the first element drawn (lowest z-index) is effectively the "bottom" element.
     27  * @param 
     28  */
     29 public interface ZIndexable<ElementType> {
     30 
     31     /**
     32      * Move above all other elements
     33      * @param element
     34      * @return
     35      */
     36     public boolean moveToTop(ElementType element);
     37 
     38 
     39     /**
     40      * Move above the specified element
     41      * @param objectToMove
     42      * @param reference
     43      * @return
     44      */
     45     public boolean moveAbove(ElementType objectToMove, ElementType reference);
     46 
     47 
     48     /**
     49      * Move beneath the specified element
     50      *
     51      * @param objectToMove
     52      * @param reference
     53      * @return
     54      */
     55     public boolean moveBeneath(ElementType objectToMove, ElementType reference);
     56 
     57     /**
     58      * Move beneath all other elements
     59      * @param key
     60      * @return
     61      */
     62     public boolean moveToBottom(ElementType key);
     63 
     64 
     65     /**
     66      * Move up by one element
     67      * @param key
     68      * @return
     69      */
     70     public boolean moveUp(ElementType key);
     71 
     72     /**
     73      * Move down by one element
     74      * @param key
     75      * @return
     76      */
     77     public boolean moveDown(ElementType key);
     78 
     79     public List<ElementType> elements();
     80 
     81 
     82     /**
     83      * Add beneath all other elements
     84      * @param element
     85      */
     86     //public void addToBottom(ElementType element);
     87 
     88     /**
     89      * Add above all other elements
     90      * @param element
     91      */
     92     //public void addToTop(ElementType element);
     93 }