class A {
public int changeAccesses(int id, String filePath, int newAccesses) throws DirectoryInconsistencyException {
if (id < 0 || id >= directories.size()) {
throw new DirectoryInconsistencyException(EXC_ID_INVALID);
}
return directories.get(id).changeAccesses(filePath, newAccesses);
}
public IGComputationTree run(int id) throws DirectoryInconsistencyException {
if (id < 0 || id >= directories.size()) {
throw new DirectoryInconsistencyException(EXC_ID_INVALID);
}
return directories.get(id).runSplitting();
}
public ProbabilityDirectoryTree printDir(int id) throws DirectoryInconsistencyException {
if (id < 0 || id >= directories.size()) {
throw new DirectoryInconsistencyException(EXC_ID_INVALID);
}
return directories.get(id).getFileTree();
}
}
Could be written as:
class A {
public int changeAccesses(Id id, String filePath, int newAccesses) throws DirectoryInconsistencyException {
return directories.get(id).changeAccesses(filePath, newAccesses);
}
public IGComputationTree run(Id id) throws DirectoryInconsistencyException {
return directories.get(id).runSplitting();
}
public ProbabilityDirectoryTree printDir(id id) throws DirectoryInconsistencyException {
return directories.get(id).getFileTree();
}
}
What it does
Note the repeated if with throw
Lint Name
No response
Category
oop
Example
Could be written as: