All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.zthulj.zcopybook.model.ZCopyBook Maven / Gradle / Ivy

Go to download

Library helping to convert positionnal inputs (cobol) to json, using a copybook format

The newest version!
package com.github.zthulj.zcopybook.model;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Getter
@RequiredArgsConstructor
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public final class ZCopyBook {

    private final RootNode rootNode;
    private List> valueNodes;
    private int waitedLength;

    public static  ZCopyBook from(RootNode rootNodeCopybook){
        List> allValueNodes = new ArrayList<>();
        rootNodeCopybook.getChilds().forEach(
                (k,v) -> allValueNodes.addAll(v.getAllValueNodes())
        );
        final int waited = allValueNodes.stream().mapToInt(e->e.getCoordinates().getSize()).sum();
        return new ZCopyBook<>(rootNodeCopybook,allValueNodes, waited);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy