Examples of Unit


Examples of soot.Unit

  protected void handleMultipleReturns()
  {
 
    if(this.getTails().size() > 1)
    {
      Unit stop = new ExitStmt();
        List<Unit> predsOfstop = new ArrayList<Unit>();
 
       
      for(Iterator<Unit> tailItr = this.getTails().iterator(); tailItr.hasNext(); )
      {
        Unit tail = tailItr.next();
        predsOfstop.add(tail);
     
        List<Unit> tailSuccs = this.unitToSuccs.get(tail);
        tailSuccs.add(stop)
      }
View Full Code Here

Examples of soot.Unit

   */
 
  protected void removeBogusHeads()
  {
    Chain<Unit> units = body.getUnits();
    Unit trueHead = units.getFirst();
   
    while(this.getHeads().size() > 1)
    {
      for(Iterator<Unit> headItr = this.getHeads().iterator(); headItr.hasNext(); )
      {
        Unit head = headItr.next();
        if(trueHead == head)
          continue;
       
        this.unitToPreds.remove(head);
        List<Unit> succs = this.unitToSuccs.get(head);
        for(Iterator<Unit> succsItr = succs.iterator(); succsItr.hasNext(); )
        {
          List<Unit> tobeRemoved = new ArrayList<Unit>();
         
          Unit succ = succsItr.next();
          List<Unit> predOfSuccs = this.unitToPreds.get(succ);
         

          for(Iterator<Unit> predItr = predOfSuccs.iterator(); predItr.hasNext(); )
          {
            Unit pred = predItr.next();
            if(pred == head)
              tobeRemoved.add(pred)
           
          }
         
View Full Code Here

Examples of soot.Unit

    List<Unit> tails = this.getTails();

    TailsLoop:   
    for(Iterator<Unit> itr = tails.iterator(); itr.hasNext(); )
    {
      Unit tail = itr.next();
      if(!(tail instanceof ThrowStmt))
        continue;
     
      DominatorNode x = dom.getDode(tail);
      DominatorNode parentOfX = dom.getParentOf(x);
      Object xgode = x.getGode();
      DominatorNode xpdomDode = pdom.getDode(xgode);
      Object parentXGode = parentOfX.getGode();
      DominatorNode parentpdomDode = pdom.getDode(parentXGode);
      //while x post-dominates its dominator (parent in dom)
      while(pdom.isDominatorOf(xpdomDode, parentpdomDode))
      {
        x = parentOfX;
        parentOfX = dom.getParentOf(x);
       
        //If parent is null we must be at the head of the graph
        if(parentOfX == null)
          //throw new RuntimeException("This should never have happened!");
          break;
       
        xgode = x.getGode();
        xpdomDode = pdom.getDode(xgode);
        parentXGode = parentOfX.getGode();
        parentpdomDode = pdom.getDode(parentXGode);
      }
     
      if(parentOfX != null)
        x = parentOfX;
     
      xgode = x.getGode();
      xpdomDode = pdom.getDode(xgode);
     
     
      Unit mergePoint = null;
     
      if(x2mergePoint.containsKey(xgode))
        mergePoint = x2mergePoint.get(xgode);
      else
      {
        //Now get all the children of x in the dom
       
        List<DominatorNode> domChilds = dom.getChildrenOf(x);
               
        Object child1god = null;
        Object child2god = null;
       
        for(Iterator<DominatorNode> domItr = domChilds.iterator(); domItr.hasNext(); )
        {
          DominatorNode child = domItr.next();
          Object childGode = child.getGode();
          DominatorNode childpdomDode = pdom.getDode(childGode);
         
         
          //we don't want to make a loop!
          List<Unit> path = this.getExtendedBasicBlockPathBetween((Unit)childGode, tail);
         
          //if(dom.isDominatorOf(child, dom.getDode(tail)))
          if(!(path == null || path.size() == 0))
            continue;
         
          if(pdom.isDominatorOf(childpdomDode, xpdomDode))
          {
            mergePoint = (Unit) child.getGode();       
            break;
          }         
                 
          //gather two eligible childs
          if(child1god == null)
            child1god = childGode;
          else if(child2god == null)
            child2god = childGode;
           
        }
       
        if(mergePoint == null)
        {
          if(child1god != null && child2god != null)
          {
            DominatorNode child1 = pdom.getDode(child1god);
            DominatorNode child2 = pdom.getDode(child2god);
 
            //go up the pdom tree and find the common parent of child1 and child2
            DominatorNode comParent = child1.getParent();
            while(comParent != null)
            {
              if(pdom.isDominatorOf(comParent, child2))
              {
                mergePoint = (Unit) comParent.getGode();
                break;
              }
              comParent = comParent.getParent();
            }
          }
          else if(child1god != null || child2god != null){
         
            DominatorNode y = null;
           
            if(child1god != null)
              y = pdom.getDode(child1god);
            else if(child2god != null)
              y = pdom.getDode(child2god);
           
             
            DominatorNode initialY = dom.getDode(y.getGode());
            DominatorNode yDodeInDom = initialY;
           
            while(dom.isDominatorOf(x, yDodeInDom))
            {
              y = y.getParent();
             
              //If this is a case where the childs of a conditional
              //are all throws, or returns, just forget it!
              if(y == null)
              {
                break ;
              }
              yDodeInDom = dom.getDode(y.getGode());
            }
            if(y != null)
              mergePoint = (Unit) y.getGode();
            else
              mergePoint = (Unit) initialY.getGode();
          }
        }
       
        //This means no (dom) child of x post-dominates x, so just use the child that is
        //immediately
        /*if(mergePoint == null)
        {
          //throw new RuntimeException("No child post-dominates x.");
          mergePoint = potentialMergePoint;
         
        }*/
        //This means no (dom) child of x post-dominates x, so just use the child that is
        //immediately. this means there is no good reliable merge point. So we just fetch the succ
        //of x in CFg so that the succ does not dominate the throw, and find the first
        //post-dom of the succ so that x does not dom it.
        //
        if(mergePoint == null)
        {
          List<Unit> xSucc = this.unitToSuccs.get(x.getGode());
          for(Iterator<Unit> uItr = xSucc.iterator(); uItr.hasNext(); )
          {
            Unit u = uItr.next();
            if(dom.isDominatorOf(dom.getDode(u), dom.getDode(tail)))
              continue;
           
           
            DominatorNode y = pdom.getDode(u);
View Full Code Here

Examples of soot.Unit

       
        /**
         * Find the real header of this handler block
         *
         */
        Unit handler = trap.getHandlerUnit();
       
        Unit pred = handler;
        while(this.unitToPreds.get(pred).size() > 0)
          pred = this.unitToPreds.get(pred).get(0);
       
       
        handler2header.put(handler, pred);
        /***********/
       
        /*
         * Keep this here for possible future changes.
         */
        /*GuardedBlock gb = new GuardedBlock(trap.getBeginUnit(), trap.getEndUnit());
        Unit ehnop;
        if(try2nop.containsKey(gb))
          ehnop = try2nop.get(gb);
        else
        {
          ehnop = new EHNopStmt();
          try2nop.put(gb, ehnop);
        }*/
       
       
        Unit ehnop;
        if(try2nop.containsKey(trap.getBeginUnit()))
          ehnop = try2nop.get(trap.getBeginUnit());
        else
        {
          ehnop = new EHNopStmt();
          try2nop.put(trap.getBeginUnit(), ehnop);
        }
               
    }
   
    //Only add a nop once
    Hashtable<Unit, Boolean> nop2added = new Hashtable<Unit, Boolean>();

    // Now actually add the edge
AddExceptionalEdge:
    for (Iterator<Trap> trapIt = body.getTraps().iterator(); trapIt.hasNext(); )
    {

        Trap trap = trapIt.next();
        Unit b = trap.getBeginUnit();
        Unit handler = trap.getHandlerUnit();
        handler = handler2header.get(handler);
       
       
        /**
         * Check if this trap is a finally trap that handles exceptions of an adjacent catch block;
         * what differentiates such trap is that it's guarded region has the same parent as the
         * handler of the trap itself, in the dom tree.
         *
         * The problem is that we don't have a complete DOM tree at this transient state.
         *
         * The work-around is to not process a trap that has already an edge pointing to it.
         *
         */
       
        if(this.unitToPreds.containsKey(handler))
        {
          List<Unit> handlerPreds = this.unitToPreds.get(handler);
          for(Iterator<Unit> preditr = handlerPreds.iterator(); preditr.hasNext(); )
            if(try2nop.containsValue(preditr.next()))
              continue AddExceptionalEdge;
             
        }
        else
          continue;

       
       
        //GuardedBlock gb = new GuardedBlock(b, e);
        Unit ehnop = try2nop.get(b);
               
        if(!nop2added.containsKey(ehnop))
        {
          List<Unit> predsOfB = getPredsOf(b);
          List<Unit> predsOfehnop = new ArrayList<Unit>(predsOfB);
         
          for(Iterator<Unit> itr = predsOfB.iterator(); itr.hasNext(); )
          {
            Unit a = itr.next();
            List<Unit> succsOfA = this.unitToSuccs.get(a);
            succsOfA.remove(b);
            succsOfA.add((Unit)ehnop);
          }
         
View Full Code Here

Examples of soot.Unit

    {
      Region r = itr.next();
      List<Unit> units = r.getUnits();
      for (Iterator<Unit> itr1 = units.iterator(); itr1.hasNext();)
      {
        Unit u = itr1.next();
        unit2region.put(u, r);
       
      }
    }
   
View Full Code Here

Examples of trackerModule.core.datastructure.Unit

   * @param illicitCargoPlan_shipName the illicit cargo plan_ship name
   */
  public void init(String shipType, String shipLocation, String illicitCargoPlan_shipName){
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Initialize ship's TDB
    Unit ships         = TDB.This().get("TDBROOT.MODEL.WORLD.SHIPS");
    Unit ship         = ships.create(getName());
    Unit mission      = ship.create("Mission");
    Unit departure       = ship.create("Departure");
    Unit location       = ship.create("Location");
    Unit destination    = ship.create("Destination");
    Unit type         = ship.create("Type");
    Unit InRoute         = ship.create("Route");
    Unit meeting       = ship.create("Meeting");
    Unit appearance       = ship.create("Appearance");
    Unit size         = ship.create("Size");
    Unit crew         = ship.create("Crew");
    Unit Latitude      = ship.create("Latitude");
    Unit Longitude      = ship.create("Longitude");
    Unit Speed        = ship.create("Speed");
    Unit soi         = ship.create("SOI");
    Unit state         = ship.create("State");
    Unit stateTime      = ship.create("StateTime");
    Unit stateTimeCount    = ship.create("StateTimeCount");
    Unit abnormalAction   = ship.create("AbnormalAction");
    Unit x           = ship.create("X");
    Unit y           = ship.create("Y");
    Unit IllicitCargoPlanShip  = ship.create("IllicitCargoPlan_Ship");
    Unit IllicitCargoPlanArea  = ship.create("IllicitCargoPlan_Area");
   
    // new continuous variables
//    Unit speedChange = ship.create("speedChange");
//    Unit turnRate = ship.create("turnRate");
//    Unit propellerTurnCount = ship.create("propellerTurnCount");
//    Unit cavitation = ship.create("cavitation");
//    Unit shipRCSChange = ship.create("shipRCSChange");
   
    // init the new continuous variables
//    speedChange.setData(0);
//    turnRate.setData(0);
//    propellerTurnCount.setData(0);
//    cavitation.setData(0);
//    shipRCSChange.setData(0);
   
    soi.setData(0.0);
   
    //set state
    state.setData("none");
    stateTime.setData(0);
    stateTimeCount.setData(0);
    Speed.setData(10.0);
    //set ship type
    if( shipType != null )
      type.setData(0, shipType);
    else
      type.setData(0, getShipType());
    //set mission
    mission.setData(0, getMission());
   
    //set information
    InRoute.setData(0, "Usual");
    meeting.setData(0, "none");
    IllicitCargoPlanArea.setData(0, "none");
    appearance.setData(0, "APP1");
    size.setData(0, getSize());
   
    //set initial location
    if( shipLocation!= null )
View Full Code Here

Examples of transientlibs.maps.units.Unit

        return onMap.tile[onX][onY].items.items.get(onMap.tile[onX][onY].items.items.size() - 1);
    }

    public GenericUnit produceUnit(int creatureID, int onX, int onY, TilelessMap onMap) {
        Unit newUnit;
        newUnit = new Unit(onX, onY, creatureID, onMap);
        if (onMap != null) {
            onMap.placeUnit(onX, onY, newUnit);
            //Log.info("Placed unit");
        } else {
            Log.error("No map!");
            //Detonator.INSTANCE.units.add(newUnit);
        }
       
        if (newUnit.creature.hasTag("pc")) {
            onMap.player = newUnit;
        }
       
        if (Detonator.INSTANCE.useGDXImages) {
            newUnit.setImage(newUnit.creature.masterImage);
        }

        if (newUnit.creature.cards != null) {
            Log.warn("DECK TIME");
            newUnit.deck = new Deck();
View Full Code Here

Examples of ucar.units.Unit

    TimeUnit tu = new TimeUnit(3.0, "hours");
    System.out.println(" TimeUnit.toString=      "+tu.toString());
    System.out.println(" TimeUnit.getValue=      "+tu.getValue());
    System.out.println(" TimeUnit.getUnitString= "+tu.getUnitString());

    Unit uu = tu.getUnit();
    showUnitInfo( uu);
    System.out.println();

    uu = SimpleUnit.makeUnit("3.0 hours");
    showUnitInfo( uu);
View Full Code Here

Examples of uk.org.woodcraft.bookings.datamodel.Unit

   
   
    Organisation orgWcf = new Organisation(TestConstants.ORG1_NAME, true);
    CannedQueries.save(orgWcf);
   
    Unit unit1 = new Unit(TestConstants.UNIT1_NAME, orgWcf, true);
    CannedQueries.save(unit1);
   
    User rootUser = new User("globaladmin@example.com", "Global Admin 1", "password", Accesslevel.GLOBAL_ADMIN);
    rootUser.setOrganisationKey(orgWcf.getKeyCheckNotNull());
    rootUser.setUnitKey(unit1.getKeyCheckNotNull());
    CannedQueries.save(rootUser);

    User orgUser = new User("orgbooking@example.com", "Org Booking Secretary 1", "password", Accesslevel.ORG_ADMIN);
    orgUser.setOrganisationKey(orgWcf.getKeyCheckNotNull());
    orgUser.setUnitKey(unit1.getKeyCheckNotNull());
    CannedQueries.save(orgUser);

    User unitUser = new User("unitbooking@example.com", "Unit Booking Secretary 1", "password", Accesslevel.UNIT_ADMIN);
    unitUser.setOrganisationKey(orgWcf.getKeyCheckNotNull());
    unitUser.setUnitKey(unit1.getKeyCheckNotNull());
    CannedQueries.save(unitUser);
   
   
    // And don't let this be repeated!
    AppSetting setupCompleteSetting = new AppSetting(AppSetting.SETUP_COMPLETE, "true");
View Full Code Here

Examples of units.Unit

    ID=IDIn;
    x=xIn;
    y=yIn;
  }
  public void eventIn(ClientGameState g) {
    Unit u=g.getUnits().get(ID);
    if(u != null){
      u.setOldLoc(u.getLoc());
      u.setLoc(new Point2D.Double(x,y));
      u.setTheta();
    }else{
      System.out.println("Wrong ID in doesnt map to unit!!!!!!! line 25 move unit");
    }
   
  }
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.