-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
728 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
...rc/main/java/com/the_qa_company/qendpoint/core/iterator/utils/GraphFilteringTripleId.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
package com.the_qa_company.qendpoint.core.iterator.utils; | ||
|
||
import com.the_qa_company.qendpoint.core.enums.ResultEstimationType; | ||
import com.the_qa_company.qendpoint.core.enums.TripleComponentOrder; | ||
import com.the_qa_company.qendpoint.core.exceptions.NotImplementedException; | ||
import com.the_qa_company.qendpoint.core.triples.IteratorTripleID; | ||
import com.the_qa_company.qendpoint.core.triples.TripleID; | ||
|
||
public class GraphFilteringTripleId implements IteratorTripleID { | ||
private final IteratorTripleID iterator; | ||
private final long[] graphIds; | ||
private TripleID next; | ||
|
||
public GraphFilteringTripleId(IteratorTripleID iterator, long[] graphIds) { | ||
this.iterator = iterator; | ||
this.graphIds = graphIds; | ||
} | ||
|
||
@Override | ||
public boolean hasPrevious() { | ||
throw new NotImplementedException(); | ||
} | ||
|
||
@Override | ||
public TripleID previous() { | ||
throw new NotImplementedException(); | ||
} | ||
|
||
@Override | ||
public void goToStart() { | ||
throw new NotImplementedException(); | ||
} | ||
|
||
@Override | ||
public boolean canGoTo() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public void goTo(long pos) { | ||
throw new NotImplementedException(); | ||
} | ||
|
||
@Override | ||
public long estimatedNumResults() { | ||
return iterator.estimatedNumResults(); | ||
} | ||
|
||
@Override | ||
public ResultEstimationType numResultEstimation() { | ||
return iterator.numResultEstimation(); | ||
} | ||
|
||
@Override | ||
public TripleComponentOrder getOrder() { | ||
return iterator.getOrder(); | ||
} | ||
|
||
@Override | ||
public long getLastTriplePosition() { | ||
return iterator.getLastTriplePosition(); | ||
} | ||
|
||
@Override | ||
public boolean isLastTriplePositionBoundToOrder() { | ||
return iterator.isLastTriplePositionBoundToOrder(); | ||
} | ||
|
||
@Override | ||
public boolean hasNext() { | ||
if (next != null) { | ||
return true; | ||
} | ||
while (iterator.hasNext()) { | ||
TripleID val = iterator.next(); | ||
|
||
long g = val.getGraph(); | ||
for (long graphId : graphIds) { | ||
if (graphId == g) { | ||
next = val; | ||
return true; | ||
} | ||
} | ||
// can't find valid graph | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
public TripleID next() { | ||
if (!hasNext()) { | ||
return null; | ||
} | ||
TripleID newVal = next; | ||
next = null; | ||
return newVal; | ||
} | ||
|
||
@Override | ||
public void remove() { | ||
throw new NotImplementedException(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.