示例#1
0
 Object createAtomSetCollectionFromString(
     String strModel, Map<String, Object> htParams, boolean isAppend) {
   setLoadState(htParams);
   boolean isAddH = (strModel.indexOf(JC.ADD_HYDROGEN_TITLE) >= 0);
   String[] fnames = (isAddH ? getFileInfo() : null);
   FileReader fileReader =
       new FileReader(
           this,
           viewer,
           "string",
           "string",
           "string",
           null,
           JmolBinary.getBR(strModel),
           htParams,
           isAppend);
   fileReader.run();
   if (fnames != null) setFileInfo(fnames);
   if (!isAppend && !(fileReader.getAtomSetCollection() instanceof String)) {
     viewer.zap(false, true, false);
     setFileInfo(
         new String[] {strModel == JC.MODELKIT_ZAP_STRING ? JC.MODELKIT_ZAP_TITLE : "string"});
   }
   return fileReader.getAtomSetCollection();
 }
示例#2
0
 /**
  * not used in Jmol project -- will close reader
  *
  * @param fullPathName
  * @param name
  * @param reader
  * @param htParams
  * @return fileData
  */
 Object createAtomSetCollectionFromReader(
     String fullPathName, String name, Object reader, Map<String, Object> htParams) {
   FileReader fileReader =
       new FileReader(this, viewer, name, fullPathName, name, null, reader, htParams, false);
   fileReader.run();
   return fileReader.getAtomSetCollection();
 }
示例#3
0
 /*
  * note -- createAtomSetCollectionFromXXX methods
  * were "openXXX" before refactoring 11/29/2008 -- BH
  *
  * The problem was that while they did open the file, they
  * (mostly) also closed them, and this was confusing.
  *
  * The term "clientFile" was replaced by "atomSetCollection"
  * here because that's what it is --- an AtomSetCollection,
  * not a file. The file is closed at this point. What is
  * returned is the atomSetCollection object.
  *
  * One could say this is just semantics, but there were
  * subtle bugs here, where readers were not always being
  * closed explicitly. In the process of identifying Out of
  * Memory Errors, I felt it was necessary to clarify all this.
  *
  * Apologies to those who feel the original clientFile notation
  * was more generalizable or understandable.
  *
  */
 Object createAtomSetCollectionFromFile(
     String name, Map<String, Object> htParams, boolean isAppend) {
   if (htParams.get("atomDataOnly") == null) {
     setLoadState(htParams);
   }
   name = viewer.resolveDatabaseFormat(name);
   int pt = name.indexOf("::");
   String nameAsGiven = (pt >= 0 ? name.substring(pt + 2) : name);
   String fileType = (pt >= 0 ? name.substring(0, pt) : null);
   Logger.info(
       "\nFileManager.getAtomSetCollectionFromFile("
           + nameAsGiven
           + ")"
           + (name.equals(nameAsGiven) ? "" : " //" + name));
   String[] names = classifyName(nameAsGiven, true);
   if (names.length == 1) return names[0];
   String fullPathName = names[0];
   String fileName = names[1];
   htParams.put(
       "fullPathName",
       (fileType == null ? "" : fileType + "::") + fullPathName.replace('\\', '/'));
   if (viewer.getBoolean(T.messagestylechime) && viewer.getBoolean(T.debugscript))
     viewer.scriptStatus("Requesting " + fullPathName);
   FileReader fileReader =
       new FileReader(
           this, viewer, fileName, fullPathName, nameAsGiven, fileType, null, htParams, isAppend);
   fileReader.run();
   return fileReader.getAtomSetCollection();
 }