本文整理匯總了Java中mesquite.lib.MesquiteString類的典型用法代碼示例。如果您正苦於以下問題:Java MesquiteString類的具體用法?Java MesquiteString怎麽用?Java MesquiteString使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MesquiteString類屬於mesquite.lib包,在下文中一共展示了MesquiteString類的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: drawInCell
import mesquite.lib.MesquiteString; //導入依賴的package包/類
public void drawInCell(int ic, Graphics g, int x, int y, int w, int h, boolean selected) {
if (data == null || booleanTask==null)
return;
MesquiteBoolean result = new MesquiteBoolean();
MesquiteString resultString = new MesquiteString();
booleanTask.calculateBoolean( data, ic, result, resultString);
if (booleanTask.displayTrueAsDark()==standardDirection.getValue()) {
if (result.getValue())
g.setColor(Color.gray);
else {
g.setColor(Color.white);
}
}
else if (result.getValue())
g.setColor(Color.white);
else {
g.setColor(Color.gray);
}
g.fillRect(x, y, w, h);
}
示例2: 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);
}
}
}
}
示例3: 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);
}
示例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.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;
}
示例5: getStringForExplanation
import mesquite.lib.MesquiteString; //導入依賴的package包/類
/** Returns string to be displayed in explanation area on mouseover of cell */
public String getStringForExplanation(int ic){
if (data == null || booleanTask==null)
return null;
MesquiteBoolean result = new MesquiteBoolean();
MesquiteString resultString = new MesquiteString();
booleanTask.calculateBoolean( data, ic, result, resultString);
return booleanTask.getValueString(result.getValue());
}
示例6: 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;
}
示例7: 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);
}
示例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 = 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);
}
示例9: 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;
}
示例10: 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);
}
示例11: uploadAbiFilesToDb
import mesquite.lib.MesquiteString; //導入依賴的package包/類
/**
* loops through a user-specified directory on the filesystem
* and uploads abi files to a database url
*/
public boolean uploadAbiFilesToDb(DNADatabaseURLSource databaseURLSource) {
if (databaseURLSource==null)
return false;
if (nameParserManager!=null) {
//nameParsingRule = nameParserManager.chooseNameParsingRules(nameParsingRule);
if (!queryNames()) {
// they cancelled, so don't upload
return false;
} else {
setUrl(urlField.getText());
}
}
String directoryPath = MesquiteFile.chooseDirectory("Choose directory containing ABI files:", null);
if (StringUtil.blank(directoryPath)) {
return false;
} else {
File directory = new File(directoryPath);
if (directory.exists() && directory.isDirectory()) {
File[] files = directory.listFiles();
if (files == null || files.length == 0) {
MesquiteMessage.warnUser("There are no files in the selected directory.");
} else {
StringBuffer logBuffer = new StringBuffer();
SequenceUploader uploader = new SequenceUploader(databaseURLSource);
boolean result = authorDefaults.verifyAuthorIsntDefault();
if (!result) {
return false;
}
storePreferences();
// create the upload batch on the server
Long batchId = uploader.createAB1BatchOnServer(getUrl(), uploadBatchNameField.getText(), uploadBatchDescriptionArea.getText(), MesquiteModule.author.getCode());
if (batchId == null) {
MesquiteMessage.warnUser("Unable to create chromatogram batch on the server. Chromatogram upload will not continue.");
return false;
}
for (int i = 0; i < files.length; i++) {
File nextAbi = files[i];
MesquiteString sampleCodeSuffix = new MesquiteString();
MesquiteString sampleCode = new MesquiteString();
MesquiteString primerName = new MesquiteString();
MesquiteString dnaCodeResult = new MesquiteString();
//here's where the names parser processes the name
if (nameParserManager!=null && nextAbi != null && !nextAbi.isDirectory()
&& nextAbi.exists()) {
if (!nameParserManager.parseFileName(nextAbi.getName(), sampleCode, sampleCodeSuffix, primerName, logBuffer, dnaCodeResult, null)) {
MesquiteMessage.warnUser("Can't upload file: " + nextAbi + " to database because it doesn't match the naming rule.");
} else {
MesquiteMessage.warnUser("Going to upload file: " + nextAbi + " to server.");
String totalCode = dnaCodeResult + sampleCode.toString();
// totalCode -- eg. DNA1200 or BP1502
uploader.uploadAB1ToServer(getUrl(),totalCode, null, nextAbi, batchId);
}
}
}
}
return true;
} else {
MesquiteMessage.warnUser("The directory path: " + directoryPath + " is not valid.");
return false;
}
}
}