Example usage for java.lang StringBuffer setLength

List of usage examples for java.lang StringBuffer setLength

Introduction

In this page you can find the example usage for java.lang StringBuffer setLength.

Prototype

@Override
public synchronized void setLength(int newLength) 

Source Link

Usage

From source file:org.latticesoft.app.BeanCommand.java

/** Adds all the value from the child command to the parent command */
private void addReturnValueFromChild(BeanCommand cmd) {
    Map childMap = null;//  ww  w  .java 2 s .c o m
    StringBuffer sb = new StringBuffer();
    String prefix = cmd.getId();
    String opName = cmd.getOutputName();
    if (prefix == null) {
        prefix = cmd.getName();
    }
    Object o = cmd.getReturnValue();
    if (o instanceof Map) {
        childMap = (Map) o;
        Iterator iter = childMap.keySet().iterator();
        while (iter.hasNext()) {
            Object key = iter.next();
            Object value = null;
            if (key != null) {
                value = childMap.get(key);
            }
            if (key != null && value != null && prefix != null) {
                sb.setLength(0);
                sb.append(prefix).append(".").append(key);
                this.returnValue.put(sb.toString(), value);
            }
        }
    } else if (opName != null) {
        sb.append(prefix).append(cmd.getOutputName());
        this.returnValue.put(sb.toString(), o);
    }

}

From source file:org.latticesoft.util.common.FileUtil.java

/**
 * Using OS api to copy file/*from   w ww  .ja va  2s .  c o  m*/
 */
public static void copyFileUsingOS(String src, String tgt) {
    String s = System.getProperty("os.name");
    String sep = System.getProperty("file.separator");
    s = s.toLowerCase();
    StringBuffer sb = new StringBuffer();
    if (s.indexOf("win") > -1) {
        File fSrc = new File(src);
        File fTgt = new File(tgt);
        if (fSrc.isDirectory()) {
            if (!fTgt.exists()) {
                fTgt.mkdir();
            }
            sb.setLength(0);
            sb.append("xcopy /q /s ");
            sb.append(FileUtil.getWinPath(src));
            sb.append(sep);
            sb.append("*.* ");
            sb.append(FileUtil.getWinPath(tgt));
        } else if (fSrc.isFile()) {
            sb.setLength(0);
            sb.append("xcopy /q ");
            sb.append(FileUtil.getWinPath(src));
            sb.append(" ");
            sb.append(FileUtil.getWinPath(fTgt.getParent()));
            sb.append(sep);
        }
    } else {
        File fSrc = new File(src);
        File fTgt = new File(tgt);
        if (fSrc.isDirectory()) {
            if (!fTgt.exists()) {
                fTgt.mkdir();
            }
            sb.setLength(0);
            sb.append("cp -r ");
            sb.append(FileUtil.getWinPath(src));
            sb.append(sep);
            sb.append("*.* ");
            sb.append(FileUtil.getWinPath(tgt));
        } else if (fSrc.isFile()) {
            sb.setLength(0);
            sb.append("cp ");
            sb.append(FileUtil.getWinPath(src));
            sb.append(" ");
            sb.append(FileUtil.getWinPath(tgt));
        }
    }
    try {
        if (log.isDebugEnabled()) {
            log.debug(sb.toString());
        }
        Process p = Runtime.getRuntime().exec(sb.toString());
        InputStream err = p.getErrorStream();
        InputStream in = p.getInputStream();
        RuntimeMessagePrinter rmpIn = new RuntimeMessagePrinter(in, "IN ");
        RuntimeMessagePrinter rmpErr = new RuntimeMessagePrinter(err, "ERR");
        rmpIn.start();
        rmpErr.start();
        p.waitFor();
    } catch (Exception e) {
        if (log.isErrorEnabled()) {
            log.error(StringUtil.getStackTraceMessage(e));
        }
    }
}

From source file:com.bstek.dorado.core.el.ExpressionUtilsObject.java

public java.util.Date calculateDate(java.util.Date date, String expression) {
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(date);//w w w .java2 s  .  co m

    if (StringUtils.isNotBlank(expression)) {
        char fieldChar = 0;
        int field = 0, offset = 0;
        boolean offsetFound = false;
        StringBuffer numText = new StringBuffer();
        for (int i = 0, len = expression.length(); i < len; i++) {
            char c = expression.charAt(i);
            if (c == ' ' || c == ',' || c == ';') {
                if (field != 0) {
                    if (numText.length() == 0) {
                        throw new IllegalArgumentException(
                                "Argument missed for Date field \"" + fieldChar + "\".");
                    }

                    int num = Integer.parseInt(numText.toString());
                    if (offset == 0) {
                        calendar.set(field, num);
                    } else {
                        calendar.add(field, num * offset);
                    }
                }

                fieldChar = 0;
                field = 0;
                offset = 0;
                offsetFound = false;
                numText.setLength(0);
            } else if (field == 0) {
                switch (c) {
                case 'y':
                case 'Y':
                    field = Calendar.YEAR;
                    break;
                case 'M':
                    field = Calendar.MONTH;
                    break;
                case 'd':
                    field = Calendar.DAY_OF_MONTH;
                    break;
                case 'h':
                case 'H':
                    field = Calendar.HOUR_OF_DAY;
                    break;
                case 'm':
                    field = Calendar.MINUTE;
                    break;
                case 's':
                    field = Calendar.SECOND;
                    break;
                case 'z':
                case 'Z':
                    field = Calendar.MILLISECOND;
                    break;
                default:
                    throw new IllegalArgumentException("Unknown Date field \"" + c + "\".");
                }
                fieldChar = c;
            } else if (!offsetFound && numText.length() == 0) {
                if (c == '+') {
                    offset = 1;
                    offsetFound = true;
                } else if (c == '-') {
                    offset = -1;
                    offsetFound = true;
                }
            } else if (c >= '0' && c <= '9') {
                numText.append(c);
            }
        }

        if (field != 0) {
            if (numText.length() == 0) {
                throw new IllegalArgumentException("Argument missed for Date field \"" + fieldChar + "\".");
            }

            int num = Integer.parseInt(numText.toString());
            if (offset == 0) {
                calendar.set(field, num);
            } else {
                calendar.add(field, num * offset);
            }
        }
    }

    return calendar.getTime();
}

From source file:org.eclipse.linuxtools.sequoyah.device.network.telnet.TelnetWrapper.java

/**
 * @param tokenArray/*  w  w  w.jav a  2 s  .  com*/
 * @return
 * @throws IOException
 */
private String readUntilTokens(final String[] tokenArray) throws IOException {
    String matchedString = null;
    boolean tokenFound = false;
    StringBuffer readData = new StringBuffer();

    HashMap<String, Integer> hashMap = new HashMap<String, Integer>();

    for (int i = 0; i < tokenArray.length; i++) {
        hashMap.put(tokenArray[i], new Integer(0));
    }

    for (int i = 0; i < this.maxResponseDataLength; i++) {

        int aux = inStream.read();

        char ch = 0;
        if (aux == 0 || aux == 1) {
            continue;
        } else {
            ch = (char) aux;
        }
        readData.append(ch);

        // if (ch != 1 && ch != 0)
        //    logger.info(ch);

        for (int j = 0; j < tokenArray.length; j++) {
            String token = tokenArray[j];
            Integer rank = hashMap.get(token);
            if (ch == token.charAt(rank)) {
                rank++;
                if (rank >= token.length()) {
                    // MATCHED
                    readData.setLength(readData.length() - token.length());
                    matchedString = token;
                    tokenFound = true;
                }
            } else {
                rank = 0;
            }
            hashMap.put(token, rank);
        }
        if (tokenFound) {
            break;
        }
    }
    this.lastResponse = readData;
    return matchedString;
}

From source file:org.pentaho.di.core.row.ValueDataUtil.java

protected static Object multiplyString(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB,
        Object dataB) throws KettleValueException {
    StringBuffer s;
    String append = "";
    int n;//from   ww w  . j  a v a 2  s .co  m
    if (metaB.isString()) {
        s = new StringBuffer(metaB.getString(dataB));
        append = metaB.getString(dataB);
        n = metaA.getInteger(dataA).intValue();
    } else {
        s = new StringBuffer(metaA.getString(dataA));
        append = metaA.getString(dataA);
        n = metaB.getInteger(dataB).intValue();
    }

    if (n == 0) {
        s.setLength(0);
    } else {
        for (int i = 1; i < n; i++) {
            s.append(append);
        }
    }

    return s.toString();
}

From source file:com.sonicle.webtop.mail.MultipartIterator.java

/**
 * Retrieves the next element in the iterator if one exists.
 *
 * @throws a ServletException if the post size exceeds the maximum file size
 *         passed in the 3 argument constructor
 * @throws an UnsupportedEncodingException if the "ISO-8859-1" encoding isn't found
 * @return a {@link org.apache.struts.upload.MultipartElement MultipartElement}
 *         representing the next element in the request data
 *
 *//*  w w  w  . j  a  v  a 2s .  co m*/
public MultipartElement getNextElement() throws ServletException, UnsupportedEncodingException {
    //retrieve the "Content-Disposition" header
    //and parse
    String disposition = readLine();

    if ((disposition != null) && (disposition.startsWith("Content-Disposition"))) {
        String name = parseDispositionName(disposition);
        String filename = parseDispositionFilename(disposition);

        String contentType = null;
        boolean isFile = (filename != null);

        if (isFile) {
            filename = new File(filename).getName();

            //check for windows filenames,
            //from linux jdk's the entire filepath
            //isn't parsed correctly from File.getName()
            int colonIndex = filename.indexOf(":");
            if (colonIndex == -1) {
                //check for Window's SMB server file paths
                colonIndex = filename.indexOf("\\\\");
            }
            int slashIndex = filename.lastIndexOf("\\");

            if ((colonIndex > -1) && (slashIndex > -1)) {
                //then consider this filename to be a full
                //windows filepath, and parse it accordingly
                //to retrieve just the file name
                filename = filename.substring(slashIndex + 1, filename.length());
            }

            //get the content type
            contentType = readLine();
            contentType = parseContentType(contentType);
        }

        //ignore next line (whitespace) (unless it's a file
        //without content-type)
        if (!((isFile) && contentType == null)) {
            readLine();
        }

        MultipartElement element = null;

        //process a file element
        if (isFile) {
            try {
                //create a local file on disk representing the element
                if (fileObjectDir == null) {
                    File elementFile = createLocalFile();
                    element = new MultipartElement(name, filename, contentType, elementFile);
                } else {
                    FileObject elementFile = createVFSFile(filename);
                    filename = elementFile.getName().getBaseName();
                    element = new MultipartElement(name, filename, contentType, elementFile);
                }

            } catch (IOException ioe) {
                Service.logger.error("Exception", ioe);
                throw new ServletException("IOException while reading file element: " + ioe.getMessage(), ioe);
            }
        } else {
            //read data into String form, then convert to bytes
            //for text
            StringBuffer textData = new StringBuffer();
            String line;
            //parse for text data
            line = readLine();

            while ((line != null) && (!line.startsWith(boundary))) {
                textData.append(line);
                line = readLine();
            }

            if (textData.length() > 0) {
                //cut off "\r" from the end if necessary
                if (textData.charAt(textData.length() - 1) == '\r') {
                    textData.setLength(textData.length() - 1);
                }
            }

            //create the element
            element = new MultipartElement(name, textData.toString());
        }
        return element;
    }

    //reset stream
    if (inputStream.markSupported()) {
        try {
            inputStream.reset();
        } catch (IOException ioe) {
            throw new ServletException("IOException while resetting input stream: " + ioe.getMessage());
        }
    }
    return null;
}

From source file:opennlp.tools.textsimilarity.TextProcessor.java

private static HashSet<String> extractCommonSegments(Pair<List<String>, Map<String, HashSet<Integer>>> objA,
        Pair<List<String>, Map<String, HashSet<Integer>>> objB, Integer segSize) {

    HashSet<String> commonSegments = new HashSet<String>();

    List<String> tokensA = objA.getFirst();

    Map<String, HashSet<Integer>> tokenPosB = objB.getSecond();

    HashSet<Integer> lastPositions = null;
    int segLength = 1;
    StringBuffer segmentStr = new StringBuffer();

    for (int i = 0; i < tokensA.size(); i++) {
        String token = tokensA.get(i);
        HashSet<Integer> positions = null;
        // if ((positions = tokenPosB.get(token)) != null &&
        // !token.equals("<punc>") &&
        // !StopList.getInstance().isStopWord(token) && token.length()>1) {
        if ((positions = tokenPosB.get(token)) != null) {
            // we have a list of positions
            if (lastPositions != null) {
                // see if there is overlap in positions
                if (hasNextPosition(lastPositions, positions)) {
                    segLength++;/*from   ww w  . j ava 2 s  .  c  o m*/

                    commonSegments.remove(segmentStr.toString().trim());
                    segmentStr.append(" ");
                    segmentStr.append(token);
                    if (StringUtils.countMatches(segmentStr.toString(), " ") >= segSize) {
                        commonSegments.add(segmentStr.toString().trim());
                    }
                    lastPositions = positions;

                } else {
                    // did not find segment, reset
                    segLength = 1;
                    segmentStr.setLength(0);
                    lastPositions = null;
                }
            } else {
                lastPositions = positions;
                segmentStr.append(" ");
                segmentStr.append(token);
            }
        } else {
            // did not find segment, reset
            segLength = 1;
            segmentStr.setLength(0);
            lastPositions = null;
        }
    }

    return commonSegments;
}

From source file:com.bstek.dorado.config.text.DispatchableTextParser.java

protected String parseHeader(char[] charArray, TextParseContext context) throws TextParseException {
    int status;/*w  w w .  j a  v  a  2  s  . c o  m*/
    status = BEFORE_HEADER;
    StringBuffer headerStack = new StringBuffer();
    int startIndex = context.getCurrentIndex();
    for (int currentIndex = startIndex; currentIndex < charArray.length
            && status != AFTER_HEADER; currentIndex++) {
        char c = charArray[currentIndex];
        context.setCurrentIndex(currentIndex);

        switch (status) {
        case BEFORE_HEADER:
            if (isIgnoredChar(c)) {
                continue;
            } else if (c == ':' || c == ';') {
                throw new TextParseException(charArray, context);
            } else {
                headerStack.append(c);
                status = IN_HEADER;
            }
            break;
        case IN_HEADER:
            if (isIgnoredChar(c)) {
                status = AFTER_HEADER;
            } else if (c == ':' || c == ';') {
                headerStack.setLength(0);
                status = AFTER_HEADER;
            } else {
                headerStack.append(c);
            }
            break;
        }
    }

    if (status != AFTER_HEADER) {
        context.increaseCurrentIndex();
    }
    String header = null;
    if (headerStack.length() > 0) {
        header = headerStack.toString();
    } else {
        context.setCurrentIndex(startIndex);
    }
    return header;
}

From source file:com.clustercontrol.infra.view.action.DeleteInfraManagementAction.java

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    this.window = HandlerUtil.getActiveWorkbenchWindow(event);
    // In case this action has been disposed
    if (null == this.window || !isEnabled()) {
        return null;
    }//from   w  w w .java2  s .c  o  m

    // ???
    this.viewPart = HandlerUtil.getActivePart(event);
    if (!(viewPart instanceof InfraManagementView)) {
        return null;
    }

    InfraManagementView view = (InfraManagementView) viewPart;

    StructuredSelection selection = null;
    if (view.getComposite().getTableViewer().getSelection() instanceof StructuredSelection) {
        selection = (StructuredSelection) view.getComposite().getTableViewer().getSelection();
    }

    StringBuffer strManagementIds = new StringBuffer();
    String tmpManagementId = null;
    Map<String, List<String>> map = new ConcurrentHashMap<String, List<String>>();
    if (selection != null) {
        for (Object object : selection.toList()) {
            String managerName = (String) ((ArrayList<?>) object)
                    .get(GetInfraManagementTableDefine.MANAGER_NAME);
            if (map.get(managerName) == null) {
                map.put(managerName, new ArrayList<String>());
            }
        }

        for (Object object : selection.toList()) {
            String managerName = (String) ((ArrayList<?>) object)
                    .get(GetInfraManagementTableDefine.MANAGER_NAME);
            tmpManagementId = (String) ((ArrayList<?>) object).get(GetInfraManagementTableDefine.MANAGEMENT_ID);
            map.get(managerName).add(tmpManagementId);
            strManagementIds.append(tmpManagementId + ", ");

        }
        strManagementIds.setLength(strManagementIds.length() - 2);

        if (MessageDialog.openConfirm(null, Messages.getString("confirmed"),
                Messages.getString("message.infra.confirm.action",
                        new Object[] { Messages.getString("infra.management.id"), Messages.getString("delete"),
                                strManagementIds }))) {
            Map<String, String> errMsg = new ConcurrentHashMap<String, String>();
            for (Map.Entry<String, List<String>> entry : map.entrySet()) {
                String managerName = entry.getKey();
                InfraEndpointWrapper wrapper = InfraEndpointWrapper.getWrapper(managerName);
                List<String> managementIds = entry.getValue();
                try {
                    wrapper.deleteInfraManagement(managementIds);
                } catch (InvalidRole_Exception e) {
                    // ???
                    errMsg.put(managerName, Messages.getString("message.accesscontrol.16"));
                } catch (InfraManagementNotFound_Exception | HinemosUnknown_Exception
                        | InvalidUserPass_Exception | NotifyNotFound_Exception e) {
                    m_log.debug("execute() : " + e.getClass() + e.getMessage());
                    String arg = Messages.getString("message.infra.action.result",
                            new Object[] { Messages.getString("infra.management.id"),
                                    Messages.getString("delete"), Messages.getString("failed"),
                                    HinemosMessage.replace(e.getMessage()) });
                    errMsg.put(managerName, arg);
                }
            }

            if (errMsg.isEmpty()) {
                MessageDialog.openInformation(null, Messages.getString("confirmed"),
                        Messages.getString("message.infra.action.result",
                                new Object[] { Messages.getString("infra.management.id"),
                                        Messages.getString("delete"), Messages.getString("successful"),
                                        strManagementIds }));
            } else {
                UIManager.showMessageBox(errMsg, true);
            }
            view.update();
        }
    }
    return null;
}

From source file:org.apache.hadoop.hive.ql.exec.AnalysisOperator.java

protected void initializeOp(Configuration hconf) throws HiveException {
    this.hconf = hconf;
    rowInspector = inputObjInspectors[0];

    standardRowInspector = ObjectInspectorUtils.getStandardObjectInspector(rowInspector);

    isDistinct = conf.getDistinct();/*  w  w w.jav a  2  s  . c o  m*/

    pkeyFields = new ExprNodeEvaluator[conf.getPartitionByKeys().size()];
    pkeyObjectInspectors = new ObjectInspector[pkeyFields.length];
    pkeyObjects = new Object[pkeyFields.length];

    if (pkeyFields.length > 0) {
        for (int i = 0; i < pkeyFields.length; i++) {
            pkeyFields[i] = ExprNodeEvaluatorFactory.get(conf.getPartitionByKeys().get(i));
            pkeyObjectInspectors[i] = pkeyFields[i].initialize(standardRowInspector);
            pkeyObjects[i] = null;
        }
    }

    okeyFields = new ExprNodeEvaluator[conf.getOrderByKeys().size()];
    okeyObjectInspectors = new ObjectInspector[okeyFields.length];
    okeyObjects = new Object[okeyFields.length];
    for (int i = 0; i < okeyFields.length; i++) {
        okeyFields[i] = ExprNodeEvaluatorFactory.get(conf.getOrderByKeys().get(i));
        okeyObjectInspectors[i] = okeyFields[i].initialize(standardRowInspector);
        okeyObjects[i] = null;
    }

    hasAggregateOrderBy = new boolean[conf.getAnalysises().size()];
    hasAggregateOrderByRevIdx = new int[conf.getAnalysises().size()];
    analysisParameterFields = new ExprNodeEvaluator[conf.getAnalysises().size()][];
    analysisParameterObjectInspectors = new ObjectInspector[conf.getAnalysises().size()][];
    analysisParameterObjects = new Object[conf.getAnalysises().size()][];
    for (int i = 0; i < analysisParameterFields.length; i++) {
        analysisEvaluatorDesc aed = conf.getAnalysises().get(i);
        String udwfname = aed.getGenericUDWFName().toLowerCase();
        ArrayList<exprNodeDesc> parameters = aed.getParameters();
        hasAggregateOrderBy[i] = aed.hasAggregateOrderBy();
        hasAggregateOrderByRevIdx[i] = -1;
        if (hasAggregateOrderBy[i]) {
            hasAggregateOrderByRevIdx[i] = hasAggregateOrderByNumber;
            hasAggregateOrderByNumber++;
        }
        if (udwfname.contains("lag")) {
            int lag = 1;
            if (parameters.size() > 1) {
                lag = (Integer) ((exprNodeConstantDesc) parameters.get(1)).getValue();
            }
            if (lag > windowlag)
                windowlag = lag;
        } else if (udwfname.contains("lead")) {
            int lead = 1;
            if (parameters.size() > 1) {
                lead = (Integer) ((exprNodeConstantDesc) parameters.get(1)).getValue();
            }
            if (lead > windowlead)
                windowlead = lead;
        } else if (udwfname.contains("row_number") || udwfname.contains("rank")
                || udwfname.contains("first_value")) {
        } else if (hasAggregateOrderBy[i]) {

        } else {
            this.forwardMode = ForwardMode.WHOLEPARTITION;
        }

        if (udwfname.contains("rank")) {
            parameters = new ArrayList<exprNodeDesc>();
            parameters.addAll(conf.getOrderByKeys());
        }

        analysisParameterFields[i] = new ExprNodeEvaluator[parameters.size()];
        analysisParameterObjectInspectors[i] = new ObjectInspector[parameters.size()];
        analysisParameterObjects[i] = new Object[parameters.size()];
        for (int j = 0; j < parameters.size(); j++) {
            analysisParameterFields[i][j] = ExprNodeEvaluatorFactory.get(parameters.get(j));
            analysisParameterObjectInspectors[i][j] = analysisParameterFields[i][j]
                    .initialize(standardRowInspector);
            analysisParameterObjects[i][j] = null;
        }
    }

    hasAggregateOrderByIdx = new int[this.hasAggregateOrderByNumber];
    int numm = 0;
    for (int j = 0; j < this.hasAggregateOrderBy.length; j++) {
        if (this.hasAggregateOrderBy[j]) {
            this.hasAggregateOrderByIdx[numm++] = j;
        }
    }

    otherColumns = new ExprNodeEvaluator[conf.getOtherColumns().size()];
    otherColumnsObjectInspectors = new ObjectInspector[otherColumns.length];
    otherColumnsObjects = new Object[otherColumns.length];

    for (int i = 0; i < otherColumns.length; i++) {
        otherColumns[i] = ExprNodeEvaluatorFactory.get(conf.getOtherColumns().get(i));
        otherColumnsObjectInspectors[i] = otherColumns[i].initialize(standardRowInspector);
        otherColumnsObjects[i] = null;
    }

    analysisIsDistinct = new boolean[conf.getAnalysises().size()];
    for (int i = 0; i < analysisIsDistinct.length; i++) {
        analysisIsDistinct[i] = conf.getAnalysises().get(i).getDistinct();
    }

    analysisEvaluators = new GenericUDWFEvaluator[conf.getAnalysises().size()];
    for (int i = 0; i < analysisEvaluators.length; i++) {
        analysisEvaluatorDesc agg = conf.getAnalysises().get(i);
        analysisEvaluators[i] = agg.getGenericUDWFEvaluator();
    }
    int totalFields = pkeyFields.length + okeyFields.length + analysisEvaluators.length + otherColumns.length;
    objectInspectors = new ArrayList<ObjectInspector>(totalFields);
    for (int i = 0; i < pkeyFields.length; i++) {
        objectInspectors.add(pkeyObjectInspectors[i]);
    }

    for (int i = 0; i < okeyFields.length; i++) {
        objectInspectors.add(okeyObjectInspectors[i]);
    }

    ArrayList<ObjectInspector> aggregateOrderByObjectInspectors = new ArrayList<ObjectInspector>();
    ArrayList<String> anaStoredName = new ArrayList<String>();
    for (int i = 0; i < analysisEvaluators.length; i++) {
        ObjectInspector roi = analysisEvaluators[i].init(analysisParameterObjectInspectors[i]);
        objectInspectors.add(roi);
        if (hasAggregateOrderBy[i]) {
            anaStoredName.add("aggr" + i);
            aggregateOrderByObjectInspectors.add(roi);
        }
    }

    for (int i = 0; i < otherColumns.length; i++) {
        objectInspectors.add(otherColumnsObjectInspectors[i]);
    }

    outputObjInspector = ObjectInspectorFactory.getStandardStructObjectInspector(conf.getOutputColumnNames(),
            objectInspectors);

    anaStoredName.add(0, "rowobj");
    aggregateOrderByObjectInspectors.add(0, standardRowInspector);
    aggregateOrderByObjectInspectorANAStore = ObjectInspectorFactory
            .getStandardStructObjectInspector(anaStoredName, aggregateOrderByObjectInspectors);

    ArrayList<String> keyNames = new ArrayList<String>(pkeyFields.length);
    for (int i = 0; i < pkeyFields.length; i++) {
        keyNames.add(conf.getOutputColumnNames().get(i));
    }

    pcurrentKeyObjectInspector = ObjectInspectorFactory.getStandardStructObjectInspector(keyNames,
            Arrays.asList(pkeyObjectInspectors));

    pnewKeyObjectInspector = ObjectInspectorFactory.getStandardStructObjectInspector(keyNames,
            Arrays.asList(pkeyObjectInspectors));

    analysisParametersLastInvoke = new Object[conf.getAnalysises().size()][];

    aggregations = newAggregations();

    pnewKeys = new ArrayList<Object>();

    StringBuffer colNames = new StringBuffer();
    StringBuffer colTypes = new StringBuffer();

    StructObjectInspector soi = (StructObjectInspector) aggregateOrderByObjectInspectorANAStore;
    List<? extends StructField> fields = soi.getAllStructFieldRefs();

    for (int k = 0; k < fields.size(); k++) {
        String newColName = "_VALUE_" + k;
        colNames.append(newColName);
        colNames.append(',');
        colTypes.append(fields.get(k).getFieldObjectInspector().getTypeName());
        colTypes.append(',');
    }
    colNames.setLength(colNames.length() - 1);
    colTypes.setLength(colTypes.length() - 1);

    Properties properties = Utilities.makeProperties(
            org.apache.hadoop.hive.serde.Constants.SERIALIZATION_FORMAT, "" + Utilities.ctrlaCode,
            org.apache.hadoop.hive.serde.Constants.LIST_COLUMNS, colNames.toString(),
            org.apache.hadoop.hive.serde.Constants.LIST_COLUMN_TYPES, colTypes.toString());

    try {
        anaserde = LazyBinarySerDe.class.newInstance();
        anaserde.initialize(hconf, properties);
    } catch (InstantiationException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (SerDeException e) {
        e.printStackTrace();
    }

    anabuffer = new AnalysisBuffer<Object>(anaserde, this.aggregateOrderByObjectInspectorANAStore, hconf);

    System.out.println("hasAggregateOrderByNumber\t" + hasAggregateOrderByNumber);
    for (int i = 0; i < hasAggregateOrderBy.length; i++) {
        System.out.print(hasAggregateOrderBy[i] + "\t");
    }
    System.out.println();
    for (int i = 0; i < hasAggregateOrderByIdx.length; i++) {
        System.out.print(hasAggregateOrderByIdx[i] + "\t");
    }
    System.out.println();
    for (int i = 0; i < hasAggregateOrderByRevIdx.length; i++) {
        System.out.print(hasAggregateOrderByRevIdx[i] + "\t");
    }
    System.out.println();

    initializeChildren(hconf);
}