Skip to content

Commit e54ce38

Browse files
committed
Fix javadoc for module "triples" (#396)
1 parent f53a156 commit e54ce38

File tree

4 files changed

+52
-10
lines changed

4 files changed

+52
-10
lines changed

metafacture-triples/src/main/java/org/metafacture/triples/AbstractTripleSort.java

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,20 @@
3535
* @author markus geipel
3636
*
3737
*/
38-
public abstract class AbstractTripleSort extends DefaultObjectPipe<Triple, ObjectReceiver<Triple>> implements MemoryWarningSystem.Listener {
38+
public abstract class AbstractTripleSort extends DefaultObjectPipe<Triple, ObjectReceiver<Triple>>
39+
implements MemoryWarningSystem.Listener {
40+
3941
/**
40-
* specifies the comparator
42+
* Specifies the comparator. Can be one of {@link #SUBJECT}, {@link #PREDICATE},
43+
* {@link #OBJECT}, {@link #ALL}.
4144
*/
4245
public enum Compare {
4346
SUBJECT, PREDICATE, OBJECT, ALL
4447
}
4548

4649
/**
47-
* sort order
48-
*
50+
* Specifies the sort order.Can be one of {@link #INCREASING},
51+
* {@link #DECREASING}.
4952
*/
5053
public enum Order {
5154
INCREASING {
@@ -63,17 +66,17 @@ public int order(final int indicator) {
6366
public abstract int order(int indicator);
6467
}
6568

66-
private final List<Triple> buffer = new ArrayList<Triple>();
67-
private final List<File> tempFiles;
69+
private final List<Triple> buffer = new ArrayList<>();
70+
private final List<File> tempFiles = new ArrayList<>();
6871
private Compare compare = Compare.SUBJECT;
6972
private Order order = Order.INCREASING;
7073
private volatile boolean memoryLow;
7174

72-
public AbstractTripleSort() {
75+
/**
76+
* Constructs an AbstractTripleSort. Calls {@link #MemoryWarningSystem}.
77+
*/
78+
protected AbstractTripleSort() {
7379
MemoryWarningSystem.addListener(this);
74-
tempFiles = new ArrayList<File>(); // Initialized here to let the
75-
// compiler enforce the call to
76-
// super() in subclasses.
7780
}
7881

7982
@Override
@@ -192,6 +195,13 @@ public final Comparator<Triple> createComparator() {
192195
return createComparator(compare, order);
193196
}
194197

198+
/**
199+
* Creates a Comparator.
200+
*
201+
* @param compareBy one of {@link #Compare}
202+
* @param order the {@link #Order}
203+
* @return a Comparator of type Triple
204+
*/
195205
public static Comparator<Triple> createComparator(final Compare compareBy, final Order order) {
196206
final Comparator<Triple> comparator;
197207
switch (compareBy) {

metafacture-triples/src/main/java/org/metafacture/triples/SortedTripleFileFacade.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ public final class SortedTripleFileFacade {
3737
private Triple triple;
3838
private boolean empty;
3939

40+
/**
41+
* Constructs a SortedTripleFileFacade with a file. Reads a Triple from the
42+
* file.
43+
*
44+
* @param file the File to load a Triple from
45+
* @throws IOException
46+
*/
4047
public SortedTripleFileFacade(final File file) throws IOException {
4148
this.file = file;
4249
in = new ObjectInputStream(new BufferedInputStream(new FileInputStream(file), BUFFERSIZE));
@@ -58,6 +65,10 @@ private void next() throws IOException {
5865
}
5966
}
6067

68+
/**
69+
* Closes the {@link #ObjectInputStream} and deletes the {@value #file} it if it
70+
* exists.
71+
*/
6172
public void close() {
6273
try {
6374
in.close();
@@ -70,13 +81,24 @@ public void close() {
7081
}
7182
}
7283

84+
/**
85+
* Peeks at a Triple at the top of the stack.
86+
*
87+
* @return the Triple on top of the stack
88+
*/
7389
public Triple peek() {
7490
if (isEmpty()) {
7591
return null;
7692
}
7793
return triple;
7894
}
7995

96+
/**
97+
* Pops a Triple from the stack.
98+
*
99+
* @return the Triple at the top of the stack.
100+
* @throws IOException
101+
*/
80102
public Triple pop() throws IOException {
81103
final Triple nextTriple = peek();
82104
next();

metafacture-triples/src/main/java/org/metafacture/triples/TripleCollect.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ public void process(final Triple triple) {
6767
}
6868
}
6969

70+
/**
71+
* Decodes a Triple. Passes the Predicate and the Object to the receiver.
72+
*
73+
* @param triple the Triple
74+
*/
7075
public void decodeTriple(final Triple triple) {
7176
if (triple.getObjectType() == ObjectType.STRING) {
7277
getReceiver().literal(triple.getPredicate(), triple.getObject());

metafacture-triples/src/main/java/org/metafacture/triples/TripleWriter.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ public final class TripleWriter extends DefaultObjectReceiver<Triple> {
4545

4646
private ObjectOutputStream outputStream;
4747

48+
/**
49+
* Constructs a TripleWriter with a given file name as output path.
50+
*
51+
* @param filename the name of the file to write to
52+
*/
4853
public TripleWriter(final String filename) {
4954
this.filename = filename;
5055
resetStream();

0 commit comments

Comments
 (0)