Get the total number of bonds inside an IChemFile.

@param file       The IChemFile object.
@return           The number of Bond object inside.
559755
public static int getBondCount(IChemFile file) {
        int count = 0;
        for (int i = 0; i < file.getChemSequenceCount(); i++) {
            count += ChemSequenceManipulator.getBondCount(file.getChemSequence(i));
        }
        return count;
    }
815393
static boolean getLoadLocalLibsFirstForFile(final File file) {
        Attributes attributes = loadMainAttributes(file);
        if (null == attributes) {
            return false;
        }
        boolean loadFirstDefault=true;
        String loadFirst = attributes.getValue(RUNDECK_PLUGIN_LIBS_LOAD_FIRST);
        if(null!=loadFirst){
            return Boolean.valueOf(loadFirst);
        }
        return loadFirstDefault;
    }
664605
public static int getBondCount(IChemSequence sequence) {
        int count = 0;
        for (int i = 0; i < sequence.getChemModelCount(); i++) {
            count += ChemModelManipulator.getBondCount(sequence.getChemModel(i));
        }
        return count;
    }
1206847
public static String getFileMD5String(File file) throws IOException {
        MessageDigest messageDigest = getMessageDigest(MD5);
        return getFileHashString(file, messageDigest);
    }
215717
public static List<IChemObject> getAllChemObjects(IChemFile file) {
        List<IChemObject> list = new ArrayList<IChemObject>();
        //list.add(file); // should not add the original file
        for (int i = 0; i < file.getChemSequenceCount(); i++) {
            list.add(file.getChemSequence(i));
            list.addAll(ChemSequenceManipulator.getAllChemObjects(file.getChemSequence(i)));
        }
        return list;
    }
127759
private IChemFile readChemFile(IChemFile file) {
        IChemSequence chemSequence = file.getBuilder().newInstance(IChemSequence.class);

        int number_of_atoms;
        StringTokenizer tokenizer;

        try {
            String line = input.readLine();
            while (line.startsWith("#"))
                line = input.readLine();
            /*
             * while (input.ready() && line != null) {
             */
            //        logger.debug("lauf");
            // parse frame by frame
            tokenizer = new StringTokenizer(line, "\t ,;");

            String token = tokenizer.nextToken();
            number_of_atoms = Integer.parseInt(token);
            String info = input.readLine();

            IChemModel chemModel = file.getBuilder().newInstance(IChemModel.class);
            IAtomContainerSet setOfMolecules = file.getBuilder().newInstance(IAtomContainerSet.class);

            IAtomContainer m = file.getBuilder().newInstance(IAtomContainer.class);
            m.setTitle(info);

            String[] types = new String[number_of_atoms];
            double[] d = new double[number_of_atoms];
            int[] d_atom = new int[number_of_atoms]; // Distances
            double[] a = new double[number_of_atoms];
            int[] a_atom = new int[number_of_atoms]; // Angles
            double[] da = new double[number_of_atoms];
            int[] da_atom = new int[number_of_atoms]; // Diederangles
            //Point3d[] pos = new Point3d[number_of_atoms]; // calculated positions

            int i = 0;
            while (i < number_of_atoms) {
                line = input.readLine();
                //          logger.debug("line:\""+line+"\"");
                if (line == null) break;
                if (line.startsWith("#")) {
                    // skip comment in file
                } else {
                    d[i] = 0d;
                    d_atom[i] = -1;
                    a[i] = 0d;
                    a_atom[i] = -1;
                    da[i] = 0d;
                    da_atom[i] = -1;

                    tokenizer = new StringTokenizer(line, "\t ,;");
                    int fields = tokenizer.countTokens();

                    if (fields < Math.min(i * 2 + 1, 7)) {
                        // this is an error but cannot throw exception
                    } else if (i == 0) {
                        types[i] = tokenizer.nextToken();
                        i++;
                    } else if (i == 1) {
                        types[i] = tokenizer.nextToken();
                        d_atom[i] = Integer.valueOf(tokenizer.nextToken()) - 1;
                        d[i] = Double.valueOf(tokenizer.nextToken());
                        i++;
                    } else if (i == 2) {
                        types[i] = tokenizer.nextToken();
                        d_atom[i] = Integer.valueOf(tokenizer.nextToken()) - 1;
                        d[i] = Double.valueOf(tokenizer.nextToken());
                        a_atom[i] = Integer.valueOf(tokenizer.nextToken()) - 1;
                        a[i] = Double.valueOf(tokenizer.nextToken());
                        i++;
                    } else {
                        types[i] = tokenizer.nextToken();
                        d_atom[i] = Integer.valueOf(tokenizer.nextToken()) - 1;
                        d[i] = Double.valueOf(tokenizer.nextToken());
                        a_atom[i] = Integer.valueOf(tokenizer.nextToken()) - 1;
                        a[i] = Double.valueOf(tokenizer.nextToken());
                        da_atom[i] = Integer.valueOf(tokenizer.nextToken()) - 1;
                        da[i] = Double.valueOf(tokenizer.nextToken());
                        i++;
                    }
                }
            }

            // calculate cartesian coordinates
            Point3d[] cartCoords = ZMatrixTools.zmatrixToCartesian(d, d_atom, a, a_atom, da, da_atom);

            for (i = 0; i < number_of_atoms; i++) {
                m.addAtom(file.getBuilder().newInstance(IAtom.class, types[i], cartCoords[i]));
            }

            //        logger.debug("molecule:"+m);

            setOfMolecules.addAtomContainer(m);
            chemModel.setMoleculeSet(setOfMolecules);
            chemSequence.addChemModel(chemModel);
            line = input.readLine();
            file.addChemSequence(chemSequence);
        } catch (IOException e) {
            // should make some noise now
            file = null;
        }
        return file;
    }
1363765
public String getSummaryFromFile(String file, int length) throws IOException
    {
        return getSummary(new FileReader(file), length);
    }
860696
@Override
    public int getConnectedAtomsCount(IAtom atom) {
        int count = 0;
        for (int i = 0; i < bondCount; i++) {
            if (bonds[i].contains(atom)) ++count;
        }
        return count;
    }
2906
private String getPathRelativeToSourceSet(File file) {
    Path absolutePath = Paths.get(file.getAbsolutePath());
    Path basePath = Paths.get(task.getProject().file("src").getAbsolutePath() + File.separator + getSourceSetNameFromFile(file));
    return basePath.relativize(absolutePath).toString();
  }
943618
private double getFileAge(File file) {
        final Date d = new Date();
        final long modified = file.lastModified();
        final double time = (d.getTime() - modified) / 1000.0 / 60.0;
        LOGGER.debug("Lock file age is {} minutes", time);
        return time;
    }
660879
public String linkTo(@javax.annotation.Nonnull final File file) throws IOException {
    return codeFile(file);
  }
469592
private byte[] getFileContents(File file) {
    if (file.exists()) {
      try {
        return FileUtil.getFileContents(file);
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
    return null;
  }
97625
public static String getFileExtension(File file) {
		return com.google.common.io.Files.getFileExtension(file.getName());
	}
763898
public static List<File> findAllFile(File file) {
        if (file == null || !file.exists()) {
            return Collections.emptyList();
        }

        if (file.isFile()) {
            return Collections.singletonList(file);
        }

        List<File> fileList = new ArrayList<>();
        File[] files = file.listFiles();
        for (File f : files) {
            fileList.addAll(findAllFile(f));
        }

        return fileList;
    }
591583
public Iterable<InlineHintModel> getHintsForFile(FileModel file)
    {
        GraphTraversal<Vertex, Vertex> inlineHintPipeline = new GraphTraversalSource(getGraphContext().getGraph()).V(file.getElement());
        inlineHintPipeline.in(FileReferenceModel.FILE_MODEL);
        inlineHintPipeline.has(WindupVertexFrame.TYPE_PROP, Text.textContains(InlineHintModel.TYPE));
        return new FramedVertexIterable<>(getGraphContext().getFramed(), inlineHintPipeline.toList(), InlineHintModel.class);
    }
760688
public static int getLinkCount(File fileName) throws IOException {
    if (fileName == null) {
      throw new IOException(
          "invalid argument to getLinkCount: file name is null");
    }
    if (!fileName.exists()) {
      throw new FileNotFoundException(fileName + " not found.");
    }

    // construct and execute shell command
    String[] cmd = getHardLinkCommand.linkCount(fileName);
    String inpMsg = null;
    String errMsg = null;
    int exitValue = -1;
    BufferedReader in = null;
    BufferedReader err = null;

    Process process = Runtime.getRuntime().exec(cmd);
    try {
      exitValue = process.waitFor();
      in = new BufferedReader(new InputStreamReader(
                                  process.getInputStream()));
      inpMsg = in.readLine();
      err = new BufferedReader(new InputStreamReader(
                                   process.getErrorStream()));
      errMsg = err.readLine();
      if (inpMsg == null || exitValue != 0) {
        throw createIOException(fileName, inpMsg, errMsg, exitValue, null);
      }
      if (osType == OSType.OS_TYPE_SOLARIS) {
        String[] result = inpMsg.split("\\s+");
        return Integer.parseInt(result[1]);
      } else {
        return Integer.parseInt(inpMsg);
      }
    } catch (NumberFormatException e) {
      throw createIOException(fileName, inpMsg, errMsg, exitValue, e);
    } catch (InterruptedException e) {
      throw createIOException(fileName, inpMsg, errMsg, exitValue, e);
    } finally {
      process.destroy();
      if (in != null) in.close();
      if (err != null) err.close();
    }
  }
69897
@Pure
	public static boolean isDbaseFile(File file) {
		return FileType.isContentType(
				file,
				MimeName.MIME_DBASE_FILE.getMimeConstant());
	}