1 package org.kit.furia.fragment;
2
3 import java.io.FileNotFoundException;
4 import java.io.IOException;
5
6 import org.kit.furia.exceptions.IRException;
7 import org.kit.furia.fragment.soot.NoClassesFound;
8 import org.kit.furia.fragment.soot.NoClassesFoundByStealer;
9
10 import soot.util.cfgcmd.CFGGraphType;
11
12 /*
13 Furia-chan: An Open Source software license violation detector.
14 Copyright (C) 2008 Kyushu Institute of Technology
15
16 This program is free software: you can redistribute it and/or modify
17 it under the terms of the GNU General Public License as published by
18 the Free Software Foundation, either version 3 of the License, or
19 (at your option) any later version.
20
21 This program is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 GNU General Public License for more details.
25
26 You should have received a copy of the GNU General Public License
27 along with this program. If not, see <http://www.gnu.org/licenses/>.
28 */
29
30 /**
31 * FragmentExtractors take a directory with class files and extract all the
32 * fragments from it.
33 * @author Arnoldo Jose Muller Molina
34 */
35
36 public interface FragmentExtractor {
37
38
39
40 /**
41 * Extracts fragments from the given directory.
42 * Furia-chan's fragment file format is:
43 * <repetitions count>\t<fragment>\n
44 * where <repetitions count> is a string representation of an integer
45 * and <fragment> is a string representation of a tree (for example: a(b,c))
46 * @param directory Directory from where we will extract fragments.
47 * @param maxStructuresAllowed Maximum nodes per tree.
48 * @param minStructuresAllowed Minimum nodes per tree.
49 * @param outputPath Output path where logs will be written.
50 * @param outputFile The file where the fragments will be stored.
51 * @throws FileNotFoundException If the input or output files cannot be found.
52 * @throws NoClassesFound If no classes were found.
53 * @throws IOException If an IO error occurs.
54 * @throws IRException If some other error occurs it will be wrapped on this exception.
55 * @throws FragmentParseException If a fragment is not generated properly, this exception will be thrown. For debugging purposes.
56 */
57 public void extractMethodsFromDirectory(
58 final String directory,
59 final int maxStructuresAllowed, final int minStructuresAllowed,
60 final String outputPath, String outputFile) throws
61 FileNotFoundException, NoClassesFound, IOException, IRException, FragmentParseException;
62
63 }