向量指令和标量指令

向量指令和标量指令:有些大型机和巨型机 设置功能齐全的向量运算指令系统。

向量指令的基本操作对象是向量,即有序排列的一组数。

若指令为向量操作,则由指令确定向量操作数的地址(主存储器起始地址或向量寄存器号),并直接或隐含地指定如增量、向量长度等其他向量参数。

向量指令规定处理机按同一操作处理向量中的所有分量,可有效地提高计算机的运算速度。

不具备向量处理功能,只对单个量即标量进行操作的指令称为标量指令。

 

 1 package Com.TableTest;
 2 
 3 import java.io.File;  
 4 import javax.xml.parsers.DocumentBuilder;  
 5 import javax.xml.parsers.DocumentBuilderFactory;  
 6 import org.w3c.dom.Document;  
 7 import org.w3c.dom.Element;  
 8 import org.w3c.dom.Node;  
 9 import org.w3c.dom.NodeList;  
10  
11 public class TableText_07 {  
12  
13     public void getAllUserNames(String fileName) {  
14         try {  
15             DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();  
16             DocumentBuilder db = dbf.newDocumentBuilder();  
17             File file = new File(fileName);  
18             if (file.exists()) {  
19                 Document doc = db.parse(file);  
20                 Element docEle = doc.getDocumentElement();  
21  
22                 // Print root element of the document  
23                 System.out.println("Root element of the document: "
24                         + docEle.getNodeName());  
25  
26                 NodeList studentList = docEle.getElementsByTagName("student");  
27  
28                 // Print total student elements in document  
29                 System.out  
30                         .println("Total students: " + studentList.getLength());  
31  
32                 if (studentList != null && studentList.getLength() > 0) {  
33                     for (int i = 0; i < studentList.getLength(); i++) {  
34  
35                         Node node = studentList.item(i);  
36  
37                         if (node.getNodeType() == Node.ELEMENT_NODE) {  
38  
39                             System.out  
40                                     .println("=====================");  
41  
42                             Element e = (Element) node;  
43                             NodeList nodeList = e.getElementsByTagName("name");  
44                             System.out.println("Name: "
45                                     + nodeList.item(0).getChildNodes().item(0)  
46                                             .getNodeValue());  
47  
48                             nodeList = e.getElementsByTagName("grade");  
49                             System.out.println("Grade: "
50                                     + nodeList.item(0).getChildNodes().item(0)  
51                                             .getNodeValue());  
52  
53                             nodeList = e.getElementsByTagName("age");  
54                             System.out.println("Age: "
55                                     + nodeList.item(0).getChildNodes().item(0)  
56                                             .getNodeValue());  
57                         }  
58                     }  
59                 } else {  
60                     System.exit(1);  
61                 }  
62             }  
63         } catch (Exception e) {  
64             System.out.println(e);  
65         }  
66     }  
67     public static void main(String[] args) {  
68  
69         TableText_07 parser = new TableText_07();  
70         parser.getAllUserNames("H:\\test2.xml");  
71     }  
72 }

parser.getAllUserNames("H:\\test2.xml"); 测试获取的文件
 1 xml version="1.0"?> 
 2 <students> 
 3     <student> 
 4         <name>bortername> 
 5         <grade>Agrade> 
 6         <age>22age> 
 7     student> 
 8     <student> 
 9         <name>Maryname> 
10         <grade>Bgrade> 
11         <age>23age> 
12     student> 
13     <student> 
14         <name>Tomname> 
15         <grade>cgrade> 
16         <age>24age> 
17     student> 
18 students>
测试获取的文件的结果集:
 1 Root element of the document: students
 2 Total students: 3
 3 =====================
 4 Name: borter
 5 Grade: A
 6 Age: 22
 7 =====================
 8 Name: Mary
 9 Grade: B
10 Age: 23
11 =====================
12 Name: Tom
13 Grade: c
14 Age: 24

 

转载于:https://www.cnblogs.com/borter/p/9388298.html

你可能感兴趣的:(java,c/c++,嵌入式)