Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Note: This library is still under development, and some concepts or features mig
```
dependencies {
...
implementation 'com.github.CST-Group:cst:1.6.0'
implementation 'com.github.CST-Group:cst:1.6.1'
}
```

Expand All @@ -53,7 +53,7 @@ Sometimes, the version number (tag) in this README gets out of date, as maintain
<dependency>
<groupId>com.github.CST-Group</groupId>
<artifactId>cst</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ java {
}


version = '1.6.0'
version = '1.6.1'

repositories {
mavenCentral()
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/br/unicamp/cst/representation/idea/Idea.java
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ private Float tryParseFloat(String value) {
try {
returnValue = Float.parseFloat(value);
} catch (Exception ex) {
returnValue = null;
returnValue = 0f;
}

return returnValue;
Expand All @@ -775,7 +775,7 @@ private Double tryParseDouble(String value) {
try {
returnValue = Double.parseDouble(value);
} catch (Exception ex) {
returnValue = null;
returnValue = 0.0;
}

return returnValue;
Expand All @@ -787,7 +787,7 @@ private Integer tryParseInteger(String value) {
try {
returnValue = Integer.parseInt(value);
} catch (Exception ex) {
returnValue = null;
returnValue = 0;
}

return returnValue;
Expand All @@ -799,7 +799,7 @@ private Long tryParseLong(String value) {
try {
returnValue = Long.parseLong(value);
} catch (Exception ex) {
returnValue = null;
returnValue = 0L;
}

return returnValue;
Expand All @@ -811,7 +811,7 @@ private Short tryParseShort(String value) {
try {
returnValue = Short.parseShort(value);
} catch (Exception ex) {
returnValue = null;
returnValue = 0;
}

return returnValue;
Expand All @@ -822,7 +822,7 @@ private Byte tryParseByte(String value) {
try {
returnValue = Byte.parseByte(value,16);
} catch (Exception ex) {
returnValue = null;
returnValue = 0x0;
}
return returnValue;
}
Expand Down
35 changes: 35 additions & 0 deletions src/test/java/br/unicamp/cst/representation/idea/TestIdea.java
Original file line number Diff line number Diff line change
Expand Up @@ -878,4 +878,39 @@ public List<ILoggingEvent> getLoggedEvents() {
assertTrue(a.equals(a1));
}

static class TestIdeaClass {
public double[] mirPose;
public TestIdeaClass() {
mirPose = null;
}
}

@Test public void testComplexConvertObject() {

Idea i0 = new Idea("root");
Idea i1 = new Idea("var");
Idea i = new Idea("mirPose");
i.add(new Idea("mirPose[0]",-5.800001621246338));
i.add(new Idea("mirPose[1]", -8.575002670288086));
i.add(new Idea("mirPose[2]", 0.2993086874485016));
i.add(new Idea("mirPose[3]", -0.0));
i.add(new Idea("mirPose[4]", 0.0));
i.add(new Idea("mirPose[5]",-0.0));
i0.add(i1);
i1.add(i);
System.out.println(i0.toStringFull());
TestIdeaClass n = new TestIdeaClass();
System.out.println(n);
Idea ii = i0.get("mirPose");
Idea ii2 = i.get("mirPose");
TestIdeaClass x = (TestIdeaClass) i0.getObject("var", "br.unicamp.cst.representation.idea.TestIdea$TestIdeaClass");
for (int k=0;k<6;k++) {
double vv = (double)i.get("mirPose["+k+"]").getValue();
System.out.println("class: "+x.mirPose[k]+" idea: "+vv);
assertEquals(x.mirPose[k],vv);
}
System.out.println(x);

}

}