zoukankan      html  css  js  c++  java
  • Predicate Programming Guide

    https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Predicates/AdditionalChapters/Introduction.html#//apple_ref/doc/uid/TP40001789

    Predicates provide a general means of specifying queries in Cocoa. The predicate system is capable of handling a large number of domains, including Core Data and Spotlight. This document describes predicates in general, their use, their syntax, and their limitations.

    At a Glance

    In Cocoa, a predicate is a logical statement that evaluates to a Boolean value (true or false). There are two types of predicate, known as comparison and compound:

    • 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.

    • compound predicate compares the results of evaluating two or more other predicates, or negates another predicate.

    Cocoa supports a wide range of types of predicate, including the following:

    • Simple comparisons, such as grade == 7 or firstName like 'Mark'

    • Case or diacritic insensitive lookups, such as name contains[cd] 'citroen'

    • Logical operations, such as (firstName beginswith 'M') AND (lastName like 'Adderley')

    You can also create predicates for relationships—such as group.name matches 'work.*'ALL children.age > 12, and ANY children.age > 12—and for operations such as @sum.items.price < 1000

    Cocoa predicates provide a means of encoding queries in a manner that is independent of the store used to hold the data being searched. You use predicates to represent logical conditions used for constraining the set of objects retrieved by Spotlight and Core Data, and for in-memory filtering of objects.

    You can use predicates with any class of object, but a class must be key-value coding compliant for the keys you want to use in a predicate.

  • 相关阅读:
    mockito测试final类/static方法/自己new的对象
    flink 1.11.2 学习笔记(5)-处理消息延时/乱序的三种机制
    linux查找操作
    分析MongoDB架构案例
    legend3---bootstrap modal框出现蒙层,无法点击modal框内容(z-index问题)
    legend3---laravel报419错误
    laravel自定义中间件实例
    laravel中间件Middleware原理解析及实例
    git: Failed to connect to github.com port 443: Timed out
    记忆规律
  • 原文地址:https://www.cnblogs.com/feng9exe/p/7449921.html
Copyright © 2011-2022 走看看