Source Code Cross Referenced for BugAspects.java in  » Code-Analyzer » findbugs » edu » umd » cs » findbugs » gui2 » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Code Analyzer » findbugs » edu.umd.cs.findbugs.gui2 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * FindBugs - Find Bugs in Java programs
003:         * Copyright (C) 2006, University of Maryland
004:         * 
005:         * This library is free software; you can redistribute it and/or
006:         * modify it under the terms of the GNU Lesser General Public
007:         * License as published by the Free Software Foundation; either
008:         * version 2.1 of the License, or (at your option) any later version.
009:         * 
010:         * This library is distributed in the hope that it will be useful,
011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013:         * Lesser General Public License for more details.
014:         * 
015:         * You should have received a copy of the GNU Lesser General Public
016:         * License along with this library; if not, write to the Free Software
017:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307, USA
018:         */
019:
020:        package edu.umd.cs.findbugs.gui2;
021:
022:        import java.util.ArrayList;
023:        import java.util.Iterator;
024:
025:        import edu.umd.cs.findbugs.filter.Matcher;
026:
027:        /**
028:         * These are the branches in our tree, each branch forms a complete query that could be sent 
029:         * to the main bugset to return all the bugs it contains
030:         * For example, a single bugAspects could be <priority,high> or it could be <priority,high>,
031:         * <designation,must fix>,<class,fishpond>,<package,default> 
032:         * 
033:         * In this implementation, <priority,high>,<designation,unclassified> is different from 
034:         * <designation,unclassified>,<priority,high>.  (I'm not talking about the fact we use the .equals 
035:         * from ArrayList, I'm talking about what a query would return, though both are true)
036:         * For a speed boost, this class could be rewritten to make these equal, BugSet could be rewritten 
037:         * to cache full queries off the main BugSet, (instead of caching each part of the query separately 
038:         * in the BugSets created) and resetData could be rewritten to work more like Swing's validate, only 
039:         * clearing data if the data is wrong.  This would save time after changing certain aspects of the tree. 
040:         * Just an idea, I wouldn't suggest it unless its absolutely necessary. -Dan
041:         * 
042:         * 
043:         * @author All of us
044:         */
045:        public class BugAspects implements  Iterable<BugAspects.SortableValue> {
046:            private static final long serialVersionUID = -5503915081879996968L;
047:            private int count = -1;
048:            private ArrayList<BugAspects.SortableValue> lst = new ArrayList<BugAspects.SortableValue>();
049:
050:            public SortableValue last() {
051:                return lst.get(lst.size() - 1);
052:            }
053:
054:            public int size() {
055:                return lst.size();
056:            }
057:
058:            @Override
059:            public String toString() {
060:                if (lst.isEmpty())
061:                    return edu.umd.cs.findbugs.L10N.getLocalString("tree.bugs",
062:                            "Bugs")
063:                            + " (" + count + ")";
064:                else {
065:                    if (count == -1)
066:                        return last().value;
067:                    else
068:                        return last().key.formatValue(last().value) + " ("
069:                                + count + ")";
070:                }
071:            }
072:
073:            /**
074:             * This is how the numbers after the branches contain the number of bugs in them, even if they aren't the final branch
075:             * @param count
076:             */
077:            public void setCount(int count) {
078:                this .count = count;
079:            }
080:
081:            public int getCount() {
082:                return count;
083:            }
084:
085:            public BugAspects() {
086:                super ();
087:            }
088:
089:            public BugAspects(BugAspects a) {
090:                lst = new ArrayList<SortableValue>(a.lst);
091:                count = a.count;
092:            }
093:
094:            public void add(SortableValue sp) {
095:                lst.add(sp);
096:            }
097:
098:            public BugAspects addToNew(SortableValue sp) {
099:                BugAspects result = new BugAspects(this );
100:                result.lst.add(sp);
101:                return result;
102:            }
103:
104:            public Matcher getMatcher() {
105:                return FilterFactory.makeAndMatcher(lst);
106:            }
107:
108:            public StackedFilterMatcher getStackedFilterMatcher() {
109:                FilterMatcher[] filters = new FilterMatcher[lst.size()];
110:                for (int i = 0; i < filters.length; i++)
111:                    filters[i] = new FilterMatcher(lst.get(i));
112:                StackedFilterMatcher sfm = new StackedFilterMatcher(filters);
113:                return sfm;
114:            }
115:
116:            public BugSet getMatchingBugs(BugSet theSet) {
117:                return theSet.getBugsMatchingFilter(this 
118:                        .getStackedFilterMatcher());
119:            }
120:
121:            static class SortableValue {
122:                final public Sortables key;
123:                final public String value;
124:
125:                public SortableValue(Sortables key, String value) {
126:                    this .key = key;
127:                    this .value = value;
128:                }
129:
130:                @Override
131:                public int hashCode() {
132:                    return key.hashCode() + value.hashCode();
133:                }
134:
135:                @Override
136:                public boolean equals(Object that) {
137:                    if (!(that instanceof  SortableValue))
138:                        return false;
139:                    SortableValue thatStringPair = ((SortableValue) that);
140:                    return this .key.equals(thatStringPair.key)
141:                            && this .value.equals(thatStringPair.value);
142:                }
143:
144:                @Override
145:                public String toString() {
146:                    return key + ":" + value;
147:                }
148:            }
149:
150:            public Iterator<SortableValue> iterator() {
151:                return lst.iterator();
152:            }
153:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.