我必须在 objectdb 中实现一个查询并且几乎没有什么想法。
问题是写一个查询
Returns the collection of all laptops each of which has at least one
other laptop preinstalled with the same processor.
我的笔记本电脑课是
public class Laptop {
String modelName; // key
int price; // in dollars
boolean hasHDScreen; // has a HD Screen ?
int hardDriveCapacity; // in GB
Processor processor; // the preinstalled processor
Memory memory; // the preinstalled memory
Company madeBy; // the inverse of company.makeLaptops
}
我的处理器类是
public class Processor {
String modelName; // key
float clockSpeed; // in gigahertz (GHz)
Company madeBy; // the inverse of Company.makeProcessors
}
我的函数定义也如下所示
public static Collection<Laptop> sameProcessor(Query q) {
/* Returns the collection of all laptops each of which has at least one
* other laptop preinstalled with the same processor.
*/
q.setClass(Laptop.class);
q.setFilter("this.processor == ");
}
我怎样才能实现它?SQL 也可以。
谢谢