Examples of Singleton


Examples of ceylon.language.Singleton

    }

    @Override
    public Iterator<? extends Sequence<? extends Object>> iterator() {
        ValueDeclaration valueDecl = null;
        return new Singleton(null, new Tuple(null, new Object[]{
                valueDecl,
                value
        })).iterator();
    }
View Full Code Here

Examples of com.dp4j.Singleton

        final String enclosingClass = singleton.toString();
        if (!returnClass.equals(enclosingClass)) {
            msgr.printMessage(Kind.ERROR, "the instance field must be of type " + enclosingClass, e);
        }

        final Singleton singletonAnn = singleton.getAnnotation(Singleton.class);
        if (singletonAnn == null) {
            if (singletonAnn.lazy()) {
                VariableTree tree = (VariableTree) trees.getTree(e);
                ExpressionTree initializer = tree.getInitializer();
                if (initializer != null) {
                    msgr.printMessage(Kind.ERROR, "For lazy Singleton initialization you must not inline initialize " + e.getSimpleName(), e);
                }
View Full Code Here

Examples of com.l2client.app.Singleton

        addEntityIdToGeoms(id, n);
    }
  }

  public void remove(int obj) {
    Singleton s = Singleton.get();
    IdentityComponent id = (IdentityComponent) s.getEntityManager().getComponent(obj, IdentityComponent.class);
    if(id != null){
      Entity e = id.getEntity();
      if(e != null)
        s.getSceneManager().changeWalkerNode(e,Action.REMOVE);
System.out.println("Starting to remove comps of "+id);     
      //FIXME check this is working correctly, what if we delete one which is currently updated, better queue for removal.
      Component pos = s.getEntityManager().getComponent(obj, PositioningComponent.class);
      s.getPosSystem().removeComponentForUpdate(pos);
      s.getJmeSystem().removeComponentForUpdate(pos);
      Component env = s.getEntityManager().getComponent(obj, EnvironmentComponent.class);
      s.getAnimSystem().removeComponentForUpdate(env);
System.out.println("Removed comps of "+id+" pos:"+pos+" env"+env);     
    } else {
System.out.println("ERROR!! Remove of "+id+" but no ID comp found!?! NO comps removed :-(");     
    }
    s.getEntityManager().deleteEntity(obj);
System.out.println("REMOVE of "+id+" finished");     
   
  }
View Full Code Here

Examples of com.l2client.app.Singleton

  @Override
  public void handlePacket() {
    log.finer("Read from Server "+this.getClass().getSimpleName());
    int obj = readD();
    Singleton s = Singleton.get();
    L2JComponent l2j = (L2JComponent) s.getEntityManager().getComponent(obj, L2JComponent.class);
    if(l2j != null){
      //TODO refactor item/npc handling, only components which should themselves know where to remove from, also refactor item/npc/pc instancing
      if(l2j.l2jItem != null) {
        _client.getItemHandler().removeItem(obj);
        log.fine("Delete of item id "+obj);
      } else {
        _client.getNpcHandler().remove(obj);
        log.fine("Delete of npc id "+obj);
      }
    } else {
      log.severe("Delete of objectid not possible no L2JComponent for:"+obj);
      s.getEntityManager().dumpComponents(obj);
    }

  }
View Full Code Here

Examples of com.l2client.app.Singleton

   */
  @Override
  public void onAction(String name, boolean isPressed, float tpf) {
    // only execute on button/key release
    if (!isPressed) {
      Singleton sin = Singleton.get();
      Vector3f origin = camera.getWorldCoordinates(
          inputManager.getCursorPosition(), 0.0f);
      Vector3f direction = camera.getWorldCoordinates(
          inputManager.getCursorPosition(), 0.3f);
      direction.subtractLocal(origin).normalizeLocal();

      Ray ray = new Ray(origin, direction);
      CollisionResults results = new CollisionResults();

      sin.getSceneManager().getRoot().collideWith(ray, results);

      if (results.size() > 0) {
        Geometry geom = null;
        for (CollisionResult res : results) {
          geom = res.getGeometry();
          if (geom != null) {
            log.fine("picked " + geom.getName());
            Integer id = geom.getUserData(Entity.ENTITY_ID);
            if (id != null) {
              //Just create a target component rest is done in the jmeupdatesystem
              Node n = res.getGeometry().getParent();
              String na = n.getName();
              log.fine("picked " + na + " id:"+ id);
              Vector3f loc = n.getLocalTranslation();
              sin.getClientFacade().sendAction(id, loc.x, loc.y, loc.z, false, true);
              results.clear();
              return;
            } else {//FIXME click on anything, check nav, then send request
              // this is the one
              Vector3f location = res.getContactPoint();
              if(location != null){
                Path p = new Path();
                PositioningComponent pos = (PositioningComponent) sin.getEntityManager().getComponent(handler.getSelectedObjectId(), PositioningComponent.class);
                if(pos != null){
                  if(sin.getNavManager().buildNavigationPath(p, pos.position, location.clone())) {
                    log.fine("new loc:" + location
                        + " sent:"+ ServerValues.getServerCoordX(location.x)
                        + ","+ ServerValues.getServerCoordY(location.z)
                        + ","+ ServerValues.getServerCoordZ(location.y));
                    sin.getClientFacade().sendMoveToAction(handler.getSelectedObjectId(), pos.position.x, pos.position.y, pos.position.z, location.x, location.y,
                        location.z);
                    results.clear();
                    return;
                  } else {
                    log.fine("Unable to build path from "+pos.position+" to "+location);
View Full Code Here

Examples of com.l2client.app.Singleton

    //test for very large update window, no more than the 5 passed should be processed (each once)
    sys.timeBudget = 1f;
    sys.update(0.01f);
    assertEquals(5, count);
   
    Singleton single = Singleton.get();
    single.init(null);
    PositioningSystem ps = Singleton.get().getPosSystem();
    PositioningComponent pos = new PositioningComponent();
    pos.position = new Vector3f(10,0,0);
    pos.startPos.set(pos.position);
    pos.goalPos = new Vector3f(0,0,0);
View Full Code Here

Examples of com.l2client.app.Singleton

    }).start();
   
  }
 
  public void removeItem(int obj) {
    Singleton s = Singleton.get();
    IdentityComponent id = (IdentityComponent) s.getEntityManager().getComponent(obj, IdentityComponent.class);
    if(id != null){
      Entity e = id.getEntity();
      if(e != null)
        s.getSceneManager().changeItemNode(e,Action.REMOVE);   
    } else {
System.out.println("ERROR!! Remove of "+id+" but no ID comp found!?! NO comps removed :-(");     
    }
    s.getEntityManager().deleteEntity(obj);
System.out.println("REMOVE of "+id+" finished");     
   
  }
View Full Code Here

Examples of javax.ejb.Singleton

      annType.addAnnotation(stateful);
     
      return new EjbStatefulBean<T>(getConfig(), rawAnnType, annType, moduleName);
    }
    else if ("Singleton".equals(_sessionType)) {
      Singleton singleton = new SingletonLiteral(name, mappedName, description);
      annType.addAnnotation(singleton);
     
      return new EjbSingletonBean<T>(getConfig(), rawAnnType, annType, moduleName);
    }
   
View Full Code Here

Examples of javax.ejb.Singleton

            /* 19.2:  ejb-name: Default is the unqualified name of the bean class */

            EjbJar ejbJar = ejbModule.getEjbJar();
            for (Class<?> beanClass : finder.findAnnotatedClasses(Singleton.class)) {
                Singleton singleton = beanClass.getAnnotation(Singleton.class);
                String ejbName = getEjbName(singleton, beanClass);

                if (!isValidAnnotationUsage(Singleton.class, beanClass, ejbName, ejbModule)) continue;

                EnterpriseBean enterpriseBean = ejbJar.getEnterpriseBean(ejbName);
View Full Code Here

Examples of javax.ejb.Singleton

                    managedClasses.remove(beanClass.get().getName());
                    specializingClasses.add(beanClass.get());
                    continue;
                }

                Singleton singleton = beanClass.getAnnotation(Singleton.class);
                String ejbName = getEjbName(singleton, beanClass.get());

                if (!isValidEjbAnnotationUsage(Singleton.class, beanClass, ejbName, ejbModule)) continue;

                EnterpriseBean enterpriseBean = ejbJar.getEnterpriseBean(ejbName);
                if (enterpriseBean == null) {
                    enterpriseBean = new SingletonBean(ejbName, beanClass.get());
                    ejbJar.addEnterpriseBean(enterpriseBean);
                }
                if (enterpriseBean.getEjbClass() == null) {
                    enterpriseBean.setEjbClass(beanClass.get());
                }
                if (enterpriseBean instanceof SessionBean) {
                    SessionBean sessionBean = (SessionBean) enterpriseBean;
                    sessionBean.setSessionType(SessionType.SINGLETON);

                    if (singleton.mappedName() != null) {
                        sessionBean.setMappedName(singleton.mappedName());
                    }
                }
                LegacyProcessor.process(beanClass.get(), enterpriseBean);
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.