Return a duplicate of given dataflow fact.

@param fact
a dataflow fact
@return a duplicate of the input dataflow fact
13791
private UnconditionalValueDerefSet duplicateFact(UnconditionalValueDerefSet fact) {
        UnconditionalValueDerefSet copyOfFact = createFact();
        copy(fact, copyOfFact);
        fact = copyOfFact;
        return fact;
    }
184149
public static <T> BinaryOperator<T> throwingMerger() {
        return (u, v) -> {
            throw new IllegalArgumentException(String.format("Duplicate key: value %s was already present now %s is added", u, v));
        };
    }
1263615
public boolean isDuplicateHTTP() {
		String dupeType = get(CAPTURE_DUPLICATE_ANNOTATION);
		return (dupeType != null && dupeType.equals(CAPTURE_DUPLICATE_HTTP));
	}
695506
public static boolean cs_dupl(Scs A) {
        int i, j, p, q, nz = 0, n, m, Ap[], Ai[], w[];
        float Ax[];
        if (!Scs_util.CS_CSC(A))
            return (false);
        /* check inputs */
        m = A.m;
        n = A.n;
        Ap = A.p;
        Ai = A.i;
        Ax = A.x;
        w = new int[m]; /* get workspace */
        for (i = 0; i < m; i++)
            w[i] = -1; /* row i not yet seen */
        for (j = 0; j < n; j++) {
            q = nz; /* column j will start at q */
            for (p = Ap[j]; p < Ap[j + 1]; p++) {
                i = Ai[p]; /* A(i,j) is nonzero */
                if (w[i] >= q) {
                    Ax[w[i]] += Ax[p]; /* A(i,j) is a duplicate */
                } else {
                    w[i] = nz; /* record where row i occurs */
                    Ai[nz] = i; /* keep A(i,j) */
                    Ax[nz++] = Ax[p];
                }
            }
            Ap[j] = q; /* record start of column j */
        }
        Ap[n] = nz; /* finalize A */
        return Scs_util.cs_sprealloc(A, 0); /* remove extra space from A */
    }
701869
private void duplicateProperties(final String spaceId,
                                     final String contentId, final Map<String, String> sourceProperties)
        throws TaskExecutionFailedException {
        log.info("Duplicating properties for " + contentId + " in space "
                 + spaceId + " in account " + dupTask.getAccount());

        try {
            new Retrier().execute(new Retriable() {
                @Override
                public String retry() throws Exception {
                    // Set properties
                    try {
                        destStore.setContentProperties(spaceId, contentId, sourceProperties);
                    } catch (StorageStateException ex) {
                        String message = "Unable to set content properties" +
                                         " on destination store ({0}) for " +
                                         "{1} (content) in {2} (space)";
                        log.warn(MessageFormat.format(message, destStore, contentId, spaceId));
                    }

                    return "success";

                }
            });

            log.info("Successfully duplicated properties for " + contentId
                     + " in space " + spaceId + " in account "
                     + dupTask.getAccount());

        } catch (Exception e) {
            String msg = "Error attempting to duplicate content properties: " + e.getMessage();
            throw new DuplicationTaskExecutionFailedException(
                buildFailureMessage(msg), e);
        }
    }
1241919
@Override
    public INDArray unsafeDuplication() {
        WorkspaceUtils.assertValidArray(this, "Cannot duplicate array");
        if (isView())
            return this.dup(this.ordering());

        DataBuffer rb = Nd4j.getMemoryManager().getCurrentWorkspace() == null ? Nd4j.getDataBufferFactory().createSame(this.data, false) : Nd4j.getDataBufferFactory().createSame(this.data, false, Nd4j.getMemoryManager().getCurrentWorkspace());

        INDArray ret = Nd4j.createArrayFromShapeBuffer(rb, this.shapeInfoDataBuffer());

        val perfD = PerformanceTracker.getInstance().helperStartTransaction();

        Pointer.memcpy(ret.data().addressPointer(), this.data().addressPointer(), this.data().length() * this.data().getElementSize());

        PerformanceTracker.getInstance().helperRegisterTransaction(0, perfD, this.data().length() * this.data().getElementSize(), MemcpyDirection.HOST_TO_HOST);

        return ret;
    }
204450
public static Object duplicateArray(Object source) {

        int size = Array.getLength(source);
        Object newarray =
            Array.newInstance(source.getClass().getComponentType(), size);

        System.arraycopy(source, 0, newarray, 0, size);

        return newarray;
    }
645542
def copy(self):
        '''
        
        '''
        dup = super(Conditional, self).copy()
        condition = self._condition.copy()
        condition.invalidate(self)
        dup._condition = condition
        return dup
685697
private static Object safeDuplicate(Object message) {
        if (message instanceof ByteBuf) {
            return ((ByteBuf) message).retainedDuplicate();
        } else if (message instanceof ByteBufHolder) {
            return ((ByteBufHolder) message).retainedDuplicate();
        } else {
            return ReferenceCountUtil.retain(message);
        }
    }
406090
private static ImmutableList<Fact> makeElementFacts(
      String label, DuplicateGroupedAndTyped elements, ElementFactGrouping grouping) {
    if (elements.isEmpty()) {
      return ImmutableList.of();
    }

    if (grouping == ALL_IN_ONE_FACT) {
      return ImmutableList.of(fact(keyToGoWithElementsString(label, elements), elements));
    }

    ImmutableList.Builder<Fact> facts = ImmutableList.builder();
    facts.add(simpleFact(keyToServeAsHeader(label, elements)));
    int n = 1;
    for (Multiset.Entry<?> entry : elements.entrySet()) {
      int count = entry.getCount();
      Object item = entry.getElement();
      facts.add(fact(numberString(n, count), item));
      n += count;
    }
    return facts.build();
  }
355315
public long factMatching(long n) {
    return match(n)
        .when(caseLong(0)).get(() -> 1L)
        .when(caseLong(any())).get(i -> i * factMatching(i - 1))
        .getMatch();
  }
38460
public boolean assertFact(final Object behaviorContext,
                              final InternalFactHandle factHandle,
                              final PropagationContext pctx,
                              final InternalWorkingMemory workingMemory) {
        boolean result = true;
        for ( int i = 0; i < behaviors.length; i++ ) {
            result = result && behaviors[i].assertFact( ((Object[]) behaviorContext)[i],
                                                        factHandle,
                                                        pctx,
                                                        workingMemory );
        }
        return result;
    }
558189
public KvStateInfo<K, N, V> duplicate() {
		final TypeSerializer<K> dupKeySerializer = keySerializer.duplicate();
		final TypeSerializer<N> dupNamespaceSerializer = namespaceSerializer.duplicate();
		final TypeSerializer<V> dupSVSerializer = stateValueSerializer.duplicate();

		if (
			dupKeySerializer == keySerializer &&
			dupNamespaceSerializer == namespaceSerializer &&
			dupSVSerializer == stateValueSerializer
		) {
			return this;
		}

		return new KvStateInfo<>(dupKeySerializer, dupNamespaceSerializer, dupSVSerializer);

	}
816780
def duplicate(self, contributor=None, inherit_collections=False):
        """"""
        duplicate = Entity.objects.get(id=self.id)
        duplicate.pk = None
        duplicate.slug = None
        duplicate.name = 'Copy of {}'.format(self.name)
        duplicate.duplicated = now()
        if contributor:
            duplicate.contributor = contributor

        duplicate.save(force_insert=True)

        assign_contributor_permissions(duplicate)

        # Override fields that are automatically set on create.
        duplicate.created = self.created
        duplicate.save()

        # Duplicate entity's data objects.
        data = get_objects_for_user(contributor, 'view_data', self.data.all())  # pylint: disable=no-member
        duplicated_data = data.duplicate(contributor)
        duplicate.data.add(*duplicated_data)

        if inherit_collections:
            collections = get_objects_for_user(
                contributor,
                'add_collection',
                self.collections.all()  # pylint: disable=no-member
            )
            for collection in collections:
                collection.entity_set.add(duplicate)
                copy_permissions(collection, duplicate)
                collection.data.add(*duplicated_data)
                for datum in duplicated_data:
                    copy_permissions(collection, datum)

        return duplicate
791342
public static boolean cs_dupl(DZcs A)
	{
		int i, j, p, q, nz = 0, n, m, Ap[], Ai[], w[] ;
		DZcsa Ax = new DZcsa() ;
		if (!CS_CSC (A)) return (false) ;		/* check inputs */
		m = A.m ; n = A.n ; Ap = A.p ; Ai = A.i ; Ax.x = A.x ;
		w = new int [m] ;				/* get workspace */
//		if (w == null) return (false) ;			/* out of memory */
		for (i = 0 ; i < m ; i++) w [i] = -1 ;		/* row i not yet seen */
		for (j = 0 ; j < n ; j++)
		{
			q = nz ;				/* column j will start at q */
			for (p = Ap [j] ; p < Ap [j+1] ; p++)
			{
				i = Ai [p] ;			/* A(i,j) is nonzero */
				if (w [i] >= q)
				{
					Ax.set(w [i], cs_cplus(Ax.get(w [i]), Ax.get(p))); /* A(i,j) is a duplicate */
				}
				else
				{
					w [i] = nz ;		/* record where row i occurs */
					Ai [nz] = i ;		/* keep A(i,j) */
					Ax.set(nz++, Ax.get(p)) ;
				}
			}
			Ap [j] = q ;				/* record start of column j */
		}
		Ap [n] = nz ;					/* finalize A */
		w = null ;
		return (cs_sprealloc (A, 0)) ;			/* remove extra space from A */
	}
875551
def _is_duplicate_record(self, rtype, name, content):
        """"""
        records = self._list_records(rtype, name, content)
        is_duplicate = len(records) >= 1
        if is_duplicate:
            LOGGER.info('Duplicate record %s %s %s, NOOP', rtype, name, content)
        return is_duplicate
1364946
@Override
    public void transfer(BasicBlock basicBlock, @CheckForNull InstructionHandle end, Fact start, Fact result)
            throws DataflowAnalysisException {
        copy(start, result);

        if (isFactValid(result)) {
            Iterator<InstructionHandle> i = isForwards() ? basicBlock.instructionIterator() : basicBlock
                    .instructionReverseIterator();

            while (i.hasNext()) {
                InstructionHandle handle = i.next();
                if (handle == end) {
                    break;
                }

                if (DEBUG && end == null) {
                    System.out.print("Transfer " + handle);
                }

                // Transfer the dataflow value
                transferInstruction(handle, basicBlock, result);

                if (DEBUG && end == null) {
                    System.out.println(" ==> " + result.toString());
                }
            }
        }
    }