[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Component.java, NONE, 1.1 Project.ja
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2007-11-19 09:20:38
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25825/src/net/sourceforge/bprocessor/model Modified Files: Project.java Persistence.java Added Files: Component.java Removed Files: LibraryObj.java Log Message: Renamed LibraryObj to Component --- LibraryObj.java DELETED --- Index: Persistence.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Persistence.java,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** Persistence.java 19 Nov 2007 08:43:43 -0000 1.59 --- Persistence.java 19 Nov 2007 09:20:41 -0000 1.60 *************** *** 158,162 **** for (Object o : document.getCatalogObjects()) { LibObjType lot = (LibObjType)o; ! LibraryObj lo = internalizeLibraryObj(lot, mapper, xmls); p.addCalalogObject(lo); } --- 158,162 ---- for (Object o : document.getCatalogObjects()) { LibObjType lot = (LibObjType)o; ! Component lo = internalizeLibraryObj(lot, mapper, xmls); p.addCalalogObject(lo); } *************** *** 798,802 **** { Collection libObjs = document.getCatalogObjects(); ! for (LibraryObj lo : Project.getInstance().getCatalogObjects()) { libObjs.add(externalizeLibObj(lo, mapper)); } --- 798,802 ---- { Collection libObjs = document.getCatalogObjects(); ! for (Component lo : Project.getInstance().getCatalogObjects()) { libObjs.add(externalizeLibObj(lo, mapper)); } *************** *** 1619,1626 **** * @throws Exception a exception */ ! public static Collection<LibraryObj> loadLibrary() throws Exception { Map<Integer, Object> map = new HashMap<Integer, Object>(); Collection<Object> xmls = new LinkedList<Object>(); ! Collection<LibraryObj> library = new LinkedList<LibraryObj>(); File libdir = new File("Library/"); if (!libdir.exists()) { --- 1619,1626 ---- * @throws Exception a exception */ ! public static Collection<Component> loadLibrary() throws Exception { Map<Integer, Object> map = new HashMap<Integer, Object>(); Collection<Object> xmls = new LinkedList<Object>(); ! Collection<Component> library = new LinkedList<Component>(); File libdir = new File("Library/"); if (!libdir.exists()) { *************** *** 1647,1653 **** } ! private static List<LibraryObj> internalizeLibObjs(File f, Map map, Collection xmls) throws Exception { ! List<LibraryObj> res = new LinkedList<LibraryObj>(); if (f.exists() && f.canRead()) { FileInputStream is = new FileInputStream(f); --- 1647,1653 ---- } ! private static List<Component> internalizeLibObjs(File f, Map map, Collection xmls) throws Exception { ! List<Component> res = new LinkedList<Component>(); if (f.exists() && f.canRead()) { FileInputStream is = new FileInputStream(f); *************** *** 1655,1659 **** for (Object lo : lib.getLibObj()) { LibObjType lot = (LibObjType)lo; ! LibraryObj libo = internalizeLibraryObj(lot, map, xmls); libo.setFile(f); res.add(libo); --- 1655,1659 ---- for (Object lo : lib.getLibObj()) { LibObjType lot = (LibObjType)lo; ! Component libo = internalizeLibraryObj(lot, map, xmls); libo.setFile(f); res.add(libo); *************** *** 1664,1669 **** } ! private static LibraryObj internalizeLibraryObj(LibObjType lot, Map map, Collection xmls) { ! LibraryObj lo = new LibraryObj(); lo.setAuthor(lot.getAuthor()); lo.setVersion(lot.getVersion()); --- 1664,1669 ---- } ! private static Component internalizeLibraryObj(LibObjType lot, Map map, Collection xmls) { ! Component lo = new Component(); lo.setAuthor(lot.getAuthor()); lo.setVersion(lot.getVersion()); *************** *** 1689,1697 **** } ! private static Library externalizeLibrary(Collection<LibraryObj> catalogObjects) { HashMap<Long, Object> map = new HashMap<Long, Object>(); Library lib = new LibraryImpl(); List libobjs = lib.getLibObj(); ! for (LibraryObj libo : catalogObjects) { libobjs.add(externalizeLibObj(libo, map)); } --- 1689,1697 ---- } ! private static Library externalizeLibrary(Collection<Component> catalogObjects) { HashMap<Long, Object> map = new HashMap<Long, Object>(); Library lib = new LibraryImpl(); List libobjs = lib.getLibObj(); ! for (Component libo : catalogObjects) { libobjs.add(externalizeLibObj(libo, map)); } *************** *** 1709,1713 **** } ! private static LibObjType externalizeLibObj(LibraryObj libo, HashMap<Long, Object> map) { LibObjType libobj = new LibObjTypeImpl(); libobj.setLocked(libo.isLocked()); --- 1709,1713 ---- } ! private static LibObjType externalizeLibObj(Component libo, HashMap<Long, Object> map) { LibObjType libobj = new LibObjTypeImpl(); libobj.setLocked(libo.isLocked()); --- NEW FILE: Component.java --- //--------------------------------------------------------------------------------- // $Id: Component.java,v 1.1 2007/11/19 09:20:41 henryml Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.model; import java.io.File; import java.util.LinkedList; import java.util.List; /** * A object pointing to a lib file */ public class Component implements Parametric { private File file; private Space space = null; private byte useableLevels = 0; private boolean isLocked = false; private String name; private String author; private String version; /** * The default constructor * @param usableLvls the levels where obj can be used incoded into a byte * @param f the file that represents this library object * @param s the space (union) this lib obj encapsulate */ public Component(byte usableLvls, File f, Space s) { file = f; useableLevels = usableLvls; space = s; name = s.getName(); } /** * Constructor for persistence */ public Component() { } /** * Get the file this lib obj represents * @return the file */ public File getFile() { return file; } /** * Set the file this lib obj points to * @param f The file */ void setFile(File f) { file = f; } /** * Return a byte with the usable levelnumber bit set * @return a byte with some set bits */ public byte getUseLevel() { return useableLevels; } /** * A getter for the space (union) this lib obj points to * @return The Space */ public Space getSpace() { return space; } /** * A setter for space in this lib obj * @param s the space */ void setSpace(Space s) { space = s; name = s.getName(); } /** * @return the isLocked */ public boolean isLocked() { return isLocked; } /** * @param isLocked the isLocked to set */ public void setLocked(boolean isLocked) { this.isLocked = isLocked; } /** * {@inheritDoc} */ public String getGeneralName() { return "Library Object"; } /** * {@inheritDoc} */ public List<Attribute> getAttributes() { List<Attribute> att = new LinkedList<Attribute>(); att.add(new Attribute("name", getName())); att.add(new Attribute("levels", new Selector<String>(getLevelStrings()))); att.add(new Attribute("geometry", getSpace())); att.add(new Attribute("Locked", isLocked())); String fileStr = "n/a"; if (getFile() != null) { fileStr = getFile().getAbsolutePath(); } att.add(new Attribute("File", fileStr)); att.add(new Attribute("Author", getAuthor())); att.add(new Attribute("Version", getVersion())); return att; } private List<String> getLevelStrings() { List<String> strings = new LinkedList<String>(); int lvl = Space.SPACE_LEVEL; for (int i = 0; i < Space.PART_LEVEL; i++) { if ((useableLevels & (1 >> i)) == (1 >> i)) { strings.add(Space.levelToString(lvl)); } lvl++; } return strings; } /** * {@inheritDoc} */ public void setAttributes(List<Attribute> attributes) { } /** * Getter for name * @return The name */ public String getName() { return name; } /** * @return the author */ public String getAuthor() { if (author == null) { author = "n/a"; } return author; } /** * @param author the author to set */ public void setAuthor(String author) { this.author = author; } /** * @return the version */ public String getVersion() { if (version == null) { version = "n/a"; } return version; } /** * @param version the version to set */ public void setVersion(String version) { this.version = version; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } } Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.142 retrieving revision 1.143 diff -C2 -d -r1.142 -r1.143 *** Project.java 12 Nov 2007 21:16:22 -0000 1.142 --- Project.java 19 Nov 2007 09:20:41 -0000 1.143 *************** *** 64,68 **** private static Collection<ClassificationType> classificationTypes; ! private static Collection<LibraryObj> library; /** The cameras */ --- 64,68 ---- private static Collection<ClassificationType> classificationTypes; ! private static Collection<Component> library; /** The cameras */ *************** *** 121,125 **** private long nextMaterialId; ! private List<LibraryObj> catalog; /** --- 121,125 ---- private long nextMaterialId; ! private List<Component> catalog; /** *************** *** 158,162 **** redoStack = new Stack(); copyBuffer = new LinkedList(); ! catalog = new LinkedList<LibraryObj>(); resetCam(); observers = new LinkedList(); --- 158,162 ---- redoStack = new Stack(); copyBuffer = new LinkedList(); ! catalog = new LinkedList<Component>(); resetCam(); observers = new LinkedList(); *************** *** 1046,1050 **** * @return the list of spaces */ ! public List<LibraryObj> getCatalogObjects() { return catalog; } --- 1046,1050 ---- * @return the list of spaces */ ! public List<Component> getCatalogObjects() { return catalog; } *************** *** 1054,1058 **** * @param lo the library object to add */ ! public void addCalalogObject(LibraryObj lo) { if (!catalog.contains(lo)) { catalog.add(lo); --- 1054,1058 ---- * @param lo the library object to add */ ! public void addCalalogObject(Component lo) { if (!catalog.contains(lo)) { catalog.add(lo); *************** *** 1065,1069 **** * @return the lib objs */ ! public static Collection<LibraryObj> getLibraryObjects() { return library; } --- 1065,1069 ---- * @return the lib objs */ ! public static Collection<Component> getLibraryObjects() { return library; } |