Questions tagged [chain]

Use the tag "method-chaining' if referring to the invocation of multiple methods against a single object. Chaining is the general idea of linking many smaller processes together to form a large process.

Method Chaining allows you to run multiple methods against an object on one line of code.

For example in Java the methods setName and setAge are chained:

Person person = new Person();        //instantiate a new person object.
person.setName("Peter").setAge(21);  //set the name, and age of object person.

First the method setName is applied to the object, then setAge.

Each method returns an object, allowing any number of calls to be chained together in a single statement.

561 questions
4
votes
3 answers

Java reduce list to fallback chain

Suppose I have a List of some entities in Java like List entities = Arrays.asList(entity1, entity2, entity3...); I would like to reduce it into one instance of a chain object like: class EntityChain { private final Entity entity; …
kornisb
  • 260
  • 1
  • 12
4
votes
1 answer

how pipe() will performing read and write operations in node js?

var fs = require("fs"); var readStream= fs.createReadStream('input.txt'); var writeStream=fs.createWriteStream('output.txt'); readStream.pipe(writeStream); console.log("hello...world"); In the above program, readStream and writeStream…
Krishna Mohan
  • 159
  • 1
  • 11
4
votes
2 answers

amino acid binding site finding, protein database

I am trying to find whether the two atoms that belong to two different chains would be considered as 'bound' or not. This based on the fact that if the distance (euclidian, which could be find through the given x,y,z coordinates) is shorter than the…
aleatha
  • 93
  • 2
  • 8
4
votes
1 answer

Order column names in ascending order within dplyr chain

I have this data.frame: df <- structure(list(att_number = structure(1:3, .Label = c("0", "1", "2"), class = "factor"), `1` = structure(c(2L, 3L, 1L), .Label = c("1026891", …
maloneypatr
  • 3,562
  • 4
  • 23
  • 33
4
votes
1 answer

R Markovchain package - fitting the markov chain based on the states sequence matrix

I was trying to use the R markovchain package. I have a question regarding the markovchainFit function and the sequence matrix. By default the markovchainFit function is run with the sequence of states as the parameter. Then it is said in the…
Makavelli
  • 41
  • 4
4
votes
1 answer

Three.js | Tween chain : How to start multiple tween's simultaneous?

My code is : function move(){ var A = new TWEEN.Tween(meshA.position).to({ z: -10 }, 2000).start(); var B = new TWEEN.Tween(meshB.rotation).to({ z: Math.PI }, 2000); var C = new TWEEN.Tween(meshC.position).to({ x: 10 }, 2000); …
Treize Cinq
  • 417
  • 5
  • 16
4
votes
1 answer

Returning data from Parse promise chain

I think I have got my head around Parse promise chains, but what I don't understand is how I return my data from the functions (i) back up the promise chain and (ii) back to the calling method of my original JS code. Using the code below, the first…
Mark__C
  • 825
  • 1
  • 13
  • 24
4
votes
1 answer

How to cleanly/safely remove link from asynchronous communication chain

I have a chain of Akka actors K -> L -> M, where K sends messages to L, L sends message to M, and each can reply to its predecessor using the sender of a received message. My question is this: how can we safely unlink L from the chain, such that…
Daniel Ashton
  • 1,388
  • 11
  • 23
4
votes
1 answer

python celery: How to append a task to an old chain

I keep in my database, the reference to a chain. from tasks import t1, t2, t3 from celery import chain res = chain(t1.s(123)|t2.s()|t3.s())() res.get() How can I append an other task to this particular chain ? res.append(t2.s()) My goal is to be…
Guillaume Vincent
  • 13,355
  • 13
  • 76
  • 103
4
votes
2 answers

find consecutive nonzero values

I am trying to write a simple MATLAB program that will find the first chain (more than 70) of consecutive nonzero values and return the starting value of that consecutive chain. I am working with movement data from a joystick and there are a few…
CentauriAurelius
  • 504
  • 3
  • 21
3
votes
1 answer

Can chaining be abstracted in cypress?

I am writing a UI assertions test with cypress and I am seeing a lot of repeated chaining. Is there a way to abstract this out into a helper method for easier maintainability (and less code duplication)? example code: it('displays the table column…
Rinkala
  • 83
  • 4
3
votes
1 answer

Chaining of operators with .|> in Julia

I have an expression [1:5;] .|> [x->x^2, inv, x->2*x, -, isodd] taken from Julia documentation. The output is 5-element Vector{Real}: 1 0.5 6 -4 true Can somebody explain the chain of operations on each elements 1:5 in detail. I…
Vinod
  • 4,138
  • 11
  • 49
  • 65
3
votes
2 answers

Is there an R package to calculate 1st order transition matrix from a frequency table?

I have a frequency table aggregated from 800 millions of records and am wondering if I can use a package to calculate 1st order transition matrix from the frequency table, which is not symmetric because some state just never happened again. A sample…
smz
  • 263
  • 4
  • 11
3
votes
1 answer

Can finite state machines with conditional transitions be expressed as Markov chains?

I'd be curious to know whether finite state machines that have conditional transitions can be expressed as Markov chains? If they can't, what would be a good counterexample?
Szemeredi_31
  • 131
  • 2
3
votes
1 answer

Rust Lifetime issue when chaining local iterator in recursive function

I have a generic function which is called recursively and which can take arguments that can be converted into an iterator. I would like to chain the iterator which is passed as argument with the iterator created from a function local collection.…