小编Vas*_*uli的帖子

使用JAVA合并多个XML文件的不同节点

例如A.xml B.xml ,我在 arrayList 中有一些 xml 文件,我想合并一些节点,而其余节点保持使用 java。我是新手,所以我不知道该怎么做。

一个xml:

<?xml version="1.0" encoding="UTF-8"?>
<nta>
<declaration>
    bool A, B;
    bool C;
</declaration>
<template>
    <location id="1"  x="10" y="10"/>
    <transition>
        <source ref="3"/>
    </transition>    
</template>
<system> system AND;</system>
</nta>
Run Code Online (Sandbox Code Playgroud)

B.xml:

<?xml version="1.0" encoding="UTF-8"?>
<nta>
<declaration>
    int f,k;
    bool D;
</declaration>
<template>
    <location id="100"  x="40" y="89"/>
    <transition>
        <source col="9"/>
    </transition>    
</template>
<system> system OR;</system>
</nta>
Run Code Online (Sandbox Code Playgroud)

和输出:

<?xml version="1.0" encoding="UTF-8"?>
<nta>
<declaration>
    bool A, B;
    bool C;
    int f,k;
    bool D;
</declaration>
<template>
    <location id="1"  x="10" …
Run Code Online (Sandbox Code Playgroud)

java xml merge

4
推荐指数
1
解决办法
5173
查看次数

使用pthreads加速C程序

我是新来的,而且我在编程方面也相对较新.我用C编写了一个程序,我需要使用pthread来加速它.我尝试使用OpenMP这样做,但我不知道如何调试它.此外,我需要找出程序是否使用pthreads和时间更快,但我不知道如何在我的代码中写这个.这是我的代码

enter code here
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <pthread.h>
#define NTHREADS 2
#define FYLLO(komvos) ((komvos) * 2 + 1)

long factorial(long);
void heap_function (int [], int, int );
void make_heap(long [], int );
void pop_heap(long [], int );

struct thread_data
{
long int    n;
long int k;
long *b;
};

main()
{

  long int n,k,c,fact=1;
  long *a,*b,*d,p[k];
  int i,j,rc;
  int q[]={2,3,4,5,6,7,8,9,12,13,14,15,16};
  pthread_t thread[NTHREADS];
  struct thread_data threada;
  for(i=0;i<NTHREADS;i++)
  {
    threada.n=n;
    threada.k=k;
    threada.b=b;
    pthread_create (&thread[i], NULL, (void *)&threada);
  } …
Run Code Online (Sandbox Code Playgroud)

c parallel-processing performance pthreads serial-processing

0
推荐指数
1
解决办法
522
查看次数