阐述
提升产品的性能,一方面可以从界面构造上入手,另一方面可以从业务数据处理上进行入手。
业务数据处理优化中,数据的筛选是很大一部分,这个过程中遇见了”NSPredicate”,感觉这个东西很不错,初步了解并记录一下,毕竟东西有点多。
谓词,用来描述或判定客体性质、特征或者客体之间关系的词项。
谓词:在计算机语言的环境下,谓词是指条件表达式的求值返回真或假的过程。
在Apple官方文档,对NSPredicate的描述如下:
A definition of logical conditions used to constrain a search either for a fetch or for in-memory filtering.
一种逻辑的定义,这种逻辑用于约束一个搜索条件,这个搜索条件可以用于数据的获取或者是内存数据的筛选.
2 谓词分哪几类
谓词分为两类 Comparision(比较) 和 Compound(混合) 。
官方文档中对种类的描述:
* A comparison predicate compares two expressions using an operator. The expressions are referred to as the left hand side and the right hand side of the predicate (with the operator in the middle). A comparison predicate returns the result of invoking the operator with the results of evaluating the expressions.
* A compound predicate compares the results of evaluating two or more other predicates, or negates another predicate.
大致意思:
比较谓词用操作符来评估比较两个表达式。这两个表达式一个在操作符的左侧,一个在操作符的右侧。比较谓词返回的是内部操作符与相关语句执行的
提升产品的性能,一方面可以从界面构造上入手,另一方面可以从业务数据处理上进行入手。
业务数据处理优化中,数据的筛选是很大一部分,这个过程中遇见了”NSPredicate”,感觉这个东西很不错,初步了解并记录一下,毕竟东西有点多。
探讨
1 谓词是什么
Predicate 翻译过来,是谓词的意思。
在百度中,对谓词描述如下:谓词,用来描述或判定客体性质、特征或者客体之间关系的词项。
谓词:在计算机语言的环境下,谓词是指条件表达式的求值返回真或假的过程。
在Apple官方文档,对NSPredicate的描述如下:
A definition of logical conditions used to constrain a search either for a fetch or for in-memory filtering.
一种逻辑的定义,这种逻辑用于约束一个搜索条件,这个搜索条件可以用于数据的获取或者是内存数据的筛选.
2 谓词分哪几类
谓词分为两类 Comparision(比较) 和 Compound(混合) 。
官方文档中对种类的描述:
* A comparison predicate compares two expressions using an operator. The expressions are referred to as the left hand side and the right hand side of the predicate (with the operator in the middle). A comparison predicate returns the result of invoking the operator with the results of evaluating the expressions.
* A compound predicate compares the results of evaluating two or more other predicates, or negates another predicate.
大致意思:
比较谓词用操作符来评估比较两个表达式。这两个表达式一个在操作符的左侧,一个在操作符的右侧。比较谓词返回的是内部操作符与相关语句执行的