/** * Returns a printable representation of this header. * * @param filter FormatProperties object for filtering this header. * @return Returns a string representation of this header. */ public String toString(FormatProperties filter) { // Check for Port filtering if (filter != null) { // If filter is enabled boolean print = false; String port = filter.getPort(); if (port == null) { print = true; // The filtering doesn't apply to this header } else if (port.equals(sourceport.toString()) || port.equals(destport.toString())) { print = true; } if (!print) { // Don't print the packet if (Trace.isTraceOn() && Trace.isTraceInformationOn()) { Trace.log(Trace.INFORMATION, CLASS + ".toString() " + "Not printing record"); } return ""; // Return empty record because it didn't pass the filter } } String portname = (String) Port.get(this.sourceport.toString()); String portname2 = (String) Port.get(this.destport.toString()); // Make sure we have enough data to parse a full header if (rawheader.getBitSize() < getHeaderLen()) { return (new Data(rawheader)).toString(); } if (portname == null) { portname = UNASSIGNED; } if (portname2 == null) { portname2 = UNASSIGNED; } String sourceport = this.sourceport.toString() + ", " + portname; String destport = this.destport.toString() + ", " + portname2; Object[] args = {sourceport, destport, length, checksum}; return Formatter.jsprintf( "\t " + UDPSTR + " . . . . : " + SRC + ": {0,18,L} " + DST + ": {1,18,L}\n" + "\t\t\t " + LEN + ": {2,5,L} " + CHKSUM + ": {3}\n", args) + printHexHeader() + printnext(filter) + (new Data(rawpayload)).toString(); }
private static void printOct(DBM dbm, LinearTerm[] substitution, IntegerInf maxK) { StringBuffer sb = new StringBuffer(); if (maxK != null) { sb.append("k>=0, "); if (maxK.isFinite()) sb.append("k<=" + maxK.toInt() + ", "); } Matrix m = dbm.mat(); int size = m.size(); for (int i = 0; i < size; ++i) { for (int j = 2 * (i / 2); j < size; ++j) { if (i == j) continue; Field f = m.get(i, j); if (!f.isFinite()) continue; sb.append( "" + substitution[i].times(1).toSB(true) + substitution[j].times(-1).toSB(false) + "<=" + f.toString() + ", "); } } if (DeltaClosure.DEBUG_LEVEL >= DeltaClosure.DEBUG_LOW) System.out.println(sb); }
/** * Creates a fictitious MetadataType for the given field of the given metadata type, assuming that * the latter is a person. The method is called from the constructor and thus should not be * overloaded. * * @param type a metadata type which represents a person * @param field a field of the person record * @return a fictitious MetadataGroupType with the person’s subfields */ private static final MetadataType getMetadataTypeFor(MetadataType type, Field field) { MetadataType result = new MetadataType(); result.setName(type.getName() + '.' + field.toString()); if (type.getNum() != null) { result.setNum(type.getNum()); } result.setAllLanguages(Helper.getAllStrings(field.getResourceKey())); result.setIsPerson(false); result.setIdentifier(field.isIdentifier()); return result; }
/** Prints the fields of a document for human consumption. */ public final String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("Document<"); for (int i = 0; i < fields.size(); i++) { Field field = (Field) fields.get(i); buffer.append(field.toString()); if (i != fields.size() - 1) buffer.append(" "); } buffer.append(">"); return buffer.toString(); }
/** * Returns a string representation of this record. The string representation is a comma separated * list of values surrounded by square brackets. * * @return a string representation of this record. */ @Override public String toString() { StringBuffer recordString = new StringBuffer("["); for (Field<? extends Object> field : this.data) { recordString.append(field.toString()); recordString.append(','); } if (!this.data.isEmpty()) { recordString.deleteCharAt(recordString.length() - 1); } recordString.append(']'); return recordString.toString(); }
public Object getUIRep() { if (uiRepCopy == null) { if (field == null) ExpCoordinator.print( new String("FieldParam(" + getLabel() + ").getUIRep field is null"), TEST_UIREP); else ExpCoordinator.print( new String("FieldParam(" + getLabel() + ").getUIRep field:" + field.toString()), TEST_UIREP); uiRepCopy = field.getUIRepCopy(isEditable()); setUIRep(uiRepCopy.getComponent()); } return (super.getUIRep()); }
protected void doOutputField(Field field) { Format format = outputCellStart(field); // Style attribute courtesy of Brendon Price <*****@*****.**> out.print("<span style=\""); if (format.getFontFamilyName() != null) out.print("font-family: " + format.getFontFamilyName() + "; "); out.print("font-size: " + format.getSize() + "pt; "); outputColor(format.getColor()); // Border code courtesy of Khadiyd Idris <*****@*****.**> Border b = field.getBorderOrDefault(); String bcolor = "black"; if (b.getColor() != null) { bcolor = "#" + Integer.toHexString(b.getColor().getRed()) + Integer.toHexString(b.getColor().getGreen()) + Integer.toHexString(b.getColor().getBlue()); } if (b.getTop() != null) out.print("border-top: solid " + bcolor + " " + b.getTop().getThickness() + "pt; "); if (b.getLeft() != null) out.print("border-left: solid " + bcolor + " " + b.getLeft().getThickness() + "pt; "); if (b.getBottom() != null) out.print("border-bottom: solid " + bcolor + " " + b.getBottom().getThickness() + "pt; "); if (b.getRight() != null) out.print("border-right: solid " + bcolor + " " + b.getRight().getThickness() + "pt; "); out.print("\">"); if (format.isBold()) out.print("<b>"); if (format.isItalic()) out.print("<i>"); if (format.isUnderline()) out.print("<u>"); String str = field.toString(); if (str == null || str.length() == 0) str = " "; // Fix courtesy of Brendon Price <*****@*****.**> if (" ".equals(str)) out.print(str); else out.print(StringUtils.newlinesToXHTMLBreaks(StringUtils.escapeHTML(str))); if (format.isUnderline()) out.print("</u>"); if (format.isItalic()) out.print("</i>"); if (format.isBold()) out.print("</b>"); out.print("</span>"); outputCellEnd(); }
@Override public String toString() { String stringRepresention = this.getStringRepresentation(); int i = 0; if (stringRepresention.length() == 0) { String res = ""; for (Field field : this.getFields()) { res += (i != 0 ? "," : "") + field.toString(); i++; } res += ""; return res; } else { return stringRepresention; } }
/** * Prints the contents of the TRE to the given PrintStream * * @param stream PrintStream to print to * @throws NITFException */ public void print(PrintStream stream) throws NITFException { stream.println("\n---------------" + getTag() + "---------------"); for (TREIterator it = iterator(); it.hasNext(); ) { FieldPair pair = it.next(); String desc = it.getFieldDescription(); Field field = pair.getField(); stream.println( pair.getName() + (desc != null ? (" (" + desc + ")") : "") + " = [" + (field.getType() == FieldType.NITF_BINARY ? ("<binary stuff, length = " + field.getLength() + ">") : field.toString()) + "]"); } stream.println("------------------------------------"); }
@Override public String toString() { StringBuffer sb = new StringBuffer("insert into "); sb.append(target); // fields ? if (fields != null && fields.size() > 0) { sb.append("("); // fields StringBuffer sb2 = new StringBuffer(); for (Field field : fields) { if (field.getExpression().getType() != Expression.REFER) throw new SQLRuntimeException("insert field can only be a column referer."); sb2.append(", ").append(field.toString()); } sb.append(sb2.substring(2)); sb.append(")"); } // values ? if (values != null && values.size() > 0) { sb.append(" values("); StringBuffer sb2 = new StringBuffer(); for (Expression v : values) { sb2.append(", ").append(v.toString()); } sb.append(sb2.substring(2)); sb.append(")"); } else { if (subQuery == null) throw new SQLRuntimeException("Invalid \"insert\" statement, no values specified."); // sub query (select) sb.append(" ").append(subQuery.toString()); } return sb.toString(); }
public String toString() { String text = name + "\n" + mergeId.toString(); return text; }
@Override public String toString() { return "range:" + field.toString(); }
@Override public String toString(Object value) { return field.toString(value); }
/** * Returns a specific sub-field of the person record. * * @param field field to return * @return the field selected */ private SingleValueRenderableMetadatum getField(Field field) { String key = metadataType.getName() + '.' + field.toString(); return (SingleValueRenderableMetadatum) members.get(key); }
/** * Returns the source port of this UDP Header. * * @return String containing a decimal representation of the source port. */ public String getSrcPort() { return sourceport.toString(); }
/** * Returns the destination port of this UDP Header. * * @return String containing a decimal representation of the destination port. */ public String getDstPort() { return destport.toString(); }
/** * Returns the length of this UDP Header. * * @return String containing a decimal representation of the length port. */ public String getLength() { return length.toString(); }
/** * ** Sets the field at the specified index ** @param ndx The index of the field to set ** @param * fld The field to set * */ public void setField(int ndx, Field fld) { this.templateProps.setString(String.valueOf(ndx), fld.toString()); this.fieldCount = -1; }
@Override public String toString() { return "value:" + field.toString(); }