@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; }
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()); } }
public Object clone() { try { return super.clone(); } catch (CloneNotSupportedException e) { throw new InternalError(e.getMessage()); } }
/** * 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(); }
/** 克隆对象 */ public Auth clone() { try { return (Auth) super.clone(); } catch (CloneNotSupportedException e) { throw new RuntimeException(e.getMessage(), e); } }
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; } } } } }
/** * 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()); } }
@Override public Object clone() { try { return super.clone(); } catch (CloneNotSupportedException e) { throw new RuntimeException("Clone not supported: " + e.getMessage()); } }
/** * Get a fresh copy of the object. For use with variables. * * @return A fresh nodelist. */ public XObject getFresh() { try { if (hasCache()) return (XObject) cloneWithReset(); else return this; // don't bother to clone... won't do any good! } catch (CloneNotSupportedException cnse) { throw new RuntimeException(cnse.getMessage()); } }
/** * Cast result object to a nodelist. * * @return The nodeset as a nodelist */ public DTMIterator iter() { try { if (hasCache()) return cloneWithReset(); else return this; // don't bother to clone... won't do any good! } catch (CloneNotSupportedException cnse) { throw new RuntimeException(cnse.getMessage()); } }
@Override public BaseCloneable clone() { try { return (BaseCloneable) super.clone(); } catch (final CloneNotSupportedException ex) { throw new InternalError(ex.getMessage()); } }
@Test public void testResolve_Command() { System.out.println( "Commands resolving a set of references mixed with text like 'temperature is @event.temperature'"); Command c = new Command(); c.setName("say something using TTS"); c.setProperty("zero", "@event.temperature"); c.setProperty("one", "temperature is @event.temperature."); c.setProperty("two", "temperature is @event.temperature#celsius degree."); c.setProperty("three", "temperature in @event.zone is @event.temperature."); c.setProperty("four", "temperature in @event.zone is @event.temperature celsius degree."); c.setProperty( "five", "temperature in @event.zone is @event.temperature celsius degree. @event.zone# is hot because temperature is [email protected]°C."); c.setProperty("six", "temperature in @event.zone is managed by object @event.object.name#."); // testing scripting c.setProperty( "seven", "= seven=\"Current temperature is @event.temperature celsius degrees. In fahrenheit is \" + Math.floor(((@event.temperature+40)*1.8)-40) + \" degrees.\";"); c.setProperty("eight", "= eight=10+5;"); // this always returns a double c.setProperty( "nine", "= nine=Math.floor(10+5).toString();"); // print the number as is to avoid conversion to // double // c.setProperty("ten", "= if (@event.temperature<= 20) ten=2; else // [email protected]/10;"); GenericEvent event = new GenericEvent(this); event.addProperty("zone", "Kitchen"); event.addProperty("temperature", "25"); event.addProperty("object.name", "Indoor Thermometer"); Resolver resolver = new Resolver(); resolver.addContext("event.", event.getPayload()); Command result = new Command(); try { result = resolver.resolve(c); } catch (CloneNotSupportedException ex) { Assert.fail(ex.getMessage()); } catch (VariableResolutionException ex) { Assert.fail(ex.getMessage()); } assertEquals("25", result.getProperty("zero")); assertEquals("temperature is 25.", result.getProperty("one")); assertEquals("temperature is 25celsius degree.", result.getProperty("two")); assertEquals("temperature in Kitchen is 25.", result.getProperty("three")); assertEquals("temperature in Kitchen is 25 celsius degree.", result.getProperty("four")); assertEquals( "temperature in Kitchen is 25 celsius degree. Kitchen is hot because temperature is +25°C.", result.getProperty("five")); assertEquals( "temperature in Kitchen is managed by object Indoor Thermometer.", result.getProperty("six")); assertEquals( "Current temperature is 25 celsius degrees. In fahrenheit is 77 degrees.", result.getProperty("seven")); // assertEquals("15.0", result.getProperty("eight")); // assertEquals("15", result.getProperty("nine")); // assertEquals("15", result.getProperty("ten")); }
public StPreset clone() { try { return (StPreset) super.clone(); } catch (CloneNotSupportedException e) { log.debug("Cloning Preset failed! " + e.getMessage()); e.printStackTrace(log.getDebugPrintWriter()); } return this; }
public Liner clone() { try { return (Liner) super.clone(); } catch (CloneNotSupportedException ex) { InternalError error = new InternalError(ex.getMessage()); error.initCause(ex); throw error; } }
public PrimerPack clone() { try { return (PrimerPack) super.clone(); } catch (CloneNotSupportedException cnse) { // Implements cloneable so should never happen throw new InternalError(cnse.getMessage()); } }
@Override public Object clone() { try { ArrayList1D clone = (ArrayList1D) super.clone(); JdoDelegateAction.getInstance().clone(clone); return clone; } catch (CloneNotSupportedException exc) { throw new InternalError("This can't happen : " + exc.getMessage()); } }
@Override public TraversalSideEffects clone() { try { final MemoryTraversalSideEffects clone = (MemoryTraversalSideEffects) super.clone(); clone.sideEffects = this.sideEffects.clone(); return clone; } catch (final CloneNotSupportedException e) { throw new IllegalStateException(e.getMessage(), e); } }
/** * Create copy of this iterator, all status including current position is kept. * * @return copy of this iterator */ @Override public Object clone() { try { BreakIterator cloned = (BreakIterator) super.clone(); cloned.wrapped = (com.ibm.icu4jni.text.BreakIterator) wrapped.clone(); return cloned; } catch (CloneNotSupportedException e) { throw new InternalError(e.getMessage()); } }
@SuppressWarnings("unchecked") public <T> T clone(Class<T> clase) { try { return (T) super.clone(); } catch (CloneNotSupportedException e) { e.getMessage(); logger.error("Clone no soportado para " + this.getClass()); return null; } }
/** * Returns a clone of this builder. * * @return the clone */ @Override public Object clone() { try { ContactBuilder result = (ContactBuilder) super.clone(); result.self = result; return result; } catch (CloneNotSupportedException e) { throw new InternalError(e.getMessage()); } }
@Override public DefaultTraversalStrategies clone() { try { final DefaultTraversalStrategies clone = (DefaultTraversalStrategies) super.clone(); clone.traversalStrategies = new ArrayList<>(); clone.traversalStrategies.addAll(this.traversalStrategies); return clone; } catch (final CloneNotSupportedException e) { throw new IllegalStateException(e.getMessage(), e); } }
@Override public TraversalRing<A, B> clone() { try { final TraversalRing<A, B> clone = (TraversalRing<A, B>) super.clone(); clone.traversals = new ArrayList<>(); for (final Traversal.Admin<A, B> traversal : this.traversals) { clone.addTraversal(traversal.clone()); } return clone; } catch (final CloneNotSupportedException e) { throw new IllegalStateException(e.getMessage(), e); } }
private ArrayList<INJTestJob> get_S_test_Jobs() { ArrayList<INJTestJob> jobns = new ArrayList<INJTestJob>(); for (AbstractTestTask task : tasks) { try { jobns.add(new INJTestJob((INJTask) task, tm, mSgdEnvironnement.clone(), this)); } catch (CloneNotSupportedException e) { if (ConfigApp.DEBUG) { System.out.println("Job is not added due to: " + e.getMessage()); } } } System.out.println("List of job: " + jobns.size()); return jobns; }
@Override public Period clone() { Period newPeriod; try { newPeriod = (Period) super.clone(); } catch (final CloneNotSupportedException e) { // this should never happen, since it is Cloneable throw new InternalError(e.getMessage()); } newPeriod.begin = begin == null ? null : (Calendar) begin.clone(); newPeriod.end = end == null ? null : (Calendar) end.clone(); return newPeriod; }
/** * 어간부가 음/기 로 끝나는 경우 * * @param o the analyzed output * @param candidates candidates * @throws MorphException throw exception */ public static boolean analysisMJ(AnalysisOutput o, List<AnalysisOutput> candidates) throws MorphException { int strlen = o.getStem().length(); if (strlen < 2) return false; char[] chrs = MorphUtil.decompose(o.getStem().charAt(strlen - 1)); boolean success = false; if (o.getStem().charAt(strlen - 1) != '기' && !(chrs.length == 3 && chrs[2] == 'ㅁ')) return false; String start = o.getStem(); String end = ""; if (o.getStem().charAt(strlen - 1) == '기') { start = o.getStem().substring(0, strlen - 1); end = "기"; } else if (o.getStem().charAt(strlen - 1) == '음') { start = o.getStem().substring(0, strlen - 1); end = "음"; } String[] eomis = EomiUtil.splitEomi(start, end); if (eomis[0] == null) return false; String[] pomis = EomiUtil.splitPomi(eomis[0]); o.setStem(pomis[0]); o.addElist(eomis[1]); o.setPomi(pomis[1]); try { if (analysisVMJ(o.clone(), candidates)) return true; if (analysisNSMJ(o.clone(), candidates)) return true; if (analysisVMXMJ(o.clone(), candidates)) return true; } catch (CloneNotSupportedException e) { throw new MorphException(e.getMessage(), e); } if (DictionaryUtil.getVerb(o.getStem()) != null) { o.setPos(PatternConstants.POS_VERB); o.setPatn(PatternConstants.PTN_VMJ); o.setScore(AnalysisOutput.SCORE_CORRECT); candidates.add(o); return true; } return false; }
@SuppressWarnings("unchecked") @Override public SingleSuccedentSequentOnBitSet clone() { try { SingleSuccedentSequentOnBitSet result = (SingleSuccedentSequentOnBitSet) super.clone(); result.leftSide = (BitSet) this.leftSide.clone(); result.leftFormulas = (LinkedList<Formula>[]) new LinkedList[FormulaType.values().length]; for (int i = 0; i < this.leftFormulas.length; i++) if (this.leftFormulas[i] != null) result.leftFormulas[i] = (LinkedList<Formula>) this.leftFormulas[i].clone(); result.rightSide = this.rightSide; return result; } catch (CloneNotSupportedException e) { throw new ImplementationError(e.getMessage()); } }
/** * ************************************************************************* Creates and returns a * copy of this object. The method performs a "deep copy" of this object. By convention, the * object returned by this method should be independent of this object (which is being cloned). * Typically, this means copying any mutable objects that comprise the internal "deep structure" * of the object being cloned and replacing the references to these objects with references to the * copies. * * <p>See also description of class <code>Object</code>. * * @see java.lang.Object * @see java.lang.Cloneable * @return A "deep copy" of this object. */ @Override public ComAcasCapability clone() { // ---------------------------------------------------------------------- // Obtain an object by invoking the base class' clone method. ComAcasCapability clonedCapability; try { clonedCapability = (ComAcasCapability) super.clone(); } catch (CloneNotSupportedException e) { throw new UnsupportedOperationException(e.getMessage()); } // ---------------------------------------------------------------------- // Copy attributes. // Primative data types already covered. return clonedCapability; }
/** * Choose any possible quadruple of the set of atoms in ac and establish all of the possible * bonding schemes according to Faulon's equations. */ public static List sample(IMolecule ac) { logger.debug("RandomGenerator->mutate() Start"); List structures = new ArrayList(); int nrOfAtoms = ac.getAtomCount(); double a11 = 0, a12 = 0, a22 = 0, a21 = 0; double b11 = 0, lowerborder = 0, upperborder = 0; double b12 = 0; double b21 = 0; double b22 = 0; double[] cmax = new double[4]; double[] cmin = new double[4]; IAtomContainer newAc = null; IAtom ax1 = null, ax2 = null, ay1 = null, ay2 = null; IBond b1 = null, b2 = null, b3 = null, b4 = null; // int[] choices = new int[3]; /* We need at least two non-zero bonds in order to be successful */ int nonZeroBondsCounter = 0; for (int x1 = 0; x1 < nrOfAtoms; x1++) { for (int x2 = x1 + 1; x2 < nrOfAtoms; x2++) { for (int y1 = x2 + 1; y1 < nrOfAtoms; y1++) { for (int y2 = y1 + 1; y2 < nrOfAtoms; y2++) { nonZeroBondsCounter = 0; ax1 = ac.getAtom(x1); ay1 = ac.getAtom(y1); ax2 = ac.getAtom(x2); ay2 = ac.getAtom(y2); /* Get four bonds for these four atoms */ b1 = ac.getBond(ax1, ay1); if (b1 != null) { a11 = BondManipulator.destroyBondOrder(b1.getOrder()); nonZeroBondsCounter++; } else { a11 = 0; } b2 = ac.getBond(ax1, ay2); if (b2 != null) { a12 = BondManipulator.destroyBondOrder(b2.getOrder()); nonZeroBondsCounter++; } else { a12 = 0; } b3 = ac.getBond(ax2, ay1); if (b3 != null) { a21 = BondManipulator.destroyBondOrder(b3.getOrder()); nonZeroBondsCounter++; } else { a21 = 0; } b4 = ac.getBond(ax2, ay2); if (b4 != null) { a22 = BondManipulator.destroyBondOrder(b4.getOrder()); nonZeroBondsCounter++; } else { a22 = 0; } if (nonZeroBondsCounter > 1) { /* Compute the range for b11 (see Faulons formulae for details) */ cmax[0] = 0; cmax[1] = a11 - a22; cmax[2] = a11 + a12 - 3; cmax[3] = a11 + a21 - 3; cmin[0] = 3; cmin[1] = a11 + a12; cmin[2] = a11 + a21; cmin[3] = a11 - a22 + 3; lowerborder = MathTools.max(cmax); upperborder = MathTools.min(cmin); for (b11 = lowerborder; b11 <= upperborder; b11++) { if (b11 != a11) { b12 = a11 + a12 - b11; b21 = a11 + a21 - b11; b22 = a22 - a11 + b11; logger.debug("Trying atom combination : " + x1 + ":" + x2 + ":" + y1 + ":" + y2); try { newAc = (IAtomContainer) ac.clone(); change(newAc, x1, y1, x2, y2, b11, b12, b21, b22); if (ConnectivityChecker.isConnected(newAc)) { structures.add(newAc); } else { logger.debug("not connected"); } } catch (CloneNotSupportedException e) { logger.error("Cloning exception: " + e.getMessage()); logger.debug(e); } } } } } } } } return structures; }
public Table evaluate() throws DatabaseException { DatabaseQueryContext context = new DatabaseQueryContext(database); if (type.equals("create")) { // Does the user have privs to create this tables? if (!database.getDatabase().canUserCreateTableObject(context, user, vname)) { throw new UserAccessException("User not permitted to create view: " + view_name); } // Does the schema exist? boolean ignore_case = database.isInCaseInsensitiveMode(); SchemaDef schema = database.resolveSchemaCase(vname.getSchema(), ignore_case); if (schema == null) { throw new DatabaseException("Schema '" + vname.getSchema() + "' doesn't exist."); } else { vname = new TableName(schema.getName(), vname.getName()); } // Check the permissions for this user to select from the tables in the // given plan. Select.checkUserSelectPermissions(context, user, plan); // Does the table already exist? if (database.tableExists(vname)) { throw new DatabaseException("View or table with name '" + vname + "' already exists."); } // Before evaluation, make a clone of the plan, QueryPlanNode plan_copy; try { plan_copy = (QueryPlanNode) plan.clone(); } catch (CloneNotSupportedException e) { Debug().writeException(e); throw new DatabaseException("Clone error: " + e.getMessage()); } // We have to execute the plan to get the DataTableDef that represents the // result of the view execution. Table t = plan.evaluate(context); DataTableDef data_table_def = new DataTableDef(t.getDataTableDef()); data_table_def.setTableName(vname); // Create a ViewDef object, ViewDef view_def = new ViewDef(data_table_def, plan_copy); // And create the view object, database.createView(query, view_def); // The initial grants for a view is to give the user who created it // full access. database .getGrantManager() .addGrant( Privileges.TABLE_ALL_PRIVS, GrantManager.TABLE, vname.toString(), user.getUserName(), true, Database.INTERNAL_SECURE_USERNAME); } else if (type.equals("drop")) { // Does the user have privs to drop this tables? if (!database.getDatabase().canUserDropTableObject(context, user, vname)) { throw new UserAccessException("User not permitted to drop view: " + view_name); } // Drop the view object database.dropView(vname); // Drop the grants for this object database.getGrantManager().revokeAllGrantsOnObject(GrantManager.TABLE, vname.toString()); } else { throw new Error("Unknown view command type: " + type); } return FunctionTable.resultTable(context, 0); }