Source Code Cross Referenced for AttributeDomProcessor.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.*; //import javax.xml.parsers.*;
023:
024:        import org.w3c.dom.*;
025:
026:        public class AttributeDomProcessor {
027:
028:            Document domDoc;
029:            ArrayList attributes;
030:            private ArrayList keys;
031:            private SootAttribute current;
032:
033:            /**
034:             * Method AttributeDomProcessor.
035:             * @param domDoc
036:             */
037:            public AttributeDomProcessor(Document domDoc) {
038:                setDomDoc(domDoc);
039:            }
040:
041:            /**
042:             * Method processAttributesDom.
043:             */
044:            public void processAttributesDom() {
045:                processNode(getDomDoc());
046:
047:            }
048:
049:            private void processNode(Node node) {
050:
051:                if (node.getNodeType() == Node.DOCUMENT_NODE) {
052:                    NodeList children = node.getChildNodes();
053:                    if (children != null) {
054:                        setAttributes(new ArrayList());
055:                        for (int i = 0; i < children.getLength(); i++) {
056:                            processNode(children.item(i));
057:                        }
058:                    }
059:
060:                } else if (node.getNodeType() == Node.ELEMENT_NODE) {
061:                    if (node.getNodeName().equals("attribute")) {
062:
063:                        current = new SootAttribute();
064:                        NodeList children = node.getChildNodes();
065:                        for (int i = 0; i < children.getLength(); i++) {
066:                            processAttributeNode(current, children.item(i));
067:                        }
068:                        getAttributes().add(current);
069:                    } else if (node.getNodeName().equals("key")) {
070:                        if (keys == null) {
071:                            keys = new ArrayList();
072:                        }
073:                        NamedNodeMap map = node.getAttributes();
074:                        AnalysisKey key = new AnalysisKey();
075:                        key.setRed((new Integer(map.getNamedItem("red")
076:                                .getNodeValue())).intValue());
077:                        key.setGreen((new Integer(map.getNamedItem("green")
078:                                .getNodeValue())).intValue());
079:                        key.setBlue((new Integer(map.getNamedItem("blue")
080:                                .getNodeValue())).intValue());
081:                        key.setKey(map.getNamedItem("key").getNodeValue());
082:                        key.setType(map.getNamedItem("aType").getNodeValue());
083:                        keys.add(key);
084:                    } else {
085:                        NodeList children = node.getChildNodes();
086:                        for (int i = 0; i < children.getLength(); i++) {
087:                            processNode(children.item(i));
088:                        }
089:                    }
090:
091:                }
092:
093:            }
094:
095:            private void processAttributeNode(SootAttribute current, Node node) {
096:
097:                if (node.getNodeType() == Node.ELEMENT_NODE) {
098:                    if (node.getNodeName().equals("link")) {
099:                        NamedNodeMap map = node.getAttributes();
100:                        LinkAttribute la = new LinkAttribute();
101:
102:                        la.setLabel(map.getNamedItem("label").getNodeValue());
103:                        la.setJavaLink((new Integer(map.getNamedItem("srcLink")
104:                                .getNodeValue()).intValue()));
105:                        la.setJimpleLink((new Integer(map.getNamedItem(
106:                                "jmpLink").getNodeValue()).intValue()));
107:                        la.setClassName(map.getNamedItem("clssNm")
108:                                .getNodeValue());
109:                        la.setType(map.getNamedItem("aType").getNodeValue());
110:                        current.addLinkAttr(la);
111:                    } else if (node.getNodeName().equals("color")) {
112:                        NamedNodeMap map = node.getAttributes();
113:                        int r = (new Integer(map.getNamedItem("r")
114:                                .getNodeValue())).intValue();
115:                        int g = (new Integer(map.getNamedItem("g")
116:                                .getNodeValue())).intValue();
117:                        int b = (new Integer(map.getNamedItem("b")
118:                                .getNodeValue())).intValue();
119:                        int fgInt = (new Integer(map.getNamedItem("fg")
120:                                .getNodeValue())).intValue();
121:                        boolean fg = false;
122:                        if (fgInt == 1) {
123:                            fg = true;
124:                        }
125:                        ColorAttribute ca = new ColorAttribute(r, g, b, fg);
126:                        ca.type(map.getNamedItem("aType").getNodeValue());
127:                        current.addColorAttr(ca);//.setColor(ca);
128:                    } else if (node.getNodeName().equals("srcPos")) {
129:                        NamedNodeMap map = node.getAttributes();
130:                        int sline = (new Integer(map.getNamedItem("sline")
131:                                .getNodeValue())).intValue();
132:                        int eline = (new Integer(map.getNamedItem("eline")
133:                                .getNodeValue())).intValue();
134:                        int spos = (new Integer(map.getNamedItem("spos")
135:                                .getNodeValue())).intValue();
136:                        int epos = (new Integer(map.getNamedItem("epos")
137:                                .getNodeValue())).intValue();
138:
139:                        current.setJavaStartLn(sline);
140:                        current.setJavaEndLn(eline);
141:                        current.setJavaStartPos(spos);
142:                        current.setJavaEndPos(epos);
143:                    } else if (node.getNodeName().equals("jmpPos")) {
144:                        NamedNodeMap map = node.getAttributes();
145:                        int sline = (new Integer(map.getNamedItem("sline")
146:                                .getNodeValue())).intValue();
147:                        int eline = (new Integer(map.getNamedItem("eline")
148:                                .getNodeValue())).intValue();
149:                        int spos = (new Integer(map.getNamedItem("spos")
150:                                .getNodeValue())).intValue();
151:                        int epos = (new Integer(map.getNamedItem("epos")
152:                                .getNodeValue())).intValue();
153:
154:                        current.setJimpleStartLn(sline);
155:                        current.setJimpleEndLn(eline);
156:                        current.setJimpleStartPos(spos);
157:                        current.setJimpleEndPos(epos);
158:                    } else if (node.getNodeName().equals("text")) {
159:                        NamedNodeMap map = node.getAttributes();
160:                        TextAttribute ta = new TextAttribute();
161:                        ta.setInfo(map.getNamedItem("info").getNodeValue());
162:                        ta.setType(map.getNamedItem("aType").getNodeValue());
163:                        current.addTextAttr(ta);
164:                    } else {
165:                        NodeList children = node.getChildNodes();
166:                        for (int i = 0; i < children.getLength(); i++) {
167:                            processAttributeNode(current, children.item(i));
168:                        }
169:                    }
170:                } else if (node.getNodeType() == Node.TEXT_NODE) {
171:                    String type = node.getParentNode().getNodeName();
172:                }
173:            }
174:
175:            /**
176:             * Returns the domDoc.
177:             * @return Document
178:             */
179:            public Document getDomDoc() {
180:                return domDoc;
181:            }
182:
183:            /**
184:             * Sets the domDoc.
185:             * @param domDoc The domDoc to set
186:             */
187:            public void setDomDoc(Document domDoc) {
188:                this .domDoc = domDoc;
189:            }
190:
191:            /**
192:             * Returns the attributes.
193:             * @return Vector
194:             */
195:            public ArrayList getAttributes() {
196:                return attributes;
197:            }
198:
199:            /**
200:             * Returns the current.
201:             * @return SootAttribute
202:             */
203:            public SootAttribute getCurrent() {
204:                return current;
205:            }
206:
207:            /**
208:             * Sets the attributes.
209:             * @param attributes The attributes to set
210:             */
211:            public void setAttributes(ArrayList attributes) {
212:                this .attributes = attributes;
213:            }
214:
215:            /**
216:             * Sets the current.
217:             * @param current The current to set
218:             */
219:            public void setCurrent(SootAttribute current) {
220:                this .current = current;
221:            }
222:
223:            /**
224:             * @return
225:             */
226:            public ArrayList getKeys() {
227:                return keys;
228:            }
229:
230:            /**
231:             * @param list
232:             */
233:            public void setKeys(ArrayList list) {
234:                keys = list;
235:            }
236:
237:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.