Converts rdata to a String
166482
String
rrToString() {
	StringBuffer sb = new StringBuffer();
	sb.append(certificateUsage);
	sb.append(" ");
	sb.append(selector);
	sb.append(" ");
	sb.append(matchingType);
	sb.append(" ");
	sb.append(base16.toString(certificateAssociationData));

	return sb.toString();
}
120346
public String getString(Map<String, Object> data, String attr) {
    Object value = data.get(attr);
    if (null == value) { return null; }
    if (!value.getClass().isArray()) { return value.toString(); }
    String[] values = (String[]) value;
    if (values.length == 1) {
      return values[0];
    } else {
      return Strings.join(values, ",");
    }
  }
854155
def _dataToString(self, data):
        
        if self.specialValueText is not None and data == self.minValue:
            return self.specialValueText
        else:
            return "{}{:.{}f}{}".format(self.prefix, data, self.decimals, self.suffix)
1086232
private static int getCorrectedParameterData(long parameterData, boolean compact) throws NotFoundException {
    int numCodewords;
    int numDataCodewords;

    if (compact) {
      numCodewords = 7;
      numDataCodewords = 2;
    } else {
      numCodewords = 10;
      numDataCodewords = 4;
    }

    int numECCodewords = numCodewords - numDataCodewords;
    int[] parameterWords = new int[numCodewords];
    for (int i = numCodewords - 1; i >= 0; --i) {
      parameterWords[i] = (int) parameterData & 0xF;
      parameterData >>= 4;
    }
    try {
      ReedSolomonDecoder rsDecoder = new ReedSolomonDecoder(GenericGF.AZTEC_PARAM);
      rsDecoder.decode(parameterWords, numECCodewords);
    } catch (ReedSolomonException ignored) {
      throw NotFoundException.getNotFoundInstance();
    }
    // Toss the error correction.  Just return the data as an integer
    int result = 0;
    for (int i = 0; i < numDataCodewords; i++) {
      result = (result << 4) + parameterWords[i];
    }
    return result;
  }
582171
protected String getParameterString(Collection<?> data) {

        StringBuffer conditions = new StringBuffer();
        conditions.append(BEGIN_CONDITION);
        Iterator<?> it = data.iterator();
        while (it.hasNext()) {
            it.next();
            conditions.append("?");
            if (it.hasNext()) {
                conditions.append(", ");
            }
        }
        conditions.append(END_CONDITION);
        return conditions.toString();
    }
270364
private String createSMMAStr(int smid, HashMap trData) {

        StringBuilder sb = new StringBuilder();
        String nitro = "Y";
        String water = "Y";
        String co2 = "M";
        String harOpt = "M";
        String sdate;
        String sm = String.format("%2d", smid);
//        ArrayList<HashMap> dataArr;
        HashMap subData;
        String vbose="N";

//        // Check if the meta data of fertilizer is not "N" ("Y" or null)
//        if (!getValueOr(expData, "fertilizer", "").equals("N")) {
//
//            // Check if necessary data is missing in all the event records
//            // P.S. rule changed since all the necessary data has a default value for it
//            dataArr = getObjectOr(trData, "fertilizer", new ArrayList());
//            if (dataArr.isEmpty()) {
//                nitro = "N";
//            }
////            for (int i = 0; i < dataArr.size(); i++) {
////                subData = dataArr.get(i);
////                if (getValueOr(subData, "date", "").equals("")
////                        || getValueOr(subData, "fecd", "").equals("")
////                        || getValueOr(subData, "feacd", "").equals("")
////                        || getValueOr(subData, "feamn", "").equals("")) {
////                    nitro = "N";
////                    break;
////                }
////            }
//        }
//        // Check if the meta data of irrigation is not "N" ("Y" or null)
//        if (!getValueOr(expData, "irrigation", "").equals("N")) {
//
//            // Check if necessary data is missing in all the event records
//            dataArr = getObjectOr(trData, "irrigation", new ArrayList());
//            for (int i = 0; i < dataArr.size(); i++) {
//                subData = dataArr.get(i);
//                if (getValueOr(subData, "date", "").equals("")
//                        || getValueOr(subData, "irval", "").equals("")) {
//                    water = "N";
//                    break;
//                }
//            }
//        }
        // Check if CO2Y value is provided and the value is positive, then set CO2 switch to W
        String co2y = getValueOr(trData, "co2y", "").trim();
        if (!co2y.equals("") && !co2y.startsWith("-")) {
            co2 = "W";
        }

        sdate = getValueOr(trData, "sdat", "");
        if (sdate.equals("")) {
            subData = getObjectOr(trData, "planting", new HashMap());
            sdate = getValueOr(subData, "date", defValD);
        }
        sdate = formatDateStr(sdate);
        sdate = String.format("%5s", sdate);

        if (!getValueOr(trData, "hadat_valid", "").trim().equals("")) {
            harOpt = "R";
        }
        
        if (getValueOr(trData, "seasonal_dome_applied", "").trim().equals("Y")) {
            vbose = "0";
        }

        String smStr;
        HashMap smData;
        // GENERAL
        sb.append("@N GENERAL     NYERS NREPS START SDATE RSEED SNAME.................... SMODEL\r\n");
        if (!(smStr = getValueOr(trData, "sm_general", "")).equals("")) {
            if (!sdate.trim().equals("-99") && !sdate.trim().equals("")) {
                smStr = replaceSMStr(smStr, sdate, 30);
            }
            smStr = replaceSMStr(smStr, getValueOr(trData, "dssat_model", ""), 68);
            sb.append(sm).append(" ").append(smStr).append("\r\n");
        } else if (!(smData = getObjectOr(trData, "general", new HashMap())).isEmpty()) {
            if (sdate.trim().equals("-99") || sdate.trim().equals("")) {
                sdate = String.format("%1$02d%2$03d", Integer.parseInt(formatNumStr(2, smData, "sdyer", "0").trim()), Integer.parseInt(formatNumStr(3, smData, "sdday", "0").trim()));
            }
            sb.append(String.format("%1$2s %2$-11s %3$5s %4$5s     %5$-1s %6$5s %7$5s %8$-25s %9$s\r\n",
                    sm,
                    "GE",
                    getValueOr(smData, "nyers", "1"),
                    getValueOr(smData, "nreps", "1"),
                    getValueOr(smData, "start", "S"),
                    sdate,
                    getValueOr(smData, "rseed", "250"),
                    getValueOr(smData, "sname", defValC),
                    getValueOr(trData, "dssat_model", getValueOr(smData, "model", ""))));
        } else {
            sb.append(sm).append(" GE              1     1     S ").append(sdate).append("  2150 DEFAULT SIMULATION CONTRL ").append(getValueOr(trData, "dssat_model", "")).append("\r\n");
        }
        // OPTIONS
        sb.append("@N OPTIONS     WATER NITRO SYMBI PHOSP POTAS DISES  CHEM  TILL   CO2\r\n");
        if (!(smStr = getValueOr(trData, "sm_options", "")).equals("")) {
//            smStr = replaceSMStr(smStr, co2, 64);
            sb.append(sm).append(" ").append(smStr).append("\r\n");
        } else if (!(smData = getObjectOr(trData, "options", new HashMap())).isEmpty()) {
            sb.append(String.format("%1$2s %2$-11s     %3$-1s     %4$-1s     %5$-1s     %6$-1s     %7$-1s     %8$-1s     %9$-1s     %10$-1s     %11$-1s\r\n",
                    sm,
                    "OP",
                    getValueOr(smData, "water", water),
                    getValueOr(smData, "nitro", nitro),
                    getValueOr(smData, "symbi", "Y"),
                    getValueOr(smData, "phosp", "N"),
                    getValueOr(smData, "potas", "N"),
                    getValueOr(smData, "dises", "N"),
                    getValueOr(smData, "chem", "N"),
                    getValueOr(smData, "till", "Y"),
                    getValueOr(smData, "co2", co2)));
        } else {
            sb.append(sm).append(" OP              ").append(water).append("     ").append(nitro).append("     Y     N     N     N     N     Y     ").append(co2).append("\r\n");
        }
        // METHODS
        sb.append("@N METHODS     WTHER INCON LIGHT EVAPO INFIL PHOTO HYDRO NSWIT MESOM MESEV MESOL\r\n");
        if (!(smStr = getValueOr(trData, "sm_methods", "")).equals("")) {
            sb.append(sm).append(" ").append(smStr).append("\r\n");
        } else if (!(smData = getObjectOr(trData, "methods", new HashMap())).isEmpty()) {
            sb.append(String.format("%1$2s %2$-11s     %3$-1s     %4$-1s     %5$-1s     %6$-1s     %7$-1s     %8$-1s     %9$-1s     %10$-1s     %11$-1s     %12$-1s     %13$-1s\r\n",
                    sm,
                    "ME",
                    getValueOr(smData, "wther", "M"),
                    getValueOr(smData, "incon", "M"),
                    getValueOr(smData, "light", "E"),
                    getValueOr(smData, "evapo", "R"),
                    getValueOr(smData, "infil", "S"),
                    getValueOr(smData, "photo", "L"),
                    getValueOr(smData, "hydro", "R"),
                    getValueOr(smData, "nswit", "1"),
                    getValueOr(smData, "mesom", "P"),
                    getValueOr(smData, "mesev", "S"),
                    getValueOr(smData, "mesol", "2")));
        } else {
            sb.append(sm).append(" ME              M     M     E     R     S     L     R     1     P     S     2\r\n"); // P.S. 2012/09/02 MESOM "G" -> "P"
        }
        // MANAGEMENT
        sb.append("@N MANAGEMENT  PLANT IRRIG FERTI RESID HARVS\r\n");
        if (!(smStr = getValueOr(trData, "sm_management", "")).equals("")) {
//            smStr = smStr.replaceAll("     D", "     R");
//            smStr = replaceSMStr(smStr, harOpt, 40);
            sb.append(sm).append(" ").append(smStr).append("\r\n");
        } else if (!(smData = getObjectOr(trData, "management", new HashMap())).isEmpty()) {
            sb.append(String.format("%1$2s %2$-11s     %3$-1s     %4$-1s     %5$-1s     %6$-1s     %7$-1s\r\n",
                    sm,
                    "MA",
                    getValueOr(smData, "plant", "R"),
                    getValueOr(smData, "irrig", "R"),
                    getValueOr(smData, "ferti", "R"),
                    getValueOr(smData, "resid", "R"),
                    getValueOr(smData, "harvs", harOpt)));
        } else {
            sb.append(sm).append(" MA              R     R     R     R     ").append(harOpt).append("\r\n");
        }
        // OUTPUTS
        sb.append("@N OUTPUTS     FNAME OVVEW SUMRY FROPT GROUT CAOUT WAOUT NIOUT MIOUT DIOUT VBOSE CHOUT OPOUT\r\n");
        if (!(smStr = getValueOr(trData, "sm_outputs", "")).equals("")) {
            sb.append(sm).append(" ").append(smStr).append("\r\n\r\n");
        } else if (!(smData = getObjectOr(trData, "outputs", new HashMap())).isEmpty()) {
            sb.append(String.format("%1$2s %2$-11s     %3$-1s     %4$-1s     %5$-1s %6$5s     %7$-1s     %8$-1s     %9$-1s     %10$-1s     %11$-1s     %12$-1s     %13$-1s     %14$-1s     %15$-1s\r\n\r\n",
                    sm,
                    "OU",
                    getValueOr(smData, "fname", "N"),
                    getValueOr(smData, "ovvew", "Y"),
                    getValueOr(smData, "sumry", "Y"),
                    getValueOr(smData, "fropt", "1"),
                    getValueOr(smData, "grout", "Y"),
                    getValueOr(smData, "caout", "Y"),
                    getValueOr(smData, "waout", "N"),
                    getValueOr(smData, "niout", "N"),
                    getValueOr(smData, "miout", "N"),
                    getValueOr(smData, "diout", "N"),
                    getValueOr(smData, "vbose", vbose),
                    getValueOr(smData, "chout", "N"),
                    getValueOr(smData, "opout", "N")));
        } else {
            sb.append(sm).append(" OU              N     Y     Y     1     Y     Y     N     N     N     N     ").append(vbose).append("     N     N\r\n\r\n");
        }
        // PLANTING
        sb.append("@  AUTOMATIC MANAGEMENT\r\n");
        sb.append("@N PLANTING    PFRST PLAST PH2OL PH2OU PH2OD PSTMX PSTMN\r\n");
        if (!(smStr = getValueOr(trData, "sm_planting", "")).equals("")) {
            sb.append(sm).append(" ").append(smStr).append("\r\n");
        } else if (!(smData = getObjectOr(trData, "planting", new HashMap())).isEmpty()) {
            sb.append(String.format("%1$2s %2$-11s %3$02d%4$03d %5$02d%6$03d %7$5s %8$5s %9$5s %10$5s %11$5s\r\n",
                    sm,
                    "PL",
                    Integer.parseInt(formatNumStr(2, smData, "pfyer", "82")),
                    Integer.parseInt(formatNumStr(3, smData, "pfday", "050")),
                    Integer.parseInt(formatNumStr(2, smData, "plyer", "82")),
                    Integer.parseInt(formatNumStr(3, smData, "plday", "064")),
                    getValueOr(smData, "ph2ol", "40"),
                    getValueOr(smData, "ph2ou", "100"),
                    getValueOr(smData, "ph2od", "30"),
                    getValueOr(smData, "pstmx", "40"),
                    getValueOr(smData, "pstmn", "10")));
        } else {
            sb.append(sm).append(" PL          82050 82064    40   100    30    40    10\r\n");
        }
        // IRRIGATION
        sb.append("@N IRRIGATION  IMDEP ITHRL ITHRU IROFF IMETH IRAMT IREFF\r\n");
        if (!(smStr = getValueOr(trData, "sm_irrigation", "")).equals("")) {
            sb.append(sm).append(" ").append(smStr).append("\r\n");
        } else if (!(smData = getObjectOr(trData, "irrigation", new HashMap())).isEmpty()) {
            sb.append(String.format("%1$2s %2$-11s %3$5s %4$5s %5$5s %6$-5s %7$-5s %8$5s %9$5s\r\n",
                    sm,
                    "IR",
                    getValueOr(smData, "imdep", "30"),
                    getValueOr(smData, "ithrl", "50"),
                    getValueOr(smData, "ithru", "100"),
                    getValueOr(smData, "iroff", "GS000"),
                    getValueOr(smData, "imeth", "IR001"),
                    getValueOr(smData, "iramt", "10"),
                    getValueOr(smData, "ireff", "1.00")));
        } else {
            sb.append(sm).append(" IR             30    50   100 GS000 IR001    10  1.00\r\n");
        }
        // NITROGEN
        sb.append("@N NITROGEN    NMDEP NMTHR NAMNT NCODE NAOFF\r\n");
        if (!(smStr = getValueOr(trData, "sm_nitrogen", "")).equals("")) {
            sb.append(sm).append(" ").append(smStr).append("\r\n");
        } else if (!(smData = getObjectOr(trData, "nitrogen", new HashMap())).isEmpty()) {
            sb.append(String.format("%1$2s %2$-11s %3$5s %4$5s %5$5s %6$-5s %7$-5s\r\n",
                    sm,
                    "NI",
                    getValueOr(smData, "nmdep", "30"),
                    getValueOr(smData, "nmthr", "50"),
                    getValueOr(smData, "namnt", "25"),
                    getValueOr(smData, "ncode", "FE001"),
                    getValueOr(smData, "naoff", "GS000")));
        } else {
            sb.append(sm).append(" NI             30    50    25 FE001 GS000\r\n");
        }
        // RESIDUES
        sb.append("@N RESIDUES    RIPCN RTIME RIDEP\r\n");
        if (!(smStr = getValueOr(trData, "sm_residues", "")).equals("")) {
            sb.append(sm).append(" ").append(smStr).append("\r\n");
        } else if (!(smData = getObjectOr(trData, "residues", new HashMap())).isEmpty()) {
            sb.append(String.format("%1$2s %2$-11s %3$5s %4$5s %5$5s\r\n",
                    sm,
                    "RE",
                    getValueOr(smData, "ripcn", "100"),
                    getValueOr(smData, "rtime", "1"),
                    getValueOr(smData, "ridep", "20")));
        } else {
            sb.append(sm).append(" RE            100     1    20\r\n");
        }
        // HARVEST
        sb.append("@N HARVEST     HFRST HLAST HPCNP HPCNR\r\n");
        if (!(smStr = getValueOr(trData, "sm_harvests", "")).equals("")) {
            sb.append(sm).append(" ").append(smStr).append("\r\n\r\n");
        } else if (!(smData = getObjectOr(trData, "harvests", new HashMap())).isEmpty()) {
            sb.append(String.format("%1$2s %2$-11s %3$5s %4$02d%5$03d %6$5s %7$5s\r\n\r\n",
                    sm,
                    "HA",
                    getValueOr(smData, "hfrst", "0"),
                    Integer.parseInt(formatNumStr(2, smData, "hlyer", "83")),
                    Integer.parseInt(formatNumStr(3, smData, "hlday", "057")),
                    getValueOr(smData, "hpcnp", "100"),
                    getValueOr(smData, "hpcnr", "0")));
        } else {
            sb.append(sm).append(" HA              0 83057   100     0\r\n\r\n");
        }

        return sb.toString();
    }
1230087
def tostring(self, root=None, doctype=None, pretty_print=True):
        """"""
        if root is None:
            root = self.root
        return etree.tounicode(
            root, doctype=doctype or self.info.doctype, pretty_print=pretty_print
        )
621464
def to_xml_string(r_index, str = '')
      serialized_tag('row', str, :r => r_index + 1) do
        tmp = '' # time / memory tradeoff, lots of calls to rubyzip costs more
                 # time..
        each_with_index { |cell, c_index| cell.to_xml_string(r_index, c_index, tmp) }
        str << tmp
      end
    end
880791
public static String rowToString(JSONArray ja) {

        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < ja.length(); i += 1) {
            if (i > 0) {
                sb.append(',');
            }
            Object o = ja.opt(i);
            if (o != null) {
                String s = o.toString();
                if (s.indexOf(',') >= 0) {
                    if (s.indexOf('"') >= 0) {
                        sb.append('\'');
                        sb.append(s);
                        sb.append('\'');
                    } else {
                        sb.append('"');
                        sb.append(s);
                        sb.append('"');
                    }
                } else {
                    sb.append(s);
                }
            }
        }
        sb.append('\n');
        return sb.toString();

    }
442920
def to_str(data):
    
    if isinstance(data, bytes):
        return codecs.decode(data, aws_encryption_sdk.internal.defaults.ENCODING)
    return data
1006368
public static String rowToString(JSONArray ja) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < ja.length(); i += 1) {
            if (i > 0) {
                sb.append(',');
            }
            Object object = ja.opt(i);
            if (object != null) {
                String string = object.toString();
                if (string.length() > 0 && (string.indexOf(',') >= 0 ||
                        string.indexOf('\n') >= 0 || string.indexOf('\r') >= 0 ||
                        string.indexOf(0) >= 0 || string.charAt(0) == '"')) {
                    sb.append('"');
                    int length = string.length();
                    for (int j = 0; j < length; j += 1) {
                        char c = string.charAt(j);
                        if (c >= ' ' && c != '"') {
                            sb.append(c);
                        }
                    }
                    sb.append('"');
                } else {
                    sb.append(string);
                }
            }
        }
        sb.append('\n');
        return sb.toString();
    }
840071
def _get_id(self, rdata):
        
        if 'id' in rdata:
            if isinstance(rdata['id'], basestring) or \
                    isinstance(rdata['id'], int) or \
                    isinstance(rdata['id'], long) or \
                    isinstance(rdata['id'], float) or \
                    rdata['id'] is None:
                return rdata['id']
            else:
                # invalid type
                raise InvalidRequestError
        else:
            # It's a notification.
            return None
11536
String
rrToString()
{
	StringBuffer sb = new StringBuffer();
	sb.append(next);
	if (!types.empty()) {
		sb.append(' ');
		sb.append(types.toString());
	}
	return sb.toString();
}
382280
def from_rdata_list(name, ttl, rdatas):
    

    if isinstance(name, (str, unicode)):
        name = dns.name.from_text(name, None)

    if len(rdatas) == 0:
        raise ValueError("rdata list must not be empty")
    r = None
    for rd in rdatas:
        if r is None:
            r = RRset(name, rd.rdclass, rd.rdtype)
            r.update_ttl(ttl)
            first_time = False
        r.add(rd)
    return r
1055597
public static String convertDataMapToText(Map<String, Object> dataMap){
		StringBuilder sb = new StringBuilder();
		for (Entry<String, Object> entry: dataMap.entrySet()){
			sb.append(entry.getKey()).append("=").append(entry.getValue());
			sb.append('\n');
		}
		return sb.toString();
	}
336365
String
rrToString() {
	StringBuffer sb = new StringBuffer();

	/* Latitude */
	sb.append(positionToString(latitude, 'N', 'S'));
	sb.append(" ");

	/* Latitude */
	sb.append(positionToString(longitude, 'E', 'W'));
	sb.append(" ");

	/* Altitude */
	renderFixedPoint(sb, w2, altitude - 10000000, 100);
	sb.append("m ");

	/* Size */
	renderFixedPoint(sb, w2, size, 100);
	sb.append("m ");

	/* Horizontal precision */
	renderFixedPoint(sb, w2, hPrecision, 100);
	sb.append("m ");

	/* Vertical precision */
	renderFixedPoint(sb, w2, vPrecision, 100);
	sb.append("m");

	return sb.toString();
}
622072
def to_string(self):
        '''
        
        '''
        node = list()
        node.append(quote_if_necessary(str(self.name)))
        node.append(' [')
        flag = False
        for a in self.attr:
            flag = True
            node.append(a)
            node.append('=')
            node.append(quote_if_necessary(str(self.attr[a])))
            node.append(', ')
        if flag is True:
            node = node[:-1]
        node.append(']')
        return ''.join(node)