< prev index next >

src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramViewModel.java

Print this page


   1 /*
   2  * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 428         return inputGraph;
 429     }
 430 
 431     @Override
 432     public void changed(RangeSliderModel source) {
 433         inputGraph = null;
 434         diagramChanged();
 435     }
 436 
 437     void setSelectedFigures(List<Figure> list) {
 438         Set<Integer> newSelectedNodes = new HashSet<>();
 439         for (Figure f : list) {
 440             newSelectedNodes.addAll(f.getSource().getSourceNodesAsSet());
 441         }
 442         this.setSelectedNodes(newSelectedNodes);
 443     }
 444 
 445     void close() {
 446         filterChain.getChangedEvent().removeListener(filterChainChangedListener);
 447         sequenceFilterChain.getChangedEvent().removeListener(filterChainChangedListener);
 448 }











































 449 }
   1 /*
   2  * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 428         return inputGraph;
 429     }
 430 
 431     @Override
 432     public void changed(RangeSliderModel source) {
 433         inputGraph = null;
 434         diagramChanged();
 435     }
 436 
 437     void setSelectedFigures(List<Figure> list) {
 438         Set<Integer> newSelectedNodes = new HashSet<>();
 439         for (Figure f : list) {
 440             newSelectedNodes.addAll(f.getSource().getSourceNodesAsSet());
 441         }
 442         this.setSelectedNodes(newSelectedNodes);
 443     }
 444 
 445     void close() {
 446         filterChain.getChangedEvent().removeListener(filterChainChangedListener);
 447         sequenceFilterChain.getChangedEvent().removeListener(filterChainChangedListener);
 448     }
 449 
 450     Iterable<InputGraph> getGraphsForward() {
 451         return new Iterable<InputGraph>() {
 452 
 453             @Override
 454             public Iterator<InputGraph> iterator() {
 455                 return new Iterator<InputGraph>() {
 456                     int index = getFirstPosition();
 457 
 458                     @Override
 459                     public boolean hasNext() {
 460                         return index + 1 < graphs.size();
 461                     }
 462 
 463                     @Override
 464                     public InputGraph next() {
 465                         return graphs.get(++index);
 466                     }
 467                 };
 468             }
 469         };
 470     }
 471 
 472     Iterable<InputGraph> getGraphsBackward() {
 473         return new Iterable<InputGraph>() {
 474             @Override
 475             public Iterator<InputGraph> iterator() {
 476                 return new Iterator<InputGraph>() {
 477                     int index = getFirstPosition();
 478 
 479                     @Override
 480                     public boolean hasNext() {
 481                         return index - 1 > 0;
 482                     }
 483 
 484                     @Override
 485                     public InputGraph next() {
 486                         return graphs.get(--index);
 487                     }
 488                 };
 489             }
 490         };
 491     }
 492 }
< prev index next >