From e91d4c547781e60c4b82b8cb9999a885f79605e8 Mon Sep 17 00:00:00 2001 From: huanghongxun Date: Thu, 10 Dec 2015 14:06:56 +0800 Subject: [PATCH] Try to fix some problems --- .../launcher/launch/DefaultGameLauncher.java | 25 +- .../launcher/launch/IMinecraftProvider.java | 1 - .../launcher/launch/MinecraftLoader.java | 10 +- .../launcher/settings/Config.java | 8 +- .../launcher/settings/Settings.java | 1 + .../launcher/utils/CrashReporter.java | 4 +- .../utils/assets/AssetsMojangLoader.java | 14 +- .../version/MinecraftVersionManager.java | 4 +- .../launcher/views/GameSettingsPanel.java | 175 +- .../launcher/views/MainFrame.java | 2 +- .../org/jackhuang/hellominecraft/HMCLog.java | 2 +- .../hellominecraft/tasks/TaskWindow.java | 53 +- .../hellominecraft/utils/NetUtils.java | 4 +- .../hellominecraft/utils/SwingUtils.java | 5 +- .../jackhuang/hellominecraft/utils/Utils.java | 4 +- HMCLAPI/src/main/java/rx/Observable.java | 2864 ++++++++++------- .../hellominecraft/launcher/I18N.properties | 2 +- .../launcher/I18N_en.properties | 2 +- .../launcher/I18N_zh.properties | 2 +- .../launcher/I18N_zh_CN.properties | 2 +- 20 files changed, 1920 insertions(+), 1264 deletions(-) diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/launch/DefaultGameLauncher.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/launch/DefaultGameLauncher.java index cffcb6256..f1a71a3de 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/launch/DefaultGameLauncher.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/launch/DefaultGameLauncher.java @@ -31,8 +31,6 @@ import org.jackhuang.hellominecraft.utils.system.Compressor; import org.jackhuang.hellominecraft.utils.MessageBox; public class DefaultGameLauncher extends GameLauncher { - - private boolean fuckingFlag; public DefaultGameLauncher(Profile version, LoginInfo info, IAuthenticator lg) { super(version, info, lg); @@ -46,23 +44,12 @@ public class DefaultGameLauncher extends GameLauncher { for (DownloadLibraryJob s : t) parallelTask.addDependsTask(new LibraryDownloadTask(s)); dw.addTask(parallelTask); - Runnable r = () -> { - boolean flag = true; - if (t.size() > 0) - flag = dw.start(); - if (!flag && MessageBox.Show(C.i18n("launch.not_finished_downloading_libraries"), MessageBox.YES_NO_OPTION) == MessageBox.YES_OPTION) - flag = true; - synchronized(DefaultGameLauncher.this) { - fuckingFlag = flag; - } - }; - try { - SwingUtilities.invokeAndWait(r); - } catch (Exception e) { - HMCLog.err("InvokeAndWait failed.", e); - r.run(); - } - return fuckingFlag; + boolean flag = true; + if (t.size() > 0) + flag = dw.start(); + if (!flag && MessageBox.Show(C.i18n("launch.not_finished_downloading_libraries"), MessageBox.YES_NO_OPTION) == MessageBox.YES_OPTION) + flag = true; + return flag; }); decompressNativesEvent.register((sender, value) -> { if (value == null) diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/launch/IMinecraftProvider.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/launch/IMinecraftProvider.java index 04a235887..06f0b9d89 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/launch/IMinecraftProvider.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/launch/IMinecraftProvider.java @@ -85,7 +85,6 @@ public abstract class IMinecraftProvider { * * @see org.jackhuang.hellominecraft.launcher.launch.IMinecraftLoader * @param p player informations, including username & auth_token - * @param type where to download * * @return what you want * diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/launch/MinecraftLoader.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/launch/MinecraftLoader.java index 08ec31515..abd7df537 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/launch/MinecraftLoader.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/launch/MinecraftLoader.java @@ -77,15 +77,7 @@ public class MinecraftLoader extends AbstractMinecraftLoader { if (MessageBox.Show(C.i18n("assets.no_assets"), MessageBox.YES_NO_OPTION) == MessageBox.YES_OPTION) { IAssetsHandler.ASSETS_HANDLER.getList(version, provider).subscribe(a -> { }); - Runnable r = () - -> TaskWindow.getInstance().addTask(IAssetsHandler.ASSETS_HANDLER.getDownloadTask(provider.profile.getDownloadType().getProvider())).start(); - - try { - SwingUtilities.invokeAndWait(r); - } catch (Exception e) { - HMCLog.err("Failed invokeAndWait", e); - r.run(); - } + TaskWindow.getInstance().addTask(IAssetsHandler.ASSETS_HANDLER.getDownloadTask(provider.profile.getDownloadType().getProvider())).start(); } String game_assets = reconstructAssets().getAbsolutePath(); diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/settings/Config.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/settings/Config.java index 2a212f6b7..0a1d2bef1 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/settings/Config.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/settings/Config.java @@ -120,8 +120,11 @@ public final class Config { } public TreeMap getConfigurations() { - if (configurations == null) + if (configurations == null) { configurations = new TreeMap<>(); + Profile profile = new Profile(); + configurations.put(profile.getName(), profile); + } return configurations; } @@ -147,9 +150,6 @@ public final class Config { clientToken = UUID.randomUUID().toString(); username = ""; logintype = downloadtype = 0; - configurations = new TreeMap<>(); - Profile profile = new Profile(); - configurations.put(profile.getName(), profile); enableShadow = false; theme = 0; } diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/settings/Settings.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/settings/Settings.java index e14d8c8e2..4c1120862 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/settings/Settings.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/settings/Settings.java @@ -119,6 +119,7 @@ public final class Settings { } public static Profile getProfile(String name) { + if (name == null) return getProfiles().get("Default"); return getProfiles().get(name); } diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/utils/CrashReporter.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/utils/CrashReporter.java index 3af8b38c0..5c1768ae0 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/utils/CrashReporter.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/utils/CrashReporter.java @@ -62,7 +62,7 @@ public class CrashReporter implements Thread.UncaughtExceptionHandler { t.printStackTrace(); } return false; - } else if (s.contains("java.lang.NoClassDefFoundError") || s.contains("java.lang.IncompatibleClassChangeError") || s.contains("java.lang.ClassFormatError")) { + } else if (s.contains("java.lang.NoClassDefFoundError") || s.contains("java.lang.VerifyError") || s.contains("java.lang.NoSuchMethodError") || s.contains("java.lang.IncompatibleClassChangeError") || s.contains("java.lang.ClassFormatError")) { System.out.println(C.i18n("crash.NoClassDefFound")); try { MessageBox.Show(C.i18n("crash.NoClassDefFound")); @@ -98,7 +98,7 @@ public class CrashReporter implements Thread.UncaughtExceptionHandler { else System.out.println(text); - if (checkThrowable(e)) { + if (checkThrowable(e) && !System.getProperty("java.vm.name").contains("OpenJDK")) { SwingUtilities.invokeLater(() -> LogWindow.INSTANCE.showAsCrashWindow(UpdateChecker.OUT_DATED)); if (!UpdateChecker.OUT_DATED) reportToServer(text, s); diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/utils/assets/AssetsMojangLoader.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/utils/assets/AssetsMojangLoader.java index f39315717..f33168908 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/utils/assets/AssetsMojangLoader.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/utils/assets/AssetsMojangLoader.java @@ -33,7 +33,6 @@ import org.jackhuang.hellominecraft.launcher.version.MinecraftVersion; import org.jackhuang.hellominecraft.utils.VersionNumber; import rx.Observable; import rx.Observer; -import rx.subscriptions.Subscriptions; /** * @@ -47,10 +46,10 @@ public class AssetsMojangLoader extends IAssetsHandler { @Override public Observable getList(MinecraftVersion mv, IMinecraftProvider mp) { - return Observable.create((Observer t1) -> { + return Observable.createWithEmptySubscription((Observer t1) -> { if (mv == null) { t1.onError(null); - return Subscriptions.empty(); + return; } String assetsId = mv.assets == null ? "legacy" : mv.assets; File assets = mp.getAssetService().getAssets(); @@ -58,7 +57,7 @@ public class AssetsMojangLoader extends IAssetsHandler { File f = IOUtils.tryGetCanonicalFile(new File(assets, "indexes/" + assetsId + ".json")); if (!f.exists() && !mp.getAssetService().downloadMinecraftAssetsIndex(assetsId)) { t1.onError(null); - return Subscriptions.empty(); + return; } String result; @@ -67,12 +66,12 @@ public class AssetsMojangLoader extends IAssetsHandler { } catch (IOException ex) { HMCLog.warn("Failed to read index json: " + f, ex); t1.onError(null); - return Subscriptions.empty(); + return; } if (StrUtils.isBlank(result)) { HMCLog.err("Index json is empty, please redownload it!"); t1.onError(null); - return Subscriptions.empty(); + return; } AssetsIndex o; try { @@ -80,7 +79,7 @@ public class AssetsMojangLoader extends IAssetsHandler { } catch (Exception e) { HMCLog.err("Failed to parse index json, please redownload it!", e); t1.onError(null); - return Subscriptions.empty(); + return; } assetsDownloadURLs = new ArrayList<>(); assetsLocalNames = new ArrayList<>(); @@ -100,7 +99,6 @@ public class AssetsMojangLoader extends IAssetsHandler { t1.onNext(al.toArray(new String[1])); t1.onCompleted(); - return Subscriptions.empty(); }); } diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/version/MinecraftVersionManager.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/version/MinecraftVersionManager.java index 62b56257d..5736e4404 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/version/MinecraftVersionManager.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/version/MinecraftVersionManager.java @@ -207,7 +207,9 @@ public final class MinecraftVersionManager extends IMinecraftProvider { @Override public GameLauncher.DecompressLibraryJob getDecompressLibraries() { - MinecraftVersion v = profile.getSelectedMinecraftVersion().resolve(this); + MinecraftVersion v = getSelectedMinecraftVersion(); + if (v == null) return null; + v = v.resolve(this); if (v.libraries == null) return null; ArrayList unzippings = new ArrayList<>(); diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/views/GameSettingsPanel.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/views/GameSettingsPanel.java index 5d494d029..d0f2917a8 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/views/GameSettingsPanel.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/views/GameSettingsPanel.java @@ -38,7 +38,6 @@ import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPopupMenu; import javax.swing.JTable; -import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.TableModelEvent; @@ -48,7 +47,6 @@ import org.jackhuang.hellominecraft.HMCLog; import org.jackhuang.hellominecraft.launcher.settings.LauncherVisibility; import org.jackhuang.hellominecraft.launcher.utils.installers.InstallerVersionList; import org.jackhuang.hellominecraft.launcher.utils.installers.InstallerVersionList.InstallerVersion; -import org.jackhuang.hellominecraft.launcher.utils.download.DownloadType; import org.jackhuang.hellominecraft.launcher.settings.Profile; import org.jackhuang.hellominecraft.launcher.settings.Settings; import org.jackhuang.hellominecraft.launcher.utils.FileNameFilter; @@ -67,6 +65,7 @@ import org.jackhuang.hellominecraft.utils.StrUtils; import org.jackhuang.hellominecraft.utils.SwingUtils; import org.jackhuang.hellominecraft.utils.system.Java; import org.jackhuang.hellominecraft.views.LogWindow; +import rx.Observable; import rx.concurrency.Schedulers; /** @@ -75,6 +74,11 @@ import rx.concurrency.Schedulers; */ public final class GameSettingsPanel extends javax.swing.JPanel implements DropTargetListener { + boolean isLoading = false; + public MinecraftVersionRequest minecraftVersion; + InstallerHelper forge, optifine, liteloader; + String mcVersion; + /** * Creates new form GameSettingsPanel */ @@ -96,7 +100,7 @@ public final class GameSettingsPanel extends javax.swing.JPanel implements DropT dropTarget = new DropTarget(lstExternalMods, DnDConstants.ACTION_COPY_OR_MOVE, this); } - + void initExplorationMenu() { ppmExplore = new JPopupMenu(); class ImplementedActionListener implements ActionListener { @@ -133,7 +137,7 @@ public final class GameSettingsPanel extends javax.swing.JPanel implements DropT itm.addActionListener(new ImplementedActionListener("screenshots")); ppmExplore.add(itm); } - + void initManagementMenu() { ppmManage = new JPopupMenu(); JMenuItem itm = new JMenuItem(C.i18n("versions.manage.rename")); @@ -170,7 +174,7 @@ public final class GameSettingsPanel extends javax.swing.JPanel implements DropT }); ppmManage.add(itm); } - + void initExternalModsTable() { if (lstExternalMods.getColumnModel().getColumnCount() > 0) { lstExternalMods.getColumnModel().getColumn(0).setMinWidth(17); @@ -179,7 +183,7 @@ public final class GameSettingsPanel extends javax.swing.JPanel implements DropT } lstExternalMods.getSelectionModel().addListSelectionListener(e -> { int row = lstExternalMods.getSelectedRow(); - List mods = profile.getMinecraftProvider().getModService().getMods(); + List mods = getProfile().getMinecraftProvider().getModService().getMods(); if (mods != null && 0 <= row && row < mods.size()) { ModInfo m = mods.get(row); boolean hasLink = m.url != null; @@ -199,13 +203,13 @@ public final class GameSettingsPanel extends javax.swing.JPanel implements DropT ((DefaultTableModel) lstExternalMods.getModel()).addTableModelListener(e -> { if (e.getType() == TableModelEvent.UPDATE && e.getColumn() == 0) { int row = lstExternalMods.getSelectedRow(); - List mods = profile.getMinecraftProvider().getModService().getMods(); + List mods = getProfile().getMinecraftProvider().getModService().getMods(); if (mods != null && mods.size() > row && row >= 0) mods.get(row).reverseModState(); } }); } - + void initTabs() { tabVersionEdit.addChangeListener(new ChangeListener() { boolean a = false, b = false; @@ -1110,12 +1114,9 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { private void cboProfilesItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cboProfilesItemStateChanged if (isLoading) return; - profile = getProfile(); - if (profile == null) - return; - if (profile.getMinecraftProvider().getVersionCount() <= 0) - versionChanged(profile, null); - prepare(profile); + if (getProfile().getMinecraftProvider().getVersionCount() <= 0) + versionChanged(null); + prepare(getProfile()); }//GEN-LAST:event_cboProfilesItemStateChanged private void btnNewProfileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewProfileActionPerformed @@ -1125,17 +1126,14 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { }//GEN-LAST:event_btnNewProfileActionPerformed private void btnRemoveProfileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRemoveProfileActionPerformed - if (profile == null) + if (getProfile() == null) return; - if (MessageBox.Show(C.i18n("ui.message.sure_remove", profile.getName()), MessageBox.YES_NO_OPTION) == MessageBox.NO_OPTION) + if (MessageBox.Show(C.i18n("ui.message.sure_remove", getProfile().getName()), MessageBox.YES_NO_OPTION) == MessageBox.NO_OPTION) return; - if (Settings.delProfile(profile)) { - cboProfiles.removeItem(profile.getName()); - profile = Settings.getOneProfile(); - if (profile != null) { - prepare(profile); - loadVersions(); - } + if (Settings.delProfile(getProfile())) { + cboProfiles.removeItem(getProfile().getName()); + prepare(getProfile()); + loadVersions(); } }//GEN-LAST:event_btnRemoveProfileActionPerformed @@ -1144,7 +1142,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { return; String mcv = (String) cboVersions.getSelectedItem(); loadMinecraftVersion(mcv); - versionChanged(getProfile(), mcv); + versionChanged(mcv); getProfile().setSelectedMinecraftVersion(mcv); cboVersions.setToolTipText(mcv); }//GEN-LAST:event_cboVersionsItemStateChanged @@ -1212,76 +1210,76 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { }//GEN-LAST:event_btnModifyMouseClicked private void txtJavaArgsFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtJavaArgsFocusLost - profile.setJavaArgs(txtJavaArgs.getText()); + getProfile().setJavaArgs(txtJavaArgs.getText()); }//GEN-LAST:event_txtJavaArgsFocusLost private void txtMinecraftArgsFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtMinecraftArgsFocusLost - profile.setMinecraftArgs(txtMinecraftArgs.getText()); + getProfile().setMinecraftArgs(txtMinecraftArgs.getText()); }//GEN-LAST:event_txtMinecraftArgsFocusLost private void txtPermSizeFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtPermSizeFocusLost - profile.setPermSize(txtPermSize.getText()); + getProfile().setPermSize(txtPermSize.getText()); }//GEN-LAST:event_txtPermSizeFocusLost private void chkDebugFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_chkDebugFocusLost - profile.setDebug(chkDebug.isSelected()); + getProfile().setDebug(chkDebug.isSelected()); }//GEN-LAST:event_chkDebugFocusLost private void chkNoJVMArgsFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_chkNoJVMArgsFocusLost - profile.setNoJVMArgs(chkNoJVMArgs.isSelected()); + getProfile().setNoJVMArgs(chkNoJVMArgs.isSelected()); }//GEN-LAST:event_chkNoJVMArgsFocusLost private void chkCancelWrapperFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_chkCancelWrapperFocusLost - profile.setCanceledWrapper(chkCancelWrapper.isSelected()); + getProfile().setCanceledWrapper(chkCancelWrapper.isSelected()); }//GEN-LAST:event_chkCancelWrapperFocusLost private void txtPrecalledCommandFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtPrecalledCommandFocusLost - profile.setPrecalledCommand(txtPrecalledCommand.getText()); + getProfile().setPrecalledCommand(txtPrecalledCommand.getText()); }//GEN-LAST:event_txtPrecalledCommandFocusLost private void txtServerIPFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtServerIPFocusLost - profile.setServerIp(txtServerIP.getText()); + getProfile().setServerIp(txtServerIP.getText()); }//GEN-LAST:event_txtServerIPFocusLost private void cboGameDirTypeFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_cboGameDirTypeFocusLost if (cboGameDirType.getSelectedIndex() >= 0) - profile.setGameDirType(GameDirType.values()[cboGameDirType.getSelectedIndex()]); + getProfile().setGameDirType(GameDirType.values()[cboGameDirType.getSelectedIndex()]); }//GEN-LAST:event_cboGameDirTypeFocusLost private void cboLauncherVisibilityFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_cboLauncherVisibilityFocusLost if (cboLauncherVisibility.getSelectedIndex() >= 0) - profile.setLauncherVisibility(LauncherVisibility.values()[cboLauncherVisibility.getSelectedIndex()]); + getProfile().setLauncherVisibility(LauncherVisibility.values()[cboLauncherVisibility.getSelectedIndex()]); }//GEN-LAST:event_cboLauncherVisibilityFocusLost private void btnDownloadAllAssetsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDownloadAllAssetsActionPerformed - if (mcVersion != null && profile != null) - profile.getMinecraftProvider().getAssetService().downloadAssets(mcVersion).run(); + if (mcVersion != null && getProfile() != null) + getProfile().getMinecraftProvider().getAssetService().downloadAssets(mcVersion).run(); }//GEN-LAST:event_btnDownloadAllAssetsActionPerformed private void txtMaxMemoryFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtMaxMemoryFocusLost - profile.setMaxMemory(txtMaxMemory.getText()); + getProfile().setMaxMemory(txtMaxMemory.getText()); }//GEN-LAST:event_txtMaxMemoryFocusLost private void txtJavaDirFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtJavaDirFocusLost - profile.setJavaDir(txtJavaDir.getText()); + getProfile().setJavaDir(txtJavaDir.getText()); }//GEN-LAST:event_txtJavaDirFocusLost private void chkFullscreenFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_chkFullscreenFocusLost - profile.setFullscreen(chkFullscreen.isSelected()); + getProfile().setFullscreen(chkFullscreen.isSelected()); }//GEN-LAST:event_chkFullscreenFocusLost private void txtHeightFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtHeightFocusLost - profile.setHeight(txtHeight.getText()); + getProfile().setHeight(txtHeight.getText()); }//GEN-LAST:event_txtHeightFocusLost private void txtWidthFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtWidthFocusLost - profile.setWidth(txtWidth.getText()); + getProfile().setWidth(txtWidth.getText()); }//GEN-LAST:event_txtWidthFocusLost private void txtGameDirFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtGameDirFocusLost - if (profile == null) + if (getProfile() == null) return; - profile.setGameDir(txtGameDir.getText()); + getProfile().setGameDir(txtGameDir.getText()); loadVersions(); }//GEN-LAST:event_txtGameDirFocusLost @@ -1301,7 +1299,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { try { String path = fc.getSelectedFile().getCanonicalPath(); txtJavaDir.setText(path); - profile.setJavaDir(txtJavaDir.getText()); + getProfile().setJavaDir(txtJavaDir.getText()); } catch (IOException e) { HMCLog.warn("Failed to set java path.", e); MessageBox.Show(C.i18n("ui.label.failed_set") + e.getMessage()); @@ -1314,9 +1312,9 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { int idx = cboJava.getSelectedIndex(); if (idx != -1) { Java j = Settings.JAVA.get(idx); - profile.setJava(j); + getProfile().setJava(j); txtJavaDir.setEnabled(idx == 1); - txtJavaDir.setText(j.getHome() == null ? profile.getSettingsJavaDir() : j.getJava()); + txtJavaDir.setText(j.getHome() == null ? getProfile().getSettingsJavaDir() : j.getJava()); } }//GEN-LAST:event_cboJavaItemStateChanged @@ -1329,14 +1327,14 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { return; boolean flag = false; for (File f : fc.getSelectedFiles()) - flag |= !profile.getMinecraftProvider().getModService().addMod(f); + flag |= !getProfile().getMinecraftProvider().getModService().addMod(f); reloadMods(); if (flag) MessageBox.Show(C.I18N.getString("mods.failed")); }//GEN-LAST:event_btnAddModActionPerformed private void btnRemoveModActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRemoveModActionPerformed - profile.getMinecraftProvider().getModService().removeMod(lstExternalMods.getSelectedRows()); + getProfile().getMinecraftProvider().getModService().removeMod(lstExternalMods.getSelectedRows()); reloadMods(); }//GEN-LAST:event_btnRemoveModActionPerformed @@ -1347,8 +1345,8 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { private void lblModInfoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblModInfoMouseClicked int idx = lstExternalMods.getSelectedRow(); - if (idx > 0 && idx < profile.getMinecraftProvider().getModService().getMods().size()) - profile.getMinecraftProvider().getModService().getMods().get(idx).showURL(); + if (idx > 0 && idx < getProfile().getMinecraftProvider().getModService().getMods().size()) + getProfile().getMinecraftProvider().getModService().getMods().get(idx).showURL(); }//GEN-LAST:event_lblModInfoMouseClicked private void btnChoosingGameDirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnChoosingGameDirActionPerformed @@ -1362,7 +1360,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { try { String path = fc.getSelectedFile().getCanonicalPath(); txtGameDir.setText(path); - profile.setGameDir(path); + getProfile().setGameDir(path); } catch (IOException e) { HMCLog.warn("Failed to set game dir.", e); MessageBox.Show(C.i18n("ui.label.failed_set") + e.getMessage()); @@ -1378,7 +1376,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { }//GEN-LAST:event_btnShowLogActionPerformed private void btnCleanGameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCleanGameActionPerformed - profile.getMinecraftProvider().cleanFolder(); + getProfile().getMinecraftProvider().cleanFolder(); }//GEN-LAST:event_btnCleanGameActionPerformed // @@ -1404,10 +1402,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { isLoading = false; if (index < cboProfiles.getItemCount()) { cboProfiles.setSelectedIndex(index); - profile = selectedProfile; - if (profile == null) - profile = firstProfile; - prepare(profile); + prepare(getProfile()); loadVersions(); } } @@ -1416,7 +1411,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { if (cboProfiles.getSelectedIndex() >= 0) return Settings.getProfile(cboProfiles.getSelectedItem().toString()); else - return null; + return Settings.getProfile(null); } void prepare(Profile profile) { @@ -1449,14 +1444,14 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { } void loadVersions() { - if (profile == null) + if (getProfile() == null) return; isLoading = true; cboVersions.removeAllItems(); int index = 0, i = 0; - MinecraftVersion selVersion = profile.getSelectedMinecraftVersion(); + MinecraftVersion selVersion = getProfile().getSelectedMinecraftVersion(); String selectedMC = selVersion == null ? null : selVersion.id; - for (MinecraftVersion each : profile.getMinecraftProvider().getVersions()) { + for (MinecraftVersion each : getProfile().getMinecraftProvider().getVersions()) { cboVersions.addItem(each.id); if (each.id.equals(selectedMC)) index = i; @@ -1470,15 +1465,16 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { } void loadMinecraftVersion() { - loadMinecraftVersion(profile.getSelectedMinecraftVersion()); + loadMinecraftVersion(getProfile().getSelectedMinecraftVersion()); } void loadMinecraftVersion(String v) { - loadMinecraftVersion(profile.getMinecraftProvider().getVersionById(v)); + loadMinecraftVersion(getProfile().getMinecraftProvider().getVersionById(v)); } /** - * Anaylze the jar of selected minecraft version of current profile to get + * Anaylze the jar of selected minecraft version of current getProfile() to + * get * the version. * * @param v @@ -1487,17 +1483,15 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { txtMinecraftVersion.setText(""); if (v == null) return; - minecraftVersion = MinecraftVersionRequest.minecraftVersion(v.getJar(profile.getGameDirFile())); + minecraftVersion = MinecraftVersionRequest.minecraftVersion(v.getJar(getProfile().getGameDirFile())); txtMinecraftVersion.setText(MinecraftVersionRequest.getResponse(minecraftVersion)); } // // public void refreshDownloads() { - DefaultTableModel model = (DefaultTableModel) lstDownloads.getModel(); - while (model.getRowCount() > 0) - model.removeRow(0); - profile.getMinecraftProvider().getDownloadService().getRemoteVersions() + DefaultTableModel model = SwingUtils.clearDefaultTable(lstDownloads); + getProfile().getMinecraftProvider().getDownloadService().getRemoteVersions() .observeOn(Schedulers.eventQueue()).subscribeOn(Schedulers.newThread()) .subscribe((ver) -> model.addRow(new Object[] {ver.id, ver.time, StrUtils.equalsOne(ver.type, "old_beta", "old_alpha", "release", "snapshot") ? C.i18n("versions." + ver.type) : ver.type}), @@ -1508,12 +1502,12 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { } void downloadMinecraft() { - if (profile == null || lstDownloads.getSelectedRow() < 0) { + if (getProfile() == null || lstDownloads.getSelectedRow() < 0) { MessageBox.Show(C.i18n("gamedownload.not_refreshed")); return; } String id = (String) lstDownloads.getModel().getValueAt(lstDownloads.getSelectedRow(), 0); - profile.getMinecraftProvider().getDownloadService().downloadMinecraft(id); + getProfile().getMinecraftProvider().getDownloadService().downloadMinecraft(id); } // @@ -1530,7 +1524,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { Transferable tr = dtde.getTransferable(); List files = (List) tr.getTransferData(DataFlavor.javaFileListFlavor); for (File file : files) - profile.getMinecraftProvider().getModService().addMod(file); + getProfile().getMinecraftProvider().getModService().addMod(file); } catch (Exception ex) { HMCLog.warn("Failed to drop file.", ex); } @@ -1586,7 +1580,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { MessageBox.Show(C.i18n("install.not_refreshed")); return; } - profile.getInstallerService().download(getVersion(idx), id).after(new TaskRunnable(this::refreshVersions)).run(); + getProfile().getInstallerService().download(getVersion(idx), id).after(new TaskRunnable(this::refreshVersions)).run(); } private List loadVersions(InstallerVersionList list, JTable table) { @@ -1615,36 +1609,21 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { loadVersions(); } - // - // - boolean isLoading = false; - Profile profile; - public MinecraftVersionRequest minecraftVersion; - InstallerHelper forge, optifine, liteloader; - String mcVersion; - // // private final Object lockMod = new Object(); private void reloadMods() { - new Thread(() -> { - synchronized (lockMod) { - profile.getMinecraftProvider().getModService().recacheMods(); - SwingUtilities.invokeLater(() -> { - synchronized (lockMod) { - SwingUtils.clearDefaultTable(lstExternalMods); - DefaultTableModel model = (DefaultTableModel) lstExternalMods.getModel(); - for (ModInfo info : profile.getMinecraftProvider().getModService().getMods()) - model.addRow(new Object[] {info.isActive(), info.getFileName(), info.version}); - } - }); - } - }).start(); + DefaultTableModel model = SwingUtils.clearDefaultTable(lstExternalMods); + Observable.>createWithEmptySubscription( + t -> t.onNext(getProfile().getMinecraftProvider().getModService().recacheMods())) + .subscribeOn(Schedulers.newThread()).observeOn(Schedulers.eventQueue()) + .flatMap(t -> Observable.from(t)) + .subscribe(t -> model.addRow(new Object[] {t.isActive(), t.getFileName(), t.version})); } // - public void versionChanged(Profile profile, String version) { + public void versionChanged(String version) { this.mcVersion = version; forge.loadVersions(); optifine.loadVersions(); @@ -1655,12 +1634,12 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { public void onSelected() { loadProfiles(); - if (profile == null) + if (getProfile() == null) return; - if (profile.getMinecraftProvider().getVersionCount() <= 0) - versionChanged(profile, null); + if (getProfile().getMinecraftProvider().getVersionCount() <= 0) + versionChanged(null); else - versionChanged(getProfile(), (String) cboVersions.getSelectedItem()); + versionChanged((String) cboVersions.getSelectedItem()); } public void showGameDownloads() { diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/views/MainFrame.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/views/MainFrame.java index df7830a0b..50cb99428 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/views/MainFrame.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/views/MainFrame.java @@ -293,7 +293,7 @@ public final class MainFrame extends DraggableFrame { backgroundLabel.setIcon(background); centralPanel.add(backgroundLabel, -1); } else - HMCLog.warn("No Background Image, the background will be white!"); + HMCLog.warn("No Background Image, the background will be empty!"); } public JPanel getTitleBar() { diff --git a/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/HMCLog.java b/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/HMCLog.java index 29cfe614f..670edc10a 100644 --- a/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/HMCLog.java +++ b/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/HMCLog.java @@ -25,7 +25,7 @@ import org.jackhuang.hellominecraft.logging.logger.Logger; */ public class HMCLog { - public static Logger logger = new Logger("HMC"); + public static Logger logger = new Logger("Hello Minecraft!"); public static void log(String message) { logger.info(message); diff --git a/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/tasks/TaskWindow.java b/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/tasks/TaskWindow.java index b21265993..914c33758 100644 --- a/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/tasks/TaskWindow.java +++ b/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/tasks/TaskWindow.java @@ -17,6 +17,7 @@ */ package org.jackhuang.hellominecraft.tasks; +import java.awt.EventQueue; import java.util.ArrayList; import java.util.LinkedList; import javax.swing.SwingUtilities; @@ -31,13 +32,13 @@ import org.jackhuang.hellominecraft.utils.SwingUtils; * @author huangyuhui */ public class TaskWindow extends javax.swing.JDialog -implements ProgressProviderListener, Runnable, DoingDoneListener { + implements ProgressProviderListener, Runnable, DoingDoneListener { - private static final TaskWindow instance = new TaskWindow(); + private static final TaskWindow INSTANCE = new TaskWindow(); private static TaskWindow inst() { - instance.clean(); - return instance; + INSTANCE.clean(); + return INSTANCE; } public static TaskWindowFactory getInstance() { @@ -200,12 +201,13 @@ implements ProgressProviderListener, Runnable, DoingDoneListener { private javax.swing.JScrollPane srlDownload; // End of variables declaration//GEN-END:variables - ArrayList tasks = new ArrayList<>(); - ArrayList progresses = new ArrayList<>(); + final ArrayList tasks = new ArrayList<>(); + final ArrayList progresses = new ArrayList<>(); @Override public void setProgress(Task task, int progress, int max) { SwingUtilities.invokeLater(() -> { + if (task == null) return; int idx = tasks.indexOf(task); if (idx == -1) return; @@ -229,7 +231,7 @@ implements ProgressProviderListener, Runnable, DoingDoneListener { task.setProgressProviderListener(this); SwingUtilities.invokeLater(() -> { - if (taskList == null) + if (taskList == null || task == null) return; tasks.add(task); progresses.add(0); @@ -245,7 +247,7 @@ implements ProgressProviderListener, Runnable, DoingDoneListener { @Override public void onDone(Task task) { SwingUtilities.invokeLater(() -> { - if (taskList == null) + if (taskList == null || task == null) return; pgsTotal.setMaximum(taskList.taskCount()); pgsTotal.setValue(pgsTotal.getValue() + 1); @@ -261,7 +263,7 @@ implements ProgressProviderListener, Runnable, DoingDoneListener { @Override public void onFailed(Task task) { SwingUtilities.invokeLater(() -> { - if (taskList == null) + if (taskList == null || task == null) return; failReasons.add(task.getInfo() + ": " + (null == task.getFailReason() ? "No exception" : (StrUtils.isBlank(task.getFailReason().getLocalizedMessage()) ? task.getFailReason().getClass().getSimpleName() : task.getFailReason().getLocalizedMessage()))); pgsTotal.setMaximum(taskList.taskCount()); @@ -283,7 +285,7 @@ implements ProgressProviderListener, Runnable, DoingDoneListener { @Override public void setStatus(Task task, String sta) { SwingUtilities.invokeLater(() -> { - if (taskList == null) + if (taskList == null || task == null) return; int idx = tasks.indexOf(task); if (idx == -1) @@ -295,6 +297,7 @@ implements ProgressProviderListener, Runnable, DoingDoneListener { public static class TaskWindowFactory { LinkedList ll = new LinkedList<>(); + boolean flag; public TaskWindowFactory addTask(Task t) { ll.add(t); @@ -302,14 +305,28 @@ implements ProgressProviderListener, Runnable, DoingDoneListener { } public boolean start() { - synchronized (instance) { - if (instance.isVisible()) - return false; - TaskWindow tw = inst(); - for (Task t : ll) - tw.addTask(t); - return tw.start(); - } + Runnable r = () -> { + synchronized (INSTANCE) { + if (INSTANCE.isVisible()) { + flag = false; + return; + } + TaskWindow tw = inst(); + for (Task t : ll) + tw.addTask(t); + flag = tw.start(); + } + }; + if (EventQueue.isDispatchThread()) + r.run(); + else + try { + EventQueue.invokeAndWait(r); + } catch (Exception e) { + HMCLog.err("Failed to invokeAndWait, the UI will work abnormally.", e); + r.run(); + } + return flag; } } } diff --git a/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/utils/NetUtils.java b/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/utils/NetUtils.java index c1ffbf3f3..a12768c92 100644 --- a/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/utils/NetUtils.java +++ b/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/utils/NetUtils.java @@ -30,7 +30,6 @@ import java.util.Map; import org.jackhuang.hellominecraft.HMCLog; import org.jackhuang.hellominecraft.utils.system.IOUtils; import rx.Observable; -import rx.subscriptions.Subscriptions; /** * @@ -160,13 +159,12 @@ public final class NetUtils { } public static Observable getRx(String url) { - return Observable.create(t1 -> { + return Observable.createWithEmptySubscription(t1 -> { try { t1.onNext(get(url)); } catch(Exception e) { t1.onError(e); } - return Subscriptions.empty(); }); } } diff --git a/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/utils/SwingUtils.java b/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/utils/SwingUtils.java index dab00959c..17e7416e8 100644 --- a/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/utils/SwingUtils.java +++ b/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/utils/SwingUtils.java @@ -131,12 +131,15 @@ public class SwingUtils { * Clear the JTable * * @param table JTable with DefaultTableModel. + * + * @return To make the code succinct */ - public static void clearDefaultTable(JTable table) { + public static DefaultTableModel clearDefaultTable(JTable table) { DefaultTableModel model = (DefaultTableModel) table.getModel(); while (model.getRowCount() > 0) model.removeRow(0); table.updateUI(); + return model; } public static void appendLast(JTable table, Object... elements) { diff --git a/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/utils/Utils.java b/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/utils/Utils.java index 11d0af561..913e5945d 100644 --- a/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/utils/Utils.java +++ b/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/utils/Utils.java @@ -93,9 +93,10 @@ public final class Utils { return new ImageIcon(i.getImage().getScaledInstance(x, y, Image.SCALE_SMOOTH)); } - public static ImageIcon searchBackgroundImage(ImageIcon background, String bgpath, int width, int height) { + public static ImageIcon searchBackgroundImage(ImageIcon init, String bgpath, int width, int height) { Random r = new Random(); boolean loaded = false; + ImageIcon background = init; // bgpath if (StrUtils.isNotBlank(bgpath) && !loaded) { @@ -142,6 +143,7 @@ public final class Utils { } } + if (background == null) return init; return background; } diff --git a/HMCLAPI/src/main/java/rx/Observable.java b/HMCLAPI/src/main/java/rx/Observable.java index 427c3969d..662de29f7 100644 --- a/HMCLAPI/src/main/java/rx/Observable.java +++ b/HMCLAPI/src/main/java/rx/Observable.java @@ -1,12 +1,12 @@ /** * Copyright 2013 Netflix, Inc. - * + *

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + *

* http://www.apache.org/licenses/LICENSE-2.0 - * + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -80,15 +80,18 @@ import rx.util.functions.Functions; /** * The Observable interface that implements the Reactive Pattern. *

- * It provides overloaded methods for subscribing as well as delegate methods to the various operators. + * It provides overloaded methods for subscribing as well as delegate methods to + * the various operators. *

- * The documentation for this interface makes use of marble diagrams. The following legend explains + * The documentation for this interface makes use of marble diagrams. The + * following legend explains * these diagrams: *

* *

- * For more information see the RxJava Wiki - * + * For more information see the + * RxJava Wiki + * * @param */ public class Observable { @@ -104,61 +107,74 @@ public class Observable { /** * Construct an Observable with Function to execute when subscribed to. *

- * NOTE: Generally you're better off using {@link #create(Func1)} to create an Observable instead of using inheritance. - * + * NOTE: Generally you're better off using {@link #create(Func1)} to create + * an Observable instead of using inheritance. + * * @param onSubscribe - * {@link Func1} to be executed when {@link #subscribe(Observer)} is called. + * {@link Func1} to be executed when {@link #subscribe(Observer)} is called. */ protected Observable(Func1, Subscription> onSubscribe) { this.onSubscribe = onSubscribe; } /** - * an {@link Observer} must call an Observable's subscribe method in order to register itself - * to receive push-based notifications from the Observable. A typical implementation of the + * an {@link Observer} must call an Observable's subscribe + * method in order to register itself + * to receive push-based notifications from the Observable. A typical + * implementation of the * subscribe method does the following: *

- * It stores a reference to the Observer in a collection object, such as a List + * It stores a reference to the Observer in a collection object, such as a + * List * object. *

- * It returns a reference to the {@link Subscription} interface. This enables - * Observers to unsubscribe (that is, to stop receiving notifications) before the Observable has - * finished sending them and has called the Observer's {@link Observer#onCompleted()} method. + * It returns a reference to the {@link Subscription} interface. This + * enables + * Observers to unsubscribe (that is, to stop receiving notifications) + * before the Observable has + * finished sending them and has called the Observer's + * {@link Observer#onCompleted()} method. *

- * At any given time, a particular instance of an Observable implementation is - * responsible for accepting all subscriptions and notifying all subscribers. Unless the - * documentation for a particular Observable implementation indicates otherwise, - * Observers should make no assumptions about the Observable implementation, such + * At any given time, a particular instance of an Observable + * implementation is + * responsible for accepting all subscriptions and notifying all + * subscribers. Unless the + * documentation for a particular Observable implementation + * indicates otherwise, + * Observers should make no assumptions about the Observable + * implementation, such * as the order of notifications that multiple Observers will receive. *

- * For more information see the RxJava Wiki - * - * + * For more information see the + * RxJava + * Wiki + * + * * @param observer * @return a {@link Subscription} reference that allows observers - * to stop receiving notifications before the provider has finished sending them + * to stop receiving notifications before the provider has finished sending + * them */ public Subscription subscribe(Observer observer) { // allow the hook to intercept and/or decorate Func1, Subscription> onSubscribeFunction = HOOK.onSubscribeStart(this, onSubscribe); // validate and proceed - if (onSubscribeFunction == null) { - throw new IllegalStateException("onSubscribe function can not be null."); - // the subscribe function can also be overridden but generally that's not the appropriate approach so I won't mention that in the exception - } + if (onSubscribeFunction == null) + throw new IllegalStateException("onSubscribe function can not be null."); // the subscribe function can also be overridden but generally that's not the appropriate approach so I won't mention that in the exception try { /** - * See https://github.com/Netflix/RxJava/issues/216 for discussion on "Guideline 6.4: Protect calls to user code from within an operator" + * See https://github.com/Netflix/RxJava/issues/216 for discussion + * on "Guideline 6.4: Protect calls to user code from within an + * operator" */ if (isInternalImplementation(observer)) { Subscription s = onSubscribeFunction.call(observer); - if (s == null) { + if (s == null) // this generally shouldn't be the case on a 'trusted' onSubscribe but in case it happens // we want to gracefully handle it the same as AtomicObservableSubscription does return HOOK.onSubscribeReturn(this, Subscriptions.empty()); - } else { + else return HOOK.onSubscribeReturn(this, s); - } } else { AtomicObservableSubscription subscription = new AtomicObservableSubscription(); subscription.wrap(onSubscribeFunction.call(new AtomicObserver<>(subscription, observer))); @@ -180,77 +196,91 @@ public class Observable { } /** - * an {@link Observer} must call an Observable's subscribe method in order to register itself - * to receive push-based notifications from the Observable. A typical implementation of the + * an {@link Observer} must call an Observable's subscribe + * method in order to register itself + * to receive push-based notifications from the Observable. A typical + * implementation of the * subscribe method does the following: *

- * It stores a reference to the Observer in a collection object, such as a List + * It stores a reference to the Observer in a collection object, such as a + * List * object. *

- * It returns a reference to the {@link Subscription} interface. This enables - * Observers to unsubscribe (that is, to stop receiving notifications) before the Observable has - * finished sending them and has called the Observer's {@link Observer#onCompleted()} method. + * It returns a reference to the {@link Subscription} interface. This + * enables + * Observers to unsubscribe (that is, to stop receiving notifications) + * before the Observable has + * finished sending them and has called the Observer's + * {@link Observer#onCompleted()} method. *

- * At any given time, a particular instance of an Observable implementation is - * responsible for accepting all subscriptions and notifying all subscribers. Unless the - * documentation for a particular Observable implementation indicates otherwise, - * Observers should make no assumptions about the Observable implementation, such + * At any given time, a particular instance of an Observable + * implementation is + * responsible for accepting all subscriptions and notifying all + * subscribers. Unless the + * documentation for a particular Observable implementation + * indicates otherwise, + * Observers should make no assumptions about the Observable + * implementation, such * as the order of notifications that multiple Observers will receive. *

- * For more information see the RxJava Wiki - * - * + * For more information see the + * RxJava + * Wiki + * + * * @param observer * @param scheduler - * The {@link Scheduler} that the sequence is subscribed to on. + * The {@link Scheduler} that the sequence is subscribed to on. * @return a {@link Subscription} reference that allows observers - * to stop receiving notifications before the provider has finished sending them + * to stop receiving notifications before the provider has finished sending + * them */ public Subscription subscribe(Observer observer, Scheduler scheduler) { return subscribeOn(scheduler).subscribe(observer); } /** - * Used for protecting against errors being thrown from Observer implementations and ensuring onNext/onError/onCompleted contract compliance. + * Used for protecting against errors being thrown from Observer + * implementations and ensuring onNext/onError/onCompleted contract + * compliance. *

- * See https://github.com/Netflix/RxJava/issues/216 for discussion on "Guideline 6.4: Protect calls to user code from within an operator" + * See https://github.com/Netflix/RxJava/issues/216 for discussion on + * "Guideline 6.4: Protect calls to user code from within an operator" */ private Subscription protectivelyWrapAndSubscribe(Observer o) { AtomicObservableSubscription subscription = new AtomicObservableSubscription(); return subscription.wrap(subscribe(new AtomicObserver<>(subscription, o))); } - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) public Subscription subscribe(final Map callbacks) { // lookup and memoize onNext Object _onNext = callbacks.get("onNext"); - if (_onNext == null) { + if (_onNext == null) throw new RuntimeException("onNext must be implemented"); - } final FuncN onNext = Functions.from(_onNext); /** * Wrapping since raw functions provided by the user are being invoked. - * - * See https://github.com/Netflix/RxJava/issues/216 for discussion on "Guideline 6.4: Protect calls to user code from within an operator" + *

+ * See https://github.com/Netflix/RxJava/issues/216 for discussion on + * "Guideline 6.4: Protect calls to user code from within an operator" */ return protectivelyWrapAndSubscribe(new Observer() { @Override public void onCompleted() { Object onComplete = callbacks.get("onCompleted"); - if (onComplete != null) { + if (onComplete != null) Functions.from(onComplete).call(); - } } @Override public void onError(Exception e) { handleError(e); Object onError = callbacks.get("onError"); - if (onError != null) { + if (onError != null) Functions.from(onError).call(e); - } } @Override @@ -265,23 +295,22 @@ public class Observable { return subscribeOn(scheduler).subscribe(callbacks); } - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) public Subscription subscribe(final Object o) { - if (o instanceof Observer) { + if (o instanceof Observer) // in case a dynamic language is not correctly handling the overloaded methods and we receive an Observer just forward to the correct method. return subscribe((Observer) o); - } // lookup and memoize onNext - if (o == null) { + if (o == null) throw new RuntimeException("onNext must be implemented"); - } final FuncN onNext = Functions.from(o); /** * Wrapping since raw functions provided by the user are being invoked. - * - * See https://github.com/Netflix/RxJava/issues/216 for discussion on "Guideline 6.4: Protect calls to user code from within an operator" + *

+ * See https://github.com/Netflix/RxJava/issues/216 for discussion on + * "Guideline 6.4: Protect calls to user code from within an operator" */ return protectivelyWrapAndSubscribe(new Observer() { @@ -312,8 +341,9 @@ public class Observable { /** * Wrapping since raw functions provided by the user are being invoked. - * - * See https://github.com/Netflix/RxJava/issues/216 for discussion on "Guideline 6.4: Protect calls to user code from within an operator" + *

+ * See https://github.com/Netflix/RxJava/issues/216 for discussion on + * "Guideline 6.4: Protect calls to user code from within an operator" */ return protectivelyWrapAndSubscribe(new Observer() { @@ -330,9 +360,8 @@ public class Observable { @Override public void onNext(T args) { - if (onNext == null) { + if (onNext == null) throw new RuntimeException("onNext must be implemented"); - } onNext.call(args); } @@ -343,18 +372,18 @@ public class Observable { return subscribeOn(scheduler).subscribe(onNext); } - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) public Subscription subscribe(final Object onNext, final Object onError) { // lookup and memoize onNext - if (onNext == null) { + if (onNext == null) throw new RuntimeException("onNext must be implemented"); - } final FuncN onNextFunction = Functions.from(onNext); /** * Wrapping since raw functions provided by the user are being invoked. - * - * See https://github.com/Netflix/RxJava/issues/216 for discussion on "Guideline 6.4: Protect calls to user code from within an operator" + *

+ * See https://github.com/Netflix/RxJava/issues/216 for discussion on + * "Guideline 6.4: Protect calls to user code from within an operator" */ return protectivelyWrapAndSubscribe(new Observer() { @@ -366,9 +395,8 @@ public class Observable { @Override public void onError(Exception e) { handleError(e); - if (onError != null) { + if (onError != null) Functions.from(onError).call(e); - } } @Override @@ -387,8 +415,9 @@ public class Observable { /** * Wrapping since raw functions provided by the user are being invoked. - * - * See https://github.com/Netflix/RxJava/issues/216 for discussion on "Guideline 6.4: Protect calls to user code from within an operator" + *

+ * See https://github.com/Netflix/RxJava/issues/216 for discussion on + * "Guideline 6.4: Protect calls to user code from within an operator" */ return protectivelyWrapAndSubscribe(new Observer() { @@ -400,16 +429,14 @@ public class Observable { @Override public void onError(Exception e) { handleError(e); - if (onError != null) { + if (onError != null) onError.call(e); - } } @Override public void onNext(T args) { - if (onNext == null) { + if (onNext == null) throw new RuntimeException("onNext must be implemented"); - } onNext.call(args); } @@ -420,34 +447,32 @@ public class Observable { return subscribeOn(scheduler).subscribe(onNext, onError); } - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) public Subscription subscribe(final Object onNext, final Object onError, final Object onComplete) { // lookup and memoize onNext - if (onNext == null) { + if (onNext == null) throw new RuntimeException("onNext must be implemented"); - } final FuncN onNextFunction = Functions.from(onNext); /** * Wrapping since raw functions provided by the user are being invoked. - * - * See https://github.com/Netflix/RxJava/issues/216 for discussion on "Guideline 6.4: Protect calls to user code from within an operator" + *

+ * See https://github.com/Netflix/RxJava/issues/216 for discussion on + * "Guideline 6.4: Protect calls to user code from within an operator" */ return protectivelyWrapAndSubscribe(new Observer() { @Override public void onCompleted() { - if (onComplete != null) { + if (onComplete != null) Functions.from(onComplete).call(); - } } @Override public void onError(Exception e) { handleError(e); - if (onError != null) { + if (onError != null) Functions.from(onError).call(e); - } } @Override @@ -466,8 +491,9 @@ public class Observable { /** * Wrapping since raw functions provided by the user are being invoked. - * - * See https://github.com/Netflix/RxJava/issues/216 for discussion on "Guideline 6.4: Protect calls to user code from within an operator" + *

+ * See https://github.com/Netflix/RxJava/issues/216 for discussion on + * "Guideline 6.4: Protect calls to user code from within an operator" */ return protectivelyWrapAndSubscribe(new Observer() { @@ -479,16 +505,14 @@ public class Observable { @Override public void onError(Exception e) { handleError(e); - if (onError != null) { + if (onError != null) onError.call(e); - } } @Override public void onNext(T args) { - if (onNext == null) { + if (onNext == null) throw new RuntimeException("onNext must be implemented"); - } onNext.call(args); } @@ -500,16 +524,19 @@ public class Observable { } /** - * Invokes an action for each element in the observable sequence, and blocks until the sequence is terminated. + * Invokes an action for each element in the observable sequence, and blocks + * until the sequence is terminated. *

* NOTE: This will block even if the Observable is asynchronous. *

- * This is similar to {@link #subscribe(Observer)} but blocks. Because it blocks it does not need the {@link Observer#onCompleted()} or {@link Observer#onError(Exception)} methods. - * + * This is similar to {@link #subscribe(Observer)} but blocks. Because it + * blocks it does not need the {@link Observer#onCompleted()} or + * {@link Observer#onError(Exception)} methods. + * * @param onNext - * {@link Action1} + * {@link Action1} * @throws RuntimeException - * if error occurs + * if error occurs */ public void forEach(final Action1 onNext) { final CountDownLatch latch = new CountDownLatch(1); @@ -517,8 +544,9 @@ public class Observable { /** * Wrapping since raw functions provided by the user are being invoked. - * - * See https://github.com/Netflix/RxJava/issues/216 for discussion on "Guideline 6.4: Protect calls to user code from within an operator" + *

+ * See https://github.com/Netflix/RxJava/issues/216 for discussion on + * "Guideline 6.4: Protect calls to user code from within an operator" */ protectivelyWrapAndSubscribe(new Observer() { @Override @@ -554,46 +582,46 @@ public class Observable { throw new RuntimeException("Interrupted while waiting for subscription to complete.", e); } - if (exceptionFromOnError.get() != null) { - if (exceptionFromOnError.get() instanceof RuntimeException) { + if (exceptionFromOnError.get() != null) + if (exceptionFromOnError.get() instanceof RuntimeException) throw (RuntimeException) exceptionFromOnError.get(); - } else { + else throw new RuntimeException(exceptionFromOnError.get()); - } - } } /** - * Invokes an action for each element in the observable sequence, and blocks until the sequence is terminated. + * Invokes an action for each element in the observable sequence, and blocks + * until the sequence is terminated. *

* NOTE: This will block even if the Observable is asynchronous. *

- * This is similar to {@link #subscribe(Observer)} but blocks. Because it blocks it does not need the {@link Observer#onCompleted()} or {@link Observer#onError(Exception)} methods. - * + * This is similar to {@link #subscribe(Observer)} but blocks. Because it + * blocks it does not need the {@link Observer#onCompleted()} or + * {@link Observer#onError(Exception)} methods. + * * @param o - * {@link Action1} + * {@link Action1} * @throws RuntimeException - * if error occurs + * if error occurs */ - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) public void forEach(final Object o) { - if (o instanceof Action1) { + if (o instanceof Action1) // in case a dynamic language is not correctly handling the overloaded methods and we receive an Action1 just forward to the correct method. forEach((Action1) o); - } // lookup and memoize onNext - if (o == null) { + if (o == null) throw new RuntimeException("onNext must be implemented"); - } final FuncN onNext = Functions.from(o); forEach(onNext::call); } /** - * Returns the only element of an observable sequence and throws an exception if there is not exactly one element in the observable sequence. - * + * Returns the only element of an observable sequence and throws an + * exception if there is not exactly one element in the observable sequence. + * * @return The single element in the observable sequence. */ public T single() { @@ -601,10 +629,12 @@ public class Observable { } /** - * Returns the only element of an observable sequence that matches the predicate and throws an exception if there is not exactly one element in the observable sequence. - * + * Returns the only element of an observable sequence that matches the + * predicate and throws an exception if there is not exactly one element in + * the observable sequence. + * * @param predicate - * A predicate function to evaluate for elements in the sequence. + * A predicate function to evaluate for elements in the sequence. * @return The single element in the observable sequence. */ public T single(Func1 predicate) { @@ -612,10 +642,12 @@ public class Observable { } /** - * Returns the only element of an observable sequence that matches the predicate and throws an exception if there is not exactly one element in the observable sequence. - * + * Returns the only element of an observable sequence that matches the + * predicate and throws an exception if there is not exactly one element in + * the observable sequence. + * * @param predicate - * A predicate function to evaluate for elements in the sequence. + * A predicate function to evaluate for elements in the sequence. * @return The single element in the observable sequence. */ public T single(Object predicate) { @@ -623,45 +655,52 @@ public class Observable { } /** - * Returns the only element of an observable sequence, or a default value if the observable sequence is empty. - * + * Returns the only element of an observable sequence, or a default value if + * the observable sequence is empty. + * * @param defaultValue - * default value for a sequence. - * @return The single element in the observable sequence, or a default value if no value is found. + * default value for a sequence. + * @return The single element in the observable sequence, or a default value + * if no value is found. */ public T singleOrDefault(T defaultValue) { return singleOrDefault(this, defaultValue); } /** - * Returns the only element of an observable sequence that matches the predicate, or a default value if no value is found. - * + * Returns the only element of an observable sequence that matches the + * predicate, or a default value if no value is found. + * * @param defaultValue - * default value for a sequence. + * default value for a sequence. * @param predicate - * A predicate function to evaluate for elements in the sequence. - * @return The single element in the observable sequence, or a default value if no value is found. + * A predicate function to evaluate for elements in the sequence. + * @return The single element in the observable sequence, or a default value + * if no value is found. */ public T singleOrDefault(T defaultValue, Func1 predicate) { return singleOrDefault(this, defaultValue, predicate); } /** - * Returns the only element of an observable sequence that matches the predicate, or a default value if no value is found. - * + * Returns the only element of an observable sequence that matches the + * predicate, or a default value if no value is found. + * * @param defaultValue - * default value for a sequence. + * default value for a sequence. * @param predicate - * A predicate function to evaluate for elements in the sequence. - * @return The single element in the observable sequence, or a default value if no value is found. + * A predicate function to evaluate for elements in the sequence. + * @return The single element in the observable sequence, or a default value + * if no value is found. */ public T singleOrDefault(T defaultValue, Object predicate) { return singleOrDefault(this, defaultValue, predicate); } /** - * Allow the {@link RxJavaErrorHandler} to receive the exception from onError. - * + * Allow the {@link RxJavaErrorHandler} to receive the exception from + * onError. + * * @param e */ private void handleError(Exception e) { @@ -671,21 +710,23 @@ public class Observable { /** * An Observable that never sends any information to an {@link Observer}. - * + *

* This Observable is useful primarily for testing purposes. - * + * * @param * the type of item emitted by the Observable */ private static class NeverObservable extends Observable { + public NeverObservable() { super((Observer t1) -> Subscriptions.empty()); } } /** - * an Observable that calls {@link Observer#onError(Exception)} when the Observer subscribes. - * + * an Observable that calls {@link Observer#onError(Exception)} when the + * Observer subscribes. + * * @param * the type of object returned by the Observable */ @@ -693,10 +734,11 @@ public class Observable { public ThrowObservable(final Exception exception) { /** - * Accepts an {@link Observer} and calls its onError method. + * Accepts an {@link Observer} and calls its onError + * method. * * @param observer - * an {@link Observer} of this Observable + * an {@link Observer} of this Observable * @return a reference to the subscription */ super((Observer observer) -> { @@ -707,45 +749,73 @@ public class Observable { } + public static Observable createWithEmptySubscription(Action1> func) { + return new Observable<>(t -> { + func.call(t); + return Subscriptions.empty(); + }); + } + /** - * Creates an Observable that will execute the given function when a {@link Observer} subscribes to it. + * Creates an Observable that will execute the given function when a + * {@link Observer} subscribes to it. *

- * Write the function you pass to create so that it behaves as an Observable - calling the passed-in - * onNext, onError, and onCompleted methods appropriately. + * Write the function you pass to create so that it behaves as + * an Observable - calling the passed-in + * onNext, onError, and onCompleted + * methods appropriately. *

- * A well-formed Observable must call either the {@link Observer}'s onCompleted method exactly once or its onError method exactly once. + * A well-formed Observable must call either the {@link Observer}'s + * onCompleted method exactly once or its onError + * method exactly once. *

- * See Rx Design Guidelines (PDF) for detailed information. - * + * See Rx Design + * Guidelines (PDF) for detailed information. + * * @param - * the type emitted by the Observable sequence + * the type emitted by the Observable sequence * @param func - * a function that accepts an Observer and calls its onNext, onError, and onCompleted methods - * as appropriate, and returns a {@link Subscription} to allow canceling the subscription (if applicable) - * @return an Observable that, when an {@link Observer} subscribes to it, will execute the given function + * a function that accepts an Observer and calls its + * onNext, onError, and + * onCompleted methods + * as appropriate, and returns a {@link Subscription} to allow canceling the + * subscription (if applicable) + * @return an Observable that, when an {@link Observer} subscribes to it, + * will execute the given function */ public static Observable create(Func1, Subscription> func) { return new Observable<>(func); } /** - * Creates an Observable that will execute the given function when a {@link Observer} subscribes to it. + * Creates an Observable that will execute the given function when a + * {@link Observer} subscribes to it. *

- * This method accept {@link Object} to allow different languages to pass in closures using {@link FunctionLanguageAdaptor}. + * This method accept {@link Object} to allow different languages to pass in + * closures using {@link FunctionLanguageAdaptor}. *

- * Write the function you pass to create so that it behaves as an Observable - calling the passed-in - * onNext, onError, and onCompleted methods appropriately. + * Write the function you pass to create so that it behaves as + * an Observable - calling the passed-in + * onNext, onError, and onCompleted + * methods appropriately. *

- * A well-formed Observable must call either the {@link Observer}'s onCompleted method exactly once or its onError method exactly once. + * A well-formed Observable must call either the {@link Observer}'s + * onCompleted method exactly once or its onError + * method exactly once. *

- * See Rx Design Guidelines (PDF) for detailed information. - * + * See Rx Design + * Guidelines (PDF) for detailed information. + * * @param - * the type emitted by the Observable sequence + * the type emitted by the Observable sequence * @param func - * a function that accepts an Observer and calls its onNext, onError, and onCompleted methods - * as appropriate, and returns a {@link Subscription} to allow canceling the subscription (if applicable) - * @return an Observable that, when an {@link Observer} subscribes to it, will execute the given function + * a function that accepts an Observer and calls its + * onNext, onError, and + * onCompleted methods + * as appropriate, and returns a {@link Subscription} to allow canceling the + * subscription (if applicable) + * @return an Observable that, when an {@link Observer} subscribes to it, + * will execute the given function */ public static Observable create(final Object func) { final FuncN _f = Functions.from(func); @@ -753,57 +823,68 @@ public class Observable { } /** - * Returns an Observable that returns no data to the {@link Observer} and immediately invokes its onCompleted method. + * Returns an Observable that returns no data to the {@link Observer} and + * immediately invokes its onCompleted method. *

* - * + * * @param * the type of item emitted by the Observable - * @return an Observable that returns no data to the {@link Observer} and immediately invokes the {@link Observer}'s onCompleted method + * @return an Observable that returns no data to the {@link Observer} and + * immediately invokes the {@link Observer}'s + * onCompleted method */ public static Observable empty() { return toObservable(new ArrayList()); } /** - * Returns an Observable that calls onError when an {@link Observer} subscribes to it. + * Returns an Observable that calls onError when an + * {@link Observer} subscribes to it. *

- * + * * @param exception - * the error to throw + * the error to throw * @param - * the type of object returned by the Observable - * @return an Observable object that calls onError when an {@link Observer} subscribes + * the type of object returned by the Observable + * @return an Observable object that calls onError when an + * {@link Observer} subscribes */ public static Observable error(Exception exception) { return new ThrowObservable<>(exception); } /** - * Filters an Observable by discarding any of its emissions that do not meet some test. + * Filters an Observable by discarding any of its emissions that do not meet + * some test. *

* - * + * * @param that - * the Observable to filter + * the Observable to filter * @param predicate - * a function that evaluates the items emitted by the source Observable, returning true if they pass the filter - * @return an Observable that emits only those items in the original Observable that the filter evaluates as true + * a function that evaluates the items emitted by the source Observable, + * returning true if they pass the filter + * @return an Observable that emits only those items in the original + * Observable that the filter evaluates as true */ public static Observable filter(Observable that, Func1 predicate) { return create(OperationFilter.filter(that, predicate)); } /** - * Filters an Observable by discarding any of its emissions that do not meet some test. + * Filters an Observable by discarding any of its emissions that do not meet + * some test. *

* - * + * * @param that - * the Observable to filter + * the Observable to filter * @param function - * a function that evaluates the items emitted by the source Observable, returning true if they pass the filter - * @return an Observable that emits only those items in the original Observable that the filter evaluates as true + * a function that evaluates the items emitted by the source Observable, + * returning true if they pass the filter + * @return an Observable that emits only those items in the original + * Observable that the filter evaluates as true */ public static Observable filter(Observable that, final Object function) { final FuncN _f = Functions.from(function); @@ -811,15 +892,18 @@ public class Observable { } /** - * Filters an Observable by discarding any of its emissions that do not meet some test. + * Filters an Observable by discarding any of its emissions that do not meet + * some test. *

* - * + * * @param that - * the Observable to filter + * the Observable to filter * @param predicate - * a function that evaluates the items emitted by the source Observable, returning true if they pass the filter - * @return an Observable that emits only those items in the original Observable that the filter evaluates as true + * a function that evaluates the items emitted by the source Observable, + * returning true if they pass the filter + * @return an Observable that emits only those items in the original + * Observable that the filter evaluates as true */ public static Observable where(Observable that, Func1 predicate) { return create(OperationWhere.where(that, predicate)); @@ -827,12 +911,14 @@ public class Observable { /** * Converts an {@link Iterable} sequence to an Observable sequence. - * + * * @param iterable - * the source {@link Iterable} sequence + * the source {@link Iterable} sequence * @param - * the type of items in the {@link Iterable} sequence and the type emitted by the resulting Observable - * @return an Observable that emits each item in the source {@link Iterable} sequence + * the type of items in the {@link Iterable} sequence and the type emitted + * by the resulting Observable + * @return an Observable that emits each item in the source {@link Iterable} + * sequence * @see {@link #toObservable(Iterable)} */ public static Observable from(Iterable iterable) { @@ -841,11 +927,12 @@ public class Observable { /** * Converts an Array to an Observable sequence. - * + * * @param items - * the source Array + * the source Array * @param - * the type of items in the Array, and the type of items emitted by the resulting Observable + * the type of items in the Array, and the type of items emitted by the + * resulting Observable * @return an Observable that emits each item in the source Array * @see {@link #toObservable(Object...)} */ @@ -854,31 +941,37 @@ public class Observable { } /** - * Generates an observable sequence of integral numbers within a specified range. - * + * Generates an observable sequence of integral numbers within a specified + * range. + * * @param start - * The value of the first integer in the sequence + * The value of the first integer in the sequence * @param count - * The number of sequential integers to generate. - * - * @return An observable sequence that contains a range of sequential integral numbers. - * - * @see Observable.Range Method (Int32, Int32) + * The number of sequential integers to generate. + * + * @return An observable sequence that contains a range of sequential + * integral numbers. + * + * @see + * Observable.Range + * Method (Int32, Int32) */ public static Observable range(int start, int count) { return from(Range.createWithCount(start, count)); } /** - * Asynchronously subscribes and unsubscribes observers on the specified scheduler. - * + * Asynchronously subscribes and unsubscribes observers on the specified + * scheduler. + * * @param source - * the source observable. + * the source observable. * @param scheduler - * the scheduler to perform subscription and unsubscription actions on. + * the scheduler to perform subscription and unsubscription actions on. * @param - * the type of observable. - * @return the source sequence whose subscriptions and unsubscriptions happen on the specified scheduler. + * the type of observable. + * @return the source sequence whose subscriptions and unsubscriptions + * happen on the specified scheduler. */ public static Observable subscribeOn(Observable source, Scheduler scheduler) { return create(OperationSubscribeOn.subscribeOn(source, scheduler)); @@ -886,46 +979,57 @@ public class Observable { /** * Asynchronously notify observers on the specified scheduler. - * + * * @param source - * the source observable. + * the source observable. * @param scheduler - * the scheduler to notify observers on. + * the scheduler to notify observers on. * @param - * the type of observable. - * @return the source sequence whose observations happen on the specified scheduler. + * the type of observable. + * @return the source sequence whose observations happen on the specified + * scheduler. */ public static Observable observeOn(Observable source, Scheduler scheduler) { return create(OperationObserveOn.observeOn(source, scheduler)); } /** - * Returns an observable sequence that invokes the observable factory whenever a new observer subscribes. - * The Defer operator allows you to defer or delay the creation of the sequence until the time when an observer - * subscribes to the sequence. This is useful to allow an observer to easily obtain an updates or refreshed version + * Returns an observable sequence that invokes the observable factory + * whenever a new observer subscribes. + * The Defer operator allows you to defer or delay the creation of the + * sequence until the time when an observer + * subscribes to the sequence. This is useful to allow an observer to easily + * obtain an updates or refreshed version * of the sequence. - * + * * @param observableFactory - * the observable factory function to invoke for each observer that subscribes to the resulting sequence. + * the observable factory function to invoke for each observer that + * subscribes to the resulting sequence. * @param - * the type of the observable. - * @return the observable sequence whose observers trigger an invocation of the given observable factory function. + * the type of the observable. + * @return the observable sequence whose observers trigger an invocation of + * the given observable factory function. */ public static Observable defer(Func0> observableFactory) { return create(OperationDefer.defer(observableFactory)); } /** - * Returns an observable sequence that invokes the observable factory whenever a new observer subscribes. - * The Defer operator allows you to defer or delay the creation of the sequence until the time when an observer - * subscribes to the sequence. This is useful to allow an observer to easily obtain an updates or refreshed version + * Returns an observable sequence that invokes the observable factory + * whenever a new observer subscribes. + * The Defer operator allows you to defer or delay the creation of the + * sequence until the time when an observer + * subscribes to the sequence. This is useful to allow an observer to easily + * obtain an updates or refreshed version * of the sequence. - * + * * @param observableFactory - * the observable factory function to invoke for each observer that subscribes to the resulting sequence. + * the observable factory function to invoke for each observer that + * subscribes to the resulting sequence. * @param - * the type of the observable. - * @return the observable sequence whose observers trigger an invocation of the given observable factory function. + * the type of the observable. + * @return the observable sequence whose observers trigger an invocation of + * the given observable factory function. */ public static Observable defer(Object observableFactory) { final FuncN _f = Functions.from(observableFactory); @@ -934,22 +1038,28 @@ public class Observable { } /** - * Returns an Observable that notifies an {@link Observer} of a single value and then completes. + * Returns an Observable that notifies an {@link Observer} of a single value + * and then completes. *

- * To convert any object into an Observable that emits that object, pass that object into the just method. + * To convert any object into an Observable that emits that object, pass + * that object into the just method. *

- * This is similar to the {@link #toObservable} method, except that toObservable will convert - * an {@link Iterable} object into an Observable that emits each of the items in the {@link Iterable}, one - * at a time, while the just method would convert the {@link Iterable} into an Observable + * This is similar to the {@link #toObservable} method, except that + * toObservable will convert + * an {@link Iterable} object into an Observable that emits each of the + * items in the {@link Iterable}, one + * at a time, while the just method would convert the + * {@link Iterable} into an Observable * that emits the entire {@link Iterable} as a single item. *

* - * + * * @param value - * the value to pass to the Observer's onNext method + * the value to pass to the Observer's onNext method * @param - * the type of the value - * @return an Observable that notifies an {@link Observer} of a single value and then completes + * the type of the value + * @return an Observable that notifies an {@link Observer} of a single value + * and then completes */ public static Observable just(T value) { List list = new ArrayList<>(); @@ -959,27 +1069,28 @@ public class Observable { } /** - * Returns the last element of an observable sequence with a specified source. - * + * Returns the last element of an observable sequence with a specified + * source. + * * @param that - * the source Observable + * the source Observable * @return the last element in the observable sequence. */ public static T last(final Observable that) { T result = null; - for (T value : that.toIterable()) { + for (T value : that.toIterable()) result = value; - } return result; } /** - * Returns the last element of an observable sequence that matches the predicate. - * + * Returns the last element of an observable sequence that matches the + * predicate. + * * @param that - * the source Observable + * the source Observable * @param predicate - * a predicate function to evaluate for elements in the sequence. + * a predicate function to evaluate for elements in the sequence. * @return the last element in the observable sequence. */ public static T last(final Observable that, final Func1 predicate) { @@ -987,12 +1098,13 @@ public class Observable { } /** - * Returns the last element of an observable sequence that matches the predicate. - * + * Returns the last element of an observable sequence that matches the + * predicate. + * * @param that - * the source Observable + * the source Observable * @param predicate - * a predicate function to evaluate for elements in the sequence. + * a predicate function to evaluate for elements in the sequence. * @return the last element in the observable sequence. */ public static T last(final Observable that, final Object predicate) { @@ -1000,15 +1112,17 @@ public class Observable { } /** - * Returns the last element of an observable sequence, or a default value if no value is found. - * + * Returns the last element of an observable sequence, or a default value if + * no value is found. + * * @param source - * the source observable. + * the source observable. * @param defaultValue - * a default value that would be returned if observable is empty. + * a default value that would be returned if observable is empty. * @param - * the type of source. - * @return the last element of an observable sequence that matches the predicate, or a default value if no value is found. + * the type of source. + * @return the last element of an observable sequence that matches the + * predicate, or a default value if no value is found. */ public static T lastOrDefault(Observable source, T defaultValue) { boolean found = false; @@ -1019,42 +1133,45 @@ public class Observable { result = value; } - if (!found) { + if (!found) return defaultValue; - } return result; } /** - * Returns the last element of an observable sequence that matches the predicate, or a default value if no value is found. - * + * Returns the last element of an observable sequence that matches the + * predicate, or a default value if no value is found. + * * @param source - * the source observable. + * the source observable. * @param defaultValue - * a default value that would be returned if observable is empty. + * a default value that would be returned if observable is empty. * @param predicate - * a predicate function to evaluate for elements in the sequence. + * a predicate function to evaluate for elements in the sequence. * @param - * the type of source. - * @return the last element of an observable sequence that matches the predicate, or a default value if no value is found. + * the type of source. + * @return the last element of an observable sequence that matches the + * predicate, or a default value if no value is found. */ public static T lastOrDefault(Observable source, T defaultValue, Func1 predicate) { return lastOrDefault(source.filter(predicate), defaultValue); } /** - * Returns the last element of an observable sequence that matches the predicate, or a default value if no value is found. - * + * Returns the last element of an observable sequence that matches the + * predicate, or a default value if no value is found. + * * @param source - * the source observable. + * the source observable. * @param defaultValue - * a default value that would be returned if observable is empty. + * a default value that would be returned if observable is empty. * @param predicate - * a predicate function to evaluate for elements in the sequence. + * a predicate function to evaluate for elements in the sequence. * @param - * the type of source. - * @return the last element of an observable sequence that matches the predicate, or a default value if no value is found. + * the type of source. + * @return the last element of an observable sequence that matches the + * predicate, or a default value if no value is found. */ public static T lastOrDefault(Observable source, T defaultValue, Object predicate) { final FuncN _f = Functions.from(predicate); @@ -1063,20 +1180,23 @@ public class Observable { } /** - * Applies a function of your choosing to every notification emitted by an Observable, and returns + * Applies a function of your choosing to every notification emitted by an + * Observable, and returns * this transformation as a new Observable sequence. *

* - * + * * @param sequence - * the source Observable + * the source Observable * @param func - * a function to apply to each item in the sequence emitted by the source Observable + * a function to apply to each item in the sequence emitted by the source + * Observable * @param - * the type of items emitted by the the source Observable + * the type of items emitted by the the source Observable * @param - * the type of items returned by map function - * @return an Observable that is the result of applying the transformation function to each item + * the type of items returned by map function + * @return an Observable that is the result of applying the transformation + * function to each item * in the sequence emitted by the source Observable */ public static Observable map(Observable sequence, Func1 func) { @@ -1084,20 +1204,23 @@ public class Observable { } /** - * Applies a function of your choosing to every notification emitted by an Observable, and returns + * Applies a function of your choosing to every notification emitted by an + * Observable, and returns * this transformation as a new Observable sequence. *

* - * + * * @param sequence - * the source Observable + * the source Observable * @param func - * a function to apply to each item in the sequence emitted by the source Observable + * a function to apply to each item in the sequence emitted by the source + * Observable * @param - * the type of items emitted by the the source Observable + * the type of items emitted by the the source Observable * @param - * the type of items returned by map function - * @return an Observable that is the result of applying the transformation function to each item + * the type of items returned by map function + * @return an Observable that is the result of applying the transformation + * function to each item * in the sequence emitted by the source Observable */ public static Observable map(Observable sequence, final Object func) { @@ -1106,24 +1229,30 @@ public class Observable { } /** - * Creates a new Observable sequence by applying a function that you supply to each object in the - * original Observable sequence, where that function is itself an Observable that emits objects, - * and then merges the results of that function applied to every item emitted by the original + * Creates a new Observable sequence by applying a function that you supply + * to each object in the + * original Observable sequence, where that function is itself an Observable + * that emits objects, + * and then merges the results of that function applied to every item + * emitted by the original * Observable, emitting these merged results as its own sequence. *

* - * + * * @param sequence - * the source Observable + * the source Observable * @param func - * a function to apply to each item emitted by the source Observable, generating a - * Observable + * a function to apply to each item emitted by the source Observable, + * generating a + * Observable * @param - * the type emitted by the source Observable + * the type emitted by the source Observable * @param - * the type emitted by the Observables emitted by func - * @return an Observable that emits a sequence that is the result of applying the transformation - * function to each item emitted by the source Observable and merging the results of + * the type emitted by the Observables emitted by func + * @return an Observable that emits a sequence that is the result of + * applying the transformation + * function to each item emitted by the source Observable and merging the + * results of * the Observables obtained from this transformation */ public static Observable mapMany(Observable sequence, Func1> func) { @@ -1131,24 +1260,30 @@ public class Observable { } /** - * Creates a new Observable sequence by applying a function that you supply to each object in the - * original Observable sequence, where that function is itself an Observable that emits objects, - * and then merges the results of that function applied to every item emitted by the original + * Creates a new Observable sequence by applying a function that you supply + * to each object in the + * original Observable sequence, where that function is itself an Observable + * that emits objects, + * and then merges the results of that function applied to every item + * emitted by the original * Observable, emitting these merged results as its own sequence. *

* - * + * * @param sequence - * the source Observable + * the source Observable * @param func - * a function to apply to each item emitted by the source Observable, generating a - * Observable + * a function to apply to each item emitted by the source Observable, + * generating a + * Observable * @param - * the type emitted by the source Observable + * the type emitted by the source Observable * @param - * the type emitted by the Observables emitted by func - * @return an Observable that emits a sequence that is the result of applying the transformation - * function to each item emitted by the source Observable and merging the results of + * the type emitted by the Observables emitted by func + * @return an Observable that emits a sequence that is the result of + * applying the transformation + * function to each item emitted by the source Observable and merging the + * results of * the Observables obtained from this transformation */ public static Observable mapMany(Observable sequence, final Object func) { @@ -1157,110 +1292,143 @@ public class Observable { } /** - * Materializes the implicit notifications of an observable sequence as explicit notification values. + * Materializes the implicit notifications of an observable sequence as + * explicit notification values. *

* - * + * * @param sequence - * An observable sequence of elements to project. - * @return An observable sequence whose elements are the result of materializing the notifications of the given sequence. - * @see MSDN: Observable.Materialize + * An observable sequence of elements to project. + * @return An observable sequence whose elements are the result of + * materializing the notifications of the given sequence. + * @see + * MSDN: + * Observable.Materialize */ public static Observable> materialize(final Observable sequence) { return create(OperationMaterialize.materialize(sequence)); } /** - * Dematerializes the explicit notification values of an observable sequence as implicit notifications. - * + * Dematerializes the explicit notification values of an observable sequence + * as implicit notifications. + * * @param sequence - * An observable sequence containing explicit notification values which have to be turned into implicit notifications. - * @return An observable sequence exhibiting the behavior corresponding to the source sequence's notification values. - * @see MSDN: Observable.Dematerialize + * An observable sequence containing explicit notification values which have + * to be turned into implicit notifications. + * @return An observable sequence exhibiting the behavior corresponding to + * the source sequence's notification values. + * @see + * MSDN: + * Observable.Dematerialize */ public static Observable dematerialize(final Observable> sequence) { return create(OperationDematerialize.dematerialize(sequence)); } /** - * Flattens the Observable sequences from a list of Observables into one Observable sequence - * without any transformation. You can combine the output of multiple Observables so that they + * Flattens the Observable sequences from a list of Observables into one + * Observable sequence + * without any transformation. You can combine the output of multiple + * Observables so that they * act like a single Observable, by using the merge method. *

* - * + * * @param source - * a list of Observables that emit sequences of items - * @return an Observable that emits a sequence of elements that are the result of flattening the + * a list of Observables that emit sequences of items + * @return an Observable that emits a sequence of elements that are the + * result of flattening the * output from the source list of Observables - * @see MSDN: Observable.Merge + * @see + * MSDN: + * Observable.Merge */ public static Observable merge(List> source) { return create(OperationMerge.merge(source)); } /** - * Flattens the Observable sequences emitted by a sequence of Observables that are emitted by a - * Observable into one Observable sequence without any transformation. You can combine the output - * of multiple Observables so that they act like a single Observable, by using the merge method. + * Flattens the Observable sequences emitted by a sequence of Observables + * that are emitted by a + * Observable into one Observable sequence without any transformation. You + * can combine the output + * of multiple Observables so that they act like a single Observable, by + * using the merge method. *

* - * + * * @param source - * an Observable that emits Observables - * @return an Observable that emits a sequence of elements that are the result of flattening the + * an Observable that emits Observables + * @return an Observable that emits a sequence of elements that are the + * result of flattening the * output from the Observables emitted by the source Observable - * @see MSDN: Observable.Merge Method + * @see + * MSDN: + * Observable.Merge Method */ public static Observable merge(Observable> source) { return create(OperationMerge.merge(source)); } /** - * Flattens the Observable sequences from a series of Observables into one Observable sequence - * without any transformation. You can combine the output of multiple Observables so that they + * Flattens the Observable sequences from a series of Observables into one + * Observable sequence + * without any transformation. You can combine the output of multiple + * Observables so that they * act like a single Observable, by using the merge method. *

* - * + * * @param source - * a series of Observables that emit sequences of items - * @return an Observable that emits a sequence of elements that are the result of flattening the + * a series of Observables that emit sequences of items + * @return an Observable that emits a sequence of elements that are the + * result of flattening the * output from the source Observables - * @see MSDN: Observable.Merge Method + * @see + * MSDN: + * Observable.Merge Method */ public static Observable merge(Observable... source) { return create(OperationMerge.merge(source)); } /** - * Returns the values from the source observable sequence until the other observable sequence produces a value. - * + * Returns the values from the source observable sequence until the other + * observable sequence produces a value. + * * @param source - * the source sequence to propagate elements for. + * the source sequence to propagate elements for. * @param other - * the observable sequence that terminates propagation of elements of the source sequence. + * the observable sequence that terminates propagation of elements of the + * source sequence. * @param - * the type of source. + * the type of source. * @param - * the other type. - * @return An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation. + * the other type. + * @return An observable sequence containing the elements of the source + * sequence up to the point the other sequence interrupted further + * propagation. */ public static Observable takeUntil(final Observable source, final Observable other) { return OperatorTakeUntil.takeUntil(source, other); } /** - * Combines the objects emitted by two or more Observables, and emits the result as a single Observable, + * Combines the objects emitted by two or more Observables, and emits the + * result as a single Observable, * by using the concat method. *

* - * + * * @param source - * a series of Observables that emit sequences of items - * @return an Observable that emits a sequence of elements that are the result of combining the + * a series of Observables that emit sequences of items + * @return an Observable that emits a sequence of elements that are the + * result of combining the * output from the source Observables - * @see MSDN: Observable.Concat Method + * @see + * MSDN: + * Observable.Concat Method */ public static Observable concat(Observable... source) { return create(OperationConcat.concat(source)); @@ -1269,148 +1437,187 @@ public class Observable { /** * Emits the same objects as the given Observable, calling the given action * when it calls onComplete or onError. - * + * * @param source - * an observable + * an observable * @param action - * an action to be called when the source completes or errors. + * an action to be called when the source completes or errors. * @return an Observable that emits the same objects, then calls the action. - * @see MSDN: Observable.Finally Method + * @see + * MSDN: + * Observable.Finally Method */ public static Observable finallyDo(Observable source, Action0 action) { return create(OperationFinally.finallyDo(source, action)); } /** - * Groups the elements of an observable and selects the resulting elements by using a specified function. - * + * Groups the elements of an observable and selects the resulting elements + * by using a specified function. + * * @param source - * an observable whose elements to group. + * an observable whose elements to group. * @param keySelector - * a function to extract the key for each element. + * a function to extract the key for each element. * @param elementSelector - * a function to map each source element to an element in an observable group. + * a function to map each source element to an element in an observable + * group. * @param - * the key type. + * the key type. * @param - * the source type. + * the source type. * @param - * the resulting observable type. - * @return an observable of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value. + * the resulting observable type. + * @return an observable of observable groups, each of which corresponds to + * a unique key value, containing all elements that share that same + * key value. */ public static Observable> groupBy(Observable source, final Func1 keySelector, final Func1 elementSelector) { return create(OperatorGroupBy.groupBy(source, keySelector, elementSelector)); } /** - * Groups the elements of an observable according to a specified key selector function and - * + * Groups the elements of an observable according to a specified key + * selector function and + * * @param source - * an observable whose elements to group. + * an observable whose elements to group. * @param keySelector - * a function to extract the key for each element. + * a function to extract the key for each element. * @param - * the key type. + * the key type. * @param - * the source type. - * @return an observable of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value. + * the source type. + * @return an observable of observable groups, each of which corresponds to + * a unique key value, containing all elements that share that same + * key value. */ public static Observable> groupBy(Observable source, final Func1 keySelector) { return create(OperatorGroupBy.groupBy(source, keySelector)); } /** - * Same functionality as merge except that errors received to onError will be held until all sequences have finished (onComplete/onError) before sending the error. + * Same functionality as merge except that errors received to + * onError will be held until all sequences have finished + * (onComplete/onError) before sending the error. *

* Only the first onError received will be sent. *

- * This enables receiving all successes from merged sequences without one onError from one sequence causing all onNext calls to be prevented. + * This enables receiving all successes from merged sequences without one + * onError from one sequence causing all onNext calls to be prevented. *

* - * + * * @param source - * a list of Observables that emit sequences of items - * @return an Observable that emits a sequence of elements that are the result of flattening the + * a list of Observables that emit sequences of items + * @return an Observable that emits a sequence of elements that are the + * result of flattening the * output from the source list of Observables - * @see MSDN: Observable.Merge Method + * @see + * MSDN: + * Observable.Merge Method */ public static Observable mergeDelayError(List> source) { return create(OperationMergeDelayError.mergeDelayError(source)); } /** - * Same functionality as merge except that errors received to onError will be held until all sequences have finished (onComplete/onError) before sending the error. + * Same functionality as merge except that errors received to + * onError will be held until all sequences have finished + * (onComplete/onError) before sending the error. *

* Only the first onError received will be sent. *

- * This enables receiving all successes from merged sequences without one onError from one sequence causing all onNext calls to be prevented. + * This enables receiving all successes from merged sequences without one + * onError from one sequence causing all onNext calls to be prevented. *

* - * + * * @param source - * an Observable that emits Observables - * @return an Observable that emits a sequence of elements that are the result of flattening the + * an Observable that emits Observables + * @return an Observable that emits a sequence of elements that are the + * result of flattening the * output from the Observables emitted by the source Observable - * @see MSDN: Observable.Merge Method + * @see + * MSDN: + * Observable.Merge Method */ public static Observable mergeDelayError(Observable> source) { return create(OperationMergeDelayError.mergeDelayError(source)); } /** - * Same functionality as merge except that errors received to onError will be held until all sequences have finished (onComplete/onError) before sending the error. + * Same functionality as merge except that errors received to + * onError will be held until all sequences have finished + * (onComplete/onError) before sending the error. *

* Only the first onError received will be sent. *

- * This enables receiving all successes from merged sequences without one onError from one sequence causing all onNext calls to be prevented. + * This enables receiving all successes from merged sequences without one + * onError from one sequence causing all onNext calls to be prevented. *

* - * + * * @param source - * a series of Observables that emit sequences of items - * @return an Observable that emits a sequence of elements that are the result of flattening the + * a series of Observables that emit sequences of items + * @return an Observable that emits a sequence of elements that are the + * result of flattening the * output from the source Observables - * @see MSDN: Observable.Merge Method + * @see + * MSDN: + * Observable.Merge Method */ public static Observable mergeDelayError(Observable... source) { return create(OperationMergeDelayError.mergeDelayError(source)); } /** - * Returns an Observable that never sends any information to an {@link Observer}. - * + * Returns an Observable that never sends any information to an + * {@link Observer}. + *

* This observable is useful primarily for testing purposes. - * + * * @param * the type of item (not) emitted by the Observable - * @return an Observable that never sends any information to an {@link Observer} + * @return an Observable that never sends any information to an + * {@link Observer} */ public static Observable never() { return new NeverObservable<>(); } /** - * Instruct an Observable to pass control to another Observable (the return value of a function) + * Instruct an Observable to pass control to another Observable (the return + * value of a function) * rather than calling onError if it encounters an error. *

- * By default, when an Observable encounters an error that prevents it from emitting the expected item to its Observer, - * the Observable calls its {@link Observer}'s onError function, and then quits without calling any more - * of its {@link Observer}'s closures. The onErrorResumeNext method changes this behavior. If you pass a - * function that emits an Observable (resumeFunction) to an Observable's onErrorResumeNext method, - * if the original Observable encounters an error, instead of calling its {@link Observer}'s onError function, it - * will instead relinquish control to this new Observable, which will call the {@link Observer}'s onNext method if - * it is able to do so. In such a case, because no Observable necessarily invokes onError, the Observer may + * By default, when an Observable encounters an error that prevents it from + * emitting the expected item to its Observer, + * the Observable calls its {@link Observer}'s onError + * function, and then quits without calling any more + * of its {@link Observer}'s closures. The onErrorResumeNext + * method changes this behavior. If you pass a + * function that emits an Observable (resumeFunction) to an + * Observable's onErrorResumeNext method, + * if the original Observable encounters an error, instead of calling its + * {@link Observer}'s onError function, it + * will instead relinquish control to this new Observable, which will call + * the {@link Observer}'s onNext method if + * it is able to do so. In such a case, because no Observable necessarily + * invokes onError, the Observer may * never know that an error happened. *

- * You can use this to prevent errors from propagating or to supply fallback data should errors be encountered. + * You can use this to prevent errors from propagating or to supply fallback + * data should errors be encountered. *

* - * + * * @param that - * the source Observable + * the source Observable * @param resumeFunction - * a function that returns an Observable that will take over if the source Observable - * encounters an error + * a function that returns an Observable that will take over if the source + * Observable + * encounters an error * @return the source Observable, with its behavior modified as described */ public static Observable onErrorResumeNext(final Observable that, final Func1> resumeFunction) { @@ -1418,27 +1625,37 @@ public class Observable { } /** - * Instruct an Observable to pass control to another Observable (the return value of a function) + * Instruct an Observable to pass control to another Observable (the return + * value of a function) * rather than calling onError if it encounters an error. *

- * By default, when an Observable encounters an error that prevents it from emitting the expected item to its Observer, - * the Observable calls its {@link Observer}'s onError function, and then quits without calling any more - * of its {@link Observer}'s closures. The onErrorResumeNext method changes this behavior. If you pass a - * function that emits an Observable (resumeFunction) to an Observable's onErrorResumeNext method, - * if the original Observable encounters an error, instead of calling its {@link Observer}'s onError function, it - * will instead relinquish control to this new Observable, which will call the {@link Observer}'s onNext method if - * it is able to do so. In such a case, because no Observable necessarily invokes onError, the Observer may + * By default, when an Observable encounters an error that prevents it from + * emitting the expected item to its Observer, + * the Observable calls its {@link Observer}'s onError + * function, and then quits without calling any more + * of its {@link Observer}'s closures. The onErrorResumeNext + * method changes this behavior. If you pass a + * function that emits an Observable (resumeFunction) to an + * Observable's onErrorResumeNext method, + * if the original Observable encounters an error, instead of calling its + * {@link Observer}'s onError function, it + * will instead relinquish control to this new Observable, which will call + * the {@link Observer}'s onNext method if + * it is able to do so. In such a case, because no Observable necessarily + * invokes onError, the Observer may * never know that an error happened. *

- * You can use this to prevent errors from propagating or to supply fallback data should errors be encountered. + * You can use this to prevent errors from propagating or to supply fallback + * data should errors be encountered. *

* - * + * * @param that - * the source Observable + * the source Observable * @param resumeFunction - * a function that returns an Observable that will take over if the source Observable - * encounters an error + * a function that returns an Observable that will take over if the source + * Observable + * encounters an error * @return the source Observable, with its behavior modified as described */ public static Observable onErrorResumeNext(final Observable that, final Object resumeFunction) { @@ -1447,26 +1664,36 @@ public class Observable { } /** - * Instruct an Observable to pass control to another Observable rather than calling onError if it encounters an error. + * Instruct an Observable to pass control to another Observable rather than + * calling onError if it encounters an error. *

- * By default, when an Observable encounters an error that prevents it from emitting the expected item to its Observer, - * the Observable calls its {@link Observer}'s onError function, and then quits without calling any more - * of its {@link Observer}'s closures. The onErrorResumeNext method changes this behavior. If you pass a - * function that emits an Observable (resumeFunction) to an Observable's onErrorResumeNext method, - * if the original Observable encounters an error, instead of calling its {@link Observer}'s onError function, it - * will instead relinquish control to this new Observable, which will call the {@link Observer}'s onNext method if - * it is able to do so. In such a case, because no Observable necessarily invokes onError, the Observer may + * By default, when an Observable encounters an error that prevents it from + * emitting the expected item to its Observer, + * the Observable calls its {@link Observer}'s onError + * function, and then quits without calling any more + * of its {@link Observer}'s closures. The onErrorResumeNext + * method changes this behavior. If you pass a + * function that emits an Observable (resumeFunction) to an + * Observable's onErrorResumeNext method, + * if the original Observable encounters an error, instead of calling its + * {@link Observer}'s onError function, it + * will instead relinquish control to this new Observable, which will call + * the {@link Observer}'s onNext method if + * it is able to do so. In such a case, because no Observable necessarily + * invokes onError, the Observer may * never know that an error happened. *

- * You can use this to prevent errors from propagating or to supply fallback data should errors be encountered. + * You can use this to prevent errors from propagating or to supply fallback + * data should errors be encountered. *

* - * + * * @param that - * the source Observable + * the source Observable * @param resumeSequence - * a function that returns an Observable that will take over if the source Observable - * encounters an error + * a function that returns an Observable that will take over if the source + * Observable + * encounters an error * @return the source Observable, with its behavior modified as described */ public static Observable onErrorResumeNext(final Observable that, final Observable resumeSequence) { @@ -1474,23 +1701,34 @@ public class Observable { } /** - * Instruct an Observable to emit a particular item to its Observer's onNext function + * Instruct an Observable to emit a particular item to its Observer's + * onNext function * rather than calling onError if it encounters an error. *

- * By default, when an Observable encounters an error that prevents it from emitting the expected item to its {@link Observer}, the Observable calls its {@link Observer}'s onError + * By default, when an Observable encounters an error that prevents it from + * emitting the expected item to its {@link Observer}, the Observable calls + * its {@link Observer}'s onError * function, and then quits - * without calling any more of its {@link Observer}'s closures. The onErrorReturn method changes - * this behavior. If you pass a function (resumeFunction) to an Observable's onErrorReturn - * method, if the original Observable encounters an error, instead of calling its {@link Observer}'s - * onError function, it will instead pass the return value of resumeFunction to the {@link Observer}'s onNext method. + * without calling any more of its {@link Observer}'s closures. The + * onErrorReturn method changes + * this behavior. If you pass a function (resumeFunction) to an + * Observable's onErrorReturn + * method, if the original Observable encounters an error, instead of + * calling its {@link Observer}'s + * onError function, it will instead pass the return value of + * resumeFunction to the {@link Observer}'s onNext + * method. *

- * You can use this to prevent errors from propagating or to supply fallback data should errors be encountered. - * + * You can use this to prevent errors from propagating or to supply fallback + * data should errors be encountered. + * * @param that - * the source Observable + * the source Observable * @param resumeFunction - * a function that returns a value that will be passed into an {@link Observer}'s onNext function if the Observable encounters an error that would - * otherwise cause it to call onError + * a function that returns a value that will be passed into an + * {@link Observer}'s onNext function if + * the Observable encounters an error that would + * otherwise cause it to call onError * @return the source Observable, with its behavior modified as described */ public static Observable onErrorReturn(final Observable that, Func1 resumeFunction) { @@ -1498,60 +1736,86 @@ public class Observable { } /** - * Returns an Observable that applies a function of your choosing to the first item emitted by a - * source Observable, then feeds the result of that function along with the second item emitted - * by an Observable into the same function, and so on until all items have been emitted by the - * source Observable, emitting the final result from the final call to your function as its sole + * Returns an Observable that applies a function of your choosing to the + * first item emitted by a + * source Observable, then feeds the result of that function along with the + * second item emitted + * by an Observable into the same function, and so on until all items have + * been emitted by the + * source Observable, emitting the final result from the final call to your + * function as its sole * output. *

- * This technique, which is called "reduce" here, is sometimes called "fold," "accumulate," "compress," or "inject" in other programming contexts. Groovy, for instance, has an inject + * This technique, which is called "reduce" here, is sometimes called + * "fold," "accumulate," "compress," or "inject" in other programming + * contexts. Groovy, for instance, has an inject * method that does a similar operation on lists. *

* - * + * * @param - * the type item emitted by the source Observable + * the type item emitted by the source Observable * @param sequence - * the source Observable + * the source Observable * @param accumulator - * an accumulator function to be invoked on each element from the sequence, whose - * result will be used in the next accumulator call (if applicable) - * - * @return an Observable that emits a single element that is the result of accumulating the - * output from applying the accumulator to the sequence of items emitted by the source + * an accumulator function to be invoked on each element from the sequence, + * whose + * result will be used in the next accumulator call (if applicable) + * + * @return an Observable that emits a single element that is the result of + * accumulating the + * output from applying the accumulator to the sequence of items emitted by + * the source * Observable - * @see MSDN: Observable.Aggregate - * @see Wikipedia: Fold (higher-order function) + * @see + * MSDN: + * Observable.Aggregate + * @see + * Wikipedia: + * Fold (higher-order function) */ public static Observable reduce(Observable sequence, Func2 accumulator) { return takeLast(create(OperationScan.scan(sequence, accumulator)), 1); } /** - * Returns an Observable that applies a function of your choosing to the first item emitted by a - * source Observable, then feeds the result of that function along with the second item emitted - * by an Observable into the same function, and so on until all items have been emitted by the - * source Observable, emitting the final result from the final call to your function as its sole + * Returns an Observable that applies a function of your choosing to the + * first item emitted by a + * source Observable, then feeds the result of that function along with the + * second item emitted + * by an Observable into the same function, and so on until all items have + * been emitted by the + * source Observable, emitting the final result from the final call to your + * function as its sole * output. *

- * This technique, which is called "reduce" here, is sometimes called "fold," "accumulate," "compress," or "inject" in other programming contexts. Groovy, for instance, has an inject + * This technique, which is called "reduce" here, is sometimes called + * "fold," "accumulate," "compress," or "inject" in other programming + * contexts. Groovy, for instance, has an inject * method that does a similar operation on lists. *

* - * + * * @param - * the type item emitted by the source Observable + * the type item emitted by the source Observable * @param sequence - * the source Observable + * the source Observable * @param accumulator - * an accumulator function to be invoked on each element from the sequence, whose - * result will be used in the next accumulator call (if applicable) - * - * @return an Observable that emits a single element that is the result of accumulating the - * output from applying the accumulator to the sequence of items emitted by the source + * an accumulator function to be invoked on each element from the sequence, + * whose + * result will be used in the next accumulator call (if applicable) + * + * @return an Observable that emits a single element that is the result of + * accumulating the + * output from applying the accumulator to the sequence of items emitted by + * the source * Observable - * @see MSDN: Observable.Aggregate - * @see Wikipedia: Fold (higher-order function) + * @see + * MSDN: + * Observable.Aggregate + * @see + * Wikipedia: + * Fold (higher-order function) */ public static Observable reduce(final Observable sequence, final Object accumulator) { final FuncN _f = Functions.from(accumulator); @@ -1559,63 +1823,89 @@ public class Observable { } /** - * Returns an Observable that applies a function of your choosing to the first item emitted by a - * source Observable, then feeds the result of that function along with the second item emitted - * by an Observable into the same function, and so on until all items have been emitted by the - * source Observable, emitting the final result from the final call to your function as its sole + * Returns an Observable that applies a function of your choosing to the + * first item emitted by a + * source Observable, then feeds the result of that function along with the + * second item emitted + * by an Observable into the same function, and so on until all items have + * been emitted by the + * source Observable, emitting the final result from the final call to your + * function as its sole * output. *

- * This technique, which is called "reduce" here, is sometimes called "fold," "accumulate," "compress," or "inject" in other programming contexts. Groovy, for instance, has an inject + * This technique, which is called "reduce" here, is sometimes called + * "fold," "accumulate," "compress," or "inject" in other programming + * contexts. Groovy, for instance, has an inject * method that does a similar operation on lists. *

* - * + * * @param - * the type item emitted by the source Observable + * the type item emitted by the source Observable * @param sequence - * the source Observable + * the source Observable * @param initialValue - * a seed passed into the first execution of the accumulator function + * a seed passed into the first execution of the accumulator function * @param accumulator - * an accumulator function to be invoked on each element from the sequence, whose - * result will be used in the next accumulator call (if applicable) - * - * @return an Observable that emits a single element that is the result of accumulating the - * output from applying the accumulator to the sequence of items emitted by the source + * an accumulator function to be invoked on each element from the sequence, + * whose + * result will be used in the next accumulator call (if applicable) + * + * @return an Observable that emits a single element that is the result of + * accumulating the + * output from applying the accumulator to the sequence of items emitted by + * the source * Observable - * @see MSDN: Observable.Aggregate - * @see Wikipedia: Fold (higher-order function) + * @see + * MSDN: + * Observable.Aggregate + * @see + * Wikipedia: + * Fold (higher-order function) */ public static Observable reduce(Observable sequence, T initialValue, Func2 accumulator) { return takeLast(create(OperationScan.scan(sequence, initialValue, accumulator)), 1); } /** - * Returns an Observable that applies a function of your choosing to the first item emitted by a - * source Observable, then feeds the result of that function along with the second item emitted - * by an Observable into the same function, and so on until all items have been emitted by the - * source Observable, emitting the final result from the final call to your function as its sole + * Returns an Observable that applies a function of your choosing to the + * first item emitted by a + * source Observable, then feeds the result of that function along with the + * second item emitted + * by an Observable into the same function, and so on until all items have + * been emitted by the + * source Observable, emitting the final result from the final call to your + * function as its sole * output. *

- * This technique, which is called "reduce" here, is sometimes called "fold," "accumulate," "compress," or "inject" in other programming contexts. Groovy, for instance, has an inject + * This technique, which is called "reduce" here, is sometimes called + * "fold," "accumulate," "compress," or "inject" in other programming + * contexts. Groovy, for instance, has an inject * method that does a similar operation on lists. *

* - * + * * @param - * the type item emitted by the source Observable + * the type item emitted by the source Observable * @param sequence - * the source Observable + * the source Observable * @param initialValue - * a seed passed into the first execution of the accumulator function + * a seed passed into the first execution of the accumulator function * @param accumulator - * an accumulator function to be invoked on each element from the sequence, whose - * result will be used in the next accumulator call (if applicable) - * @return an Observable that emits a single element that is the result of accumulating the - * output from applying the accumulator to the sequence of items emitted by the source + * an accumulator function to be invoked on each element from the sequence, + * whose + * result will be used in the next accumulator call (if applicable) + * @return an Observable that emits a single element that is the result of + * accumulating the + * output from applying the accumulator to the sequence of items emitted by + * the source * Observable - * @see MSDN: Observable.Aggregate - * @see Wikipedia: Fold (higher-order function) + * @see + * MSDN: + * Observable.Aggregate + * @see + * Wikipedia: + * Fold (higher-order function) */ public static Observable reduce(final Observable sequence, final T initialValue, final Object accumulator) { final FuncN _f = Functions.from(accumulator); @@ -1623,46 +1913,64 @@ public class Observable { } /** - * Returns an Observable that applies a function of your choosing to the first item emitted by a - * source Observable, then feeds the result of that function along with the second item emitted - * by an Observable into the same function, and so on until all items have been emitted by the - * source Observable, emitting the result of each of these iterations as its own sequence. + * Returns an Observable that applies a function of your choosing to the + * first item emitted by a + * source Observable, then feeds the result of that function along with the + * second item emitted + * by an Observable into the same function, and so on until all items have + * been emitted by the + * source Observable, emitting the result of each of these iterations as its + * own sequence. *

* - * + * * @param - * the type item emitted by the source Observable + * the type item emitted by the source Observable * @param sequence - * the source Observable + * the source Observable * @param accumulator - * an accumulator function to be invoked on each element from the sequence, whose - * result will be emitted and used in the next accumulator call (if applicable) - * @return an Observable that emits a sequence of items that are the result of accumulating the + * an accumulator function to be invoked on each element from the sequence, + * whose + * result will be emitted and used in the next accumulator call (if + * applicable) + * @return an Observable that emits a sequence of items that are the result + * of accumulating the * output from the sequence emitted by the source Observable - * @see MSDN: Observable.Scan + * @see + * MSDN: + * Observable.Scan */ public static Observable scan(Observable sequence, Func2 accumulator) { return create(OperationScan.scan(sequence, accumulator)); } /** - * Returns an Observable that applies a function of your choosing to the first item emitted by a - * source Observable, then feeds the result of that function along with the second item emitted - * by an Observable into the same function, and so on until all items have been emitted by the - * source Observable, emitting the result of each of these iterations as its own sequence. + * Returns an Observable that applies a function of your choosing to the + * first item emitted by a + * source Observable, then feeds the result of that function along with the + * second item emitted + * by an Observable into the same function, and so on until all items have + * been emitted by the + * source Observable, emitting the result of each of these iterations as its + * own sequence. *

* - * + * * @param - * the type item emitted by the source Observable + * the type item emitted by the source Observable * @param sequence - * the source Observable + * the source Observable * @param accumulator - * an accumulator function to be invoked on each element from the sequence, whose - * result will be emitted and used in the next accumulator call (if applicable) - * @return an Observable that emits a sequence of items that are the result of accumulating the + * an accumulator function to be invoked on each element from the sequence, + * whose + * result will be emitted and used in the next accumulator call (if + * applicable) + * @return an Observable that emits a sequence of items that are the result + * of accumulating the * output from the sequence emitted by the source Observable - * @see MSDN: Observable.Scan + * @see + * MSDN: + * Observable.Scan */ public static Observable scan(final Observable sequence, final Object accumulator) { final FuncN _f = Functions.from(accumulator); @@ -1670,50 +1978,68 @@ public class Observable { } /** - * Returns an Observable that applies a function of your choosing to the first item emitted by a - * source Observable, then feeds the result of that function along with the second item emitted - * by an Observable into the same function, and so on until all items have been emitted by the - * source Observable, emitting the result of each of these iterations as its own sequence. + * Returns an Observable that applies a function of your choosing to the + * first item emitted by a + * source Observable, then feeds the result of that function along with the + * second item emitted + * by an Observable into the same function, and so on until all items have + * been emitted by the + * source Observable, emitting the result of each of these iterations as its + * own sequence. *

* - * + * * @param - * the type item emitted by the source Observable + * the type item emitted by the source Observable * @param sequence - * the source Observable + * the source Observable * @param initialValue - * the initial (seed) accumulator value + * the initial (seed) accumulator value * @param accumulator - * an accumulator function to be invoked on each element from the sequence, whose - * result will be emitted and used in the next accumulator call (if applicable) - * @return an Observable that emits a sequence of items that are the result of accumulating the + * an accumulator function to be invoked on each element from the sequence, + * whose + * result will be emitted and used in the next accumulator call (if + * applicable) + * @return an Observable that emits a sequence of items that are the result + * of accumulating the * output from the sequence emitted by the source Observable - * @see MSDN: Observable.Scan + * @see + * MSDN: + * Observable.Scan */ public static Observable scan(Observable sequence, T initialValue, Func2 accumulator) { return create(OperationScan.scan(sequence, initialValue, accumulator)); } /** - * Returns an Observable that applies a function of your choosing to the first item emitted by a - * source Observable, then feeds the result of that function along with the second item emitted - * by an Observable into the same function, and so on until all items have been emitted by the - * source Observable, emitting the result of each of these iterations as its own sequence. + * Returns an Observable that applies a function of your choosing to the + * first item emitted by a + * source Observable, then feeds the result of that function along with the + * second item emitted + * by an Observable into the same function, and so on until all items have + * been emitted by the + * source Observable, emitting the result of each of these iterations as its + * own sequence. *

* - * + * * @param - * the type item emitted by the source Observable + * the type item emitted by the source Observable * @param sequence - * the source Observable + * the source Observable * @param initialValue - * the initial (seed) accumulator value + * the initial (seed) accumulator value * @param accumulator - * an accumulator function to be invoked on each element from the sequence, whose - * result will be emitted and used in the next accumulator call (if applicable) - * @return an Observable that emits a sequence of items that are the result of accumulating the + * an accumulator function to be invoked on each element from the sequence, + * whose + * result will be emitted and used in the next accumulator call (if + * applicable) + * @return an Observable that emits a sequence of items that are the result + * of accumulating the * output from the sequence emitted by the source Observable - * @see MSDN: Observable.Scan + * @see + * MSDN: + * Observable.Scan */ public static Observable scan(final Observable sequence, final T initialValue, final Object accumulator) { final FuncN _f = Functions.from(accumulator); @@ -1721,30 +2047,34 @@ public class Observable { } /** - * Determines whether all elements of an observable sequence satisfies a condition. - * + * Determines whether all elements of an observable sequence satisfies a + * condition. + * * @param sequence - * an observable sequence whose elements to apply the predicate to. + * an observable sequence whose elements to apply the predicate to. * @param predicate - * a function to test each element for a condition. + * a function to test each element for a condition. * @param - * the type of observable. - * @return true if all elements of an observable sequence satisfies a condition; otherwise, false. + * the type of observable. + * @return true if all elements of an observable sequence satisfies a + * condition; otherwise, false. */ public static Observable all(final Observable sequence, final Func1 predicate) { return create(OperationAll.all(sequence, predicate)); } /** - * Determines whether all elements of an observable sequence satisfies a condition. - * + * Determines whether all elements of an observable sequence satisfies a + * condition. + * * @param sequence - * an observable sequence whose elements to apply the predicate to. + * an observable sequence whose elements to apply the predicate to. * @param predicate - * a function to test each element for a condition. + * a function to test each element for a condition. * @param - * the type of observable. - * @return true if all elements of an observable sequence satisfies a condition; otherwise, false. + * the type of observable. + * @return true if all elements of an observable sequence satisfies a + * condition; otherwise, false. */ public static Observable all(final Observable sequence, Object predicate) { final FuncN _f = Functions.from(predicate); @@ -1752,58 +2082,74 @@ public class Observable { } /** - * Returns an Observable that skips the first num items emitted by the source - * Observable. You can ignore the first num items emitted by an Observable and attend - * only to those items that come after, by modifying the Observable with the skip method. + * Returns an Observable that skips the first num items emitted + * by the source + * Observable. You can ignore the first num items emitted by an + * Observable and attend + * only to those items that come after, by modifying the Observable with the + * skip method. *

* - * + * * @param items - * the source Observable + * the source Observable * @param num - * the number of items to skip - * @return an Observable that emits the same sequence of items emitted by the source Observable, + * the number of items to skip + * @return an Observable that emits the same sequence of items emitted by + * the source Observable, * except for the first num items - * @see MSDN: Observable.Skip Method + * @see + * MSDN: + * Observable.Skip Method */ public static Observable skip(final Observable items, int num) { return create(OperationSkip.skip(items, num)); } /** - * Accepts an Observable and wraps it in another Observable that ensures that the resulting + * Accepts an Observable and wraps it in another Observable that ensures + * that the resulting * Observable is chronologically well-behaved. *

- * A well-behaved observable ensures onNext, onCompleted, or onError calls to its subscribers are not interleaved, onCompleted and + * A well-behaved observable ensures onNext, + * onCompleted, or onError calls to its + * subscribers are not interleaved, onCompleted and * onError are only called once respectively, and no - * onNext calls follow onCompleted and onError calls. - * + * onNext calls follow onCompleted and + * onError calls. + * * @param observable - * the source Observable + * the source Observable * @param - * the type of item emitted by the source Observable - * @return an Observable that is a chronologically well-behaved version of the source Observable + * the type of item emitted by the source Observable + * @return an Observable that is a chronologically well-behaved version of + * the source Observable */ public static Observable synchronize(Observable observable) { return create(OperationSynchronize.synchronize(observable)); } /** - * Returns an Observable that emits the first num items emitted by the source + * Returns an Observable that emits the first num items emitted + * by the source * Observable. *

- * You can choose to pay attention only to the first num values emitted by an Observable by calling its take method. This method returns an Observable that will call a + * You can choose to pay attention only to the first num values + * emitted by an Observable by calling its take method. This + * method returns an Observable that will call a * subscribing Observer's onNext function a - * maximum of num times before calling onCompleted. + * maximum of num times before calling + * onCompleted. *

* - * + * * @param items - * the source Observable + * the source Observable * @param num - * the number of items from the start of the sequence emitted by the source - * Observable to emit - * @return an Observable that only emits the first num items emitted by the source + * the number of items from the start of the sequence emitted by the source + * Observable to emit + * @return an Observable that only emits the first num items + * emitted by the source * Observable */ public static Observable take(final Observable items, final int num) { @@ -1811,15 +2157,17 @@ public class Observable { } /** - * Returns an Observable that emits the last count items emitted by the source + * Returns an Observable that emits the last count items + * emitted by the source * Observable. - * + * * @param items - * the source Observable + * the source Observable * @param count - * the number of items from the end of the sequence emitted by the source - * Observable to emit - * @return an Observable that only emits the last count items emitted by the source + * the number of items from the end of the sequence emitted by the source + * Observable to emit + * @return an Observable that only emits the last count items + * emitted by the source * Observable */ public static Observable takeLast(final Observable items, final int count) { @@ -1827,11 +2175,12 @@ public class Observable { } /** - * Returns a specified number of contiguous values from the start of an observable sequence. - * + * Returns a specified number of contiguous values from the start of an + * observable sequence. + * * @param items * @param predicate - * a function to test each source element for a condition + * a function to test each source element for a condition * @return */ public static Observable takeWhile(final Observable items, Func1 predicate) { @@ -1839,11 +2188,12 @@ public class Observable { } /** - * Returns a specified number of contiguous values from the start of an observable sequence. - * + * Returns a specified number of contiguous values from the start of an + * observable sequence. + * * @param items * @param predicate - * a function to test each source element for a condition + * a function to test each source element for a condition * @return */ public static Observable takeWhile(final Observable items, Object predicate) { @@ -1853,11 +2203,14 @@ public class Observable { } /** - * Returns values from an observable sequence as long as a specified condition is true, and then skips the remaining values. - * + * Returns values from an observable sequence as long as a specified + * condition is true, and then skips the remaining values. + * * @param items * @param predicate - * a function to test each element for a condition; the second parameter of the function represents the index of the source element; otherwise, false. + * a function to test each element for a condition; the second parameter of + * the function represents the index of the source element; + * otherwise, false. * @return */ public static Observable takeWhileWithIndex(final Observable items, Func2 predicate) { @@ -1871,22 +2224,28 @@ public class Observable { } /** - * Returns an Observable that emits a single item, a list composed of all the items emitted by + * Returns an Observable that emits a single item, a list composed of all + * the items emitted by * the source Observable. *

- * Normally, an Observable that returns multiple items will do so by calling its Observer's onNext function for each such item. You can change this behavior, instructing the + * Normally, an Observable that returns multiple items will do so by calling + * its Observer's onNext function for each such item. You can + * change this behavior, instructing the * Observable * to * compose a list of all of these multiple items and - * then to call the Observer's onNext function once, passing it the entire list, by calling the Observable object's toList method prior to calling its + * then to call the Observer's onNext function once, passing it + * the entire list, by calling the Observable object's toList + * method prior to calling its * subscribe * method. *

* - * + * * @param that - * the source Observable - * @return an Observable that emits a single item: a List containing all of the + * the source Observable + * @return an Observable that emits a single item: a List + * containing all of the * items emitted by the source Observable */ public static Observable> toList(final Observable that) { @@ -1895,9 +2254,9 @@ public class Observable { /** * Converts an observable sequence to an Iterable. - * + * * @param that - * the source Observable + * the source Observable * @return Observable converted to Iterable. */ public static Iterable toIterable(final Observable that) { @@ -1912,25 +2271,28 @@ public class Observable { /** * Returns an iterator that iterates all values of the observable. - * + * * @param that - * an observable sequence to get an iterator for. + * an observable sequence to get an iterator for. * @param - * the type of source. - * @return the iterator that could be used to iterate over the elements of the observable. + * the type of source. + * @return the iterator that could be used to iterate over the elements of + * the observable. */ public static Iterator getIterator(Observable that) { return OperatorToIterator.toIterator(that); } /** - * Samples the next value (blocking without buffering) from in an observable sequence. - * + * Samples the next value (blocking without buffering) from in an observable + * sequence. + * * @param items - * the source observable sequence. + * the source observable sequence. * @param - * the type of observable. - * @return iterable that blocks upon each iteration until the next element in the observable source sequence becomes available. + * the type of observable. + * @return iterable that blocks upon each iteration until the next element + * in the observable source sequence becomes available. */ public static Iterable next(Observable items) { return OperationNext.next(items); @@ -1938,57 +2300,66 @@ public class Observable { /** * Samples the most recent value in an observable sequence. - * + * * @param source - * the source observable sequence. + * the source observable sequence. * @param - * the type of observable. + * the type of observable. * @param initialValue - * the initial value that will be yielded by the enumerable sequence if no element has been sampled yet. - * @return the iterable that returns the last sampled element upon each iteration. + * the initial value that will be yielded by the enumerable sequence if no + * element has been sampled yet. + * @return the iterable that returns the last sampled element upon each + * iteration. */ public static Iterable mostRecent(Observable source, T initialValue) { return OperationMostRecent.mostRecent(source, initialValue); } /** - * Returns the only element of an observable sequence and throws an exception if there is not exactly one element in the observable sequence. - * + * Returns the only element of an observable sequence and throws an + * exception if there is not exactly one element in the observable sequence. + * * @param that - * the source Observable + * the source Observable * @return The single element in the observable sequence. * @throws IllegalStateException - * if there is not exactly one element in the observable sequence + * if there is not exactly one element in the observable sequence */ public static T single(Observable that) { return singleOrDefault(that, false, null); } /** - * Returns the only element of an observable sequence that matches the predicate and throws an exception if there is not exactly one element in the observable sequence. - * + * Returns the only element of an observable sequence that matches the + * predicate and throws an exception if there is not exactly one element in + * the observable sequence. + * * @param that - * the source Observable + * the source Observable * @param predicate - * A predicate function to evaluate for elements in the sequence. + * A predicate function to evaluate for elements in the sequence. * @return The single element in the observable sequence. * @throws IllegalStateException - * if there is not exactly one element in the observable sequence that matches the predicate + * if there is not exactly one element in the observable sequence that + * matches the predicate */ public static T single(Observable that, Func1 predicate) { return single(that.filter(predicate)); } /** - * Returns the only element of an observable sequence that matches the predicate and throws an exception if there is not exactly one element in the observable sequence. - * + * Returns the only element of an observable sequence that matches the + * predicate and throws an exception if there is not exactly one element in + * the observable sequence. + * * @param that - * the source Observable + * the source Observable * @param predicate - * A predicate function to evaluate for elements in the sequence. + * A predicate function to evaluate for elements in the sequence. * @return The single element in the observable sequence. * @throws IllegalStateException - * if there is not exactly one element in the observable sequence that matches the predicate + * if there is not exactly one element in the observable sequence that + * matches the predicate */ public static T single(Observable that, Object predicate) { final FuncN _f = Functions.from(predicate); @@ -1997,43 +2368,49 @@ public class Observable { } /** - * Returns the only element of an observable sequence, or a default value if the observable sequence is empty. - * + * Returns the only element of an observable sequence, or a default value if + * the observable sequence is empty. + * * @param that - * the source Observable + * the source Observable * @param defaultValue - * default value for a sequence. - * @return The single element in the observable sequence, or a default value if no value is found. + * default value for a sequence. + * @return The single element in the observable sequence, or a default value + * if no value is found. */ public static T singleOrDefault(Observable that, T defaultValue) { return singleOrDefault(that, true, defaultValue); } /** - * Returns the only element of an observable sequence that matches the predicate, or a default value if no value is found. - * + * Returns the only element of an observable sequence that matches the + * predicate, or a default value if no value is found. + * * @param that - * the source Observable + * the source Observable * @param defaultValue - * default value for a sequence. + * default value for a sequence. * @param predicate - * A predicate function to evaluate for elements in the sequence. - * @return The single element in the observable sequence, or a default value if no value is found. + * A predicate function to evaluate for elements in the sequence. + * @return The single element in the observable sequence, or a default value + * if no value is found. */ public static T singleOrDefault(Observable that, T defaultValue, Func1 predicate) { return singleOrDefault(that.filter(predicate), defaultValue); } /** - * Returns the only element of an observable sequence that matches the predicate, or a default value if no value is found. - * + * Returns the only element of an observable sequence that matches the + * predicate, or a default value if no value is found. + * * @param that - * the source Observable + * the source Observable * @param defaultValue - * default value for a sequence. + * default value for a sequence. * @param predicate - * A predicate function to evaluate for elements in the sequence. - * @return The single element in the observable sequence, or a default value if no value is found. + * A predicate function to evaluate for elements in the sequence. + * @return The single element in the observable sequence, or a default value + * if no value is found. */ public static T singleOrDefault(Observable that, T defaultValue, Object predicate) { final FuncN _f = Functions.from(predicate); @@ -2045,35 +2422,37 @@ public class Observable { Iterator it = that.toIterable().iterator(); if (!it.hasNext()) { - if (hasDefault) { + if (hasDefault) return defaultVal; - } throw new IllegalStateException("Expected single entry. Actually empty stream."); } T result = it.next(); - if (it.hasNext()) { + if (it.hasNext()) throw new IllegalStateException("Expected single entry. Actually more than one entry."); - } return result; } /** * Converts an Iterable sequence to an Observable sequence. - * - * Any object that supports the Iterable interface can be converted into an Observable that emits - * each iterable item in the object, by passing the object into the toObservable method. + *

+ * Any object that supports the Iterable interface can be converted into an + * Observable that emits + * each iterable item in the object, by passing the object into the + * toObservable method. *

* - * + * * @param iterable - * the source Iterable sequence + * the source Iterable sequence * @param - * the type of items in the iterable sequence and the type emitted by the resulting - * Observable - * @return an Observable that emits each item in the source Iterable sequence + * the type of items in the iterable sequence and the type emitted by the + * resulting + * Observable + * @return an Observable that emits each item in the source Iterable + * sequence */ public static Observable toObservable(Iterable iterable) { return create(OperationToObservableIterable.toObservableIterable(iterable)); @@ -2081,17 +2460,21 @@ public class Observable { /** * Converts an Future to an Observable sequence. - * - * Any object that supports the {@link Future} interface can be converted into an Observable that emits - * the return value of the get() method in the object, by passing the object into the toObservable method. *

- * This is blocking so the Subscription returned when calling {@link #subscribe(Observer)} does nothing. - * + * Any object that supports the {@link Future} interface can be converted + * into an Observable that emits + * the return value of the get() method in the object, by passing the object + * into the toObservable method. + *

+ * This is blocking so the Subscription returned when calling + * {@link #subscribe(Observer)} does nothing. + * * @param future - * the source {@link Future} + * the source {@link Future} * @param - * the type of of object that the future's returns and the type emitted by the resulting - * Observable + * the type of of object that the future's returns and the type emitted by + * the resulting + * Observable * @return an Observable that emits the item from the source Future */ public static Observable toObservable(Future future) { @@ -2100,22 +2483,27 @@ public class Observable { /** * Converts an Future to an Observable sequence. - * - * Any object that supports the {@link Future} interface can be converted into an Observable that emits - * the return value of the get() method in the object, by passing the object into the toObservable method. - * The subscribe method on this synchronously so the Subscription returned doesn't nothing. *

- * This is blocking so the Subscription returned when calling {@link #subscribe(Observer)} does nothing. - * + * Any object that supports the {@link Future} interface can be converted + * into an Observable that emits + * the return value of the get() method in the object, by passing the object + * into the toObservable method. + * The subscribe method on this synchronously so the Subscription returned + * doesn't nothing. + *

+ * This is blocking so the Subscription returned when calling + * {@link #subscribe(Observer)} does nothing. + * * @param future - * the source {@link Future} + * the source {@link Future} * @param timeout - * the maximum time to wait + * the maximum time to wait * @param unit - * the time unit of the time argument + * the time unit of the time argument * @param - * the type of of object that the future's returns and the type emitted by the resulting - * Observable + * the type of of object that the future's returns and the type emitted by + * the resulting + * Observable * @return an Observable that emits the item from the source Future */ public static Observable toObservable(Future future, long timeout, TimeUnit unit) { @@ -2124,17 +2512,19 @@ public class Observable { /** * Converts an Array sequence to an Observable sequence. - * - * An Array can be converted into an Observable that emits each item in the Array, by passing the + *

+ * An Array can be converted into an Observable that emits each item in the + * Array, by passing the * Array into the toObservable method. *

* - * + * * @param items - * the source Array + * the source Array * @param - * the type of items in the Array, and the type of items emitted by the resulting - * Observable + * the type of items in the Array, and the type of items emitted by the + * resulting + * Observable * @return an Observable that emits each item in the source Array */ public static Observable toObservable(T... items) { @@ -2145,10 +2535,10 @@ public class Observable { * Sort T objects by their natural order (object must implement Comparable). *

* - * + * * @param sequence * @throws ClassCastException - * if T objects do not implement Comparable + * if T objects do not implement Comparable * @return */ public static Observable> toSortedList(Observable sequence) { @@ -2159,7 +2549,7 @@ public class Observable { * Sort T objects using the defined sort function. *

* - * + * * @param sequence * @param sortFunction * @return @@ -2172,7 +2562,7 @@ public class Observable { * Sort T objects using the defined sort function. *

* - * + * * @param sequence * @param sortFunction * @return @@ -2183,27 +2573,36 @@ public class Observable { } /** - * Returns an Observable that applies a function of your choosing to the combination of items - * emitted, in sequence, by two other Observables, with the results of this function becoming the + * Returns an Observable that applies a function of your choosing to the + * combination of items + * emitted, in sequence, by two other Observables, with the results of this + * function becoming the * sequence emitted by the returned Observable. *

- * zip applies this function in strict sequence, so the first item emitted by the new Observable will be the result of the function applied to the first item emitted by + * zip applies this function in strict sequence, so the first + * item emitted by the new Observable will be the result of the function + * applied to the first item emitted by * w0 * and the first item emitted by w1; the - * second item emitted by the new Observable will be the result of the function applied to the second item emitted by w0 and the second item emitted by w1; and so forth. + * second item emitted by the new Observable will be the result of the + * function applied to the second item emitted by w0 and the + * second item emitted by w1; and so forth. *

- * The resulting Observable returned from zip will call onNext as many times as the number onNext calls of the source Observable with the + * The resulting Observable returned from zip + * will call onNext as many times as the number + * onNext calls of the source Observable with the * shortest sequence. *

* - * + * * @param w0 - * one source Observable + * one source Observable * @param w1 - * another source Observable + * another source Observable * @param reduceFunction - * a function that, when applied to an item emitted by each of the source Observables, - * results in a value that will be emitted by the resulting Observable + * a function that, when applied to an item emitted by each of the source + * Observables, + * results in a value that will be emitted by the resulting Observable * @return an Observable that emits the zipped results */ public static Observable zip(Observable w0, Observable w1, Func2 reduceFunction) { @@ -2211,76 +2610,91 @@ public class Observable { } /** - * Determines whether two sequences are equal by comparing the elements pairwise. - * + * Determines whether two sequences are equal by comparing the elements + * pairwise. + * * @param first - * observable to compare + * observable to compare * @param second - * observable to compare + * observable to compare * @param - * type of sequence - * @return sequence of booleans, true if two sequences are equal by comparing the elements pairwise; otherwise, false. + * type of sequence + * @return sequence of booleans, true if two sequences are equal by + * comparing the elements pairwise; otherwise, false. */ public static Observable sequenceEqual(Observable first, Observable second) { return sequenceEqual(first, second, Object::equals); } /** - * Determines whether two sequences are equal by comparing the elements pairwise using a specified equality function. - * + * Determines whether two sequences are equal by comparing the elements + * pairwise using a specified equality function. + * * @param first - * observable sequence to compare + * observable sequence to compare * @param second - * observable sequence to compare + * observable sequence to compare * @param equality - * a function used to compare elements of both sequences + * a function used to compare elements of both sequences * @param - * type of sequence - * @return sequence of booleans, true if two sequences are equal by comparing the elements pairwise; otherwise, false. + * type of sequence + * @return sequence of booleans, true if two sequences are equal by + * comparing the elements pairwise; otherwise, false. */ public static Observable sequenceEqual(Observable first, Observable second, Func2 equality) { return zip(first, second, equality); } /** - * Determines whether two sequences are equal by comparing the elements pairwise using a specified equality function. - * + * Determines whether two sequences are equal by comparing the elements + * pairwise using a specified equality function. + * * @param first - * observable sequence to compare + * observable sequence to compare * @param second - * observable sequence to compare + * observable sequence to compare * @param equality - * a function used to compare elements of both sequences + * a function used to compare elements of both sequences * @param - * type of sequence - * @return sequence of booleans, true if two sequences are equal by comparing the elements pairwise; otherwise, false. + * type of sequence + * @return sequence of booleans, true if two sequences are equal by + * comparing the elements pairwise; otherwise, false. */ public static Observable sequenceEqual(Observable first, Observable second, Object equality) { return zip(first, second, equality); } /** - * Returns an Observable that applies a function of your choosing to the combination of items - * emitted, in sequence, by two other Observables, with the results of this function becoming the + * Returns an Observable that applies a function of your choosing to the + * combination of items + * emitted, in sequence, by two other Observables, with the results of this + * function becoming the * sequence emitted by the returned Observable. *

- * zip applies this function in strict sequence, so the first item emitted by the new Observable will be the result of the function applied to the first item emitted by + * zip applies this function in strict sequence, so the first + * item emitted by the new Observable will be the result of the function + * applied to the first item emitted by * w0 * and the first item emitted by w1; the - * second item emitted by the new Observable will be the result of the function applied to the second item emitted by w0 and the second item emitted by w1; and so forth. + * second item emitted by the new Observable will be the result of the + * function applied to the second item emitted by w0 and the + * second item emitted by w1; and so forth. *

- * The resulting Observable returned from zip will call onNext as many times as the number onNext calls of the source Observable with the + * The resulting Observable returned from zip + * will call onNext as many times as the number + * onNext calls of the source Observable with the * shortest sequence. *

* - * + * * @param w0 - * one source Observable + * one source Observable * @param w1 - * another source Observable + * another source Observable * @param function - * a function that, when applied to an item emitted by each of the source Observables, - * results in a value that will be emitted by the resulting Observable + * a function that, when applied to an item emitted by each of the source + * Observables, + * results in a value that will be emitted by the resulting Observable * @return an Observable that emits the zipped results */ public static Observable zip(Observable w0, Observable w1, final Object function) { @@ -2289,31 +2703,40 @@ public class Observable { } /** - * Returns an Observable that applies a function of your choosing to the combination of items - * emitted, in sequence, by three other Observables, with the results of this function becoming + * Returns an Observable that applies a function of your choosing to the + * combination of items + * emitted, in sequence, by three other Observables, with the results of + * this function becoming * the sequence emitted by the returned Observable. *

- * zip applies this function in strict sequence, so the first item emitted by the new Observable will be the result of the function applied to the first item emitted by + * zip applies this function in strict sequence, so the first + * item emitted by the new Observable will be the result of the function + * applied to the first item emitted by * w0, * the first item emitted by w1, and the - * first item emitted by w2; the second item emitted by the new Observable will be the result of the function applied to the second item emitted by w0, the second item + * first item emitted by w2; the second item emitted by the new + * Observable will be the result of the function applied to the second item + * emitted by w0, the second item * emitted by w1, and the second item * emitted by w2; and so forth. *

- * The resulting Observable returned from zip will call onNext as many times as the number onNext calls of the source Observable with the + * The resulting Observable returned from zip + * will call onNext as many times as the number + * onNext calls of the source Observable with the * shortest sequence. *

* - * + * * @param w0 - * one source Observable + * one source Observable * @param w1 - * another source Observable + * another source Observable * @param w2 - * a third source Observable + * a third source Observable * @param function - * a function that, when applied to an item emitted by each of the source Observables, - * results in a value that will be emitted by the resulting Observable + * a function that, when applied to an item emitted by each of the source + * Observables, + * results in a value that will be emitted by the resulting Observable * @return an Observable that emits the zipped results */ public static Observable zip(Observable w0, Observable w1, Observable w2, Func3 function) { @@ -2321,31 +2744,40 @@ public class Observable { } /** - * Returns an Observable that applies a function of your choosing to the combination of items - * emitted, in sequence, by three other Observables, with the results of this function becoming + * Returns an Observable that applies a function of your choosing to the + * combination of items + * emitted, in sequence, by three other Observables, with the results of + * this function becoming * the sequence emitted by the returned Observable. *

- * zip applies this function in strict sequence, so the first item emitted by the new Observable will be the result of the function applied to the first item emitted by + * zip applies this function in strict sequence, so the first + * item emitted by the new Observable will be the result of the function + * applied to the first item emitted by * w0, * the first item emitted by w1, and the - * first item emitted by w2; the second item emitted by the new Observable will be the result of the function applied to the second item emitted by w0, the second item + * first item emitted by w2; the second item emitted by the new + * Observable will be the result of the function applied to the second item + * emitted by w0, the second item * emitted by w1, and the second item * emitted by w2; and so forth. *

- * The resulting Observable returned from zip will call onNext as many times as the number onNext calls of the source Observable with the + * The resulting Observable returned from zip + * will call onNext as many times as the number + * onNext calls of the source Observable with the * shortest sequence. *

* - * + * * @param w0 - * one source Observable + * one source Observable * @param w1 - * another source Observable + * another source Observable * @param w2 - * a third source Observable + * a third source Observable * @param function - * a function that, when applied to an item emitted by each of the source Observables, - * results in a value that will be emitted by the resulting Observable + * a function that, when applied to an item emitted by each of the source + * Observables, + * results in a value that will be emitted by the resulting Observable * @return an Observable that emits the zipped results */ public static Observable zip(Observable w0, Observable w1, Observable w2, final Object function) { @@ -2354,32 +2786,41 @@ public class Observable { } /** - * Returns an Observable that applies a function of your choosing to the combination of items - * emitted, in sequence, by four other Observables, with the results of this function becoming + * Returns an Observable that applies a function of your choosing to the + * combination of items + * emitted, in sequence, by four other Observables, with the results of this + * function becoming * the sequence emitted by the returned Observable. *

- * zip applies this function in strict sequence, so the first item emitted by the new Observable will be the result of the function applied to the first item emitted by + * zip applies this function in strict sequence, so the first + * item emitted by the new Observable will be the result of the function + * applied to the first item emitted by * w0, * the first item emitted by w1, the - * first item emitted by w2, and the first item emitted by w3; the second item emitted by the new Observable will be the result of the function applied to the second item + * first item emitted by w2, and the first item emitted by + * w3; the second item emitted by the new Observable will be + * the result of the function applied to the second item * emitted by each of those Observables; and so forth. *

- * The resulting Observable returned from zip will call onNext as many times as the number onNext calls of the source Observable with the + * The resulting Observable returned from zip + * will call onNext as many times as the number + * onNext calls of the source Observable with the * shortest sequence. *

* - * + * * @param w0 - * one source Observable + * one source Observable * @param w1 - * another source Observable + * another source Observable * @param w2 - * a third source Observable + * a third source Observable * @param w3 - * a fourth source Observable + * a fourth source Observable * @param reduceFunction - * a function that, when applied to an item emitted by each of the source Observables, - * results in a value that will be emitted by the resulting Observable + * a function that, when applied to an item emitted by each of the source + * Observables, + * results in a value that will be emitted by the resulting Observable * @return an Observable that emits the zipped results */ public static Observable zip(Observable w0, Observable w1, Observable w2, Observable w3, Func4 reduceFunction) { @@ -2387,32 +2828,41 @@ public class Observable { } /** - * Returns an Observable that applies a function of your choosing to the combination of items - * emitted, in sequence, by four other Observables, with the results of this function becoming + * Returns an Observable that applies a function of your choosing to the + * combination of items + * emitted, in sequence, by four other Observables, with the results of this + * function becoming * the sequence emitted by the returned Observable. *

- * zip applies this function in strict sequence, so the first item emitted by the new Observable will be the result of the function applied to the first item emitted by + * zip applies this function in strict sequence, so the first + * item emitted by the new Observable will be the result of the function + * applied to the first item emitted by * w0, * the first item emitted by w1, the - * first item emitted by w2, and the first item emitted by w3; the second item emitted by the new Observable will be the result of the function applied to the second item + * first item emitted by w2, and the first item emitted by + * w3; the second item emitted by the new Observable will be + * the result of the function applied to the second item * emitted by each of those Observables; and so forth. *

- * The resulting Observable returned from zip will call onNext as many times as the number onNext calls of the source Observable with the + * The resulting Observable returned from zip + * will call onNext as many times as the number + * onNext calls of the source Observable with the * shortest sequence. *

* - * + * * @param w0 - * one source Observable + * one source Observable * @param w1 - * another source Observable + * another source Observable * @param w2 - * a third source Observable + * a third source Observable * @param w3 - * a fourth source Observable + * a fourth source Observable * @param function - * a function that, when applied to an item emitted by each of the source Observables, - * results in a value that will be emitted by the resulting Observable + * a function that, when applied to an item emitted by each of the source + * Observables, + * results in a value that will be emitted by the resulting Observable * @return an Observable that emits the zipped results */ public static Observable zip(Observable w0, Observable w1, Observable w2, Observable w3, final Object function) { @@ -2421,14 +2871,17 @@ public class Observable { } /** - * Filters an Observable by discarding any of its emissions that do not meet some test. + * Filters an Observable by discarding any of its emissions that do not meet + * some test. *

* - * + * * @param predicate - * a function that evaluates the items emitted by the source Observable, returning - * true if they pass the filter - * @return an Observable that emits only those items in the original Observable that the filter + * a function that evaluates the items emitted by the source Observable, + * returning + * true if they pass the filter + * @return an Observable that emits only those items in the original + * Observable that the filter * evaluates as true */ public Observable filter(Func1 predicate) { @@ -2438,25 +2891,31 @@ public class Observable { /** * Registers an action to be called when this observable calls * onComplete or onError. - * + * * @param action - * an action to be called when this observable completes or errors. - * @return an Observable that emits the same objects as this observable, then calls the action. - * @see MSDN: Observable.Finally Method + * an action to be called when this observable completes or errors. + * @return an Observable that emits the same objects as this observable, + * then calls the action. + * @see + * MSDN: + * Observable.Finally Method */ public Observable finallyDo(Action0 action) { return create(OperationFinally.finallyDo(this, action)); } /** - * Filters an Observable by discarding any of its emissions that do not meet some test. + * Filters an Observable by discarding any of its emissions that do not meet + * some test. *

* - * + * * @param callback - * a function that evaluates the items emitted by the source Observable, returning - * true if they pass the filter - * @return an Observable that emits only those items in the original Observable that the filter + * a function that evaluates the items emitted by the source Observable, + * returning + * true if they pass the filter + * @return an Observable that emits only those items in the original + * Observable that the filter * evaluates as "true" */ public Observable filter(final Object callback) { @@ -2465,27 +2924,31 @@ public class Observable { } /** - * Filters an Observable by discarding any of its emissions that do not meet some test. + * Filters an Observable by discarding any of its emissions that do not meet + * some test. *

* - * + * * @param predicate - * a function that evaluates the items emitted by the source Observable, returning - * true if they pass the filter - * @return an Observable that emits only those items in the original Observable that the filter + * a function that evaluates the items emitted by the source Observable, + * returning + * true if they pass the filter + * @return an Observable that emits only those items in the original + * Observable that the filter * evaluates as true */ public Observable where(Func1 predicate) { return where(this, predicate); } - + public final Observable flatMap(Func1> func) { return merge(map(func)); } /** - * Returns the last element of an observable sequence with a specified source. - * + * Returns the last element of an observable sequence with a specified + * source. + * * @return the last element in the observable sequence. */ public T last() { @@ -2493,10 +2956,11 @@ public class Observable { } /** - * Returns the last element of an observable sequence that matches the predicate. - * + * Returns the last element of an observable sequence that matches the + * predicate. + * * @param predicate - * a predicate function to evaluate for elements in the sequence. + * a predicate function to evaluate for elements in the sequence. * @return the last element in the observable sequence. */ public T last(final Func1 predicate) { @@ -2504,10 +2968,11 @@ public class Observable { } /** - * Returns the last element of an observable sequence that matches the predicate. - * + * Returns the last element of an observable sequence that matches the + * predicate. + * * @param predicate - * a predicate function to evaluate for elements in the sequence. + * a predicate function to evaluate for elements in the sequence. * @return the last element in the observable sequence. */ public T last(final Object predicate) { @@ -2518,50 +2983,57 @@ public class Observable { /** * Returns the last element, or a default value if no value is found. - * + * * @param defaultValue - * a default value that would be returned if observable is empty. - * @return the last element of an observable sequence that matches the predicate, or a default value if no value is found. + * a default value that would be returned if observable is empty. + * @return the last element of an observable sequence that matches the + * predicate, or a default value if no value is found. */ public T lastOrDefault(T defaultValue) { return lastOrDefault(this, defaultValue); } /** - * Returns the last element that matches the predicate, or a default value if no value is found. - * + * Returns the last element that matches the predicate, or a default value + * if no value is found. + * * @param defaultValue - * a default value that would be returned if observable is empty. + * a default value that would be returned if observable is empty. * @param predicate - * a predicate function to evaluate for elements in the sequence. - * @return the last element of an observable sequence that matches the predicate, or a default value if no value is found. + * a predicate function to evaluate for elements in the sequence. + * @return the last element of an observable sequence that matches the + * predicate, or a default value if no value is found. */ public T lastOrDefault(T defaultValue, Func1 predicate) { return lastOrDefault(this, defaultValue, predicate); } /** - * Returns the last element that matches the predicate, or a default value if no value is found. - * + * Returns the last element that matches the predicate, or a default value + * if no value is found. + * * @param defaultValue - * a default value that would be returned if observable is empty. + * a default value that would be returned if observable is empty. * @param predicate - * a predicate function to evaluate for elements in the sequence. - * @return the last element of an observable sequence that matches the predicate, or a default value if no value is found. + * a predicate function to evaluate for elements in the sequence. + * @return the last element of an observable sequence that matches the + * predicate, or a default value if no value is found. */ public T lastOrDefault(T defaultValue, Object predicate) { return lastOrDefault(this, defaultValue, predicate); } /** - * Applies a function of your choosing to every item emitted by an Observable, and returns this + * Applies a function of your choosing to every item emitted by an + * Observable, and returns this * transformation as a new Observable sequence. *

* - * + * * @param func - * a function to apply to each item in the sequence. - * @return an Observable that emits a sequence that is the result of applying the transformation + * a function to apply to each item in the sequence. + * @return an Observable that emits a sequence that is the result of + * applying the transformation * function to each item in the sequence emitted by the input Observable. */ public Observable map(Func1 func) { @@ -2569,14 +3041,16 @@ public class Observable { } /** - * Applies a function of your choosing to every item emitted by an Observable, and returns this + * Applies a function of your choosing to every item emitted by an + * Observable, and returns this * transformation as a new Observable sequence. *

* - * + * * @param callback - * a function to apply to each item in the sequence. - * @return an Observable that emits a sequence that is the result of applying the transformation + * a function to apply to each item in the sequence. + * @return an Observable that emits a sequence that is the result of + * applying the transformation * function to each item in the sequence emitted by the input Observable. */ public Observable map(final Object callback) { @@ -2585,17 +3059,23 @@ public class Observable { } /** - * Creates a new Observable sequence by applying a function that you supply to each item in the - * original Observable sequence, where that function is itself an Observable that emits items, and - * then merges the results of that function applied to every item emitted by the original + * Creates a new Observable sequence by applying a function that you supply + * to each item in the + * original Observable sequence, where that function is itself an Observable + * that emits items, and + * then merges the results of that function applied to every item emitted by + * the original * Observable, emitting these merged results as its own sequence. *

* - * + * * @param func - * a function to apply to each item in the sequence, that returns an Observable. - * @return an Observable that emits a sequence that is the result of applying the transformation - * function to each item in the input sequence and merging the results of the + * a function to apply to each item in the sequence, that returns an + * Observable. + * @return an Observable that emits a sequence that is the result of + * applying the transformation + * function to each item in the input sequence and merging the results of + * the * Observables obtained from this transformation. */ public Observable mapMany(Func1> func) { @@ -2603,17 +3083,23 @@ public class Observable { } /** - * Creates a new Observable sequence by applying a function that you supply to each item in the - * original Observable sequence, where that function is itself an Observable that emits items, and - * then merges the results of that function applied to every item emitted by the original + * Creates a new Observable sequence by applying a function that you supply + * to each item in the + * original Observable sequence, where that function is itself an Observable + * that emits items, and + * then merges the results of that function applied to every item emitted by + * the original * Observable, emitting these merged results as its own sequence. *

* - * + * * @param callback - * a function to apply to each item in the sequence that returns an Observable. - * @return an Observable that emits a sequence that is the result of applying the transformation' - * function to each item in the input sequence and merging the results of the + * a function to apply to each item in the sequence that returns an + * Observable. + * @return an Observable that emits a sequence that is the result of + * applying the transformation' + * function to each item in the input sequence and merging the results of + * the * Observables obtained from this transformation. */ public Observable mapMany(final Object callback) { @@ -2622,23 +3108,29 @@ public class Observable { } /** - * Materializes the implicit notifications of this observable sequence as explicit notification values. + * Materializes the implicit notifications of this observable sequence as + * explicit notification values. *

* - * - * @return An observable sequence whose elements are the result of materializing the notifications of the given sequence. - * @see MSDN: Observable.materialize + * + * @return An observable sequence whose elements are the result of + * materializing the notifications of the given sequence. + * @see + * MSDN: + * Observable.materialize */ public Observable> materialize() { return materialize(this); } /** - * Asynchronously subscribes and unsubscribes observers on the specified scheduler. - * + * Asynchronously subscribes and unsubscribes observers on the specified + * scheduler. + * * @param scheduler - * the scheduler to perform subscription and unsubscription actions on. - * @return the source sequence whose subscriptions and unsubscriptions happen on the specified scheduler. + * the scheduler to perform subscription and unsubscription actions on. + * @return the source sequence whose subscriptions and unsubscriptions + * happen on the specified scheduler. */ public Observable subscribeOn(Scheduler scheduler) { return subscribeOn(this, scheduler); @@ -2646,46 +3138,61 @@ public class Observable { /** * Asynchronously notify observers on the specified scheduler. - * + * * @param scheduler - * the scheduler to notify observers on. - * @return the source sequence whose observations happen on the specified scheduler. + * the scheduler to notify observers on. + * @return the source sequence whose observations happen on the specified + * scheduler. */ public Observable observeOn(Scheduler scheduler) { return observeOn(this, scheduler); } /** - * Dematerializes the explicit notification values of an observable sequence as implicit notifications. - * - * @return An observable sequence exhibiting the behavior corresponding to the source sequence's notification values. - * @see MSDN: Observable.dematerialize + * Dematerializes the explicit notification values of an observable sequence + * as implicit notifications. + * + * @return An observable sequence exhibiting the behavior corresponding to + * the source sequence's notification values. + * @see + * MSDN: + * Observable.dematerialize * @throws Exception - * if attempted on Observable not of type {@code Observable>}. + * if attempted on Observable not of type + * {@code Observable>}. */ public Observable dematerialize() { return dematerialize((Observable>) this); } /** - * Instruct an Observable to pass control to another Observable rather than calling onError if it encounters an error. + * Instruct an Observable to pass control to another Observable rather than + * calling onError if it encounters an error. *

- * By default, when an Observable encounters an error that prevents it from emitting the expected - * item to its Observer, the Observable calls its Observer's onError function, and + * By default, when an Observable encounters an error that prevents it from + * emitting the expected + * item to its Observer, the Observable calls its Observer's + * onError function, and * then quits without calling any more of its Observer's closures. The - * onErrorResumeNext method changes this behavior. If you pass another Observable - * (resumeFunction) to an Observable's onErrorResumeNext method, if the - * original Observable encounters an error, instead of calling its Observer's + * onErrorResumeNext method changes this behavior. If you pass + * another Observable + * (resumeFunction) to an Observable's + * onErrorResumeNext method, if the + * original Observable encounters an error, instead of calling its + * Observer's * onErrort function, it will instead relinquish control to - * resumeFunction which will call the Observer's onNext method if it - * is able to do so. In such a case, because no Observable necessarily invokes + * resumeFunction which will call the Observer's + * onNext method if it + * is able to do so. In such a case, because no Observable necessarily + * invokes * onError, the Observer may never know that an error happened. *

- * You can use this to prevent errors from propagating or to supply fallback data should errors + * You can use this to prevent errors from propagating or to supply fallback + * data should errors * be encountered. *

* - * + * * @param resumeFunction * @return the original Observable, with appropriately modified behavior */ @@ -2694,25 +3201,34 @@ public class Observable { } /** - * Instruct an Observable to emit a particular item rather than calling onError if + * Instruct an Observable to emit a particular item rather than calling + * onError if * it encounters an error. *

- * By default, when an Observable encounters an error that prevents it from emitting the expected - * item to its Observer, the Observable calls its Observer's onError function, and + * By default, when an Observable encounters an error that prevents it from + * emitting the expected + * item to its Observer, the Observable calls its Observer's + * onError function, and * then quits without calling any more of its Observer's closures. The - * onErrorResumeNext method changes this behavior. If you pass another Observable - * (resumeFunction) to an Observable's onErrorResumeNext method, if the - * original Observable encounters an error, instead of calling its Observer's + * onErrorResumeNext method changes this behavior. If you pass + * another Observable + * (resumeFunction) to an Observable's + * onErrorResumeNext method, if the + * original Observable encounters an error, instead of calling its + * Observer's * onError function, it will instead relinquish control to - * resumeFunction which will call the Observer's onNext method if it - * is able to do so. In such a case, because no Observable necessarily invokes + * resumeFunction which will call the Observer's + * onNext method if it + * is able to do so. In such a case, because no Observable necessarily + * invokes * onError, the Observer may never know that an error happened. *

- * You can use this to prevent errors from propagating or to supply fallback data should errors + * You can use this to prevent errors from propagating or to supply fallback + * data should errors * be encountered. *

* - * + * * @param resumeFunction * @return the original Observable with appropriately modified behavior */ @@ -2722,25 +3238,34 @@ public class Observable { } /** - * Instruct an Observable to pass control to another Observable rather than calling + * Instruct an Observable to pass control to another Observable rather than + * calling * onError if it encounters an error. *

- * By default, when an Observable encounters an error that prevents it from emitting the expected - * item to its Observer, the Observable calls its Observer's onError function, and + * By default, when an Observable encounters an error that prevents it from + * emitting the expected + * item to its Observer, the Observable calls its Observer's + * onError function, and * then quits without calling any more of its Observer's closures. The - * onErrorResumeNext method changes this behavior. If you pass another Observable - * (resumeSequence) to an Observable's onErrorResumeNext method, if the - * original Observable encounters an error, instead of calling its Observer's + * onErrorResumeNext method changes this behavior. If you pass + * another Observable + * (resumeSequence) to an Observable's + * onErrorResumeNext method, if the + * original Observable encounters an error, instead of calling its + * Observer's * onError function, it will instead relinquish control to - * resumeSequence which will call the Observer's onNext method if it - * is able to do so. In such a case, because no Observable necessarily invokes + * resumeSequence which will call the Observer's + * onNext method if it + * is able to do so. In such a case, because no Observable necessarily + * invokes * onError, the Observer may never know that an error happened. *

- * You can use this to prevent errors from propagating or to supply fallback data should errors + * You can use this to prevent errors from propagating or to supply fallback + * data should errors * be encountered. *

* - * + * * @param resumeSequence * @return the original Observable, with appropriately modified behavior */ @@ -2749,21 +3274,29 @@ public class Observable { } /** - * Instruct an Observable to emit a particular item rather than calling onError if + * Instruct an Observable to emit a particular item rather than calling + * onError if * it encounters an error. *

- * By default, when an Observable encounters an error that prevents it from emitting the expected - * object to its Observer, the Observable calls its Observer's onError function, and + * By default, when an Observable encounters an error that prevents it from + * emitting the expected + * object to its Observer, the Observable calls its Observer's + * onError function, and * then quits without calling any more of its Observer's closures. The - * onErrorReturn method changes this behavior. If you pass a function - * (resumeFunction) to an Observable's onErrorReturn method, if the - * original Observable encounters an error, instead of calling its Observer's - * onError function, it will instead call pass the return value of + * onErrorReturn method changes this behavior. If you pass a + * function + * (resumeFunction) to an Observable's + * onErrorReturn method, if the + * original Observable encounters an error, instead of calling its + * Observer's + * onError function, it will instead call pass the return value + * of * resumeFunction to the Observer's onNext method. *

- * You can use this to prevent errors from propagating or to supply fallback data should errors + * You can use this to prevent errors from propagating or to supply fallback + * data should errors * be encountered. - * + * * @param resumeFunction * @return the original Observable with appropriately modified behavior */ @@ -2772,21 +3305,29 @@ public class Observable { } /** - * Instruct an Observable to emit a particular item rather than calling onError if + * Instruct an Observable to emit a particular item rather than calling + * onError if * it encounters an error. *

- * By default, when an Observable encounters an error that prevents it from emitting the expected - * object to its Observer, the Observable calls its Observer's onError function, and + * By default, when an Observable encounters an error that prevents it from + * emitting the expected + * object to its Observer, the Observable calls its Observer's + * onError function, and * then quits without calling any more of its Observer's closures. The - * onErrorReturn method changes this behavior. If you pass a function - * (resumeFunction) to an Observable's onErrorReturn method, if the - * original Observable encounters an error, instead of calling its Observer's - * onError function, it will instead call pass the return value of + * onErrorReturn method changes this behavior. If you pass a + * function + * (resumeFunction) to an Observable's + * onErrorReturn method, if the + * original Observable encounters an error, instead of calling its + * Observer's + * onError function, it will instead call pass the return value + * of * resumeFunction to the Observer's onNext method. *

- * You can use this to prevent errors from propagating or to supply fallback data should errors + * You can use this to prevent errors from propagating or to supply fallback + * data should errors * be encountered. - * + * * @param resumeFunction * @return the original Observable with appropriately modified behavior */ @@ -2796,236 +3337,330 @@ public class Observable { } /** - * Returns an Observable that applies a function of your choosing to the first item emitted by a - * source Observable, then feeds the result of that function along with the second item emitted - * by an Observable into the same function, and so on until all items have been emitted by the - * source Observable, emitting the final result from the final call to your function as its sole + * Returns an Observable that applies a function of your choosing to the + * first item emitted by a + * source Observable, then feeds the result of that function along with the + * second item emitted + * by an Observable into the same function, and so on until all items have + * been emitted by the + * source Observable, emitting the final result from the final call to your + * function as its sole * output. *

- * This technique, which is called "reduce" here, is sometimes called "fold," "accumulate," - * "compress," or "inject" in other programming contexts. Groovy, for instance, has an + * This technique, which is called "reduce" here, is sometimes called + * "fold," "accumulate," + * "compress," or "inject" in other programming contexts. Groovy, for + * instance, has an * inject method that does a similar operation on lists. *

* - * + * * @param accumulator - * An accumulator function to be invoked on each element from the sequence, whose result - * will be used in the next accumulator call (if applicable). - * - * @return An observable sequence with a single element from the result of accumulating the + * An accumulator function to be invoked on each element from the sequence, + * whose result + * will be used in the next accumulator call (if applicable). + * + * @return An observable sequence with a single element from the result of + * accumulating the * output from the list of Observables. - * @see MSDN: Observable.Aggregate - * @see Wikipedia: Fold (higher-order function) + * @see + * MSDN: + * Observable.Aggregate + * @see + * Wikipedia: + * Fold (higher-order function) */ public Observable reduce(Func2 accumulator) { return reduce(this, accumulator); } /** - * Returns an Observable that applies a function of your choosing to the first item emitted by a - * source Observable, then feeds the result of that function along with the second item emitted - * by an Observable into the same function, and so on until all items have been emitted by the - * source Observable, emitting the final result from the final call to your function as its sole + * Returns an Observable that applies a function of your choosing to the + * first item emitted by a + * source Observable, then feeds the result of that function along with the + * second item emitted + * by an Observable into the same function, and so on until all items have + * been emitted by the + * source Observable, emitting the final result from the final call to your + * function as its sole * output. *

- * This technique, which is called "reduce" here, is sometimes called "fold," "accumulate," - * "compress," or "inject" in other programming contexts. Groovy, for instance, has an + * This technique, which is called "reduce" here, is sometimes called + * "fold," "accumulate," + * "compress," or "inject" in other programming contexts. Groovy, for + * instance, has an * inject method that does a similar operation on lists. *

* - * + * * @param accumulator - * An accumulator function to be invoked on each element from the sequence, whose result - * will be used in the next accumulator call (if applicable). - * - * @return an Observable that emits a single element from the result of accumulating the output + * An accumulator function to be invoked on each element from the sequence, + * whose result + * will be used in the next accumulator call (if applicable). + * + * @return an Observable that emits a single element from the result of + * accumulating the output * from the list of Observables. - * @see MSDN: Observable.Aggregate - * @see Wikipedia: Fold (higher-order function) + * @see + * MSDN: + * Observable.Aggregate + * @see + * Wikipedia: + * Fold (higher-order function) */ public Observable reduce(Object accumulator) { return reduce(this, accumulator); } /** - * Returns an Observable that applies a function of your choosing to the first item emitted by a - * source Observable, then feeds the result of that function along with the second item emitted - * by an Observable into the same function, and so on until all items have been emitted by the - * source Observable, emitting the final result from the final call to your function as its sole + * Returns an Observable that applies a function of your choosing to the + * first item emitted by a + * source Observable, then feeds the result of that function along with the + * second item emitted + * by an Observable into the same function, and so on until all items have + * been emitted by the + * source Observable, emitting the final result from the final call to your + * function as its sole * output. *

- * This technique, which is called "reduce" here, is sometimes called "fold," "accumulate," - * "compress," or "inject" in other programming contexts. Groovy, for instance, has an + * This technique, which is called "reduce" here, is sometimes called + * "fold," "accumulate," + * "compress," or "inject" in other programming contexts. Groovy, for + * instance, has an * inject method that does a similar operation on lists. *

* - * + * * @param initialValue - * The initial (seed) accumulator value. + * The initial (seed) accumulator value. * @param accumulator - * An accumulator function to be invoked on each element from the sequence, whose - * result will be used in the next accumulator call (if applicable). - * - * @return an Observable that emits a single element from the result of accumulating the output + * An accumulator function to be invoked on each element from the sequence, + * whose + * result will be used in the next accumulator call (if applicable). + * + * @return an Observable that emits a single element from the result of + * accumulating the output * from the list of Observables. - * @see MSDN: Observable.Aggregate - * @see Wikipedia: Fold (higher-order function) + * @see + * MSDN: + * Observable.Aggregate + * @see + * Wikipedia: + * Fold (higher-order function) */ public Observable reduce(T initialValue, Func2 accumulator) { return reduce(this, initialValue, accumulator); } /** - * Returns an Observable that applies a function of your choosing to the first item emitted by a - * source Observable, then feeds the result of that function along with the second item emitted - * by an Observable into the same function, and so on until all items have been emitted by the - * source Observable, emitting the final result from the final call to your function as its sole + * Returns an Observable that applies a function of your choosing to the + * first item emitted by a + * source Observable, then feeds the result of that function along with the + * second item emitted + * by an Observable into the same function, and so on until all items have + * been emitted by the + * source Observable, emitting the final result from the final call to your + * function as its sole * output. *

- * This technique, which is called "reduce" here, is sometimes called "fold," "accumulate," - * "compress," or "inject" in other programming contexts. Groovy, for instance, has an + * This technique, which is called "reduce" here, is sometimes called + * "fold," "accumulate," + * "compress," or "inject" in other programming contexts. Groovy, for + * instance, has an * inject method that does a similar operation on lists. *

* - * + * * @param initialValue - * The initial (seed) accumulator value. + * The initial (seed) accumulator value. * @param accumulator - * An accumulator function to be invoked on each element from the sequence, whose - * result will be used in the next accumulator call (if applicable). - * @return an Observable that emits a single element from the result of accumulating the output + * An accumulator function to be invoked on each element from the sequence, + * whose + * result will be used in the next accumulator call (if applicable). + * @return an Observable that emits a single element from the result of + * accumulating the output * from the list of Observables. - * @see MSDN: Observable.Aggregate - * @see Wikipedia: Fold (higher-order function) + * @see + * MSDN: + * Observable.Aggregate + * @see + * Wikipedia: + * Fold (higher-order function) */ public Observable reduce(T initialValue, Object accumulator) { return reduce(this, initialValue, accumulator); } /** - * Returns an Observable that applies a function of your choosing to the first item emitted by a - * source Observable, then feeds the result of that function along with the second item emitted - * by an Observable into the same function, and so on until all items have been emitted by the - * source Observable, emitting the result of each of these iterations. It emits the result of - * each of these iterations as a sequence from the returned Observable. This sort of function is + * Returns an Observable that applies a function of your choosing to the + * first item emitted by a + * source Observable, then feeds the result of that function along with the + * second item emitted + * by an Observable into the same function, and so on until all items have + * been emitted by the + * source Observable, emitting the result of each of these iterations. It + * emits the result of + * each of these iterations as a sequence from the returned Observable. This + * sort of function is * sometimes called an accumulator. *

* - * + * * @param accumulator - * An accumulator function to be invoked on each element from the sequence whose - * result will be sent via onNext and used in the next accumulator call - * (if applicable). - * @return an Observable sequence whose elements are the result of accumulating the output from + * An accumulator function to be invoked on each element from the sequence + * whose + * result will be sent via onNext and used in the next + * accumulator call + * (if applicable). + * @return an Observable sequence whose elements are the result of + * accumulating the output from * the list of Observables. - * @see MSDN: Observable.Scan + * @see + * MSDN: + * Observable.Scan */ public Observable scan(Func2 accumulator) { return scan(this, accumulator); } /** - * Returns an Observable that applies a function of your choosing to the first item emitted by a - * source Observable, then feeds the result of that function along with the second item emitted - * by an Observable into the same function, and so on until all items have been emitted by the - * source Observable, emitting the result of each of these iterations. It emits the result of - * each of these iterations as a sequence from the returned Observable. This sort of function is + * Returns an Observable that applies a function of your choosing to the + * first item emitted by a + * source Observable, then feeds the result of that function along with the + * second item emitted + * by an Observable into the same function, and so on until all items have + * been emitted by the + * source Observable, emitting the result of each of these iterations. It + * emits the result of + * each of these iterations as a sequence from the returned Observable. This + * sort of function is * sometimes called an accumulator. *

* - * + * * @param accumulator - * An accumulator function to be invoked on each element from the sequence whose - * result will be sent via onNext and used in the next accumulator call - * (if applicable). - * - * @return an Observable sequence whose elements are the result of accumulating the output from + * An accumulator function to be invoked on each element from the sequence + * whose + * result will be sent via onNext and used in the next + * accumulator call + * (if applicable). + * + * @return an Observable sequence whose elements are the result of + * accumulating the output from * the list of Observables. - * @see MSDN: Observable.Scan + * @see + * MSDN: + * Observable.Scan */ public Observable scan(final Object accumulator) { return scan(this, accumulator); } /** - * Returns an Observable that applies a function of your choosing to the first item emitted by a - * source Observable, then feeds the result of that function along with the second item emitted - * by an Observable into the same function, and so on until all items have been emitted by the - * source Observable, emitting the result of each of these iterations. This sort of function is + * Returns an Observable that applies a function of your choosing to the + * first item emitted by a + * source Observable, then feeds the result of that function along with the + * second item emitted + * by an Observable into the same function, and so on until all items have + * been emitted by the + * source Observable, emitting the result of each of these iterations. This + * sort of function is * sometimes called an accumulator. *

* - * + * * @param initialValue - * The initial (seed) accumulator value. + * The initial (seed) accumulator value. * @param accumulator - * An accumulator function to be invoked on each element from the sequence whose - * result will be sent via onNext and used in the next accumulator call - * (if applicable). - * @return an Observable sequence whose elements are the result of accumulating the output from + * An accumulator function to be invoked on each element from the sequence + * whose + * result will be sent via onNext and used in the next + * accumulator call + * (if applicable). + * @return an Observable sequence whose elements are the result of + * accumulating the output from * the list of Observables. - * @see MSDN: Observable.Scan + * @see + * MSDN: + * Observable.Scan */ public Observable scan(T initialValue, Func2 accumulator) { return scan(this, initialValue, accumulator); } /** - * Returns an Observable that applies a function of your choosing to the first item emitted by a - * source Observable, then feeds the result of that function along with the second item emitted - * by an Observable into the same function, then feeds the result of that function along with the - * third item into the same function, and so on, emitting the result of each of these + * Returns an Observable that applies a function of your choosing to the + * first item emitted by a + * source Observable, then feeds the result of that function along with the + * second item emitted + * by an Observable into the same function, then feeds the result of that + * function along with the + * third item into the same function, and so on, emitting the result of each + * of these * iterations. This sort of function is sometimes called an accumulator. *

* - * + * * @param initialValue - * The initial (seed) accumulator value. + * The initial (seed) accumulator value. * @param accumulator - * An accumulator function to be invoked on each element from the sequence whose result - * will be sent via onNext and used in the next accumulator call (if - * applicable). - * @return an Observable sequence whose elements are the result of accumulating the output from + * An accumulator function to be invoked on each element from the sequence + * whose result + * will be sent via onNext and used in the next accumulator + * call (if + * applicable). + * @return an Observable sequence whose elements are the result of + * accumulating the output from * the list of Observables. - * @see MSDN: Observable.Scan + * @see + * MSDN: + * Observable.Scan */ public Observable scan(final T initialValue, final Object accumulator) { return scan(this, initialValue, accumulator); } /** - * Determines whether all elements of an observable sequence satisfies a condition. - * + * Determines whether all elements of an observable sequence satisfies a + * condition. + * * @param predicate - * a function to test each element for a condition. - * @return true if all elements of an observable sequence satisfies a condition; otherwise, false. + * a function to test each element for a condition. + * @return true if all elements of an observable sequence satisfies a + * condition; otherwise, false. */ public Observable all(Func1 predicate) { return all(this, predicate); } /** - * Determines whether all elements of an observable sequence satisfies a condition. - * + * Determines whether all elements of an observable sequence satisfies a + * condition. + * * @param predicate - * a function to test each element for a condition. - * @return true if all elements of an observable sequence satisfies a condition; otherwise, false. + * a function to test each element for a condition. + * @return true if all elements of an observable sequence satisfies a + * condition; otherwise, false. */ public Observable all(Object predicate) { return all(this, predicate); } /** - * Returns an Observable that skips the first num items emitted by the source + * Returns an Observable that skips the first num items emitted + * by the source * Observable. - * You can ignore the first num items emitted by an Observable and attend only to - * those items that come after, by modifying the Observable with the skip method. + * You can ignore the first num items emitted by an Observable + * and attend only to + * those items that come after, by modifying the Observable with the + * skip method. *

* - * + * * @param num * The number of items to skip - * @return an Observable sequence that is identical to the source Observable except that it does + * @return an Observable sequence that is identical to the source Observable + * except that it does * not emit the first num items from that sequence. */ public Observable skip(int num) { @@ -3033,19 +3668,25 @@ public class Observable { } /** - * Returns an Observable that emits the first num items emitted by the source + * Returns an Observable that emits the first num items emitted + * by the source * Observable. - * - * You can choose to pay attention only to the first num values emitted by a - * Observable by calling its take method. This method returns an Observable that will - * call a subscribing Observer's onNext function a maximum of num times + *

+ * You can choose to pay attention only to the first num values + * emitted by a + * Observable by calling its take method. This method returns + * an Observable that will + * call a subscribing Observer's onNext function a maximum of + * num times * before calling onCompleted. *

* - * + * * @param num - * @return an Observable that emits only the first num items from the source - * Observable, or all of the items from the source Observable if that Observable emits + * @return an Observable that emits only the first num items + * from the source + * Observable, or all of the items from the source Observable if that + * Observable emits * fewer than num items. */ public Observable take(final int num) { @@ -3053,10 +3694,11 @@ public class Observable { } /** - * Returns an Observable that items emitted by the source Observable as long as a specified condition is true. - * + * Returns an Observable that items emitted by the source Observable as long + * as a specified condition is true. + * * @param predicate - * a function to test each source element for a condition + * a function to test each source element for a condition * @return */ public Observable takeWhile(final Func1 predicate) { @@ -3064,10 +3706,11 @@ public class Observable { } /** - * Returns a specified number of contiguous values from the start of an observable sequence. - * + * Returns a specified number of contiguous values from the start of an + * observable sequence. + * * @param predicate - * a function to test each source element for a condition + * a function to test each source element for a condition * @return */ public Observable takeWhile(final Object predicate) { @@ -3075,10 +3718,13 @@ public class Observable { } /** - * Returns values from an observable sequence as long as a specified condition is true, and then skips the remaining values. - * + * Returns values from an observable sequence as long as a specified + * condition is true, and then skips the remaining values. + * * @param predicate - * a function to test each element for a condition; the second parameter of the function represents the index of the source element; otherwise, false. + * a function to test each element for a condition; the second parameter of + * the function represents the index of the source element; + * otherwise, false. * @return */ public Observable takeWhileWithIndex(final Func2 predicate) { @@ -3086,10 +3732,13 @@ public class Observable { } /** - * Returns values from an observable sequence as long as a specified condition is true, and then skips the remaining values. - * + * Returns values from an observable sequence as long as a specified + * condition is true, and then skips the remaining values. + * * @param predicate - * a function to test each element for a condition; the second parameter of the function represents the index of the source element; otherwise, false. + * a function to test each element for a condition; the second parameter of + * the function represents the index of the source element; + * otherwise, false. * @return */ public Observable takeWhileWithIndex(final Object predicate) { @@ -3097,13 +3746,15 @@ public class Observable { } /** - * Returns an Observable that emits the last count items emitted by the source + * Returns an Observable that emits the last count items + * emitted by the source * Observable. - * + * * @param count - * the number of items from the end of the sequence emitted by the source - * Observable to emit - * @return an Observable that only emits the last count items emitted by the source + * the number of items from the end of the sequence emitted by the source + * Observable to emit + * @return an Observable that only emits the last count items + * emitted by the source * Observable */ public Observable takeLast(final int count) { @@ -3111,32 +3762,43 @@ public class Observable { } /** - * Returns the values from the source observable sequence until the other observable sequence produces a value. - * + * Returns the values from the source observable sequence until the other + * observable sequence produces a value. + * * @param other - * the observable sequence that terminates propagation of elements of the source sequence. + * the observable sequence that terminates propagation of elements of the + * source sequence. * @param - * the other type. - * @return An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation. + * the other type. + * @return An observable sequence containing the elements of the source + * sequence up to the point the other sequence interrupted further + * propagation. */ public Observable takeUntil(Observable other) { return takeUntil(this, other); } /** - * Returns an Observable that emits a single item, a list composed of all the items emitted by + * Returns an Observable that emits a single item, a list composed of all + * the items emitted by * the source Observable. - * - * Normally, an Observable that returns multiple items will do so by calling its Observer's - * onNext function for each such item. You can change this behavior, instructing - * the Observable to compose a list of all of these multiple items and then to call the - * Observer's onNext function once, passing it the entire list, by calling the - * Observable object's toList method prior to calling its subscribe + *

+ * Normally, an Observable that returns multiple items will do so by calling + * its Observer's + * onNext function for each such item. You can change this + * behavior, instructing + * the Observable to compose a list of all of these multiple items and then + * to call the + * Observer's onNext function once, passing it the entire list, + * by calling the + * Observable object's toList method prior to calling its + * subscribe * method. *

* - * - * @return an Observable that emits a single item: a List containing all of the items emitted by + * + * @return an Observable that emits a single item: a List containing all of + * the items emitted by * the source Observable. */ public Observable> toList() { @@ -3147,9 +3809,9 @@ public class Observable { * Sort T objects by their natural order (object must implement Comparable). *

* - * + * * @throws ClassCastException - * if T objects do not implement Comparable + * if T objects do not implement Comparable * @return */ public Observable> toSortedList() { @@ -3160,7 +3822,7 @@ public class Observable { * Sort T objects using the defined sort function. *

* - * + * * @param sortFunction * @return */ @@ -3172,7 +3834,7 @@ public class Observable { * Sort T objects using the defined sort function. *

* - * + * * @param sortFunction * @return */ @@ -3182,7 +3844,7 @@ public class Observable { /** * Converts an observable sequence to an Iterable. - * + * * @return Observable converted to Iterable. */ public Iterable toIterable() { @@ -3191,34 +3853,41 @@ public class Observable { @SuppressWarnings("unchecked") public Observable startWith(T... values) { - return concat(Observable. from(values), this); + return concat(Observable.from(values), this); } /** - * Groups the elements of an observable and selects the resulting elements by using a specified function. - * + * Groups the elements of an observable and selects the resulting elements + * by using a specified function. + * * @param keySelector - * a function to extract the key for each element. + * a function to extract the key for each element. * @param elementSelector - * a function to map each source element to an element in an observable group. + * a function to map each source element to an element in an observable + * group. * @param - * the key type. + * the key type. * @param - * the resulting observable type. - * @return an observable of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value. + * the resulting observable type. + * @return an observable of observable groups, each of which corresponds to + * a unique key value, containing all elements that share that same + * key value. */ public Observable> groupBy(final Func1 keySelector, final Func1 elementSelector) { return groupBy(this, keySelector, elementSelector); } /** - * Groups the elements of an observable according to a specified key selector function and - * + * Groups the elements of an observable according to a specified key + * selector function and + * * @param keySelector - * a function to extract the key for each element. + * a function to extract the key for each element. * @param - * the key type. - * @return an observable of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value. + * the key type. + * @return an observable of observable groups, each of which corresponds to + * a unique key value, containing all elements that share that same + * key value. */ public Observable> groupBy(final Func1 keySelector) { return groupBy(this, keySelector); @@ -3226,17 +3895,20 @@ public class Observable { /** * Returns an iterator that iterates all values of the observable. - * - * @return the iterator that could be used to iterate over the elements of the observable. + * + * @return the iterator that could be used to iterate over the elements of + * the observable. */ public Iterator getIterator() { return getIterator(this); } /** - * Samples the next value (blocking without buffering) from in an observable sequence. - * - * @return iterable that blocks upon each iteration until the next element in the observable source sequence becomes available. + * Samples the next value (blocking without buffering) from in an observable + * sequence. + * + * @return iterable that blocks upon each iteration until the next element + * in the observable source sequence becomes available. */ public Iterable next() { return next(this); @@ -3244,29 +3916,35 @@ public class Observable { /** * Samples the most recent value in an observable sequence. - * + * * @param initialValue - * the initial value that will be yielded by the enumerable sequence if no element has been sampled yet. - * @return the iterable that returns the last sampled element upon each iteration. + * the initial value that will be yielded by the enumerable sequence if no + * element has been sampled yet. + * @return the iterable that returns the last sampled element upon each + * iteration. */ public Iterable mostRecent(T initialValue) { return mostRecent(this, initialValue); } /** - * Whether a given {@link Function} is an internal implementation inside rx.* packages or not. + * Whether a given {@link Function} is an internal implementation inside + * rx.* packages or not. *

- * For why this is being used see https://github.com/Netflix/RxJava/issues/216 for discussion on "Guideline 6.4: Protect calls to user code from within an operator" - * - * NOTE: If strong reasons for not depending on package names comes up then the implementation of this method can change to looking for a marker interface. - * + * For why this is being used see + * https://github.com/Netflix/RxJava/issues/216 for discussion on "Guideline + * 6.4: Protect calls to user code from within an operator" + *

+ * NOTE: If strong reasons for not depending on package names comes up then + * the implementation of this method can change to looking for a marker + * interface. + * * @param f * @return */ private boolean isInternalImplementation(Object o) { - if (o == null) { + if (o == null) return true; - } // prevent double-wrapping (yeah it happens) if (o instanceof AtomicObserver) return true; diff --git a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N.properties b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N.properties index 157043a74..7eeaaad9b 100644 --- a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N.properties +++ b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N.properties @@ -240,7 +240,7 @@ mainwindow.enter_script_name=\u8f93\u5165\u8981\u751f\u6210\u811a\u672c\u7684\u6 mainwindow.make_launch_succeed=\u542f\u52a8\u811a\u672c\u5df2\u751f\u6210\u5b8c\u6bd5: mainwindow.no_version=\u672a\u627e\u5230\u4efb\u4f55\u7248\u672c\uff0c\u662f\u5426\u8fdb\u5165\u6e38\u620f\u4e0b\u8f7d\uff1f -launcher.about=\u9ed8\u8ba4\u80cc\u666f\u56fe\u6765\u81eaLiberty Dome\u670d\u52a1\u5668\u3002
\u5173\u4e8e\u4f5c\u8005\uff1a
\n\u767e\u5ea6ID\uff1ahuanghongxun20
\nmcbbs\uff1ahuanghongxun
\n\u90ae\u7bb1\uff1ahuanghongxun2008@126.com
\nMinecraft Forum ID: klkl6523
\n\u6b22\u8fce\u63d0\u4ea4Bug\u54e6
\nCopyright (c) 2013-2015 huangyuhui.
\u514d\u8d23\u58f0\u660e\uff1aMinecraft\u8f6f\u4ef6\u7248\u6743\u5f52Mojang AB\u6240\u6709\uff0c\u6e38\u620f\u7531\u4e8e\u8bef\u64cd\u4f5c\u672c\u542f\u52a8\u5668\u800c\u4e22\u5931\u6570\u636e\u7684\u6982\u4e0d\u8d1f\u8d23\u3002
\u672c\u542f\u52a8\u5668\u5728GPLv2\u534f\u8bae\u4e0b\u5f00\u6e90:http://github.com/huanghongxun/HMCL/ +launcher.about=\u9ed8\u8ba4\u80cc\u666f\u56fe\u6765\u81eaLiberty Dome\u670d\u52a1\u5668\u3002
\u5173\u4e8e\u4f5c\u8005\uff1a
\n\u767e\u5ea6ID\uff1ahuanghongxun20
\nmcbbs\uff1ahuanghongxun
\n\u90ae\u7bb1\uff1ahuanghongxun2008@126.com
\nMinecraft Forum ID: klkl6523
\n\u6b22\u8fce\u63d0\u4ea4Bug\u54e6
\nCopyright (c) 2013-2015 huangyuhui.
\u514d\u8d23\u58f0\u660e\uff1aMinecraft\u8f6f\u4ef6\u7248\u6743\u5f52Mojang AB\u6240\u6709\uff0c\u6e38\u620f\u7531\u4e8e\u8bef\u64cd\u4f5c\u672c\u542f\u52a8\u5668\u800c\u4e22\u5931\u6570\u636e\u7684\u6982\u4e0d\u8d1f\u8d23\u3002
\u672c\u542f\u52a8\u5668\u5728GPLv3\u534f\u8bae\u4e0b\u5f00\u6e90:http://github.com/huanghongxun/HMCL/
\u672c\u8f6f\u4ef6\u4f7f\u7528\u4e86\u57fa\u4e8eApache License 2.0\u7684RxJava\u548cGson\u9879\u76ee\uff0c\u611f\u8c22\u8d21\u732e\u8005\u3002 launcher.download_source=\u4e0b\u8f7d\u6e90 launcher.background_location=\u80cc\u666f\u5730\u5740 launcher.exit_failed=\u5f3a\u5236\u9000\u51fa\u5931\u8d25\uff0c\u53ef\u80fd\u662fForge 1.7.10\u53ca\u66f4\u9ad8\u7248\u672c\u5bfc\u81f4\u7684\uff0c\u65e0\u6cd5\u89e3\u51b3\u3002 diff --git a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N_en.properties b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N_en.properties index ee0a0edbc..285b7b02e 100644 --- a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N_en.properties +++ b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N_en.properties @@ -240,7 +240,7 @@ mainwindow.enter_script_name=Enter the script name. mainwindow.make_launch_succeed=Finished script creation. mainwindow.no_version=No version found. Switch to Game Downloads Tab? -launcher.about=About Author
\nEmail\uff1ahuanghongxun2008@126.com
\nMinecraft Forum ID: klkl6523
\nCopyright (c) 2013 huangyuhui
Opened source under GPL v2 licence:http://github.com/huanghongxun/HMCL/ +launcher.about=About Author
\nEmail\uff1ahuanghongxun2008@126.com
\nMinecraft Forum ID: klkl6523
\nCopyright (c) 2013 huangyuhui
Opened source under GPL v3 license:http://github.com/huanghongxun/HMCL/
This software used project RxJava and Gson which is under Apache License 2.0, thanks contributors. launcher.download_source=Download Source launcher.background_location=Background Location launcher.exit_failed=Failed to shutdown. diff --git a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N_zh.properties b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N_zh.properties index 6775e082e..24001e92f 100644 --- a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N_zh.properties +++ b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N_zh.properties @@ -240,7 +240,7 @@ mainwindow.enter_script_name=\u8f38\u5165\u8981\u751f\u6210\u8173\u672c\u7684\u6 mainwindow.make_launch_succeed=\u555f\u52d5\u8173\u672c\u5df2\u751f\u6210\u5b8c\u7562: mainwindow.no_version=\u672a\u627e\u5230\u4efb\u4f55\u7248\u672c\uff0c\u662f\u5426\u9032\u5165\u904a\u6232\u4e0b\u8f09\uff1f -launcher.about=\u9ed8\u8a8d\u80cc\u666f\u5716\u4f86\u81eaLiberty Dome\u670d\u52d9\u5668\u3002
\u95dc\u65bc\u4f5c\u8005\uff1a
\n\u767e\u5ea6ID\uff1ahuanghongxun20
\nmcbbs\uff1ahuanghongxun
\n\u90f5\u7bb1\uff1ahuanghongxun2008@126.com
\nMinecraft Forum ID: klkl6523
\n\u6b61\u8fce\u63d0\u4ea4Bug\u54e6
\nCopyright (c) 2013-2015 huangyuhui.
\u514d\u8cac\u8072\u660e\uff1aMinecraft\u8edf\u4ef6\u7248\u6b0a\u6b78Mojang AB\u6240\u6709\uff0c\u904a\u6232\u7531\u65bc\u8aa4\u64cd\u4f5c\u672c\u555f\u52d5\u5668\u800c\u4e1f\u5931\u6578\u64da\u7684\u6982\u4e0d\u8ca0\u8cac\u3002
\u672c\u555f\u52d5\u5668\u5728GPLv2\u5354\u8b70\u4e0b\u958b\u6e90:http://github.com/huanghongxun/HMCL/ +launcher.about=\u9ed8\u8a8d\u80cc\u666f\u5716\u4f86\u81eaLiberty Dome\u670d\u52d9\u5668\u3002
\u95dc\u65bc\u4f5c\u8005\uff1a
\n\u767e\u5ea6ID\uff1ahuanghongxun20
\nmcbbs\uff1ahuanghongxun
\n\u90f5\u7bb1\uff1ahuanghongxun2008@126.com
\nMinecraft Forum ID: klkl6523
\n\u6b61\u8fce\u63d0\u4ea4Bug\u54e6
\nCopyright (c) 2013-2015 huangyuhui.
\u514d\u8cac\u8072\u660e\uff1aMinecraft\u8edf\u4ef6\u7248\u6b0a\u6b78Mojang AB\u6240\u6709\uff0c\u904a\u6232\u7531\u65bc\u8aa4\u64cd\u4f5c\u672c\u555f\u52d5\u5668\u800c\u4e1f\u5931\u6578\u64da\u7684\u6982\u4e0d\u8ca0\u8cac\u3002
\u672c\u555f\u52d5\u5668\u5728GPLv3\u5354\u8b70\u4e0b\u958b\u6e90:http://github.com/huanghongxun/HMCL/
\u672c\u8edf\u4ef6\u4f7f\u7528\u4e86\u57fa\u65bcApache License 2.0\u7684RxJava\u548cGson\u9805\u76ee\uff0c\u611f\u8b1d\u8ca2\u737b\u8005\u3002 launcher.download_source=\u4e0b\u8f09\u6e90 launcher.background_location=\u80cc\u666f\u5730\u5740 launcher.exit_failed=\u5f37\u5236\u9000\u51fa\u5931\u6557\uff0c\u53ef\u80fd\u662fForge 1.7.10\u53ca\u66f4\u9ad8\u7248\u672c\u5c0e\u81f4\u7684\uff0c\u7121\u6cd5\u89e3\u6c7a\u3002 diff --git a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N_zh_CN.properties b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N_zh_CN.properties index 199a50bf5..bc8d72097 100644 --- a/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N_zh_CN.properties +++ b/HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/launcher/I18N_zh_CN.properties @@ -237,7 +237,7 @@ mainwindow.enter_script_name=\u8f93\u5165\u8981\u751f\u6210\u811a\u672c\u7684\u6 mainwindow.make_launch_succeed=\u542f\u52a8\u811a\u672c\u5df2\u751f\u6210\u5b8c\u6bd5: mainwindow.no_version=\u672a\u627e\u5230\u4efb\u4f55\u7248\u672c\uff0c\u662f\u5426\u8fdb\u5165\u6e38\u620f\u4e0b\u8f7d\uff1f -launcher.about=\u9ed8\u8ba4\u80cc\u666f\u56fe\u6765\u81eaLiberty Dome\u670d\u52a1\u5668\u3002
\u5173\u4e8e\u4f5c\u8005\uff1a
\n\u767e\u5ea6ID\uff1ahuanghongxun20
\nmcbbs\uff1ahuanghongxun
\n\u90ae\u7bb1\uff1ahuanghongxun2008@126.com
\nMinecraft Forum ID: klkl6523
\n\u6b22\u8fce\u63d0\u4ea4Bug\u54e6
\nCopyright (c) 2013-2015 huangyuhui.
\u514d\u8d23\u58f0\u660e\uff1aMinecraft\u8f6f\u4ef6\u7248\u6743\u5f52Mojang AB\u6240\u6709\uff0c\u6e38\u620f\u7531\u4e8e\u8bef\u64cd\u4f5c\u672c\u542f\u52a8\u5668\u800c\u4e22\u5931\u6570\u636e\u7684\u6982\u4e0d\u8d1f\u8d23\u3002
\u672c\u542f\u52a8\u5668\u5728GPLv2\u534f\u8bae\u4e0b\u5f00\u6e90:http://github.com/huanghongxun/HMCL/ +launcher.about=\u9ed8\u8ba4\u80cc\u666f\u56fe\u6765\u81eaLiberty Dome\u670d\u52a1\u5668\u3002
\u5173\u4e8e\u4f5c\u8005\uff1a
\n\u767e\u5ea6ID\uff1ahuanghongxun20
\nmcbbs\uff1ahuanghongxun
\n\u90ae\u7bb1\uff1ahuanghongxun2008@126.com
\nMinecraft Forum ID: klkl6523
\n\u6b22\u8fce\u63d0\u4ea4Bug\u54e6
\nCopyright (c) 2013-2015 huangyuhui.
\u514d\u8d23\u58f0\u660e\uff1aMinecraft\u8f6f\u4ef6\u7248\u6743\u5f52Mojang AB\u6240\u6709\uff0c\u6e38\u620f\u7531\u4e8e\u8bef\u64cd\u4f5c\u672c\u542f\u52a8\u5668\u800c\u4e22\u5931\u6570\u636e\u7684\u6982\u4e0d\u8d1f\u8d23\u3002
\u672c\u542f\u52a8\u5668\u5728GPLv3\u534f\u8bae\u4e0b\u5f00\u6e90:http://github.com/huanghongxun/HMCL/
\u672c\u8f6f\u4ef6\u4f7f\u7528\u4e86\u57fa\u4e8eApache License 2.0\u7684RxJava\u548cGson\u9879\u76ee\uff0c\u611f\u8c22\u8d21\u732e\u8005\u3002 launcher.download_source=\u4e0b\u8f7d\u6e90 launcher.background_location=\u80cc\u666f\u5730\u5740 launcher.exit_failed=\u5f3a\u5236\u9000\u51fa\u5931\u8d25\uff0c\u53ef\u80fd\u662fForge 1.7.10\u53ca\u66f4\u9ad8\u7248\u672c\u5bfc\u81f4\u7684\uff0c\u65e0\u6cd5\u89e3\u51b3\u3002