com.android.repository.api
Class UpdatablePackage

java.lang.Object
  extended by com.android.repository.api.UpdatablePackage
All Implemented Interfaces:
java.lang.Comparable<UpdatablePackage>

public class UpdatablePackage
extends java.lang.Object
implements java.lang.Comparable<UpdatablePackage>

Represents a (revisionless) package, either local, remote, or both. If both a local and remote package are specified, they should represent exactly the same package, excepting the revision. That is, the result of installing the remote package should be (a possibly updated version of) the local package.


Constructor Summary
UpdatablePackage(LocalPackage localInfo)
           
UpdatablePackage(LocalPackage localInfo, RemotePackage remoteInfo)
           
UpdatablePackage(RemotePackage remoteInfo)
           
 
Method Summary
 void addRemote(RemotePackage remote)
          Adds the given remote package if this package doesn't already have a remote, or if the given remote is more recent.
 int compareTo(UpdatablePackage o)
           
 java.util.Set<RemotePackage> getAllRemotes()
           
 LocalPackage getLocalInfo()
           
 RemotePackage getRemote(boolean includePreview)
           
 RepoPackage getRepresentative(boolean includePreview)
          Gets a RepoPackage (either local or remote) corresponding to this updatable package.
 boolean hasLocal()
           
 boolean hasPreview()
           
 boolean hasRemote(boolean includePreview)
           
 boolean isUpdate(boolean includePreview)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UpdatablePackage

public UpdatablePackage(@NonNull
                        LocalPackage localInfo)

UpdatablePackage

public UpdatablePackage(@NonNull
                        RemotePackage remoteInfo)

UpdatablePackage

public UpdatablePackage(@NonNull
                        LocalPackage localInfo,
                        @NonNull
                        RemotePackage remoteInfo)
Method Detail

addRemote

public void addRemote(@NonNull
                      RemotePackage remote)
Adds the given remote package if this package doesn't already have a remote, or if the given remote is more recent. If it is a preview, it will be returned by getRemote(boolean) only if it is specified that preview packages are desired.

Parameters:
remote - The remote package.

getLocalInfo

@Nullable
public LocalPackage getLocalInfo()

getRemote

@Nullable
public RemotePackage getRemote(boolean includePreview)

hasPreview

public boolean hasPreview()

hasRemote

public boolean hasRemote(boolean includePreview)

hasLocal

public boolean hasLocal()

compareTo

public int compareTo(@NonNull
                     UpdatablePackage o)
Specified by:
compareTo in interface java.lang.Comparable<UpdatablePackage>

getRepresentative

@NonNull
public RepoPackage getRepresentative(boolean includePreview)
Gets a RepoPackage (either local or remote) corresponding to this updatable package. This will be the first of:
  1. The LocalPackage if the package is installed
  2. The preview RemotePackage if there is a remote preview and includePreview is true
  3. The remote package otherwise, or null if there is no non-preview remote.


isUpdate

public boolean isUpdate(boolean includePreview)

getAllRemotes

@NonNull
public java.util.Set<RemotePackage> getAllRemotes()