View Javadoc
1   /*
2    * Copyright (c) 2005, The JUNG Authors
3    * All rights reserved.
4    * 
5    * This software is open-source under the BSD license; see either "license.txt"
6    * or https://github.com/jrtom/jung/blob/master/LICENSE for a description.
7    * 
8    *
9    * Created on Apr 2, 2005
10   */
11  package edu.uci.ics.jung.visualization.picking;
12  
13  import java.awt.ItemSelectable;
14  import java.util.Set;
15  
16  /**
17   * An interface for classes that keep track of the "picked" state
18   * of edges or vertices.
19   * 
20   * @author Tom Nelson
21   * @author Joshua O'Madadhain
22   */
23  public interface PickedState<T> extends PickedInfo<T>, ItemSelectable {
24      /**
25       * Marks <code>v</code> as "picked" if <code>b == true</code>,
26       * and unmarks <code>v</code> as picked if <code>b == false</code>.
27       * @param v the element to be picked/unpicked
28       * @param b true if {@code v} is to be marked as picked, false if to be marked as unpicked
29       * @return the "picked" state of <code>v</code> prior to this call
30       */
31      boolean pick(T v, boolean b);
32      
33      /**
34       * Clears the "picked" state from all elements.
35       */
36      void clear();
37      
38      /**
39       * @return all "picked" elements.
40       */
41      Set<T> getPicked();
42      
43      /** 
44       * @return <code>true</code> if <code>v</code> is currently "picked".
45       */
46      boolean isPicked(T v);
47  
48  }