You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@joshua.apache.org by mj...@apache.org on 2016/05/31 15:14:37 UTC
[6/9] incubator-joshua git commit: Fixed Word Alignment code using
linked lists
Fixed Word Alignment code using linked lists
Project: http://git-wip-us.apache.org/repos/asf/incubator-joshua/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-joshua/commit/fadc2855
Tree: http://git-wip-us.apache.org/repos/asf/incubator-joshua/tree/fadc2855
Diff: http://git-wip-us.apache.org/repos/asf/incubator-joshua/diff/fadc2855
Branch: refs/heads/master
Commit: fadc285571d45271f0829da3bb8b380833561794
Parents: b601067
Author: Felix Hieber <fh...@amazon.com>
Authored: Mon May 30 10:44:14 2016 +0200
Committer: Felix Hieber <fh...@amazon.com>
Committed: Mon May 30 10:44:14 2016 +0200
----------------------------------------------------------------------
lib/ivy.xml | 3 +--
src/joshua/decoder/hypergraph/AlignedSourceTokens.java | 11 ++++-------
2 files changed, 5 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/fadc2855/lib/ivy.xml
----------------------------------------------------------------------
diff --git a/lib/ivy.xml b/lib/ivy.xml
index d41595d..66034c6 100644
--- a/lib/ivy.xml
+++ b/lib/ivy.xml
@@ -1,12 +1,11 @@
<ivy-module version="2.0">
<info organisation="joshua" module="joshua"/>
<dependencies>
- <dependency org="net.sourceforge.ant-doxygen" name="ant-doxygen" rev="1.6.1" />
<dependency org="net.sf.jung" name="jung-algorithms" rev="2.0"/>
<dependency org="net.sf.jung" name="jung-api" rev="2.0"/>
<dependency org="net.sf.jung" name="jung-graph-impl" rev="2.0"/>
<dependency org="net.sf.jung" name="jung-visualization" rev="2.0"/>
- <dependency org="org.apache.commons" name="commons-cli" rev="1.2"/>
+ <dependency org="org.apache.commons" name="commons-cli" rev="1.3.1"/>
<dependency org="org.testng" name="testng" rev="6.7"/>
<dependency org="junit" name="junit" rev="4.10" />
<dependency org="net.sourceforge.collections" name="collections-generic" rev="4.01"/>
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/fadc2855/src/joshua/decoder/hypergraph/AlignedSourceTokens.java
----------------------------------------------------------------------
diff --git a/src/joshua/decoder/hypergraph/AlignedSourceTokens.java b/src/joshua/decoder/hypergraph/AlignedSourceTokens.java
index 5c6b2dd..cde7183 100644
--- a/src/joshua/decoder/hypergraph/AlignedSourceTokens.java
+++ b/src/joshua/decoder/hypergraph/AlignedSourceTokens.java
@@ -42,8 +42,7 @@ class AlignedSourceTokens extends LinkedList<Integer> {
/** whether the word this Point corresponds to has no alignment in source */
private boolean isNull = false;
- AlignedSourceTokens() {
- }
+ AlignedSourceTokens() {}
void setFinal() {
isFinal = true;
@@ -62,9 +61,7 @@ class AlignedSourceTokens extends LinkedList<Integer> {
* returns true if element was added.
*/
public boolean add(Integer x) {
- if (isNull || isNonTerminal)
- return false;
- return super.add(x);
+ return isNull ? false : super.add(x);
}
public boolean isNonTerminal() {
@@ -85,9 +82,9 @@ class AlignedSourceTokens extends LinkedList<Integer> {
*/
void shiftBy(int start, int shift) {
if (!isFinal && !isNull) {
- ListIterator<Integer> it = this.listIterator();
+ final ListIterator<Integer> it = this.listIterator();
while (it.hasNext()) {
- int x = it.next();
+ final int x = it.next();
if (x > start) {
it.set(x + shift);
}