/** Finds one child for given name . * @param name the name of the child * @return the file object or null if it does not exist */ protected final AbstractFolder getChild(String name) { return getChild(name, true); }
private Map<String, AbstractFolder> dereferenceValues(final Map<String, Reference<AbstractFolder>> map) { Map<String, AbstractFolder> retVal = new HashMap<String, AbstractFolder>(map.size()); for (String name : map.keySet()) { AbstractFolder child = getChild(name, false); if (child != null) { retVal.put(name, child); } } return retVal; }
private synchronized FileObject getFileObjectImpl(String name, String ext) { check(); if ((ext == null) || ext.equals("")) { // NOI18N return getChild(name); } else { StringBuffer sb = new StringBuffer(name.length() + 1 + ((ext == null) ? 0 : ext.length())); sb.append(name).append(EXT_SEP).append(ext); return getChild(sb.toString()); } }
private void filesCreated(final Set<String> addedToFire, final boolean expected) { for (String s : addedToFire) { AbstractFolder fo = getChild(s); if (fo != null) { fileCreated0(this, fo, expected); } } }
public final synchronized FileObject[] getChildren() { check(); if (children == null) { return new FileObject[0]; } int size = children.length; ArrayList<FileObject> aList = new ArrayList<FileObject>(); for (int i = 0; i < size; i++) { FileObject f = getChild(children[i]); if (f != null) { aList.add(f); } } return aList.toArray(new FileObject[0]); }
/** Tries to find a resource if it exists in memory. * @param en enumeration of strings to scan * @return found object or null */ final Reference<AbstractFolder> findRefIfExists(Enumeration<String> en) { AbstractFolder fo = this; while ((fo != null) && en.hasMoreElements()) { if (fo.map == null) { // this object is not initialized yet return null; } // try to go on // lock to provide safety for getChild synchronized (fo) { String tmpName = en.nextElement(); if (en.hasMoreElements()) { fo = fo.getChild(tmpName); } else { return fo.map.get(tmpName); } } } // no next requirements or not found return null; }
/** Tries to find a resource. * @param en enumeration of strings to scan * @return found object or null */ final FileObject find(Enumeration<String> en) { AbstractFolder fo = this; while ((fo != null) && en.hasMoreElements()) { // try to go on // lock to provide safety for getChild synchronized (fo) { // JST: Better to call the check only here, // than in getChild, than it is not called // so often. fo.check(); final String next = en.nextElement(); if ("..".equals(next)) { fo = (AbstractFolder)fo.getParent(); } else { fo = fo.getChild(next); } } } // no next requirements or not found return fo; }
/** Finds one child for given name . * @param name the name of the child * @return the file object or null if it does not exist */ protected final AbstractFolder getChild (String name) { return getChild (name, true); }
/** Finds one child for given name . * @param name the name of the child * @return the file object or null if it does not exist */ protected final AbstractFolder getChild (String name) { return getChild (name, true); }
private Map/*<String, AbstractFileObject>*/ dereferenceValues(final Map/*<String, Reference (AbstractFileObject)> */ map) { Map retVal = new HashMap (map.size()); Iterator it = map.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry) it.next(); String name = (String) entry.getKey(); AbstractFolder child = getChild(name, false); if (child != null) retVal.put(name, child); } return retVal; }
private Map/*<String, AbstractFileObject>*/ dereferenceValues(final Map/*<String, Reference (AbstractFileObject)> */ map) { Map retVal = new HashMap (map.size()); Iterator it = map.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry) it.next(); String name = (String) entry.getKey(); AbstractFolder child = getChild(name, false); if (child != null) retVal.put(name, child); } return retVal; }
public final synchronized FileObject[] getChildren () { check (); if (children == null) { return new FileObject[0]; } int size = children.length; ArrayList aList = new ArrayList(); for (int i = 0; i < size; i++) { FileObject f = getChild (children[i]); if (f != null) aList.add(f); } return (FileObject [])aList.toArray(new FileObject [0]); }
private void filesCreated(final Set/*<String>*/ addedToFire, final boolean expected) { for (Iterator it = addedToFire.iterator(); it.hasNext();) { AbstractFolder fo = getChild((String) it.next()); if (fo != null) { fileCreated0(this, fo, expected); } } }
private void filesCreated(final Set/*<String>*/ addedToFire, final boolean expected) { for (Iterator it = addedToFire.iterator(); it.hasNext();) { AbstractFolder fo = getChild((String) it.next()); if (fo != null) { fileCreated0(this, fo, expected); } } }
/** Retrieve file or folder contained in this folder by name. * <em>Note</em> that neither file nor folder is created on disk. * @param name basename of the file or folder (in this folder) * @param ext extension of the file; <CODE>null</CODE> or <code>""</code> * if the file should have no extension or if folder is requested * @return the object representing this file or <CODE>null</CODE> if the file * or folder does not exist * @exception IllegalArgumentException if <code>this</code> is not a folder */ public final synchronized FileObject getFileObject (String name, String ext) { check (); if (ext == null || ext.equals ("")) { // NOI18N return getChild (name); } else { StringBuffer sb = new StringBuffer(name.length() + 1 + ((ext == null) ? 0 : ext.length())); sb.append(name).append(EXT_SEP).append(ext); return getChild (sb.toString()); } }
public final synchronized FileObject[] getChildren () { check (); if (children == null) { return new FileObject[0]; } int size = children.length; ArrayList aList = new ArrayList(); for (int i = 0; i < size; i++) { FileObject f = getChild (children[i]); if (f != null) aList.add(f); } return (FileObject [])aList.toArray(new FileObject [0]); }
/** Retrieve file or folder contained in this folder by name. * <em>Note</em> that neither file nor folder is created on disk. * @param name basename of the file or folder (in this folder) * @param ext extension of the file; <CODE>null</CODE> or <code>""</code> * if the file should have no extension or if folder is requested * @return the object representing this file or <CODE>null</CODE> if the file * or folder does not exist * @exception IllegalArgumentException if <code>this</code> is not a folder */ public final synchronized FileObject getFileObject (String name, String ext) { check (); if (ext == null || ext.equals ("")) { // NOI18N return getChild (name); } else { StringBuffer sb = new StringBuffer(name.length() + 1 + ((ext == null) ? 0 : ext.length())); sb.append(name).append(EXT_SEP).append(ext); return getChild (sb.toString()); } }
/** Tries to find a resource if it exists in memory. * @param en enumeration of strings to scan * @return found object or null */ final Reference findRefIfExists (Enumeration en) { AbstractFolder fo = this; while (fo != null && en.hasMoreElements ()) { if (fo.map == null) { // this object is not initialized yet return null; } // try to go on // lock to provide safety for getChild synchronized (fo) { String name = (String)en.nextElement (); if (en.hasMoreElements()){ fo = fo.getChild(name); }else{ return((Reference)fo.map.get(name)); } } } // no next requirements or not found return null; }
/** Tries to find a resource. * @param en enumeration of strings to scan * @return found object or null */ final FileObject find (Enumeration en) { AbstractFolder fo = this; while (fo != null && en.hasMoreElements ()) { // try to go on // lock to provide safety for getChild synchronized (fo) { // JST: Better to call the check only here, // than in getChild, than it is not called // so often. fo.check (); fo = fo.getChild ((String)en.nextElement ()); } } // no next requirements or not found return fo; }
/** Tries to find a resource. * @param en enumeration of strings to scan * @return found object or null */ final FileObject find (Enumeration en) { AbstractFolder fo = this; while (fo != null && en.hasMoreElements ()) { // try to go on // lock to provide safety for getChild synchronized (fo) { // JST: Better to call the check only here, // than in getChild, than it is not called // so often. fo.check (); fo = fo.getChild ((String)en.nextElement ()); } } // no next requirements or not found return fo; }