Skip to content

Commit

Permalink
- fix bug report for astar graphdb in orientechnologies#7103 issue
Browse files Browse the repository at this point in the history
 -fix null checking in astar function .
 - add toCalendar method as we discussed on Better support for time expression orientechnologies#7081.
 - add some test cases for toCalendar Method . (need to be documented) .
  • Loading branch information
saeedtabrizi committed Jan 27, 2017
1 parent 31e5f1b commit 14d8dd6
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
<scope>provided</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/com.ibm.icu/icu4j -->
<!-- https://mvnrepository.com/artifact/com.ibm.icu/icu4j 58 -->
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,11 @@ public OCalendar setDate(int year,int month,int day, int hour, int minute, int s
this.calendar.setTimeZone(com.ibm.icu.util.TimeZone.getTimeZone(timezoneid));
} catch (Exception ex) {
// do nothhing

}



return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import java.util.TimeZone;

/**
* @author Saeed Tabrizi (saeed a_t nowcando.com)
* @author Saeed Tabrizi (saeed a_t nowcando.com)
*/
public class OSQLMethodToCalendar extends OAbstractSQLMethod {

Expand All @@ -37,6 +37,10 @@ public class OSQLMethodToCalendar extends OAbstractSQLMethod {
OCalendar.CAL_WEDNESDAY, OCalendar.CAL_THURSDAY, OCalendar.CAL_FRIDAY};
private short[] yearHolidaysDefault = new short[]{};





public OSQLMethodToCalendar() {
super(NAME, 0, 3);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,18 @@ public class OTimeSpan {
private long totalMilis =0;

private long days =0;

private byte hours =0;
private byte minutes =0;

private byte seconds =0;
private long milis =0;
private boolean isStartGreater = false;

public OTimeSpan(Date start,Date end){
try{


long diff = end.getTime() - start.getTime();
if(diff<0) this.isStartGreater=true;
this.totalDays = Math.floorDiv(diff,MilisPerDay) ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import static org.junit.Assert.assertEquals;


/**
* Tests the "toCalendar()" method implemented by the OSQLMethodToCalendar class. Note
* that the only input to the execute() method from the OSQLMethod interface
Expand All @@ -24,6 +25,7 @@ public class OSQLMethodToCalendarTest {

private OSQLMethodToCalendar function;


@Before
public void setup() {
function = new OSQLMethodToCalendar();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* <p>
* If property is not defined in edge or is null, distance between vertexes are 0 .
*
* @author Saeed Tabrizi (saeed a_t nowcando.com)
* @author Saeed Tabrizi (saeed a_t nowcando.com)
*/
public class OSQLFunctionAstar extends OSQLFunctionHeuristicPathFinderAbstract {
public static final String NAME = "astar";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import static org.junit.Assert.assertEquals;

/*
* @author Saeed Tabrizi (saeed a_t nowcando.com)
* @author Saeed Tabrizi (saeed a_t nowcando.com)
*/
public class OSQLFunctionAstarTest {
private static int dbCounter = 0;
Expand Down

0 comments on commit 14d8dd6

Please sign in to comment.