From 94ae08701bbd7585a0b7e5a92d1975965a503c03 Mon Sep 17 00:00:00 2001
From: Dennis Kao <ulysseskao@gmail.com>
Date: Wed, 15 Jan 2014 11:28:52 +0800
Subject: [PATCH] Merge branch 'origin/2.1.x'

---
 xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/Dgn7TextElementReaderTest.java |   88 +++++++++++++++-----------------------------
 1 files changed, 30 insertions(+), 58 deletions(-)

diff --git a/xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/Dgn7TextElementReaderTest.java b/xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/Dgn7TextElementReaderTest.java
index 301255e..54d8808 100644
--- a/xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/Dgn7TextElementReaderTest.java
+++ b/xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/Dgn7TextElementReaderTest.java
@@ -17,10 +17,8 @@
  * Dgn7TextElementReaderTest
  * User: Ulysses
  * Date: 2008/1/10
- * Time: �W�� 12:19:14
  */
-public class Dgn7TextElementReaderTest
-{
+public class Dgn7TextElementReaderTest {
     private final static Logger logger = Logger.getLogger(Dgn7fileReaderTest.class);
 
     private final static String testFilePathCreated = "demo.dgn";
@@ -30,16 +28,13 @@
     private FileInputStream _fs;
 
     @BeforeTest
-    public void setUp() throws FileNotFoundException
-    {
+    public void setUp() throws FileNotFoundException {
     }
 
     @Test
-    public void testRead() throws Dgn7fileException, IOException
-    {
+    public void testRead() throws Dgn7fileException, IOException {
         File dataFile = TestData.file(this, testFilePathCreated);
-        if (dataFile.exists())
-        {
+        if (dataFile.exists()) {
             System.out.println("Output--" + testFilePathCreated);
             _fs = new FileInputStream(dataFile);
             FileChannel fc = _fs.getChannel();
@@ -49,8 +44,7 @@
         }
 
         dataFile = TestData.file(this, testFilePathExist);
-        if (dataFile.exists())
-        {
+        if (dataFile.exists()) {
             System.out.println("Output--" + testFilePathExist);
             _fs = new FileInputStream(dataFile);
             FileChannel fc = _fs.getChannel();
@@ -60,8 +54,7 @@
         }
 
         dataFile = TestData.file(this, testFilePathPostComplete);
-        if (dataFile.exists())
-        {
+        if (dataFile.exists()) {
             System.out.println("Output--" + testFilePathPostComplete);
             _fs = new FileInputStream(dataFile);
             FileChannel fc = _fs.getChannel();
@@ -71,97 +64,76 @@
         }
     }
 
-    public void dumpElements(FileChannel fc) throws Dgn7fileException, IOException
-    {
+    public void dumpElements(FileChannel fc) throws Dgn7fileException, IOException {
         Dgn7fileReader reader = new Dgn7fileReader(fc, new Lock());
         int count = 0;
         Element lastComplex = null;
-        while (reader.hasNext())
-        {
-            Dgn7fileReader.Record record = reader.nextElement();
-            if (record.element() != null)
-            {
+        while (reader.hasNext()) {
+            Element.FileRecord record = reader.nextElement();
+            if (record.element() != null) {
                 Element element = (Element) record.element();
                 ElementType type = element.getElementType();
 
-                if ((!type.isComplexElement()) && (!element.isComponentElement()))
-                {
-                    if (lastComplex != null)
-                    {
+                if ((!type.isComplexElement()) && (!element.isComponentElement())) {
+                    if (lastComplex != null) {
                         // @todo add process in here
                         lastComplex = null;
                     }
 
                     // @todo add process in here
-                } else if (element.isComponentElement())
-                {
-                    if (lastComplex != null)
-                    {
+                } else if (element.isComponentElement()) {
+                    if (lastComplex != null) {
                         ((ComplexElement) lastComplex).add(element);
                     }
-                } else if (type.isComplexElement())
-                {
-                    if (lastComplex == null)
-                    {
+                } else if (type.isComplexElement()) {
+                    if (lastComplex == null) {
                         lastComplex = element;
-                    } else
-                    {
+                    } else {
                         // @todo add process in here
                         lastComplex = element;
                     }
                 }
 
-                if (element.getElementType().isComplexElement())
-                {
-                    if (element instanceof ComplexChainElement)
-                    {
+                if (element.getElementType().isComplexElement()) {
+                    if (element instanceof ComplexChainElement) {
                         ComplexChainElement complexChain = (ComplexChainElement) element;
                         int size = complexChain.size();
-                        for (Object aComplexChain : complexChain)
-                        {
+                        for (Object aComplexChain : complexChain) {
                             Element subElement = (Element) aComplexChain;
                             subElement.getType();
                         }
                     }
 
-                    if (element instanceof ComplexShapeElement)
-                    {
+                    if (element instanceof ComplexShapeElement) {
                         ComplexShapeElement complexShape = (ComplexShapeElement) element;
                     }
 
-                    if (element instanceof TextNodeElement)
-                    {
+                    if (element instanceof TextNodeElement) {
                         TextNodeElement textNode = (TextNodeElement) element;
                         int size = textNode.size();
-                        for (int i = 0; i < size; i++)
-                        {
+                        for (int i = 0; i < size; i++) {
                             Element subElement = (Element) textNode.get(i);
                             subElement.getElementType();
                         }
                     }
 
-                } else
-                {
+                } else {
                     boolean hasLinkage = false;
-                    if (element instanceof TextElement)
-                    {
+                    if (element instanceof TextElement) {
                         TextElement textElm = (TextElement) element;
                         List<UserAttributeData> usrData = textElm.getUserAttributeData();
                         Iterator<UserAttributeData> it = usrData.iterator();
-                        while (it.hasNext())
-                        {
+                        while (it.hasNext()) {
                             UserAttributeData attr = it.next();
-                            if (attr instanceof FrammeAttributeData)
-                            {
+                            if (attr instanceof FrammeAttributeData) {
                                 hasLinkage = true;
                                 System.out.println("------------------------------------------");
                                 System.out.println("FSC=" + ((FrammeAttributeData) attr).getFsc() + ":" +
-                                        ((FrammeAttributeData) attr).getUfid());
+                                    ((FrammeAttributeData) attr).getUfid());
                             }
                         }
 
-                        if (hasLinkage)
-                        {
+                        if (hasLinkage) {
                             System.out.println("Text.Font=" + textElm.getFontIndex());
                             System.out.println("Text.Just=" + textElm.getJustification());
                             System.out.println("usrData.len=" + usrData.size());
@@ -175,6 +147,6 @@
             count++;
         }
 
-        logger.info("ElementRecord Count=" + count);
+        logger.info("FileRecord Count=" + count);
     }
 }

--
Gitblit v0.0.0-SNAPSHOT