Converts the CPE into the CPE 2.3 Formatted String.

@return the CPE 2.3 Formatted String
348609
@Override
    public String toCpe23FS() {
        return String.format("cpe:2.3:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s",
                Convert.wellFormedToFS(part),
                Convert.wellFormedToFS(vendor),
                Convert.wellFormedToFS(product),
                Convert.wellFormedToFS(version),
                Convert.wellFormedToFS(update),
                Convert.wellFormedToFS(edition),
                Convert.wellFormedToFS(language),
                Convert.wellFormedToFS(swEdition),
                Convert.wellFormedToFS(targetSw),
                Convert.wellFormedToFS(targetHw),
                Convert.wellFormedToFS(other));
    }
897119
public String moreToString() {
        StringBuilder sb = new StringBuilder("Last cert?  ");
        sb.append((index == -1) ? "Yes" : "No");
        sb.append("\n");
        return sb.toString();
    }
1167700
public String toCode() {
        String ret = "";
        if (StringUtils.isEmpty(scope)) {
            ret = "private ";
        } else {
            ret = scope + ClassCode.BLANK_STRING;
        }
        
        ret += type + ClassCode.BLANK_STRING + name;
        
        if (!StringUtils.isEmpty(defaultValue)) {
            ret += "=" + defaultValue;
        }
        
        return ret;
    }
400430
public String getString() 
    {
        String string = Constants.BLANK;
        if (this.getNextConverter().getData() != null)
        {
            double doubleValue = this.getValue();
            synchronized (gPercentFormat)
            {
                string = gPercentFormat.format(doubleValue);
            }
        }
        return string;
    }
886715
def _to_string(self):
        
        parts = []
        if self.library:  # pylint: disable=no-member
            parts.extend([self.org, self.library])  # pylint: disable=no-member
            if self.branch:  # pylint: disable=no-member
                parts.append(u"{prefix}@{branch}".format(prefix=self.BRANCH_PREFIX, branch=self.branch))  # pylint: disable=no-member
        if self.version_guid:  # pylint: disable=no-member
            parts.append(u"{prefix}@{guid}".format(prefix=self.VERSION_PREFIX, guid=self.version_guid))  # pylint: disable=no-member
        return u"+".join(parts)
923284
def as_wfn(self):
        

        from .cpe2_3_wfn import CPE2_3_WFN

        wfn = []
        wfn.append(CPE2_3_WFN.CPE_PREFIX)

        for i in range(0, len(CPEComponent.ordered_comp_parts)):
            ck = CPEComponent.ordered_comp_parts[i]
            lc = self._get_attribute_components(ck)

            if len(lc) > 1:
                # Incompatible version 1.1, there are two or more elements
                # in CPE Name
                errmsg = "Incompatible version {0} with WFN".format(
                    self.VERSION)
                raise TypeError(errmsg)

            else:
                comp = lc[0]

                v = []
                v.append(ck)
                v.append("=")

                if isinstance(comp, CPEComponentAnyValue):

                    # Logical value any
                    v.append(CPEComponent2_3_WFN.VALUE_ANY)

                elif isinstance(comp, CPEComponentNotApplicable):

                    # Logical value not applicable
                    v.append(CPEComponent2_3_WFN.VALUE_NA)

                elif (isinstance(comp, CPEComponentUndefined) or
                      isinstance(comp, CPEComponentEmpty)):
                    # Do not set the attribute
                    continue
                else:
                    # Get the simple value of WFN of component
                    v.append('"')
                    v.append(comp.as_wfn())
                    v.append('"')

                # Append v to the WFN and add a separator
                wfn.append("".join(v))
                wfn.append(CPEComponent2_3_WFN.SEPARATOR_COMP)

        # Del the last separator
        wfn = wfn[:-1]

        # Return the WFN string
        wfn.append(CPE2_3_WFN.CPE_SUFFIX)

        return "".join(wfn)
1343852
public String nextString() {
        nextClean('"');
        StringBuilder sb = new StringBuilder();
        for (;;) {
            char c = next();
            switch (c) {
                case 0:
                case '\n':
                case '\r':
                    throw syntaxError("Unterminated string");
                case '\\':
                    c = next();
                    switch (c) {
                        case 'b':
                            sb.append('\b');
                            break;
                        case 't':
                            sb.append('\t');
                            break;
                        case 'n':
                            sb.append('\n');
                            break;
                        case 'f':
                            sb.append('\f');
                            break;
                        case 'r':
                            sb.append('\r');
                            break;
                        case 'u':
                            sb.append((char)Integer.parseInt(next(4), 16));
                            break;
                        default:
                            sb.append(c);
                    }
                    break;
                case '"':
                    return sb.toString();
                default:
                    if (c < ' ') {
                        throw syntaxError("Unescaped control character (ascii " + ((int) c) + ") in string");
                    }
                    sb.append(c);
                    break;
            }
        }
    }
566615
public static final Function<BigInteger,String> toCurrencyStr() {
        return (Function<BigInteger,String>)((Function)FnNumber.toCurrencyStr());
    }
143788
public String toSourceString() {
    return "{namespace "
        + namespace.identifier()
        + (attrs.isEmpty() ? "" : " " + Joiner.on(' ').join(attrs))
        + "}\n";
  }
14548
public String getString()
    {
        int len=getInt();
        if (len==0xFFFF)
            return null;
        try
        {
            String s=new String(_buf,_pos,len,StringUtil.__ISO_8859_1);
            _pos+=len+1;
            return s;
        }
        catch (IndexOutOfBoundsException e)
        {
            // Bad request!!!
            LogSupport.ignore(log,e);
            return null;
        }
        catch (UnsupportedEncodingException e)
        {
            log.fatal(e);
            System.exit(1);
            return null;
        }
    }
249993
public String getStringF() {
		int len = getInt();
		byte[] utf = new byte[len];
		System.arraycopy(buf, bufPosition, utf, 0, utf.length);
		bufPosition += utf.length;
		return new String(utf, 0, len, charsetUTF8);
	}
1358347
public String toVerboseString() {

    /* Take a local reference to the table in case a resize happens. */
    Entry[] tempTable = table;

    StringBuffer buf = new StringBuffer();

    /* Include the SchemaSet hashcode just in case we need to distinguish them */
    buf.append("SchemaSet ");
    buf.append(this.hashCode());
    buf.append(" {\n");

    /* For each table entry, write out all the SchemaIds */
    for (int i=0; i < tempTable.length;  i++) {
      buf.append("  [");
      buf.append(i);
      buf.append("] ");
      Entry ent = tempTable[i];
      buf.append(ent);
      while (ent != null) {
        ent = ent.next;
        buf.append(" ");
        buf.append(ent);
      }
      buf.append("\n");
    }

    buf.append(" }\n");

    return buf.toString();
  }
146142
public String verboseToString() {
        String out = resultToString(getResult());
        switch (result) {
        case BACK:
        case FAIL:
            out = out + vertex.throwableToString();
            break;
        case FOLLOW:
        case SUCCEED:
            out = out + vertex.moreToString();
            break;
        case POSSIBLE:
            break;
        default:
            break;
        }
        out = out + "Certificate contains:\n" + vertex.certToString();
        return out;
    }
1221902
@Override
	public String getString() {
		String result = cachedString;
		if(result == null) {
			synchronized(this) {
				result = cachedString;
				if(result == null) {
					if(isSinglePrefixBlock() || !isMultiple()) { //covers the case of !isMultiple, ie single addresses, when there is no prefix or the prefix is the bit count
						result = getDefaultLowerString();
					} else if(!isFullRange() || (result = getDefaultSegmentWildcardString()) == null) {
						if(isPrefixBlock()) {
							result = getDefaultMaskedRangeString();
						} else {
							result = getDefaultRangeString();
						}
					}
					cachedString = result;
				}
			}
		}
		return result;
	}
139506
public static Status cpeUri(String value) {
        try {
            String[] parts = value.split(":");
            if (parts.length > 8 || parts.length == 1 || !"cpe".equalsIgnoreCase(parts[0])) {
                LOG.warn("The CPE (" + value + ") is invalid as it is not in the CPE 2.2 URI format");
                return Status.INVALID;
            }
            if (parts.length >= 2 && parts[1].length() == 2) {
                boolean found = false;
                String a = parts[1].substring(1);
                for (Part p : Part.values()) {
                    if (p.getAbbreviation().equals(a)) {
                        found = true;
                        break;
                    }
                }
                if (!found) {
                    LOG.warn("The CPE (" + value + ") is invalid as it has an invalid part attribute");
                    return Status.INVALID_PART;
                }
            } else {
                LOG.warn("The CPE (" + value + ") is invalid as it has an invalid part attribute");
                return Status.INVALID_PART;
            }
            if (parts.length > 2) {
                if ("*".equals(parts[2])) {
                    LOG.warn("The CPE (" + value + ") has an invalid vendor - asterisk");
                    return Status.INVALID;
                }
                Status s = component(Convert.cpeUriToWellFormed(parts[2]));
                if (!s.isValid() || "*".equals(parts[2])) {
                    LOG.warn("The CPE (" + value + ") has an invalid vendor - " + s.getMessage());
                    return s;
                }
            }
            if (parts.length > 3) {
                if ("*".equals(parts[3])) {
                    LOG.warn("The CPE (" + value + ") has an invalid product - asterisk");
                    return Status.INVALID;
                }
                Status s = component(Convert.cpeUriToWellFormed(parts[3]));
                if (!s.isValid()) {
                    LOG.warn("The CPE (" + value + ") has an invalid product - " + s.getMessage());
                    return s;
                }
            }
            if (parts.length > 4) {
                if ("*".equals(parts[4])) {
                    LOG.warn("The CPE (" + value + ") has an invalid version - asterisk");
                    return Status.INVALID;
                }
                Status s = component(Convert.cpeUriToWellFormed(parts[4]));
                if (!s.isValid()) {
                    LOG.warn("The CPE (" + value + ") has an invalid version - " + s.getMessage());
                    return s;
                }
            }
            if (parts.length > 5) {
                if ("*".equals(parts[5])) {
                    LOG.warn("The CPE (" + value + ") has an invalid update - asterisk");
                    return Status.INVALID;
                }
                Status s = component(Convert.cpeUriToWellFormed(parts[5]));
                if (!s.isValid()) {
                    LOG.warn("The CPE (" + value + ") has an invalid update - " + s.getMessage());
                    return s;
                }
            }
            if (parts.length > 6) {
                if (parts[6].startsWith("~")) {
                    if (countCharacter(parts[6], '~') != 5) {
                        LOG.warn("The CPE (" + value + ") has an invalid packed edition - too many entries");
                        return Status.INVALID;
                    }
                    String[] unpacked = parts[6].split("~");
                    if (unpacked.length > 1) {
                        if ("*".equals(unpacked[1])) {
                            LOG.warn("The CPE (" + value + ") has an invalid packed edition - asterisk");
                            return Status.INVALID;
                        }
                        Status s = component(Convert.cpeUriToWellFormed(unpacked[1]));
                        if (!s.isValid()) {
                            LOG.warn("The CPE (" + value + ") has an invalid packed edition - " + s.getMessage());
                            return s;
                        }
                    }
                    if (unpacked.length > 2) {
                        if ("*".equals(unpacked[2])) {
                            LOG.warn("The CPE (" + value + ") has an invalid packed sw_edition - asterisk");
                            return Status.INVALID;
                        }
                        Status s = component(Convert.cpeUriToWellFormed(unpacked[2]));
                        if (!s.isValid()) {
                            LOG.warn("The CPE (" + value + ") has an invalid packed sw_edition - " + s.getMessage());
                            return s;
                        }
                    }
                    if (unpacked.length > 3) {
                        if ("*".equals(unpacked[3])) {
                            LOG.warn("The CPE (" + value + ") has an invalid packed target_sw - asterisk");
                            return Status.INVALID;
                        }
                        Status s = component(Convert.cpeUriToWellFormed(unpacked[3]));
                        if (!s.isValid()) {
                            LOG.warn("The CPE (" + value + ") has an invalid packed target_sw - " + s.getMessage());
                            return s;
                        }
                    }
                    if (unpacked.length > 4) {
                        if ("*".equals(unpacked[4])) {
                            LOG.warn("The CPE (" + value + ") has an invalid packed target_hw - asterisk");
                            return Status.INVALID;
                        }
                        Status s = component(Convert.cpeUriToWellFormed(unpacked[4]));
                        if (!s.isValid()) {
                            LOG.warn("The CPE (" + value + ") has an invalid packed target_hw - " + s.getMessage());
                            return s;
                        }
                    }
                    if (unpacked.length > 5) {
                        if ("*".equals(unpacked[5])) {
                            LOG.warn("The CPE (" + value + ") has an invalid packed other - asterisk");
                            return Status.INVALID;
                        }
                        Status s = component(Convert.cpeUriToWellFormed(unpacked[5]));
                        if (!s.isValid()) {
                            LOG.warn("The CPE (" + value + ") has an invalid packed other - " + s.getMessage());
                            return s;
                        }
                    }
                } else {
                    if ("*".equals(parts[6])) {
                        LOG.warn("The CPE (" + value + ") has an invalid edition - asterisk");
                        return Status.INVALID;
                    }
                    Status s = component(Convert.cpeUriToWellFormed(parts[6]));
                    if (!s.isValid()) {
                        LOG.warn("The CPE (" + value + ") has an invalid edition - " + s.getMessage());
                        return s;
                    }
                }
            }
            if (parts.length > 7) {
                if ("*".equals(parts[7])) {
                    LOG.warn("The CPE (" + value + ") has an invalid language - asterisk");
                    return Status.INVALID;
                }
                Status s = component(Convert.cpeUriToWellFormed(parts[7]));
                if (!s.isValid()) {
                    LOG.warn("The CPE (" + value + ") has an invalid language - " + s.getMessage());
                    return s;
                }
            }
        } catch (CpeEncodingException ex) {
            LOG.warn("The CPE (" + value + ") has an unencoded special characters");
            return Status.INVALID;
        }
        return Status.VALID;
    }
99826
def _parse(self):
        

        # Check prefix and initial bracket of WFN
        if self._str[0:5] != CPE2_3_WFN.CPE_PREFIX:
            errmsg = "Bad-formed CPE Name: WFN prefix not found"
            raise ValueError(errmsg)

        # Check final backet
        if self._str[-1:] != "]":
            errmsg = "Bad-formed CPE Name: final bracket of WFN not found"
            raise ValueError(errmsg)

        content = self._str[5:-1]

        if content != "":
            # Dictionary with pairs attribute-value
            components = dict()

            # Split WFN in components
            list_component = content.split(CPEComponent2_3_WFN.SEPARATOR_COMP)

            # Adds the defined components
            for e in list_component:
                # Whitespace not valid in component names and values
                if e.find(" ") != -1:
                    msg = "Bad-formed CPE Name: WFN with too many whitespaces"
                    raise ValueError(msg)

                # Split pair attribute-value
                pair = e.split(CPEComponent2_3_WFN.SEPARATOR_PAIR)
                att_name = pair[0]
                att_value = pair[1]

                # Check valid attribute name
                if att_name not in CPEComponent.CPE_COMP_KEYS_EXTENDED:
                    msg = "Bad-formed CPE Name: invalid attribute name '{0}'".format(
                        att_name)
                    raise ValueError(msg)

                if att_name in components:
                    # Duplicate attribute
                    msg = "Bad-formed CPE Name: attribute '{0}' repeated".format(
                        att_name)
                    raise ValueError(msg)

                if not (att_value.startswith('"') and
                        att_value.endswith('"')):

                    # Logical value
                    strUpper = att_value.upper()
                    if strUpper == CPEComponent2_3_WFN.VALUE_ANY:
                        comp = CPEComponentAnyValue()
                    elif strUpper == CPEComponent2_3_WFN.VALUE_NA:
                        comp = CPEComponentNotApplicable()
                    else:
                        msg = "Invalid logical value '{0}'".format(att_value)
                        raise ValueError(msg)

                elif att_value.startswith('"') and att_value.endswith('"'):
                    # String value
                    comp = CPEComponent2_3_WFN(att_value, att_name)

                else:
                    # Bad value
                    msg = "Bad-formed CPE Name: invalid value '{0}'".format(
                        att_value)
                    raise ValueError(msg)

                components[att_name] = comp

            # Adds the undefined components
            for ck in CPEComponent.CPE_COMP_KEYS_EXTENDED:
                if ck not in components:
                    components[ck] = CPEComponentUndefined()

            # #######################
            #  Storage of CPE Name  #
            # #######################

            part_comp = components[CPEComponent.ATT_PART]
            if isinstance(part_comp, CPEComponentLogical):
                elements = []
                elements.append(components)
                self[CPE.KEY_UNDEFINED] = elements
            else:
                # Create internal structure of CPE Name in parts:
                # one of them is filled with identified components,
                # the rest are empty
                part_value = part_comp.get_value()
                # Del double quotes of value
                system = part_value[1:-1]
                if system in CPEComponent.SYSTEM_VALUES:
                    self._create_cpe_parts(system, components)
                else:
                    self._create_cpe_parts(CPEComponent.VALUE_PART_UNDEFINED,
                                           components)

        # Fills the empty parts of internal structure of CPE Name
        for pk in CPE.CPE_PART_KEYS:
            if pk not in self.keys():
                self[pk] = []
1266948
public String getFormatted() {
        String input = this.getUnformatted() + "   ";
        StringBuilder buf = new StringBuilder();
        for (int i = 0; i < this.getUnformatted().length(); i+= 4) {
            buf.append(input, i, i+4);
            buf.append(' ');
        }
        return buf.toString().trim();
    }