private void setElement(String code) { String[] elion = code.split(point); int n = Integer.valueOf(elion[0]).intValue(); ChemicalElementType chel = new ChemicalElementType(); chel.setElementSymbol(element[n]); chel.setNuclearCharge(Integer.valueOf(elion[0])); atom.setChemicalElement(chel); IsotopeParametersType isp = new IsotopeParametersType(); // isp.setMassNumber(Integer.valueOf(elion[1])); // ist.setIsotopeParameters(isp); is.setIonCharge(Integer.valueOf(elion[1])); }
private void removeUnnecessaryData() { Set<AtomType> clear = Sets.newHashSet(); List<Atom> atoms = Lists.newArrayList(); List<AtomType> atomTypes = structure.getAtomTypes(); for (Section section : structure.getSections()) { if (section.getSectionType().equals(SectionType.STRUCTUREDATA)) { atoms.addAll(section.getAtoms()); } } for (AtomType atomType : atomTypes) { AtomType delete = atomType; for (Atom atom : atoms) { if (atomType.getName().contains(atom.getType())) { delete = null; } } if (delete != null) { clear.add(delete); } } clear.forEach(atomTypes::remove); }
/** * Returns an instance of a with the specified name and number of arguments, or {@code null}. * * @param name name of the function * @param args optional arguments * @param dyn compile-/run-time flag * @param ctx query context * @param ii input info * @return function instance * @throws QueryException query exception */ public static TypedFunc get( final QNm name, final Expr[] args, final boolean dyn, final QueryContext ctx, final InputInfo ii) throws QueryException { // get namespace and local name // parse data type constructors if (eq(name.uri(), XSURI)) { final byte[] ln = name.local(); final AtomType type = AtomType.find(name, false); if (type == null) { final Levenshtein ls = new Levenshtein(); for (final AtomType t : AtomType.values()) { if (t.par != null && t != AtomType.NOT && t != AtomType.AAT && t != AtomType.BIN && ls.similar(lc(ln), lc(t.string()), 0)) FUNSIMILAR.thrw(ii, name.string(), t.string()); } } // no constructor function found, or abstract type specified if (type == null || type == AtomType.NOT || type == AtomType.AAT) { FUNCUNKNOWN.thrw(ii, name.string()); } if (args.length != 1) FUNCTYPE.thrw(ii, name.string()); final SeqType to = SeqType.get(type, Occ.ZERO_ONE); return TypedFunc.constr(new Cast(ii, args[0], to), to); } // pre-defined functions final StandardFunc fun = Functions.get().get(name, args, ii); if (fun != null) { if (!ctx.sc.xquery3 && fun.xquery3()) FEATURE30.thrw(ii); for (final Function f : Function.UPDATING) { if (fun.sig == f) { ctx.updating(true); break; } } return new TypedFunc(fun, fun.sig.type(args.length)); } // user-defined function final TypedFunc tf = ctx.funcs.get(name, args, ii); if (tf != null) return tf; // Java function (only allowed with administrator permissions) final JavaMapping jf = JavaMapping.get(name, args, ctx, ii); if (jf != null) return TypedFunc.java(jf); // add user-defined function that has not been declared yet if (!dyn && FuncType.find(name) == null) return ctx.funcs.add(name, args, ii, ctx); // no function found return null; }
public void build() { rt = null; root = new XSAMSData(); procs = new ProcessesType(); rad = new Radiative(); atoms = new Atoms(); sources = new Sources(); procs.setRadiative(rad); states = new StatesType(); states.setAtoms(atoms); root.setStates(states); root.setProcesses(procs); try { int nr = 0; while (rs.next()) { rt = new RadiativeTransitionType(); rtp = new RadiativeTransitionProbabilityType(); rt.getProbabilities().add(rtp); atom = new AtomType(); ist = new IsotopeType(); atom.getIsotopes().add(ist); is = new IonStateType(); ist.getIonStates().add(is); aslow = new AtomicStateType(); asup = new AtomicStateType(); aslow.setStateID("Initial_" + nr); asup.setStateID("Final_" + nr); andtlow = new AtomicNumericalDataType(); andtup = new AtomicNumericalDataType(); aslow.setAtomicNumericalData(andtlow); asup.setAtomicNumericalData(andtup); is.getAtomicStates().add(aslow); is.getAtomicStates().add(asup); aqnlow = new AtomicQuantumNumbersType(); aqnup = new AtomicQuantumNumbersType(); aslow.setAtomicQuantumNumbers(aqnlow); asup.setAtomicQuantumNumbers(aqnup); aclow = new AtomicCompositionType(); acup = new AtomicCompositionType(); aslow.setAtomicComposition(aclow); asup.setAtomicComposition(acup); acmlow = new AtomicComponentType(); acmup = new AtomicComponentType(); conflow = new ConfigurationType(); acmlow.setConfiguration(conflow); confup = new ConfigurationType(); acmup.setConfiguration(confup); aclow.getComponents().add(acmlow); acup.getComponents().add(acmup); termlow = new TermType(); termup = new TermType(); acmlow.setTerm(termlow); acmup.setTerm(termup); wavelength = ((Double) (rs.getObject("wavelength"))).doubleValue(); code = rs.getObject("code").toString(); loggf = ((Double) (rs.getObject("loggf"))).doubleValue(); E_low = ((Double) (rs.getObject("E_low"))).doubleValue(); E_up = ((Double) (rs.getObject("E_up"))).doubleValue(); J_low = ((Double) (rs.getObject("J_low"))).doubleValue(); J_up = ((Double) (rs.getObject("J_up"))).doubleValue(); g_low = ((Double) (rs.getObject("g_low"))).doubleValue(); g_up = ((Double) (rs.getObject("g_up"))).doubleValue(); Connection_low = rs.getObject("Connection_low").toString(); Connection_up = rs.getObject("Connection_up").toString(); Conf_low = rs.getObject("Conf_low").toString(); Conf_up = rs.getObject("Conf_up").toString(); Term_low = rs.getObject("Term_low").toString(); Term_up = rs.getObject("Term_up").toString(); Ref = rs.getObject("Ref").toString(); Comments = rs.getObject("Ref").toString(); setWavelength(wavelength); setElement(code); setProbability(loggf); setElow(E_low); setEup(E_up); setglow(g_low); setgup(g_up); setQNlow(J_low); setQNup(J_up); // setConnlow(Connection_low); // setConnup(Connection_up); setConflow(Conf_low); setConfup(Conf_up); setComments(Comments); atoms.getAtoms().add(atom); rad.getRadiativeTransitions().add(rt); nr++; } data2xml(); con.close(); rs.close(); } catch (Exception e) { System.out.println(e.toString()); } }