Пример #1
0
  public DecodedOrigin clone(Node node) throws CloneNotSupportedException {
    if (!(node instanceof DecodableEnsemble)) {
      throw new CloneNotSupportedException("Error cloning DecodedOrigin: Invalid node type");
    }

    try {
      DecodableEnsemble de = (DecodableEnsemble) node;

      DecodedOrigin result = (DecodedOrigin) super.clone();
      result.setDecoders(MU.clone(myDecoders));

      Function[] functions = new Function[myFunctions.length];
      for (int i = 0; i < functions.length; i++) {
        functions[i] = myFunctions[i].clone();
      }
      result.myFunctions = functions;

      result.myNodeOrigin = myNodeOrigin;
      result.myNodes = de.getNodes();
      result.myNode = de;
      result.myOutput = (RealOutput) myOutput.clone();
      if (myNoise != null) {
        result.setNoise(myNoise.clone());
      }
      result.setMode(myMode);
      return result;
    } catch (CloneNotSupportedException e) {
      throw new CloneNotSupportedException("Error cloning DecodedOrigin: " + e.getMessage());
    }
  }
  /**
   * @설명 : Cyworld 사진첩 게시물 목록보기 @RequestURI :
   * https://apis.skplanetx.com/cyworld/minihome/{cyId}/albums/{folderNo}/items
   */
  private void initCyPhotoAlbumList(int folderNo) {

    // Querystring Parameters
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("page", 1); // 조회할 목록의 페이지를 지정합니다.
    map.put("count", 20); // 페이지당 출력되는 게시물 수를 지정합니다.

    // Bundle 생성
    RequestBundle bundle =
        AsyncRequester.make_GET_DELTE_bundle(
            this,
            Define.CYWORLD_MINIHOME_URI + mBestiesInfo.cyId + "/albums/" + folderNo + "/items",
            map);

    try {
      AsyncRequester.request(
          CyworldPhotoListActivity.this,
          bundle,
          HttpMethod.GET,
          new EntityParserHandler(
              new EntityCyPhoto(),
              new OnEntityParseComplete() {

                @Override
                public void onParsingComplete(Object entityArray) {
                  mPhotoArray = (ArrayList<EntityCyPhoto>) entityArray;

                  mPhotoAdapter.setCyworldPhotoList(mPhotoArray);
                  setListAdapter(mPhotoAdapter);
                }
              }));
    } catch (CloneNotSupportedException e) {
      e.printStackTrace();
    }
  }
Пример #3
0
  protected void reset() {
    paused = false;
    Sprite.spriteContext = this;
    sprites.clear();

    try {
      level = currentLevel.clone();
    } catch (CloneNotSupportedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    level.resetSpriteTemplate();

    layer = new LevelRenderer(level, graphicsConfiguration, 320, 240);

    double oldX = 0;

    if (mario != null) oldX = mario.x;

    mario = new Mario(this);
    sprites.add(mario);
    startTime = 1;

    timeLeft = 200 * 15;
    Art.startMusic(1);
    tick = 0;
    //        recorder = new DataRecorder(this,level,keys,gametype);
    if (recorder != null) {
      recorder.detailedLog = "";
    }
    gameStarted = false;
  }
Пример #4
0
  /**
   * Returns a shallow copy of this graph instance. Neither edges nor vertices are cloned.
   *
   * @return a shallow copy of this set.
   * @throws RuntimeException
   * @see java.lang.Object#clone()
   */
  public Object clone() {
    try {
      TypeUtil<AbstractBaseGraph<V, E>> typeDecl = null;

      AbstractBaseGraph<V, E> newGraph = TypeUtil.uncheckedCast(super.clone(), typeDecl);

      newGraph.edgeMap = new LinkedHashMap<E, IntrusiveEdge>();

      newGraph.edgeFactory = this.edgeFactory;
      newGraph.unmodifiableEdgeSet = null;
      newGraph.unmodifiableVertexSet = null;

      // NOTE:  it's important for this to happen in an object
      // method so that the new inner class instance gets associated with
      // the right outer class instance
      newGraph.specifics = newGraph.createSpecifics();

      Graphs.addGraph(newGraph, this);

      return newGraph;
    } catch (CloneNotSupportedException e) {
      e.printStackTrace();
      throw new RuntimeException();
    }
  }
Пример #5
0
  /**
   * clone a copy of oclOperator
   *
   * @throws CloneNotSupportedException
   * @return Object
   */
  public Object clone() throws CloneNotSupportedException {
    try {
      oclEvent op = new oclEvent();
      op.opName = (oclPredicate) opName.clone();

      ListIterator li = prevail.listIterator();
      while (li.hasNext()) {
        oclSE se = (oclSE) li.next();
        op.addPrevSE((oclSE) se.clone());
      }

      li = necessary.listIterator();
      while (li.hasNext()) {
        oclSC sc = (oclSC) li.next();
        op.addNecSC((oclSC) sc.clone());
      }

      li = conditional.listIterator();
      while (li.hasNext()) {
        oclSC sc = (oclSC) li.next();
        op.addCondSC((oclSC) sc.clone());
      }

      return op;
    } catch (CloneNotSupportedException e) {
      Utility.debugPrintln("Failed to clone event component + " + e.toString());
      throw e;
    }
  }
  /** Confirm that cloning works. */
  public void testCloning() {
    // test default instance
    DialBackground b1 = new DialBackground();
    DialBackground b2 = null;
    try {
      b2 = (DialBackground) b1.clone();
    } catch (CloneNotSupportedException e) {
      e.printStackTrace();
    }
    assertTrue(b1 != b2);
    assertTrue(b1.getClass() == b2.getClass());
    assertTrue(b1.equals(b2));

    // test a customised instance
    b1 = new DialBackground();
    b1.setPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.green));
    b1.setGradientPaintTransformer(
        new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_VERTICAL));
    b2 = null;
    try {
      b2 = (DialBackground) b1.clone();
    } catch (CloneNotSupportedException e) {
      e.printStackTrace();
    }
    assertTrue(b1 != b2);
    assertTrue(b1.getClass() == b2.getClass());
    assertTrue(b1.equals(b2));

    // check that the listener lists are independent
    MyDialLayerChangeListener l1 = new MyDialLayerChangeListener();
    b1.addChangeListener(l1);
    assertTrue(b1.hasListener(l1));
    assertFalse(b2.hasListener(l1));
  }
  private void handlePayeeFocusChange() {
    if (modTrans == null
        && Options.useAutoCompleteProperty().get()
        && payeeTextField.getLength() > 0) {
      if (payeeTextField.autoCompleteModelObjectProperty().get() != null) {

        // The auto complete model may return multiple solutions.  Choose the first solution that
        // works
        final List<Transaction> transactions =
            new ArrayList<>(
                payeeTextField
                    .autoCompleteModelObjectProperty()
                    .get()
                    .getAllExtraInfo(payeeTextField.getText()));

        Collections.reverse(transactions); // reverse the transactions, most recent first

        for (final Transaction transaction : transactions) {
          if (canModifyTransaction(transaction)) {
            try {
              modifyTransaction(
                  modifyTransactionForAutoComplete((Transaction) transaction.clone()));
            } catch (final CloneNotSupportedException e) {
              Logger.getLogger(getClass().getName()).log(Level.SEVERE, e.getMessage(), e);
            }
            modTrans = null; // clear the modTrans field  TODO: use new transaction instead?
            break;
          }
        }
      }
    }
  }
  public Object clone(IEditableReportEditGroupOwnerBean newowner) {
    try {
      AbsEditableReportEditDataBean newbean = (AbsEditableReportEditDataBean) super.clone();
      newbean.setOwner(newowner);
      if (this.lstEditActionGroupBeans != null) {
        List<EditActionGroupBean> lstGroupBeansNew = new ArrayList<EditActionGroupBean>();
        for (EditActionGroupBean groupBeanTmp : lstEditActionGroupBeans) {
          lstGroupBeansNew.add((EditActionGroupBean) groupBeanTmp.clone(newbean));
        }
        newbean.setLstEditActionGroupBeans(lstGroupBeansNew);
      }

      if (lstExternalValues != null) {
        List<EditableReportExternalValueBean> lstExternalValuesNew =
            new ArrayList<EditableReportExternalValueBean>();
        for (EditableReportExternalValueBean valueBeanTmp : lstExternalValues) {
          lstExternalValuesNew.add((EditableReportExternalValueBean) valueBeanTmp.clone());
        }
        newbean.setLstExternalValues(lstExternalValuesNew);
      }
      return newbean;
    } catch (CloneNotSupportedException e) {
      e.printStackTrace();
      return null;
    }
  }
Пример #9
0
 public Object clone() {
   try {
     return super.clone();
   } catch (CloneNotSupportedException e) {
     throw new InternalError(e.getMessage());
   }
 }
Пример #10
0
 public CustomNPC(NPCData data) {
   super();
   this.data = data;
   growth = data.getGrowth();
   preferredAttributes = new ArrayList<PreferredAttribute>(data.getPreferredAttributes());
   character = new NPC(data.getName(), data.getStats().level, this);
   character.outfitPlan.addAll(data.getTopOutfit());
   character.outfitPlan.addAll(data.getBottomOutfit());
   character.closet.addAll(character.outfitPlan);
   character.change(Modifier.normal);
   character.att = new HashMap<Attribute, Integer>(data.getStats().attributes);
   character.traits = new HashSet<Trait>(data.getStats().traits);
   character.getArousal().setMax(data.getStats().arousal);
   character.getStamina().setMax(data.getStats().stamina);
   character.getMojo().setMax(data.getStats().mojo);
   character.getWillpower().setMax(data.getStats().willpower);
   character.setTrophy(data.getTrophy());
   character.plan = data.getPlan();
   character.mood = Emotion.confident;
   character.custom = true;
   try {
     character.body = data.getBody().clone(character);
   } catch (CloneNotSupportedException e) {
     e.printStackTrace();
     character.body = new Body(character);
   }
   character.body.finishBody(data.getSex());
   for (ItemAmount i : data.getStartingItems()) {
     character.gain(i.item, i.amount);
     ;
   }
   Global.gainSkills(character);
 }
Пример #11
0
  /**
   * Creates a deep copy of the cluster: segments in the new cluster are copies of the original
   * segments, not references.
   *
   * @return the object
   */
  @Override
  public Cluster clone() {
    Cluster result = null;
    try {
      result = (Cluster) (super.clone());
    } catch (CloneNotSupportedException e) {
      logger.log(Level.SEVERE, "", e);
      e.printStackTrace();
    }
    result.segmentSet = new TreeSet<Segment>();
    for (Segment segment : segmentSet) {
      result.segmentSet.add((segment.clone()));
    }
    result.informationMap = new TreeMap<String, Object>(new StringComparator());
    for (String key : informationMap.keySet()) {
      result.setInformation(key, informationMap.get(key));
    }

    result.modelScores = new ModelScores();
    for (String key : modelScores.keySet()) {
      result.modelScores.put(key, modelScores.get(key));
    }

    result.speakerNameSet = (SpeakerNameSet) speakerNameSet.clone();

    return result;
  }
Пример #12
0
 /**
  * Overrides the standard <code>java.lang.Object.clone</code> method to return a copy of this
  * cookie.
  */
 public Object clone() throws CloneNotSupportedException {
   try {
     return super.clone();
   } catch (CloneNotSupportedException e) {
     throw new RuntimeException(e.getMessage());
   }
 }
Пример #13
0
  /**
   * Clones a <code>List</code> of <code>TransactionEntry(s)</code>
   *
   * @param fees <code>List</code> of fees to clone
   */
  public void setTransactionEntries(final List<TransactionEntry> fees) {
    feeList = new ArrayList<>();

    if (fees.size() == 1) {
      TransactionEntry e = fees.get(0);

      if (e.getCreditAccount().equals(e.getDebitAccount())) {
        feeField.setDecimal(e.getAmount(account).abs());
      } else {
        try {
          feeList.add((TransactionEntry) e.clone()); // copy over the provided set's entry
        } catch (CloneNotSupportedException e1) {
          Logger.getLogger(FeePanel.class.getName())
              .log(Level.SEVERE, e1.getLocalizedMessage(), e1);
        }
        feeField.setDecimal(sumFees().abs());
      }
    } else {
      for (TransactionEntry entry : fees) { // clone the provided set's entries
        try {
          feeList.add((TransactionEntry) entry.clone());
        } catch (CloneNotSupportedException e) {
          Logger.getLogger(FeePanel.class.getName()).log(Level.SEVERE, e.toString(), e);
        }
      }

      feeField.setDecimal(sumFees().abs());
    }

    feeField.setEditable(feeList.size() < 1);
  }
Пример #14
0
 public AccountOtherCommonMaster toDisp(boolean withDetail) {
   AccountOtherCommonMaster master = null;
   try {
     master = (AccountOtherCommonMaster) super.clone();
   } catch (CloneNotSupportedException e) {
     e.printStackTrace();
   }
   master.setBusinessUnit(
       new BusinessUnits(this.getBusinessUnit().getId(), this.getBusinessUnit().getName()));
   master.setEmployee(new Employee(this.getEmployee().getId(), this.getEmployee().getName()));
   if (this.fundAccount != null) {
     master.setFundAccount(
         new FundAccount(this.getFundAccount().getId(), this.getFundAccount().getName()));
   }
   if (withDetail) {
     List<AccountOtherCommonDetail> details = master.getDetails();
     int size = details.size();
     for (int i = 0; i < size; i++) {
       AccountOtherCommonDetail masterdetail = details.get(i);
       masterdetail.setMaster(null);
       Bursary bursary =
           new Bursary(masterdetail.getBursary().getId(), masterdetail.getBursary().getFullName());
       masterdetail.setBursary(bursary);
     }
   } else {
     master.getDetails().clear();
   }
   return master;
 }
Пример #15
0
  /** Confirm that cloning works. */
  public void testCloning() {
    DefaultXYDataset d1 = new DefaultXYDataset();
    DefaultXYDataset d2 = null;
    try {
      d2 = (DefaultXYDataset) d1.clone();
    } catch (CloneNotSupportedException e) {
      e.printStackTrace();
    }
    assertTrue(d1 != d2);
    assertTrue(d1.getClass() == d2.getClass());
    assertTrue(d1.equals(d2));

    // try a dataset with some content...
    double[] x1 = new double[] {1.0, 2.0, 3.0};
    double[] y1 = new double[] {4.0, 5.0, 6.0};
    double[][] data1 = new double[][] {x1, y1};
    d1.addSeries("S1", data1);
    try {
      d2 = (DefaultXYDataset) d1.clone();
    } catch (CloneNotSupportedException e) {
      e.printStackTrace();
    }
    assertTrue(d1 != d2);
    assertTrue(d1.getClass() == d2.getClass());
    assertTrue(d1.equals(d2));

    // check that the clone doesn't share the same underlying arrays.
    x1[1] = 2.2;
    assertFalse(d1.equals(d2));
    x1[1] = 2.0;
    assertTrue(d1.equals(d2));
  }
Пример #16
0
  @Override
  public void useParametersFrom(FilterRepresentation a) {
    if (a instanceof FilterDrawRepresentation) {
      FilterDrawRepresentation representation = (FilterDrawRepresentation) a;
      mParamColor.copyPalletFrom(representation.mParamColor);
      try {
        if (representation.mCurrent != null) {
          mCurrent = (StrokeData) representation.mCurrent.clone();
        } else {
          mCurrent = null;
        }
        if (representation.mDrawing != null) {
          mDrawing = new Vector<StrokeData>();
          for (Iterator<StrokeData> elem = representation.mDrawing.iterator(); elem.hasNext(); ) {
            StrokeData next = elem.next();
            mDrawing.add(new StrokeData(next));
          }
        } else {
          mDrawing = null;
        }

      } catch (CloneNotSupportedException e) {
        e.printStackTrace();
      }
    } else {
      Log.v(LOGTAG, "cannot use parameters from " + a);
    }
  }
Пример #17
0
  /** TarHeaders can be cloned. */
  public Object clone() {
    TarHeader hdr = null;

    try {
      hdr = (TarHeader) super.clone();

      hdr.name = (this.name == null) ? null : new StringBuffer(this.name.toString());
      hdr.mode = this.mode;
      hdr.userId = this.userId;
      hdr.groupId = this.groupId;
      hdr.size = this.size;
      hdr.modTime = this.modTime;
      hdr.checkSum = this.checkSum;
      hdr.linkFlag = this.linkFlag;
      hdr.linkName = (this.linkName == null) ? null : new StringBuffer(this.linkName.toString());
      hdr.magic = (this.magic == null) ? null : new StringBuffer(this.magic.toString());
      hdr.userName = (this.userName == null) ? null : new StringBuffer(this.userName.toString());
      hdr.groupName = (this.groupName == null) ? null : new StringBuffer(this.groupName.toString());
      hdr.devMajor = this.devMajor;
      hdr.devMinor = this.devMinor;
    } catch (CloneNotSupportedException ex) {
      ex.printStackTrace(System.err);
    }

    return hdr;
  }
  /** Confirm that cloning works. */
  public void testCloning() {
    // try a default instance
    StandardDialScale s1 = new StandardDialScale();
    StandardDialScale s2 = null;
    try {
      s2 = (StandardDialScale) s1.clone();
    } catch (CloneNotSupportedException e) {
      e.printStackTrace();
    }
    assertTrue(s1 != s2);
    assertTrue(s1.getClass() == s2.getClass());
    assertTrue(s1.equals(s2));

    // try a customised instance
    s1 = new StandardDialScale();
    s1.setExtent(123.4);
    s1.setMajorTickPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.white));
    s1.setMajorTickStroke(new BasicStroke(2.0f));
    s2 = null;
    try {
      s2 = (StandardDialScale) s1.clone();
    } catch (CloneNotSupportedException e) {
      e.printStackTrace();
    }
    assertTrue(s1 != s2);
    assertTrue(s1.getClass() == s2.getClass());
    assertTrue(s1.equals(s2));

    // check that the listener lists are independent
    MyDialLayerChangeListener l1 = new MyDialLayerChangeListener();
    s1.addChangeListener(l1);
    assertTrue(s1.hasListener(l1));
    assertFalse(s2.hasListener(l1));
  }
Пример #19
0
  /**
   * Writes the chart as the pdf file by an author and subject.
   *
   * @param author the pdf author string
   * @param subject the pdf subject string
   */
  public void write(final String author, final String subject) {
    JFreeChart chart = chartPanel.getChart();

    final String filePath = fileSelector.saveFile(chart.getTitle().getText() + ".pdf");
    if (filePath == null) {
      return;
    }

    try {
      final JFreeChart chartClone = (JFreeChart) chart.clone();
      chartClone.setBorderVisible(true);
      chartClone.setPadding(new RectangleInsets(2D, 2D, 2D, 2D));

      SwingUtilities.invokeLater(
          new Runnable() {
            public void run() {
              try {
                ChartPDFUtil.writeChartAsPDF(
                    filePath,
                    chartClone,
                    chartPanel.getWidth(),
                    chartPanel.getHeight(),
                    author,
                    subject);
              } catch (IOException e) {
                e.printStackTrace();
              } catch (DocumentException e) {
                e.printStackTrace();
              }
            }
          });
    } catch (CloneNotSupportedException e) {
      e.printStackTrace();
    }
  }
Пример #20
0
 public Vehicle clone() throws CloneNotSupportedException {
   try {
     return (Vehicle) super.clone();
   } catch (CloneNotSupportedException e) {
     throw new InternalError(e.toString());
   }
 }
Пример #21
0
  /*
   * (non-Javadoc)
   *
   * @see java.lang.Runnable#run()
   */
  @Override
  public void run() {

    DefaultWriteFileHandler defaultWriteFileHandler = new DefaultWriteFileHandler();

    while (this.isRun.get()) {
      BaseTransData data = null;
      synchronized (TransQueue.COMMONTABLENAMEOBJ) {
        if (TransQueue.COMMONTABLENAMEQUEUE.isEmpty()) {
          try {
            TransQueue.COMMONTABLENAMEOBJ.wait();
          } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
        } else {
          data = TransQueue.COMMONTABLENAMEQUEUE.poll();
        }
      }
      if (data != null) {
        while (data.getData()) {
          try {
            BaseTransData baseTransData = data.clone();
            defaultWriteFileHandler.addQueue(baseTransData);
          } catch (CloneNotSupportedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
        }

      } else {
        logger.error("error");
      }
    }
  }
Пример #22
0
  public PooledEntity GetPooledEntity(Entity entity, float time) {
    synchronized (m_available) {
      if (!m_available.isEmpty()) {
        PooledEntity ent = m_available.get(0);
        ent.m_data.SetActive(true);
        try {
          ent.m_data.SetTransform((Transform2D) entity.GetTransform().clone());
        } catch (CloneNotSupportedException ex) {
          ex.printStackTrace();
        }
        ent.SetLife(time);

        m_inUse.add(ent);
        m_available.remove(0);
        return ent;
      } else {
        Entity entity_copy = entity.GetCopy();
        entity_copy.SetActive(true);

        PooledEntity ent = new PooledEntity(entity_copy, time);
        m_inUse.add(ent);
        return ent;
      }
    }
  }
Пример #23
0
 /**
  * generatorBusinessKey (根据一条主键数据,生成业务主键)
  *
  * @param TPk
  * @author Bill huang
  * @return String
  * @exception
  * @since 1.0.0
  */
 protected synchronized String generatorBusinessKey(TPk wt) {
   // 查询一条主键数据
   TPk tpk = this.getTPKByEntity(wt);
   if (tpk == null) {
     return null;
   }
   StringBuffer key = new StringBuffer();
   TPk t = null;
   // 将主键数据拷贝出来一个副本,直接对副本的数据进行操作
   try {
     t = (TPk) tpk.clone();
   } catch (CloneNotSupportedException e) {
     log.debug(e.getMessage(), e);
     t = new TPk();
     BeanUtils.copyProperties(tpk, t);
   }
   // 对副本的数据进行前缀处理
   this.doPreProcess(t, key);
   // 对副本的数据进行中间数据增长处理
   this.doMiddleProcess(t, key);
   // 对副本的数据进行后缀处理
   this.doSufProcess(t, key);
   tpk.setCurval(t.getCurval());
   // 生成完成后的主键数据更新到数据库
   this.saveOrUpdateTPk(tpk);
   return key.toString();
 }
Пример #24
0
  @Override
  public PCClass clone() {
    PCClass aClass = null;

    try {
      aClass = (PCClass) super.clone();

      List<KnownSpellIdentifier> ksl = getListFor(ListKey.KNOWN_SPELLS);
      if (ksl != null) {
        aClass.removeListFor(ListKey.KNOWN_SPELLS);
        for (KnownSpellIdentifier ksi : ksl) {
          aClass.addToListFor(ListKey.KNOWN_SPELLS, ksi);
        }
      }
      Map<AttackType, Integer> acmap = getMapFor(MapKey.ATTACK_CYCLE);
      if (acmap != null && !acmap.isEmpty()) {
        aClass.removeMapFor(MapKey.ATTACK_CYCLE);
        for (Map.Entry<AttackType, Integer> me : acmap.entrySet()) {
          aClass.addToMapFor(MapKey.ATTACK_CYCLE, me.getKey(), me.getValue());
        }
      }

      aClass.levelMap = new TreeMap<>();
      for (Map.Entry<Integer, PCClassLevel> me : levelMap.entrySet()) {
        aClass.levelMap.put(me.getKey(), me.getValue().clone());
      }
    } catch (CloneNotSupportedException exc) {
      ShowMessageDelegate.showMessageDialog(
          exc.getMessage(), Constants.APPLICATION_NAME, MessageType.ERROR);
    }

    return aClass;
  }
Пример #25
0
 @Override
 public LargeMailUser clone() {
   LargeMailUser copy;
   try {
     copy = ((LargeMailUser) super.clone());
   } catch (CloneNotSupportedException _x) {
     throw new InternalError((_x.toString()));
   }
   copy.addressLine = new ArrayList<AddressLine>((getAddressLine().size()));
   for (AddressLine iter : addressLine) {
     copy.addressLine.add(iter.clone());
   }
   copy.largeMailUserName =
       new ArrayList<LargeMailUser.LargeMailUserName>((getLargeMailUserName().size()));
   for (LargeMailUser.LargeMailUserName iter : largeMailUserName) {
     copy.largeMailUserName.add(iter.clone());
   }
   copy.largeMailUserIdentifier =
       ((largeMailUserIdentifier == null)
           ? null
           : ((LargeMailUser.LargeMailUserIdentifier) largeMailUserIdentifier.clone()));
   copy.buildingName = new ArrayList<BuildingName>((getBuildingName().size()));
   for (BuildingName iter : buildingName) {
     copy.buildingName.add(iter.clone());
   }
   copy.department = ((department == null) ? null : ((Department) department.clone()));
   copy.postBox = ((postBox == null) ? null : ((PostBox) postBox.clone()));
   copy.thoroughfare = ((thoroughfare == null) ? null : ((Thoroughfare) thoroughfare.clone()));
   copy.postalCode = ((postalCode == null) ? null : ((PostalCode) postalCode.clone()));
   copy.any = new ArrayList<Object>((getAny().size()));
   for (Object iter : any) {
     copy.any.add(iter);
   }
   return copy;
 }
Пример #26
0
 public ProductPlanMaster toDisp(boolean withDetail) {
   ProductPlanMaster master = null;
   try {
     master = (ProductPlanMaster) super.clone();
   } catch (CloneNotSupportedException e) {
     e.printStackTrace();
   }
   master.setPlanEmployee(
       new Employee(this.getPlanEmployee().getId(), this.getPlanEmployee().getName()));
   master.setExecuteEmployee(
       new Employee(this.getExecuteEmployee().getId(), this.getExecuteEmployee().getName()));
   if (withDetail) {
     List<ProductPlanDetail> details = master.getDetails();
     int size = details.size();
     for (int i = 0; i < size; i++) {
       ProductPlanDetail masterdetail = details.get(i);
       masterdetail.setProductPlanMaster(null);
       Product product = masterdetail.getProduct();
       masterdetail.setProduct(
           new Product(
               product.getId(),
               product.getFullName(),
               product.getItem(),
               product.getSpecification(),
               product.getUnit(),
               product.getColor()));
     }
   } else {
     master.getDetails().clear();
   }
   return master;
 }
Пример #27
0
 /** 克隆对象 */
 public Auth clone() {
   try {
     return (Auth) super.clone();
   } catch (CloneNotSupportedException e) {
     throw new RuntimeException(e.getMessage(), e);
   }
 }
Пример #28
0
  /**
   * Set the behavior of the current editing component to display the specified lines of formatted
   * text when the client hovers over the text.
   *
   * <p>Tooltips do not inherit display characteristics, such as color and styles, from the message
   * component on which they are applied.
   *
   * @param lines The lines of formatted text which will be displayed to the client upon hovering.
   * @return This builder instance.
   */
  public FancyMessage formattedTooltip(FancyMessage... lines) {
    if (lines.length < 1) {
      onHover(null, null); // Clear tooltip
      return this;
    }

    FancyMessage result = new FancyMessage();
    result.messageParts
        .clear(); // Remove the one existing text component that exists by default, which
    // destabilizes the object

    for (int i = 0; i < lines.length; i++) {
      try {
        for (MessagePart component : lines[i]) {
          if (component.clickActionData != null && component.clickActionName != null) {
            throw new IllegalArgumentException("The tooltip text cannot have click data.");
          } else if (component.hoverActionData != null && component.hoverActionName != null) {
            throw new IllegalArgumentException("The tooltip text cannot have a tooltip.");
          }
          if (component.hasText()) {
            result.messageParts.add(component.clone());
          }
        }
        if (i != lines.length - 1) {
          result.messageParts.add(new MessagePart(rawText("\n")));
        }
      } catch (CloneNotSupportedException e) {
        e.printStackTrace();
        return this;
      }
    }
    return formattedTooltip(
        result.messageParts.size() == 0 ? null : result); // Throws NPE if size is 0, intended
  }
Пример #29
0
 public AccountCommonMaster toDisp(boolean withDetail) {
   AccountCommonMaster master = null;
   try {
     master = (AccountCommonMaster) super.clone();
   } catch (CloneNotSupportedException e) {
     e.printStackTrace();
   }
   master.setBusinessUnit(
       new BusinessUnits(this.getBusinessUnit().getId(), this.getBusinessUnit().getName()));
   master.setEmployee(new Employee(this.getEmployee().getId(), this.getEmployee().getName()));
   if (this.fundAccount != null) {
     master.setFundAccount(
         new FundAccount(this.getFundAccount().getId(), this.getFundAccount().getName()));
   }
   if (withDetail) {
     List<AccountCommonDetail> details = master.getDetails();
     int size = details.size();
     for (int i = 0; i < size; i++) {
       AccountCommonDetail masterdetail = details.get(i);
       masterdetail.setMaster(null);
       ProductCommonMaster productMaster = masterdetail.getProductMaster();
       masterdetail.setProductMaster(productMaster.toDisp(false));
       //				productMaster.getProductOrderBills().clear();
       //				productMaster.getProductPlans().clear();
       // master.getDetails().add(masterdetail);
     }
   } else {
     master.getDetails().clear();
   }
   return master;
 }
Пример #30
0
 public static Query createQuery() {
   try {
     return (Query) prototypeObj.clone();
   } catch (CloneNotSupportedException e) {
     e.printStackTrace();
     return null;
   }
 }