This file contains hidden or 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
| public class Department { | |
| @PrimaryKey | |
| private long id; | |
| private String name; | |
| @OneToMany(className = "com.foo.domain.Employee", name = "works-in", column = "dept") | |
| private List<Employee> employees; |
This file contains hidden or 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
| select * from department where id = 14 |
This file contains hidden or 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
| select * from employee where id = 4028 |
This file contains hidden or 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
| public class Employee { | |
| @PrimaryKey | |
| private long id; | |
| private String name; | |
| @ManyToOne(className = "com.foo.domain.Department", name = "works-in", column = "dept") | |
| private Department department; |
This file contains hidden or 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
| public static boolean isPrime(int p, int k) { | |
| Random rand = new Random(); | |
| for (int i = 0; i < k; i++) { | |
| int a = rand.nextInt(p - 1) + 1; | |
| int pow = (int) Math.pow(a, p - 1); | |
| if (pow % p != 1) | |
| return false; | |
| } | |
| return true; | |
| } |
This file contains hidden or 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
| public static boolean isPrime(int p) { | |
| Random rand = new Random(); | |
| int a = rand.nextInt(p - 1) + 1; | |
| int pow = (int) Math.pow(a, p - 1); | |
| return pow % p == 1; | |
| } |
This file contains hidden or 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
| public static boolean isPrime(int n) { | |
| for (int i = 2; i < Math.floor(Math.sqrt(n)); i++) { | |
| if (n % i == 0) | |
| return false; | |
| } | |
| return true; | |
| } |
This file contains hidden or 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
| public static boolean isPrime(int n) { | |
| for (int i = 2; i < n - 1; i++) { | |
| if (n % i == 0) | |
| return false; | |
| } | |
| return true; | |
| } |
This file contains hidden or 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
| private List<Bean> getClientStubBeans() { | |
| String workingDir = System.getProperty("user.dir"); | |
| File stubDir = new File(workingDir + File.separator + "bin-test" + File.separator + "com\\foo\\client\\stub"); | |
| if (!stubDir.exists() || !stubDir.isDirectory()) { | |
| logger.error("Unable to load client stubs"); | |
| return new ArrayList<Bean>(); | |
| } | |
| return buildBeanDefinitions(stubDir); | |
| } |
This file contains hidden or 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
| private void addClasspathDependencies() { | |
| String workingDir = System.getProperty("user.dir"); | |
| // We need to add these libs to appease the ClassLoader Gods | |
| File lib = new File(workingDir + File.separator + "lib"); | |
| for (File file : lib.listFiles()) | |
| addToClasspath(file); | |
| // Add bin-test to the class path -- this is where the stubs are | |
| File binTest = new File(workingDir + File.separator + "bin-test"); |