id
int64
22
34.9k
original_code
stringlengths
31
107k
code_wo_comment
stringlengths
29
77.3k
cleancode
stringlengths
25
62.1k
repo
stringlengths
6
65
label
sequencelengths
4
4
11,878
@Override public void runWithEvent(IAction action, Event event) { updateEnablement(action); if (action.isEnabled()) { ISelection currentSelection = getSelection(); Set<EPlanElement> selected = PlanEditorUtil.emfFromSelection(currentSelection); final MoveToOrbitOperation op = new MoveToOrbitOperation(selected); String errorMsg = op.analyzeMistakenSelection(); if (errorMsg != null) { LogUtil.warn(errorMsg); ErrorDialog.openError(WidgetUtils.getShell(), "Nothing to Move To " + OrbitEventUtil.ORBIT_NAME, "No orbit-related plan elements selected.", new ExceptionStatus(EditorPlugin.ID, errorMsg, new ExecutionException(selected.toString()))); return; } try { String orbitId = promptForValue(); if (orbitId != null) { op.setOrbitId(orbitId); IUndoContext undoContext = getUndoContext(); CommonUtils.execute(op, undoContext); String errorMsg2 = op.analyzeMissingOrbitDestination(); if (errorMsg2 != null) { LogUtil.warn(errorMsg2); //TODO: Use the new WidgetUtils.showErrorToUser method. ErrorDialog.openError(WidgetUtils.getShell(), "Move To " + OrbitEventUtil.ORBIT_NAME, "Move To " + OrbitEventUtil.ORBIT_NAME + " may not have done what you expected.", new ExceptionStatus(EditorPlugin.ID, errorMsg2, new ExecutionException(selected.toString()))); return; } } } catch (Exception e) { IStatus error = new ExceptionStatus(EditorPlugin.ID, e.getMessage(), e); ErrorDialog.openError(WidgetUtils.getShell(), "An error occurred", "That didn't work.", error); } } }
@Override public void runWithEvent(IAction action, Event event) { updateEnablement(action); if (action.isEnabled()) { ISelection currentSelection = getSelection(); Set<EPlanElement> selected = PlanEditorUtil.emfFromSelection(currentSelection); final MoveToOrbitOperation op = new MoveToOrbitOperation(selected); String errorMsg = op.analyzeMistakenSelection(); if (errorMsg != null) { LogUtil.warn(errorMsg); ErrorDialog.openError(WidgetUtils.getShell(), "Nothing to Move To " + OrbitEventUtil.ORBIT_NAME, "No orbit-related plan elements selected.", new ExceptionStatus(EditorPlugin.ID, errorMsg, new ExecutionException(selected.toString()))); return; } try { String orbitId = promptForValue(); if (orbitId != null) { op.setOrbitId(orbitId); IUndoContext undoContext = getUndoContext(); CommonUtils.execute(op, undoContext); String errorMsg2 = op.analyzeMissingOrbitDestination(); if (errorMsg2 != null) { LogUtil.warn(errorMsg2); ErrorDialog.openError(WidgetUtils.getShell(), "Move To " + OrbitEventUtil.ORBIT_NAME, "Move To " + OrbitEventUtil.ORBIT_NAME + " may not have done what you expected.", new ExceptionStatus(EditorPlugin.ID, errorMsg2, new ExecutionException(selected.toString()))); return; } } } catch (Exception e) { IStatus error = new ExceptionStatus(EditorPlugin.ID, e.getMessage(), e); ErrorDialog.openError(WidgetUtils.getShell(), "An error occurred", "That didn't work.", error); } } }
@override public void runwithevent(iaction action, event event) { updateenablement(action); if (action.isenabled()) { iselection currentselection = getselection(); set<eplanelement> selected = planeditorutil.emffromselection(currentselection); final movetoorbitoperation op = new movetoorbitoperation(selected); string errormsg = op.analyzemistakenselection(); if (errormsg != null) { logutil.warn(errormsg); errordialog.openerror(widgetutils.getshell(), "nothing to move to " + orbiteventutil.orbit_name, "no orbit-related plan elements selected.", new exceptionstatus(editorplugin.id, errormsg, new executionexception(selected.tostring()))); return; } try { string orbitid = promptforvalue(); if (orbitid != null) { op.setorbitid(orbitid); iundocontext undocontext = getundocontext(); commonutils.execute(op, undocontext); string errormsg2 = op.analyzemissingorbitdestination(); if (errormsg2 != null) { logutil.warn(errormsg2); errordialog.openerror(widgetutils.getshell(), "move to " + orbiteventutil.orbit_name, "move to " + orbiteventutil.orbit_name + " may not have done what you expected.", new exceptionstatus(editorplugin.id, errormsg2, new executionexception(selected.tostring()))); return; } } } catch (exception e) { istatus error = new exceptionstatus(editorplugin.id, e.getmessage(), e); errordialog.openerror(widgetutils.getshell(), "an error occurred", "that didn't work.", error); } } }
mikiec84/OpenSPIFe
[ 1, 0, 0, 0 ]
20,922
public static boolean addNode(Properties ctx, String treeType, int Record_ID, String trxName) { // TODO: Check & refactor this // Get Tree int AD_Tree_ID = 0; MClient client = MClient.get(ctx); I_AD_ClientInfo ci = client.getInfo(); if (TREETYPE_Activity.equals(treeType)) AD_Tree_ID = ci.getAD_Tree_Activity_ID(); else if (TREETYPE_BoM.equals(treeType)) throw new IllegalArgumentException("BoM Trees not supported"); else if (TREETYPE_BPartner.equals(treeType)) AD_Tree_ID = ci.getAD_Tree_BPartner_ID(); else if (TREETYPE_Campaign.equals(treeType)) AD_Tree_ID = ci.getAD_Tree_Campaign_ID(); else if (TREETYPE_ElementValue.equals(treeType)) throw new IllegalArgumentException("ElementValue cannot use this API"); else if (TREETYPE_Menu.equals(treeType)) AD_Tree_ID = ci.getAD_Tree_Menu_ID(); else if (TREETYPE_Organization.equals(treeType)) AD_Tree_ID = ci.getAD_Tree_Org_ID(); else if (TREETYPE_Product.equals(treeType)) AD_Tree_ID = ci.getAD_Tree_Product_ID(); else if (TREETYPE_ProductCategory.equals(treeType)) throw new IllegalArgumentException("Product Category Trees not supported"); else if (TREETYPE_Project.equals(treeType)) AD_Tree_ID = ci.getAD_Tree_Project_ID(); else if (TREETYPE_SalesRegion.equals(treeType)) AD_Tree_ID = ci.getAD_Tree_SalesRegion_ID(); if (AD_Tree_ID == 0) throw new IllegalArgumentException("No Tree found"); MTree_Base tree = MTree_Base.get(ctx, AD_Tree_ID, trxName); if (tree.get_ID() != AD_Tree_ID) throw new IllegalArgumentException("Tree found AD_Tree_ID=" + AD_Tree_ID); // Insert Tree in correct tree boolean saved = false; if (TREETYPE_Menu.equals(treeType)) { MTree_NodeMM node = new MTree_NodeMM(tree, Record_ID); saved = node.save(); } else if (TREETYPE_BPartner.equals(treeType)) { MTree_NodeBP node = new MTree_NodeBP(tree, Record_ID); saved = node.save(); } else if (TREETYPE_Product.equals(treeType)) { MTree_NodePR node = new MTree_NodePR(tree, Record_ID); saved = node.save(); } else { MTree_Node node = new MTree_Node(tree, Record_ID); saved = node.save(); } return saved; }
public static boolean addNode(Properties ctx, String treeType, int Record_ID, String trxName) { int AD_Tree_ID = 0; MClient client = MClient.get(ctx); I_AD_ClientInfo ci = client.getInfo(); if (TREETYPE_Activity.equals(treeType)) AD_Tree_ID = ci.getAD_Tree_Activity_ID(); else if (TREETYPE_BoM.equals(treeType)) throw new IllegalArgumentException("BoM Trees not supported"); else if (TREETYPE_BPartner.equals(treeType)) AD_Tree_ID = ci.getAD_Tree_BPartner_ID(); else if (TREETYPE_Campaign.equals(treeType)) AD_Tree_ID = ci.getAD_Tree_Campaign_ID(); else if (TREETYPE_ElementValue.equals(treeType)) throw new IllegalArgumentException("ElementValue cannot use this API"); else if (TREETYPE_Menu.equals(treeType)) AD_Tree_ID = ci.getAD_Tree_Menu_ID(); else if (TREETYPE_Organization.equals(treeType)) AD_Tree_ID = ci.getAD_Tree_Org_ID(); else if (TREETYPE_Product.equals(treeType)) AD_Tree_ID = ci.getAD_Tree_Product_ID(); else if (TREETYPE_ProductCategory.equals(treeType)) throw new IllegalArgumentException("Product Category Trees not supported"); else if (TREETYPE_Project.equals(treeType)) AD_Tree_ID = ci.getAD_Tree_Project_ID(); else if (TREETYPE_SalesRegion.equals(treeType)) AD_Tree_ID = ci.getAD_Tree_SalesRegion_ID(); if (AD_Tree_ID == 0) throw new IllegalArgumentException("No Tree found"); MTree_Base tree = MTree_Base.get(ctx, AD_Tree_ID, trxName); if (tree.get_ID() != AD_Tree_ID) throw new IllegalArgumentException("Tree found AD_Tree_ID=" + AD_Tree_ID); boolean saved = false; if (TREETYPE_Menu.equals(treeType)) { MTree_NodeMM node = new MTree_NodeMM(tree, Record_ID); saved = node.save(); } else if (TREETYPE_BPartner.equals(treeType)) { MTree_NodeBP node = new MTree_NodeBP(tree, Record_ID); saved = node.save(); } else if (TREETYPE_Product.equals(treeType)) { MTree_NodePR node = new MTree_NodePR(tree, Record_ID); saved = node.save(); } else { MTree_Node node = new MTree_Node(tree, Record_ID); saved = node.save(); } return saved; }
public static boolean addnode(properties ctx, string treetype, int record_id, string trxname) { int ad_tree_id = 0; mclient client = mclient.get(ctx); i_ad_clientinfo ci = client.getinfo(); if (treetype_activity.equals(treetype)) ad_tree_id = ci.getad_tree_activity_id(); else if (treetype_bom.equals(treetype)) throw new illegalargumentexception("bom trees not supported"); else if (treetype_bpartner.equals(treetype)) ad_tree_id = ci.getad_tree_bpartner_id(); else if (treetype_campaign.equals(treetype)) ad_tree_id = ci.getad_tree_campaign_id(); else if (treetype_elementvalue.equals(treetype)) throw new illegalargumentexception("elementvalue cannot use this api"); else if (treetype_menu.equals(treetype)) ad_tree_id = ci.getad_tree_menu_id(); else if (treetype_organization.equals(treetype)) ad_tree_id = ci.getad_tree_org_id(); else if (treetype_product.equals(treetype)) ad_tree_id = ci.getad_tree_product_id(); else if (treetype_productcategory.equals(treetype)) throw new illegalargumentexception("product category trees not supported"); else if (treetype_project.equals(treetype)) ad_tree_id = ci.getad_tree_project_id(); else if (treetype_salesregion.equals(treetype)) ad_tree_id = ci.getad_tree_salesregion_id(); if (ad_tree_id == 0) throw new illegalargumentexception("no tree found"); mtree_base tree = mtree_base.get(ctx, ad_tree_id, trxname); if (tree.get_id() != ad_tree_id) throw new illegalargumentexception("tree found ad_tree_id=" + ad_tree_id); boolean saved = false; if (treetype_menu.equals(treetype)) { mtree_nodemm node = new mtree_nodemm(tree, record_id); saved = node.save(); } else if (treetype_bpartner.equals(treetype)) { mtree_nodebp node = new mtree_nodebp(tree, record_id); saved = node.save(); } else if (treetype_product.equals(treetype)) { mtree_nodepr node = new mtree_nodepr(tree, record_id); saved = node.save(); } else { mtree_node node = new mtree_node(tree, record_id); saved = node.save(); } return saved; }
metas-fresh/fresh
[ 1, 0, 0, 0 ]
12,731
public List<PigOutLogicalChunks> createLogicalChunks() throws FrontendException { Set<Operator> seenByDFS = new HashSet<Operator>(); Map<LogicalPlan, PigOutLogicalChunks> mapping = new HashMap<>(); while ( !visitQueue.isEmpty() ) { Operator s = visitQueue.poll(); LogicalRelationalOperator lro = (LogicalRelationalOperator) s; log.debug("Visit: " + lro); // for each s, we may need to create a new "chunk" // each partition is created by DFS from a source if (!seenByDFS.add(s)) continue; // Create a new logical plan for the new chunk LogicalPlan newPlan = new LogicalPlan(); newPlan.add(s); subPlans.put(s, newPlan); List<Operator> preds = this.plan.getPredecessors(s); if (preds != null) planPreds.put(newPlan, new LinkedList<>(preds)); log.debug(lro.getAlias() + " is the root of new chunk"); discoverPartition(s, seenByDFS, newPlan); String nameNode = this.siteAssignment.get(s); String hostname = nameNode.split(":")[0]; String portNum = this.context.getProperties().getProperty(hostname + ".job.tracker").split(":")[1]; int port = new Integer(portNum); PigOutCluster clusterInfo = getPigOutCluster(hostname, port); long dataIn = computeDataInSize(newPlan); long dataOut = computeDataOutSize(newPlan); addStores(newPlan); addLoads(newPlan); Iterator<Operator> it = newPlan.getOperators(); while (it.hasNext()) { Operator op = it.next(); op.setPlan(newPlan); } PigOutLogicalChunks chunk; chunk = new PigOutLogicalChunks(newPlan, context, clusterInfo, dataIn, dataOut); chunk.setAlias(lro.getAlias()); mapping.put( newPlan, chunk ); } for (LogicalPlan lp : mapping.keySet()) { List<Operator> succs = planSuccs.get(lp); List<Operator> preds = planPreds.get(lp); PigOutLogicalChunks chunk = mapping.get(lp); if (succs != null) { for (Operator succ : succs) { LogicalPlan succLP = (LogicalPlan) succ.getPlan(); PigOutLogicalChunks succChunk = mapping.get(succLP); succChunk.addPredecessors(chunk); log.debug(succChunk.getAlias() + " depends on " + chunk.getAlias()); } } if (preds != null) { for (Operator pred : preds) { LogicalPlan predLP = (LogicalPlan) pred.getPlan(); PigOutLogicalChunks predChunk = mapping.get(predLP); chunk.addPredecessors(predChunk); log.debug(chunk.getAlias() + " depends on " + predChunk.getAlias()); } } } List<PigOutLogicalChunks> list_chunks = new LinkedList<>(); for (PigOutLogicalChunks chunk : mapping.values()) { list_chunks.add( chunk ); } return list_chunks; }
public List<PigOutLogicalChunks> createLogicalChunks() throws FrontendException { Set<Operator> seenByDFS = new HashSet<Operator>(); Map<LogicalPlan, PigOutLogicalChunks> mapping = new HashMap<>(); while ( !visitQueue.isEmpty() ) { Operator s = visitQueue.poll(); LogicalRelationalOperator lro = (LogicalRelationalOperator) s; log.debug("Visit: " + lro); if (!seenByDFS.add(s)) continue; LogicalPlan newPlan = new LogicalPlan(); newPlan.add(s); subPlans.put(s, newPlan); List<Operator> preds = this.plan.getPredecessors(s); if (preds != null) planPreds.put(newPlan, new LinkedList<>(preds)); log.debug(lro.getAlias() + " is the root of new chunk"); discoverPartition(s, seenByDFS, newPlan); String nameNode = this.siteAssignment.get(s); String hostname = nameNode.split(":")[0]; String portNum = this.context.getProperties().getProperty(hostname + ".job.tracker").split(":")[1]; int port = new Integer(portNum); PigOutCluster clusterInfo = getPigOutCluster(hostname, port); long dataIn = computeDataInSize(newPlan); long dataOut = computeDataOutSize(newPlan); addStores(newPlan); addLoads(newPlan); Iterator<Operator> it = newPlan.getOperators(); while (it.hasNext()) { Operator op = it.next(); op.setPlan(newPlan); } PigOutLogicalChunks chunk; chunk = new PigOutLogicalChunks(newPlan, context, clusterInfo, dataIn, dataOut); chunk.setAlias(lro.getAlias()); mapping.put( newPlan, chunk ); } for (LogicalPlan lp : mapping.keySet()) { List<Operator> succs = planSuccs.get(lp); List<Operator> preds = planPreds.get(lp); PigOutLogicalChunks chunk = mapping.get(lp); if (succs != null) { for (Operator succ : succs) { LogicalPlan succLP = (LogicalPlan) succ.getPlan(); PigOutLogicalChunks succChunk = mapping.get(succLP); succChunk.addPredecessors(chunk); log.debug(succChunk.getAlias() + " depends on " + chunk.getAlias()); } } if (preds != null) { for (Operator pred : preds) { LogicalPlan predLP = (LogicalPlan) pred.getPlan(); PigOutLogicalChunks predChunk = mapping.get(predLP); chunk.addPredecessors(predChunk); log.debug(chunk.getAlias() + " depends on " + predChunk.getAlias()); } } } List<PigOutLogicalChunks> list_chunks = new LinkedList<>(); for (PigOutLogicalChunks chunk : mapping.values()) { list_chunks.add( chunk ); } return list_chunks; }
public list<pigoutlogicalchunks> createlogicalchunks() throws frontendexception { set<operator> seenbydfs = new hashset<operator>(); map<logicalplan, pigoutlogicalchunks> mapping = new hashmap<>(); while ( !visitqueue.isempty() ) { operator s = visitqueue.poll(); logicalrelationaloperator lro = (logicalrelationaloperator) s; log.debug("visit: " + lro); if (!seenbydfs.add(s)) continue; logicalplan newplan = new logicalplan(); newplan.add(s); subplans.put(s, newplan); list<operator> preds = this.plan.getpredecessors(s); if (preds != null) planpreds.put(newplan, new linkedlist<>(preds)); log.debug(lro.getalias() + " is the root of new chunk"); discoverpartition(s, seenbydfs, newplan); string namenode = this.siteassignment.get(s); string hostname = namenode.split(":")[0]; string portnum = this.context.getproperties().getproperty(hostname + ".job.tracker").split(":")[1]; int port = new integer(portnum); pigoutcluster clusterinfo = getpigoutcluster(hostname, port); long datain = computedatainsize(newplan); long dataout = computedataoutsize(newplan); addstores(newplan); addloads(newplan); iterator<operator> it = newplan.getoperators(); while (it.hasnext()) { operator op = it.next(); op.setplan(newplan); } pigoutlogicalchunks chunk; chunk = new pigoutlogicalchunks(newplan, context, clusterinfo, datain, dataout); chunk.setalias(lro.getalias()); mapping.put( newplan, chunk ); } for (logicalplan lp : mapping.keyset()) { list<operator> succs = plansuccs.get(lp); list<operator> preds = planpreds.get(lp); pigoutlogicalchunks chunk = mapping.get(lp); if (succs != null) { for (operator succ : succs) { logicalplan succlp = (logicalplan) succ.getplan(); pigoutlogicalchunks succchunk = mapping.get(succlp); succchunk.addpredecessors(chunk); log.debug(succchunk.getalias() + " depends on " + chunk.getalias()); } } if (preds != null) { for (operator pred : preds) { logicalplan predlp = (logicalplan) pred.getplan(); pigoutlogicalchunks predchunk = mapping.get(predlp); chunk.addpredecessors(predchunk); log.debug(chunk.getalias() + " depends on " + predchunk.getalias()); } } } list<pigoutlogicalchunks> list_chunks = new linkedlist<>(); for (pigoutlogicalchunks chunk : mapping.values()) { list_chunks.add( chunk ); } return list_chunks; }
kyunghoj/pigout
[ 1, 0, 0, 0 ]
21,065
@Bean public ListFactoryBean userDnList() { ListFactoryBean bean = new ListFactoryBean(); bean.setTargetListClass(ArrayList.class); // TODO Add values to this list to allow more distinguished name patterns. // If preferable, ldap.dn can be removed when there is more than one value to avoid confusion. List<String> sourceList = new ArrayList<String>(Arrays.asList("${ldap.dn}", "cn={0},OU=WCT users,DC=webcurator,DC=org") //, // TODO CONFIGURATION //"cn={0},OU=WCT users,DC=webcurator,DC=org", //"cn={0},OU=WCT users,DC=webcurator,DC=org" ); bean.setSourceList(sourceList); return bean; }
@Bean public ListFactoryBean userDnList() { ListFactoryBean bean = new ListFactoryBean(); bean.setTargetListClass(ArrayList.class); List<String> sourceList = new ArrayList<String>(Arrays.asList("${ldap.dn}", "cn={0},OU=WCT users,DC=webcurator,DC=org") ); bean.setSourceList(sourceList); return bean; }
@bean public listfactorybean userdnlist() { listfactorybean bean = new listfactorybean(); bean.settargetlistclass(arraylist.class); list<string> sourcelist = new arraylist<string>(arrays.aslist("${ldap.dn}", "cn={0},ou=wct users,dc=webcurator,dc=org") ); bean.setsourcelist(sourcelist); return bean; }
mbreemhaar/webcurator
[ 1, 1, 0, 0 ]
21,104
private static String safeUri(String uri) { // todo: make this way more safe return uri.replace(" ", "%20"); }
private static String safeUri(String uri) { return uri.replace(" ", "%20"); }
private static string safeuri(string uri) { return uri.replace(" ", "%20"); }
mikiec84/blueprints
[ 1, 0, 0, 0 ]
13,004
public static void main(String[] args) { printoutModelFile("/Users/aidancbrady/Documents/Mekanism/src/main/resources/assets/mekanism/models/block/digital_miner.json"); }
public static void main(String[] args) { printoutModelFile("/Users/aidancbrady/Documents/Mekanism/src/main/resources/assets/mekanism/models/block/digital_miner.json"); }
public static void main(string[] args) { printoutmodelfile("/users/aidancbrady/documents/mekanism/src/main/resources/assets/mekanism/models/block/digital_miner.json"); }
marcus8448/Mekanism
[ 1, 0, 0, 0 ]
13,116
private String compoundProduce( JavaFileManager.Location location, Set<ITypeManifold> sps, String fqn, DiagnosticListener<JavaFileObject> errorHandler ) { ITypeManifold found = null; String result = ""; for( ITypeManifold sp: sps ) { if( sp.getContributorKind() == Primary || sp.getContributorKind() == Partial ) { if( found != null && (found.getContributorKind() == Primary || sp.getContributorKind() == Primary) ) { //## todo: use location to select more specifically (in Java 9+ with the location's module) List<IFile> files = sp.findFilesForType( fqn ); JavaFileObject file = new SourceJavaFileObject( files.get( 0 ).toURI() ); errorHandler.report( new JavacDiagnostic( file, Diagnostic.Kind.ERROR, 0, 1, 1, "The type, " + fqn + ", has conflicting type manifolds:\n" + "'" + found.getClass().getName() + "' and '" + sp.getClass().getName() + "'.\n" + "Either two or more resource files have the same base name or the project depends on two or more type manifolds that target the same resource type.\n" + "If the former, consider renaming one or more of the resource files.\n" + "If the latter, you must remove one or more of the type manifold libraries." ) ); } else { found = sp; result = sp.contribute( location, fqn, false, result, errorHandler ); } } } for( ITypeManifold sp: sps ) { if( sp.getContributorKind() == ContributorKind.Supplemental ) { result = sp.contribute( location, fqn, false, result, errorHandler ); } } return result; }
private String compoundProduce( JavaFileManager.Location location, Set<ITypeManifold> sps, String fqn, DiagnosticListener<JavaFileObject> errorHandler ) { ITypeManifold found = null; String result = ""; for( ITypeManifold sp: sps ) { if( sp.getContributorKind() == Primary || sp.getContributorKind() == Partial ) { if( found != null && (found.getContributorKind() == Primary || sp.getContributorKind() == Primary) ) { List<IFile> files = sp.findFilesForType( fqn ); JavaFileObject file = new SourceJavaFileObject( files.get( 0 ).toURI() ); errorHandler.report( new JavacDiagnostic( file, Diagnostic.Kind.ERROR, 0, 1, 1, "The type, " + fqn + ", has conflicting type manifolds:\n" + "'" + found.getClass().getName() + "' and '" + sp.getClass().getName() + "'.\n" + "Either two or more resource files have the same base name or the project depends on two or more type manifolds that target the same resource type.\n" + "If the former, consider renaming one or more of the resource files.\n" + "If the latter, you must remove one or more of the type manifold libraries." ) ); } else { found = sp; result = sp.contribute( location, fqn, false, result, errorHandler ); } } } for( ITypeManifold sp: sps ) { if( sp.getContributorKind() == ContributorKind.Supplemental ) { result = sp.contribute( location, fqn, false, result, errorHandler ); } } return result; }
private string compoundproduce( javafilemanager.location location, set<itypemanifold> sps, string fqn, diagnosticlistener<javafileobject> errorhandler ) { itypemanifold found = null; string result = ""; for( itypemanifold sp: sps ) { if( sp.getcontributorkind() == primary || sp.getcontributorkind() == partial ) { if( found != null && (found.getcontributorkind() == primary || sp.getcontributorkind() == primary) ) { list<ifile> files = sp.findfilesfortype( fqn ); javafileobject file = new sourcejavafileobject( files.get( 0 ).touri() ); errorhandler.report( new javacdiagnostic( file, diagnostic.kind.error, 0, 1, 1, "the type, " + fqn + ", has conflicting type manifolds:\n" + "'" + found.getclass().getname() + "' and '" + sp.getclass().getname() + "'.\n" + "either two or more resource files have the same base name or the project depends on two or more type manifolds that target the same resource type.\n" + "if the former, consider renaming one or more of the resource files.\n" + "if the latter, you must remove one or more of the type manifold libraries." ) ); } else { found = sp; result = sp.contribute( location, fqn, false, result, errorhandler ); } } } for( itypemanifold sp: sps ) { if( sp.getcontributorkind() == contributorkind.supplemental ) { result = sp.contribute( location, fqn, false, result, errorhandler ); } } return result; }
manifold-systems/manifold
[ 1, 0, 0, 0 ]
13,241
public void setCurPie(PieInfoWrapperr infoWrapper, float degree) { if (mDrawingPie != null) { if (degree >= mDrawingPie.toAngle / 2) { if (!mDrawingPie.hasCached) { // fix anim duration too short PieInfoWrapperr preWrapper = mDrawingPie.preWrapper; if (preWrapper != null && !preWrapper.hasCached) { preWrapper.hasCached = true; mCachedDrawWrappers.add(preWrapper); } mCachedDrawWrappers.add(mDrawingPie); mDrawingPie.hasCached = true; } } } mDrawingPie = infoWrapper; animAngle = degree; callInvalidate(); }
public void setCurPie(PieInfoWrapperr infoWrapper, float degree) { if (mDrawingPie != null) { if (degree >= mDrawingPie.toAngle / 2) { if (!mDrawingPie.hasCached) { PieInfoWrapperr preWrapper = mDrawingPie.preWrapper; if (preWrapper != null && !preWrapper.hasCached) { preWrapper.hasCached = true; mCachedDrawWrappers.add(preWrapper); } mCachedDrawWrappers.add(mDrawingPie); mDrawingPie.hasCached = true; } } } mDrawingPie = infoWrapper; animAngle = degree; callInvalidate(); }
public void setcurpie(pieinfowrapperr infowrapper, float degree) { if (mdrawingpie != null) { if (degree >= mdrawingpie.toangle / 2) { if (!mdrawingpie.hascached) { pieinfowrapperr prewrapper = mdrawingpie.prewrapper; if (prewrapper != null && !prewrapper.hascached) { prewrapper.hascached = true; mcacheddrawwrappers.add(prewrapper); } mcacheddrawwrappers.add(mdrawingpie); mdrawingpie.hascached = true; } } } mdrawingpie = infowrapper; animangle = degree; callinvalidate(); }
linyingfa/AnimatedPieView-master
[ 1, 0, 0, 0 ]
21,553
public List<LineChart> LineChartGen(String filePath, String dataType, List<String> columns, List<String> columnNames) throws IllegalArgumentException { // TODO Auto-generated method stub //Read data from hdfs List<String> results = readAllData(filePath,true); //Only read limited line data(if the data length over max length) List<LineChart> lineCharts = new ArrayList<LineChart>(); for(String selectedCol : columnNames) { LineChart lineChart = singleLineGen(results, dataType, columns, selectedCol); if(lineChart == null) continue; else lineCharts.add(lineChart); } return lineCharts; }
public List<LineChart> LineChartGen(String filePath, String dataType, List<String> columns, List<String> columnNames) throws IllegalArgumentException { List<String> results = readAllData(filePath,true); List<LineChart> lineCharts = new ArrayList<LineChart>(); for(String selectedCol : columnNames) { LineChart lineChart = singleLineGen(results, dataType, columns, selectedCol); if(lineChart == null) continue; else lineCharts.add(lineChart); } return lineCharts; }
public list<linechart> linechartgen(string filepath, string datatype, list<string> columns, list<string> columnnames) throws illegalargumentexception { list<string> results = readalldata(filepath,true); list<linechart> linecharts = new arraylist<linechart>(); for(string selectedcol : columnnames) { linechart linechart = singlelinegen(results, datatype, columns, selectedcol); if(linechart == null) continue; else linecharts.add(linechart); } return linecharts; }
milkboylyf/EasyML
[ 0, 1, 0, 0 ]
13,513
@Override public Value evaluate(BlockContext ctx) { ctx.beforeExpression(this); FunctionBlock funcBlock = null; BlockContext callContext = ctx; if (object != null) { // method call on an object if (VariableReference.isSelfReference(object.getName())) { // self object reference? funcBlock = callContext.retrieveLocalFunction(functionName); throw new RockstarRuntimeException("self reference"); } else if (VariableReference.isParentReference(object.getName())) { // parent object reference // find the caller object context RockObject callerObj = ctx.getThisObjectCtx() .orElseThrow(() -> new RockstarRuntimeException("parent reference in a non-object context")); // get the parent object, if exists RockObject parentObj = callerObj.getSuperObject(); if (parentObj != null) { // find the context that contains the function starting the parent callContext = parentObj.getContextForFunction(functionName); // the call context must be the same object as the caller object if ((callContext != null) && (callContext instanceof RockObject) && (((RockObject) callContext).getObjId() == callerObj.getObjId())) { // get the method from that context funcBlock = callContext.retrieveLocalFunction(functionName); } } else { throw new RockstarRuntimeException("parent reference in non-inherited class"); } } else { // object reference ctx.beforeExpression(object); Value objValue = ctx.afterExpression(object, ctx.getVariableValue(object)); if (objValue == null) { throw new RockstarRuntimeException("Object not found: " + object); } if (objValue.isObject()) { // get the object itself RockObject objContext = objValue.getObject(); // find the context that contains the function callContext = objContext.getContextForFunction(functionName); if (callContext == null) { throw new RockstarRuntimeException("Invalid method call " + functionName + " on a " + objValue.getType().name() + " type variable " + object); } // get the method from the object funcBlock = callContext.retrieveLocalFunction(functionName); } else { throw new RockstarRuntimeException("Invalid method call " + functionName + " on a " + objValue.getType().name() + " type variable " + object); } } } else { // simple method call syntax if (VariableReference.isParentReference(functionName) && ctx.getThisObjectCtx().isPresent()) { // unqualified "parent" function: must be a parent constructor reference // find the caller object context RockObject callerObj = ctx.getThisObjectCtx() .orElseThrow(() -> new RockstarRuntimeException("parent constructor call in a non-object context")); // get the parent object, if exists RockObject parentObj = callerObj.getSuperObject(); // TODO check if it is called in a constructor if (parentObj != null) { // context is the parent object callContext = parentObj; // get the constructor from the parent context funcBlock = parentObj.getConstructor(); } else { throw new RockstarRuntimeException("parent constructor reference in non-inherited class"); } } else { // pure function call or unqualified call in an object context? BlockContext funcCtx = ctx.getContextForFunction(functionName); if (funcCtx == null) { // function not found, or function exists only in subcontexts throw new RockstarRuntimeException("Undefined function: " + functionName); } // we found the function, now we need to find the overrides, if it is on an object if (funcCtx instanceof RockObject) { // search the function from the top of the object levels funcCtx = ((RockObject) funcCtx).getTopObject().getContextForFunction(functionName); } else { // find the containing context by name funcCtx = ctx.getContextForFunction(functionName); } // retrieve the function code funcBlock = funcCtx.retrieveLocalFunction(functionName); } } Value retValue; if (funcBlock != null) { List<Expression> params = getParameters(); List<Value> values = new ArrayList<>(params.size()); params.forEach((expr) -> values.add(expr.evaluate(ctx).asParameter())); // call the functon retValue = funcBlock.call(callContext, values); } else { if (object == null) { throw new RockstarRuntimeException("Undefined function: " + functionName); } throw new RockstarRuntimeException("Undefined method: " + functionName + " on class " + object.getName()); } // return the return value return ctx.afterExpression(this, retValue == null ? Value.NULL : retValue); }
@Override public Value evaluate(BlockContext ctx) { ctx.beforeExpression(this); FunctionBlock funcBlock = null; BlockContext callContext = ctx; if (object != null) { if (VariableReference.isSelfReference(object.getName())) { funcBlock = callContext.retrieveLocalFunction(functionName); throw new RockstarRuntimeException("self reference"); } else if (VariableReference.isParentReference(object.getName())) { RockObject callerObj = ctx.getThisObjectCtx() .orElseThrow(() -> new RockstarRuntimeException("parent reference in a non-object context")); RockObject parentObj = callerObj.getSuperObject(); if (parentObj != null) { callContext = parentObj.getContextForFunction(functionName); if ((callContext != null) && (callContext instanceof RockObject) && (((RockObject) callContext).getObjId() == callerObj.getObjId())) { funcBlock = callContext.retrieveLocalFunction(functionName); } } else { throw new RockstarRuntimeException("parent reference in non-inherited class"); } } else { ctx.beforeExpression(object); Value objValue = ctx.afterExpression(object, ctx.getVariableValue(object)); if (objValue == null) { throw new RockstarRuntimeException("Object not found: " + object); } if (objValue.isObject()) { RockObject objContext = objValue.getObject(); callContext = objContext.getContextForFunction(functionName); if (callContext == null) { throw new RockstarRuntimeException("Invalid method call " + functionName + " on a " + objValue.getType().name() + " type variable " + object); } funcBlock = callContext.retrieveLocalFunction(functionName); } else { throw new RockstarRuntimeException("Invalid method call " + functionName + " on a " + objValue.getType().name() + " type variable " + object); } } } else { if (VariableReference.isParentReference(functionName) && ctx.getThisObjectCtx().isPresent()) { RockObject callerObj = ctx.getThisObjectCtx() .orElseThrow(() -> new RockstarRuntimeException("parent constructor call in a non-object context")); RockObject parentObj = callerObj.getSuperObject(); if (parentObj != null) { callContext = parentObj; funcBlock = parentObj.getConstructor(); } else { throw new RockstarRuntimeException("parent constructor reference in non-inherited class"); } } else { BlockContext funcCtx = ctx.getContextForFunction(functionName); if (funcCtx == null) { throw new RockstarRuntimeException("Undefined function: " + functionName); } if (funcCtx instanceof RockObject) { funcCtx = ((RockObject) funcCtx).getTopObject().getContextForFunction(functionName); } else { funcCtx = ctx.getContextForFunction(functionName); } funcBlock = funcCtx.retrieveLocalFunction(functionName); } } Value retValue; if (funcBlock != null) { List<Expression> params = getParameters(); List<Value> values = new ArrayList<>(params.size()); params.forEach((expr) -> values.add(expr.evaluate(ctx).asParameter())); retValue = funcBlock.call(callContext, values); } else { if (object == null) { throw new RockstarRuntimeException("Undefined function: " + functionName); } throw new RockstarRuntimeException("Undefined method: " + functionName + " on class " + object.getName()); } return ctx.afterExpression(this, retValue == null ? Value.NULL : retValue); }
@override public value evaluate(blockcontext ctx) { ctx.beforeexpression(this); functionblock funcblock = null; blockcontext callcontext = ctx; if (object != null) { if (variablereference.isselfreference(object.getname())) { funcblock = callcontext.retrievelocalfunction(functionname); throw new rockstarruntimeexception("self reference"); } else if (variablereference.isparentreference(object.getname())) { rockobject callerobj = ctx.getthisobjectctx() .orelsethrow(() -> new rockstarruntimeexception("parent reference in a non-object context")); rockobject parentobj = callerobj.getsuperobject(); if (parentobj != null) { callcontext = parentobj.getcontextforfunction(functionname); if ((callcontext != null) && (callcontext instanceof rockobject) && (((rockobject) callcontext).getobjid() == callerobj.getobjid())) { funcblock = callcontext.retrievelocalfunction(functionname); } } else { throw new rockstarruntimeexception("parent reference in non-inherited class"); } } else { ctx.beforeexpression(object); value objvalue = ctx.afterexpression(object, ctx.getvariablevalue(object)); if (objvalue == null) { throw new rockstarruntimeexception("object not found: " + object); } if (objvalue.isobject()) { rockobject objcontext = objvalue.getobject(); callcontext = objcontext.getcontextforfunction(functionname); if (callcontext == null) { throw new rockstarruntimeexception("invalid method call " + functionname + " on a " + objvalue.gettype().name() + " type variable " + object); } funcblock = callcontext.retrievelocalfunction(functionname); } else { throw new rockstarruntimeexception("invalid method call " + functionname + " on a " + objvalue.gettype().name() + " type variable " + object); } } } else { if (variablereference.isparentreference(functionname) && ctx.getthisobjectctx().ispresent()) { rockobject callerobj = ctx.getthisobjectctx() .orelsethrow(() -> new rockstarruntimeexception("parent constructor call in a non-object context")); rockobject parentobj = callerobj.getsuperobject(); if (parentobj != null) { callcontext = parentobj; funcblock = parentobj.getconstructor(); } else { throw new rockstarruntimeexception("parent constructor reference in non-inherited class"); } } else { blockcontext funcctx = ctx.getcontextforfunction(functionname); if (funcctx == null) { throw new rockstarruntimeexception("undefined function: " + functionname); } if (funcctx instanceof rockobject) { funcctx = ((rockobject) funcctx).gettopobject().getcontextforfunction(functionname); } else { funcctx = ctx.getcontextforfunction(functionname); } funcblock = funcctx.retrievelocalfunction(functionname); } } value retvalue; if (funcblock != null) { list<expression> params = getparameters(); list<value> values = new arraylist<>(params.size()); params.foreach((expr) -> values.add(expr.evaluate(ctx).asparameter())); retvalue = funcblock.call(callcontext, values); } else { if (object == null) { throw new rockstarruntimeexception("undefined function: " + functionname); } throw new rockstarruntimeexception("undefined method: " + functionname + " on class " + object.getname()); } return ctx.afterexpression(this, retvalue == null ? value.null : retvalue); }
mikesep/rocky
[ 1, 1, 0, 0 ]
21,954
public static InputSource getInputSource(XSLTC xsltc, Source source) throws TransformerConfigurationException { InputSource input = null; final String systemId = source.getSystemId(); try { // Try to get InputSource from SAXSource input if (source instanceof SAXSource) { final SAXSource sax = (SAXSource) source; input = sax.getInputSource(); // Pass the SAX parser to the compiler try { XMLReader reader = sax.getXMLReader(); /* * Fix for bug 24695 According to JAXP 1.2 specification if a * SAXSource is created using a SAX InputSource the Transformer or * TransformerFactory creates a reader via the XMLReaderFactory if * setXMLReader is not used */ if (reader == null) { try { reader = XMLReaderFactory.createXMLReader(); } catch (final Exception e) { try { // Incase there is an exception thrown // resort to JAXP final SAXParserFactory parserFactory = SAXParserFactory.newInstance(); parserFactory.setNamespaceAware(true); if (xsltc.isSecureProcessing()) { try { parserFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (final SAXException se) { } } reader = parserFactory.newSAXParser().getXMLReader(); } catch (final ParserConfigurationException pce) { throw new TransformerConfigurationException("ParserConfigurationException", pce); } } } reader.setFeature("http://xml.org/sax/features/namespaces", true); reader.setFeature("http://xml.org/sax/features/namespace-prefixes", false); xsltc.setXMLReader(reader); } catch (final SAXNotRecognizedException snre) { throw new TransformerConfigurationException("SAXNotRecognizedException ", snre); } catch (final SAXNotSupportedException snse) { throw new TransformerConfigurationException("SAXNotSupportedException ", snse); } catch (final SAXException se) { throw new TransformerConfigurationException("SAXException ", se); } } // handle DOMSource else if (source instanceof DOMSource) { final DOMSource domsrc = (DOMSource) source; final Document dom = (Document) domsrc.getNode(); final DOM2SAX dom2sax = new DOM2SAX(dom); xsltc.setXMLReader(dom2sax); // Try to get SAX InputSource from DOM Source. input = SAXSource.sourceToInputSource(source); if (input == null) { input = new InputSource(domsrc.getSystemId()); } } // Try to get InputStream or Reader from StreamSource else if (source instanceof StreamSource) { final StreamSource stream = (StreamSource) source; final InputStream istream = stream.getInputStream(); final Reader reader = stream.getReader(); xsltc.setXMLReader(null); // Clear old XML reader // Create InputSource from Reader or InputStream in Source if (istream != null) { input = new InputSource(istream); } else if (reader != null) { input = new InputSource(reader); } else { input = new InputSource(systemId); } } else { final ErrorMsg err = new ErrorMsg(Messages.get().jaxpUnknownSourceErr()); throw new TransformerConfigurationException(err.toString()); } input.setSystemId(systemId); } catch (final NullPointerException e) { final ErrorMsg err = new ErrorMsg(Messages.get().jaxpNoSourceErr("TransformerFactory.newTemplates()")); throw new TransformerConfigurationException(err.toString()); } catch (final SecurityException e) { final ErrorMsg err = new ErrorMsg(Messages.get().fileAccessErr(systemId), -1); throw new TransformerConfigurationException(err.toString()); } return input; }
public static InputSource getInputSource(XSLTC xsltc, Source source) throws TransformerConfigurationException { InputSource input = null; final String systemId = source.getSystemId(); try { if (source instanceof SAXSource) { final SAXSource sax = (SAXSource) source; input = sax.getInputSource(); try { XMLReader reader = sax.getXMLReader(); if (reader == null) { try { reader = XMLReaderFactory.createXMLReader(); } catch (final Exception e) { try { final SAXParserFactory parserFactory = SAXParserFactory.newInstance(); parserFactory.setNamespaceAware(true); if (xsltc.isSecureProcessing()) { try { parserFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (final SAXException se) { } } reader = parserFactory.newSAXParser().getXMLReader(); } catch (final ParserConfigurationException pce) { throw new TransformerConfigurationException("ParserConfigurationException", pce); } } } reader.setFeature("http://xml.org/sax/features/namespaces", true); reader.setFeature("http://xml.org/sax/features/namespace-prefixes", false); xsltc.setXMLReader(reader); } catch (final SAXNotRecognizedException snre) { throw new TransformerConfigurationException("SAXNotRecognizedException ", snre); } catch (final SAXNotSupportedException snse) { throw new TransformerConfigurationException("SAXNotSupportedException ", snse); } catch (final SAXException se) { throw new TransformerConfigurationException("SAXException ", se); } } else if (source instanceof DOMSource) { final DOMSource domsrc = (DOMSource) source; final Document dom = (Document) domsrc.getNode(); final DOM2SAX dom2sax = new DOM2SAX(dom); xsltc.setXMLReader(dom2sax); input = SAXSource.sourceToInputSource(source); if (input == null) { input = new InputSource(domsrc.getSystemId()); } } else if (source instanceof StreamSource) { final StreamSource stream = (StreamSource) source; final InputStream istream = stream.getInputStream(); final Reader reader = stream.getReader(); xsltc.setXMLReader(null); if (istream != null) { input = new InputSource(istream); } else if (reader != null) { input = new InputSource(reader); } else { input = new InputSource(systemId); } } else { final ErrorMsg err = new ErrorMsg(Messages.get().jaxpUnknownSourceErr()); throw new TransformerConfigurationException(err.toString()); } input.setSystemId(systemId); } catch (final NullPointerException e) { final ErrorMsg err = new ErrorMsg(Messages.get().jaxpNoSourceErr("TransformerFactory.newTemplates()")); throw new TransformerConfigurationException(err.toString()); } catch (final SecurityException e) { final ErrorMsg err = new ErrorMsg(Messages.get().fileAccessErr(systemId), -1); throw new TransformerConfigurationException(err.toString()); } return input; }
public static inputsource getinputsource(xsltc xsltc, source source) throws transformerconfigurationexception { inputsource input = null; final string systemid = source.getsystemid(); try { if (source instanceof saxsource) { final saxsource sax = (saxsource) source; input = sax.getinputsource(); try { xmlreader reader = sax.getxmlreader(); if (reader == null) { try { reader = xmlreaderfactory.createxmlreader(); } catch (final exception e) { try { final saxparserfactory parserfactory = saxparserfactory.newinstance(); parserfactory.setnamespaceaware(true); if (xsltc.issecureprocessing()) { try { parserfactory.setfeature(xmlconstants.feature_secure_processing, true); } catch (final saxexception se) { } } reader = parserfactory.newsaxparser().getxmlreader(); } catch (final parserconfigurationexception pce) { throw new transformerconfigurationexception("parserconfigurationexception", pce); } } } reader.setfeature("http://xml.org/sax/features/namespaces", true); reader.setfeature("http://xml.org/sax/features/namespace-prefixes", false); xsltc.setxmlreader(reader); } catch (final saxnotrecognizedexception snre) { throw new transformerconfigurationexception("saxnotrecognizedexception ", snre); } catch (final saxnotsupportedexception snse) { throw new transformerconfigurationexception("saxnotsupportedexception ", snse); } catch (final saxexception se) { throw new transformerconfigurationexception("saxexception ", se); } } else if (source instanceof domsource) { final domsource domsrc = (domsource) source; final document dom = (document) domsrc.getnode(); final dom2sax dom2sax = new dom2sax(dom); xsltc.setxmlreader(dom2sax); input = saxsource.sourcetoinputsource(source); if (input == null) { input = new inputsource(domsrc.getsystemid()); } } else if (source instanceof streamsource) { final streamsource stream = (streamsource) source; final inputstream istream = stream.getinputstream(); final reader reader = stream.getreader(); xsltc.setxmlreader(null); if (istream != null) { input = new inputsource(istream); } else if (reader != null) { input = new inputsource(reader); } else { input = new inputsource(systemid); } } else { final errormsg err = new errormsg(messages.get().jaxpunknownsourceerr()); throw new transformerconfigurationexception(err.tostring()); } input.setsystemid(systemid); } catch (final nullpointerexception e) { final errormsg err = new errormsg(messages.get().jaxpnosourceerr("transformerfactory.newtemplates()")); throw new transformerconfigurationexception(err.tostring()); } catch (final securityexception e) { final errormsg err = new errormsg(messages.get().fileaccesserr(systemid), -1); throw new transformerconfigurationexception(err.tostring()); } return input; }
lyca/lyca-xslt
[ 0, 0, 1, 0 ]
30,244
public void handleKey(KeyCode code) throws IOException, ClassNotFoundException { switch (code) { case UP: move(new Point(-1, 0),""); break; case RIGHT: move(new Point(0, 1),""); break; case DOWN: move(new Point(1, 0),""); break; case LEFT: move(new Point(0, -1),""); break; default: // TODO: implement something funny. } if (isDebugActive()) { System.out.println(code); } }
public void handleKey(KeyCode code) throws IOException, ClassNotFoundException { switch (code) { case UP: move(new Point(-1, 0),""); break; case RIGHT: move(new Point(0, 1),""); break; case DOWN: move(new Point(1, 0),""); break; case LEFT: move(new Point(0, -1),""); break; default: } if (isDebugActive()) { System.out.println(code); } }
public void handlekey(keycode code) throws ioexception, classnotfoundexception { switch (code) { case up: move(new point(-1, 0),""); break; case right: move(new point(0, 1),""); break; case down: move(new point(1, 0),""); break; case left: move(new point(0, -1),""); break; default: } if (isdebugactive()) { system.out.println(code); } }
krisiney/SOKOBANFX-DMS-2020
[ 0, 1, 0, 0 ]
22,278
@Override public void onNext(T o) { if (debug) Log.i(TAG, "net onNext o:" + o); observableWrapper.setData(o); logThread(""); if (debug) Log.e(TAG, " check subscriber :" + subscriber + " isUnsubscribed:" + subscriber.isUnsubscribed()); if (subscriber != null && !subscriber.isUnsubscribed()) { subscriber.onNext(o);// FIXME: issue A:外面如果ObservableOn 其他线程,将会是异步操作,如果在实际的onNext调用之前,发生了onComplete或者onError,将会unsubscribe,导致onNext没有被调用 } }
@Override public void onNext(T o) { if (debug) Log.i(TAG, "net onNext o:" + o); observableWrapper.setData(o); logThread(""); if (debug) Log.e(TAG, " check subscriber :" + subscriber + " isUnsubscribed:" + subscriber.isUnsubscribed()); if (subscriber != null && !subscriber.isUnsubscribed()) { subscriber.onNext(o)
@override public void onnext(t o) { if (debug) log.i(tag, "net onnext o:" + o); observablewrapper.setdata(o); logthread(""); if (debug) log.e(tag, " check subscriber :" + subscriber + " isunsubscribed:" + subscriber.isunsubscribed()); if (subscriber != null && !subscriber.isunsubscribed()) { subscriber.onnext(o)
ming1991/mingop
[ 0, 0, 1, 0 ]
22,279
@Override public void onNext(T o) { if (debug) Log.i(TAG, "cache onNext o:" + o); observableWrapper.setData(o); logThread(""); if (netLatch.getCount() > 0) { if (debug) Log.e(TAG, " check subscriber :" + subscriber + " isUnsubscribed:" + subscriber.isUnsubscribed()); if (subscriber != null && !subscriber.isUnsubscribed()) { subscriber.onNext(o);// FIXME: issue A:外面如果ObservableOn 其他线程,将会是异步操作,如果在实际的onNext调用之前,发生了onComplete或者onError,将会unsubscribe,导致onNext没有被调用 } } else { if (debug) Log.e(TAG, "net result had been load,so cache is not need to load"); } }
@Override public void onNext(T o) { if (debug) Log.i(TAG, "cache onNext o:" + o); observableWrapper.setData(o); logThread(""); if (netLatch.getCount() > 0) { if (debug) Log.e(TAG, " check subscriber :" + subscriber + " isUnsubscribed:" + subscriber.isUnsubscribed()); if (subscriber != null && !subscriber.isUnsubscribed()) { subscriber.onNext(o)"net result had been load,so cache is not need to load"); } }
@override public void onnext(t o) { if (debug) log.i(tag, "cache onnext o:" + o); observablewrapper.setdata(o); logthread(""); if (netlatch.getcount() > 0) { if (debug) log.e(tag, " check subscriber :" + subscriber + " isunsubscribed:" + subscriber.isunsubscribed()); if (subscriber != null && !subscriber.isunsubscribed()) { subscriber.onnext(o)"net result had been load,so cache is not need to load"); } }
ming1991/mingop
[ 0, 0, 1, 0 ]
14,123
public abstract Iterable<Tuple2<K, V>> doCall(final T t) throws Exception;
public abstract Iterable<Tuple2<K, V>> doCall(final T t) throws Exception;
public abstract iterable<tuple2<k, v>> docall(final t t) throws exception;
lordjoe/SparkAccumulators
[ 0, 1, 0, 0 ]
22,556
private boolean updateAddressFilter(String filter) { String[] pieces = filter.split("/"); if(pieces.length != 2) { searchTextField.setBackground(Color.RED); return false; } InetAddress new_filter_address; InetAddress new_filter_mask; boolean new_filter_enabled = !(pieces[1].equals("0")); try { new_filter_address = InetAddress.getByName(pieces[0]); // compute the subnet mask address byte[] byte_mask = new byte[4]; int slash = Integer.parseInt(pieces[1]); // compute the mask address // there is probably a way easier way to do this for (int j=0; slash-- > 0; j++) { if (j<8) byte_mask[0] += Math.pow(2,j); if (j<16) byte_mask[1] += Math.pow(2,j-8); if (j<24) byte_mask[2] += Math.pow(2,j-16); if (j<32) byte_mask[3] += Math.pow(2,j-24); } new_filter_mask = InetAddress.getByAddress(byte_mask); } catch (Exception e) { searchTextField.setBackground(Color.RED); return false; } ip_filter_enabled = new_filter_enabled; filter_address = new_filter_address; filter_mask = new_filter_mask; fireExpressionChangedEvent(); //TODO: make data listen to this so that we don't need this call data.setFilterPredicate(this); System.out.println("Updating filter succeeded!"); searchTextField.setBackground(Color.WHITE); return true; }
private boolean updateAddressFilter(String filter) { String[] pieces = filter.split("/"); if(pieces.length != 2) { searchTextField.setBackground(Color.RED); return false; } InetAddress new_filter_address; InetAddress new_filter_mask; boolean new_filter_enabled = !(pieces[1].equals("0")); try { new_filter_address = InetAddress.getByName(pieces[0]); byte[] byte_mask = new byte[4]; int slash = Integer.parseInt(pieces[1]); for (int j=0; slash-- > 0; j++) { if (j<8) byte_mask[0] += Math.pow(2,j); if (j<16) byte_mask[1] += Math.pow(2,j-8); if (j<24) byte_mask[2] += Math.pow(2,j-16); if (j<32) byte_mask[3] += Math.pow(2,j-24); } new_filter_mask = InetAddress.getByAddress(byte_mask); } catch (Exception e) { searchTextField.setBackground(Color.RED); return false; } ip_filter_enabled = new_filter_enabled; filter_address = new_filter_address; filter_mask = new_filter_mask; fireExpressionChangedEvent(); data.setFilterPredicate(this); System.out.println("Updating filter succeeded!"); searchTextField.setBackground(Color.WHITE); return true; }
private boolean updateaddressfilter(string filter) { string[] pieces = filter.split("/"); if(pieces.length != 2) { searchtextfield.setbackground(color.red); return false; } inetaddress new_filter_address; inetaddress new_filter_mask; boolean new_filter_enabled = !(pieces[1].equals("0")); try { new_filter_address = inetaddress.getbyname(pieces[0]); byte[] byte_mask = new byte[4]; int slash = integer.parseint(pieces[1]); for (int j=0; slash-- > 0; j++) { if (j<8) byte_mask[0] += math.pow(2,j); if (j<16) byte_mask[1] += math.pow(2,j-8); if (j<24) byte_mask[2] += math.pow(2,j-16); if (j<32) byte_mask[3] += math.pow(2,j-24); } new_filter_mask = inetaddress.getbyaddress(byte_mask); } catch (exception e) { searchtextfield.setbackground(color.red); return false; } ip_filter_enabled = new_filter_enabled; filter_address = new_filter_address; filter_mask = new_filter_mask; fireexpressionchangedevent(); data.setfilterpredicate(this); system.out.println("updating filter succeeded!"); searchtextfield.setbackground(color.white); return true; }
kylekyle/netgrok
[ 1, 0, 0, 0 ]
22,557
private void updateRanges() { // get the minimum degree rank min_degree_rank = (float)(degreeRangeSlider.getLowValue() - degreeRangeSlider.getMinimum()) / (float)(degreeRangeSlider.getMaximum() - degreeRangeSlider.getMinimum()); max_degree_rank = (float)(degreeRangeSlider.getHighValue() - degreeRangeSlider.getMinimum()) / (float)(degreeRangeSlider.getMaximum() - degreeRangeSlider.getMinimum()); min_bandwidth_rank = (float)(bandwidthRangeSlider.getLowValue() - bandwidthRangeSlider.getMinimum()) / (float)(bandwidthRangeSlider.getMaximum() - bandwidthRangeSlider.getMinimum()); max_bandwidth_rank = (float)(bandwidthRangeSlider.getHighValue() - bandwidthRangeSlider.getMinimum()) / (float)(bandwidthRangeSlider.getMaximum() - bandwidthRangeSlider.getMinimum()); min_degree_enabled = degreeRangeSlider.getLowValue() != degreeRangeSlider.getMinimum(); max_degree_enabled = degreeRangeSlider.getHighValue() != degreeRangeSlider.getMaximum(); min_bandwidth_enabled = bandwidthRangeSlider.getLowValue() != bandwidthRangeSlider.getMinimum(); max_bandwidth_enabled = bandwidthRangeSlider.getHighValue() != bandwidthRangeSlider.getMaximum(); fireExpressionChangedEvent(); //TODO: make data listen to this so that we don't need this call data.setFilterPredicate(this); }
private void updateRanges() { min_degree_rank = (float)(degreeRangeSlider.getLowValue() - degreeRangeSlider.getMinimum()) / (float)(degreeRangeSlider.getMaximum() - degreeRangeSlider.getMinimum()); max_degree_rank = (float)(degreeRangeSlider.getHighValue() - degreeRangeSlider.getMinimum()) / (float)(degreeRangeSlider.getMaximum() - degreeRangeSlider.getMinimum()); min_bandwidth_rank = (float)(bandwidthRangeSlider.getLowValue() - bandwidthRangeSlider.getMinimum()) / (float)(bandwidthRangeSlider.getMaximum() - bandwidthRangeSlider.getMinimum()); max_bandwidth_rank = (float)(bandwidthRangeSlider.getHighValue() - bandwidthRangeSlider.getMinimum()) / (float)(bandwidthRangeSlider.getMaximum() - bandwidthRangeSlider.getMinimum()); min_degree_enabled = degreeRangeSlider.getLowValue() != degreeRangeSlider.getMinimum(); max_degree_enabled = degreeRangeSlider.getHighValue() != degreeRangeSlider.getMaximum(); min_bandwidth_enabled = bandwidthRangeSlider.getLowValue() != bandwidthRangeSlider.getMinimum(); max_bandwidth_enabled = bandwidthRangeSlider.getHighValue() != bandwidthRangeSlider.getMaximum(); fireExpressionChangedEvent(); data.setFilterPredicate(this); }
private void updateranges() { min_degree_rank = (float)(degreerangeslider.getlowvalue() - degreerangeslider.getminimum()) / (float)(degreerangeslider.getmaximum() - degreerangeslider.getminimum()); max_degree_rank = (float)(degreerangeslider.gethighvalue() - degreerangeslider.getminimum()) / (float)(degreerangeslider.getmaximum() - degreerangeslider.getminimum()); min_bandwidth_rank = (float)(bandwidthrangeslider.getlowvalue() - bandwidthrangeslider.getminimum()) / (float)(bandwidthrangeslider.getmaximum() - bandwidthrangeslider.getminimum()); max_bandwidth_rank = (float)(bandwidthrangeslider.gethighvalue() - bandwidthrangeslider.getminimum()) / (float)(bandwidthrangeslider.getmaximum() - bandwidthrangeslider.getminimum()); min_degree_enabled = degreerangeslider.getlowvalue() != degreerangeslider.getminimum(); max_degree_enabled = degreerangeslider.gethighvalue() != degreerangeslider.getmaximum(); min_bandwidth_enabled = bandwidthrangeslider.getlowvalue() != bandwidthrangeslider.getminimum(); max_bandwidth_enabled = bandwidthrangeslider.gethighvalue() != bandwidthrangeslider.getmaximum(); fireexpressionchangedevent(); data.setfilterpredicate(this); }
kylekyle/netgrok
[ 1, 0, 0, 0 ]
30,751
private void resolveConstantPoolReferences(ConstantInfo[] constantPool) { for (ConstantInfo constant : constantPool) { if (constant instanceof ConstantInfo.Class) { ConstantInfo.Class info = (ConstantInfo.Class)constant; info.setName(((ConstantInfo.Utf8)constantPool[info.getNameIndex() - 1]).getString()); } else if (constant instanceof ConstantInfo.Fieldref) { ConstantInfo.Fieldref info = (ConstantInfo.Fieldref)constant; info.setClassInfo((ConstantInfo.Class)constantPool[info.getClassIndex() - 1]); info.setNameAndType((ConstantInfo.NameAndType)constantPool[info.getNameAndTypeIndex() - 1]); } else if (constant instanceof ConstantInfo.Methodref) { ConstantInfo.Methodref info = (ConstantInfo.Methodref)constant; info.setClassInfo((ConstantInfo.Class)constantPool[info.getClassIndex() - 1]); info.setNameAndType((ConstantInfo.NameAndType)constantPool[info.getNameAndTypeIndex() - 1]); } else if (constant instanceof ConstantInfo.InterfaceMethodref) { ConstantInfo.InterfaceMethodref info = (ConstantInfo.InterfaceMethodref)constant; info.setClassInfo((ConstantInfo.Class)constantPool[info.getClassIndex() - 1]); info.setNameAndType((ConstantInfo.NameAndType)constantPool[info.getNameAndTypeIndex() - 1]); } else if (constant instanceof ConstantInfo.String) { ConstantInfo.String info = (ConstantInfo.String)constant; info.setString(((ConstantInfo.Utf8)constantPool[info.getStringIndex() - 1]).getString()); } else if (constant instanceof ConstantInfo.Integer || constant instanceof ConstantInfo.Float || constant instanceof ConstantInfo.Long || constant instanceof ConstantInfo.Double) { // not needed } else if (constant instanceof ConstantInfo.NameAndType) { ConstantInfo.NameAndType info = (ConstantInfo.NameAndType)constant; info.setName(((ConstantInfo.Utf8)constantPool[info.getNameIndex() - 1]).getString()); info.setDescriptor(((ConstantInfo.Utf8)constantPool[info.getDescriptorIndex() - 1]).getString()); } else if (constant instanceof ConstantInfo.Utf8) { // not needed } else if (constant instanceof ConstantInfo.MethodHandle || constant instanceof ConstantInfo.MethodType || constant instanceof ConstantInfo.InvokeDynamic) { // not used yet } else if (constant != null) { // Long/Double may leave create a blank space throw new UnsupportedOperationException("Unhandled ConstantType: " + constant); } } }
private void resolveConstantPoolReferences(ConstantInfo[] constantPool) { for (ConstantInfo constant : constantPool) { if (constant instanceof ConstantInfo.Class) { ConstantInfo.Class info = (ConstantInfo.Class)constant; info.setName(((ConstantInfo.Utf8)constantPool[info.getNameIndex() - 1]).getString()); } else if (constant instanceof ConstantInfo.Fieldref) { ConstantInfo.Fieldref info = (ConstantInfo.Fieldref)constant; info.setClassInfo((ConstantInfo.Class)constantPool[info.getClassIndex() - 1]); info.setNameAndType((ConstantInfo.NameAndType)constantPool[info.getNameAndTypeIndex() - 1]); } else if (constant instanceof ConstantInfo.Methodref) { ConstantInfo.Methodref info = (ConstantInfo.Methodref)constant; info.setClassInfo((ConstantInfo.Class)constantPool[info.getClassIndex() - 1]); info.setNameAndType((ConstantInfo.NameAndType)constantPool[info.getNameAndTypeIndex() - 1]); } else if (constant instanceof ConstantInfo.InterfaceMethodref) { ConstantInfo.InterfaceMethodref info = (ConstantInfo.InterfaceMethodref)constant; info.setClassInfo((ConstantInfo.Class)constantPool[info.getClassIndex() - 1]); info.setNameAndType((ConstantInfo.NameAndType)constantPool[info.getNameAndTypeIndex() - 1]); } else if (constant instanceof ConstantInfo.String) { ConstantInfo.String info = (ConstantInfo.String)constant; info.setString(((ConstantInfo.Utf8)constantPool[info.getStringIndex() - 1]).getString()); } else if (constant instanceof ConstantInfo.Integer || constant instanceof ConstantInfo.Float || constant instanceof ConstantInfo.Long || constant instanceof ConstantInfo.Double) { } else if (constant instanceof ConstantInfo.NameAndType) { ConstantInfo.NameAndType info = (ConstantInfo.NameAndType)constant; info.setName(((ConstantInfo.Utf8)constantPool[info.getNameIndex() - 1]).getString()); info.setDescriptor(((ConstantInfo.Utf8)constantPool[info.getDescriptorIndex() - 1]).getString()); } else if (constant instanceof ConstantInfo.Utf8) { } else if (constant instanceof ConstantInfo.MethodHandle || constant instanceof ConstantInfo.MethodType || constant instanceof ConstantInfo.InvokeDynamic) { } else if (constant != null) { throw new UnsupportedOperationException("Unhandled ConstantType: " + constant); } } }
private void resolveconstantpoolreferences(constantinfo[] constantpool) { for (constantinfo constant : constantpool) { if (constant instanceof constantinfo.class) { constantinfo.class info = (constantinfo.class)constant; info.setname(((constantinfo.utf8)constantpool[info.getnameindex() - 1]).getstring()); } else if (constant instanceof constantinfo.fieldref) { constantinfo.fieldref info = (constantinfo.fieldref)constant; info.setclassinfo((constantinfo.class)constantpool[info.getclassindex() - 1]); info.setnameandtype((constantinfo.nameandtype)constantpool[info.getnameandtypeindex() - 1]); } else if (constant instanceof constantinfo.methodref) { constantinfo.methodref info = (constantinfo.methodref)constant; info.setclassinfo((constantinfo.class)constantpool[info.getclassindex() - 1]); info.setnameandtype((constantinfo.nameandtype)constantpool[info.getnameandtypeindex() - 1]); } else if (constant instanceof constantinfo.interfacemethodref) { constantinfo.interfacemethodref info = (constantinfo.interfacemethodref)constant; info.setclassinfo((constantinfo.class)constantpool[info.getclassindex() - 1]); info.setnameandtype((constantinfo.nameandtype)constantpool[info.getnameandtypeindex() - 1]); } else if (constant instanceof constantinfo.string) { constantinfo.string info = (constantinfo.string)constant; info.setstring(((constantinfo.utf8)constantpool[info.getstringindex() - 1]).getstring()); } else if (constant instanceof constantinfo.integer || constant instanceof constantinfo.float || constant instanceof constantinfo.long || constant instanceof constantinfo.double) { } else if (constant instanceof constantinfo.nameandtype) { constantinfo.nameandtype info = (constantinfo.nameandtype)constant; info.setname(((constantinfo.utf8)constantpool[info.getnameindex() - 1]).getstring()); info.setdescriptor(((constantinfo.utf8)constantpool[info.getdescriptorindex() - 1]).getstring()); } else if (constant instanceof constantinfo.utf8) { } else if (constant instanceof constantinfo.methodhandle || constant instanceof constantinfo.methodtype || constant instanceof constantinfo.invokedynamic) { } else if (constant != null) { throw new unsupportedoperationexception("unhandled constanttype: " + constant); } } }
k0kubun/jjvm
[ 1, 0, 0, 0 ]
22,840
public static void send(final InternalDistributedMember recipient, final int processorId, final DM dm, Set keys) throws ForceReattemptException { Assert.assertTrue(recipient != null, "FetchKeysReplyMessage NULL reply message"); final int numSeries = 1; final int seriesNum = 0; // chunkEntries returns false if didn't finish if (logger.isDebugEnabled()) { logger.debug("Starting pr keys chunking for {} kets to member {}", keys.size(), recipient); } try { boolean finished = chunkSet(recipient, keys, InitialImageOperation.CHUNK_SIZE_IN_BYTES, false, new ObjectIntProcedure() { int msgNum = 0; boolean last = false; /** * @param a byte[] chunk * @param b positive if last chunk * @return true to continue to next chunk */ public boolean executeWith(Object a, int b) { // if (this.last) // throw new InternalGemFireError(LocalizedStrings.FetchKeysMessage_ALREADY_PROCESSED_LAST_CHUNK.toLocalizedString()); HeapDataOutputStream chunk = (HeapDataOutputStream)a; this.last = b > 0; try { boolean okay = sendChunk(recipient, processorId, dm, chunk, seriesNum, msgNum++, numSeries, this.last); return okay; } catch (CancelException e) { return false; } } }); if (logger.isDebugEnabled()) { logger.debug("{} pr keys chunking", (finished?"Finished" : "DID NOT complete")); } } catch (IOException io) { throw new ForceReattemptException(LocalizedStrings.FetchKeysMessage_UNABLE_TO_SEND_RESPONSE_TO_FETCH_KEYS_REQUEST.toLocalizedString(), io); } // TODO [bruce] pass a reference to the cache or region down here so we can do this test //Assert.assertTrue(!cache is closed, "chunking interrupted but cache is still open"); }
public static void send(final InternalDistributedMember recipient, final int processorId, final DM dm, Set keys) throws ForceReattemptException { Assert.assertTrue(recipient != null, "FetchKeysReplyMessage NULL reply message"); final int numSeries = 1; final int seriesNum = 0; if (logger.isDebugEnabled()) { logger.debug("Starting pr keys chunking for {} kets to member {}", keys.size(), recipient); } try { boolean finished = chunkSet(recipient, keys, InitialImageOperation.CHUNK_SIZE_IN_BYTES, false, new ObjectIntProcedure() { int msgNum = 0; boolean last = false; public boolean executeWith(Object a, int b) { HeapDataOutputStream chunk = (HeapDataOutputStream)a; this.last = b > 0; try { boolean okay = sendChunk(recipient, processorId, dm, chunk, seriesNum, msgNum++, numSeries, this.last); return okay; } catch (CancelException e) { return false; } } }); if (logger.isDebugEnabled()) { logger.debug("{} pr keys chunking", (finished?"Finished" : "DID NOT complete")); } } catch (IOException io) { throw new ForceReattemptException(LocalizedStrings.FetchKeysMessage_UNABLE_TO_SEND_RESPONSE_TO_FETCH_KEYS_REQUEST.toLocalizedString(), io); } }
public static void send(final internaldistributedmember recipient, final int processorid, final dm dm, set keys) throws forcereattemptexception { assert.asserttrue(recipient != null, "fetchkeysreplymessage null reply message"); final int numseries = 1; final int seriesnum = 0; if (logger.isdebugenabled()) { logger.debug("starting pr keys chunking for {} kets to member {}", keys.size(), recipient); } try { boolean finished = chunkset(recipient, keys, initialimageoperation.chunk_size_in_bytes, false, new objectintprocedure() { int msgnum = 0; boolean last = false; public boolean executewith(object a, int b) { heapdataoutputstream chunk = (heapdataoutputstream)a; this.last = b > 0; try { boolean okay = sendchunk(recipient, processorid, dm, chunk, seriesnum, msgnum++, numseries, this.last); return okay; } catch (cancelexception e) { return false; } } }); if (logger.isdebugenabled()) { logger.debug("{} pr keys chunking", (finished?"finished" : "did not complete")); } } catch (ioexception io) { throw new forcereattemptexception(localizedstrings.fetchkeysmessage_unable_to_send_response_to_fetch_keys_request.tolocalizedstring(), io); } }
karensmolermiller/incubator-geode
[ 0, 1, 0, 0 ]
14,744
@Override void processOFMessage(ControllerChannelHandler h, OFMessage m) throws IOException { switch (m.getType()) { case HELLO: processOFHello(h, (OFHello) m); break; case ECHO_REPLY: break; case ECHO_REQUEST: processOFEchoRequest(h, (OFEchoRequest) m); break; case FEATURES_REQUEST: processOFFeaturesRequest(h, (OFFeaturesRequest) m); break; case BARRIER_REQUEST: //TODO: actually implement barrier contract OFBarrierReply breply = new OFBarrierReply(); breply.setXid(m.getXid()); h.channel.write(Collections.singletonList(breply)); break; case SET_CONFIG: case ERROR: case PACKET_OUT: case PORT_MOD: case QUEUE_GET_CONFIG_REQUEST: case STATS_REQUEST: case FLOW_MOD: case GET_CONFIG_REQUEST: h.sw.handleIO(m); break; case VENDOR: unhandledMessageReceived(h, m); break; case FEATURES_REPLY: case FLOW_REMOVED: case PACKET_IN: case PORT_STATUS: case BARRIER_REPLY: case GET_CONFIG_REPLY: case STATS_REPLY: case QUEUE_GET_CONFIG_REPLY: illegalMessageReceived(h, m); break; } }
@Override void processOFMessage(ControllerChannelHandler h, OFMessage m) throws IOException { switch (m.getType()) { case HELLO: processOFHello(h, (OFHello) m); break; case ECHO_REPLY: break; case ECHO_REQUEST: processOFEchoRequest(h, (OFEchoRequest) m); break; case FEATURES_REQUEST: processOFFeaturesRequest(h, (OFFeaturesRequest) m); break; case BARRIER_REQUEST: OFBarrierReply breply = new OFBarrierReply(); breply.setXid(m.getXid()); h.channel.write(Collections.singletonList(breply)); break; case SET_CONFIG: case ERROR: case PACKET_OUT: case PORT_MOD: case QUEUE_GET_CONFIG_REQUEST: case STATS_REQUEST: case FLOW_MOD: case GET_CONFIG_REQUEST: h.sw.handleIO(m); break; case VENDOR: unhandledMessageReceived(h, m); break; case FEATURES_REPLY: case FLOW_REMOVED: case PACKET_IN: case PORT_STATUS: case BARRIER_REPLY: case GET_CONFIG_REPLY: case STATS_REPLY: case QUEUE_GET_CONFIG_REPLY: illegalMessageReceived(h, m); break; } }
@override void processofmessage(controllerchannelhandler h, ofmessage m) throws ioexception { switch (m.gettype()) { case hello: processofhello(h, (ofhello) m); break; case echo_reply: break; case echo_request: processofechorequest(h, (ofechorequest) m); break; case features_request: processoffeaturesrequest(h, (offeaturesrequest) m); break; case barrier_request: ofbarrierreply breply = new ofbarrierreply(); breply.setxid(m.getxid()); h.channel.write(collections.singletonlist(breply)); break; case set_config: case error: case packet_out: case port_mod: case queue_get_config_request: case stats_request: case flow_mod: case get_config_request: h.sw.handleio(m); break; case vendor: unhandledmessagereceived(h, m); break; case features_reply: case flow_removed: case packet_in: case port_status: case barrier_reply: case get_config_reply: case stats_reply: case queue_get_config_reply: illegalmessagereceived(h, m); break; } }
mgerola/OpenVirteX
[ 0, 1, 0, 0 ]
14,763
private void concultar() { String sql = "select * from tbusuarios where iduser=?"; try { pst = conexao.prepareStatement(sql); pst.setString(1, txtUsuId.getText()); rs = pst.executeQuery(); if (rs.next()) { txtUsuNome.setText(rs.getString(2)); txtUsuFone.setText(rs.getString(3)); txtUsuLogin.setText(rs.getString(4)); txtUsuSenha.setText(rs.getString(5)); //a linha abaixo se refere ao combobox cboUsuPerfil.setSelectedItem(rs.getString(6)); } else { JOptionPane.showMessageDialog(null, "Usuário não cadastrado"); //as linhas abaixo "limpam os campos" txtUsuNome.setText(null); txtUsuFone.setText(null); txtUsuLogin.setText(null); txtUsuSenha.setText(null); } } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }
private void concultar() { String sql = "select * from tbusuarios where iduser=?"; try { pst = conexao.prepareStatement(sql); pst.setString(1, txtUsuId.getText()); rs = pst.executeQuery(); if (rs.next()) { txtUsuNome.setText(rs.getString(2)); txtUsuFone.setText(rs.getString(3)); txtUsuLogin.setText(rs.getString(4)); txtUsuSenha.setText(rs.getString(5)); cboUsuPerfil.setSelectedItem(rs.getString(6)); } else { JOptionPane.showMessageDialog(null, "Usuário não cadastrado"); txtUsuNome.setText(null); txtUsuFone.setText(null); txtUsuLogin.setText(null); txtUsuSenha.setText(null); } } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }
private void concultar() { string sql = "select * from tbusuarios where iduser=?"; try { pst = conexao.preparestatement(sql); pst.setstring(1, txtusuid.gettext()); rs = pst.executequery(); if (rs.next()) { txtusunome.settext(rs.getstring(2)); txtusufone.settext(rs.getstring(3)); txtusulogin.settext(rs.getstring(4)); txtususenha.settext(rs.getstring(5)); cbousuperfil.setselecteditem(rs.getstring(6)); } else { joptionpane.showmessagedialog(null, "usuário não cadastrado"); txtusunome.settext(null); txtusufone.settext(null); txtusulogin.settext(null); txtususenha.settext(null); } } catch (exception e) { joptionpane.showmessagedialog(null, e); } }
marceloamorimcg/Dr.InfoSystem
[ 0, 0, 0, 0 ]
14,764
private void adicionar() { String sql = "insert into tbusuarios(iduser, usuario, fone,login,senha,perfil) values(?,?,?,?,?,?)"; try { pst = conexao.prepareStatement(sql); pst.setString(1, txtUsuId.getText()); pst.setString(2, txtUsuNome.getText()); pst.setString(3, txtUsuFone.getText()); pst.setString(4, txtUsuLogin.getText()); pst.setString(5, txtUsuSenha.getText()); pst.setString(6, cboUsuPerfil.getSelectedItem().toString()); //validição dos campos obrigatorios if ((txtUsuId.getText().isEmpty()) || (txtUsuNome.getText().isEmpty()) || (txtUsuLogin.getText().isEmpty()) || (txtUsuSenha.getText().isEmpty())) { JOptionPane.showMessageDialog(null, "Preencha todos os campos Obrigatorio"); } else { //a estrutura abaixo é usada para confirmar a inserção dos dados na tabela //a linha abaixo atualiza a tabela usuario com os dados do formulario int adicionado = pst.executeUpdate(); // testando a logica //System.out.println(adicionado); if (adicionado > 0) { JOptionPane.showMessageDialog(null, "Usuario adicionado com sucesso"); txtUsuNome.setText(null); txtUsuFone.setText(null); txtUsuLogin.setText(null); txtUsuSenha.setText(null); } } } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }
private void adicionar() { String sql = "insert into tbusuarios(iduser, usuario, fone,login,senha,perfil) values(?,?,?,?,?,?)"; try { pst = conexao.prepareStatement(sql); pst.setString(1, txtUsuId.getText()); pst.setString(2, txtUsuNome.getText()); pst.setString(3, txtUsuFone.getText()); pst.setString(4, txtUsuLogin.getText()); pst.setString(5, txtUsuSenha.getText()); pst.setString(6, cboUsuPerfil.getSelectedItem().toString()); if ((txtUsuId.getText().isEmpty()) || (txtUsuNome.getText().isEmpty()) || (txtUsuLogin.getText().isEmpty()) || (txtUsuSenha.getText().isEmpty())) { JOptionPane.showMessageDialog(null, "Preencha todos os campos Obrigatorio"); } else { int adicionado = pst.executeUpdate(); if (adicionado > 0) { JOptionPane.showMessageDialog(null, "Usuario adicionado com sucesso"); txtUsuNome.setText(null); txtUsuFone.setText(null); txtUsuLogin.setText(null); txtUsuSenha.setText(null); } } } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }
private void adicionar() { string sql = "insert into tbusuarios(iduser, usuario, fone,login,senha,perfil) values(?,?,?,?,?,?)"; try { pst = conexao.preparestatement(sql); pst.setstring(1, txtusuid.gettext()); pst.setstring(2, txtusunome.gettext()); pst.setstring(3, txtusufone.gettext()); pst.setstring(4, txtusulogin.gettext()); pst.setstring(5, txtususenha.gettext()); pst.setstring(6, cbousuperfil.getselecteditem().tostring()); if ((txtusuid.gettext().isempty()) || (txtusunome.gettext().isempty()) || (txtusulogin.gettext().isempty()) || (txtususenha.gettext().isempty())) { joptionpane.showmessagedialog(null, "preencha todos os campos obrigatorio"); } else { int adicionado = pst.executeupdate(); if (adicionado > 0) { joptionpane.showmessagedialog(null, "usuario adicionado com sucesso"); txtusunome.settext(null); txtusufone.settext(null); txtusulogin.settext(null); txtususenha.settext(null); } } } catch (exception e) { joptionpane.showmessagedialog(null, e); } }
marceloamorimcg/Dr.InfoSystem
[ 0, 0, 0, 0 ]
14,786
public DataTokenizer buildTokenizerInstance( String tokenizerType ) { // Use a predefined list of known Tokenizers // TODO: publish more tokenizers... (when they are ready/good enough/abstract enough) if ("CSVTokenizer".equals( tokenizerType )) { return new CSVTokenizerImpl(); } // Use the name of a class and instantiate this tokenizer try { // use classloader and search for named class in class path... ClassLoader classLoader = this.getClass().getClassLoader(); Class<?> loadedClass = classLoader.loadClass( tokenizerType ); // TODO: check if superclass is registered as a DataTokenizer.... // and check if it implements DataTokenizer Class<?>[] interfaces = loadedClass.getInterfaces(); if (Arrays.asList( interfaces ).contains( DataTokenizer.class )) { // create the class using the unparametereized the constructor. return (DataTokenizer) loadedClass.getDeclaredConstructor().newInstance(); } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { e.printStackTrace(); } throw new IllegalArgumentException(); }
public DataTokenizer buildTokenizerInstance( String tokenizerType ) { if ("CSVTokenizer".equals( tokenizerType )) { return new CSVTokenizerImpl(); } try { ClassLoader classLoader = this.getClass().getClassLoader(); Class<?> loadedClass = classLoader.loadClass( tokenizerType ); Class<?>[] interfaces = loadedClass.getInterfaces(); if (Arrays.asList( interfaces ).contains( DataTokenizer.class )) { return (DataTokenizer) loadedClass.getDeclaredConstructor().newInstance(); } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { e.printStackTrace(); } throw new IllegalArgumentException(); }
public datatokenizer buildtokenizerinstance( string tokenizertype ) { if ("csvtokenizer".equals( tokenizertype )) { return new csvtokenizerimpl(); } try { classloader classloader = this.getclass().getclassloader(); class<?> loadedclass = classloader.loadclass( tokenizertype ); class<?>[] interfaces = loadedclass.getinterfaces(); if (arrays.aslist( interfaces ).contains( datatokenizer.class )) { return (datatokenizer) loadedclass.getdeclaredconstructor().newinstance(); } } catch (classnotfoundexception | instantiationexception | illegalaccessexception | illegalargumentexception | invocationtargetexception | nosuchmethodexception | securityexception e) { e.printstacktrace(); } throw new illegalargumentexception(); }
mindscan-de/BrightFlux
[ 0, 1, 0, 0 ]
23,051
@Override protected void updateConnectButtonState() { // TODO: Update this logic to also handle the user logged in by email. boolean connected = getPlusClient().isConnected(); mSignOutButtons.setVisibility(connected ? View.VISIBLE : View.GONE); mPlusSignInButton.setVisibility(connected ? View.GONE : View.VISIBLE); }
@Override protected void updateConnectButtonState() { boolean connected = getPlusClient().isConnected(); mSignOutButtons.setVisibility(connected ? View.VISIBLE : View.GONE); mPlusSignInButton.setVisibility(connected ? View.GONE : View.VISIBLE); }
@override protected void updateconnectbuttonstate() { boolean connected = getplusclient().isconnected(); msignoutbuttons.setvisibility(connected ? view.visible : view.gone); mplussigninbutton.setvisibility(connected ? view.gone : view.visible); }
llanox/EasyVote
[ 0, 1, 0, 0 ]
23,285
@Test public void fetchTest(){ // FileConfigProvider fcp = new FileConfigProvider("overrides.json"); // for(Config config : fcp.getAll("prod", "ssa")){ // System.out.println(config); // } // RestConfigProvider rcc = new RestConfigProvider("http://localhost:8080/configuration"); // rcc.getAll("prod", "ssa"); // }
@Test public void fetchTest(){ }
@test public void fetchtest(){ }
krisglover/cia
[ 0, 0, 0, 1 ]
31,543
private String waitForAnswer(String expected) { // todo add the possibility to specify more options to be specified // todo use regexp matching instead of the beginning of a string String line = null; if (expected != null) { try { while ((line = mplayerOutErr.readLine()) != null) { if (MusicZones.getIsDebugOn()) { logger.log(Level.INFO, "Reading line: {0}", line); } if (line.startsWith(expected)) { return line; } } } catch (IOException ex) { System.err.println(ex); } } return line; }
private String waitForAnswer(String expected) { String line = null; if (expected != null) { try { while ((line = mplayerOutErr.readLine()) != null) { if (MusicZones.getIsDebugOn()) { logger.log(Level.INFO, "Reading line: {0}", line); } if (line.startsWith(expected)) { return line; } } } catch (IOException ex) { System.err.println(ex); } } return line; }
private string waitforanswer(string expected) { string line = null; if (expected != null) { try { while ((line = mplayerouterr.readline()) != null) { if (musiczones.getisdebugon()) { logger.log(level.info, "reading line: {0}", line); } if (line.startswith(expected)) { return line; } } } catch (ioexception ex) { system.err.println(ex); } } return line; }
jzerbe/musiczones
[ 0, 1, 0, 0 ]
31,583
private void logGameStart(CFMap map) { log.println("=== CodeFray Version 1 [Capture the Flag] Official Game Log ===\n"); //TODO: FIX ANNOTATION STUFF //log.println("[Red Team Controller: " + quote(game.getController(Team.RED).getIdString()) + "]"); //log.println("[Blue Team Controller: " + quote(game.getController(Team.BLUE).getIdString()) + "]"); log.println(); log.println("> Game started."); }
private void logGameStart(CFMap map) { log.println("=== CodeFray Version 1 [Capture the Flag] Official Game Log ===\n"); log.println(); log.println("> Game started."); }
private void loggamestart(cfmap map) { log.println("=== codefray version 1 [capture the flag] official game log ===\n"); log.println(); log.println("> game started."); }
lg198/CodeFray
[ 0, 1, 0, 0 ]
31,644
public int getPriorityLevel(LinkedList<String> questionAsked) { // If the filtered question is the same than asked if(normalizedQuestion.equals(questionAsked)) return 100; // If it is an ordered subset // TODO I'M NOT SURE IF THIS IS WORKING else if(isSubset(questionAsked)) return 65; else if(containsWords(questionAsked)>0) return 30; // Otherwise else return 0; }
public int getPriorityLevel(LinkedList<String> questionAsked) { if(normalizedQuestion.equals(questionAsked)) return 100; else if(isSubset(questionAsked)) return 65; else if(containsWords(questionAsked)>0) return 30; else return 0; }
public int getprioritylevel(linkedlist<string> questionasked) { if(normalizedquestion.equals(questionasked)) return 100; else if(issubset(questionasked)) return 65; else if(containswords(questionasked)>0) return 30; else return 0; }
melvidoni/chatbot
[ 1, 0, 0, 0 ]
31,645
private int containsWords(LinkedList<String> questionAsked) { // Create a counter int containedWords = 0; // For each word asked for(String wordAsked : questionAsked) { // If found, we add one, otherwise, we add zero containedWords += normalizedQuestion.contains(wordAsked) ? 1 : 0; } // Return the value return containedWords; }
private int containsWords(LinkedList<String> questionAsked) { int containedWords = 0; for(String wordAsked : questionAsked) { containedWords += normalizedQuestion.contains(wordAsked) ? 1 : 0; } return containedWords; }
private int containswords(linkedlist<string> questionasked) { int containedwords = 0; for(string wordasked : questionasked) { containedwords += normalizedquestion.contains(wordasked) ? 1 : 0; } return containedwords; }
melvidoni/chatbot
[ 1, 0, 0, 0 ]
31,742
@Inject( method = "updateTexture()V", at = @At( value = "HEAD", target = "net/minecraft/client/render/MapRenderer$MapTexture.updateTexture()V" ), cancellable = true) private void updateAetherTexture(CallbackInfo ci) { if (this.state.dimension == AetherDimension.AETHER_WORLD_KEY){ for (int i = 0; i < 128; ++i) { for (int j = 0; j < 128; ++j) { int k = j + i * 128; int l = this.state.colors[k] & 255; if (l >> 2 == 0) { // MapColor.CLEAR // Who knows what this does? Nothing, it seems. But just in case I'll let it stick around. // Comment your code please! this.texture.getImage().setColor(j, i, (k + k / 128 & 1) * 8 + 16 << 24); } else { this.texture.getImage().setColor(j, i, AetherMapColorUtil.getColor(MapColor.COLORS[l >> 2], l & 3)); } } } this.texture.upload(); ci.cancel(); } }
@Inject( method = "updateTexture()V", at = @At( value = "HEAD", target = "net/minecraft/client/render/MapRenderer$MapTexture.updateTexture()V" ), cancellable = true) private void updateAetherTexture(CallbackInfo ci) { if (this.state.dimension == AetherDimension.AETHER_WORLD_KEY){ for (int i = 0; i < 128; ++i) { for (int j = 0; j < 128; ++j) { int k = j + i * 128; int l = this.state.colors[k] & 255; if (l >> 2 == 0) { this.texture.getImage().setColor(j, i, (k + k / 128 & 1) * 8 + 16 << 24); } else { this.texture.getImage().setColor(j, i, AetherMapColorUtil.getColor(MapColor.COLORS[l >> 2], l & 3)); } } } this.texture.upload(); ci.cancel(); } }
@inject( method = "updatetexture()v", at = @at( value = "head", target = "net/minecraft/client/render/maprenderer$maptexture.updatetexture()v" ), cancellable = true) private void updateaethertexture(callbackinfo ci) { if (this.state.dimension == aetherdimension.aether_world_key){ for (int i = 0; i < 128; ++i) { for (int j = 0; j < 128; ++j) { int k = j + i * 128; int l = this.state.colors[k] & 255; if (l >> 2 == 0) { this.texture.getimage().setcolor(j, i, (k + k / 128 & 1) * 8 + 16 << 24); } else { this.texture.getimage().setcolor(j, i, aethermapcolorutil.getcolor(mapcolor.colors[l >> 2], l & 3)); } } } this.texture.upload(); ci.cancel(); } }
kalucky0/The-Aether
[ 1, 0, 0, 0 ]
31,763
@Test public void test_EchoUser_restTemplate() { String firstName = "Chuck"; String lastName = "Norris"; String result = restTemplate.getForObject( "http://localhost:8888/"+firstName+"/"+lastName, String.class); String expected = "{\"firstName\":\""+firstName+"\",\"lastName\":\""+lastName+"\"}"; assertThat(result, containsString(expected)); log.info("*** Successfully echoed a User ("+firstName+" "+lastName+") through REST ***"); }
@Test public void test_EchoUser_restTemplate() { String firstName = "Chuck"; String lastName = "Norris"; String result = restTemplate.getForObject( "http://localhost:8888/"+firstName+"/"+lastName, String.class); String expected = "{\"firstName\":\""+firstName+"\",\"lastName\":\""+lastName+"\"}"; assertThat(result, containsString(expected)); log.info("*** Successfully echoed a User ("+firstName+" "+lastName+") through REST ***"); }
@test public void test_echouser_resttemplate() { string firstname = "chuck"; string lastname = "norris"; string result = resttemplate.getforobject( "http://localhost:8888/"+firstname+"/"+lastname, string.class); string expected = "{\"firstname\":\""+firstname+"\",\"lastname\":\""+lastname+"\"}"; assertthat(result, containsstring(expected)); log.info("*** successfully echoed a user ("+firstname+" "+lastname+") through rest ***"); }
mickknutson/spring-cloud-config
[ 0, 0, 1, 0 ]
15,506
public boolean validateBinaryExpr(BinaryExpr node) { ExprNode expr1 = node.getExpr1(); ExprNode expr2 = node.getExpr2(); Type t1 = expr1.getType(); Type t2 = expr2.getType(); String op = node.getOperation(); switch (op) { case "==": case "!=": if (Types.isNumber(t1)) { return this.requireNumber(expr2,t2); } else { return true; //TODO pass anything.may be Object needed? } case "+": case "-": case "*": case "/": case "%": case ">=": case "<=": case ">": case "<": case "&": case "|": case "^": case BinaryExpr.OP_SHIFT_LEFT: case BinaryExpr.OP_SHIFT_RIGHT: case BinaryExpr.OP_UNSIGNED_SHIFT_RIGHT: return this.requireNumber(expr1, t1) && this.requireNumber(expr2, t2); case "&&": case "||": return requireBoolean(expr1, t1) && requireBoolean(expr2, t2); default: diagnosisReporter.report(Diagnosis.Kind.ERROR, "unsupported operation:" + op, node.offset); return false; } }
public boolean validateBinaryExpr(BinaryExpr node) { ExprNode expr1 = node.getExpr1(); ExprNode expr2 = node.getExpr2(); Type t1 = expr1.getType(); Type t2 = expr2.getType(); String op = node.getOperation(); switch (op) { case "==": case "!=": if (Types.isNumber(t1)) { return this.requireNumber(expr2,t2); } else { return true; } case "+": case "-": case "*": case "/": case "%": case ">=": case "<=": case ">": case "<": case "&": case "|": case "^": case BinaryExpr.OP_SHIFT_LEFT: case BinaryExpr.OP_SHIFT_RIGHT: case BinaryExpr.OP_UNSIGNED_SHIFT_RIGHT: return this.requireNumber(expr1, t1) && this.requireNumber(expr2, t2); case "&&": case "||": return requireBoolean(expr1, t1) && requireBoolean(expr2, t2); default: diagnosisReporter.report(Diagnosis.Kind.ERROR, "unsupported operation:" + op, node.offset); return false; } }
public boolean validatebinaryexpr(binaryexpr node) { exprnode expr1 = node.getexpr1(); exprnode expr2 = node.getexpr2(); type t1 = expr1.gettype(); type t2 = expr2.gettype(); string op = node.getoperation(); switch (op) { case "==": case "!=": if (types.isnumber(t1)) { return this.requirenumber(expr2,t2); } else { return true; } case "+": case "-": case "*": case "/": case "%": case ">=": case "<=": case ">": case "<": case "&": case "|": case "^": case binaryexpr.op_shift_left: case binaryexpr.op_shift_right: case binaryexpr.op_unsigned_shift_right: return this.requirenumber(expr1, t1) && this.requirenumber(expr2, t2); case "&&": case "||": return requireboolean(expr1, t1) && requireboolean(expr2, t2); default: diagnosisreporter.report(diagnosis.kind.error, "unsupported operation:" + op, node.offset); return false; } }
lbqh/kalang
[ 0, 1, 0, 0 ]
15,600
public void projectTo(final ComplexProjective1 cp) throws IllegalArgumentException { /* Check if the point lies on the sphere. */ if (Math.abs(normSquared() - 1.0) > EPSILON) { throw new IllegalArgumentException("Norm must be 1.0. " + "Norm is " + norm() + ". "); } /* Check if the point lies above or below the xy-plane. */ if (z > 0.0) { /* We might be close to the north pole. This would be bad, * numerically. So perform a 180 degree rotation around the * x-axis, project that point, and swap the entries of the * result. */ /* Dummy variables */ final double dummyRe; final double dummyIm; /* Rotate by 180 degree around the x-axis. */ y = -y; z = -z; /* Project that point. Now, z < -EPSILON. */ belowXYProjectTo(cp); /* Rotate back. */ y = -y; z = -z; /* Swap the entries of the result. * * TODO: Maybe Complex2 should have a final method that swaps the * entries. This might speed up dereferencing the fields of cp, * because dereferencing fiels of other objects might be slower * than dereferencing fields of the same object. But actually, I * don't know if that is true or if it matters. */ dummyRe = cp.aRe; dummyIm = cp.aIm; cp.aRe = cp.bRe; cp.aIm = cp.bIm; cp.bRe = dummyRe; cp.bIm = dummyIm; } else { /* Point lies below xy-plane so we use */ belowXYProjectTo(cp); } }
public void projectTo(final ComplexProjective1 cp) throws IllegalArgumentException { if (Math.abs(normSquared() - 1.0) > EPSILON) { throw new IllegalArgumentException("Norm must be 1.0. " + "Norm is " + norm() + ". "); } if (z > 0.0) { final double dummyRe; final double dummyIm; y = -y; z = -z; belowXYProjectTo(cp); y = -y; z = -z; dummyRe = cp.aRe; dummyIm = cp.aIm; cp.aRe = cp.bRe; cp.aIm = cp.bIm; cp.bRe = dummyRe; cp.bIm = dummyIm; } else { belowXYProjectTo(cp); } }
public void projectto(final complexprojective1 cp) throws illegalargumentexception { if (math.abs(normsquared() - 1.0) > epsilon) { throw new illegalargumentexception("norm must be 1.0. " + "norm is " + norm() + ". "); } if (z > 0.0) { final double dummyre; final double dummyim; y = -y; z = -z; belowxyprojectto(cp); y = -y; z = -z; dummyre = cp.are; dummyim = cp.aim; cp.are = cp.bre; cp.aim = cp.bim; cp.bre = dummyre; cp.bim = dummyim; } else { belowxyprojectto(cp); } }
jupsal/schmies-jTEM
[ 1, 0, 0, 0 ]
32,041
@Test public void dontPullAttachmentAlreadyPulled() { try { // create a rev with an attachment, then update it keeping attachment // TODO we need to somehow check the attachment wasn't re-downloaded createRevisionAndBigTextAttachment(); pull(); DocumentRevision docRev1 = datastore.getDocument(id, rev); Attachment a1 = datastore.getAttachment(docRev1, bigTextAttachmentName); updateRevisionAndKeepAttachment(); updateRevisionAndKeepAttachment(); pull(); DocumentRevision docRev2 = datastore.getDocument(id, rev); Attachment a2 = datastore.getAttachment(docRev2, bigTextAttachmentName); Assert.assertNotNull(a2); } catch (Exception e) { Assert.fail("Create/pull error " + e); } }
@Test public void dontPullAttachmentAlreadyPulled() { try { createRevisionAndBigTextAttachment(); pull(); DocumentRevision docRev1 = datastore.getDocument(id, rev); Attachment a1 = datastore.getAttachment(docRev1, bigTextAttachmentName); updateRevisionAndKeepAttachment(); updateRevisionAndKeepAttachment(); pull(); DocumentRevision docRev2 = datastore.getDocument(id, rev); Attachment a2 = datastore.getAttachment(docRev2, bigTextAttachmentName); Assert.assertNotNull(a2); } catch (Exception e) { Assert.fail("Create/pull error " + e); } }
@test public void dontpullattachmentalreadypulled() { try { createrevisionandbigtextattachment(); pull(); documentrevision docrev1 = datastore.getdocument(id, rev); attachment a1 = datastore.getattachment(docrev1, bigtextattachmentname); updaterevisionandkeepattachment(); updaterevisionandkeepattachment(); pull(); documentrevision docrev2 = datastore.getdocument(id, rev); attachment a2 = datastore.getattachment(docrev2, bigtextattachmentname); assert.assertnotnull(a2); } catch (exception e) { assert.fail("create/pull error " + e); } }
kiwiwearables/sync-android
[ 1, 0, 0, 0 ]
7,632
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle extras; Log.d(TAG, "Widget configuration activity created"); setResult(RESULT_CANCELED); extras = getIntent().getExtras(); if (extras != null) { mAppWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); } if (mAppWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) { finish(); return; } resultValue = new Intent(); resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId); setResult(RESULT_OK, resultValue); if(SessionManager.hasSessionInStore(this)) { // Finish activity earlier Log.d(TAG, "Session already taken, leaving configuration activity"); finish(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle extras; Log.d(TAG, "Widget configuration activity created"); setResult(RESULT_CANCELED); extras = getIntent().getExtras(); if (extras != null) { mAppWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); } if (mAppWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) { finish(); return; } resultValue = new Intent(); resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId); setResult(RESULT_OK, resultValue); if(SessionManager.hasSessionInStore(this)) { Log.d(TAG, "Session already taken, leaving configuration activity"); finish(); } }
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); bundle extras; log.d(tag, "widget configuration activity created"); setresult(result_canceled); extras = getintent().getextras(); if (extras != null) { mappwidgetid = extras.getint(appwidgetmanager.extra_appwidget_id, appwidgetmanager.invalid_appwidget_id); } if (mappwidgetid == appwidgetmanager.invalid_appwidget_id) { finish(); return; } resultvalue = new intent(); resultvalue.putextra(appwidgetmanager.extra_appwidget_id, mappwidgetid); setresult(result_ok, resultvalue); if(sessionmanager.hassessioninstore(this)) { log.d(tag, "session already taken, leaving configuration activity"); finish(); } }
memleakpl/flat
[ 0, 0, 1, 0 ]
24,024
void sqlLiteralForObject(StringBuilder buffer, Object object) { if (object == null) { buffer.append("NULL"); } else if (object instanceof String) { buffer.append('\''); // lets escape quotes String literal = (String) object; if (literal.length() > TRIM_VALUES_THRESHOLD) { literal = literal.substring(0, TRIM_VALUES_THRESHOLD) + "..."; } int curPos = 0; int endPos = 0; while ((endPos = literal.indexOf('\'', curPos)) >= 0) { buffer.append(literal.substring(curPos, endPos + 1)).append('\''); curPos = endPos + 1; } if (curPos < literal.length()) buffer.append(literal.substring(curPos)); buffer.append('\''); } // handle byte pretty formatting else if (object instanceof Byte) { IDUtil.appendFormattedByte(buffer, ((Byte) object).byteValue()); } else if (object instanceof Number) { // process numeric value (do something smart in the future) buffer.append(object); } else if (object instanceof java.sql.Date) { buffer.append('\'').append(object).append('\''); } else if (object instanceof java.sql.Time) { buffer.append('\'').append(object).append('\''); } else if (object instanceof java.util.Date) { long time = ((java.util.Date) object).getTime(); buffer.append('\'').append(new java.sql.Timestamp(time)).append('\''); } else if (object instanceof java.util.Calendar) { long time = ((java.util.Calendar) object).getTimeInMillis(); buffer.append(object.getClass().getName()).append('(').append(new java.sql.Timestamp(time)).append(')'); } else if (object instanceof Character) { buffer.append(((Character) object).charValue()); } else if (object instanceof Boolean) { buffer.append('\'').append(object).append('\''); } else if (object instanceof Enum<?>) { // buffer.append(object.getClass().getName()).append("."); buffer.append(((Enum<?>) object).name()).append("="); if (object instanceof ExtendedEnumeration) { Object value = ((ExtendedEnumeration) object).getDatabaseValue(); if (value instanceof String) buffer.append("'"); buffer.append(value); if (value instanceof String) buffer.append("'"); } else { buffer.append(((Enum<?>) object).ordinal()); // FIXME -- this isn't quite right } } else if (object instanceof SQLParameterBinding) { sqlLiteralForObject(buffer, ((SQLParameterBinding) object).getValue()); } else if (object.getClass().isArray()) { buffer.append("< "); int len = Array.getLength(object); boolean trimming = false; if (len > TRIM_VALUES_THRESHOLD) { len = TRIM_VALUES_THRESHOLD; trimming = true; } for (int i = 0; i < len; i++) { if (i > 0) { buffer.append(","); } sqlLiteralForObject(buffer, Array.get(object, i)); } if (trimming) { buffer.append("..."); } buffer.append('>'); } else { buffer.append(object.getClass().getName()).append("@").append(System.identityHashCode(object)); } }
void sqlLiteralForObject(StringBuilder buffer, Object object) { if (object == null) { buffer.append("NULL"); } else if (object instanceof String) { buffer.append('\''); String literal = (String) object; if (literal.length() > TRIM_VALUES_THRESHOLD) { literal = literal.substring(0, TRIM_VALUES_THRESHOLD) + "..."; } int curPos = 0; int endPos = 0; while ((endPos = literal.indexOf('\'', curPos)) >= 0) { buffer.append(literal.substring(curPos, endPos + 1)).append('\''); curPos = endPos + 1; } if (curPos < literal.length()) buffer.append(literal.substring(curPos)); buffer.append('\''); } else if (object instanceof Byte) { IDUtil.appendFormattedByte(buffer, ((Byte) object).byteValue()); } else if (object instanceof Number) { buffer.append(object); } else if (object instanceof java.sql.Date) { buffer.append('\'').append(object).append('\''); } else if (object instanceof java.sql.Time) { buffer.append('\'').append(object).append('\''); } else if (object instanceof java.util.Date) { long time = ((java.util.Date) object).getTime(); buffer.append('\'').append(new java.sql.Timestamp(time)).append('\''); } else if (object instanceof java.util.Calendar) { long time = ((java.util.Calendar) object).getTimeInMillis(); buffer.append(object.getClass().getName()).append('(').append(new java.sql.Timestamp(time)).append(')'); } else if (object instanceof Character) { buffer.append(((Character) object).charValue()); } else if (object instanceof Boolean) { buffer.append('\'').append(object).append('\''); } else if (object instanceof Enum<?>) { buffer.append(((Enum<?>) object).name()).append("="); if (object instanceof ExtendedEnumeration) { Object value = ((ExtendedEnumeration) object).getDatabaseValue(); if (value instanceof String) buffer.append("'"); buffer.append(value); if (value instanceof String) buffer.append("'"); } else { buffer.append(((Enum<?>) object).ordinal()); } } else if (object instanceof SQLParameterBinding) { sqlLiteralForObject(buffer, ((SQLParameterBinding) object).getValue()); } else if (object.getClass().isArray()) { buffer.append("< "); int len = Array.getLength(object); boolean trimming = false; if (len > TRIM_VALUES_THRESHOLD) { len = TRIM_VALUES_THRESHOLD; trimming = true; } for (int i = 0; i < len; i++) { if (i > 0) { buffer.append(","); } sqlLiteralForObject(buffer, Array.get(object, i)); } if (trimming) { buffer.append("..."); } buffer.append('>'); } else { buffer.append(object.getClass().getName()).append("@").append(System.identityHashCode(object)); } }
void sqlliteralforobject(stringbuilder buffer, object object) { if (object == null) { buffer.append("null"); } else if (object instanceof string) { buffer.append('\''); string literal = (string) object; if (literal.length() > trim_values_threshold) { literal = literal.substring(0, trim_values_threshold) + "..."; } int curpos = 0; int endpos = 0; while ((endpos = literal.indexof('\'', curpos)) >= 0) { buffer.append(literal.substring(curpos, endpos + 1)).append('\''); curpos = endpos + 1; } if (curpos < literal.length()) buffer.append(literal.substring(curpos)); buffer.append('\''); } else if (object instanceof byte) { idutil.appendformattedbyte(buffer, ((byte) object).bytevalue()); } else if (object instanceof number) { buffer.append(object); } else if (object instanceof java.sql.date) { buffer.append('\'').append(object).append('\''); } else if (object instanceof java.sql.time) { buffer.append('\'').append(object).append('\''); } else if (object instanceof java.util.date) { long time = ((java.util.date) object).gettime(); buffer.append('\'').append(new java.sql.timestamp(time)).append('\''); } else if (object instanceof java.util.calendar) { long time = ((java.util.calendar) object).gettimeinmillis(); buffer.append(object.getclass().getname()).append('(').append(new java.sql.timestamp(time)).append(')'); } else if (object instanceof character) { buffer.append(((character) object).charvalue()); } else if (object instanceof boolean) { buffer.append('\'').append(object).append('\''); } else if (object instanceof enum<?>) { buffer.append(((enum<?>) object).name()).append("="); if (object instanceof extendedenumeration) { object value = ((extendedenumeration) object).getdatabasevalue(); if (value instanceof string) buffer.append("'"); buffer.append(value); if (value instanceof string) buffer.append("'"); } else { buffer.append(((enum<?>) object).ordinal()); } } else if (object instanceof sqlparameterbinding) { sqlliteralforobject(buffer, ((sqlparameterbinding) object).getvalue()); } else if (object.getclass().isarray()) { buffer.append("< "); int len = array.getlength(object); boolean trimming = false; if (len > trim_values_threshold) { len = trim_values_threshold; trimming = true; } for (int i = 0; i < len; i++) { if (i > 0) { buffer.append(","); } sqlliteralforobject(buffer, array.get(object, i)); } if (trimming) { buffer.append("..."); } buffer.append('>'); } else { buffer.append(object.getclass().getname()).append("@").append(system.identityhashcode(object)); } }
laakhbeenor/cayenne
[ 0, 0, 1, 0 ]
15,851
protected double valueFor(Object o) { if (o instanceof java.lang.Number) // compiler complains unless I include the full classname!!! Huh? return ((Number)o).doubleValue(); else if (o instanceof Valuable) return ((Valuable)o).doubleValue(); else if (o instanceof Boolean) return ((Boolean)o).booleanValue() ? 1 : 0; else return Double.NaN; // unknown }
protected double valueFor(Object o) { if (o instanceof java.lang.Number) return ((Number)o).doubleValue(); else if (o instanceof Valuable) return ((Valuable)o).doubleValue(); else if (o instanceof Boolean) return ((Boolean)o).booleanValue() ? 1 : 0; else return Double.NaN; }
protected double valuefor(object o) { if (o instanceof java.lang.number) return ((number)o).doublevalue(); else if (o instanceof valuable) return ((valuable)o).doublevalue(); else if (o instanceof boolean) return ((boolean)o).booleanvalue() ? 1 : 0; else return double.nan; }
minhhn2910/g-mason
[ 1, 0, 0, 0 ]
24,088
private Grid<Cuenta> createGrid() { grid = new Grid<>(); grid.setWidthFull(); grid.addThemeVariants(GridVariant.LUMO_NO_BORDER,GridVariant.LUMO_ROW_STRIPES); SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); grid.addColumn(c -> c.getIban()).setHeader("Iban").setFlexGrow(1); grid.addColumn(c -> c.getSaldo()).setHeader("Saldo").setFlexGrow(1); grid.addColumn(c -> dateFormat.format(c.getFechaCreacion())).setHeader("Fecha Creacion").setWidth("250px").setFlexGrow(0); return grid; }
private Grid<Cuenta> createGrid() { grid = new Grid<>(); grid.setWidthFull(); grid.addThemeVariants(GridVariant.LUMO_NO_BORDER,GridVariant.LUMO_ROW_STRIPES); SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); grid.addColumn(c -> c.getIban()).setHeader("Iban").setFlexGrow(1); grid.addColumn(c -> c.getSaldo()).setHeader("Saldo").setFlexGrow(1); grid.addColumn(c -> dateFormat.format(c.getFechaCreacion())).setHeader("Fecha Creacion").setWidth("250px").setFlexGrow(0); return grid; }
private grid<cuenta> creategrid() { grid = new grid<>(); grid.setwidthfull(); grid.addthemevariants(gridvariant.lumo_no_border,gridvariant.lumo_row_stripes); simpledateformat dateformat = new simpledateformat("dd/mm/yyyy"); grid.addcolumn(c -> c.getiban()).setheader("iban").setflexgrow(1); grid.addcolumn(c -> c.getsaldo()).setheader("saldo").setflexgrow(1); grid.addcolumn(c -> dateformat.format(c.getfechacreacion())).setheader("fecha creacion").setwidth("250px").setflexgrow(0); return grid; }
juansgonzalez/ingenia-bank
[ 0, 0, 0, 0 ]
7,744
@Ignore("This test was not writted due to lack of time. This is what should have been done:\n" + "Since this feature involves network calls, to properly unit test this it, is necessary\n" + "to mock the Network module and provide a fake JSON response. This way the test doesn't\n" + "rely on an internet connection, a web service and the JSON response is always the same.\n" + "Once we have that it is possible tu use assertj-android to check if the data inside the\n" + "RecyclerView is the same as what we expecting from the JSON.") @Test public void hitList_isCorrect() { // TODO write me }
@Ignore("This test was not writted due to lack of time. This is what should have been done:\n" + "Since this feature involves network calls, to properly unit test this it, is necessary\n" + "to mock the Network module and provide a fake JSON response. This way the test doesn't\n" + "rely on an internet connection, a web service and the JSON response is always the same.\n" + "Once we have that it is possible tu use assertj-android to check if the data inside the\n" + "RecyclerView is the same as what we expecting from the JSON.") @Test public void hitList_isCorrect() { }
@ignore("this test was not writted due to lack of time. this is what should have been done:\n" + "since this feature involves network calls, to properly unit test this it, is necessary\n" + "to mock the network module and provide a fake json response. this way the test doesn't\n" + "rely on an internet connection, a web service and the json response is always the same.\n" + "once we have that it is possible tu use assertj-android to check if the data inside the\n" + "recyclerview is the same as what we expecting from the json.") @test public void hitlist_iscorrect() { }
leinardi/Dagger2MVP
[ 0, 1, 0, 0 ]
24,143
@Override public boolean equals(Object obj) { // TODO: come up with a better implementation of this later return false; }
@Override public boolean equals(Object obj) { return false; }
@override public boolean equals(object obj) { return false; }
kaubster/se-577-group-projects
[ 1, 0, 0, 0 ]
7,766
@Test public void testPaginate() throws Exception { //fail("Test not implemented yet."); //TODO: do later }
@Test public void testPaginate() throws Exception { }
@test public void testpaginate() throws exception { }
mkalus/segrada
[ 0, 0, 0, 1 ]
7,935
private void processUnresolved(TypeReference Sref) throws LookupException { // WARNING // INCOMPLETE see processSubtypeConstraints TypeReference RRef = (TypeReference) invokedGenericMethod().returnTypeReference(); FirstPhaseConstraintSet constraints = new FirstPhaseConstraintSet(invocation(), invokedGenericMethod()); View view = RRef.view(); TypeReference SprimeRef = box(Sref); Java7 java = view.language(Java7.class); if(! RRef.getElement().sameAs(java.voidType(RRef.view().namespace()))) { // the constraint S >> R', provided R is not void TypeReference RprimeRef = substitutedReference(RRef); constraints.add(new GGConstraint(SprimeRef, RprimeRef.getElement())); } // additional constraints Bi[T1=B(T1) ... Tn=B(Tn)] >> Ti where Bi is the declared bound of Ti for(TypeParameter param: typeParameters()) { TypeReference Bi = param.upperBoundReference(); TypeReference BiAfterSubstitution = substitutedReference(Bi); Type Ti = (Type) param.selectionDeclaration(); Type BTi = assignments().type(param); if(BTi == null) { BTi = Ti; } constraints.add(new GGConstraint(BiAfterSubstitution, Ti)); constraints.add(new SSConstraint(java.reference(BTi), BiAfterSubstitution.getElement())); } for(GGConstraint constraint: _origin.generatedGG()) { constraints.add(new GGConstraint(substitutedReference(constraint.ARef()), constraint.F())); } for(EQConstraint constraint: _origin.generatedEQ()) { constraints.add(new EQConstraint(substitutedReference(constraint.ARef()), constraint.F())); } SecondPhaseConstraintSet seconds = constraints.secondPhase(); // JLS: Any equality constraints are resolved ... seconds.processEqualityConstraints(); // JLS: ..., and then, for each remaining constraint of the form Ti <: Uk, the argument // Ti is inferred to be glb(U1,...,Uk) seconds.processSubtypeConstraints(); //Any remaining type variable T that has not yet been inferred is then inferred // to have type Object . If a previously inferred type variable P uses T , then P is // inferred to be P [T =Object ]. for(TypeParameter param: seconds.unresolvedParameters()) { seconds.add(new ActualTypeAssignment(param, java.getDefaultSuperClass(view.namespace()))); } //FIXME Perform substitution for(TypeParameter param: unresolvedParameters()) { add(seconds.assignments().assignment(param)); } }
private void processUnresolved(TypeReference Sref) throws LookupException { TypeReference RRef = (TypeReference) invokedGenericMethod().returnTypeReference(); FirstPhaseConstraintSet constraints = new FirstPhaseConstraintSet(invocation(), invokedGenericMethod()); View view = RRef.view(); TypeReference SprimeRef = box(Sref); Java7 java = view.language(Java7.class); if(! RRef.getElement().sameAs(java.voidType(RRef.view().namespace()))) { TypeReference RprimeRef = substitutedReference(RRef); constraints.add(new GGConstraint(SprimeRef, RprimeRef.getElement())); } for(TypeParameter param: typeParameters()) { TypeReference Bi = param.upperBoundReference(); TypeReference BiAfterSubstitution = substitutedReference(Bi); Type Ti = (Type) param.selectionDeclaration(); Type BTi = assignments().type(param); if(BTi == null) { BTi = Ti; } constraints.add(new GGConstraint(BiAfterSubstitution, Ti)); constraints.add(new SSConstraint(java.reference(BTi), BiAfterSubstitution.getElement())); } for(GGConstraint constraint: _origin.generatedGG()) { constraints.add(new GGConstraint(substitutedReference(constraint.ARef()), constraint.F())); } for(EQConstraint constraint: _origin.generatedEQ()) { constraints.add(new EQConstraint(substitutedReference(constraint.ARef()), constraint.F())); } SecondPhaseConstraintSet seconds = constraints.secondPhase(); seconds.processEqualityConstraints(); seconds.processSubtypeConstraints(); for(TypeParameter param: seconds.unresolvedParameters()) { seconds.add(new ActualTypeAssignment(param, java.getDefaultSuperClass(view.namespace()))); } for(TypeParameter param: unresolvedParameters()) { add(seconds.assignments().assignment(param)); } }
private void processunresolved(typereference sref) throws lookupexception { typereference rref = (typereference) invokedgenericmethod().returntypereference(); firstphaseconstraintset constraints = new firstphaseconstraintset(invocation(), invokedgenericmethod()); view view = rref.view(); typereference sprimeref = box(sref); java7 java = view.language(java7.class); if(! rref.getelement().sameas(java.voidtype(rref.view().namespace()))) { typereference rprimeref = substitutedreference(rref); constraints.add(new ggconstraint(sprimeref, rprimeref.getelement())); } for(typeparameter param: typeparameters()) { typereference bi = param.upperboundreference(); typereference biaftersubstitution = substitutedreference(bi); type ti = (type) param.selectiondeclaration(); type bti = assignments().type(param); if(bti == null) { bti = ti; } constraints.add(new ggconstraint(biaftersubstitution, ti)); constraints.add(new ssconstraint(java.reference(bti), biaftersubstitution.getelement())); } for(ggconstraint constraint: _origin.generatedgg()) { constraints.add(new ggconstraint(substitutedreference(constraint.aref()), constraint.f())); } for(eqconstraint constraint: _origin.generatedeq()) { constraints.add(new eqconstraint(substitutedreference(constraint.aref()), constraint.f())); } secondphaseconstraintset seconds = constraints.secondphase(); seconds.processequalityconstraints(); seconds.processsubtypeconstraints(); for(typeparameter param: seconds.unresolvedparameters()) { seconds.add(new actualtypeassignment(param, java.getdefaultsuperclass(view.namespace()))); } for(typeparameter param: unresolvedparameters()) { add(seconds.assignments().assignment(param)); } }
markovandooren/jnome
[ 0, 1, 0, 0 ]
24,673
private void validateZoneAvailable(String tenantId, String zone) throws IllegalArgumentException { List<ZoneDTO> zones; try { zones = zoneApi.getAvailableZones(tenantId); } catch (ResourceAccessException e) { // need to do something here to handle things more gracefully. throw new RuntimeException("Unable to validate zones.", e); } boolean found = zones.stream().anyMatch(z -> z.getName().equals(zone)); log.debug("Found {} zones for tenant", zoneApi.getAvailableZones(tenantId).size()); if (!found) throw new IllegalArgumentException("Provided zone does not exist: " + zone); }
private void validateZoneAvailable(String tenantId, String zone) throws IllegalArgumentException { List<ZoneDTO> zones; try { zones = zoneApi.getAvailableZones(tenantId); } catch (ResourceAccessException e) { throw new RuntimeException("Unable to validate zones.", e); } boolean found = zones.stream().anyMatch(z -> z.getName().equals(zone)); log.debug("Found {} zones for tenant", zoneApi.getAvailableZones(tenantId).size()); if (!found) throw new IllegalArgumentException("Provided zone does not exist: " + zone); }
private void validatezoneavailable(string tenantid, string zone) throws illegalargumentexception { list<zonedto> zones; try { zones = zoneapi.getavailablezones(tenantid); } catch (resourceaccessexception e) { throw new runtimeexception("unable to validate zones.", e); } boolean found = zones.stream().anymatch(z -> z.getname().equals(zone)); log.debug("found {} zones for tenant", zoneapi.getavailablezones(tenantid).size()); if (!found) throw new illegalargumentexception("provided zone does not exist: " + zone); }
racker/salus-telemetry-ambassador
[ 1, 0, 0, 0 ]
16,532
public String getBlockId() { final BlockEntity be = serverWorld.getBlockEntity(this.blockPos); // FIXME do we need to check at y+1? return String.valueOf(Registry.BLOCK_ENTITY_TYPE.getId(be.getType())); }
public String getBlockId() { final BlockEntity be = serverWorld.getBlockEntity(this.blockPos); return String.valueOf(Registry.BLOCK_ENTITY_TYPE.getId(be.getType())); }
public string getblockid() { final blockentity be = serverworld.getblockentity(this.blockpos); return string.valueof(registry.block_entity_type.getid(be.gettype())); }
pcal43/mob-filter
[ 0, 0, 1, 0 ]
24,727
@Override public List<DeviceStorageRoot> getSecondaryDeviceStorageRoots() { ArrayList<DeviceStorageRoot> secondaryStorageRoot = new ArrayList<>(1); if (secondaryStoragePath != null) { secondaryStorageRoot.add(new DeviceStorageRoot(secondaryStoragePath, secondaryStoragePath, DeviceStorageRoot.Type.SECONDARY)); } return secondaryStorageRoot; }
@Override public List<DeviceStorageRoot> getSecondaryDeviceStorageRoots() { ArrayList<DeviceStorageRoot> secondaryStorageRoot = new ArrayList<>(1); if (secondaryStoragePath != null) { secondaryStorageRoot.add(new DeviceStorageRoot(secondaryStoragePath, secondaryStoragePath, DeviceStorageRoot.Type.SECONDARY)); } return secondaryStorageRoot; }
@override public list<devicestorageroot> getsecondarydevicestorageroots() { arraylist<devicestorageroot> secondarystorageroot = new arraylist<>(1); if (secondarystoragepath != null) { secondarystorageroot.add(new devicestorageroot(secondarystoragepath, secondarystoragepath, devicestorageroot.type.secondary)); } return secondarystorageroot; }
novoda/storage-path-finder
[ 1, 0, 0, 0 ]
8,431
@JsonGetter("amount") public int getAmount ( ) { return this.amount; }
@JsonGetter("amount") public int getAmount ( ) { return this.amount; }
@jsongetter("amount") public int getamount ( ) { return this.amount; }
pagarme/pagarme-core-api-java
[ 0, 0, 0, 0 ]
8,432
@JsonSetter("amount") public void setAmount (int value) { this.amount = value; }
@JsonSetter("amount") public void setAmount (int value) { this.amount = value; }
@jsonsetter("amount") public void setamount (int value) { this.amount = value; }
pagarme/pagarme-core-api-java
[ 0, 0, 0, 0 ]
8,433
@JsonGetter("description") public String getDescription ( ) { return this.description; }
@JsonGetter("description") public String getDescription ( ) { return this.description; }
@jsongetter("description") public string getdescription ( ) { return this.description; }
pagarme/pagarme-core-api-java
[ 0, 0, 0, 0 ]
8,434
@JsonSetter("description") public void setDescription (String value) { this.description = value; }
@JsonSetter("description") public void setDescription (String value) { this.description = value; }
@jsonsetter("description") public void setdescription (string value) { this.description = value; }
pagarme/pagarme-core-api-java
[ 0, 0, 0, 0 ]
8,435
@JsonGetter("quantity") public int getQuantity ( ) { return this.quantity; }
@JsonGetter("quantity") public int getQuantity ( ) { return this.quantity; }
@jsongetter("quantity") public int getquantity ( ) { return this.quantity; }
pagarme/pagarme-core-api-java
[ 0, 0, 0, 0 ]
8,436
@JsonSetter("quantity") public void setQuantity (int value) { this.quantity = value; }
@JsonSetter("quantity") public void setQuantity (int value) { this.quantity = value; }
@jsonsetter("quantity") public void setquantity (int value) { this.quantity = value; }
pagarme/pagarme-core-api-java
[ 0, 0, 0, 0 ]
8,437
@JsonGetter("category") public String getCategory ( ) { return this.category; }
@JsonGetter("category") public String getCategory ( ) { return this.category; }
@jsongetter("category") public string getcategory ( ) { return this.category; }
pagarme/pagarme-core-api-java
[ 0, 0, 0, 0 ]
8,438
@JsonSetter("category") public void setCategory (String value) { this.category = value; }
@JsonSetter("category") public void setCategory (String value) { this.category = value; }
@jsonsetter("category") public void setcategory (string value) { this.category = value; }
pagarme/pagarme-core-api-java
[ 0, 0, 0, 0 ]
8,485
private void updateCartCount(int count){ if (txtItemCount != null) { txtItemCount.setText(String.valueOf(count)); } }
private void updateCartCount(int count){ if (txtItemCount != null) { txtItemCount.setText(String.valueOf(count)); } }
private void updatecartcount(int count){ if (txtitemcount != null) { txtitemcount.settext(string.valueof(count)); } }
nilesh14/FMC
[ 1, 0, 0, 0 ]
16,767
@Override public Runnable getConsumer(final KafkaSynchronizedConsumerPool pool, final KafkaStream<byte[], byte[]> stream) { return new Runnable() { @Override public void run() { ConsumerIterator<byte[],byte[]> iter = stream.iterator(); byte[] sipHashKey = frontend.keystore.getKey(KeyStore.SIPHASH_KAFKA_PLASMA_FRONTEND_IN); byte[] aesKey = frontend.keystore.getKey(KeyStore.AES_KAFKA_PLASMA_FRONTEND_IN); // Iterate on the messages TDeserializer deserializer = new TDeserializer(new TCompactProtocol.Factory()); KafkaOffsetCounters counters = pool.getCounters(); // TODO(hbs): allow setting of writeBufferSize try { while (iter.hasNext()) { // // Since the cal to 'next' may block, we need to first // check that there is a message available // boolean nonEmpty = iter.nonEmpty(); if (nonEmpty) { MessageAndMetadata<byte[], byte[]> msg = iter.next(); counters.count(msg.partition(), msg.offset()); byte[] data = msg.message(); Sensision.update(SensisionConstants.SENSISION_CLASS_PLASMA_FRONTEND_KAFKA_MESSAGES, Sensision.EMPTY_LABELS, 1); Sensision.update(SensisionConstants.SENSISION_CLASS_PLASMA_FRONTEND_KAFKA_BYTES, Sensision.EMPTY_LABELS, data.length); if (null != sipHashKey) { data = CryptoUtils.removeMAC(sipHashKey, data); } // Skip data whose MAC was not verified successfully if (null == data) { Sensision.update(SensisionConstants.SENSISION_CLASS_PLASMA_FRONTEND_KAFKA_INVALIDMACS, Sensision.EMPTY_LABELS, 1); continue; } // Unwrap data if need be if (null != aesKey) { data = CryptoUtils.unwrap(aesKey, data); } // Skip data that was not unwrapped successfuly if (null == data) { Sensision.update(SensisionConstants.SENSISION_CLASS_PLASMA_FRONTEND_KAFKA_INVALIDCIPHERS, Sensision.EMPTY_LABELS, 1); continue; } // // Extract KafkaDataMessage // KafkaDataMessage tmsg = new KafkaDataMessage(); deserializer.deserialize(tmsg, data); switch(tmsg.getType()) { case STORE: GTSEncoder encoder = new GTSEncoder(0L, null, tmsg.getData()); encoder.setClassId(tmsg.getClassId()); encoder.setLabelsId(tmsg.getLabelsId()); frontend.dispatch(encoder); break; case DELETE: case ARCHIVE: break; default: throw new RuntimeException("Invalid message type."); } } else { // Sleep a tiny while try { Thread.sleep(1L); } catch (InterruptedException ie) { } } } } catch (Throwable t) { t.printStackTrace(System.err); } finally { // Set abort to true in case we exit the 'run' method pool.getAbort().set(true); } } }; }
@Override public Runnable getConsumer(final KafkaSynchronizedConsumerPool pool, final KafkaStream<byte[], byte[]> stream) { return new Runnable() { @Override public void run() { ConsumerIterator<byte[],byte[]> iter = stream.iterator(); byte[] sipHashKey = frontend.keystore.getKey(KeyStore.SIPHASH_KAFKA_PLASMA_FRONTEND_IN); byte[] aesKey = frontend.keystore.getKey(KeyStore.AES_KAFKA_PLASMA_FRONTEND_IN); TDeserializer deserializer = new TDeserializer(new TCompactProtocol.Factory()); KafkaOffsetCounters counters = pool.getCounters(); try { while (iter.hasNext()) { boolean nonEmpty = iter.nonEmpty(); if (nonEmpty) { MessageAndMetadata<byte[], byte[]> msg = iter.next(); counters.count(msg.partition(), msg.offset()); byte[] data = msg.message(); Sensision.update(SensisionConstants.SENSISION_CLASS_PLASMA_FRONTEND_KAFKA_MESSAGES, Sensision.EMPTY_LABELS, 1); Sensision.update(SensisionConstants.SENSISION_CLASS_PLASMA_FRONTEND_KAFKA_BYTES, Sensision.EMPTY_LABELS, data.length); if (null != sipHashKey) { data = CryptoUtils.removeMAC(sipHashKey, data); } if (null == data) { Sensision.update(SensisionConstants.SENSISION_CLASS_PLASMA_FRONTEND_KAFKA_INVALIDMACS, Sensision.EMPTY_LABELS, 1); continue; } if (null != aesKey) { data = CryptoUtils.unwrap(aesKey, data); } if (null == data) { Sensision.update(SensisionConstants.SENSISION_CLASS_PLASMA_FRONTEND_KAFKA_INVALIDCIPHERS, Sensision.EMPTY_LABELS, 1); continue; } KafkaDataMessage tmsg = new KafkaDataMessage(); deserializer.deserialize(tmsg, data); switch(tmsg.getType()) { case STORE: GTSEncoder encoder = new GTSEncoder(0L, null, tmsg.getData()); encoder.setClassId(tmsg.getClassId()); encoder.setLabelsId(tmsg.getLabelsId()); frontend.dispatch(encoder); break; case DELETE: case ARCHIVE: break; default: throw new RuntimeException("Invalid message type."); } } else { try { Thread.sleep(1L); } catch (InterruptedException ie) { } } } } catch (Throwable t) { t.printStackTrace(System.err); } finally { pool.getAbort().set(true); } } }; }
@override public runnable getconsumer(final kafkasynchronizedconsumerpool pool, final kafkastream<byte[], byte[]> stream) { return new runnable() { @override public void run() { consumeriterator<byte[],byte[]> iter = stream.iterator(); byte[] siphashkey = frontend.keystore.getkey(keystore.siphash_kafka_plasma_frontend_in); byte[] aeskey = frontend.keystore.getkey(keystore.aes_kafka_plasma_frontend_in); tdeserializer deserializer = new tdeserializer(new tcompactprotocol.factory()); kafkaoffsetcounters counters = pool.getcounters(); try { while (iter.hasnext()) { boolean nonempty = iter.nonempty(); if (nonempty) { messageandmetadata<byte[], byte[]> msg = iter.next(); counters.count(msg.partition(), msg.offset()); byte[] data = msg.message(); sensision.update(sensisionconstants.sensision_class_plasma_frontend_kafka_messages, sensision.empty_labels, 1); sensision.update(sensisionconstants.sensision_class_plasma_frontend_kafka_bytes, sensision.empty_labels, data.length); if (null != siphashkey) { data = cryptoutils.removemac(siphashkey, data); } if (null == data) { sensision.update(sensisionconstants.sensision_class_plasma_frontend_kafka_invalidmacs, sensision.empty_labels, 1); continue; } if (null != aeskey) { data = cryptoutils.unwrap(aeskey, data); } if (null == data) { sensision.update(sensisionconstants.sensision_class_plasma_frontend_kafka_invalidciphers, sensision.empty_labels, 1); continue; } kafkadatamessage tmsg = new kafkadatamessage(); deserializer.deserialize(tmsg, data); switch(tmsg.gettype()) { case store: gtsencoder encoder = new gtsencoder(0l, null, tmsg.getdata()); encoder.setclassid(tmsg.getclassid()); encoder.setlabelsid(tmsg.getlabelsid()); frontend.dispatch(encoder); break; case delete: case archive: break; default: throw new runtimeexception("invalid message type."); } } else { try { thread.sleep(1l); } catch (interruptedexception ie) { } } } } catch (throwable t) { t.printstacktrace(system.err); } finally { pool.getabort().set(true); } } }; }
randomboolean/warp10-platform
[ 0, 1, 0, 0 ]
432
protected void addSubtable(GlyphSubtable subtable) { if (subtable instanceof GlyphClassSubtable) { this.gct = (GlyphClassSubtable) subtable; } else if (subtable instanceof AttachmentPointSubtable) { // TODO - not yet used // this.apt = (AttachmentPointSubtable) subtable; } else if (subtable instanceof LigatureCaretSubtable) { // TODO - not yet used // this.lct = (LigatureCaretSubtable) subtable; } else if (subtable instanceof MarkAttachmentSubtable) { this.mat = (MarkAttachmentSubtable) subtable; } else { throw new UnsupportedOperationException("unsupported glyph definition subtable type: " + subtable); } }
protected void addSubtable(GlyphSubtable subtable) { if (subtable instanceof GlyphClassSubtable) { this.gct = (GlyphClassSubtable) subtable; } else if (subtable instanceof AttachmentPointSubtable) { } else if (subtable instanceof LigatureCaretSubtable) { } else if (subtable instanceof MarkAttachmentSubtable) { this.mat = (MarkAttachmentSubtable) subtable; } else { throw new UnsupportedOperationException("unsupported glyph definition subtable type: " + subtable); } }
protected void addsubtable(glyphsubtable subtable) { if (subtable instanceof glyphclasssubtable) { this.gct = (glyphclasssubtable) subtable; } else if (subtable instanceof attachmentpointsubtable) { } else if (subtable instanceof ligaturecaretsubtable) { } else if (subtable instanceof markattachmentsubtable) { this.mat = (markattachmentsubtable) subtable; } else { throw new unsupportedoperationexception("unsupported glyph definition subtable type: " + subtable); } }
not2sirius/fop
[ 1, 0, 0, 0 ]
8,645
@Override public void exitOperator_expr(OperonModuleParser.Operator_exprContext ctx) { //:OFF:log.debug("EXIT Operator_expr :: Stack size :: " + this.stack.size()); List<ParseTree> subNodes = getContextChildNodes(ctx); int subNodesSize = subNodes.size(); // Get the FunctionRef FunctionRef funcRef = (FunctionRef) this.stack.pop(); boolean isCascade = false; if (subNodes.get(subNodes.size() - 2) instanceof TerminalNode && subNodes.get(subNodes.size() - 2).getText().toLowerCase().equals("cascade")) { //:OFF:log.debug(" >> Operator :: set cascade true :: " + subNodes.get(subNodes.size() - 2).getText()); isCascade = true; } // Get the overloaded operator: for (int i = 0; i < subNodesSize; i ++) { //:OFF:log.debug(subNodes.get(i).getClass().getName()); if (subNodes.get(i) instanceof TerminalNode) { //:OFF:log.debug(" >> Operator :: terminal-node found."); } } String operator = subNodes.get(2).getText(); //:OFF:log.debug(" >> OPERATOR :: " + operator); Operator op = new Operator(this.currentStatement); // TODO: might not to inherit Node, therefore giving statement not required. op.setOperator(operator); op.setFunctionRef(funcRef); op.setCascade(isCascade); this.stack.push(op); }
@Override public void exitOperator_expr(OperonModuleParser.Operator_exprContext ctx) { List<ParseTree> subNodes = getContextChildNodes(ctx); int subNodesSize = subNodes.size(); FunctionRef funcRef = (FunctionRef) this.stack.pop(); boolean isCascade = false; if (subNodes.get(subNodes.size() - 2) instanceof TerminalNode && subNodes.get(subNodes.size() - 2).getText().toLowerCase().equals("cascade")) { isCascade = true; } for (int i = 0; i < subNodesSize; i ++) { if (subNodes.get(i) instanceof TerminalNode) { } } String operator = subNodes.get(2).getText(); Operator op = new Operator(this.currentStatement); op.setOperator(operator); op.setFunctionRef(funcRef); op.setCascade(isCascade); this.stack.push(op); }
@override public void exitoperator_expr(operonmoduleparser.operator_exprcontext ctx) { list<parsetree> subnodes = getcontextchildnodes(ctx); int subnodessize = subnodes.size(); functionref funcref = (functionref) this.stack.pop(); boolean iscascade = false; if (subnodes.get(subnodes.size() - 2) instanceof terminalnode && subnodes.get(subnodes.size() - 2).gettext().tolowercase().equals("cascade")) { iscascade = true; } for (int i = 0; i < subnodessize; i ++) { if (subnodes.get(i) instanceof terminalnode) { } } string operator = subnodes.get(2).gettext(); operator op = new operator(this.currentstatement); op.setoperator(operator); op.setfunctionref(funcref); op.setcascade(iscascade); this.stack.push(op); }
operon-io/operon-lang
[ 1, 0, 0, 0 ]
33,243
private void testClassify(String testID, String testExpectedID) { log.info("Testing the CLASSIFY task"); OWLOntologyManager manager = TestData.manager; // We prepare the input ontology try { OWLOntology testOntology = manager.createOntology(); OWLOntologyID testOntologyID = testOntology.getOntologyID(); log.debug("Created test ontology with ID: {}", testOntologyID); manager.applyChange(new AddImport(testOntology, TestData.factory.getOWLImportsDeclaration(IRI .create(testID)))); // Maybe we want to see what is in before if (log.isDebugEnabled()) TestUtils.debug(manager.getOntology(testOntologyID), log); // Now we test the method log.debug("Running HermiT"); Set<OWLAxiom> inferred = this.theinstance.runTask(ReasoningService.Tasks.CLASSIFY, manager.getOntology(testOntologyID)); // Maybe we want to see the inferred axiom list if (log.isDebugEnabled()) { TestUtils.debug(inferred, log); } Set<OWLLogicalAxiom> expectedAxioms = manager.getOntology(IRI.create(testExpectedID)) .getLogicalAxioms(); Set<OWLAxiom> missing = new HashSet<OWLAxiom>(); for (OWLAxiom expected : expectedAxioms) { if (!inferred.contains(expected)) { log.error("missing expected axiom: {}", expected); missing.add(expected); } } assertTrue(missing.isEmpty()); // We want only Class related axioms in the result set for (OWLAxiom a : inferred) { assertTrue(a instanceof OWLClassAssertionAxiom || a instanceof OWLSubClassOfAxiom || a instanceof OWLEquivalentClassesAxiom || a instanceof OWLDisjointClassesAxiom); } // We want to remove the ontology from the manager manager.removeOntology(testOntology); } catch (OWLOntologyCreationException e) { log.error("An {} have been thrown while creating the input ontology for test", e.getClass()); assertTrue(false); } catch (ReasoningServiceException e) { log.error("An {} have been thrown while executing the reasoning", e.getClass()); assertTrue(false); } catch (InconsistentInputException e) { log.error("An {} have been thrown while executing the reasoning", e.getClass()); assertTrue(false); } catch (UnsupportedTaskException e) { log.error("An {} have been thrown while executing the reasoning", e.getClass()); assertTrue(false); } }
private void testClassify(String testID, String testExpectedID) { log.info("Testing the CLASSIFY task"); OWLOntologyManager manager = TestData.manager; try { OWLOntology testOntology = manager.createOntology(); OWLOntologyID testOntologyID = testOntology.getOntologyID(); log.debug("Created test ontology with ID: {}", testOntologyID); manager.applyChange(new AddImport(testOntology, TestData.factory.getOWLImportsDeclaration(IRI .create(testID)))); if (log.isDebugEnabled()) TestUtils.debug(manager.getOntology(testOntologyID), log); log.debug("Running HermiT"); Set<OWLAxiom> inferred = this.theinstance.runTask(ReasoningService.Tasks.CLASSIFY, manager.getOntology(testOntologyID)); if (log.isDebugEnabled()) { TestUtils.debug(inferred, log); } Set<OWLLogicalAxiom> expectedAxioms = manager.getOntology(IRI.create(testExpectedID)) .getLogicalAxioms(); Set<OWLAxiom> missing = new HashSet<OWLAxiom>(); for (OWLAxiom expected : expectedAxioms) { if (!inferred.contains(expected)) { log.error("missing expected axiom: {}", expected); missing.add(expected); } } assertTrue(missing.isEmpty()); for (OWLAxiom a : inferred) { assertTrue(a instanceof OWLClassAssertionAxiom || a instanceof OWLSubClassOfAxiom || a instanceof OWLEquivalentClassesAxiom || a instanceof OWLDisjointClassesAxiom); } manager.removeOntology(testOntology); } catch (OWLOntologyCreationException e) { log.error("An {} have been thrown while creating the input ontology for test", e.getClass()); assertTrue(false); } catch (ReasoningServiceException e) { log.error("An {} have been thrown while executing the reasoning", e.getClass()); assertTrue(false); } catch (InconsistentInputException e) { log.error("An {} have been thrown while executing the reasoning", e.getClass()); assertTrue(false); } catch (UnsupportedTaskException e) { log.error("An {} have been thrown while executing the reasoning", e.getClass()); assertTrue(false); } }
private void testclassify(string testid, string testexpectedid) { log.info("testing the classify task"); owlontologymanager manager = testdata.manager; try { owlontology testontology = manager.createontology(); owlontologyid testontologyid = testontology.getontologyid(); log.debug("created test ontology with id: {}", testontologyid); manager.applychange(new addimport(testontology, testdata.factory.getowlimportsdeclaration(iri .create(testid)))); if (log.isdebugenabled()) testutils.debug(manager.getontology(testontologyid), log); log.debug("running hermit"); set<owlaxiom> inferred = this.theinstance.runtask(reasoningservice.tasks.classify, manager.getontology(testontologyid)); if (log.isdebugenabled()) { testutils.debug(inferred, log); } set<owllogicalaxiom> expectedaxioms = manager.getontology(iri.create(testexpectedid)) .getlogicalaxioms(); set<owlaxiom> missing = new hashset<owlaxiom>(); for (owlaxiom expected : expectedaxioms) { if (!inferred.contains(expected)) { log.error("missing expected axiom: {}", expected); missing.add(expected); } } asserttrue(missing.isempty()); for (owlaxiom a : inferred) { asserttrue(a instanceof owlclassassertionaxiom || a instanceof owlsubclassofaxiom || a instanceof owlequivalentclassesaxiom || a instanceof owldisjointclassesaxiom); } manager.removeontology(testontology); } catch (owlontologycreationexception e) { log.error("an {} have been thrown while creating the input ontology for test", e.getclass()); asserttrue(false); } catch (reasoningserviceexception e) { log.error("an {} have been thrown while executing the reasoning", e.getclass()); asserttrue(false); } catch (inconsistentinputexception e) { log.error("an {} have been thrown while executing the reasoning", e.getclass()); asserttrue(false); } catch (unsupportedtaskexception e) { log.error("an {} have been thrown while executing the reasoning", e.getclass()); asserttrue(false); } }
nikosnikolaidis/stanbol
[ 0, 0, 0, 1 ]
8,668
@Test public void testAclExtraction() { CiscoXrConfiguration c = parseVendorConfig("acl"); assertThat(c.getIpv4Acls(), hasKeys("acl")); Ipv4AccessList acl = c.getIpv4Acls().get("acl"); // TODO: get the remark line in there too. assertThat(acl.getLines(), hasSize(7)); assertThat(c.getIpv6Acls(), hasKeys("aclv6")); Ipv6AccessList aclv6 = c.getIpv6Acls().get("aclv6"); // TODO: get the remark line in there too. assertThat(aclv6.getLines(), hasSize(4)); }
@Test public void testAclExtraction() { CiscoXrConfiguration c = parseVendorConfig("acl"); assertThat(c.getIpv4Acls(), hasKeys("acl")); Ipv4AccessList acl = c.getIpv4Acls().get("acl"); assertThat(acl.getLines(), hasSize(7)); assertThat(c.getIpv6Acls(), hasKeys("aclv6")); Ipv6AccessList aclv6 = c.getIpv6Acls().get("aclv6"); assertThat(aclv6.getLines(), hasSize(4)); }
@test public void testaclextraction() { ciscoxrconfiguration c = parsevendorconfig("acl"); assertthat(c.getipv4acls(), haskeys("acl")); ipv4accesslist acl = c.getipv4acls().get("acl"); assertthat(acl.getlines(), hassize(7)); assertthat(c.getipv6acls(), haskeys("aclv6")); ipv6accesslist aclv6 = c.getipv6acls().get("aclv6"); assertthat(aclv6.getlines(), hassize(4)); }
pranavbj-amzn/batfish
[ 1, 0, 0, 0 ]
8,669
@Test public void testAclConversion() { Configuration c = parseConfig("acl"); assertThat(c.getIpAccessLists(), hasKeys("acl")); IpAccessList acl = c.getIpAccessLists().get("acl"); // TODO: get the remark line in there too. assertThat(acl.getLines(), hasSize(7)); assertThat(c.getIp6AccessLists(), hasKeys("aclv6")); Ip6AccessList aclv6 = c.getIp6AccessLists().get("aclv6"); // TODO: get the remark line in there too. assertThat(aclv6.getLines(), hasSize(4)); }
@Test public void testAclConversion() { Configuration c = parseConfig("acl"); assertThat(c.getIpAccessLists(), hasKeys("acl")); IpAccessList acl = c.getIpAccessLists().get("acl"); assertThat(acl.getLines(), hasSize(7)); assertThat(c.getIp6AccessLists(), hasKeys("aclv6")); Ip6AccessList aclv6 = c.getIp6AccessLists().get("aclv6"); assertThat(aclv6.getLines(), hasSize(4)); }
@test public void testaclconversion() { configuration c = parseconfig("acl"); assertthat(c.getipaccesslists(), haskeys("acl")); ipaccesslist acl = c.getipaccesslists().get("acl"); assertthat(acl.getlines(), hassize(7)); assertthat(c.getip6accesslists(), haskeys("aclv6")); ip6accesslist aclv6 = c.getip6accesslists().get("aclv6"); assertthat(aclv6.getlines(), hassize(4)); }
pranavbj-amzn/batfish
[ 1, 0, 0, 0 ]
33,288
@Override public boolean onTouch(View v, MotionEvent event) { switch(event.getAction()){ case MotionEvent.ACTION_CANCEL: _downTime.set(0); break; case MotionEvent.ACTION_DOWN: _downTime.set(System.currentTimeMillis()); _downX = event.getX(); _downY = event.getY(); if(_longClickTimer == null){ // if there is no pre-existing task, create a new one _longClickTimer = new AsyncTask<Void, Void, Boolean>(){ @Override protected Boolean doInBackground(Void... params) { try{ for(long i=0;i<Definitions.THRESHOLD_LONG_CLICK_MAX_DURATION;i+=INTERVAL_LONG_CLICK_CHECK){ Thread.sleep(INTERVAL_LONG_CLICK_CHECK); long downTime = _downTime.get(); if(downTime > 0 && System.currentTimeMillis()-downTime > Definitions.THRESHOLD_LONG_CLICK_MIN_DURATION){ return true; } } }catch(InterruptedException ex){ LogUtils.warn(CLASS_NAME, "doInBackground", ex.toString()); } return false; } @Override protected void onPostExecute(Boolean result) { if(result){ centerChart(); _downTime.set(0); } _longClickTimer = null; } }; // new asyncTask _longClickTimer.execute(); } break; case MotionEvent.ACTION_MOVE: checkForMovement(event); break; case MotionEvent.ACTION_UP: long downTime = _downTime.getAndSet(0); if(downTime != 0 && (System.currentTimeMillis()-downTime) < Definitions.THRESHOLD_CLICK_MAX_DURATION && !checkForMovement(event)){ SeriesSelection selection = _viewChart.getCurrentSeriesAndPoint(); if(selection == null || selection.getSeriesIndex() != 0){ // if there was no selection or this is not the first series (point values) LogUtils.debug(CLASS_NAME, "onTouch", "No usable selection."); }else{ List<GaugeValue> values = _currentGauge.getValues(); int valueCount = values.size(); int index = 0; //TODO: this will break if the chart shows something else than the last getMaxGraphPoints() of values if(valueCount - _settings.getMaxGraphPoints() > 0){ index = valueCount - _settings.getMaxGraphPoints() + selection.getPointIndex(); }else{ index = selection.getPointIndex(); } _currentValue = _currentGauge.getValues().get(index); (new GaugeValueDialog()).show(GraphActivity.this.getSupportFragmentManager(), GaugeValueDialog.TAG); } } break; default: break; // ignore everything else } return false; // always return false so that we do not interfere with the graph pan/zoom controls }
@Override public boolean onTouch(View v, MotionEvent event) { switch(event.getAction()){ case MotionEvent.ACTION_CANCEL: _downTime.set(0); break; case MotionEvent.ACTION_DOWN: _downTime.set(System.currentTimeMillis()); _downX = event.getX(); _downY = event.getY(); if(_longClickTimer == null){ _longClickTimer = new AsyncTask<Void, Void, Boolean>(){ @Override protected Boolean doInBackground(Void... params) { try{ for(long i=0;i<Definitions.THRESHOLD_LONG_CLICK_MAX_DURATION;i+=INTERVAL_LONG_CLICK_CHECK){ Thread.sleep(INTERVAL_LONG_CLICK_CHECK); long downTime = _downTime.get(); if(downTime > 0 && System.currentTimeMillis()-downTime > Definitions.THRESHOLD_LONG_CLICK_MIN_DURATION){ return true; } } }catch(InterruptedException ex){ LogUtils.warn(CLASS_NAME, "doInBackground", ex.toString()); } return false; } @Override protected void onPostExecute(Boolean result) { if(result){ centerChart(); _downTime.set(0); } _longClickTimer = null; } }; _longClickTimer.execute(); } break; case MotionEvent.ACTION_MOVE: checkForMovement(event); break; case MotionEvent.ACTION_UP: long downTime = _downTime.getAndSet(0); if(downTime != 0 && (System.currentTimeMillis()-downTime) < Definitions.THRESHOLD_CLICK_MAX_DURATION && !checkForMovement(event)){ SeriesSelection selection = _viewChart.getCurrentSeriesAndPoint(); if(selection == null || selection.getSeriesIndex() != 0){ LogUtils.debug(CLASS_NAME, "onTouch", "No usable selection."); }else{ List<GaugeValue> values = _currentGauge.getValues(); int valueCount = values.size(); int index = 0; if(valueCount - _settings.getMaxGraphPoints() > 0){ index = valueCount - _settings.getMaxGraphPoints() + selection.getPointIndex(); }else{ index = selection.getPointIndex(); } _currentValue = _currentGauge.getValues().get(index); (new GaugeValueDialog()).show(GraphActivity.this.getSupportFragmentManager(), GaugeValueDialog.TAG); } } break; default: break; } return false; }
@override public boolean ontouch(view v, motionevent event) { switch(event.getaction()){ case motionevent.action_cancel: _downtime.set(0); break; case motionevent.action_down: _downtime.set(system.currenttimemillis()); _downx = event.getx(); _downy = event.gety(); if(_longclicktimer == null){ _longclicktimer = new asynctask<void, void, boolean>(){ @override protected boolean doinbackground(void... params) { try{ for(long i=0;i<definitions.threshold_long_click_max_duration;i+=interval_long_click_check){ thread.sleep(interval_long_click_check); long downtime = _downtime.get(); if(downtime > 0 && system.currenttimemillis()-downtime > definitions.threshold_long_click_min_duration){ return true; } } }catch(interruptedexception ex){ logutils.warn(class_name, "doinbackground", ex.tostring()); } return false; } @override protected void onpostexecute(boolean result) { if(result){ centerchart(); _downtime.set(0); } _longclicktimer = null; } }; _longclicktimer.execute(); } break; case motionevent.action_move: checkformovement(event); break; case motionevent.action_up: long downtime = _downtime.getandset(0); if(downtime != 0 && (system.currenttimemillis()-downtime) < definitions.threshold_click_max_duration && !checkformovement(event)){ seriesselection selection = _viewchart.getcurrentseriesandpoint(); if(selection == null || selection.getseriesindex() != 0){ logutils.debug(class_name, "ontouch", "no usable selection."); }else{ list<gaugevalue> values = _currentgauge.getvalues(); int valuecount = values.size(); int index = 0; if(valuecount - _settings.getmaxgraphpoints() > 0){ index = valuecount - _settings.getmaxgraphpoints() + selection.getpointindex(); }else{ index = selection.getpointindex(); } _currentvalue = _currentgauge.getvalues().get(index); (new gaugevaluedialog()).show(graphactivity.this.getsupportfragmentmanager(), gaugevaluedialog.tag); } } break; default: break; } return false; }
otula/kiiaudata
[ 0, 0, 1, 0 ]
675
@Override public int describeContents() { return 0;//TODO figure out how to act with this stuff }
@Override public int describeContents() { return 0 }
@override public int describecontents() { return 0 }
programmerr47/breverkruntkin-test-task
[ 1, 0, 0, 0 ]
8,907
public void setWs(boolean b) { // TODO: document me this.tr.setSkipws(b); }
public void setWs(boolean b) { this.tr.setSkipws(b); }
public void setws(boolean b) { this.tr.setskipws(b); }
rebse/flaka
[ 0, 0, 0, 0 ]
8,908
public void setCl(boolean b) { // TODO: document me this.tr.setResolveContLines(b); }
public void setCl(boolean b) { this.tr.setResolveContLines(b); }
public void setcl(boolean b) { this.tr.setresolvecontlines(b); }
rebse/flaka
[ 0, 0, 0, 0 ]
781
private Map<String, T> getChoiceMap() { if (choiceMap == null || alwaysReload()) { Collection<T> choices = loadChoices(); choiceMap = new HashMap<>(); for (T choice: choices) { // TODO: smarter initialization of the map choiceMap.put(choice.getLocalPart(), choice); } } return choiceMap; }
private Map<String, T> getChoiceMap() { if (choiceMap == null || alwaysReload()) { Collection<T> choices = loadChoices(); choiceMap = new HashMap<>(); for (T choice: choices) { choiceMap.put(choice.getLocalPart(), choice); } } return choiceMap; }
private map<string, t> getchoicemap() { if (choicemap == null || alwaysreload()) { collection<t> choices = loadchoices(); choicemap = new hashmap<>(); for (t choice: choices) { choicemap.put(choice.getlocalpart(), choice); } } return choicemap; }
mythoss/midpoint
[ 1, 0, 0, 0 ]
9,010
public static void main(String[] args) { // The connection string value can be obtained by: // 1. Going to your Event Hubs namespace in Azure Portal. // 2. Creating an Event Hub instance. // 3. Creating a "Shared access policy" for your Event Hub instance. // 4. Copying the connection string from the policy's properties. String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; EventHubProducerAsyncClient producer = new EventHubClientBuilder() .connectionString(connectionString) .buildAsyncProducer(); // Create an event to send. EventData data = new EventData("Hello world!".getBytes(UTF_8)); // Send that event. This call returns a Mono<Void>, which we subscribe to. It completes successfully when the // event has been delivered to the Event Hub. It completes with an error if an exception occurred while sending // the event. // SendOptions are not specified, so events sent are load balanced between all available partitions in the // Event Hub instance. producer.send(data).subscribe( (ignored) -> System.out.println("Event sent."), error -> { System.err.println("There was an error sending the event: " + error.toString()); if (error instanceof AmqpException) { AmqpException amqpException = (AmqpException) error; System.err.println(String.format("Is send operation retriable? %s. Error condition: %s", amqpException.isTransient(), amqpException.getErrorCondition())); } }, () -> { // Disposing of our producer and client. producer.close(); }); }
public static void main(String[] args) { String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; EventHubProducerAsyncClient producer = new EventHubClientBuilder() .connectionString(connectionString) .buildAsyncProducer(); EventData data = new EventData("Hello world!".getBytes(UTF_8)); producer.send(data).subscribe( (ignored) -> System.out.println("Event sent."), error -> { System.err.println("There was an error sending the event: " + error.toString()); if (error instanceof AmqpException) { AmqpException amqpException = (AmqpException) error; System.err.println(String.format("Is send operation retriable? %s. Error condition: %s", amqpException.isTransient(), amqpException.getErrorCondition())); } }, () -> { producer.close(); }); }
public static void main(string[] args) { string connectionstring = "endpoint={endpoint};sharedaccesskeyname={sharedaccesskeyname};sharedaccesskey={sharedaccesskey};entitypath={eventhubname}"; eventhubproducerasyncclient producer = new eventhubclientbuilder() .connectionstring(connectionstring) .buildasyncproducer(); eventdata data = new eventdata("hello world!".getbytes(utf_8)); producer.send(data).subscribe( (ignored) -> system.out.println("event sent."), error -> { system.err.println("there was an error sending the event: " + error.tostring()); if (error instanceof amqpexception) { amqpexception amqpexception = (amqpexception) error; system.err.println(string.format("is send operation retriable? %s. error condition: %s", amqpexception.istransient(), amqpexception.geterrorcondition())); } }, () -> { producer.close(); }); }
ppsim/azure-sdk-for-java
[ 0, 0, 0, 0 ]
822
private BasePrinter escapeCharacter(char c) { if (c == '"') { return backslashChar(c); } switch (c) { case '\\': return backslashChar('\\'); case '\r': return backslashChar('r'); case '\n': return backslashChar('n'); case '\t': return backslashChar('t'); default: if (c < 32) { //TODO(bazel-team): support \x escapes return this.append(String.format("\\x%02x", (int) c)); } return this.append(c); // no need to support UTF-8 } // endswitch }
private BasePrinter escapeCharacter(char c) { if (c == '"') { return backslashChar(c); } switch (c) { case '\\': return backslashChar('\\'); case '\r': return backslashChar('r'); case '\n': return backslashChar('n'); case '\t': return backslashChar('t'); default: if (c < 32) { return this.append(String.format("\\x%02x", (int) c)); } return this.append(c); } }
private baseprinter escapecharacter(char c) { if (c == '"') { return backslashchar(c); } switch (c) { case '\\': return backslashchar('\\'); case '\r': return backslashchar('r'); case '\n': return backslashchar('n'); case '\t': return backslashchar('t'); default: if (c < 32) { return this.append(string.format("\\x%02x", (int) c)); } return this.append(c); } }
moroten/bazel
[ 0, 1, 0, 0 ]
831
private Pair<ImageView, String> loadImageWithCaption(int fileId, String caption, Map <String, Integer> weaponMap, Integer id) { try { //TODO: USE BELOW WHEN INFO IS CHANGED System.out.println(fileId); var image = new ImageView(myLogic.getImage(fileId)); System.out.println("**********"); System.out.println(image); weaponMap.put(image.toString(), id); image.setFitWidth(100); image.setFitHeight(100); Pair pair = new Pair<>(image, caption); return pair; // return new Pair<>(image, caption); } catch(Exception e){ System.out.println(e); //This shouldn't ever happen } return null; }
private Pair<ImageView, String> loadImageWithCaption(int fileId, String caption, Map <String, Integer> weaponMap, Integer id) { try { System.out.println(fileId); var image = new ImageView(myLogic.getImage(fileId)); System.out.println("**********"); System.out.println(image); weaponMap.put(image.toString(), id); image.setFitWidth(100); image.setFitHeight(100); Pair pair = new Pair<>(image, caption); return pair; } catch(Exception e){ System.out.println(e); } return null; }
private pair<imageview, string> loadimagewithcaption(int fileid, string caption, map <string, integer> weaponmap, integer id) { try { system.out.println(fileid); var image = new imageview(mylogic.getimage(fileid)); system.out.println("**********"); system.out.println(image); weaponmap.put(image.tostring(), id); image.setfitwidth(100); image.setfitheight(100); pair pair = new pair<>(image, caption); return pair; } catch(exception e){ system.out.println(e); } return null; }
pandawithcat/VoogaSalad
[ 1, 0, 0, 0 ]
25,437
@Override public void channelRead0(final ChannelHandlerContext ctx, final RPCMessage msg) throws IOException { switch (msg.getType()) { case RPC_BLOCK_READ_REQUEST: assert msg instanceof RPCBlockReadRequest; mBlockHandler.handleBlockReadRequest(ctx, (RPCBlockReadRequest) msg); break; case RPC_BLOCK_WRITE_REQUEST: assert msg instanceof RPCBlockWriteRequest; mBlockHandler.handleBlockWriteRequest(ctx, (RPCBlockWriteRequest) msg); break; case RPC_FILE_READ_REQUEST: assert msg instanceof RPCFileReadRequest; mUnderFileSystemHandler.handleFileReadRequest(ctx, (RPCFileReadRequest) msg); break; case RPC_FILE_WRITE_REQUEST: assert msg instanceof RPCFileWriteRequest; mUnderFileSystemHandler.handleFileWriteRequest(ctx, (RPCFileWriteRequest) msg); break; case RPC_ERROR_RESPONSE: // TODO(peis): Fix this, we should not assert here. assert msg instanceof RPCErrorResponse; LOG.error("Received an error response from the client: " + msg.toString()); break; default: RPCErrorResponse resp = new RPCErrorResponse(RPCResponse.Status.UNKNOWN_MESSAGE_ERROR); ctx.writeAndFlush(resp); // TODO(peis): Fix this. We should not throw an exception here. throw new IllegalArgumentException( "No handler implementation for rpc msg type: " + msg.getType()); } }
@Override public void channelRead0(final ChannelHandlerContext ctx, final RPCMessage msg) throws IOException { switch (msg.getType()) { case RPC_BLOCK_READ_REQUEST: assert msg instanceof RPCBlockReadRequest; mBlockHandler.handleBlockReadRequest(ctx, (RPCBlockReadRequest) msg); break; case RPC_BLOCK_WRITE_REQUEST: assert msg instanceof RPCBlockWriteRequest; mBlockHandler.handleBlockWriteRequest(ctx, (RPCBlockWriteRequest) msg); break; case RPC_FILE_READ_REQUEST: assert msg instanceof RPCFileReadRequest; mUnderFileSystemHandler.handleFileReadRequest(ctx, (RPCFileReadRequest) msg); break; case RPC_FILE_WRITE_REQUEST: assert msg instanceof RPCFileWriteRequest; mUnderFileSystemHandler.handleFileWriteRequest(ctx, (RPCFileWriteRequest) msg); break; case RPC_ERROR_RESPONSE: assert msg instanceof RPCErrorResponse; LOG.error("Received an error response from the client: " + msg.toString()); break; default: RPCErrorResponse resp = new RPCErrorResponse(RPCResponse.Status.UNKNOWN_MESSAGE_ERROR); ctx.writeAndFlush(resp); throw new IllegalArgumentException( "No handler implementation for rpc msg type: " + msg.getType()); } }
@override public void channelread0(final channelhandlercontext ctx, final rpcmessage msg) throws ioexception { switch (msg.gettype()) { case rpc_block_read_request: assert msg instanceof rpcblockreadrequest; mblockhandler.handleblockreadrequest(ctx, (rpcblockreadrequest) msg); break; case rpc_block_write_request: assert msg instanceof rpcblockwriterequest; mblockhandler.handleblockwriterequest(ctx, (rpcblockwriterequest) msg); break; case rpc_file_read_request: assert msg instanceof rpcfilereadrequest; munderfilesystemhandler.handlefilereadrequest(ctx, (rpcfilereadrequest) msg); break; case rpc_file_write_request: assert msg instanceof rpcfilewriterequest; munderfilesystemhandler.handlefilewriterequest(ctx, (rpcfilewriterequest) msg); break; case rpc_error_response: assert msg instanceof rpcerrorresponse; log.error("received an error response from the client: " + msg.tostring()); break; default: rpcerrorresponse resp = new rpcerrorresponse(rpcresponse.status.unknown_message_error); ctx.writeandflush(resp); throw new illegalargumentexception( "no handler implementation for rpc msg type: " + msg.gettype()); } }
ramiyer/alluxio
[ 1, 0, 1, 0 ]
25,438
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { LOG.warn("Exception thrown while processing request", cause); // TODO(peis): This doesn't have to be decode error, it can also be any network errors such as // connection reset. Fix this ALLUXIO-2235. RPCErrorResponse resp = new RPCErrorResponse(RPCResponse.Status.DECODE_ERROR); ChannelFuture channelFuture = ctx.writeAndFlush(resp); // Close the channel because it is likely a network error. channelFuture.addListener(ChannelFutureListener.CLOSE); }
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { LOG.warn("Exception thrown while processing request", cause); RPCErrorResponse resp = new RPCErrorResponse(RPCResponse.Status.DECODE_ERROR); ChannelFuture channelFuture = ctx.writeAndFlush(resp); channelFuture.addListener(ChannelFutureListener.CLOSE); }
@override public void exceptioncaught(channelhandlercontext ctx, throwable cause) throws exception { log.warn("exception thrown while processing request", cause); rpcerrorresponse resp = new rpcerrorresponse(rpcresponse.status.decode_error); channelfuture channelfuture = ctx.writeandflush(resp); channelfuture.addlistener(channelfuturelistener.close); }
ramiyer/alluxio
[ 0, 0, 1, 0 ]
17,264
public static NavigableMap<String, Object> readAttrs(Buffer buffer, int version) { NavigableMap<String, Object> attrs = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); int flags = buffer.getInt(); if (version >= SftpConstants.SFTP_V4) { int type = buffer.getUByte(); switch (type) { case SftpConstants.SSH_FILEXFER_TYPE_REGULAR: attrs.put("isRegular", Boolean.TRUE); break; case SftpConstants.SSH_FILEXFER_TYPE_DIRECTORY: attrs.put("isDirectory", Boolean.TRUE); break; case SftpConstants.SSH_FILEXFER_TYPE_SYMLINK: attrs.put("isSymbolicLink", Boolean.TRUE); break; case SftpConstants.SSH_FILEXFER_TYPE_SOCKET: case SftpConstants.SSH_FILEXFER_TYPE_CHAR_DEVICE: case SftpConstants.SSH_FILEXFER_TYPE_BLOCK_DEVICE: case SftpConstants.SSH_FILEXFER_TYPE_FIFO: attrs.put("isOther", Boolean.TRUE); break; default: // ignored } } if ((flags & SftpConstants.SSH_FILEXFER_ATTR_SIZE) != 0) { attrs.put("size", buffer.getLong()); } if (version == SftpConstants.SFTP_V3) { if ((flags & SftpConstants.SSH_FILEXFER_ATTR_UIDGID) != 0) { attrs.put("uid", buffer.getInt()); attrs.put("gid", buffer.getInt()); } } else { if ((version >= SftpConstants.SFTP_V6) && ((flags & SftpConstants.SSH_FILEXFER_ATTR_ALLOCATION_SIZE) != 0)) { @SuppressWarnings("unused") long allocSize = buffer.getLong(); // TODO handle allocation size } if ((flags & SftpConstants.SSH_FILEXFER_ATTR_OWNERGROUP) != 0) { attrs.put("owner", new DefaultGroupPrincipal(buffer.getString())); attrs.put("group", new DefaultGroupPrincipal(buffer.getString())); } } if ((flags & SftpConstants.SSH_FILEXFER_ATTR_PERMISSIONS) != 0) { attrs.put("permissions", permissionsToAttributes(buffer.getInt())); } if (version == SftpConstants.SFTP_V3) { if ((flags & SftpConstants.SSH_FILEXFER_ATTR_ACMODTIME) != 0) { attrs.put("lastAccessTime", readTime(buffer, version, flags)); attrs.put("lastModifiedTime", readTime(buffer, version, flags)); } } else if (version >= SftpConstants.SFTP_V4) { if ((flags & SftpConstants.SSH_FILEXFER_ATTR_ACCESSTIME) != 0) { attrs.put("lastAccessTime", readTime(buffer, version, flags)); } if ((flags & SftpConstants.SSH_FILEXFER_ATTR_CREATETIME) != 0) { attrs.put("creationTime", readTime(buffer, version, flags)); } if ((flags & SftpConstants.SSH_FILEXFER_ATTR_MODIFYTIME) != 0) { attrs.put("lastModifiedTime", readTime(buffer, version, flags)); } if ((version >= SftpConstants.SFTP_V6) && (flags & SftpConstants.SSH_FILEXFER_ATTR_CTIME) != 0) { attrs.put("ctime", readTime(buffer, version, flags)); } if ((flags & SftpConstants.SSH_FILEXFER_ATTR_ACL) != 0) { attrs.put("acl", readACLs(buffer, version)); } if ((flags & SftpConstants.SSH_FILEXFER_ATTR_BITS) != 0) { @SuppressWarnings("unused") int bits = buffer.getInt(); @SuppressWarnings("unused") int valid = 0xffffffff; if (version >= SftpConstants.SFTP_V6) { valid = buffer.getInt(); } // TODO: handle attrib bits } if (version >= SftpConstants.SFTP_V6) { if ((flags & SftpConstants.SSH_FILEXFER_ATTR_TEXT_HINT) != 0) { @SuppressWarnings("unused") boolean text = buffer.getBoolean(); // TODO: handle text } if ((flags & SftpConstants.SSH_FILEXFER_ATTR_MIME_TYPE) != 0) { @SuppressWarnings("unused") String mimeType = buffer.getString(); // TODO: handle mime-type } if ((flags & SftpConstants.SSH_FILEXFER_ATTR_LINK_COUNT) != 0) { @SuppressWarnings("unused") int nlink = buffer.getInt(); // TODO: handle link-count } if ((flags & SftpConstants.SSH_FILEXFER_ATTR_UNTRANSLATED_NAME) != 0) { @SuppressWarnings("unused") String untranslated = buffer.getString(); // TODO: handle untranslated-name } } } if ((flags & SftpConstants.SSH_FILEXFER_ATTR_EXTENDED) != 0) { attrs.put("extended", readExtensions(buffer)); } return attrs; }
public static NavigableMap<String, Object> readAttrs(Buffer buffer, int version) { NavigableMap<String, Object> attrs = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); int flags = buffer.getInt(); if (version >= SftpConstants.SFTP_V4) { int type = buffer.getUByte(); switch (type) { case SftpConstants.SSH_FILEXFER_TYPE_REGULAR: attrs.put("isRegular", Boolean.TRUE); break; case SftpConstants.SSH_FILEXFER_TYPE_DIRECTORY: attrs.put("isDirectory", Boolean.TRUE); break; case SftpConstants.SSH_FILEXFER_TYPE_SYMLINK: attrs.put("isSymbolicLink", Boolean.TRUE); break; case SftpConstants.SSH_FILEXFER_TYPE_SOCKET: case SftpConstants.SSH_FILEXFER_TYPE_CHAR_DEVICE: case SftpConstants.SSH_FILEXFER_TYPE_BLOCK_DEVICE: case SftpConstants.SSH_FILEXFER_TYPE_FIFO: attrs.put("isOther", Boolean.TRUE); break; default: } } if ((flags & SftpConstants.SSH_FILEXFER_ATTR_SIZE) != 0) { attrs.put("size", buffer.getLong()); } if (version == SftpConstants.SFTP_V3) { if ((flags & SftpConstants.SSH_FILEXFER_ATTR_UIDGID) != 0) { attrs.put("uid", buffer.getInt()); attrs.put("gid", buffer.getInt()); } } else { if ((version >= SftpConstants.SFTP_V6) && ((flags & SftpConstants.SSH_FILEXFER_ATTR_ALLOCATION_SIZE) != 0)) { @SuppressWarnings("unused") long allocSize = buffer.getLong(); } if ((flags & SftpConstants.SSH_FILEXFER_ATTR_OWNERGROUP) != 0) { attrs.put("owner", new DefaultGroupPrincipal(buffer.getString())); attrs.put("group", new DefaultGroupPrincipal(buffer.getString())); } } if ((flags & SftpConstants.SSH_FILEXFER_ATTR_PERMISSIONS) != 0) { attrs.put("permissions", permissionsToAttributes(buffer.getInt())); } if (version == SftpConstants.SFTP_V3) { if ((flags & SftpConstants.SSH_FILEXFER_ATTR_ACMODTIME) != 0) { attrs.put("lastAccessTime", readTime(buffer, version, flags)); attrs.put("lastModifiedTime", readTime(buffer, version, flags)); } } else if (version >= SftpConstants.SFTP_V4) { if ((flags & SftpConstants.SSH_FILEXFER_ATTR_ACCESSTIME) != 0) { attrs.put("lastAccessTime", readTime(buffer, version, flags)); } if ((flags & SftpConstants.SSH_FILEXFER_ATTR_CREATETIME) != 0) { attrs.put("creationTime", readTime(buffer, version, flags)); } if ((flags & SftpConstants.SSH_FILEXFER_ATTR_MODIFYTIME) != 0) { attrs.put("lastModifiedTime", readTime(buffer, version, flags)); } if ((version >= SftpConstants.SFTP_V6) && (flags & SftpConstants.SSH_FILEXFER_ATTR_CTIME) != 0) { attrs.put("ctime", readTime(buffer, version, flags)); } if ((flags & SftpConstants.SSH_FILEXFER_ATTR_ACL) != 0) { attrs.put("acl", readACLs(buffer, version)); } if ((flags & SftpConstants.SSH_FILEXFER_ATTR_BITS) != 0) { @SuppressWarnings("unused") int bits = buffer.getInt(); @SuppressWarnings("unused") int valid = 0xffffffff; if (version >= SftpConstants.SFTP_V6) { valid = buffer.getInt(); } } if (version >= SftpConstants.SFTP_V6) { if ((flags & SftpConstants.SSH_FILEXFER_ATTR_TEXT_HINT) != 0) { @SuppressWarnings("unused") boolean text = buffer.getBoolean(); } if ((flags & SftpConstants.SSH_FILEXFER_ATTR_MIME_TYPE) != 0) { @SuppressWarnings("unused") String mimeType = buffer.getString(); } if ((flags & SftpConstants.SSH_FILEXFER_ATTR_LINK_COUNT) != 0) { @SuppressWarnings("unused") int nlink = buffer.getInt(); } if ((flags & SftpConstants.SSH_FILEXFER_ATTR_UNTRANSLATED_NAME) != 0) { @SuppressWarnings("unused") String untranslated = buffer.getString(); } } } if ((flags & SftpConstants.SSH_FILEXFER_ATTR_EXTENDED) != 0) { attrs.put("extended", readExtensions(buffer)); } return attrs; }
public static navigablemap<string, object> readattrs(buffer buffer, int version) { navigablemap<string, object> attrs = new treemap<>(string.case_insensitive_order); int flags = buffer.getint(); if (version >= sftpconstants.sftp_v4) { int type = buffer.getubyte(); switch (type) { case sftpconstants.ssh_filexfer_type_regular: attrs.put("isregular", boolean.true); break; case sftpconstants.ssh_filexfer_type_directory: attrs.put("isdirectory", boolean.true); break; case sftpconstants.ssh_filexfer_type_symlink: attrs.put("issymboliclink", boolean.true); break; case sftpconstants.ssh_filexfer_type_socket: case sftpconstants.ssh_filexfer_type_char_device: case sftpconstants.ssh_filexfer_type_block_device: case sftpconstants.ssh_filexfer_type_fifo: attrs.put("isother", boolean.true); break; default: } } if ((flags & sftpconstants.ssh_filexfer_attr_size) != 0) { attrs.put("size", buffer.getlong()); } if (version == sftpconstants.sftp_v3) { if ((flags & sftpconstants.ssh_filexfer_attr_uidgid) != 0) { attrs.put("uid", buffer.getint()); attrs.put("gid", buffer.getint()); } } else { if ((version >= sftpconstants.sftp_v6) && ((flags & sftpconstants.ssh_filexfer_attr_allocation_size) != 0)) { @suppresswarnings("unused") long allocsize = buffer.getlong(); } if ((flags & sftpconstants.ssh_filexfer_attr_ownergroup) != 0) { attrs.put("owner", new defaultgroupprincipal(buffer.getstring())); attrs.put("group", new defaultgroupprincipal(buffer.getstring())); } } if ((flags & sftpconstants.ssh_filexfer_attr_permissions) != 0) { attrs.put("permissions", permissionstoattributes(buffer.getint())); } if (version == sftpconstants.sftp_v3) { if ((flags & sftpconstants.ssh_filexfer_attr_acmodtime) != 0) { attrs.put("lastaccesstime", readtime(buffer, version, flags)); attrs.put("lastmodifiedtime", readtime(buffer, version, flags)); } } else if (version >= sftpconstants.sftp_v4) { if ((flags & sftpconstants.ssh_filexfer_attr_accesstime) != 0) { attrs.put("lastaccesstime", readtime(buffer, version, flags)); } if ((flags & sftpconstants.ssh_filexfer_attr_createtime) != 0) { attrs.put("creationtime", readtime(buffer, version, flags)); } if ((flags & sftpconstants.ssh_filexfer_attr_modifytime) != 0) { attrs.put("lastmodifiedtime", readtime(buffer, version, flags)); } if ((version >= sftpconstants.sftp_v6) && (flags & sftpconstants.ssh_filexfer_attr_ctime) != 0) { attrs.put("ctime", readtime(buffer, version, flags)); } if ((flags & sftpconstants.ssh_filexfer_attr_acl) != 0) { attrs.put("acl", readacls(buffer, version)); } if ((flags & sftpconstants.ssh_filexfer_attr_bits) != 0) { @suppresswarnings("unused") int bits = buffer.getint(); @suppresswarnings("unused") int valid = 0xffffffff; if (version >= sftpconstants.sftp_v6) { valid = buffer.getint(); } } if (version >= sftpconstants.sftp_v6) { if ((flags & sftpconstants.ssh_filexfer_attr_text_hint) != 0) { @suppresswarnings("unused") boolean text = buffer.getboolean(); } if ((flags & sftpconstants.ssh_filexfer_attr_mime_type) != 0) { @suppresswarnings("unused") string mimetype = buffer.getstring(); } if ((flags & sftpconstants.ssh_filexfer_attr_link_count) != 0) { @suppresswarnings("unused") int nlink = buffer.getint(); } if ((flags & sftpconstants.ssh_filexfer_attr_untranslated_name) != 0) { @suppresswarnings("unused") string untranslated = buffer.getstring(); } } } if ((flags & sftpconstants.ssh_filexfer_attr_extended) != 0) { attrs.put("extended", readextensions(buffer)); } return attrs; }
msohn/mina-sshd
[ 0, 1, 0, 0 ]
17,318
@Override void storeProperties() throws IOException { super.storeProperties(); // Store chnages in manifest storeManifestChanges(); // store localized info if (bundleInfo != null && bundleInfo.isModified()) { bundleInfo.store(); } // XXX else ignore for now but we could save into some default location ProjectXMLManager pxm = getProjectXMLManager(); // Store project.xml changes // store module dependencies DependencyListModel dependencyModel = getDependenciesListModel(); if (dependencyModel.isChanged()) { Set<ModuleDependency> depsToSave = new TreeSet<ModuleDependency>(dependencyModel.getDependencies()); logNetBeansAPIUsage("DEPENDENCIES", dependencyModel.getDependencies()); // NOI18N try { pxm.replaceDependencies(depsToSave); } catch (CyclicDependencyException ex) { throw new IOException(ex); } } Set<String> friends = getFriendListModel().getFriends(); Set<String> publicPkgs = getPublicPackagesModel().getSelectedPackages(); boolean refreshModuleList = false; if (getPublicPackagesModel().isChanged() || getFriendListModel().isChanged()) { if (friends.size() > 0) { // store friends packages pxm.replaceFriends(friends, publicPkgs); } else { // store public packages pxm.replacePublicPackages(publicPkgs); } refreshModuleList = true; } // store class-path-extensions + its src & javadoc if (cps != null && wrappedJarsListModel != null && wrappedJarsChanged) { final List<Item> cpExtList = ClassPathUiSupport.getList(wrappedJarsListModel); Map<String, String> newCpExt = new HashMap<String, String>(); for (Item item : cpExtList) { String binPath = item.getFilePath(); if (binPath != null) { FileObject fo = FileUtil.toFileObject(PropertyUtils.resolveFile(getProjectDirectoryFile(), binPath)); if(fo != null) { String runtimePath = ApisupportAntUtils.CPEXT_RUNTIME_RELATIVE_PATH + fo.getNameExt(); newCpExt.put(runtimePath, binPath); } } } // delete removed JARs, remove any remaining exported packages and src&javadoc refs left Iterator<Item> it = getCPExtIterator(); HashSet<String> jarsSet = new HashSet<String>(newCpExt.values()); while (it.hasNext()) { Item item = it.next(); if (!jarsSet.contains(item.getFilePath())) { // XXX deleting here doesn't work on Windows: // File f = PropertyUtils.resolveFile(getProjectDirectoryFile(), item.getFilePath()); // FileObject toDel = FileUtil.toFileObject(f); // if (toDel != null) { // toDel.delete(); // } assert item.getReference() != null : "getCPExtIterator() initializes references to wrapped JARs"; item.removeSourceAndJavadoc(getUpdateHelper()); getRefHelper().destroyReference(item.getReference()); } } cps.encodeToStrings(cpExtList, CPEXT); pxm.replaceClassPathExtensions(newCpExt); wrappedJarsChanged = false; } if (isStandalone()) { ModuleProperties.storePlatform(getHelper(), getActivePlatform()); if (javaPlatformChanged) { ModuleProperties.storeJavaPlatform(getHelper(), getEvaluator(), getActiveJavaPlatform(), false); } if (refreshModuleList) { ModuleList.refreshModuleListForRoot(getProjectDirectoryFile()); } } else if (isSuiteComponent() && refreshModuleList) { ModuleList.refreshModuleListForRoot(getSuiteDirectory()); } else if (isNetBeansOrg()) { if (javaPlatformChanged) { ModuleProperties.storeJavaPlatform(getHelper(), getEvaluator(), getActiveJavaPlatform(), true); } if (refreshModuleList) { ModuleList.refreshModuleListForRoot(ModuleList.findNetBeansOrg(getProjectDirectoryFile())); } } }
@Override void storeProperties() throws IOException { super.storeProperties(); storeManifestChanges(); if (bundleInfo != null && bundleInfo.isModified()) { bundleInfo.store(); } ProjectXMLManager pxm = getProjectXMLManager(); DependencyListModel dependencyModel = getDependenciesListModel(); if (dependencyModel.isChanged()) { Set<ModuleDependency> depsToSave = new TreeSet<ModuleDependency>(dependencyModel.getDependencies()); logNetBeansAPIUsage("DEPENDENCIES", dependencyModel.getDependencies()); try { pxm.replaceDependencies(depsToSave); } catch (CyclicDependencyException ex) { throw new IOException(ex); } } Set<String> friends = getFriendListModel().getFriends(); Set<String> publicPkgs = getPublicPackagesModel().getSelectedPackages(); boolean refreshModuleList = false; if (getPublicPackagesModel().isChanged() || getFriendListModel().isChanged()) { if (friends.size() > 0) { pxm.replaceFriends(friends, publicPkgs); } else { pxm.replacePublicPackages(publicPkgs); } refreshModuleList = true; } if (cps != null && wrappedJarsListModel != null && wrappedJarsChanged) { final List<Item> cpExtList = ClassPathUiSupport.getList(wrappedJarsListModel); Map<String, String> newCpExt = new HashMap<String, String>(); for (Item item : cpExtList) { String binPath = item.getFilePath(); if (binPath != null) { FileObject fo = FileUtil.toFileObject(PropertyUtils.resolveFile(getProjectDirectoryFile(), binPath)); if(fo != null) { String runtimePath = ApisupportAntUtils.CPEXT_RUNTIME_RELATIVE_PATH + fo.getNameExt(); newCpExt.put(runtimePath, binPath); } } } Iterator<Item> it = getCPExtIterator(); HashSet<String> jarsSet = new HashSet<String>(newCpExt.values()); while (it.hasNext()) { Item item = it.next(); if (!jarsSet.contains(item.getFilePath())) { assert item.getReference() != null : "getCPExtIterator() initializes references to wrapped JARs"; item.removeSourceAndJavadoc(getUpdateHelper()); getRefHelper().destroyReference(item.getReference()); } } cps.encodeToStrings(cpExtList, CPEXT); pxm.replaceClassPathExtensions(newCpExt); wrappedJarsChanged = false; } if (isStandalone()) { ModuleProperties.storePlatform(getHelper(), getActivePlatform()); if (javaPlatformChanged) { ModuleProperties.storeJavaPlatform(getHelper(), getEvaluator(), getActiveJavaPlatform(), false); } if (refreshModuleList) { ModuleList.refreshModuleListForRoot(getProjectDirectoryFile()); } } else if (isSuiteComponent() && refreshModuleList) { ModuleList.refreshModuleListForRoot(getSuiteDirectory()); } else if (isNetBeansOrg()) { if (javaPlatformChanged) { ModuleProperties.storeJavaPlatform(getHelper(), getEvaluator(), getActiveJavaPlatform(), true); } if (refreshModuleList) { ModuleList.refreshModuleListForRoot(ModuleList.findNetBeansOrg(getProjectDirectoryFile())); } } }
@override void storeproperties() throws ioexception { super.storeproperties(); storemanifestchanges(); if (bundleinfo != null && bundleinfo.ismodified()) { bundleinfo.store(); } projectxmlmanager pxm = getprojectxmlmanager(); dependencylistmodel dependencymodel = getdependencieslistmodel(); if (dependencymodel.ischanged()) { set<moduledependency> depstosave = new treeset<moduledependency>(dependencymodel.getdependencies()); lognetbeansapiusage("dependencies", dependencymodel.getdependencies()); try { pxm.replacedependencies(depstosave); } catch (cyclicdependencyexception ex) { throw new ioexception(ex); } } set<string> friends = getfriendlistmodel().getfriends(); set<string> publicpkgs = getpublicpackagesmodel().getselectedpackages(); boolean refreshmodulelist = false; if (getpublicpackagesmodel().ischanged() || getfriendlistmodel().ischanged()) { if (friends.size() > 0) { pxm.replacefriends(friends, publicpkgs); } else { pxm.replacepublicpackages(publicpkgs); } refreshmodulelist = true; } if (cps != null && wrappedjarslistmodel != null && wrappedjarschanged) { final list<item> cpextlist = classpathuisupport.getlist(wrappedjarslistmodel); map<string, string> newcpext = new hashmap<string, string>(); for (item item : cpextlist) { string binpath = item.getfilepath(); if (binpath != null) { fileobject fo = fileutil.tofileobject(propertyutils.resolvefile(getprojectdirectoryfile(), binpath)); if(fo != null) { string runtimepath = apisupportantutils.cpext_runtime_relative_path + fo.getnameext(); newcpext.put(runtimepath, binpath); } } } iterator<item> it = getcpextiterator(); hashset<string> jarsset = new hashset<string>(newcpext.values()); while (it.hasnext()) { item item = it.next(); if (!jarsset.contains(item.getfilepath())) { assert item.getreference() != null : "getcpextiterator() initializes references to wrapped jars"; item.removesourceandjavadoc(getupdatehelper()); getrefhelper().destroyreference(item.getreference()); } } cps.encodetostrings(cpextlist, cpext); pxm.replaceclasspathextensions(newcpext); wrappedjarschanged = false; } if (isstandalone()) { moduleproperties.storeplatform(gethelper(), getactiveplatform()); if (javaplatformchanged) { moduleproperties.storejavaplatform(gethelper(), getevaluator(), getactivejavaplatform(), false); } if (refreshmodulelist) { modulelist.refreshmodulelistforroot(getprojectdirectoryfile()); } } else if (issuitecomponent() && refreshmodulelist) { modulelist.refreshmodulelistforroot(getsuitedirectory()); } else if (isnetbeansorg()) { if (javaplatformchanged) { moduleproperties.storejavaplatform(gethelper(), getevaluator(), getactivejavaplatform(), true); } if (refreshmodulelist) { modulelist.refreshmodulelistforroot(modulelist.findnetbeansorg(getprojectdirectoryfile())); } } }
pokebadgerswithspoon/incubator-netbeans
[ 1, 0, 1, 0 ]
17,373
public void deleteByUserId(int userId) { try { DeleteBuilder<UserRequest, Long> deleteBuilder = dao.deleteBuilder(); deleteBuilder.where().eq(QMUserColumns.ID, userId); if (deleteBuilder.delete() > 0) { //TODO VT need to think how to send ID to observers notifyObserversDeletedById(userId); } } catch (SQLException e) { ErrorUtils.logError(e); } }
public void deleteByUserId(int userId) { try { DeleteBuilder<UserRequest, Long> deleteBuilder = dao.deleteBuilder(); deleteBuilder.where().eq(QMUserColumns.ID, userId); if (deleteBuilder.delete() > 0) { notifyObserversDeletedById(userId); } } catch (SQLException e) { ErrorUtils.logError(e); } }
public void deletebyuserid(int userid) { try { deletebuilder<userrequest, long> deletebuilder = dao.deletebuilder(); deletebuilder.where().eq(qmusercolumns.id, userid); if (deletebuilder.delete() > 0) { notifyobserversdeletedbyid(userid); } } catch (sqlexception e) { errorutils.logerror(e); } }
philz127/CAPSTONE
[ 1, 0, 0, 0 ]
25,568
@Deprecated public boolean isValidShortNumberForRegion(String shortNumber, String regionDialingFrom) { PhoneMetadata phoneMetadata = MetadataManager.getShortNumberMetadataForRegion(regionDialingFrom); if (phoneMetadata == null) { return false; } PhoneNumberDesc generalDesc = phoneMetadata.getGeneralDesc(); if (!matchesPossibleNumberAndNationalNumber(shortNumber, generalDesc)) { return false; } PhoneNumberDesc shortNumberDesc = phoneMetadata.getShortCode(); return matchesPossibleNumberAndNationalNumber(shortNumber, shortNumberDesc); }
@Deprecated public boolean isValidShortNumberForRegion(String shortNumber, String regionDialingFrom) { PhoneMetadata phoneMetadata = MetadataManager.getShortNumberMetadataForRegion(regionDialingFrom); if (phoneMetadata == null) { return false; } PhoneNumberDesc generalDesc = phoneMetadata.getGeneralDesc(); if (!matchesPossibleNumberAndNationalNumber(shortNumber, generalDesc)) { return false; } PhoneNumberDesc shortNumberDesc = phoneMetadata.getShortCode(); return matchesPossibleNumberAndNationalNumber(shortNumber, shortNumberDesc); }
@deprecated public boolean isvalidshortnumberforregion(string shortnumber, string regiondialingfrom) { phonemetadata phonemetadata = metadatamanager.getshortnumbermetadataforregion(regiondialingfrom); if (phonemetadata == null) { return false; } phonenumberdesc generaldesc = phonemetadata.getgeneraldesc(); if (!matchespossiblenumberandnationalnumber(shortnumber, generaldesc)) { return false; } phonenumberdesc shortnumberdesc = phonemetadata.getshortcode(); return matchespossiblenumberandnationalnumber(shortnumber, shortnumberdesc); }
nickbarban/libphonenumber
[ 0, 0, 0, 0 ]
33,777
private List<AnnotatedAttributeValuePair> getAttributeValuePairs(JsonOutcome outcome, JsonReference reference) { Optional<String> docNameTrue = getFirstDocname(reference); String docName = docNameTrue.orElse(outcome.getShortTitle()); // we use the highlighted text to put the table caption String highlightedText = outcome.getOutcomeDescription(); Arm arm1 = getAssignedArm(outcome.getItemArmIdGrp1(), outcome.getGrp1ArmName()); Arm arm2 = getAssignedArm(outcome.getItemArmIdGrp2(), outcome.getGrp2ArmName()); // outcome values Attribute ovAttribute = attributes.getFromName("Outcome value"); AnnotatedAttributeValuePair ov1 = new AnnotatedAttributeValuePair(ovAttribute, outcome.getData3(), docName, arm1, "", highlightedText, "", 0); AnnotatedAttributeValuePair ov2 = new AnnotatedAttributeValuePair(ovAttribute, outcome.getData4(), docName, arm2, "", highlightedText, "", 0); // timepoints Attribute timepointAttribute = attributes.getFromName("Longest follow up"); AnnotatedAttributeValuePair tp1 = new AnnotatedAttributeValuePair(timepointAttribute, outcome.getTimepointString(), docName, arm1, "", highlightedText, "", 0); AnnotatedAttributeValuePair tp2 = new AnnotatedAttributeValuePair(timepointAttribute, outcome.getTimepointString(), docName, arm2, "", highlightedText, "", 0); // timepoint units Attribute timepointUnitAttribute = attributes.getFromName("Longest follow up (metric)"); AnnotatedAttributeValuePair tpUnit1 = new AnnotatedAttributeValuePair(timepointUnitAttribute, outcome.getItemTimepointMetric(), docName, arm1, "", highlightedText, "", 0); AnnotatedAttributeValuePair tpUnit2 = new AnnotatedAttributeValuePair(timepointUnitAttribute, outcome.getItemTimepointMetric(), docName, arm2, "", highlightedText, "", 0); // sample size Attribute samplesizeAttribute = attributes.getFromName("Individual-level analysed"); AnnotatedAttributeValuePair ss1 = new AnnotatedAttributeValuePair(samplesizeAttribute, outcome.getData1(), docName, arm1, "", highlightedText, "", 0); AnnotatedAttributeValuePair ss2 = new AnnotatedAttributeValuePair(samplesizeAttribute, outcome.getData2(), docName, arm2, "", highlightedText, "", 0); // TODO: anything else? return Lists.newArrayList(ov1, ov2, tp1, tp2, tpUnit1, tpUnit2, ss1, ss2); }
private List<AnnotatedAttributeValuePair> getAttributeValuePairs(JsonOutcome outcome, JsonReference reference) { Optional<String> docNameTrue = getFirstDocname(reference); String docName = docNameTrue.orElse(outcome.getShortTitle()); String highlightedText = outcome.getOutcomeDescription(); Arm arm1 = getAssignedArm(outcome.getItemArmIdGrp1(), outcome.getGrp1ArmName()); Arm arm2 = getAssignedArm(outcome.getItemArmIdGrp2(), outcome.getGrp2ArmName()); Attribute ovAttribute = attributes.getFromName("Outcome value"); AnnotatedAttributeValuePair ov1 = new AnnotatedAttributeValuePair(ovAttribute, outcome.getData3(), docName, arm1, "", highlightedText, "", 0); AnnotatedAttributeValuePair ov2 = new AnnotatedAttributeValuePair(ovAttribute, outcome.getData4(), docName, arm2, "", highlightedText, "", 0); Attribute timepointAttribute = attributes.getFromName("Longest follow up"); AnnotatedAttributeValuePair tp1 = new AnnotatedAttributeValuePair(timepointAttribute, outcome.getTimepointString(), docName, arm1, "", highlightedText, "", 0); AnnotatedAttributeValuePair tp2 = new AnnotatedAttributeValuePair(timepointAttribute, outcome.getTimepointString(), docName, arm2, "", highlightedText, "", 0); Attribute timepointUnitAttribute = attributes.getFromName("Longest follow up (metric)"); AnnotatedAttributeValuePair tpUnit1 = new AnnotatedAttributeValuePair(timepointUnitAttribute, outcome.getItemTimepointMetric(), docName, arm1, "", highlightedText, "", 0); AnnotatedAttributeValuePair tpUnit2 = new AnnotatedAttributeValuePair(timepointUnitAttribute, outcome.getItemTimepointMetric(), docName, arm2, "", highlightedText, "", 0); Attribute samplesizeAttribute = attributes.getFromName("Individual-level analysed"); AnnotatedAttributeValuePair ss1 = new AnnotatedAttributeValuePair(samplesizeAttribute, outcome.getData1(), docName, arm1, "", highlightedText, "", 0); AnnotatedAttributeValuePair ss2 = new AnnotatedAttributeValuePair(samplesizeAttribute, outcome.getData2(), docName, arm2, "", highlightedText, "", 0); return Lists.newArrayList(ov1, ov2, tp1, tp2, tpUnit1, tpUnit2, ss1, ss2); }
private list<annotatedattributevaluepair> getattributevaluepairs(jsonoutcome outcome, jsonreference reference) { optional<string> docnametrue = getfirstdocname(reference); string docname = docnametrue.orelse(outcome.getshorttitle()); string highlightedtext = outcome.getoutcomedescription(); arm arm1 = getassignedarm(outcome.getitemarmidgrp1(), outcome.getgrp1armname()); arm arm2 = getassignedarm(outcome.getitemarmidgrp2(), outcome.getgrp2armname()); attribute ovattribute = attributes.getfromname("outcome value"); annotatedattributevaluepair ov1 = new annotatedattributevaluepair(ovattribute, outcome.getdata3(), docname, arm1, "", highlightedtext, "", 0); annotatedattributevaluepair ov2 = new annotatedattributevaluepair(ovattribute, outcome.getdata4(), docname, arm2, "", highlightedtext, "", 0); attribute timepointattribute = attributes.getfromname("longest follow up"); annotatedattributevaluepair tp1 = new annotatedattributevaluepair(timepointattribute, outcome.gettimepointstring(), docname, arm1, "", highlightedtext, "", 0); annotatedattributevaluepair tp2 = new annotatedattributevaluepair(timepointattribute, outcome.gettimepointstring(), docname, arm2, "", highlightedtext, "", 0); attribute timepointunitattribute = attributes.getfromname("longest follow up (metric)"); annotatedattributevaluepair tpunit1 = new annotatedattributevaluepair(timepointunitattribute, outcome.getitemtimepointmetric(), docname, arm1, "", highlightedtext, "", 0); annotatedattributevaluepair tpunit2 = new annotatedattributevaluepair(timepointunitattribute, outcome.getitemtimepointmetric(), docname, arm2, "", highlightedtext, "", 0); attribute samplesizeattribute = attributes.getfromname("individual-level analysed"); annotatedattributevaluepair ss1 = new annotatedattributevaluepair(samplesizeattribute, outcome.getdata1(), docname, arm1, "", highlightedtext, "", 0); annotatedattributevaluepair ss2 = new annotatedattributevaluepair(samplesizeattribute, outcome.getdata2(), docname, arm2, "", highlightedtext, "", 0); return lists.newarraylist(ov1, ov2, tp1, tp2, tpunit1, tpunit2, ss1, ss2); }
ouyangzhiping/Info-extract
[ 1, 0, 0, 0 ]
33,859
public void sortRows(AlignmentTrack.SortOption option, double location) { if (alignmentRows == null) { return; } for (AlignmentInterval.Row row : alignmentRows) { if (option == AlignmentTrack.SortOption.NUCELOTIDE) { // TODO -- why is this here? } row.updateScore(option, location, this); } Collections.sort(alignmentRows, new Comparator<Row>() { public int compare(AlignmentInterval.Row arg0, AlignmentInterval.Row arg1) { if (arg0.getScore() > arg1.getScore()) { return 1; } else if (arg0.getScore() > arg1.getScore()) { return -1; } return 0; } }); }
public void sortRows(AlignmentTrack.SortOption option, double location) { if (alignmentRows == null) { return; } for (AlignmentInterval.Row row : alignmentRows) { if (option == AlignmentTrack.SortOption.NUCELOTIDE) { } row.updateScore(option, location, this); } Collections.sort(alignmentRows, new Comparator<Row>() { public int compare(AlignmentInterval.Row arg0, AlignmentInterval.Row arg1) { if (arg0.getScore() > arg1.getScore()) { return 1; } else if (arg0.getScore() > arg1.getScore()) { return -1; } return 0; } }); }
public void sortrows(alignmenttrack.sortoption option, double location) { if (alignmentrows == null) { return; } for (alignmentinterval.row row : alignmentrows) { if (option == alignmenttrack.sortoption.nucelotide) { } row.updatescore(option, location, this); } collections.sort(alignmentrows, new comparator<row>() { public int compare(alignmentinterval.row arg0, alignmentinterval.row arg1) { if (arg0.getscore() > arg1.getscore()) { return 1; } else if (arg0.getscore() > arg1.getscore()) { return -1; } return 0; } }); }
nrgene/NRGene-IGV
[ 1, 0, 0, 0 ]
17,516
public native byte [] getClientIp();
public native byte [] getClientIp();
public native byte [] getclientip();
recolic/hbase-2.1.0
[ 0, 0, 1, 0 ]
25,782
public static List<JSONObject> constructRokuNativeElements(JSONObject elementObj) { List<JSONObject> elements = new ArrayList<>(); JSONArray valueArr = (JSONArray) elementObj.get("value"); if (valueArr == null) { return elements; } for (int i = 0; i < valueArr.size(); i++) { String[] boundsComponents = { "0", "0", "0", "0" }; String text = ""; JSONObject valueObj = (JSONObject) valueArr.get(i); JSONArray attrArr = (JSONArray) valueObj.get("Attrs"); for (int i2 = 0; i2 < attrArr.size(); i2++) { JSONObject attrObj = (JSONObject) attrArr.get(i2); JSONObject nameObj = (JSONObject) attrObj.get("Name"); if (nameObj.containsValue("bounds")) { String boundsStr = (String) attrObj.get("Value"); boundsStr = boundsStr.replace("{", "").replace("}", ""); boundsComponents = boundsStr.split(", "); } if (nameObj.containsValue("text")) { text = (String) attrObj.get("Value"); } } elements.add(constructRokuNativeElementJSON(elementObj, text, boundsComponents)); } return elements; }
public static List<JSONObject> constructRokuNativeElements(JSONObject elementObj) { List<JSONObject> elements = new ArrayList<>(); JSONArray valueArr = (JSONArray) elementObj.get("value"); if (valueArr == null) { return elements; } for (int i = 0; i < valueArr.size(); i++) { String[] boundsComponents = { "0", "0", "0", "0" }; String text = ""; JSONObject valueObj = (JSONObject) valueArr.get(i); JSONArray attrArr = (JSONArray) valueObj.get("Attrs"); for (int i2 = 0; i2 < attrArr.size(); i2++) { JSONObject attrObj = (JSONObject) attrArr.get(i2); JSONObject nameObj = (JSONObject) attrObj.get("Name"); if (nameObj.containsValue("bounds")) { String boundsStr = (String) attrObj.get("Value"); boundsStr = boundsStr.replace("{", "").replace("}", ""); boundsComponents = boundsStr.split(", "); } if (nameObj.containsValue("text")) { text = (String) attrObj.get("Value"); } } elements.add(constructRokuNativeElementJSON(elementObj, text, boundsComponents)); } return elements; }
public static list<jsonobject> constructrokunativeelements(jsonobject elementobj) { list<jsonobject> elements = new arraylist<>(); jsonarray valuearr = (jsonarray) elementobj.get("value"); if (valuearr == null) { return elements; } for (int i = 0; i < valuearr.size(); i++) { string[] boundscomponents = { "0", "0", "0", "0" }; string text = ""; jsonobject valueobj = (jsonobject) valuearr.get(i); jsonarray attrarr = (jsonarray) valueobj.get("attrs"); for (int i2 = 0; i2 < attrarr.size(); i2++) { jsonobject attrobj = (jsonobject) attrarr.get(i2); jsonobject nameobj = (jsonobject) attrobj.get("name"); if (nameobj.containsvalue("bounds")) { string boundsstr = (string) attrobj.get("value"); boundsstr = boundsstr.replace("{", "").replace("}", ""); boundscomponents = boundsstr.split(", "); } if (nameobj.containsvalue("text")) { text = (string) attrobj.get("value"); } } elements.add(constructrokunativeelementjson(elementobj, text, boundscomponents)); } return elements; }
mohanakrishna12/rokuality-server
[ 0, 1, 0, 0 ]
1,229
@Test public void testReadFailure() throws IOException { // TODO (lwhite): These tests don't fail. What was their intent? Table table1 = Table.read() .csv(CsvReadOptions.builder("../data/read_failure_test.csv").minimizeColumnSizes()); table1.structure(); // just make sure the import completed ShortColumn test = table1.shortColumn("Test"); // TODO(lwhite): Better tests assertNotNull(test.summary()); }
@Test public void testReadFailure() throws IOException { Table table1 = Table.read() .csv(CsvReadOptions.builder("../data/read_failure_test.csv").minimizeColumnSizes()); table1.structure(); ShortColumn test = table1.shortColumn("Test"); assertNotNull(test.summary()); }
@test public void testreadfailure() throws ioexception { table table1 = table.read() .csv(csvreadoptions.builder("../data/read_failure_test.csv").minimizecolumnsizes()); table1.structure(); shortcolumn test = table1.shortcolumn("test"); assertnotnull(test.summary()); }
rayeaster/tablesaw
[ 0, 0, 0, 1 ]
34,107
public void copyFrom(OutputProperties opsrc) throws TransformerException { // Bugzilla 6157: recover from xsl:output statements // checkDuplicates(opsrc); copyFrom(opsrc.getProperties()); }
public void copyFrom(OutputProperties opsrc) throws TransformerException { copyFrom(opsrc.getProperties()); }
public void copyfrom(outputproperties opsrc) throws transformerexception { copyfrom(opsrc.getproperties()); }
oradian/xalan-j
[ 0, 0, 1, 0 ]
25,919
private void buildDependencyTree( Queue<DependencyNode> nodeQueue, boolean full, boolean online, Session session, Map<String, Profile> profiles, PomFileLoader loader, Log log ) { int neededLevels = full ? -1 : 1; while( !nodeQueue.isEmpty() ) { DependencyNode node = nodeQueue.poll(); if( neededLevels >= 0 && node.getLevel() >= neededLevels ) continue; node.collectDependencyManagement( profiles, session.projects(), log ); Map<DependencyKey, RawDependency> localDependencies = getHierarchicalDependencies( session, node.getProject(), null, online, profiles, log ); if( localDependencies == null ) continue; for( Entry<DependencyKey, RawDependency> e : localDependencies.entrySet() ) { DependencyKey dependencyKey = e.getKey(); RawDependency dependency = e.getValue(); if( dependency.isOptional() && !node.isRoot() ) continue; GroupArtifact ga = new GroupArtifact( dependencyKey.getGroupId(), dependencyKey.getArtifactId() ); if( isGroupArtifactExcluded( node, ga ) ) continue; DependencyNode existingNode = node.searchNodeForGroupArtifact( ga ); if( existingNode != null ) { if( existingNode.getLevel() <= node.getLevel() + 1 ) continue; else existingNode.removeFromParent(); } final Optional<VersionScope> optionalVs = getVersionScopeFromDependencyManagement( node, dependencyKey, dependency ); final VersionScope vs; if(optionalVs.isPresent() ) { vs = optionalVs.get(); } else { vs = dependency.getVs(); if( node.isRoot() ) { if(vs.getScope() == null) { vs.setScope( Scope.COMPILE ); } } else { Scope scope = Scope.getScopeTransformation( node.getVs().getScope(), dependency.getVs().getScope() ); if(scope == null ) continue; vs.setScope( scope ); } } Scope scope = vs.getScope(); assert scope != null; assert vs.getVersion() != null : "null version of dependency " + dependencyKey + " -> " + dependency + " (for project " + project + ")"; if( scope == Scope.IMPORT || scope == Scope.SYSTEM ) continue; // get remote repositories List<Repository> additionalRepos = getProjectRepositories( session, node.getProject(), log ); Gav dependencyGav = new Gav( dependencyKey.getGroupId(), dependencyKey.getArtifactId(), vs.getVersion() ); Project childProject = null; if( neededLevels < 0 || node.getLevel() >= neededLevels ) { childProject = session.projects().forGav( dependencyGav ); if( childProject == null ) { File pomFile = loader.loadPomFileForGav( dependencyGav, additionalRepos, log ); if( pomFile == null ) { log.html( Tools.errorMessage( "cannot fetch project " + dependencyGav + " referenced in " + node.getProject() ) ); continue; } PomAnalysis analysis = new PomAnalysis( session, loader, null, false, log ); analysis.addFile( pomFile ); Set<Project> loadedProjects = analysis.loadProjects(); if( loadedProjects.size() != 1 ) { log.html( Tools.errorMessage( "cannot fetch project " + dependencyGav + " referenced in " + node.getProject() ) ); continue; } childProject = loadedProjects.iterator().next(); analysis.completeLoadedProjects(); analysis.addCompletedProjectsToSession(); Set<Project> addedToGraph = analysis.addCompletedProjectsToGraph(); if( !addedToGraph.contains( childProject ) ) { log.html( Tools.errorMessage( "cannot fetch project " + dependencyGav + " referenced in " + node.getProject() ) ); continue; } } if( childProject == null ) { // TODO : use specified repositories if needed ! log.html( Tools.warningMessage( "cannot fetch project " + dependencyGav + " referenced in " + node.getProject() + (dependency.isOptional() ? " (this is an optional dependency)" : "") ) ); continue; } } DependencyNode child = new DependencyNode( childProject, dependencyKey, vs ); child.addExclusions( dependency.getExclusions() ); node.addChild( child ); DependencyManagement dm = node.getLocalManagement( dependencyKey ); if( dm != null ) child.addExclusions( dm.getExclusions() ); //FIXME is always false if( scope == Scope.SYSTEM ) continue; // TODO it seems to me that transitive dependency policy only // applies to jar artifacts, is that true ?? // if( "jar".equals( dependencyKey.getType() ) ) nodeQueue.add( child ); } } }
private void buildDependencyTree( Queue<DependencyNode> nodeQueue, boolean full, boolean online, Session session, Map<String, Profile> profiles, PomFileLoader loader, Log log ) { int neededLevels = full ? -1 : 1; while( !nodeQueue.isEmpty() ) { DependencyNode node = nodeQueue.poll(); if( neededLevels >= 0 && node.getLevel() >= neededLevels ) continue; node.collectDependencyManagement( profiles, session.projects(), log ); Map<DependencyKey, RawDependency> localDependencies = getHierarchicalDependencies( session, node.getProject(), null, online, profiles, log ); if( localDependencies == null ) continue; for( Entry<DependencyKey, RawDependency> e : localDependencies.entrySet() ) { DependencyKey dependencyKey = e.getKey(); RawDependency dependency = e.getValue(); if( dependency.isOptional() && !node.isRoot() ) continue; GroupArtifact ga = new GroupArtifact( dependencyKey.getGroupId(), dependencyKey.getArtifactId() ); if( isGroupArtifactExcluded( node, ga ) ) continue; DependencyNode existingNode = node.searchNodeForGroupArtifact( ga ); if( existingNode != null ) { if( existingNode.getLevel() <= node.getLevel() + 1 ) continue; else existingNode.removeFromParent(); } final Optional<VersionScope> optionalVs = getVersionScopeFromDependencyManagement( node, dependencyKey, dependency ); final VersionScope vs; if(optionalVs.isPresent() ) { vs = optionalVs.get(); } else { vs = dependency.getVs(); if( node.isRoot() ) { if(vs.getScope() == null) { vs.setScope( Scope.COMPILE ); } } else { Scope scope = Scope.getScopeTransformation( node.getVs().getScope(), dependency.getVs().getScope() ); if(scope == null ) continue; vs.setScope( scope ); } } Scope scope = vs.getScope(); assert scope != null; assert vs.getVersion() != null : "null version of dependency " + dependencyKey + " -> " + dependency + " (for project " + project + ")"; if( scope == Scope.IMPORT || scope == Scope.SYSTEM ) continue; List<Repository> additionalRepos = getProjectRepositories( session, node.getProject(), log ); Gav dependencyGav = new Gav( dependencyKey.getGroupId(), dependencyKey.getArtifactId(), vs.getVersion() ); Project childProject = null; if( neededLevels < 0 || node.getLevel() >= neededLevels ) { childProject = session.projects().forGav( dependencyGav ); if( childProject == null ) { File pomFile = loader.loadPomFileForGav( dependencyGav, additionalRepos, log ); if( pomFile == null ) { log.html( Tools.errorMessage( "cannot fetch project " + dependencyGav + " referenced in " + node.getProject() ) ); continue; } PomAnalysis analysis = new PomAnalysis( session, loader, null, false, log ); analysis.addFile( pomFile ); Set<Project> loadedProjects = analysis.loadProjects(); if( loadedProjects.size() != 1 ) { log.html( Tools.errorMessage( "cannot fetch project " + dependencyGav + " referenced in " + node.getProject() ) ); continue; } childProject = loadedProjects.iterator().next(); analysis.completeLoadedProjects(); analysis.addCompletedProjectsToSession(); Set<Project> addedToGraph = analysis.addCompletedProjectsToGraph(); if( !addedToGraph.contains( childProject ) ) { log.html( Tools.errorMessage( "cannot fetch project " + dependencyGav + " referenced in " + node.getProject() ) ); continue; } } if( childProject == null ) { log.html( Tools.warningMessage( "cannot fetch project " + dependencyGav + " referenced in " + node.getProject() + (dependency.isOptional() ? " (this is an optional dependency)" : "") ) ); continue; } } DependencyNode child = new DependencyNode( childProject, dependencyKey, vs ); child.addExclusions( dependency.getExclusions() ); node.addChild( child ); DependencyManagement dm = node.getLocalManagement( dependencyKey ); if( dm != null ) child.addExclusions( dm.getExclusions() ); if( scope == Scope.SYSTEM ) continue; nodeQueue.add( child ); } } }
private void builddependencytree( queue<dependencynode> nodequeue, boolean full, boolean online, session session, map<string, profile> profiles, pomfileloader loader, log log ) { int neededlevels = full ? -1 : 1; while( !nodequeue.isempty() ) { dependencynode node = nodequeue.poll(); if( neededlevels >= 0 && node.getlevel() >= neededlevels ) continue; node.collectdependencymanagement( profiles, session.projects(), log ); map<dependencykey, rawdependency> localdependencies = gethierarchicaldependencies( session, node.getproject(), null, online, profiles, log ); if( localdependencies == null ) continue; for( entry<dependencykey, rawdependency> e : localdependencies.entryset() ) { dependencykey dependencykey = e.getkey(); rawdependency dependency = e.getvalue(); if( dependency.isoptional() && !node.isroot() ) continue; groupartifact ga = new groupartifact( dependencykey.getgroupid(), dependencykey.getartifactid() ); if( isgroupartifactexcluded( node, ga ) ) continue; dependencynode existingnode = node.searchnodeforgroupartifact( ga ); if( existingnode != null ) { if( existingnode.getlevel() <= node.getlevel() + 1 ) continue; else existingnode.removefromparent(); } final optional<versionscope> optionalvs = getversionscopefromdependencymanagement( node, dependencykey, dependency ); final versionscope vs; if(optionalvs.ispresent() ) { vs = optionalvs.get(); } else { vs = dependency.getvs(); if( node.isroot() ) { if(vs.getscope() == null) { vs.setscope( scope.compile ); } } else { scope scope = scope.getscopetransformation( node.getvs().getscope(), dependency.getvs().getscope() ); if(scope == null ) continue; vs.setscope( scope ); } } scope scope = vs.getscope(); assert scope != null; assert vs.getversion() != null : "null version of dependency " + dependencykey + " -> " + dependency + " (for project " + project + ")"; if( scope == scope.import || scope == scope.system ) continue; list<repository> additionalrepos = getprojectrepositories( session, node.getproject(), log ); gav dependencygav = new gav( dependencykey.getgroupid(), dependencykey.getartifactid(), vs.getversion() ); project childproject = null; if( neededlevels < 0 || node.getlevel() >= neededlevels ) { childproject = session.projects().forgav( dependencygav ); if( childproject == null ) { file pomfile = loader.loadpomfileforgav( dependencygav, additionalrepos, log ); if( pomfile == null ) { log.html( tools.errormessage( "cannot fetch project " + dependencygav + " referenced in " + node.getproject() ) ); continue; } pomanalysis analysis = new pomanalysis( session, loader, null, false, log ); analysis.addfile( pomfile ); set<project> loadedprojects = analysis.loadprojects(); if( loadedprojects.size() != 1 ) { log.html( tools.errormessage( "cannot fetch project " + dependencygav + " referenced in " + node.getproject() ) ); continue; } childproject = loadedprojects.iterator().next(); analysis.completeloadedprojects(); analysis.addcompletedprojectstosession(); set<project> addedtograph = analysis.addcompletedprojectstograph(); if( !addedtograph.contains( childproject ) ) { log.html( tools.errormessage( "cannot fetch project " + dependencygav + " referenced in " + node.getproject() ) ); continue; } } if( childproject == null ) { log.html( tools.warningmessage( "cannot fetch project " + dependencygav + " referenced in " + node.getproject() + (dependency.isoptional() ? " (this is an optional dependency)" : "") ) ); continue; } } dependencynode child = new dependencynode( childproject, dependencykey, vs ); child.addexclusions( dependency.getexclusions() ); node.addchild( child ); dependencymanagement dm = node.getlocalmanagement( dependencykey ); if( dm != null ) child.addexclusions( dm.getexclusions() ); if( scope == scope.system ) continue; nodequeue.add( child ); } } }
mpicque/pom-explorer
[ 1, 1, 1, 0 ]
34,120
private void setupViewPager(ViewPager viewPager) { // TODO: see if we can replace the words with icons in the future mSectionsPageAdapter.addFragment(new HomeFragment(), "Home"); mSectionsPageAdapter.addFragment(new SettingsFragment(), "Settings"); viewPager.setAdapter(mSectionsPageAdapter); }
private void setupViewPager(ViewPager viewPager) { mSectionsPageAdapter.addFragment(new HomeFragment(), "Home"); mSectionsPageAdapter.addFragment(new SettingsFragment(), "Settings"); viewPager.setAdapter(mSectionsPageAdapter); }
private void setupviewpager(viewpager viewpager) { msectionspageadapter.addfragment(new homefragment(), "home"); msectionspageadapter.addfragment(new settingsfragment(), "settings"); viewpager.setadapter(msectionspageadapter); }
mo-morgan/Food-Radar
[ 1, 0, 0, 0 ]
1,432
@Override public void onDestroy() { super.onDestroy(); // Always call the superclass // probably not needed, onStop closes the socket, which should make the thread stop (?) if (recvAsyncTask != null) recvAsyncTask.cancel(true); recvAsyncTask = null; }
@Override public void onDestroy() { super.onDestroy(); if (recvAsyncTask != null) recvAsyncTask.cancel(true); recvAsyncTask = null; }
@override public void ondestroy() { super.ondestroy(); if (recvasynctask != null) recvasynctask.cancel(true); recvasynctask = null; }
phques/androidpush
[ 1, 0, 0, 0 ]
1,435
public static CashierTransaction fromJson( final Cashier cashier, final JsonCommand command) { final Integer txnType = command.integerValueOfParameterNamed("txnType"); final BigDecimal txnAmount = command.bigDecimalValueOfParameterNamed("txnAmount"); final LocalDate txnDate = command.localDateValueOfParameterNamed("txnDate"); final String entityType = command.stringValueOfParameterNamed("entityType"); final String txnNote = command.stringValueOfParameterNamed("txnNote"); final Long entityId = command.longValueOfParameterNamed("entityId"); final String currencyCode = command.stringValueOfParameterNamed("currencyCode"); // TODO: get client/loan/savings details return new CashierTransaction (cashier, txnType, txnAmount, txnDate, entityType, entityId, txnNote, currencyCode); }
public static CashierTransaction fromJson( final Cashier cashier, final JsonCommand command) { final Integer txnType = command.integerValueOfParameterNamed("txnType"); final BigDecimal txnAmount = command.bigDecimalValueOfParameterNamed("txnAmount"); final LocalDate txnDate = command.localDateValueOfParameterNamed("txnDate"); final String entityType = command.stringValueOfParameterNamed("entityType"); final String txnNote = command.stringValueOfParameterNamed("txnNote"); final Long entityId = command.longValueOfParameterNamed("entityId"); final String currencyCode = command.stringValueOfParameterNamed("currencyCode"); return new CashierTransaction (cashier, txnType, txnAmount, txnDate, entityType, entityId, txnNote, currencyCode); }
public static cashiertransaction fromjson( final cashier cashier, final jsoncommand command) { final integer txntype = command.integervalueofparameternamed("txntype"); final bigdecimal txnamount = command.bigdecimalvalueofparameternamed("txnamount"); final localdate txndate = command.localdatevalueofparameternamed("txndate"); final string entitytype = command.stringvalueofparameternamed("entitytype"); final string txnnote = command.stringvalueofparameternamed("txnnote"); final long entityid = command.longvalueofparameternamed("entityid"); final string currencycode = command.stringvalueofparameternamed("currencycode"); return new cashiertransaction (cashier, txntype, txnamount, txndate, entitytype, entityid, txnnote, currencycode); }
raghuvissu/GST
[ 0, 1, 0, 0 ]
1,463
public void parse(InputStream file) throws IOException, TikaException { ByteArrayOutputStream xmpraw = new ByteArrayOutputStream(); if (!scanner.parse(file, xmpraw)) { return; } Reader decoded = new InputStreamReader( new ByteArrayInputStream(xmpraw.toByteArray()), DEFAULT_XMP_CHARSET); try { XMPMetadata xmp = XMPMetadata.load(new InputSource(decoded)); XMPSchemaDublinCore dc = xmp.getDublinCoreSchema(); if (dc != null) { if (dc.getTitle() != null) { metadata.set(DublinCore.TITLE, dc.getTitle()); } if (dc.getDescription() != null) { metadata.set(DublinCore.DESCRIPTION, dc.getDescription()); } if (dc.getCreators() != null && dc.getCreators().size() > 0) { metadata.set(DublinCore.CREATOR, joinCreators(dc.getCreators())); } if (dc.getSubjects() != null && dc.getSubjects().size() > 0) { Iterator<String> keywords = dc.getSubjects().iterator(); while (keywords.hasNext()) { metadata.add(DublinCore.SUBJECT, keywords.next()); } // TODO should we set KEYWORDS too? // All tested photo managers set the same in Iptc.Application2.Keywords and Xmp.dc.subject } } } catch (IOException e) { // Could not parse embedded XMP metadata. That's not a serious // problem, so we'll just ignore the issue for now. // TODO: Make error handling like this configurable. } }
public void parse(InputStream file) throws IOException, TikaException { ByteArrayOutputStream xmpraw = new ByteArrayOutputStream(); if (!scanner.parse(file, xmpraw)) { return; } Reader decoded = new InputStreamReader( new ByteArrayInputStream(xmpraw.toByteArray()), DEFAULT_XMP_CHARSET); try { XMPMetadata xmp = XMPMetadata.load(new InputSource(decoded)); XMPSchemaDublinCore dc = xmp.getDublinCoreSchema(); if (dc != null) { if (dc.getTitle() != null) { metadata.set(DublinCore.TITLE, dc.getTitle()); } if (dc.getDescription() != null) { metadata.set(DublinCore.DESCRIPTION, dc.getDescription()); } if (dc.getCreators() != null && dc.getCreators().size() > 0) { metadata.set(DublinCore.CREATOR, joinCreators(dc.getCreators())); } if (dc.getSubjects() != null && dc.getSubjects().size() > 0) { Iterator<String> keywords = dc.getSubjects().iterator(); while (keywords.hasNext()) { metadata.add(DublinCore.SUBJECT, keywords.next()); } } } } catch (IOException e) { } }
public void parse(inputstream file) throws ioexception, tikaexception { bytearrayoutputstream xmpraw = new bytearrayoutputstream(); if (!scanner.parse(file, xmpraw)) { return; } reader decoded = new inputstreamreader( new bytearrayinputstream(xmpraw.tobytearray()), default_xmp_charset); try { xmpmetadata xmp = xmpmetadata.load(new inputsource(decoded)); xmpschemadublincore dc = xmp.getdublincoreschema(); if (dc != null) { if (dc.gettitle() != null) { metadata.set(dublincore.title, dc.gettitle()); } if (dc.getdescription() != null) { metadata.set(dublincore.description, dc.getdescription()); } if (dc.getcreators() != null && dc.getcreators().size() > 0) { metadata.set(dublincore.creator, joincreators(dc.getcreators())); } if (dc.getsubjects() != null && dc.getsubjects().size() > 0) { iterator<string> keywords = dc.getsubjects().iterator(); while (keywords.hasnext()) { metadata.add(dublincore.subject, keywords.next()); } } } } catch (ioexception e) { } }
ontometrics/tika
[ 1, 1, 0, 0 ]
9,676
@Override public List<Movie> getMoviesRatedByUser(int userId) { // TODO: write query to retrieve all movies rated by user with id userId List<Movie> movies = new LinkedList<Movie>(); Genre genre0 = new Genre(0, "genre0"); Genre genre1 = new Genre(1, "genre1"); Genre genre2 = new Genre(2, "genre2"); movies.add(new Movie(0, "Titre 0", Arrays.asList(new Genre[]{genre0, genre1}))); movies.add(new Movie(3, "Titre 3", Arrays.asList(new Genre[]{genre0, genre1, genre2}))); return movies; }
@Override public List<Movie> getMoviesRatedByUser(int userId) { List<Movie> movies = new LinkedList<Movie>(); Genre genre0 = new Genre(0, "genre0"); Genre genre1 = new Genre(1, "genre1"); Genre genre2 = new Genre(2, "genre2"); movies.add(new Movie(0, "Titre 0", Arrays.asList(new Genre[]{genre0, genre1}))); movies.add(new Movie(3, "Titre 3", Arrays.asList(new Genre[]{genre0, genre1, genre2}))); return movies; }
@override public list<movie> getmoviesratedbyuser(int userid) { list<movie> movies = new linkedlist<movie>(); genre genre0 = new genre(0, "genre0"); genre genre1 = new genre(1, "genre1"); genre genre2 = new genre(2, "genre2"); movies.add(new movie(0, "titre 0", arrays.aslist(new genre[]{genre0, genre1}))); movies.add(new movie(3, "titre 3", arrays.aslist(new genre[]{genre0, genre1, genre2}))); return movies; }
quentinceschin123456/MovieRecommender
[ 0, 1, 0, 0 ]
1,545
public void execute(List<String> statements) throws MetaStoreException { for (String statement : statements) { execute(statement); } }
public void execute(List<String> statements) throws MetaStoreException { for (String statement : statements) { execute(statement); } }
public void execute(list<string> statements) throws metastoreexception { for (string statement : statements) { execute(statement); } }
plusplusjiajia/SSM
[ 1, 0, 0, 0 ]
9,749
@Test public void testGetFormatted () { IMutableCurrencyValue aCV = new CurrencyValue (ECurrency.EUR, MathHelper.toBigDecimal (5)); if (EJavaVersion.JDK_9.isSupportedVersion ()) assertEquals ("5,00" + CURRENCY_SPACE + "€", aCV.getCurrencyFormatted ()); else assertEquals ("€" + CURRENCY_SPACE + "5,00", aCV.getCurrencyFormatted ()); aCV = new CurrencyValue (ECurrency.EUR, new BigDecimal ("5.12")); if (EJavaVersion.JDK_9.isSupportedVersion ()) assertEquals ("5,12" + CURRENCY_SPACE + "€", aCV.getCurrencyFormatted ()); else assertEquals ("€" + CURRENCY_SPACE + "5,12", aCV.getCurrencyFormatted ()); aCV = new CurrencyValue (ECurrency.USD, new BigDecimal ("5.12")); assertEquals ("$5.12", aCV.getCurrencyFormatted ()); for (final ECurrency eCurrency : ECurrency.values ()) { aCV = new CurrencyValue (eCurrency, new BigDecimal ("5.12")); final String sCurrencyFormatted = aCV.getCurrencyFormatted (); assertNotNull (sCurrencyFormatted); final String sValueFormatted = aCV.getValueFormatted (); assertNotNull (sValueFormatted); assertTrue (sValueFormatted, sValueFormatted.indexOf (CurrencyHelper.getCurrencySymbol (eCurrency)) < 0); CommonsTestHelper.testGetClone (aCV); // There seems to be a bug in the optimizer of 1.6.0_45 so that the output // values are sometimes reordered - dunno why :( LOGGER.info ("[" + sCurrencyFormatted + "][" + sValueFormatted + "]"); } }
@Test public void testGetFormatted () { IMutableCurrencyValue aCV = new CurrencyValue (ECurrency.EUR, MathHelper.toBigDecimal (5)); if (EJavaVersion.JDK_9.isSupportedVersion ()) assertEquals ("5,00" + CURRENCY_SPACE + "€", aCV.getCurrencyFormatted ()); else assertEquals ("€" + CURRENCY_SPACE + "5,00", aCV.getCurrencyFormatted ()); aCV = new CurrencyValue (ECurrency.EUR, new BigDecimal ("5.12")); if (EJavaVersion.JDK_9.isSupportedVersion ()) assertEquals ("5,12" + CURRENCY_SPACE + "€", aCV.getCurrencyFormatted ()); else assertEquals ("€" + CURRENCY_SPACE + "5,12", aCV.getCurrencyFormatted ()); aCV = new CurrencyValue (ECurrency.USD, new BigDecimal ("5.12")); assertEquals ("$5.12", aCV.getCurrencyFormatted ()); for (final ECurrency eCurrency : ECurrency.values ()) { aCV = new CurrencyValue (eCurrency, new BigDecimal ("5.12")); final String sCurrencyFormatted = aCV.getCurrencyFormatted (); assertNotNull (sCurrencyFormatted); final String sValueFormatted = aCV.getValueFormatted (); assertNotNull (sValueFormatted); assertTrue (sValueFormatted, sValueFormatted.indexOf (CurrencyHelper.getCurrencySymbol (eCurrency)) < 0); CommonsTestHelper.testGetClone (aCV); LOGGER.info ("[" + sCurrencyFormatted + "][" + sValueFormatted + "]"); } }
@test public void testgetformatted () { imutablecurrencyvalue acv = new currencyvalue (ecurrency.eur, mathhelper.tobigdecimal (5)); if (ejavaversion.jdk_9.issupportedversion ()) assertequals ("5,00" + currency_space + "€", acv.getcurrencyformatted ()); else assertequals ("€" + currency_space + "5,00", acv.getcurrencyformatted ()); acv = new currencyvalue (ecurrency.eur, new bigdecimal ("5.12")); if (ejavaversion.jdk_9.issupportedversion ()) assertequals ("5,12" + currency_space + "€", acv.getcurrencyformatted ()); else assertequals ("€" + currency_space + "5,12", acv.getcurrencyformatted ()); acv = new currencyvalue (ecurrency.usd, new bigdecimal ("5.12")); assertequals ("$5.12", acv.getcurrencyformatted ()); for (final ecurrency ecurrency : ecurrency.values ()) { acv = new currencyvalue (ecurrency, new bigdecimal ("5.12")); final string scurrencyformatted = acv.getcurrencyformatted (); assertnotnull (scurrencyformatted); final string svalueformatted = acv.getvalueformatted (); assertnotnull (svalueformatted); asserttrue (svalueformatted, svalueformatted.indexof (currencyhelper.getcurrencysymbol (ecurrency)) < 0); commonstesthelper.testgetclone (acv); logger.info ("[" + scurrencyformatted + "][" + svalueformatted + "]"); } }
phax/ph-masterdata
[ 0, 0, 1, 0 ]
34,357
List<CandidateField> findCandidateFieldsForType(@NonNull Object source) { // At this point source class represents the true polymorphic type of the document Class<?> sourceClass = source.getClass(); // Lock a thread wanting to find information about the same type // So that this information retrieval is only done once // Ignore this warning, this class reference will be on the heap List<CandidateField> candidateFields = this.encryptedFieldsMap.get(sourceClass); if (candidateFields != null) { // The cache is already aware of this type, return candidate fields for it return candidateFields; } // Don't bother with primitives if (ClassUtils.isPrimitiveOrWrapper(sourceClass)) return Collections.emptyList(); // If it is not known, scan each field for annotation or Appsmith type List<CandidateField> finalCandidateFields = new ArrayList<>(); synchronized (sourceClass) { ReflectionUtils.doWithFields(sourceClass, field -> { if (field.getAnnotation(Encrypted.class) != null) { CandidateField candidateField = new CandidateField(field, CandidateField.Type.ANNOTATED_FIELD); finalCandidateFields.add(candidateField); } else if (AppsmithDomain.class.isAssignableFrom(field.getType())) { CandidateField candidateField = null; field.setAccessible(true); Object fieldValue = ReflectionUtils.getField(field, source); if (fieldValue == null) { if (this.encryptedFieldsMap.containsKey(field.getType())) { // If this field is null, but the cache has a non-empty list of candidates already, // then this is an appsmith field with known annotations candidateField = new CandidateField(field, CandidateField.Type.APPSMITH_FIELD_KNOWN); } else { // If it is null and the cache is not aware of the field, this is still a prospect, // but with an unknown type (could also be polymorphic) candidateField = new CandidateField(field, CandidateField.Type.APPSMITH_FIELD_UNKNOWN); } } else { // If an object exists, check if the object type is the same as the field type CandidateField.Type appsmithFieldType; if (field.getType().getCanonicalName().equals(fieldValue.getClass().getCanonicalName())) { // If they match, then this is going to be an appsmith known field appsmithFieldType = CandidateField.Type.APPSMITH_FIELD_KNOWN; } else { // If not, then this field is polymorphic, // it will need to be checked for type every time appsmithFieldType = CandidateField.Type.APPSMITH_FIELD_POLYMORPHIC; } // Now, go into field type and repeat List<CandidateField> candidateFieldsForType = findCandidateFieldsForType(fieldValue); if (appsmithFieldType.equals(CandidateField.Type.APPSMITH_FIELD_POLYMORPHIC) || !candidateFieldsForType.isEmpty()) { // This type only qualifies as a candidate if it is polymorphic, // or has a list of candidates candidateField = new CandidateField(field, appsmithFieldType); } } field.setAccessible(false); if (candidateField != null) { // This will only ever be null if the field value is populated, // and is known to be a non-encryption related field finalCandidateFields.add(candidateField); } } else if (Collection.class.isAssignableFrom(field.getType()) && field.getGenericType() instanceof ParameterizedType) { // If this is a collection, check if the Type parameter is an AppsmithDomain Type[] typeArguments; ParameterizedType parameterizedType = (ParameterizedType) field.getGenericType(); typeArguments = parameterizedType.getActualTypeArguments(); Class<?> subFieldType; try { subFieldType = (Class<?>) typeArguments[0]; } catch (ClassCastException|ArrayIndexOutOfBoundsException e) { subFieldType = null; } if(subFieldType != null) { if (this.encryptedFieldsMap.containsKey(subFieldType)) { // This is a known type, it should necessarily be of AppsmithDomain type assert AppsmithDomain.class.isAssignableFrom(subFieldType); final List<CandidateField> existingSubTypeCandidates = this.encryptedFieldsMap.get(subFieldType); if (!existingSubTypeCandidates.isEmpty()) { finalCandidateFields.add(new CandidateField(field, CandidateField.Type.APPSMITH_COLLECTION_KNOWN)); } } else if (AppsmithDomain.class.isAssignableFrom(subFieldType)) { // If the type is not known, then this is either not parsed yet, or has polymorphic implementations field.setAccessible(true); Object fieldValue = ReflectionUtils.getField(field, source); Collection<?> collection = (Collection<?>) fieldValue; if (collection == null || collection.isEmpty()) { finalCandidateFields.add(new CandidateField(field, CandidateField.Type.APPSMITH_COLLECTION_UNKNOWN)); } else { for (final Object o : collection) { if (o == null) { continue; } if (o.getClass().getCanonicalName().equals(subFieldType.getTypeName())) { final List<CandidateField> candidateFieldsForListMember = findCandidateFieldsForType(o); if (candidateFieldsForListMember != null && !candidateFieldsForListMember.isEmpty()) { finalCandidateFields.add(new CandidateField(field, CandidateField.Type.APPSMITH_COLLECTION_KNOWN)); } } else { finalCandidateFields.add(new CandidateField(field, CandidateField.Type.APPSMITH_COLLECTION_POLYMORPHIC)); } break; } } field.setAccessible(false); } } // TODO Add support for nested collections } else if (Map.class.isAssignableFrom(field.getType()) && field.getGenericType() instanceof ParameterizedType) { Type[] typeArguments; ParameterizedType parameterizedType = (ParameterizedType) field.getGenericType(); typeArguments = parameterizedType.getActualTypeArguments(); Class<?> subFieldType = (Class<?>) typeArguments[1]; if (this.encryptedFieldsMap.containsKey(subFieldType)) { // This is a known type, it should necessarily be of AppsmithDomain type assert AppsmithDomain.class.isAssignableFrom(subFieldType); final List<CandidateField> existingSubTypeCandidates = this.encryptedFieldsMap.get(subFieldType); if (!existingSubTypeCandidates.isEmpty()) { finalCandidateFields.add(new CandidateField(field, CandidateField.Type.APPSMITH_MAP_KNOWN)); } } else if (AppsmithDomain.class.isAssignableFrom(subFieldType)) { // If the type is not known, then this is either not parsed yet, or has polymorphic implementations field.setAccessible(true); Object fieldValue = ReflectionUtils.getField(field, source); Map<?, ?> map = (Map<?, ?>) fieldValue; if (map == null || map.isEmpty()) { finalCandidateFields.add(new CandidateField(field, CandidateField.Type.APPSMITH_MAP_UNKNOWN)); } else { for (Map.Entry<?, ?> entry : map.entrySet()) { final Object value = entry.getValue(); if (value == null) { continue; } if (value.getClass().getCanonicalName().equals(subFieldType.getTypeName())) { final List<CandidateField> candidateFieldsForListMember = findCandidateFieldsForType(value); if (candidateFieldsForListMember != null && !candidateFieldsForListMember.isEmpty()) { finalCandidateFields.add(new CandidateField(field, CandidateField.Type.APPSMITH_MAP_KNOWN)); } } else { finalCandidateFields.add(new CandidateField(field, CandidateField.Type.APPSMITH_MAP_POLYMORPHIC)); } break; } } field.setAccessible(false); } } }, field -> field.getAnnotation(Encrypted.class) != null || AppsmithDomain.class.isAssignableFrom(field.getType()) || Collection.class.isAssignableFrom(field.getType()) || Map.class.isAssignableFrom(field.getType())); } // Update cache for next use encryptedFieldsMap.put(sourceClass, finalCandidateFields); return finalCandidateFields; }
List<CandidateField> findCandidateFieldsForType(@NonNull Object source) { Class<?> sourceClass = source.getClass(); List<CandidateField> candidateFields = this.encryptedFieldsMap.get(sourceClass); if (candidateFields != null) { return candidateFields; } if (ClassUtils.isPrimitiveOrWrapper(sourceClass)) return Collections.emptyList(); List<CandidateField> finalCandidateFields = new ArrayList<>(); synchronized (sourceClass) { ReflectionUtils.doWithFields(sourceClass, field -> { if (field.getAnnotation(Encrypted.class) != null) { CandidateField candidateField = new CandidateField(field, CandidateField.Type.ANNOTATED_FIELD); finalCandidateFields.add(candidateField); } else if (AppsmithDomain.class.isAssignableFrom(field.getType())) { CandidateField candidateField = null; field.setAccessible(true); Object fieldValue = ReflectionUtils.getField(field, source); if (fieldValue == null) { if (this.encryptedFieldsMap.containsKey(field.getType())) { candidateField = new CandidateField(field, CandidateField.Type.APPSMITH_FIELD_KNOWN); } else { candidateField = new CandidateField(field, CandidateField.Type.APPSMITH_FIELD_UNKNOWN); } } else { CandidateField.Type appsmithFieldType; if (field.getType().getCanonicalName().equals(fieldValue.getClass().getCanonicalName())) { appsmithFieldType = CandidateField.Type.APPSMITH_FIELD_KNOWN; } else { appsmithFieldType = CandidateField.Type.APPSMITH_FIELD_POLYMORPHIC; } List<CandidateField> candidateFieldsForType = findCandidateFieldsForType(fieldValue); if (appsmithFieldType.equals(CandidateField.Type.APPSMITH_FIELD_POLYMORPHIC) || !candidateFieldsForType.isEmpty()) { candidateField = new CandidateField(field, appsmithFieldType); } } field.setAccessible(false); if (candidateField != null) { finalCandidateFields.add(candidateField); } } else if (Collection.class.isAssignableFrom(field.getType()) && field.getGenericType() instanceof ParameterizedType) { Type[] typeArguments; ParameterizedType parameterizedType = (ParameterizedType) field.getGenericType(); typeArguments = parameterizedType.getActualTypeArguments(); Class<?> subFieldType; try { subFieldType = (Class<?>) typeArguments[0]; } catch (ClassCastException|ArrayIndexOutOfBoundsException e) { subFieldType = null; } if(subFieldType != null) { if (this.encryptedFieldsMap.containsKey(subFieldType)) { assert AppsmithDomain.class.isAssignableFrom(subFieldType); final List<CandidateField> existingSubTypeCandidates = this.encryptedFieldsMap.get(subFieldType); if (!existingSubTypeCandidates.isEmpty()) { finalCandidateFields.add(new CandidateField(field, CandidateField.Type.APPSMITH_COLLECTION_KNOWN)); } } else if (AppsmithDomain.class.isAssignableFrom(subFieldType)) { field.setAccessible(true); Object fieldValue = ReflectionUtils.getField(field, source); Collection<?> collection = (Collection<?>) fieldValue; if (collection == null || collection.isEmpty()) { finalCandidateFields.add(new CandidateField(field, CandidateField.Type.APPSMITH_COLLECTION_UNKNOWN)); } else { for (final Object o : collection) { if (o == null) { continue; } if (o.getClass().getCanonicalName().equals(subFieldType.getTypeName())) { final List<CandidateField> candidateFieldsForListMember = findCandidateFieldsForType(o); if (candidateFieldsForListMember != null && !candidateFieldsForListMember.isEmpty()) { finalCandidateFields.add(new CandidateField(field, CandidateField.Type.APPSMITH_COLLECTION_KNOWN)); } } else { finalCandidateFields.add(new CandidateField(field, CandidateField.Type.APPSMITH_COLLECTION_POLYMORPHIC)); } break; } } field.setAccessible(false); } } } else if (Map.class.isAssignableFrom(field.getType()) && field.getGenericType() instanceof ParameterizedType) { Type[] typeArguments; ParameterizedType parameterizedType = (ParameterizedType) field.getGenericType(); typeArguments = parameterizedType.getActualTypeArguments(); Class<?> subFieldType = (Class<?>) typeArguments[1]; if (this.encryptedFieldsMap.containsKey(subFieldType)) { assert AppsmithDomain.class.isAssignableFrom(subFieldType); final List<CandidateField> existingSubTypeCandidates = this.encryptedFieldsMap.get(subFieldType); if (!existingSubTypeCandidates.isEmpty()) { finalCandidateFields.add(new CandidateField(field, CandidateField.Type.APPSMITH_MAP_KNOWN)); } } else if (AppsmithDomain.class.isAssignableFrom(subFieldType)) { field.setAccessible(true); Object fieldValue = ReflectionUtils.getField(field, source); Map<?, ?> map = (Map<?, ?>) fieldValue; if (map == null || map.isEmpty()) { finalCandidateFields.add(new CandidateField(field, CandidateField.Type.APPSMITH_MAP_UNKNOWN)); } else { for (Map.Entry<?, ?> entry : map.entrySet()) { final Object value = entry.getValue(); if (value == null) { continue; } if (value.getClass().getCanonicalName().equals(subFieldType.getTypeName())) { final List<CandidateField> candidateFieldsForListMember = findCandidateFieldsForType(value); if (candidateFieldsForListMember != null && !candidateFieldsForListMember.isEmpty()) { finalCandidateFields.add(new CandidateField(field, CandidateField.Type.APPSMITH_MAP_KNOWN)); } } else { finalCandidateFields.add(new CandidateField(field, CandidateField.Type.APPSMITH_MAP_POLYMORPHIC)); } break; } } field.setAccessible(false); } } }, field -> field.getAnnotation(Encrypted.class) != null || AppsmithDomain.class.isAssignableFrom(field.getType()) || Collection.class.isAssignableFrom(field.getType()) || Map.class.isAssignableFrom(field.getType())); } encryptedFieldsMap.put(sourceClass, finalCandidateFields); return finalCandidateFields; }
list<candidatefield> findcandidatefieldsfortype(@nonnull object source) { class<?> sourceclass = source.getclass(); list<candidatefield> candidatefields = this.encryptedfieldsmap.get(sourceclass); if (candidatefields != null) { return candidatefields; } if (classutils.isprimitiveorwrapper(sourceclass)) return collections.emptylist(); list<candidatefield> finalcandidatefields = new arraylist<>(); synchronized (sourceclass) { reflectionutils.dowithfields(sourceclass, field -> { if (field.getannotation(encrypted.class) != null) { candidatefield candidatefield = new candidatefield(field, candidatefield.type.annotated_field); finalcandidatefields.add(candidatefield); } else if (appsmithdomain.class.isassignablefrom(field.gettype())) { candidatefield candidatefield = null; field.setaccessible(true); object fieldvalue = reflectionutils.getfield(field, source); if (fieldvalue == null) { if (this.encryptedfieldsmap.containskey(field.gettype())) { candidatefield = new candidatefield(field, candidatefield.type.appsmith_field_known); } else { candidatefield = new candidatefield(field, candidatefield.type.appsmith_field_unknown); } } else { candidatefield.type appsmithfieldtype; if (field.gettype().getcanonicalname().equals(fieldvalue.getclass().getcanonicalname())) { appsmithfieldtype = candidatefield.type.appsmith_field_known; } else { appsmithfieldtype = candidatefield.type.appsmith_field_polymorphic; } list<candidatefield> candidatefieldsfortype = findcandidatefieldsfortype(fieldvalue); if (appsmithfieldtype.equals(candidatefield.type.appsmith_field_polymorphic) || !candidatefieldsfortype.isempty()) { candidatefield = new candidatefield(field, appsmithfieldtype); } } field.setaccessible(false); if (candidatefield != null) { finalcandidatefields.add(candidatefield); } } else if (collection.class.isassignablefrom(field.gettype()) && field.getgenerictype() instanceof parameterizedtype) { type[] typearguments; parameterizedtype parameterizedtype = (parameterizedtype) field.getgenerictype(); typearguments = parameterizedtype.getactualtypearguments(); class<?> subfieldtype; try { subfieldtype = (class<?>) typearguments[0]; } catch (classcastexception|arrayindexoutofboundsexception e) { subfieldtype = null; } if(subfieldtype != null) { if (this.encryptedfieldsmap.containskey(subfieldtype)) { assert appsmithdomain.class.isassignablefrom(subfieldtype); final list<candidatefield> existingsubtypecandidates = this.encryptedfieldsmap.get(subfieldtype); if (!existingsubtypecandidates.isempty()) { finalcandidatefields.add(new candidatefield(field, candidatefield.type.appsmith_collection_known)); } } else if (appsmithdomain.class.isassignablefrom(subfieldtype)) { field.setaccessible(true); object fieldvalue = reflectionutils.getfield(field, source); collection<?> collection = (collection<?>) fieldvalue; if (collection == null || collection.isempty()) { finalcandidatefields.add(new candidatefield(field, candidatefield.type.appsmith_collection_unknown)); } else { for (final object o : collection) { if (o == null) { continue; } if (o.getclass().getcanonicalname().equals(subfieldtype.gettypename())) { final list<candidatefield> candidatefieldsforlistmember = findcandidatefieldsfortype(o); if (candidatefieldsforlistmember != null && !candidatefieldsforlistmember.isempty()) { finalcandidatefields.add(new candidatefield(field, candidatefield.type.appsmith_collection_known)); } } else { finalcandidatefields.add(new candidatefield(field, candidatefield.type.appsmith_collection_polymorphic)); } break; } } field.setaccessible(false); } } } else if (map.class.isassignablefrom(field.gettype()) && field.getgenerictype() instanceof parameterizedtype) { type[] typearguments; parameterizedtype parameterizedtype = (parameterizedtype) field.getgenerictype(); typearguments = parameterizedtype.getactualtypearguments(); class<?> subfieldtype = (class<?>) typearguments[1]; if (this.encryptedfieldsmap.containskey(subfieldtype)) { assert appsmithdomain.class.isassignablefrom(subfieldtype); final list<candidatefield> existingsubtypecandidates = this.encryptedfieldsmap.get(subfieldtype); if (!existingsubtypecandidates.isempty()) { finalcandidatefields.add(new candidatefield(field, candidatefield.type.appsmith_map_known)); } } else if (appsmithdomain.class.isassignablefrom(subfieldtype)) { field.setaccessible(true); object fieldvalue = reflectionutils.getfield(field, source); map<?, ?> map = (map<?, ?>) fieldvalue; if (map == null || map.isempty()) { finalcandidatefields.add(new candidatefield(field, candidatefield.type.appsmith_map_unknown)); } else { for (map.entry<?, ?> entry : map.entryset()) { final object value = entry.getvalue(); if (value == null) { continue; } if (value.getclass().getcanonicalname().equals(subfieldtype.gettypename())) { final list<candidatefield> candidatefieldsforlistmember = findcandidatefieldsfortype(value); if (candidatefieldsforlistmember != null && !candidatefieldsforlistmember.isempty()) { finalcandidatefields.add(new candidatefield(field, candidatefield.type.appsmith_map_known)); } } else { finalcandidatefields.add(new candidatefield(field, candidatefield.type.appsmith_map_polymorphic)); } break; } } field.setaccessible(false); } } }, field -> field.getannotation(encrypted.class) != null || appsmithdomain.class.isassignablefrom(field.gettype()) || collection.class.isassignablefrom(field.gettype()) || map.class.isassignablefrom(field.gettype())); } encryptedfieldsmap.put(sourceclass, finalcandidatefields); return finalcandidatefields; }
profencer/appsmith
[ 0, 1, 0, 0 ]
1,644
public static void setFirstDateAsDCT(SieveDocument doc) { if (doc.getDocstamp() == null) { for (Timex nextTimex : doc.getTimexes()) { if (nextTimex.getType().equals(Timex.Type.DATE)) { nextTimex.setDocumentFunction(DocumentFunction.CREATION_TIME); doc.addCreationTime(nextTimex); break; } } } }
public static void setFirstDateAsDCT(SieveDocument doc) { if (doc.getDocstamp() == null) { for (Timex nextTimex : doc.getTimexes()) { if (nextTimex.getType().equals(Timex.Type.DATE)) { nextTimex.setDocumentFunction(DocumentFunction.CREATION_TIME); doc.addCreationTime(nextTimex); break; } } } }
public static void setfirstdateasdct(sievedocument doc) { if (doc.getdocstamp() == null) { for (timex nexttimex : doc.gettimexes()) { if (nexttimex.gettype().equals(timex.type.date)) { nexttimex.setdocumentfunction(documentfunction.creation_time); doc.addcreationtime(nexttimex); break; } } } }
nchambers/caevo
[ 1, 0, 0, 0 ]
26,251
public SetterType determineSetterType(String expression) { // TODO: if (expression.contains("setb")) return SetterType.BUILDER; if(expression.contains("setf")) return SetterType.FIELD; return SetterType.METHOD; }
public SetterType determineSetterType(String expression) { if(expression.contains("setf")) return SetterType.FIELD; return SetterType.METHOD; }
public settertype determinesettertype(string expression) { if(expression.contains("setf")) return settertype.field; return settertype.method; }
nndi-oss/intellij-just-sett
[ 0, 1, 0, 0 ]
1,701
public static boolean isPasswordValid(String password) { //TODO: Replace this with your own logic return password.length() > 4; }
public static boolean isPasswordValid(String password) { return password.length() > 4; }
public static boolean ispasswordvalid(string password) { return password.length() > 4; }
neiplz/Pedometer
[ 1, 0, 0, 0 ]
26,305
private void updateRule() { Recur.Builder<LocalDate> rBuilder = new Recur.Builder<>(); switch (frequencyBox.getValue()) { case DAILY: rBuilder.frequency(net.fortuna.ical4j.model.Recur.Frequency.DAILY); break; case MONTHLY: rBuilder.frequency(net.fortuna.ical4j.model.Recur.Frequency.MONTHLY); break; case WEEKLY: rBuilder.frequency(net.fortuna.ical4j.model.Recur.Frequency.WEEKLY); break; case YEARLY: rBuilder.frequency(net.fortuna.ical4j.model.Recur.Frequency.YEARLY); break; default: break; } int interval = repeatCountSpinner.getValue(); if (interval > 1) { rBuilder.interval(interval); } else { rBuilder.interval(0); } if (endsOnButton.isSelected()) { LocalDate date = endsOnDatePicker.getValue(); rBuilder.until(date); } if (endsAfterButton.isSelected()) { rBuilder.count(endsAfterCounterSpinner.getValue()); } if (frequencyBox.getValue() == Frequency.MONTHLY) { if (repeatByDayOfTheMonth.isSelected()) { int value = getSkinnable().getStartDate().getDayOfMonth(); rBuilder.monthList(new NumberList(value, value, false)); } else { LocalDate localDate = getSkinnable().getStartDate(); // TODO: use zone id of context (entry, calendar) ZonedDateTime zonedDateTime = ZonedDateTime.of(localDate, LocalTime.now(), ZoneId.systemDefault()); int hits = 1; ZonedDateTime current = zonedDateTime.withDayOfMonth(1); do { if (current.getDayOfWeek() .equals(zonedDateTime.getDayOfWeek())) { hits++; } current = current.plusDays(1); } while (current.toLocalDate().isBefore(localDate)); WeekDayList weekdays = new WeekDayList(); switch (zonedDateTime.getDayOfWeek()) { case FRIDAY: weekdays.add(new WeekDay(WeekDay.FR, hits)); break; case MONDAY: weekdays.add(new WeekDay(WeekDay.MO, hits)); break; case SATURDAY: weekdays.add(new WeekDay(WeekDay.SA, hits)); break; case SUNDAY: weekdays.add(new WeekDay(WeekDay.SU, hits)); break; case THURSDAY: weekdays.add(new WeekDay(WeekDay.TH, hits)); break; case TUESDAY: weekdays.add(new WeekDay(WeekDay.TU, hits)); break; case WEDNESDAY: weekdays.add(new WeekDay(WeekDay.WE, hits)); break; default: break; } rBuilder.dayList(weekdays); } } if (frequencyBox.getValue() == Frequency.WEEKLY) { /* * Weekdays MO, TU, .... SU */ WeekDayList weekdays = new WeekDayList(); maybeAddWeekday(weekdays, WeekDay.MO, weekDayMondayButton); maybeAddWeekday(weekdays, WeekDay.TU, weekDayTuesdayButton); maybeAddWeekday(weekdays, WeekDay.WE, weekDayWednesdayButton); maybeAddWeekday(weekdays, WeekDay.TH, weekDayThursdayButton); maybeAddWeekday(weekdays, WeekDay.FR, weekDayFridayButton); maybeAddWeekday(weekdays, WeekDay.SA, weekDaySaturdayButton); maybeAddWeekday(weekdays, WeekDay.SU, weekDaySundayButton); rBuilder.dayList(weekdays); } Recur<LocalDate> rule = rBuilder.build(); getSkinnable().setRecurrenceRule(rule.toString()); if (LoggingDomain.RECURRENCE.isLoggable(Level.FINE)) { LoggingDomain.RECURRENCE.fine( "test dumping 10 recurrences starting with today's date"); LocalDate today = LocalDate.of(2015, 8, 18); List<LocalDate> dates = rule.getDates(today, today, LocalDate.MAX, 10); for (LocalDate repeatingDate : dates) { LoggingDomain.RECURRENCE.fine(repeatingDate.toString()); } } }
private void updateRule() { Recur.Builder<LocalDate> rBuilder = new Recur.Builder<>(); switch (frequencyBox.getValue()) { case DAILY: rBuilder.frequency(net.fortuna.ical4j.model.Recur.Frequency.DAILY); break; case MONTHLY: rBuilder.frequency(net.fortuna.ical4j.model.Recur.Frequency.MONTHLY); break; case WEEKLY: rBuilder.frequency(net.fortuna.ical4j.model.Recur.Frequency.WEEKLY); break; case YEARLY: rBuilder.frequency(net.fortuna.ical4j.model.Recur.Frequency.YEARLY); break; default: break; } int interval = repeatCountSpinner.getValue(); if (interval > 1) { rBuilder.interval(interval); } else { rBuilder.interval(0); } if (endsOnButton.isSelected()) { LocalDate date = endsOnDatePicker.getValue(); rBuilder.until(date); } if (endsAfterButton.isSelected()) { rBuilder.count(endsAfterCounterSpinner.getValue()); } if (frequencyBox.getValue() == Frequency.MONTHLY) { if (repeatByDayOfTheMonth.isSelected()) { int value = getSkinnable().getStartDate().getDayOfMonth(); rBuilder.monthList(new NumberList(value, value, false)); } else { LocalDate localDate = getSkinnable().getStartDate(); ZonedDateTime zonedDateTime = ZonedDateTime.of(localDate, LocalTime.now(), ZoneId.systemDefault()); int hits = 1; ZonedDateTime current = zonedDateTime.withDayOfMonth(1); do { if (current.getDayOfWeek() .equals(zonedDateTime.getDayOfWeek())) { hits++; } current = current.plusDays(1); } while (current.toLocalDate().isBefore(localDate)); WeekDayList weekdays = new WeekDayList(); switch (zonedDateTime.getDayOfWeek()) { case FRIDAY: weekdays.add(new WeekDay(WeekDay.FR, hits)); break; case MONDAY: weekdays.add(new WeekDay(WeekDay.MO, hits)); break; case SATURDAY: weekdays.add(new WeekDay(WeekDay.SA, hits)); break; case SUNDAY: weekdays.add(new WeekDay(WeekDay.SU, hits)); break; case THURSDAY: weekdays.add(new WeekDay(WeekDay.TH, hits)); break; case TUESDAY: weekdays.add(new WeekDay(WeekDay.TU, hits)); break; case WEDNESDAY: weekdays.add(new WeekDay(WeekDay.WE, hits)); break; default: break; } rBuilder.dayList(weekdays); } } if (frequencyBox.getValue() == Frequency.WEEKLY) { WeekDayList weekdays = new WeekDayList(); maybeAddWeekday(weekdays, WeekDay.MO, weekDayMondayButton); maybeAddWeekday(weekdays, WeekDay.TU, weekDayTuesdayButton); maybeAddWeekday(weekdays, WeekDay.WE, weekDayWednesdayButton); maybeAddWeekday(weekdays, WeekDay.TH, weekDayThursdayButton); maybeAddWeekday(weekdays, WeekDay.FR, weekDayFridayButton); maybeAddWeekday(weekdays, WeekDay.SA, weekDaySaturdayButton); maybeAddWeekday(weekdays, WeekDay.SU, weekDaySundayButton); rBuilder.dayList(weekdays); } Recur<LocalDate> rule = rBuilder.build(); getSkinnable().setRecurrenceRule(rule.toString()); if (LoggingDomain.RECURRENCE.isLoggable(Level.FINE)) { LoggingDomain.RECURRENCE.fine( "test dumping 10 recurrences starting with today's date"); LocalDate today = LocalDate.of(2015, 8, 18); List<LocalDate> dates = rule.getDates(today, today, LocalDate.MAX, 10); for (LocalDate repeatingDate : dates) { LoggingDomain.RECURRENCE.fine(repeatingDate.toString()); } } }
private void updaterule() { recur.builder<localdate> rbuilder = new recur.builder<>(); switch (frequencybox.getvalue()) { case daily: rbuilder.frequency(net.fortuna.ical4j.model.recur.frequency.daily); break; case monthly: rbuilder.frequency(net.fortuna.ical4j.model.recur.frequency.monthly); break; case weekly: rbuilder.frequency(net.fortuna.ical4j.model.recur.frequency.weekly); break; case yearly: rbuilder.frequency(net.fortuna.ical4j.model.recur.frequency.yearly); break; default: break; } int interval = repeatcountspinner.getvalue(); if (interval > 1) { rbuilder.interval(interval); } else { rbuilder.interval(0); } if (endsonbutton.isselected()) { localdate date = endsondatepicker.getvalue(); rbuilder.until(date); } if (endsafterbutton.isselected()) { rbuilder.count(endsaftercounterspinner.getvalue()); } if (frequencybox.getvalue() == frequency.monthly) { if (repeatbydayofthemonth.isselected()) { int value = getskinnable().getstartdate().getdayofmonth(); rbuilder.monthlist(new numberlist(value, value, false)); } else { localdate localdate = getskinnable().getstartdate(); zoneddatetime zoneddatetime = zoneddatetime.of(localdate, localtime.now(), zoneid.systemdefault()); int hits = 1; zoneddatetime current = zoneddatetime.withdayofmonth(1); do { if (current.getdayofweek() .equals(zoneddatetime.getdayofweek())) { hits++; } current = current.plusdays(1); } while (current.tolocaldate().isbefore(localdate)); weekdaylist weekdays = new weekdaylist(); switch (zoneddatetime.getdayofweek()) { case friday: weekdays.add(new weekday(weekday.fr, hits)); break; case monday: weekdays.add(new weekday(weekday.mo, hits)); break; case saturday: weekdays.add(new weekday(weekday.sa, hits)); break; case sunday: weekdays.add(new weekday(weekday.su, hits)); break; case thursday: weekdays.add(new weekday(weekday.th, hits)); break; case tuesday: weekdays.add(new weekday(weekday.tu, hits)); break; case wednesday: weekdays.add(new weekday(weekday.we, hits)); break; default: break; } rbuilder.daylist(weekdays); } } if (frequencybox.getvalue() == frequency.weekly) { weekdaylist weekdays = new weekdaylist(); maybeaddweekday(weekdays, weekday.mo, weekdaymondaybutton); maybeaddweekday(weekdays, weekday.tu, weekdaytuesdaybutton); maybeaddweekday(weekdays, weekday.we, weekdaywednesdaybutton); maybeaddweekday(weekdays, weekday.th, weekdaythursdaybutton); maybeaddweekday(weekdays, weekday.fr, weekdayfridaybutton); maybeaddweekday(weekdays, weekday.sa, weekdaysaturdaybutton); maybeaddweekday(weekdays, weekday.su, weekdaysundaybutton); rbuilder.daylist(weekdays); } recur<localdate> rule = rbuilder.build(); getskinnable().setrecurrencerule(rule.tostring()); if (loggingdomain.recurrence.isloggable(level.fine)) { loggingdomain.recurrence.fine( "test dumping 10 recurrences starting with today's date"); localdate today = localdate.of(2015, 8, 18); list<localdate> dates = rule.getdates(today, today, localdate.max, 10); for (localdate repeatingdate : dates) { loggingdomain.recurrence.fine(repeatingdate.tostring()); } } }
mwkroening/CalendarFX
[ 0, 1, 0, 0 ]
18,334
private boolean checkDoorIsSealed(World world, BlockPosition pos, int meta) { //TODO: door corners return ((meta & 8) == 8 || ((meta & 4) >> 2 == (meta & 1) && checkDoorSeal(world, pos.getPositionAtOffset(0, 0, 1), meta) && checkDoorSeal(world, pos.getPositionAtOffset(0, 0, -1), meta)) || (meta & 4) >> 2 != (meta & 1) && checkDoorSeal(world, pos.getPositionAtOffset(1, 0, 0), meta) && checkDoorSeal(world, pos.getPositionAtOffset(-1, 0, 0), meta)); }
private boolean checkDoorIsSealed(World world, BlockPosition pos, int meta) { return ((meta & 8) == 8 || ((meta & 4) >> 2 == (meta & 1) && checkDoorSeal(world, pos.getPositionAtOffset(0, 0, 1), meta) && checkDoorSeal(world, pos.getPositionAtOffset(0, 0, -1), meta)) || (meta & 4) >> 2 != (meta & 1) && checkDoorSeal(world, pos.getPositionAtOffset(1, 0, 0), meta) && checkDoorSeal(world, pos.getPositionAtOffset(-1, 0, 0), meta)); }
private boolean checkdoorissealed(world world, blockposition pos, int meta) { return ((meta & 8) == 8 || ((meta & 4) >> 2 == (meta & 1) && checkdoorseal(world, pos.getpositionatoffset(0, 0, 1), meta) && checkdoorseal(world, pos.getpositionatoffset(0, 0, -1), meta)) || (meta & 4) >> 2 != (meta & 1) && checkdoorseal(world, pos.getpositionatoffset(1, 0, 0), meta) && checkdoorseal(world, pos.getpositionatoffset(-1, 0, 0), meta)); }
phit/AdvancedRocketry
[ 1, 0, 0, 0 ]
18,335
private boolean checkDoorSeal(World world, BlockPosition pos, int meta) { Block otherBlock = world.getBlock(pos.x, pos.y, pos.z); int otherMeta = world.getBlockMetadata(pos.x, pos.y, pos.z); return (otherBlock == AdvancedRocketryBlocks.blockAirLock && (otherMeta & 1) == (meta & 1)) || (otherBlock != AdvancedRocketryBlocks.blockAirLock && isBlockSealed(world, pos)); }
private boolean checkDoorSeal(World world, BlockPosition pos, int meta) { Block otherBlock = world.getBlock(pos.x, pos.y, pos.z); int otherMeta = world.getBlockMetadata(pos.x, pos.y, pos.z); return (otherBlock == AdvancedRocketryBlocks.blockAirLock && (otherMeta & 1) == (meta & 1)) || (otherBlock != AdvancedRocketryBlocks.blockAirLock && isBlockSealed(world, pos)); }
private boolean checkdoorseal(world world, blockposition pos, int meta) { block otherblock = world.getblock(pos.x, pos.y, pos.z); int othermeta = world.getblockmetadata(pos.x, pos.y, pos.z); return (otherblock == advancedrocketryblocks.blockairlock && (othermeta & 1) == (meta & 1)) || (otherblock != advancedrocketryblocks.blockairlock && isblocksealed(world, pos)); }
phit/AdvancedRocketry
[ 0, 0, 0, 0 ]
34,826
@Test(enabled=false) public void testGetFutureConfigWhenReady() throws Exception { MyPolicy policy = new MyPolicy(MutableMap.builder() .put(TestEntity.CONF_NAME, DependentConfiguration.whenDone(Callables.returning("aval"))) .build()); app.policies().add(policy); assertEquals(policy.getConfig(TestEntity.CONF_NAME), "aval"); }
@Test(enabled=false) public void testGetFutureConfigWhenReady() throws Exception { MyPolicy policy = new MyPolicy(MutableMap.builder() .put(TestEntity.CONF_NAME, DependentConfiguration.whenDone(Callables.returning("aval"))) .build()); app.policies().add(policy); assertEquals(policy.getConfig(TestEntity.CONF_NAME), "aval"); }
@test(enabled=false) public void testgetfutureconfigwhenready() throws exception { mypolicy policy = new mypolicy(mutablemap.builder() .put(testentity.conf_name, dependentconfiguration.whendone(callables.returning("aval"))) .build()); app.policies().add(policy); assertequals(policy.getconfig(testentity.conf_name), "aval"); }
nakomis/incubator-brooklyn
[ 1, 0, 0, 0 ]
34,827
@Test(enabled=false) public void testGetFutureConfigBlocksUntilReady() throws Exception { final CountDownLatch latch = new CountDownLatch(1); MyPolicy policy = new MyPolicy(MutableMap.builder() .put(TestEntity.CONF_NAME, DependentConfiguration.whenDone(new Callable<String>() { public String call() { try { latch.await(); return "aval"; } catch (InterruptedException e) { throw Exceptions.propagate(e); } }})) .build()); app.policies().add(policy); Thread t = new Thread(new Runnable() { public void run() { try { Thread.sleep(10+EARLY_RETURN_GRACE); latch.countDown(); } catch (InterruptedException e) { throw Exceptions.propagate(e); } }}); try { long starttime = System.currentTimeMillis(); t.start(); assertEquals(policy.getConfig(TestEntity.CONF_NAME), "aval"); long endtime = System.currentTimeMillis(); assertTrue((endtime - starttime) >= 10, "starttime="+starttime+"; endtime="+endtime); } finally { t.interrupt(); } }
@Test(enabled=false) public void testGetFutureConfigBlocksUntilReady() throws Exception { final CountDownLatch latch = new CountDownLatch(1); MyPolicy policy = new MyPolicy(MutableMap.builder() .put(TestEntity.CONF_NAME, DependentConfiguration.whenDone(new Callable<String>() { public String call() { try { latch.await(); return "aval"; } catch (InterruptedException e) { throw Exceptions.propagate(e); } }})) .build()); app.policies().add(policy); Thread t = new Thread(new Runnable() { public void run() { try { Thread.sleep(10+EARLY_RETURN_GRACE); latch.countDown(); } catch (InterruptedException e) { throw Exceptions.propagate(e); } }}); try { long starttime = System.currentTimeMillis(); t.start(); assertEquals(policy.getConfig(TestEntity.CONF_NAME), "aval"); long endtime = System.currentTimeMillis(); assertTrue((endtime - starttime) >= 10, "starttime="+starttime+"; endtime="+endtime); } finally { t.interrupt(); } }
@test(enabled=false) public void testgetfutureconfigblocksuntilready() throws exception { final countdownlatch latch = new countdownlatch(1); mypolicy policy = new mypolicy(mutablemap.builder() .put(testentity.conf_name, dependentconfiguration.whendone(new callable<string>() { public string call() { try { latch.await(); return "aval"; } catch (interruptedexception e) { throw exceptions.propagate(e); } }})) .build()); app.policies().add(policy); thread t = new thread(new runnable() { public void run() { try { thread.sleep(10+early_return_grace); latch.countdown(); } catch (interruptedexception e) { throw exceptions.propagate(e); } }}); try { long starttime = system.currenttimemillis(); t.start(); assertequals(policy.getconfig(testentity.conf_name), "aval"); long endtime = system.currenttimemillis(); asserttrue((endtime - starttime) >= 10, "starttime="+starttime+"; endtime="+endtime); } finally { t.interrupt(); } }
nakomis/incubator-brooklyn
[ 1, 0, 0, 0 ]
18,502
public void testUpdate() { // Note: painting code, cannot test }
public void testUpdate() { }
public void testupdate() { }
qinFamily/freeVM
[ 0, 0, 0, 1 ]
18,503
public void testPaint() { // Note: painting code, cannot test }
public void testPaint() { }
public void testpaint() { }
qinFamily/freeVM
[ 0, 0, 0, 1 ]
18,504
public void testPaintContentBorderBottomEdge() { // Note: painting code, cannot test }
public void testPaintContentBorderBottomEdge() { }
public void testpaintcontentborderbottomedge() { }
qinFamily/freeVM
[ 0, 0, 0, 1 ]