1 /* 2 3 dsh-venn Lightweight components for venn diagrams. 4 Copyright (c) 2009-2013 held jointly by the individual authors. 5 6 This library is free software; you can redistribute it and/or modify it 7 under the terms of the GNU Lesser General Public License as published 8 by the Free Software Foundation; either version 3 of the License, or (at 9 your option) any later version. 10 11 This library is distributed in the hope that it will be useful, but WITHOUT 12 ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or 13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 License for more details. 15 16 You should have received a copy of the GNU Lesser General Public License 17 along with this library; if not, write to the Free Software Foundation, 18 Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 19 20 > http://www.fsf.org/licensing/licenses/lgpl.html 21 > http://www.opensource.org/licenses/lgpl-license.php 22 23 */ 24 package org.dishevelled.venn; 25 26 import java.awt.geom.Rectangle2D; 27 28 //import java.util.Iterator; 29 30 /** 31 * Venn diagram layout algorithm. 32 * 33 * @param <E> value type 34 * @author Michael Heuer 35 */ 36 public interface VennLayouter<E> 37 { 38 39 // let the algorithm choose the best answer 40 41 /** 42 * Layout the specified venn diagram within the specified bounding rectangle. 43 * 44 * @param model venn model, must not be null 45 * @param boundingRectangle bounding rectangle, must not be null 46 * @param performanceHint performance hint, must not be null 47 * @return the result of the layout operation 48 */ 49 VennLayout layout(VennModel<E> model, 50 Rectangle2D boundingRectangle, 51 PerformanceHint performanceHint); 52 53 // allow the caller to choose the best answer 54 55 /** 56 * Layout the specified venn diagram within the specified bounding rectangle, 57 * returning zero or more possible layouts that satisfy the specified scoring 58 * function and score predicate. 59 * 60 * @param model venn model, must not be null 61 * @param boundingRectangle bounding rectangle, must not be null 62 * @param scoringFunction scoring function, must not be null 63 * @param scorePredicate score predicate, must not be null 64 * @param performanceHint performance hint, must not be null 65 * @return zero or more possible layouts that satisfy the specified scoring 66 * function and score predicate 67 */ 68 // Iterator<VennLayout> layout(VennModel<E> model, 69 // Rectangle2D boundingRectangle, 70 // ScoringFunction scoringFunction, 71 // ScorePredicate scorePredicate, 72 // PerformanceHint performanceHint); 73 74 75 /** 76 * Scoring function. 77 */ 78 // interface ScoringFunction // or just use UnaryFunction<VennLayout,Double> ? 79 // { 80 /** 81 * Return a score for the specified venn layout. 82 * 83 * @param layout venn layout to score 84 * @return a score for the specified venn layout 85 */ 86 // double score(VennLayout layout); 87 // } 88 89 /** 90 * Score predicate. 91 */ 92 // interface ScorePredicate // or just use UnaryPredicate<Double> ? 93 // { 94 /** 95 * Return true if the specified score satisfies this predicate. 96 * 97 * @param score score to evaluate 98 * @return true if the specified score satisfies this predicate 99 */ 100 // boolean evaluate(double score); 101 // } 102 103 /** 104 * Venn diagram layout algorithm performance hint. 105 */ 106 enum PerformanceHint 107 { 108 /** Optimize for speed. */ 109 OPTIMIZE_FOR_SPEED, 110 111 /** Optimize for correctness. */ 112 OPTIMIZE_FOR_CORRECTNESS; 113 } 114 }