private void displayInstances(PrintStream outps, Iterable<ServerInstanceLogRecordList> repResults) {
        boolean isZOS = false;
        ArrayList<DisplayInstance> unsortedInstances = new ArrayList<DisplayInstance>();

        Comparator<DisplayInstance> comparator = new Comparator<DisplayInstance>() {
            @Override
            public int compare(DisplayInstance serverList1, DisplayInstance serverList2) {
                long time1 = serverList1.getValue();
                long time2 = serverList2.getValue();

                if (time1 < time2) {
                    return -1;
                } else if (time1 > time2) {
                    return 1;
                }

                return 0;
            }
        };

        //setup spaces
        char[] spacesAr = new char[MAX_ZCOLUMN_SIZE]; //choose the larger of the two
        for (int i = 0; i < spacesAr.length; i++) {
            spacesAr[i] = ' ';
        }
        spaces = new String(spacesAr);

        //gather all the instances and convert to a display object
        for (ServerInstanceLogRecordList list : repResults) {
            //determine platform
            isZOS = "Y".equalsIgnoreCase(list.getHeader().getProperty(ServerInstanceLogRecordList.HEADER_ISZOS));

            ArrayList<DisplayInstance> kidResult = new ArrayList<DisplayInstance>();

            long kidTimeStamp = collectAllKids(kidResult, list);

            //if kids exist or current instance has records
            if (kidTimeStamp > 0) {
                if (list.iterator().next() == null) {
                    //if the current instance doesn't have any records, it won't be displayed. A timestamp
                    //still needs to be provided so that the instance can be sorted accordingly if it has kids,
                    //so provide the kid's timestamp
                    unsortedInstances.add(new DisplayInstance("", "", kidTimeStamp, kidResult));
                } else {
                    long timestamp = list.getStartTime().getTime();
                    unsortedInstances.add(new DisplayInstance(Long.toString(timestamp), "", timestamp, kidResult));
                }
            }
        }

        printInstances(unsortedInstances, comparator, false, isZOS);
    }
private void displayInstances ( PrintStream outps , Iterable < ServerInstanceLogRecordList > repResults ) { boolean isZOS = false ; ArrayList < DisplayInstance > unsortedInstances = new ArrayList < DisplayInstance > ( ) ; Comparator < DisplayInstance > comparator = new Comparator < DisplayInstance > ( ) { @ Override public int compare ( DisplayInstance serverList1 , DisplayInstance serverList2 ) { long time1 = serverList1 . getValue ( ) ; long time2 = serverList2 . getValue ( ) ; if ( time1 < time2 ) { return - 1 ; } else if ( time1 > time2 ) { return 1 ; } return 0 ; } } ; char [ ] spacesAr = new char [ MAX_ZCOLUMN_SIZE ] ; for ( int i = 0 ; i < spacesAr . length ; i ++ ) { spacesAr [ i ] = ' ' ; } spaces = new String ( spacesAr ) ; for ( ServerInstanceLogRecordList list : repResults ) { isZOS = "Y" . equalsIgnoreCase ( list . getHeader ( ) . getProperty ( ServerInstanceLogRecordList . HEADER_ISZOS ) ) ; ArrayList < DisplayInstance > kidResult = new ArrayList < DisplayInstance > ( ) ; long kidTimeStamp = collectAllKids ( kidResult , list ) ; if ( kidTimeStamp > 0 ) { if ( list . iterator ( ) . next ( ) == null ) { unsortedInstances . add ( new DisplayInstance ( "" , "" , kidTimeStamp , kidResult ) ) ; } else { long timestamp = list . getStartTime ( ) . getTime ( ) ; unsortedInstances . add ( new DisplayInstance ( Long . toString ( timestamp ) , "" , timestamp , kidResult ) ) ; } } } printInstances ( unsortedInstances , comparator , false , isZOS ) ; }
/*
Displays the main and subprocesses instance IDs from all the server instances