Skip to content

Commit

Permalink
Merge pull request #319 from DimitriPlotnikov/master
Browse files Browse the repository at this point in the history
Bugfix release: replace a class that is not available in openjdk
  • Loading branch information
Plotnikov authored Dec 7, 2016
2 parents f059957 + 23b7b50 commit 3e85b5c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docker/DockerfileRelease
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ RUN python setup.py install
# Define working directory.doc
RUN mkdir -p /data/nestml/target/
WORKDIR /data/nestml/target/
RUN wget https://github.com/nest/nestml/releases/download/1.4.2/nestml.jar
RUN wget https://github.com/nest/nestml/releases/download/1.4.3/nestml.jar

# Define default command.
# Entry point is constructed in the invoking script
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>nestml</groupId>
<artifactId>nestml-core</artifactId>
<version>1.4.2</version>
<version>1.4.3</version>

<properties>
<!-- .. Libraries ..................................................... -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,7 @@
*/
package org.nest.units.unitrepresentation;

import com.google.common.base.Preconditions;
import javafx.util.Pair;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.TreeSet;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand Down Expand Up @@ -241,7 +233,7 @@ private boolean factorize(List<Factor> factors, UnitRepresentation workingCopy)

UnitRepresentation base = SIData.getBaseRepresentations().get(baseName);
//match base in workingCopy
Pair<Integer,UnitRepresentation> match = workingCopy.match(base);
Map.Entry<Integer,UnitRepresentation> match = workingCopy.match(base);
UnitRepresentation remainder = match.getValue();
Factor factor = new Factor(baseName,match.getKey());
orderedResults.add(new FactorizationResult(remainder,factor));
Expand Down Expand Up @@ -271,15 +263,15 @@ private boolean factorize(List<Factor> factors, UnitRepresentation workingCopy)
return false;
}

private Pair<Integer, UnitRepresentation> match(UnitRepresentation base) {
private Map.Entry<Integer,UnitRepresentation> match(UnitRepresentation base) {
if(this.contains(base)){ //base is factor with positive exponent
int exponent = 1;
while(this.contains(base.pow(++exponent))){} //step up until we lose match
exponent--; //step back once
return new Pair(exponent,this.divideBy(base.pow(exponent)));
return new AbstractMap.SimpleEntry<>(exponent,this.divideBy(base.pow(exponent)));

}else{ //base is not a factor: return division result anyways so we can expand if nothing else matches
return new Pair(1,this.divideBy(base));
return new AbstractMap.SimpleEntry<>(1,this.divideBy(base));
}
}

Expand Down

0 comments on commit 3e85b5c

Please sign in to comment.