} else if (m_structure.attribute(i).isString()) { vals[i] = 0; m_structure.attribute(i).setStringValue(Utils.unquote(val.toString())); } else if (m_structure.attribute(i).isDate()) { String format = m_structure.attribute(i).getDateFormat();
} else if (m_structure.attribute(i).isString()) { vals[i] = 0; m_structure.attribute(i).setStringValue(Utils.unquote(val.toString())); } else if (m_structure.attribute(i).isDate()) { String format = m_structure.attribute(i).getDateFormat();
String valToSetInHeader = one.m_stringVals.get(one.m_instance.attribute(i).name()); currentStructure.attribute(count).setStringValue(valToSetInHeader); vals[count] = 0; String valToSetInHeader = one.m_stringVals.get(two.m_instance.attribute(i).name()); currentStructure.attribute(count).setStringValue(valToSetInHeader); vals[count] = 0;
String valToSetInHeader = one.m_stringVals.get(one.m_instance.attribute(i).name()); currentStructure.attribute(count).setStringValue(valToSetInHeader); vals[count] = 0; String valToSetInHeader = one.m_stringVals.get(two.m_instance.attribute(i).name()); currentStructure.attribute(count).setStringValue(valToSetInHeader); vals[count] = 0;
String valToSetInHeader = one.m_stringVals.get(one.m_instance.attribute(i).name()); currentStructure.attribute(count).setStringValue(valToSetInHeader); vals[count] = 0; String valToSetInHeader = one.m_stringVals.get(two.m_instance.attribute(i).name()); currentStructure.attribute(count).setStringValue(valToSetInHeader); vals[count] = 0;
String valToSetInHeader = one.m_stringVals.get(one.m_instance.attribute(i).name()); currentStructure.attribute(count).setStringValue(valToSetInHeader); vals[count] = 0; String valToSetInHeader = one.m_stringVals.get(two.m_instance.attribute(i).name()); currentStructure.attribute(count).setStringValue(valToSetInHeader); vals[count] = 0;
m_instanceOutHeader.attribute(1).setStringValue( m_stdOutbuffer.length() > 0 ? m_stdOutbuffer.toString() : "Process completed successfully"); m_instanceOutHeader.attribute(2).setStringValue( m_stdErrBuffer.length() > 0 ? m_stdErrBuffer.toString() : ""); double[] vals = new double[3];
m_instanceOutHeader.attribute(1).setStringValue( m_stdOutbuffer.length() > 0 ? m_stdOutbuffer.toString() : ""); m_instanceOutHeader.attribute(2).setStringValue( m_stdErrBuffer.length() > 0 ? m_stdErrBuffer.toString() : "Process did " + "not complete successfully");
m_instanceOutHeader.attribute(1).setStringValue( m_stdOutbuffer.length() > 0 ? m_stdOutbuffer.toString() : ""); m_instanceOutHeader.attribute(2).setStringValue( m_stdErrBuffer.length() > 0 ? m_stdErrBuffer.toString() : "Process did " + "not complete successfully");
m_instanceOutHeader.attribute(1).setStringValue( m_stdOutbuffer.length() > 0 ? m_stdOutbuffer.toString() : "Process completed successfully"); m_instanceOutHeader.attribute(2).setStringValue( m_stdErrBuffer.length() > 0 ? m_stdErrBuffer.toString() : ""); double[] vals = new double[3];
@Override public Instance output() { Instance outInst = m_delegate.output(); if (m_hasStringAtts && outInst != null) { for (int i = 0; i < outInst.dataset().numAttributes(); i++) { if (outInst.dataset().attribute(i).isString() && !outInst.isMissing(i)) { String val = outInst.stringValue(i); outInst.attribute(i).setStringValue(val); outInst.setValue(i, 0); } } } return outInst; }
/** * Apply this rule to the supplied instance * * @param inst the instance to apply to */ public void apply(Instance inst) { for (int i = 0; i < m_selectedAtts.length; i++) { int numStringVals = inst.attribute(m_selectedAtts[i]).numValues(); if (!inst.isMissing(m_selectedAtts[i])) { String value = inst.stringValue(m_selectedAtts[i]); value = apply(value); inst.dataset().attribute(m_selectedAtts[i]).setStringValue(value); // only set the index to zero if there were more than 1 string values // for this string attribute (meaning that although the data is // streaming // in, the user has opted to retain all string values in the header. // We // only operate in pure streaming - one string value in memory at any // one time - mode). // this check saves time (no new attribute vector created) if there is // only one value (i.e. index is already zero). if (numStringVals > 1) { inst.setValue(m_selectedAtts[i], 0); } } } }
/** * Apply this rule to the supplied instance * * @param inst the instance to apply to */ public void apply(Instance inst) { for (int i = 0; i < m_selectedAtts.length; i++) { int numStringVals = inst.attribute(m_selectedAtts[i]).numValues(); if (!inst.isMissing(m_selectedAtts[i])) { String value = inst.stringValue(m_selectedAtts[i]); value = apply(value); inst.dataset().attribute(m_selectedAtts[i]).setStringValue(value); // only set the index to zero if there were more than 1 string values // for this string attribute (meaning that although the data is // streaming // in, the user has opted to retain all string values in the header. // We // only operate in pure streaming - one string value in memory at any // one time - mode). // this check saves time (no new attribute vector created) if there is // only one value (i.e. index is already zero). if (numStringVals > 1) { inst.setValue(m_selectedAtts[i], 0); } } } }
/** * Make an output instance given an input one * * @param inputI the input instance to process * @return the output instance with substrings replaced */ public Instance makeOutputInstance(Instance inputI) { double[] vals = new double[m_outputStructure.numAttributes()]; String[] stringVals = new String[m_outputStructure.numAttributes()]; for (int i = 0; i < inputI.numAttributes(); i++) { if (inputI.attribute(i).isString() && !inputI.isMissing(i)) { stringVals[i] = inputI.stringValue(i); } else { vals[i] = inputI.value(i); } } for (SubstringReplacerMatchRule mr : m_matchRules) { mr.apply(stringVals); } for (int i = 0; i < m_outputStructure.numAttributes(); i++) { if (m_outputStructure.attribute(i).isString() && stringVals[i] != null) { m_outputStructure.attribute(i).setStringValue(stringVals[i]); } } Instance result = new DenseInstance(inputI.weight(), vals); result.setDataset(m_outputStructure); return result; }
/** * Make an output instance given an input one * * @param inputI the input instance to process * @return the output instance with substrings replaced */ public Instance makeOutputInstance(Instance inputI) { double[] vals = new double[m_outputStructure.numAttributes()]; String[] stringVals = new String[m_outputStructure.numAttributes()]; for (int i = 0; i < inputI.numAttributes(); i++) { if (inputI.attribute(i).isString() && !inputI.isMissing(i)) { stringVals[i] = inputI.stringValue(i); } else { vals[i] = inputI.value(i); } } for (SubstringReplacerMatchRule mr : m_matchRules) { mr.apply(stringVals); } for (int i = 0; i < m_outputStructure.numAttributes(); i++) { if (m_outputStructure.attribute(i).isString() && stringVals[i] != null) { m_outputStructure.attribute(i).setStringValue(stringVals[i]); } } Instance result = new DenseInstance(inputI.weight(), vals); result.setDataset(m_outputStructure); return result; }
&& !filteredI.isMissing(i)) { String val = filteredI.stringValue(i); filteredI.dataset().attribute(i).setStringValue(val); filteredI.setValue(i, 0);
&& !filteredI.isMissing(i)) { String val = filteredI.stringValue(i); filteredI.dataset().attribute(i).setStringValue(val); filteredI.setValue(i, 0);
if (filteredI.attribute(i).isString() && ! filteredI.isMissing(i)) { String val = filteredI.stringValue(i); structureCopy.attribute(i).setStringValue(val); filteredI.setValue(i, 0);
if (filteredI.attribute(i).isString() && ! filteredI.isMissing(i)) { String val = filteredI.stringValue(i); structureCopy.attribute(i).setStringValue(val); filteredI.setValue(i, 0);
modelAtt.setStringValue(incoming.stringValue(m_attributeMap[i]));