Source Code Cross Referenced for SootAttribute.java in  » Code-Analyzer » soot » ca » mcgill » sable » soot » attributes » 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 » soot » ca.mcgill.sable.soot.attributes 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Soot - a J*va Optimization Framework
002:         * Copyright (C) 2003 Jennifer Lhotak
003:         *
004:         * This library is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU Lesser General Public
006:         * License as published by the Free Software Foundation; either
007:         * version 2.1 of the License, or (at your option) any later version.
008:         *
009:         * This library is distributed in the hope that it will be useful,
010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:         * Lesser General Public License for more details.
013:         *
014:         * You should have received a copy of the GNU Lesser General Public
015:         * License along with this library; if not, write to the
016:         * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
017:         * Boston, MA 02111-1307, USA.
018:         */
019:
020:        package ca.mcgill.sable.soot.attributes;
021:
022:        import java.util.*;
023:
024:        public class SootAttribute {
025:
026:            private int javaEndLn;
027:            private int javaStartLn;
028:            private int jimpleEndLn;
029:            private int jimpleStartLn;
030:            private int jimpleStartPos;
031:            private int jimpleEndPos;
032:            private int javaStartPos;
033:            private int javaEndPos;
034:
035:            private ArrayList colorList;
036:            private ArrayList textList;
037:
038:            private ArrayList linkList;
039:
040:            private int jimpleLength;
041:            private int javaLength;
042:
043:            public ArrayList getAnalysisTypes() {
044:                ArrayList types = new ArrayList();
045:                if (getTextList() != null) {
046:                    Iterator it = getTextList().iterator();
047:                    while (it.hasNext()) {
048:                        TextAttribute ta = (TextAttribute) it.next();
049:                        if (!types.contains(ta.getType())) {
050:                            types.add(ta.getType());
051:                        }
052:                    }
053:                }
054:                if (getLinkList() != null) {
055:                    Iterator lit = getLinkList().iterator();
056:                    while (lit.hasNext()) {
057:                        LinkAttribute la = (LinkAttribute) lit.next();
058:                        if (!types.contains(la.getType())) {
059:                            types.add(la.getType());
060:                        }
061:                    }
062:                }
063:
064:                if (getColorList() != null) {
065:                    Iterator cit = getColorList().iterator();
066:                    while (cit.hasNext()) {
067:                        ColorAttribute ca = (ColorAttribute) cit.next();
068:                        if (!types.contains(ca.type())) {
069:                            types.add(ca.type());
070:                        }
071:                    }
072:                }
073:                return types;
074:            }
075:
076:            public void addColorAttr(ColorAttribute color) {
077:                if (getColorList() == null) {
078:                    setColorList(new ArrayList());
079:                }
080:                getColorList().add(color);
081:
082:            }
083:
084:            private static final String NEWLINE = "\n";
085:
086:            public void addLinkAttr(LinkAttribute link) {
087:                if (getLinkList() == null) {
088:                    setLinkList(new ArrayList());
089:                }
090:                getLinkList().add(link);
091:                TextAttribute ta = new TextAttribute();
092:                ta.setInfo(link.getLabel());
093:                ta.setType(link.getType());
094:                addTextAttr(ta);
095:            }
096:
097:            public ArrayList getAllLinkAttrs() {
098:                return getLinkList();
099:            }
100:
101:            public void addTextAttr(TextAttribute text) {
102:                if (getTextList() == null) {
103:                    setTextList(new ArrayList());
104:                }
105:                text.setInfo(formatText(text.getInfo()));
106:                getTextList().add(text);
107:            }
108:
109:            public String formatText(String text) {
110:                text = text.replaceAll("&lt;", "<");
111:                text = text.replaceAll("&gt;", ">");
112:                text = text.replaceAll("&amp;", "&");
113:                return text;
114:            }
115:
116:            public StringBuffer getAllTextAttrs(String lineSep) {
117:                StringBuffer sb = new StringBuffer();
118:                if (getTextList() != null) {
119:                    Iterator it = getTextList().iterator();
120:                    while (it.hasNext()) {
121:                        TextAttribute ta = (TextAttribute) it.next();
122:                        String next = ta.getInfo();
123:                        if (lineSep.equals("<br>")) {
124:                            // implies java tooltip
125:                            next = convertHTMLTags(next);
126:                        }
127:                        sb.append(next);
128:                        sb.append(lineSep);
129:                    }
130:                }
131:                return sb;
132:            }
133:
134:            public StringBuffer getTextAttrsForType(String lineSep, String type) {
135:                StringBuffer sb = new StringBuffer();
136:
137:                if (getTextList() != null) {
138:                    Iterator it = getTextList().iterator();
139:                    while (it.hasNext()) {
140:                        TextAttribute ta = (TextAttribute) it.next();
141:                        if (ta.getType().equals(type)) {
142:                            String next = ta.getInfo();
143:                            if (lineSep.equals("<br>")) {
144:                                // implies java tooltip
145:                                next = convertHTMLTags(next);
146:                            }
147:                            sb.append(next);
148:                            sb.append(lineSep);
149:                        }
150:                    }
151:                }
152:                return sb;
153:            }
154:
155:            public String convertHTMLTags(String next) {
156:                if (next == null)
157:                    return null;
158:                else {
159:                    next = next.replaceAll("<", "&lt;");
160:                    next = next.replaceAll(">", "&gt;");
161:                    return next;
162:                }
163:            }
164:
165:            // these two are maybe not accurate maybe
166:            // need to check if ln in question is between
167:            // the start and end ln's
168:            public boolean attrForJimpleLn(int jimple_ln) {
169:                if (getJimpleStartLn() == jimple_ln)
170:                    return true;
171:                else
172:                    return false;
173:            }
174:
175:            public boolean attrForJavaLn(int java_ln) {
176:                if (getJavaStartLn() == java_ln)
177:                    return true;
178:                else
179:                    return false;
180:            }
181:
182:            public SootAttribute() {
183:            }
184:
185:            /**
186:             * @return
187:             */
188:            public int getJimpleEndPos() {
189:                return jimpleEndPos;
190:            }
191:
192:            /**
193:             * @return
194:             */
195:            public int getJimpleStartPos() {
196:                return jimpleStartPos;
197:            }
198:
199:            /**
200:             * @param i
201:             */
202:            public void setJimpleEndPos(int i) {
203:                jimpleEndPos = i;
204:            }
205:
206:            /**
207:             * @param i
208:             */
209:            public void setJimpleStartPos(int i) {
210:                jimpleStartPos = i;
211:            }
212:
213:            /**
214:             * @return
215:             */
216:            public ArrayList getTextList() {
217:                return textList;
218:            }
219:
220:            /**
221:             * @param list
222:             */
223:            public void setTextList(ArrayList list) {
224:                textList = list;
225:            }
226:
227:            /**
228:             * @return
229:             */
230:            public ArrayList getLinkList() {
231:                return linkList;
232:            }
233:
234:            /**
235:             * @param list
236:             */
237:            public void setLinkList(ArrayList list) {
238:                linkList = list;
239:            }
240:
241:            /**
242:             * @return
243:             */
244:            public int getJavaEndPos() {
245:                return javaEndPos;
246:            }
247:
248:            /**
249:             * @return
250:             */
251:            public int getJavaStartPos() {
252:                return javaStartPos;
253:            }
254:
255:            /**
256:             * @param i
257:             */
258:            public void setJavaEndPos(int i) {
259:                javaEndPos = i;
260:            }
261:
262:            /**
263:             * @param i
264:             */
265:            public void setJavaStartPos(int i) {
266:                javaStartPos = i;
267:            }
268:
269:            /**
270:             * @return
271:             */
272:            public int getJavaEndLn() {
273:                return javaEndLn;
274:            }
275:
276:            /**
277:             * @return
278:             */
279:            public int getJavaStartLn() {
280:                return javaStartLn;
281:            }
282:
283:            /**
284:             * @return
285:             */
286:            public int getJimpleEndLn() {
287:                return jimpleEndLn;
288:            }
289:
290:            /**
291:             * @return
292:             */
293:            public int getJimpleStartLn() {
294:                return jimpleStartLn;
295:            }
296:
297:            /**
298:             * @param i
299:             */
300:            public void setJavaEndLn(int i) {
301:                javaEndLn = i;
302:            }
303:
304:            /**
305:             * @param i
306:             */
307:            public void setJavaStartLn(int i) {
308:                javaStartLn = i;
309:            }
310:
311:            /**
312:             * @param i
313:             */
314:            public void setJimpleEndLn(int i) {
315:                jimpleEndLn = i;
316:            }
317:
318:            /**
319:             * @param i
320:             */
321:            public void setJimpleStartLn(int i) {
322:                jimpleStartLn = i;
323:            }
324:
325:            /**
326:             * @return
327:             */
328:            public int getJavaLength() {
329:                return javaLength;
330:            }
331:
332:            /**
333:             * @return
334:             */
335:            public int getJimpleLength() {
336:                return jimpleLength;
337:            }
338:
339:            /**
340:             * @param i
341:             */
342:            public void setJavaLength(int i) {
343:                javaLength = i;
344:            }
345:
346:            /**
347:             * @param i
348:             */
349:            public void setJimpleLength(int i) {
350:                jimpleLength = i;
351:            }
352:
353:            /**
354:             * @return
355:             */
356:            public ArrayList getColorList() {
357:                return colorList;
358:            }
359:
360:            /**
361:             * @param list
362:             */
363:            public void setColorList(ArrayList list) {
364:                colorList = list;
365:            }
366:
367:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.