Questions tagged [predicates]

Predicates are functions that return the boolean values, `True` or `False`.

In computing, Predicates are functions that return the boolean values, True or False. Some languages and frameworks treat them specially.

See also Wikipedia.

There are alternate (and possibly more mainstream) meanings. See Wikipedia.

108 questions
0
votes
5 answers

Predicate inside a Where<> query not hit?

I need to call the method for each item in the list. So, I have used Where<> query as follows, List list = new List(); list.Add("Name1"); list.Add("Name2"); list.Add("Name3"); var name = list.Where(n => { return…
Divakar
  • 514
  • 1
  • 9
  • 25
0
votes
1 answer

Predicates in coredata in objectivec

I have two tables in coredata Details and person. Person has two fields Id and Code: Id Code IAS RT IAS TP IAS IP Now,detailshas two fields,code and Name Code Name RT Rataz TP Tranzps IP Irrz Now I…
Prez
  • 227
  • 3
  • 12
0
votes
1 answer

Alloy - Count atoms used by other atoms

I'm trying to notice a change in atom relations to other atoms. Using the below signatures : sig Word, Definition{} sig Dictionary { def: Word -> lone Definition } I then use a predicate to show what happens when you add a new…
LEJ
  • 1,868
  • 4
  • 16
  • 24
0
votes
1 answer

Alloy - Check predicate is correct?

I'm currently playing around with predicates in Alloy. I know that I can use assert and check statements to confirm that my model is working as it should. However, is there any way to check that a predicate I have created has done what I expect? Or…
LEJ
  • 1,868
  • 4
  • 16
  • 24
0
votes
2 answers

Multiplicity with Predicates

So I have the following: some sig Person { friends : set Person } fact TransitiveForThree { one p1, p2, p3 : Person { p1 in p2.friends && p2 in p3.friends => p1 in p3.friends } } The idea is that I want there to exist a set of…
SirGoose
  • 131
  • 1
  • 2
  • 7
0
votes
1 answer

Hibernate Predicate search in joined table

I have 2 Entity: @Entity public class Organization { @Column(name = "name") public String name; @OneToMany(mappedBy = "organization") public Collection tin; } @Entity public class Tin { @Column(name = "name") public…
m.zemlyanoi
  • 335
  • 1
  • 5
  • 15
0
votes
3 answers

C/C++ Equivalent of Java Predicate

Is there a C/C++ equivalent structure/class of Predicate class in Java? Specifically, I have a very simple Java code as given below. import java.util.function.Predicate; public class JavaPredicates { public static void main(String[] args) { …
Samet Tonyalı
  • 214
  • 2
  • 9
0
votes
1 answer

Why does Predicates.instanceOf returns false?

I have a String s = { "code1" : { "price" : 100, "type" : null }, "code2" : { "price" : 110, "type" : null } } Then I do: Object p = Mapper.readValue(s, Person.class); So it executes…
dardy
  • 433
  • 1
  • 6
  • 18
0
votes
1 answer

building a predicate with no value expression

I'm trying to create an Expression> for IQueryable.OrderByDescending() This is in my base class for FindLast and I found that LastOrDefault will not work and thus an OrderByDescending.FirstOrDefault was necessary. However as stated…
Jessie Lulham
  • 110
  • 12
0
votes
2 answers

HElp with converting to first order logic

Using only these predicates..... child(X) X is a child unwell(X,Y) X is unwell on day Y location(X,Y,Z) Location of X on day Y is Z (school, park, home) sunny(X) X is a sunny day Generally, children do not go to school…
John
  • 4,413
  • 6
  • 25
  • 28
0
votes
2 answers

How to form a JPA query?

I have the table below: I want to form a query with the following rules: Get product1 where Type is not type1 and not type2 and Flavor is not flavor1. Type can be type1, type 2 or null. I formed my query like this: CriteriaBuilder cb =…
0
votes
1 answer

LIKE Predicate in Java. Does it Exist?

I have a requirement in which we have to search an object from a list of it. For example if we have a list of Persons object List userList = new ArrayList(); The User object would have first name and last name as parameters like this. …
0
votes
0 answers

Finding the XPATH attribute value using the last() predicate

XML file HP HM How to get value of the attribute "cover" using the last() predicate? The XPath specification…
SEgeek
  • 119
  • 2
  • 8
0
votes
1 answer

Distinguish between function calls and indexed arrays using ANTLR4

The syntax of a language is ambiguous in the sense that function names and indexed identifiers are written in an equal way: var = function(5) => function call where 5 is a parameter var = array(5) => element 5 of the array To be able to…
0
votes
1 answer

Assignment in loop predicate, are parentheses needed?

Here's a function in JavaScript that replaces the children of a node var app = {}; app.replaceChildren = function (node, childrenReplacementNode) { var child; while (child = node.firstChild) { node.removeChild(child); } …
OregonTrail
  • 8,594
  • 7
  • 43
  • 58