本文整理汇总了Java中jloda.util.Pair.get1方法的典型用法代码示例。如果您正苦于以下问题:Java Pair.get1方法的具体用法?Java Pair.get1怎么用?Java Pair.get1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jloda.util.Pair
的用法示例。
在下文中一共展示了Pair.get1方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apply
import jloda.util.Pair; //导入方法依赖的package包/类
public void apply(NexusStreamParser np) throws Exception {
np.matchIgnoreCase("queryServer url=");
final String url = np.getWordFileNamePunctuation().replace("http://", "").replace("/MeganServer", "").replace("/$", "");
np.matchIgnoreCase("query=");
String query = np.getWordMatchesIgnoringCase("numberOfFiles listFiles");
np.matchIgnoreCase(";");
Pair<String, String> credentials = RemoteServiceManager.getCredentials(url);
if (credentials == null) {
NotificationsInSwing.showError(getViewer().getFrame(), "Server unknown to MEGAN (please first add it): " + url);
} else {
final String fullURL = RemoteServiceManager.getServerURL(url);
final Megan5ServerConnector connector = new Megan5ServerConnector(fullURL, credentials.get1(), credentials.get2());
if (query.equalsIgnoreCase("countFiles")) {
Director.showMessageWindow();
System.out.println("Server=" + url + ", number of files=" + connector.getAvailiableDatasets().length);
} else if (query.equalsIgnoreCase("listFiles")) {
Director.showMessageWindow();
System.out.println("Server=" + url + ", available files:\n");
RMADataset[] datasets = connector.getAvailiableDatasets();
for (RMADataset dataset : datasets) {
System.out.println(dataset.getDatasetName());
}
}
}
}
示例2: getFont
import jloda.util.Pair; //导入方法依赖的package包/类
public Font getFont(String target) {
Pair<Font, Color> pair = fonts.get(target);
if (pair == null || pair.get1() == null)
return getFont();
else
return pair.get1();
}
示例3: getUser
import jloda.util.Pair; //导入方法依赖的package包/类
/**
* get the remote user
*
* @param localFileName
* @return remote user
*/
public static String getUser(String localFileName) {
localFileName = localFileName.replaceAll("/MeganServer$", "");
if (isRemoteFile(localFileName)) {
final Pair<String, String> credentials = getCredentials(getServerShortName(localFileName));
if (credentials != null)
return credentials.get1();
}
return null;
}
示例4: saveCredentialsToProperties
import jloda.util.Pair; //导入方法依赖的package包/类
/**
* save all credentials to properties
*/
public static void saveCredentialsToProperties() {
List<String> list = new LinkedList<>();
for (String server : server2Credentials.keySet()) {
Pair<String, String> pair = server2Credentials.get(server);
String user = pair.get1();
String encodedPassword = Base64.encodeBase64String(pair.get2().getBytes());
list.add(server + "::" + user + "::" + encodedPassword);
}
ProgramProperties.put("MeganServerCredentials", list.toArray(new String[list.size()]));
}