Cocoa 提供了一个名为NSPredicate的类,用于指定过滤器的条件,用NSPredicate描述查询方式,原理类似于在数据库中进行查询。可以在数据库风格的API中使用NSPredicate类,常见的用于Core Data和Spotlight。 本文讲解过程中用到了部分类比如garage(车库的类),car(车)等仅供举例,未列出创建代码,体会predicate的用法才是关键。
创...
分类:
其他好文 时间:
2014-11-27 20:33:11
阅读次数:
198
在上一篇博文中,我们有拿一个简单的“汽车模型”来讲解复合关系。在今天的这篇博文中,我们将接着上一次的例子,讲解下存取(accessor)方法的使用。所谓存取方法,就是用来读取或改变某个对象属性的方法。如果添加一个方法去改变Car对象中的engine对象变量,那它就是一个存取方法。 存取方法分为...
分类:
其他好文 时间:
2014-11-27 00:07:40
阅读次数:
284
CD
You have a long drive by car ahead. You have a tape recorder, but unfortunately your best music is on CDs. You need to have it on tapes so the problem to solve is: you have a tape N m...
分类:
其他好文 时间:
2014-11-26 22:39:08
阅读次数:
280
There areNgas stations along a circular route, where the amount of gas at stationiisgas[i].You have a car with an unlimited gas tank and it costscost[...
分类:
其他好文 时间:
2014-11-25 23:08:49
阅读次数:
158
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
For example,
"A man, a plan, a canal: Panama" is a palindrome.
"race a car" is not a pa...
分类:
其他好文 时间:
2014-11-24 10:10:28
阅读次数:
152
Gas StationThere areNgas stations along a circular route, where the amount of gas at stationiisgas[i].You have a car with an unlimited gas tank and it...
分类:
其他好文 时间:
2014-11-23 23:04:52
阅读次数:
268
1240. Faulty OdometerConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionYou are given a car odometer which displays the miles traveled as an...
分类:
其他好文 时间:
2014-11-23 01:53:52
阅读次数:
139
忙了一天,GTK和QT环境搭建了!QT5(包含Creator和TOOLs),安装真慢,安装文件300MB,安装下载源文件700多MB,总共花了3/4个小时,主要因为,该网站限速,不到100KB/S的速度真是坑啊,本想着,弄好了也算了,不过,真正用起来,还是和安装一样蛋疼,只有中文面板选项,子菜单什么...
分类:
系统相关 时间:
2014-11-22 00:35:52
阅读次数:
247
依赖关系 Dependency
Class Car{}
Class Person{
int a;
static int b
public void buy(Car c){
int c;
....
}
}
一个类是另一个类的某个方法的参数,或局部变量,或静态方法调用等。
另外变量分两种:局部变量,成员变量。
在某个方法中定义的变量为局...
分类:
其他好文 时间:
2014-11-19 18:35:25
阅读次数:
120
成员对象: 一个类的成员变量是另一个类的对象
封闭类:包含成员对象的类
举个栗子:
class Tyre {
private:
int radius;
int width;
public:
Tyre(int r, int w):radius(r), width(w) { }
};
class Engine {
};
class Car {
// 这个类就是所谓...
分类:
编程语言 时间:
2014-11-19 11:22:06
阅读次数:
192