/** * Translated to <tt>array[index] = value</tt> in JavaScript, sets the element at the specified index in this * <tt>Array</tt> to the specified value. * * @param index * the index * @param value * the value */ @Template("set") public void $set(String index, V value) { Long i = this.toArrayIndex(index); if (i == null) { this.nonArrayElements.put(JSAbstractOperations.ToString(index), value); } else { this.$set(i, value); } }
@Override public void $invoke(Object p1) { Array<EcRemoteLinkedData> results = (Array<EcRemoteLinkedData>) p1; for (int i = 0; i < results.$length(); i++) { EcRemoteLinkedData d = new EcRemoteLinkedData(null, null); d.copyFrom(results.$get(i)); results.$set(i, d); if (caching) { if (!shouldTryUrl(d.id)) { String md5 = EcCrypto.md5(d.id); for (int j = 0; j < cacheUrls.$length(); j++) { String url = cacheUrls.$get(j); if (url.indexOf(md5) != -1) { JSObjectAdapter.$put(cache, url, d); break; } } } JSObjectAdapter.$put(cache, d.shortId(), d); JSObjectAdapter.$put(cache, d.id, d); } } if (success != null) { success.$invoke(); } } }, null);
@Override public void $invoke(Array<EcRemoteLinkedData> p1) { if (successAll != null) { Array<EcRollupRule> rollupRules = JSCollections.$array(); for (int i = 0; i < p1.$length(); i++) { EcRollupRule a = new EcRollupRule(); if (p1.$get(i).isA(EcRollupRule.myType)) { a.copyFrom(p1.$get(i)); } else if (p1.$get(i).isA(EcEncryptedValue.myType)) { EcEncryptedValue val = new EcEncryptedValue(); val.copyFrom(p1.$get(i)); if (val.isAnEncrypted(EcRollupRule.myType)) { EcRemoteLinkedData obj = val.decryptIntoObject(); if (JSObjectAdapter.$get(obj, "competency") != competencyId && JSObjectAdapter.$get(obj, "competency") != shortId) { continue; } a.copyFrom(obj); EcEncryptedValue.encryptOnSave(a.id, true); } } rollupRules.$set(i, a); } if (successAll != null) successAll.$invoke(rollupRules); } }
@Override public void $invoke(Array<EcRemoteLinkedData> p1) { if (success != null) { Array<EcAlignment> ret = JSCollections.$array(); for (int i = 0; i < p1.$length(); i++) { EcAlignment alignment = new EcAlignment(); if (p1.$get(i).isAny(alignment.getTypes())) { alignment.copyFrom(p1.$get(i)); } else if (p1.$get(i).isA(EcEncryptedValue.myType)) { EcEncryptedValue val = new EcEncryptedValue(); val.copyFrom(p1.$get(i)); if (val.isAnEncrypted(EcAlignment.myType)) { EcRemoteLinkedData obj = val.decryptIntoObject(); if (JSObjectAdapter.$get(obj, "source") != sourceId && JSObjectAdapter.$get(obj, "source") != noVersion) { continue; } alignment.copyFrom(obj); } } ret.$set(i, alignment); } success.$invoke(ret); } }
@Override public void $invoke(Array<EcRemoteLinkedData> p1) { if (success != null) { Array<EcAlignment> ret = JSCollections.$array(); for (int i = 0; i < p1.$length(); i++) { EcAlignment alignment = new EcAlignment(); if (p1.$get(i).isAny(alignment.getTypes())) { alignment.copyFrom(p1.$get(i)); } else if (p1.$get(i).isA(EcEncryptedValue.myType)) { EcEncryptedValue val = new EcEncryptedValue(); val.copyFrom(p1.$get(i)); if (val.isAnEncrypted(EcAlignment.myType)) { EcRemoteLinkedData obj = val.decryptIntoObject(); if (JSObjectAdapter.$get(obj, "source") != competencyId && JSObjectAdapter.$get(obj, "source") != noVersion && JSObjectAdapter.$get(obj, "target") != competencyId && JSObjectAdapter.$get(obj, "target") != noVersion) { continue; } alignment.copyFrom(obj); } } ret.$set(i, alignment); } success.$invoke(ret); } }
@Override public void $invoke(Array<EcRemoteLinkedData> p1) { if (success != null) { Array<EcLevel> ret = JSCollections.$array(); for (int i = 0; i < p1.$length(); i++) { EcLevel level = new EcLevel(); if (p1.$get(i).isAny(level.getTypes())) { level.copyFrom(p1.$get(i)); } else if (p1.$get(i).isA(EcEncryptedValue.myType)) { EcEncryptedValue val = new EcEncryptedValue(); val.copyFrom(p1.$get(i)); if (val.isAnEncrypted(EcLevel.myType)) { EcRemoteLinkedData obj = val.decryptIntoObject(); level.copyFrom(obj); EcEncryptedValue.encryptOnSave(level.id, true); } } ret.$set(i, level); } success.$invoke(ret); } }
@Override public void $invoke(Array<EcRemoteLinkedData> p1) { if (success != null) { Array<EcCompetency> ret = JSCollections.$array(); for (int i = 0; i < p1.$length(); i++) { EcCompetency comp = new EcCompetency(); if (p1.$get(i).isAny(comp.getTypes())) { comp.copyFrom(p1.$get(i)); } else if (p1.$get(i).isA(EcEncryptedValue.myType)) { EcEncryptedValue val = new EcEncryptedValue(); val.copyFrom(p1.$get(i)); if (val.isAnEncrypted(EcCompetency.myType)) { EcRemoteLinkedData obj = val.decryptIntoObject(); comp.copyFrom(obj); EcEncryptedValue.encryptOnSave(comp.id, true); } } ret.$set(i, comp); } success.$invoke(ret); } }
@Override public void $invoke(Array<EcRemoteLinkedData> p1) { if (success != null) { Array<EcConcept> ret = JSCollections.$array(); for (int i = 0; i < p1.$length(); i++) { EcConcept comp = new EcConcept(); if (p1.$get(i).isAny(comp.getTypes())) { comp.copyFrom(p1.$get(i)); } else if (p1.$get(i).isA(EcEncryptedValue.myType)) { EcEncryptedValue val = new EcEncryptedValue(); val.copyFrom(p1.$get(i)); if (val.isAnEncrypted(EcConcept.myType)) { EcRemoteLinkedData obj = val.decryptIntoObject(); comp.copyFrom(obj); EcEncryptedValue.encryptOnSave(comp.id, true); } } ret.$set(i, comp); } success.$invoke(ret); } }
@Override public void $invoke(Array<EcRemoteLinkedData> p1) { if (success != null) { Array<EcAlignment> ret = JSCollections.$array(); for (int i = 0; i < p1.$length(); i++) { EcAlignment alignment = new EcAlignment(); if (p1.$get(i).isAny(alignment.getTypes())) { alignment.copyFrom(p1.$get(i)); } else if (p1.$get(i).isA(EcEncryptedValue.myType)) { EcEncryptedValue val = new EcEncryptedValue(); val.copyFrom(p1.$get(i)); if (val.isAnEncrypted(EcAlignment.myType)) { EcRemoteLinkedData obj = val.decryptIntoObject(); if (sourceIds.indexOf((String) JSObjectAdapter.$get(obj, "source")) == -1 && finalNoVersions.indexOf((String) JSObjectAdapter.$get(obj, "source")) == -1) { continue; } alignment.copyFrom(obj); } } ret.$set(i, alignment); } success.$invoke(ret); } }
@Override public void $invoke(Array<EcRemoteLinkedData> p1) { if (success != null) { Array<EcFile> ret = JSCollections.$array(); for (int i = 0; i < p1.$length(); i++) { EcFile file = new EcFile(); if (p1.$get(i).isAny(file.getTypes())) { file.copyFrom(p1.$get(i)); } else if (p1.$get(i).isA(EcEncryptedValue.myType)) { EcEncryptedValue val = new EcEncryptedValue(); val.copyFrom(p1.$get(i)); if (val.isAnEncrypted(EcFile.myType)) { EcRemoteLinkedData obj = val.decryptIntoObject(); file.copyFrom(obj); EcEncryptedValue.encryptOnSave(file.id, true); } } ret.$set(i, file); } success.$invoke(ret); } } }, failure);
@Override public void $invoke(Array<EcRemoteLinkedData> p1) { if (success != null) { Array<EcFramework> ret = JSCollections.$array(); for (int i = 0; i < p1.$length(); i++) { EcFramework framework = new EcFramework(); if (p1.$get(i).isAny(framework.getTypes())) { framework.copyFrom(p1.$get(i)); } else if (p1.$get(i).isA(EcEncryptedValue.myType)) { EcEncryptedValue val = new EcEncryptedValue(); val.copyFrom(p1.$get(i)); if (val.isAnEncrypted(EcFramework.myType)) { EcRemoteLinkedData obj = val.decryptIntoObject(); framework.copyFrom(obj); EcEncryptedValue.encryptOnSave(framework.id, true); } } ret.$set(i, framework); } success.$invoke(ret); } }
@Override public void $invoke(Array<EcRemoteLinkedData> p1) { if (success != null) { Array<EcRollupRule> ret = JSCollections.$array(); for (int i = 0; i < p1.$length(); i++) { EcRollupRule rule = new EcRollupRule(); if (p1.$get(i).isAny(rule.getTypes())) { rule.copyFrom(p1.$get(i)); } else if (p1.$get(i).isA(EcEncryptedValue.myType)) { EcEncryptedValue val = new EcEncryptedValue(); val.copyFrom(p1.$get(i)); if (val.isAnEncrypted(EcRollupRule.myType)) { EcRemoteLinkedData obj = val.decryptIntoObject(); rule.copyFrom(obj); EcEncryptedValue.encryptOnSave(rule.id, true); } } ret.$set(i, rule); } success.$invoke(ret); } }
@Override public void $invoke(Array<EcRemoteLinkedData> p1) { if (success != null) { Array<EcAlignment> ret = JSCollections.$array(); for (int i = 0; i < p1.$length(); i++) { EcAlignment alignment = new EcAlignment(); if (p1.$get(i).isAny(alignment.getTypes())) { alignment.copyFrom(p1.$get(i)); } else if (p1.$get(i).isA(EcEncryptedValue.myType)) { EcEncryptedValue val = new EcEncryptedValue(); val.copyFrom(p1.$get(i)); if (val.isAnEncrypted(EcAlignment.myType)) { EcRemoteLinkedData obj = val.decryptIntoObject(); alignment.copyFrom(obj); } } ret.$set(i, alignment); } success.$invoke(ret); } }
@Override public void $invoke(Array<EcRemoteLinkedData> p1) { if (success != null) { Array<EcConceptScheme> ret = JSCollections.$array(); for (int i = 0; i < p1.$length(); i++) { EcConceptScheme scheme = new EcConceptScheme(); if (p1.$get(i).isAny(scheme.getTypes())) { scheme.copyFrom(p1.$get(i)); } else if (p1.$get(i).isA(EcEncryptedValue.myType)) { EcEncryptedValue val = new EcEncryptedValue(); val.copyFrom(p1.$get(i)); if (val.isAnEncrypted(EcConceptScheme.myType)) { EcRemoteLinkedData obj = val.decryptIntoObject(); scheme.copyFrom(obj); EcEncryptedValue.encryptOnSave(scheme.id, true); } } ret.$set(i, scheme); } success.$invoke(ret); } }
protected Object atIfyArray(Array o) { Array a = new Array(); for (int i = 0; i < o.$length(); i++) { if (EcObject.isObject(o.$get(i))) { if (o.$get(i) instanceof EcLinkedData) a.$set(i, atIfyObject(o.$get(i))); else { a.$set(i, o.$get(i)); } } else if (EcArray.isArray(o.$get(i))) a.$set(i, atIfyArray((Array) o.$get(i))); else a.$set(i, o.$get(i)); } return a; }
@Override public void $invoke(Array<EcRemoteLinkedData> p1) { if (successAll != null) { Array<EcAlignment> rels = JSCollections.$array(); for (int i = 0; i < p1.$length(); i++) { EcAlignment a = new EcAlignment(); a.copyFrom(p1.$get(i)); rels.$set(i, a); } if (successAll != null) successAll.$invoke(rels); } }
@Override public void $invoke(Array<EcIdentity> pks) { Array cache = null; String stringified = JSGlobal.JSON.stringify(signatures); if (signatureSheetCaching) { cache = new Array(); cache.$set(0, new Date().getTime() + finalDuration); cache.$set(1, stringified); JSObjectAdapter.$put(signatureSheetCache, server, cache); } success.$invoke(stringified); } });
/** * Translated to <tt>array[index] = value</tt> in JavaScript, sets the element at the specified index in this * <tt>Array</tt> to the specified value. * * @param index * the index * @param value * the value */ @Template("set") public void $set(int index, V value) { this.$set((long)index, value); }
@Override public void $invoke(Array<EcRemoteLinkedData> p1) { if (success != null) { Array<EcAssertion> ret = JSCollections.$array(); for (int i = 0; i < p1.$length(); i++) { EcAssertion assertion = new EcAssertion(); assertion.copyFrom(p1.$get(i)); ret.$set(i, assertion); } success.$invoke(ret); } }
public void update(int nodeIndex, double change, boolean positive) { double a = alphas.$get(nodeIndex); double b = betas.$get(nodeIndex); if (positive) alphas.$set(nodeIndex, a+change); else betas.$set(nodeIndex,b+change); activations.$set(nodeIndex,(a+(positive ? change : 0))/(a+b+change)); updated.$set(nodeIndex,true); }