Resolve a Marshaller with the given source and target class.
The marshaller is used as follows: Instances of the source can be marshalled into the target class.
@param source The source (input) class
@param target The target (output) class
424767
public <S, T> ToMarshaller<S, T> findMarshaller(Class<S> source, Class<T> target) {
		return findMarshaller(new ConverterKey<S,T>(source, target, DefaultBinding.class));
	}
162019
public void connectSource(int inputNumber, IntermediateResult source, JobEdge edge, int consumerNumber) {

		final DistributionPattern pattern = edge.getDistributionPattern();
		final IntermediateResultPartition[] sourcePartitions = source.getPartitions();

		ExecutionEdge[] edges;

		switch (pattern) {
			case POINTWISE:
				edges = connectPointwise(sourcePartitions, inputNumber);
				break;

			case ALL_TO_ALL:
				edges = connectAllToAll(sourcePartitions, inputNumber);
				break;

			default:
				throw new RuntimeException("Unrecognized distribution pattern.");

		}

		inputEdges[inputNumber] = edges;

		// add the consumers to the source
		// for now (until the receiver initiated handshake is in place), we need to register the
		// edges as the execution graph
		for (ExecutionEdge ee : edges) {
			ee.getSource().addConsumer(ee, consumerNumber);
		}
	}
1044812
public static void merge(String source, String target) throws IOException{
        final AtomicLong count = new AtomicLong();
        final AtomicLong lines = new AtomicLong();
        try(BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(target),"utf-8"))){
            Files.walkFileTree(Paths.get(source), new SimpleFileVisitor<Path>(){

                    @Override
                    public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
                        LOGGER.info("处理文件："+file);
                        try(BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file.toFile()),"utf-8"));){
                            String line;
                            while( (line = reader.readLine()) != null ){
                                count.addAndGet(line.length());
                                lines.incrementAndGet();
                                writer.write(line+"\n");
                            }
                        }
                        return FileVisitResult.CONTINUE;
                    }
                    
                });
        }
        LOGGER.info("语料库行数："+lines.get());
        LOGGER.info("语料库字符数目："+count.get());
    }
131644
public void copyInto(File source, File targetDir, final VariableResolver resolver) throws IOException{
        FileUtil.copyInto(source, targetDir, new FileUtil.FileCreator(){
            @Override
            public void createFile(File sourceFile, File targetFile) throws IOException{
                replace(new FileReader(sourceFile), new FileWriter(targetFile), resolver);
            }

            @Override
            public String translate(String name){
                return replace(name, resolver);
            }
        });
    }
382960
public static void copy(InputStream source, File destination) throws IOException {
        OutputStream output = null;

        try {
            output = new FileOutputStream(destination);
            copy(source, output);
        } finally {
            closeQuietly(output);
        }
    }
1062954
public static File copyFile(String source, String target) throws IOException {
        FileChannel inputChannel = null;
        FileChannel outputChannel = null;
        try {
            inputChannel = new FileInputStream(source).getChannel();
            outputChannel = new FileOutputStream(target).getChannel();
            outputChannel.transferFrom(inputChannel, 0, inputChannel.size());
        } finally {
            if (inputChannel != null) {
                inputChannel.close();
            }
            if (outputChannel != null) {
                outputChannel.close();
            }
        }
        return new File(target);
    }
638424
public static void copyProperties(Object target, Object source) throws IkasoaException {
		Class<?> sourceClz = source.getClass(), targetClz = target.getClass();
		Field[] fields = sourceClz.getDeclaredFields();
		if (fields.length == 0)
			fields = sourceClz.getSuperclass().getDeclaredFields();
		for (short i = 0; i < fields.length; i++) {
			String fieldName = fields[i].getName();
			Field targetField = null;
			try {
				targetField = targetClz.getDeclaredField(fieldName);
			} catch (NoSuchFieldException e) {
				try {
					targetField = targetClz.getSuperclass().getDeclaredField(fieldName);
				} catch (NoSuchFieldException | SecurityException e1) {
					throw new IkasoaException(e1);
				}
			}
			if (fields[i].getType() == targetField.getType()) {
				String getMethodName = new StringBuilder("get").append(fieldName.substring(0, 1).toUpperCase())
						.append(fieldName.substring(1)).toString();
				String setMethodName = new StringBuilder("set").append(fieldName.substring(0, 1).toUpperCase())
						.append(fieldName.substring(1)).toString();
				Method getMethod, setMethod;
				try {
					try {
						getMethod = sourceClz.getDeclaredMethod(getMethodName, new Class[] {});
					} catch (NoSuchMethodException e) {
						getMethod = sourceClz.getSuperclass().getDeclaredMethod(getMethodName, new Class[] {});
					}
					try {
						setMethod = targetClz.getDeclaredMethod(setMethodName, fields[i].getType());
					} catch (NoSuchMethodException e) {
						setMethod = targetClz.getSuperclass().getDeclaredMethod(setMethodName, fields[i].getType());
					}
					setMethod.invoke(target, getMethod.invoke(source, new Object[] {}));
				} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
					throw new IkasoaException(e);
				} catch (NoSuchMethodException e) {
				} catch (Exception e) {
					log.warn("Object copy failed : {}", e.getMessage());
				}
			} else {
				throw new IkasoaException("Object copy failed ! Attribute type error !");
			}
		}
	}
51754
public void load(Object source, Object target)
  {
    for (LoadField load : _loadFields) {
      load.load(source, target);
    }
  }
1040524
public static void copyDirectory(File source, File target) {
        if (source.isDirectory()) {
            if (!target.exists()) {
                target.mkdir();
            }
            for (String child : source.list()) {
                copyDirectory(new File(source, child), new File(target, child));
            }
        } else {
            try {
                write(new FileInputStream(source), new FileOutputStream(target));
            } catch (IOException e) {
                if (target.isDirectory()) {
                    if (!target.exists()) {
                        if (!target.mkdirs()) {
                            throw E.ioException("cannot copy [%s] to [%s]", source, target);
                        }
                    }
                    target = new File(target, source.getName());
                } else {
                    File targetFolder = target.getParentFile();
                    if (!targetFolder.exists()) {
                        if (!targetFolder.mkdirs()) {
                            throw E.ioException("cannot copy [%s] to [%s]", source, target);
                        }
                    }
                }
                try {
                    write(new FileInputStream(source), new FileOutputStream(target));
                } catch (IOException e0) {
                    throw E.ioException(e0);
                }
            }
        }
    }
188693
public static void copy(Struct source, Struct target, boolean overwrite) {
	Iterator<Entry<Key, Object>> it = source.entryIterator();
	Entry<Key, Object> e;
	while (it.hasNext()) {
	    e = it.next();
	    if (overwrite || !target.containsKey(e.getKey())) target.setEL(e.getKey(), e.getValue());
	}
    }
855627
public <S, T> FromUnmarshaller<S, T> findUnmarshaller(Class<S> source, Class<T> target) {
		return findUnmarshaller(new ConverterKey<S,T>(source, target, DefaultBinding.class));
	}
209101
public static void merge(List<String> sources, String target) throws IOException{
        //读取所有需要合并的词典
        Set<String> set = new HashSet<>();
        AtomicInteger i = new AtomicInteger();
        for(String source : sources){
            try(Stream<String> lines = Files.lines(Paths.get(source), Charset.forName("utf-8"))){
                lines.forEach(line -> {
                    i.incrementAndGet();
                    line = line.trim();
                    // 词长度：大于等于2并且小于等于4
                    // 识别功能 能识别的词 就不用放到词典中了，没必要多此一举
                    //至少要两个中文字符，防止大量无意义或特殊词混入词典
                    if (line.length() > 4
                            || line.length() < 2
                            || !Utils.isChineseCharAndLengthAtLeastTwo(line)
                            || RecognitionTool.recog(line)) {
                        LOGGER.debug("过滤：" + line);
                        return;
                    }
                    set.add(line);
                });
            }
        }
        LOGGER.info("合并词数："+i.get());
        LOGGER.info("保留词数："+set.size());
        List<String> list = set.stream().sorted().collect(Collectors.toList());
        Files.write(Paths.get(target), list, Charset.forName("utf-8"));
    }
3234
function(source, target) {
        var linkedTarget = $(target);
        clearLinkedData(target);
        $.each(source, function(key, sourceValue) {
            if (isInternal(key)) {
                return;
            }
            var targetValue = null;
            if ($.isPlainObject(sourceValue)) {
                targetValue = target[key];
                setLinkedData(sourceValue, targetValue);
            } else if ($.isArray(sourceValue)) {
                targetValue = target[key];
                $.each(sourceValue, function(index, arrayValue) {
                    var targetArrayValue = targetValue[index];
                    setLinkedData(arrayValue, targetArrayValue);
                });
            } else {
                linkedTarget.setField(key, sourceValue);
            }
            return;
        });
    }
775534
public void add(Object source) {
		if(source instanceof InputStream) {
			add((InputStream)source);
		} else if(source instanceof URL) {
			add((URL)source);
		} else if(source instanceof String) {
			add((String)source);
		} else {
			throw new JclException("Unknown Resource type");
		}

	}
836973
public static <T> void completeFrom(CompletionStage<T> source, CompletableFuture<T> target) {
    source.whenComplete(
        (t, error) -> {
          if (error != null) {
            target.completeExceptionally(error);
          } else {
            target.complete(t);
          }
        });
  }
744968
public static void copyResourceFile(String source, Path target) throws IOException {
        InputStream resource = FsCrawlerUtil.class.getResourceAsStream(source);
        FileUtils.copyInputStreamToFile(resource, target.toFile());
    }
692311
public static Map<String, Object> resolveTo(Map<String, Object> root, Map<String, Object> target)
	{
		resolve(target, root, "");
		return target;
	}