コード例 #1
0
ファイル: DataTest.java プロジェクト: GromTable/GromTable
  @Test
  public void testToString() {
    Data data = new Data("datadata".getBytes());
    Assert.assertEquals("datadata", data.toString());

    Data dataLong = new Data(7233190438178485345L);
    Assert.assertEquals("7233190438178485345", dataLong.toString());
  }
コード例 #2
0
  @Test
  public void testEquals() {

    Style instance = createStyle(data.s1);
    Style obj = createStyle(data.s2);
    boolean expected = data.expected;
    boolean actual = instance.equals(obj);
    assertTrue(data.toString(), expected == actual);
  }
コード例 #3
0
  /**
   * @param args
   * @throws JAXBException
   */
  public static void main(String[] args) throws JAXBException {
    JAXBContext context = JAXBContext.newInstance(Data.class);
    Unmarshaller u = context.createUnmarshaller();
    u.setEventHandler(new DefaultValidationEventHandler());
    File xml = new File("./src/Data.xml");
    Data d = (Data) u.unmarshal(xml);

    System.out.println(d.toString());
  }
コード例 #4
0
ファイル: ColorMap.java プロジェクト: ethanrd/IDV
  /**
   * Does the pattern match the given value
   *
   * @param value value to check
   * @return Pattern matches value
   */
  public boolean match(Data value) throws Exception {
    if (value instanceof Real && isNumericRange()) {
      Real[] range = getNumericRange();
      Real r = (Real) value;
      if (r.__ge__(range[0]) == 0) return false;
      if (r.__le__(range[1]) == 0) return false;
      return true;
    }

    String stringValue = value.toString();
    return StringUtil.stringMatch(stringValue, pattern, true, true);
  }
コード例 #5
0
 @Override
 public String toString() {
   String str;
   str = "\nReserva amb ID: " + id + "\n";
   str += "--------------------------------------\n";
   str += "Client: " + clientReserva.getId() + "\n";
   str += "Moto: " + motoReserva.getIdMoto() + "\n";
   str += "Cost: " + preu + "€\n";
   if (penalitzacioMoto) {
     str += "La moto té algun desperfecte.\n";
   } else {
     str += "La moto s'ha retornat amb bon estat.\n";
   }
   if (penalitzacioTemps) {
     str += "La moto no s'ha retornat a temps.\n";
   } else {
     str += "La moto s'ha retornat a temps.\n";
   }
   str += "Local d'inici: " + localInicial.toString() + "\n";
   str += "Data d'inici: " + dataInicial.toString() + "\n";
   str += "Local de finalització: " + localFinal.toString() + "\n";
   str += "Data de finalització: " + dataFinal.toString() + "\n";
   return str;
 }
コード例 #6
0
ファイル: Model.java プロジェクト: Jankish/GRAB
  public void createExcel(String file) {

    String filename = createPath(file);
    System.out.println(filename);

    /*
       try {
       WorkbookSettings ws = new WorkbookSettings();
       ws.setLocale(new Locale("sv", "SE"));
       WritableWorkbook workbook = Workbook.createWorkbook(new File(filename), ws);
       WritableSheet s = workbook.createSheet("Sheet1", 0);
    //writeDataSheet(s);
    workbook.write();
    workbook.close();
    } catch (IOException e) {
    e.printStackTrace();
    } catch (WriteException e) {
    e.printStackTrace();
    }**/

    try {

      File newFile = new File(filename);
      Writer out =
          new BufferedWriter(new OutputStreamWriter(new FileOutputStream(newFile), "UTF8"));
      //	BufferedWrite output = new BufferedWriter(new OutputStreamReader(new
      // FileInputS§tream(filename), "iso-8859-1"));
      // FileWriter fw = new FileWriter(newFile.getAbsoluteFile());
      // BufferedWriter bw = new BufferedWriter(fw);
      // bw.write("Artikel;Antal/st;Pris/st;Total\n");
      out.append("Artikel;Antal/st;Pris/st;Total\n");
      for (Data d : dataList) {
        out.append(d.toString());
        out.append("\n");
        // bw.write(d.toString());
        // bw.write("\n");
      }
      // bw.close();
      out.flush();
      out.close();
    } catch (UnsupportedEncodingException unsuppEn) {
      unsuppEn.printStackTrace();
    } catch (IOException ioE) {
      ioE.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
コード例 #7
0
  public void extractAlerts(ArrayList<StringBuilder> alerts) {
    int i = 0;
    StringBuilder sb = new StringBuilder();
    while (!alerts.get(i).toString().equals("not found")) {
      sb = alerts.get(i);
      int j = 0;

      while (j < 5) {
        int k = sb.indexOf("</c>");
        Data[j] = parseXml(sb.toString(), "<c>", "</c>", 0, 0);
        sb.delete(0, k + 1);
        j++;
      }
      if (Data[0] != "not found") {
        det.assignData(Data);
        Log.d("Det2", Data.toString());
        alertdata.put(Data[2], det);
        Log.d("AlertData2", alertdata.toString());

        alertlist.add(alertdata);

        if (ch == 0) {
          alrts.add(Data[2]);
          ch++;
        }
        if (!alrts.get(ch - 1).equals(Data[2])) {
          Log.d("aldat", alrts.get(ch - 1));
          alrts.add(Data[2]);
          ch++;
        }
        Log.d("Alert2", Data[2]);
        Log.d("List2", alertlist.toString());
      }
      i++;
    }
  }
コード例 #8
0
ファイル: VCardTelephone.java プロジェクト: vznet/emite
 public String getValue(final Data data) {
   return getValue(data.toString());
 }
コード例 #9
0
 @Override
 public String toString() {
   return String.format(
       "Marvel Response [%d, %s, %s, %s, %s, %s]",
       code, status, copyright, attributionText, attributionHTML, data.toString());
 }