[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Classification.java, 1.4, 1.5 Space.
Status: Pre-Alpha
Brought to you by:
henryml
|
From: Nikolaj B. <nbr...@us...> - 2006-12-17 20:23:47
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21118/src/net/sourceforge/bprocessor/model Modified Files: Classification.java Space.java Project.java Log Message: Implemented produkttypes for the classifications, and the loading of the file containing them. Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.106 retrieving revision 1.107 diff -C2 -d -r1.106 -r1.107 *** Space.java 5 Dec 2006 15:21:19 -0000 1.106 --- Space.java 17 Dec 2006 20:23:36 -0000 1.107 *************** *** 125,128 **** --- 125,131 ---- private Classification classification; + /** The classification */ + private Classification productType; + /** If the constructionspace is transparent */ private boolean transparent; *************** *** 132,160 **** - /** The construcstionspace classification options */ - private String[] constructionOptions = - {"None", "Terrandæk", "Tagkonstruktion", "Ydervæg", "Ældre termovindue", - "2-lags lavenergivindue", "3-lags lavenergivindue", "Dør", "Loft"}; - - /** The functionalspace classification options */ - private String[] functionalOptions = - {"None", "Exteriør", "Stue", "Badeværelse", "Opvarmet rum", "Uopvarmet rum"}; - - /** The construcstionspace on part element, classification options */ - private String[] elementConstructionOptions = - {"None", "Karm", "Sprosse", "Post", "Vindue 2lag termo", "Vindue 3lag termo"}; - - /** The functionalspace on part element, classification options */ - private String[] elementFunctionalOptions = - {"None"}; - - /** The construcstionspace on part level, classification options */ - private String[] partConstructionOptions = - {"None"}; - - /** The functionalspace on part level, classification options */ - private String[] partFunctionalOptions = - {"None"}; - /** The modellor */ private Modellor modellor; --- 135,138 ---- *************** *** 1145,1148 **** --- 1123,1141 ---- } + /** + * Return the product type + * @return The product type + */ + public Classification getTypeClassification() { + return productType; + } + /** + * Set the product type + * @param productType The product type + */ + public void setTypeClassification(Classification productType) { + this.productType = productType; + } + *************** *** 1492,1495 **** --- 1485,1490 ---- setClassification(((Classification)a.getClassification())); } + } else if (a.getName().equals("Type")) { + setTypeClassification((((Classification)a.getClassification()))); } else if (a.getName().equals("Transparent")) { setTransparent((((Boolean)a.getValue()).booleanValue())); *************** *** 1555,1558 **** --- 1550,1557 ---- } } + if (getClassification() != null && !getClassification().getProdukt().equalsIgnoreCase("")) { + res.add(new Attribute("Type", Project.getInstance(). + getType(getClassification().getName()), getTypeClassification(), 4)); + } res.add(new Attribute("ID", getId().toString(), false)); res.add(new Attribute("Owner", getOwner(), false)); *************** *** 1643,1647 **** return getClassification().toString() + " - " + res + id; } else { ! return name + " - " + res + id; } } --- 1642,1650 ---- return getClassification().toString() + " - " + res + id; } else { ! if (name.equalsIgnoreCase("Void")) { ! return name; ! } else { ! return name + " - " + res + id; ! } } } Index: Classification.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Classification.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Classification.java 16 Nov 2006 23:20:39 -0000 1.4 --- Classification.java 17 Dec 2006 20:23:36 -0000 1.5 *************** *** 30,33 **** --- 30,37 ---- private Classification parent; + /** The type of this classification */ + private String produkt; + + /** Construction Type */ public static final int CONSTRUCTION = 0; *************** *** 36,39 **** --- 40,46 ---- public static final int FUNCTIONAL = 1; + /** functional Type */ + public static final int TYPES = 2; + /** type */ private int type; *************** *** 51,54 **** --- 58,62 ---- setType(type); setParent(parent); + setProdukt(""); } *************** *** 62,65 **** --- 70,74 ---- setType(type); setId(new String("-1")); + setProdukt(""); } *************** *** 72,75 **** --- 81,85 ---- setId(new String("0")); setType(type); + setProdukt(""); } *************** *** 179,182 **** --- 189,209 ---- } + + /** + * Get the different types for this classification + * @return produkt the produkt types + */ + public String getProdukt() { + return produkt; + } + + /** + * Set the produkt type for this classification + * @param produkt the produkt types + */ + public void setProdukt(String produkt) { + this.produkt = produkt; + } + Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.99 retrieving revision 1.100 diff -C2 -d -r1.99 -r1.100 *** Project.java 3 Dec 2006 17:50:36 -0000 1.99 --- Project.java 17 Dec 2006 20:23:36 -0000 1.100 *************** *** 53,56 **** --- 53,59 ---- private Classification functionalClas = new Classification(1); + /** The classification */ + private Classification typesClas = new Classification(2); + /** The cameras */ private HashMap cameras = new HashMap(); *************** *** 140,143 **** --- 143,147 ---- loadClassification(true); loadClassification(false); + loadTypes(); } catch (Exception e) { System.out.println("loading classification"); *************** *** 785,788 **** --- 789,793 ---- String curname = ""; String curid; + boolean clasmade = false; Classification parent; Classification last; *************** *** 792,796 **** if (construction) { bf = new BufferedReader ! (new InputStreamReader(new FileInputStream("constructions.txt"), "ISO-8859-1")); clas = new Classification(0); parent = new Classification(0); --- 797,801 ---- if (construction) { bf = new BufferedReader ! (new InputStreamReader(new FileInputStream("construction2.txt"), "ISO-8859-1")); clas = new Classification(0); parent = new Classification(0); *************** *** 808,850 **** while (st.hasMoreTokens()) { token = st.nextToken(); ! if (depth == 0 && !token.equalsIgnoreCase(";")) { ! curid = new String(token); ! st.nextToken(); ! curname = st.nextToken(); ! Classification curclas; ! if (construction) { ! curclas = new Classification(curid, curname, clas, 0); ! } else { ! curclas = new Classification(curid, curname, clas, 1); ! } ! parent = curclas; ! clas.addChild(curclas); ! lastdepth = 0; ! last = curclas; ! } else if (token.equalsIgnoreCase(";")) { ! depth++; ! } else if (depth != 0 && !token.equalsIgnoreCase(";")) { ! curid = new String(token); ! st.nextToken(); ! curname = st.nextToken(); ! if (depth > lastdepth) { ! parent = last; ! } ! if (depth < lastdepth) { ! parent = parent.getParent(); ! } ! Classification curclas; ! if (construction) { ! curclas = new Classification(curid, curname, parent, 0); ! } else { ! curclas = new Classification(curid, curname, parent, 1); } ! parent.addChild(curclas); ! last = curclas; ! lastdepth = depth; ! } } depth = 0; current = bf.readLine(); } if (construction) { --- 813,867 ---- while (st.hasMoreTokens()) { token = st.nextToken(); ! if (!clasmade) { ! if (depth == 0 && !token.equalsIgnoreCase(";")) { ! curid = new String(token); ! st.nextToken(); ! curname = st.nextToken(); ! Classification curclas; ! if (construction) { ! curclas = new Classification(curid, curname, clas, 0); ! clasmade = true; ! } else { ! curclas = new Classification(curid, curname, clas, 1); ! clasmade = true; ! } ! parent = curclas; ! clas.addChild(curclas); ! lastdepth = 0; ! last = curclas; ! } else if (token.equalsIgnoreCase(";")) { ! depth++; ! } else if (depth != 0 && !token.equalsIgnoreCase(";")) { ! curid = new String(token); ! st.nextToken(); ! curname = st.nextToken(); ! if (depth > lastdepth) { ! parent = last; ! } ! if (depth < lastdepth) { ! parent = parent.getParent(); ! } ! Classification curclas; ! if (construction) { ! curclas = new Classification(curid, curname, parent, 0); ! clasmade = true; ! } else { ! curclas = new Classification(curid, curname, parent, 1); ! clasmade = true; ! } ! parent.addChild(curclas); ! last = curclas; ! lastdepth = depth; ! } ! } else { ! if (!token.equalsIgnoreCase(";")) { ! last.setProdukt(token); ! //System.out.println(token); } ! } } depth = 0; current = bf.readLine(); + clasmade = false; } if (construction) { *************** *** 923,927 **** --- 940,1035 ---- return cl; } + + /** + * This method loads the product types from a file + * @exception Exception Thrown if an exception occurs + */ + public void loadTypes() throws Exception { + BufferedReader bf; + bf = new BufferedReader( + new InputStreamReader(new FileInputStream("typer.txt"), "ISO-8859-1")); + Classification clas; + String current = ""; + String token = ""; + String curname = ""; + String curid; + boolean clasmade = false; + Classification parent; + Classification last; + clas = new Classification(2); + parent = new Classification(2); + last = new Classification(2); + int depth = 0; + int lastdepth = 0; + current = bf.readLine(); + while (!current.equalsIgnoreCase("--stop--")) { + StringTokenizer st = new StringTokenizer(current, ";", true); + while (st.hasMoreTokens()) { + token = st.nextToken(); + if (!clasmade) { + if (depth == 0 && !token.equalsIgnoreCase(";")) { + curname = new String(token); + Classification curclas; + curclas = new Classification("0", curname, clas, 2); + clasmade = true; + parent = curclas; + clas.addChild(curclas); + lastdepth = 0; + last = curclas; + } else if (token.equalsIgnoreCase(";")) { + depth++; + } else if (depth != 0 && !token.equalsIgnoreCase(";")) { + curid = new String(token); + st.nextToken(); + curname = st.nextToken(); + if (depth > lastdepth) { + parent = last; + } + if (depth < lastdepth) { + parent = parent.getParent(); + } + Classification curclas; + curclas = new Classification(curid, curname, parent, 0); + clasmade = true; + parent.addChild(curclas); + last = curclas; + lastdepth = depth; + } + } + } + depth = 0; + current = bf.readLine(); + clasmade = false; + } + typesClas = clas; + } + /** + * GetType returns the type of this classification + * @param name the name of the classification + * @return temp the type + */ + public Classification getType(String name) { + Classification temp = null; + Iterator it = typesClas.getChildren().iterator(); + while (it.hasNext()) { + temp = (Classification) it.next(); + if (temp.getName().equalsIgnoreCase(name)) { + return temp; + } + } + return null; + } + + + /** + * Get the types classification + * @return typesClas the types classification + */ + public Classification getTypesClas() { + return typesClas; + } + + /** * getter for the copy buffer |