Commits

synthomat  committed 723c47e

ProductList.merge -> synchronized

  • Participants
  • Parent commits 3fd8c63

Comments (0)

Files changed (2)

File src/model/ProductList.java

 		return null;
 	}
 	
-	public void merge(ProductList pl) {		
+	synchronized public void merge(ProductList pl) {		
 		for (int i=0; i< pl.size(); i++) {
 			Product plProd = pl.get(i);
 			

File src/strategies/XStreamConverters/ProductConverter.java

 
 public class ProductConverter implements Converter {
 
-    public boolean canConvert(Class clazz) {
-	return clazz.equals(Product.class);
-    }
+	public boolean canConvert(Class clazz) {
+		return clazz.equals(Product.class);
+	}
 
-    public void marshal(Object value, HierarchicalStreamWriter writer,
-	    MarshallingContext context) {
+	public void marshal(Object value, HierarchicalStreamWriter writer, MarshallingContext context) {
 
-	Product product = (Product) value;
+		Product product = (Product) value;
 
-	// ID-Attribut hinzufügen
-	writer.addAttribute("id", product.getIdAsString());
+		// ID-Attribut hinzufügen
+		writer.addAttribute("id", product.getIdAsString());
 
-	// NODES
-	writer.startNode("name");
-	writer.setValue(product.getName());
-	writer.endNode();
-	writer.startNode("preis");
-	writer.setValue(product.getPriceAsString());
-	writer.endNode();
-	writer.startNode("quantity");
-	writer.setValue(Integer.toString(product.getQuantity()));
-	writer.endNode();
-    }
+		// NODES
+		writer.startNode("name");
+		writer.setValue(product.getName());
+		writer.endNode();
+		writer.startNode("preis");
+		writer.setValue(product.getPriceAsString());
+		writer.endNode();
+		writer.startNode("quantity");
+		writer.setValue(Integer.toString(product.getQuantity()));
+		writer.endNode();
+	}
 
-    public Object unmarshal(HierarchicalStreamReader reader,
-	    UnmarshallingContext context) {
-	Product product = new Product();
+	public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
+		Product product = new Product();
 
-	// Attribut auslesen
-	product.setId(new Integer(reader.getAttribute("id")));
+		// Attribut auslesen
+		product.setId(new Integer(reader.getAttribute("id")));
 
-	// NODES
-	reader.moveDown();
-	product.setName(reader.getValue());
-	reader.moveUp();
-	reader.moveDown();
-	product.setPrice(new Double(reader.getValue()));
-	reader.moveUp();
-	reader.moveDown();
-	product.setQuantity(new Integer(reader.getValue()));
-	reader.moveUp();
+		// NODES
+		reader.moveDown();
+		product.setName(reader.getValue());
+		reader.moveUp();
+		reader.moveDown();
+		product.setPrice(new Double(reader.getValue()));
+		reader.moveUp();
+		reader.moveDown();
+		product.setQuantity(new Integer(reader.getValue()));
+		reader.moveUp();
 
-	return product;
-    }
+		return product;
+	}
 }