Package java.lang

Examples of java.lang.StringBuilder


            return mCastType;
        }

        @Override
        public String toString() {
            StringBuilder sb = new StringBuilder();
            sb.append(mInputColumn);
            if (mCast) {
                sb.append(" cast to: " + DataType.findTypeName(mCastType));
            }
            return sb.toString();
        }
View Full Code Here


    public boolean isRich(){
        return getIncome() >= 80000;
    }

    public String getName() {
        StringBuilder name = new StringBuilder();

        // Age
        if (getAge()>=21){
            name.append("old");
        }else{
            name.append("young");
        }

        //Income
        if (isRich()){
            name.append(" rich");
        }

        //Sex
        if (getSex() == Sex.MALE){
            name.append(" man");
        }else{
             name.append(" woman");
        }

        return name.toString();
    }
View Full Code Here

        this.totalSplits = totalSplits;
    }

    @Override
    public String toString() {
        StringBuilder st = new StringBuilder();
        st.append("Number of splits :" + wrappedSplits.length+"\n");
        try {
            st.append("Total Length = "+ getLength()+"\n");
            for (int i = 0; i < wrappedSplits.length; i++) {
                st.append("Input split["+i+"]:\n   Length = "+ wrappedSplits[i].getLength()+"\n  Locations:\n");
                for (String location :  wrappedSplits[i].getLocations())
                    st.append("    "+location+"\n");
                st.append("\n-----------------------\n");
          }
        } catch (IOException e) {
          return null;
        } catch (InterruptedException e) {
          return null;
        }
        return st.toString();
    }
View Full Code Here

  @Override
  public String get(int index)
  {
    index = index * width;
    StringBuilder sb = new StringBuilder();
    sb.append(_elements[index]);

    int left = width;
    ++index;
    while (left>1)
    {
      sb.append(',');
      sb.append(_elements[index]);
      --left; ++index;
    }

    return sb.toString();
  }
View Full Code Here

    long[] val = (long[])o;

    if (val.length == 0)
      return null;

    StringBuilder sb = new StringBuilder();
    sb.append(val[0]);

    for(int i=1; i<val.length; ++i)
    {
      sb.append(',');
      sb.append(val[i]);
    }
    return sb.toString();
  }
View Full Code Here

        // Get the response
        BufferedReader rd = new BufferedReader
                (new InputStreamReader(response.getEntity().getContent()));

        StringBuilder builder = new StringBuilder();
        String line = "";
        while ((line = rd.readLine()) != null) {
            builder.append(line);
        }

        Assert.assertNotNull(response);
        Assert.assertEquals("Got " + builder.toString(), 200, response.getStatusLine().getStatusCode());
    }
View Full Code Here

        // Get the response
        BufferedReader rd = new BufferedReader
                (new InputStreamReader(response.getEntity().getContent()));

        StringBuilder builder = new StringBuilder();
        String line = "";
        while ((line = rd.readLine()) != null) {
            builder.append(line);
        }

        Assert.assertNotNull(response);
        Assert.assertEquals("Got " + builder.toString(), 200, response.getStatusLine().getStatusCode());
    }
View Full Code Here

        this.totalSplits = totalSplits;
    }

    @Override
    public String toString() {
        StringBuilder st = new StringBuilder();
        st.append("Number of splits :" + wrappedSplits.length+"\n");
        try {
            st.append("Total Length = "+ getLength()+"\n");
            for (int i = 0; i < wrappedSplits.length; i++) {
                st.append("Input split["+i+"]:\n   Length = "+ wrappedSplits[i].getLength()+"\n  Locations:\n");
                for (String location :  wrappedSplits[i].getLocations())
                    st.append("    "+location+"\n");
                st.append("\n-----------------------\n");
          }
        } catch (IOException e) {
          return null;
        } catch (InterruptedException e) {
          return null;
        }
        return st.toString();
    }
View Full Code Here

        this.workingDirPrefix = new String(workingDirPrefix);
    }

    private String makeConfigFileForJavaGrader(MultipartRequest req, File workingDir)
    {
        StringBuilder configString = new StringBuilder();
        //key setting value
        String JUnitTestClassName = req.getParameter("JUnitTestClassName");
        if(null != JUnitTestClassName)
        {
            configString.append("[" + JUnitTestClassName + "]\n");
        }
        else
        {
            System.out.println("There is no JUnitTestClassName provided");
        }

        Enumeration keys = req.getParameterNames();
        while(keys.hasMoreElements())
        {
            String key = (String)keys.nextElement();
            String value = req.getParameter(key);

            if(null != value)
            {
                if(true == value.equalsIgnoreCase("on"))
                    value = "Yes";

                configString.append(key + " = " +  value + "\n");
            }

        }

        // input files to process
        Enumeration files = req.getFileNames();
        while (files.hasMoreElements())
        {
            String name = (String)files.nextElement();
            String filename = req.getFilesystemName(name);
            //String type = req.getContentType(name);
            if(null != filename)
                configString.append(name + " = " + workingDir.getAbsolutePath() + File.separator + filename + "\n");
        }

        //output directory
        File outputDir = new File(workingDir.getAbsolutePath() + File.separator + "output");
        outputDir.mkdirs();
        configString.append("outputDirectory = " + outputDir.getAbsolutePath() + "\n");
       
        //timeout
        configString.append("testProcessTimeOut = 15\n");

        //Feedback directory
        File feedbackDir = new File(workingDir.getAbsolutePath() + File.separator + "FeedBack");
        feedbackDir.mkdirs();

        return configString.toString();
    }
View Full Code Here

        String header =  "email\n{\n" +
                         " Date receives : " + this.received.toString() + "\n" +
                         " From: " + this.from + "\n" +
                         " Subject: " + this.subject + "\n" +
                         " Body:" + this.body + "\n";
        StringBuilder result = new StringBuilder();
        result.append(header);
        for(Attachment a : this.attachments)
        {
            result.append(" " + a.toString());
        }
       
        result.append("}\n");
       
        return result.toString();
    }
View Full Code Here

TOP

Related Classes of java.lang.StringBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.