16224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala/* 26224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * Copyright 2012 AndroidPlot.com 36224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * 46224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * Licensed under the Apache License, Version 2.0 (the "License"); 56224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * you may not use this file except in compliance with the License. 66224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * You may obtain a copy of the License at 76224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * 86224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * http://www.apache.org/licenses/LICENSE-2.0 96224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * 106224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * Unless required by applicable law or agreed to in writing, software 116224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * distributed under the License is distributed on an "AS IS" BASIS, 126224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 136224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * See the License for the specific language governing permissions and 146224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * limitations under the License. 156224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala */ 166224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala 176224eda509d436a575f801942337da92a6c18767Eino-Ville Talvalapackage com.androidplot.util; 186224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala 196224eda509d436a575f801942337da92a6c18767Eino-Ville Talvalaimport java.util.List; 206224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala 216224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala/** 226224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * Encapsulates the concept of z-indexable objects; Each object is stored above or below each other object and may 236224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * 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. 246224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * 256224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * Note that the method names correspond to the order of items drawn directly on top of one another using an iterator; 266224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * the first element drawn (lowest z-index) is effectively the "bottom" element. 276224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * @param286224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala */ 296224eda509d436a575f801942337da92a6c18767Eino-Ville Talvalapublic interface ZIndexable<ElementType> { 306224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala 316224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala /** 326224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * Move above all other elements 336224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * @param element 346224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * @return 356224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala */ 366224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala public boolean moveToTop(ElementType element); 376224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala 386224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala 396224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala /** 406224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * Move above the specified element 416224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * @param objectToMove 426224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * @param reference 436224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * @return 446224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala */ 456224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala public boolean moveAbove(ElementType objectToMove, ElementType reference); 466224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala 476224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala 486224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala /** 496224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * Move beneath the specified element 506224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * 516224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * @param objectToMove 526224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * @param reference 536224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * @return 546224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala */ 556224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala public boolean moveBeneath(ElementType objectToMove, ElementType reference); 566224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala 576224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala /** 586224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * Move beneath all other elements 596224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * @param key 606224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * @return 616224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala */ 626224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala public boolean moveToBottom(ElementType key); 636224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala 646224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala 656224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala /** 666224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * Move up by one element 676224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * @param key 686224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * @return 696224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala */ 706224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala public boolean moveUp(ElementType key); 716224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala 726224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala /** 736224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * Move down by one element 746224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * @param key 756224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * @return 766224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala */ 776224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala public boolean moveDown(ElementType key); 786224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala 796224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala public List<ElementType> elements(); 806224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala 816224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala 826224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala /** 836224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * Add beneath all other elements 846224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * @param element 856224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala */ 866224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala //public void addToBottom(ElementType element); 876224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala 886224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala /** 896224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * Add above all other elements 906224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala * @param element 916224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala */ 926224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala //public void addToTop(ElementType element); 936224eda509d436a575f801942337da92a6c18767Eino-Ville Talvala}