没有重新定义的接口,没有定义方法,类 - 是否可能?

时间:2015-07-27 08:03:50

标签: java android

我是android和java的新手。我对代码解释有一些疑问。这是公司SDK的一部分。

public class RECOBeaconManager {

   private static long d;    
   private static long e;
   private static RECOBeaconManager f;
   private Context g;
   private Messenger h = null;
   private Messenger i = null;
   private CopyOnWriteArrayList<RECOBeaconRegion> j;
   private CopyOnWriteArrayList<RECOBeaconRegion> k;
   protected RECOMonitoringListener a;
   protected RECORangingListener b;
   protected RECOServiceConnectListener c;
   private long l;
   private long m;
   private boolean n = false;
   private boolean o = true;
   private boolean p = true;
   private int q;
   private ServiceConnection r = new c(this);

   private RECOBeaconManager(Context var1) {        /some code/    }
   public static RECOBeaconManager getInstance(Context var0) {        /some code/    }
   @Deprecated
   public static RECOBeaconManager getInstance(Context var0, boolean var1) {        /some code/    }
   public static RECOBeaconManager getInstance(Context var0, boolean var1, boolean var2) {        /some code/       }

   private boolean a() {        /some code/    }
   private boolean b() {        /some code/    }
   public void bind(RECOServiceConnectListener var1) {
      ++this.q;
      this.c = var1;
      if(this.isBound()) {
          this.c();
      } else {
          if(this.q == 1) {
              Intent var2 = new Intent(this.g, RECOBeaconService.class);
              if(!this.g.bindService(var2, this.r, 1)) {
                  this.c.onServiceFail(RECOErrorCode.RECO_MANAGER_NOT_BIND);
              }
          }

      }
   }

   public void unbind() throws RemoteException {        /some code/    }
   public boolean isBound() {        /some code/    }
   public boolean isMonitoringAvailable() {        /some code/    }
   public boolean isRangingAvailable() {       /some code/    }
   public void startMonitoringForRegion(RECOBeaconRegion var1) throws RemoteException, NullPointerException {
      this.a(true);
      if(var1 == null) {
          this.a.monitoringDidFailForRegion(var1, RECOErrorCode.RECO_NULL_REGION);
          throw new NullPointerException("Cannot monitor null RECOBeaconRegion.");
      } else {
          this.j.remove(var1);
          this.j.add(var1);
          z.a(this.h, this.i, 1, new f(var1, this.l, this.m));
      }
   }

   public void stopMonitoringForRegion(RECOBeaconRegion var1) throws RemoteException, NullPointerException {       /some code/    }

   public void startRangingBeaconsInRegion(RECOBeaconRegion var1) throws RemoteException, NullPointerException {        /some code/    }
   public void stopRangingBeaconsInRegion(RECOBeaconRegion var1) throws RemoteException, NullPointerException {        /some code/    }
   public void requestStateForRegion(RECOBeaconRegion var1) throws RemoteException, NullPointerException {  /some code/    }
   private void a(boolean var1) throws RemoteException, NullPointerException {        /some code/    }
   public ArrayList<RECOBeaconRegion> getMonitoredRegions() {        /some code/    }
   public ArrayList<RECOBeaconRegion> getRangedRegions() {        /some code/    }
   public void setMonitoringListener(RECOMonitoringListener var1) {        /some code/    }
   public void setRangingListener(RECORangingListener var1) {      /some code/    }
   public void setScanPeriod(long var1) {        /some code/    }
   public void setSleepPeriod(long var1) {        /some code/    }
   private void c() {        /some code/    }
   public void setDiscontinuousScan(boolean var1) {       /some code/    }
   public String version() {        /some code/    }
   static {        /some code/     }
}

首先,在bind方法中,RECOServiceConnectListener是一个接口,但我在这个类中找不到实现。可能吗?接口由抽象方法和常量组成。他们需要在课堂上实施吗?

其次,在startMonitoringForRegion方法中,

 z.a(this.h, this.i, 1, new f(var1, this.l, this.m));

我不能在这堂课中表现得很好。它仅作为导入提及。 z类存在。另一个类如RECOMonitoringListener被定义和使用。但是z不是。我错了吗?

请告诉我如何分析此代码。 谢谢。

1 个答案:

答案 0 :(得分:0)

RECOBeaconManager未实现RECOServiceConnectListener。因此,它不需要实现(或重新定义)RECOServiceConnectListener的方法。

至于z不知道。它在您发布的代码中根本不显示。并且RECOBeaconManager不会扩展或实现任何内容,因此它不能来自超类。它必须是导入,但是从您发布的代码中无法了解它。

如果您使用的是IDE,例如Netbeans,您可以在z上进行SHIFT + CLICK,它会将您带到它的定义。