diff options
Diffstat (limited to 'index/IndexCreator.java')
-rw-r--r-- | index/IndexCreator.java | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/index/IndexCreator.java b/index/IndexCreator.java index 76f8ebc..fc469ce 100644 --- a/index/IndexCreator.java +++ b/index/IndexCreator.java @@ -1,3 +1,24 @@ +/*+ + * Copyright 2012 rsiddharth + * Email: <rsiddharth@ninthfloor.org> + * + * This file is part of Scruf. + * + * Scruf is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + + package scruf.index; import java.io.*; @@ -33,21 +54,21 @@ public class IndexCreator { } } public boolean write() { - if(modified) - new WriteFile(index,indexContent.toString()).write(); - return modified; + if(modified) + new WriteFile(index,indexContent.toString()).write(); + return modified; } public File indexFile() { - return index; + return index; } private boolean shouldAdd(String fileName) { - String regex = ".*"+fileName+".*"; - // checks if fileName is already there in index. - boolean check1 = !(Pattern.compile(regex). - matcher(indexContent.toString()).find()); - // checks if fileName is index itself. - boolean check2 = !(Pattern.matches(fileName,"index")); - boolean add = (check1 && check2); - return add; + String regex = ".*"+fileName+".*"; + // checks if fileName is already there in index. + boolean check1 = !(Pattern.compile(regex). + matcher(indexContent.toString()).find()); + // checks if fileName is index itself. + boolean check2 = !(Pattern.matches(fileName,"index")); + boolean add = (check1 && check2); + return add; } -}
\ No newline at end of file +} |