本文整理匯總了Java中mesquite.lib.MesquiteString.setValue方法的典型用法代碼示例。如果您正苦於以下問題:Java MesquiteString.setValue方法的具體用法?Java MesquiteString.setValue怎麽用?Java MesquiteString.setValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mesquite.lib.MesquiteString
的用法示例。
在下文中一共展示了MesquiteString.setValue方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: processInfoFile
import mesquite.lib.MesquiteString; //導入方法依賴的package包/類
public static void processInfoFile(String infoFilePath, MesquiteString fullName, MesquiteString voucherCode){
String s = MesquiteFile.getFileContentsAsString(infoFilePath);
Document doc = XMLUtil.getDocumentFromString(s);
if (doc == null) { // must be old format
fullName.setValue(s);
} else {
Element rootElement = doc.getRootElement();
Element chromaseqElement = rootElement.element("chromaseq");
if (chromaseqElement != null) {
String versionString = chromaseqElement.attributeValue("version");
int versionInXml = MesquiteInteger.fromString(versionString);
if (versionInXml==infoFileVersion) {
Element processedFolderElement = chromaseqElement.element("processedFolder");
Element sampleElement = processedFolderElement.element("sample");
String name = sampleElement.attributeValue("fullName");
if (fullName!=null) fullName.setValue(name);
String voucher = sampleElement.attributeValue("voucherCode");
if (voucherCode!=null) voucherCode.setValue(voucher);
}
}
}
}
示例2: calculateNumber
import mesquite.lib.MesquiteString; //導入方法依賴的package包/類
public void calculateNumber(Taxon taxon, MesquiteNumber result, MesquiteString resultString){
if (result==null)
return;
result.setToUnassigned();
Taxa taxa = taxon.getTaxa();
int it = taxon.getIndex();
clearResultAndLastResult(result);
int count = 0;
for (int im = 0; im < getProject().getNumberCharMatrices(taxa); im++){
CharacterData data = getProject().getCharacterMatrix(taxa, im);
if (data.hasDataForTaxon(it)){
count++;
}
}
result.setValue(count);
if (resultString!=null){
resultString.setValue(result.toString());
}
saveLastResult(result);
saveLastResultString(resultString);
}
示例3: getTerminals
import mesquite.lib.MesquiteString; //導入方法依賴的package包/類
public static int getTerminals(Element element, String[] names, boolean[] leaves, boolean[] hasChildren, MesquiteString termName, MesquiteInteger c) {
boolean isNode = isNode(element);
boolean isName = "Name".equalsIgnoreCase(element.getName());
List children = element.content();
Iterator iterator = children.iterator();
int terms = 0;
while (iterator.hasNext()) {
Object o = iterator.next();
if (isName){
if (o instanceof CDATA) {
termName.setValue(((CDATA)o).getText());
}
}
else if (o instanceof Element) {
Element e = (Element)o;
if (isContinuable(e))
terms += getTerminals((Element) o, names, leaves,hasChildren, termName, c);
}
}
if (isNode && terms == 0) {
names[c.getValue()] = new String(termName.getValue()); //element.getAttributeValue("NAME");
if (isLeaf(element))
leaves[c.getValue()] = true;
else
leaves[c.getValue()] = false;
if (hasChildren(element))
hasChildren[c.getValue()] = true;
else
hasChildren[c.getValue()] = false;
c.increment();
return 1;
}
else
return terms;
}
示例4: getTerminals
import mesquite.lib.MesquiteString; //導入方法依賴的package包/類
public static int getTerminals(Element element, String[] names, boolean[] leaves, boolean[] hasChildren, MesquiteString termName, MesquiteInteger c) {
boolean isNode = isNode(element);
boolean isName = "Name".equalsIgnoreCase(element.getName());
List children = element.getContent();
Iterator iterator = children.iterator();
int terms = 0;
while (iterator.hasNext()) {
Object o = iterator.next();
if (isName){
if (o instanceof CDATA) {
termName.setValue(((CDATA)o).getText());
}
}
else if (o instanceof Element) {
Element e = (Element)o;
if (isContinuable(e))
terms += getTerminals((Element) o, names, leaves,hasChildren, termName, c);
}
}
if (isNode && terms == 0) {
names[c.getValue()] = new String(termName.getValue()); //element.getAttributeValue("NAME");
if (isLeaf(element))
leaves[c.getValue()] = true;
else
leaves[c.getValue()] = false;
if (hasChildren(element))
hasChildren[c.getValue()] = true;
else
hasChildren[c.getValue()] = false;
c.increment();
return 1;
}
else
return terms;
}
示例5: calculateNumber
import mesquite.lib.MesquiteString; //導入方法依賴的package包/類
public void calculateNumber(Taxon taxon, MesquiteNumber result, MesquiteString resultString){
if (result==null)
return;
result.setToUnassigned();
clearResultAndLastResult(result);
Taxa taxa = taxon.getTaxa();
int it = taxa.whichTaxonNumber(taxon);
if (taxa != currentTaxa || observedStates == null ) {
observedStates = matrixSourceTask.getCurrentMatrix(taxa);
currentTaxa = taxa;
}
if (observedStates==null)
return;
DNAData data = (DNAData)observedStates.getParentData();
result.setValue(0);
if (data!=null) {
AceFile ace = AceFile.getAceFile(this, data, it);
if (ace!=null)
result.setValue(ace.getNumReads());
}
if (resultString!=null)
resultString.setValue("Number of reads "+ observedStates.getName() + ": " + result.toString());
saveLastResult(result);
saveLastResultString(resultString);
}
示例6: calculateNumber
import mesquite.lib.MesquiteString; //導入方法依賴的package包/類
public void calculateNumber(Taxon taxon, MesquiteNumber result, MesquiteString resultString){
if (result==null)
return;
clearResultAndLastResult(result);
Taxa taxa = taxon.getTaxa();
int it = taxa.whichTaxonNumber(taxon);
if (taxa != currentTaxa || observedStates == null ) {
observedStates = matrixSourceTask.getCurrentMatrix(taxa);
currentTaxa = taxa;
}
if (observedStates==null)
return;
DNAData data = (DNAData)observedStates.getParentData();
CharInclusionSet inclusion = null;
if (data !=null)
inclusion = (CharInclusionSet)data.getCurrentSpecsSet(CharInclusionSet.class);
int numChars = observedStates.getNumChars();
int charExc = 0;
int tot = 0;
int count = 0;
double value = 0.0;
if (numChars != 0) {
for (int ic = 0; ic<data.getNumChars(); ic++) {
if (inclusion == null || inclusion.isBitOn(ic)){
long s = data.getState(ic,it);
if (!CategoricalState.isUnassigned(s) && !CategoricalState.isInapplicable(s)) {
if (s == A || s == T || s == AT) //monomorphic A or T or A&T or uncertain A or T
tot++;
else if (s == C || s == G || s == CG) { //monomorphic C or G or C&G or uncertain C or G
tot++;
count++;
}
}
} else
charExc++;
}
if (tot == 0)
value = 0;
else
value = ((double)count)/tot;
result.setValue(value);
}
String exs = "";
if (charExc > 0)
exs = " (" + Integer.toString(charExc) + " characters excluded)";
if (resultString!=null)
resultString.setValue("Proportion of CG in taxon "+ observedStates.getName() + exs + ": " + result.toString());
saveLastResult(result);
saveLastResultString(resultString);
}
示例7: getTerminalsWithAuthors
import mesquite.lib.MesquiteString; //導入方法依賴的package包/類
public static int getTerminalsWithAuthors(Element element, String[] names, String[] authors, boolean[] leaves, boolean[] hasChildren, MesquiteString termName,MesquiteString authorName, MesquiteInteger c) {
boolean isNode = isNode(element);
boolean isName = "Name".equalsIgnoreCase(element.getName());
boolean isAuthor = "Authority".equalsIgnoreCase(element.getName());
List children = element.content();
Iterator iterator = children.iterator();
int terms = 0;
while (iterator.hasNext()) {
Object o = iterator.next();
if (isName){
if (o instanceof CDATA) {
termName.setValue(((CDATA)o).getText());
}
}
else if (isAuthor){
if (o instanceof CDATA) {
authorName.setValue(((CDATA)o).getText());
}
}
else if (o instanceof Element) {
Element e = (Element)o;
if (isContinuable(e))
terms += getTerminals((Element) o, names, leaves,hasChildren, termName, c);
}
}
if (isNode && terms == 0) {
names[c.getValue()] = new String(termName.getValue()); //element.getAttributeValue("NAME");
authors[c.getValue()] = new String(authorName.getValue()); //element.getAttributeValue("NAME");
if (isLeaf(element))
leaves[c.getValue()] = true;
else
leaves[c.getValue()] = false;
if (hasChildren(element))
hasChildren[c.getValue()] = true;
else
hasChildren[c.getValue()] = false;
c.increment();
return 1;
}
else
return terms;
}
示例8: calculateNumber
import mesquite.lib.MesquiteString; //導入方法依賴的package包/類
public void calculateNumber(Taxon taxon, MesquiteNumber result, MesquiteString resultString){
if (result==null)
return;
clearResultAndLastResult(result);
Taxa taxa = taxon.getTaxa();
int it = taxa.whichTaxonNumber(taxon);
if (taxa != currentTaxa || observedStates == null ) {
observedStates = matrixSourceTask.getCurrentMatrix(taxa);
currentTaxa = taxa;
}
if (observedStates==null)
return;
DNAData data = (DNAData)observedStates.getParentData();
CharInclusionSet inclusion = null;
if (data !=null)
inclusion = (CharInclusionSet)data.getCurrentSpecsSet(CharInclusionSet.class);
int numChars = observedStates.getNumChars();
int charExc = 0;
int tot = 0;
int count = 0;
double value = 0.0;
if (numChars != 0) {
for (int ic = 0; ic<data.getNumChars(); ic++) {
if (inclusion == null || inclusion.isBitOn(ic)){
long s = data.getState(ic,it);
if (!CategoricalState.isUnassigned(s) && !CategoricalState.isInapplicable(s)) {
if (s == A || s == T || s == AT) //monomorphic A or T or A&T or uncertain A or T
tot++;
else if (s == C || s == G || s == CG) { //monomorphic C or G or C&G or uncertain C or G
tot++;
count++;
}
}
} else
charExc++;
}
if (tot == 0)
value = MesquiteDouble.unassigned; //changed from 0, 26 jan '14
else
value = ((double)count)/tot;
result.setValue(value);
}
String exs = "";
if (charExc > 0)
exs = " (" + Integer.toString(charExc) + " characters excluded)";
if (resultString!=null)
resultString.setValue("Proportion of CG in taxon "+ observedStates.getName() + exs + ": " + result.toString());
saveLastResult(result);
saveLastResultString(resultString);
}