Skip to content
Snippets Groups Projects
Commit c5947e9c authored by Russell Furnas Kaup's avatar Russell Furnas Kaup
Browse files

DataConverter

parent 5bcfc9c6
No related branches found
No related tags found
No related merge requests found
......@@ -3,5 +3,7 @@
<classpathentry kind="src" path="src"/>
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="/home/raku/Desktop/xstream-1.4.7.jar"/>
<classpathentry kind="lib" path="/home/raku/Desktop/xmlpull-1.1.3.1.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
......@@ -5,7 +5,7 @@ public class Address {
String city;
String state;
String zip;
String country;
String country; //git sucks
Address(String street, String city, String state, String zip, String country) {
this.street = street;
......
......@@ -3,8 +3,11 @@ package assignment2;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import com.thoughtworks.xstream.*;
public class DataConvereter {
public class DataConverter {
private Customer[] customerArray;
public void readPerson() {
......@@ -15,7 +18,11 @@ public class DataConvereter {
} catch (FileNotFoundException e) {
e.printStackTrace();
}
int size =Integer.parseInt(s.nextLine());
Person[] personArray;
personArray = new Person[size];
for(int i=0;i<size;i++){
String personTemp = s.nextLine();
String[] parts = personTemp.split(";");
......@@ -23,7 +30,7 @@ public class DataConvereter {
String name = parts[1];
String address = parts[2];
String eMail = parts[3];
new Person(personCode,name,address,eMail);
personArray[i] = new Person(personCode,name,address,eMail);
}
s.close();
}
......@@ -36,7 +43,11 @@ public class DataConvereter {
} catch (FileNotFoundException e) {
e.printStackTrace();
}
int size =Integer.parseInt(s.nextLine());
Venues[] venuesArray;
venuesArray = new Venues[size];
for(int i=0;i<size;i++){
String venueTemp = s.nextLine();
String[] parts = venueTemp.split(";");
......@@ -44,7 +55,7 @@ public class DataConvereter {
String name = parts[1];
String address = parts[2];
int capacity = Integer.parseInt(parts[3]);
new Venues(venueCode,name,address,capacity);
venuesArray[i] = new Venues(venueCode,name,address,capacity);
}
s.close();
}
......@@ -58,6 +69,8 @@ public class DataConvereter {
e.printStackTrace();
}
int size =Integer.parseInt(s.nextLine());
//up top for testing implementation
customerArray = new Customer[size];
for(int i=0;i<size;i++){
String customerTemp = s.nextLine();
String[] parts = customerTemp.split(";");
......@@ -66,7 +79,7 @@ public class DataConvereter {
String primaryContact = parts[2];
String name = parts[3];
String address = parts[4];
new Customer(customerCode,type, primaryContact, name, address);
customerArray[i] = new Customer(customerCode,type, primaryContact, name, address);
}
s.close();
}
......@@ -121,6 +134,22 @@ public class DataConvereter {
s.close();
}
private String serializeObjects(Object obj) {
XStream xstream = new XStream();
String xml = null;
return xml;
}
private String serializeObjects(Person[] per[]) {
XStream xstream = new XStream();
String xml = null;
return xml;
}
public static void main(String args[]) {
serializeObjects(readProduct().)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment