auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
AggregationInfo buildAggregationInfo() { String expression; if (_name.equalsIgnoreCase(AggregationFunctionType.COUNT.getName())) { expression = "*"; } else { List<? extends AstNode> children = getChildren(); if (children == null || children.isEmpty()) { throw new Pql2CompilationException("Aggregation function expects non-null argument"); } if (_name.equalsIgnoreCase(AggregationFunctionType.DISTINCT.getName()) && children.size() == 1 && children .get(0) instanceof StarExpressionAstNode) { throw new Pql2CompilationException( "Syntax error: Pinot currently does not support DISTINCT with *. Please specify each column name as argument to DISTINCT function"); } Set<String> expressions = new HashSet<>(); StringBuilder distinctColumnExpr = new StringBuilder(); int numChildren = children.size(); for (int i = 0; i < numChildren; ++i) { expression = TransformExpressionTree.getStandardExpression(children.get(i)); if (expressions.add(expression)) { if (i != 0) { distinctColumnExpr.append(AGGREGATION_FUNCTION_ARG_SEPARATOR); } distinctColumnExpr.append(expression); } } expression = distinctColumnExpr.toString(); } AggregationInfo aggregationInfo = new AggregationInfo(); aggregationInfo.setAggregationType(_name); aggregationInfo.putToAggregationParams(CompilerConstants.COLUMN_KEY_IN_AGGREGATION_INFO, expression); aggregationInfo.setIsInSelectList(_isInSelectList); return aggregationInfo; }

Target:
AggregationInfo buildAggregationInfo() { String expression; if (_name.equalsIgnoreCase(AggregationFunctionType.COUNT.getName())) { expression = "*"; } else { List<? extends AstNode> children = getChildren(); if (children == null || children.isEmpty()) { throw new Pql2CompilationException("Aggregation function expects non-null argument"); } if (_name.equalsIgnoreCase(AggregationFunctionType.DISTINCT.getName()) && children.size() == 1 && children .get(0) instanceof StarExpressionAstNode) { throw new Pql2CompilationException( "Syntax error: Pinot currently does not support DISTINCT with *. Please specify each column name as argument to DISTINCT function"); } Set<String> expressions = new HashSet<>(); StringBuilder distinctColumnExpr = new StringBuilder(); int numChildren = children.size(); for (int i = 0; i < numChildren; ++i) { expression = TransformExpressionTree.getStandardExpression(children.get(i)); if (expressions.add(expression)) { if (i != 0) { distinctColumnExpr.append(CompilerConstants.AGGREGATION_FUNCTION_ARG_SEPARATOR); } distinctColumnExpr.append(expression); } } expression = distinctColumnExpr.toString(); } AggregationInfo aggregationInfo = new AggregationInfo(); aggregationInfo.setAggregationType(_name); aggregationInfo.putToAggregationParams(CompilerConstants.COLUMN_KEY_IN_AGGREGATION_INFO, expression); aggregationInfo.setIsInSelectList(_isInSelectList); return aggregationInfo; }
Source:
private void handleSuccessors(CfgBlock block, ProgramState incomingState) { ProgramState currentState = incomingState; if (block instanceof CfgBranchingBlock) { CfgBranchingBlock branchingBlock = (CfgBranchingBlock) block; Tree branchingTree = branchingBlock.branchingTree(); if (branchingTree.is( Kind.IF_STATEMENT, Kind.WHILE_STATEMENT, Kind.FOR_STATEMENT, Kind.DO_WHILE_STATEMENT, Kind.CONDITIONAL_AND, Kind.CONDITIONAL_OR)) { handleConditionSuccessors(branchingBlock, currentState); return; } else if (branchingTree.is(Kind.FOR_IN_STATEMENT, Kind.FOR_OF_STATEMENT)) { ForObjectStatementTree forTree = (ForObjectStatementTree) branchingTree; Tree variable = forTree.variableOrExpression(); if (variable.is(Kind.VAR_DECLARATION)) { VariableDeclarationTree declaration = (VariableDeclarationTree) variable; variable = declaration.variables().get(0); } currentState = store(currentState, variable, forTree.expression()); } } pushAllSuccessors(block, currentState); }

Target:
private void handleSuccessors(CfgBlock block, ProgramState incomingState) { ProgramState currentState = incomingState; if (block instanceof CfgBranchingBlock) { CfgBranchingBlock branchingBlock = (CfgBranchingBlock) block; Tree branchingTree = branchingBlock.branchingTree(); if (branchingTree.is( Kind.IF_STATEMENT, Kind.WHILE_STATEMENT, Kind.FOR_STATEMENT, Kind.DO_WHILE_STATEMENT, Kind.CONDITIONAL_AND, Kind.CONDITIONAL_OR)) { handleConditionSuccessors(branchingBlock, currentState); return; } else if (branchingTree.is(Kind.FOR_IN_STATEMENT, Kind.FOR_OF_STATEMENT)) { ForObjectStatementTree forTree = (ForObjectStatementTree) branchingTree; Tree variable = forTree.variableOrExpression(); if (variable.is(Kind.VAR_DECLARATION)) { VariableDeclarationTree declaration = (VariableDeclarationTree) variable; variable = declaration.variables().get(0); } currentState = store(currentState, variable, SymbolicValue.UNKNOWN); } } pushAllSuccessors(block, currentState); }
Source:
public void testNotFound() throws Exception { MockWebServer server = mockWebServer(); server.enqueue(new MockResponse().setBody(payloadFromResource("/not-found.json"))); DigitalOceanApi api = api(server.getUrl("/")); ImageApi imageApi = api.getImageApi(); try { imageApi.list(); fail("Request should have failed"); } catch (Exception ex) { assertTrue(ex instanceof ResourceNotFoundException, "Exception should be a ResourceNotFoundException"); assertEquals(ex.getMessage(), "Not Found"); } finally { api.close(); server.shutdown(); } }

Target:
public void testNotFound() throws Exception { MockWebServer server = mockWebServer(); server.enqueue(new MockResponse().setBody(payloadFromResource("/not-found.json"))); DigitalOceanApi api = api(server.getUrl("/")); ImageApi imageApi = api.getImageApi(); try { imageApi.list(); fail("Request should have failed"); } catch (Exception ex) { assertTrue(ex instanceof ResourceNotFoundException, "Exception should be a ResourceNotFoundException"); assertEquals(ex.getMessage(), NOT_FOUND); } finally { api.close(); server.shutdown(); } }
Source:
protected Map<VmTemplate, List<DiskImage>> buildFromOVFs(List<String> ovfList) { OvfManager ovfManager = new OvfManager(); Map<VmTemplate, List<DiskImage>> templates = new HashMap<>(); OvfHelper ovfHelper = new OvfHelper(); for (String ovf : ovfList) { try { if (ovfManager.IsOvfTemplate(ovf)) { VmTemplate vmTemplate = ovfHelper.readVmTemplateFromOvf(ovf); List templateDisks = new ArrayList(vmTemplate.getDiskTemplateMap().values()); templates.put(vmTemplate, templateDisks); } } catch (OvfReaderException ex) { auditLogOvfLoadError(ex.getName()); } } return templates; }

Target:
protected Map<VmTemplate, List<DiskImage>> buildFromOVFs(List<String> ovfList) { OvfManager ovfManager = new OvfManager(); Map<VmTemplate, List<DiskImage>> templateDisksMap = new HashMap<>(); OvfHelper ovfHelper = new OvfHelper(); for (String ovf : ovfList) { try { if (ovfManager.IsOvfTemplate(ovf)) { VmTemplate vmTemplate = ovfHelper.readVmTemplateFromOvf(ovf); List<DiskImage> templateDisks = new ArrayList(vmTemplate.getDiskTemplateMap().values()); templateDisksMap.put(vmTemplate, templateDisks); } } catch (OvfReaderException ex) { auditLogOvfLoadError(ex.getName()); } } return templateDisksMap; }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.delete_video_dialog, container, false); TextView title_tv = (TextView) v.findViewById(R.id.tv_dialog_title); title_tv.setVisibility(View.GONE); TextView dialog_tv_1 = (TextView) v .findViewById(R.id.tv_dialog_message1); dialog_tv_1.setText(getArguments().getString("dialog_msg_1")); Button positiveBtn = (Button) v.findViewById(R.id.positiveButton); positiveBtn.setText(getArguments().getString("dialog_yes_btn").toUpperCase()); positiveBtn.setOnClickListener(new OnClickListener() { public void onClick(View v) { try { if (callback != null && isVisible()) { callback.onPositiveClicked(); dismiss(); } } catch (Exception e) { logger.error(e); } } }); Button negativebtn = (Button) v.findViewById(R.id.negativeButton); negativebtn.setText(getArguments().getString("dialog_no_btn").toUpperCase()); negativebtn.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (callback != null && isVisible()) { callback.onNegativeClicked(); dismiss(); } } }); return v; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.delete_video_dialog, container, false); TextView title_tv = (TextView) v.findViewById(R.id.tv_dialog_title); title_tv.setVisibility(View.GONE); TextView dialog_tv_1 = (TextView) v .findViewById(R.id.tv_dialog_message1); dialog_tv_1.setText(getArguments().getString("dialog_msg_1")); Button positiveBtn = (Button) v.findViewById(R.id.positiveButton); positiveBtn.setText(getArguments().getString("dialog_yes_btn")); positiveBtn.setOnClickListener(new OnClickListener() { public void onClick(View v) { try { if (callback != null && isVisible()) { callback.onPositiveClicked(); dismiss(); } } catch (Exception e) { logger.error(e); } } }); Button negativebtn = (Button) v.findViewById(R.id.negativeButton); negativebtn.setText(getArguments().getString("dialog_no_btn").toUpperCase()); negativebtn.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (callback != null && isVisible()) { callback.onNegativeClicked(); dismiss(); } } }); return v; }
Source:
private void disconnectStorageByType(StorageType storageType, List<StorageServerConnections> connections) { Optional<StorageDomain> heDomain = storageDomainDao.getAllForStoragePool(getStoragePool().getId()) .stream() .filter(StorageDomain::isHostedEngineStorage) .findAny(); if (heDomain.isPresent()) { String heID = heDomain.get().getStorageStaticData().getStorage(); connections = connections.stream().filter(c -> !c.getId().equals(heID)).collect(Collectors.toList()); } storageHelperDirector.getItem(storageType).prepareDisconnectHostFromStoragePoolServers(getParameters(), connections); VDSReturnValue vdsReturnValue = runVdsCommand( VDSCommandType.DisconnectStorageServer, new StorageServerConnectionManagementVDSParameters(getVds().getId(), getStoragePool().getId(), storageType, connections)); setSucceeded(vdsReturnValue.getSucceeded()); if (!vdsReturnValue.getSucceeded()) { storageHelperDirector.getItem(storageType) .isConnectSucceeded((HashMap<String, String>) vdsReturnValue.getReturnValue(), connections); } }

Target:
private void disconnectStorageByType(StorageType storageType, List<StorageServerConnections> connections) { List<String> heIds = storageDomainDao.getHostedEngineStorageDomainIds().stream() .map(storageDomainDao::get) .map(StorageDomain::getStorageStaticData) .map(StorageDomainStatic::getStorage) .collect(Collectors.toList()); connections = connections.stream() .filter(c -> heIds.stream().noneMatch(heId -> c.getId().equals(heId))) .collect(Collectors.toList()); storageHelperDirector.getItem(storageType).prepareDisconnectHostFromStoragePoolServers(getParameters(), connections); VDSReturnValue vdsReturnValue = runVdsCommand( VDSCommandType.DisconnectStorageServer, new StorageServerConnectionManagementVDSParameters(getVds().getId(), getStoragePool().getId(), storageType, connections)); setSucceeded(vdsReturnValue.getSucceeded()); if (!vdsReturnValue.getSucceeded()) { storageHelperDirector.getItem(storageType) .isConnectSucceeded((HashMap<String, String>) vdsReturnValue.getReturnValue(), connections); } }
Source:
public void verifyVideoWidth(int widthDesired) { String content = getContent(); int width = Integer.parseInt( content.substring(content.indexOf("px") - 4, content.indexOf("px") - 1) ); Assertion.assertNumber( widthDesired, width, "width is " + width + " should be " + widthDesired ); }

Target:
public void verifyVideoWidth(int widthDesired) { String content = getContent(); int width = Integer.parseInt( content.substring(content.indexOf("px") - 4, content.indexOf("px") - 1) ); Assertion.assertNumber( widthDesired, width, "Video width in source edit mode is " + width + " while desired width is " + widthDesired ); }
Source:
public <K, V> ConcurrentMap<K, V> getPersistentConcurrentMap(String name) { return new ConcurrentHashMap<K, V>(); }

Target:
public <K extends Serializable, V extends Serializable> ConcurrentMap<K, V> getPersistentConcurrentMap(String name) { ConcurrentMap concurrentMap = knownMaps.get(name); if (concurrentMap != null) { return concurrentMap; } else { ConcurrentHashMap<K, V> newMap = new ConcurrentHashMap<K, V>(); concurrentMap = knownMaps.putIfAbsent(name, newMap); if (concurrentMap == null) { return newMap; } else { return concurrentMap; } } }
Source:
public AuthCache(Protocol.ExpiringAction action) { this.cachedAction = action; try { if (action.expiresIn != null && !action.expiresIn.isEmpty()) { this.validUntil = System.currentTimeMillis() + Long.parseLong(action.expiresIn); } else if (action.expiresAt != null && !action.expiresAt.isEmpty()) { this.validUntil = ISO_FORMAT.parse(action.expiresAt) .getTime() - AUTH_CACHE_EAGER_TIMEOUT; } else { this.validUntil = System.currentTimeMillis() + 1000; } } catch (Exception e) { this.validUntil = System.currentTimeMillis() + 1000; } }

Target:
public AuthCache(Protocol.ExpiringAction action) { this.cachedAction = action; try { if (action.expiresIn != null && !action.expiresIn.isEmpty()) { this.validUntil = System.currentTimeMillis() + Long.parseLong(action.expiresIn); } else if (action.expiresAt != null && !action.expiresAt.isEmpty()) { this.validUntil = ISO_FORMAT.parse(action.expiresAt) .getTime() - AUTH_CACHE_EAGER_TIMEOUT; } else { this.validUntil = System.currentTimeMillis(); } } catch (Exception e) { this.validUntil = System.currentTimeMillis(); } }
Source:
public Object getAnyExample(String nodeKey,ObjectNode node, String location, ParseResult result ){ JsonNode example = node.get(nodeKey); if (example != null) { if (example.getNodeType().equals(JsonNodeType.STRING)) { String value = getString(nodeKey, node, false, location, result); if (StringUtils.isNotBlank(value)) { return value; } } if (example.getNodeType().equals(JsonNodeType.NUMBER)) { Integer integerExample = getInteger(nodeKey, node, false, location, result); JsonNode format = node.get("format"); if (integerExample != null && !(format != null && format.asText().equals("int64"))) { return integerExample; }else { BigDecimal bigDecimalExample = getBigDecimal(nodeKey, node, false, location, result); if (bigDecimalExample != null) { return bigDecimalExample; } } } else if (example.getNodeType().equals(JsonNodeType.OBJECT)) { ObjectNode objectValue = getObject(nodeKey, node, false, location, result); if (objectValue != null) { return objectValue; } } else if (example.getNodeType().equals(JsonNodeType.ARRAY)) { ArrayNode arrayValue = getArray(nodeKey, node, false, location, result); if (arrayValue != null) { return arrayValue; } } } return null; }

Target:
public Object getAnyExample(String nodeKey,ObjectNode node, String location, ParseResult result ){ JsonNode example = node.get(nodeKey); if (example != null) { if (example.getNodeType().equals(JsonNodeType.STRING)) { String value = getString(nodeKey, node, false, location, result); if (StringUtils.isNotBlank(value)) { return value; } } if (example.getNodeType().equals(JsonNodeType.NUMBER)) { Integer integerExample = getInteger(nodeKey, node, false, location, result); if (integerExample != null) { return integerExample; }else { BigDecimal bigDecimalExample = getBigDecimal(nodeKey, node, false, location, result); if (bigDecimalExample != null) { return bigDecimalExample; } } } else if (example.getNodeType().equals(JsonNodeType.OBJECT)) { ObjectNode objectValue = getObject(nodeKey, node, false, location, result); if (objectValue != null) { return objectValue; } } else if (example.getNodeType().equals(JsonNodeType.ARRAY)) { ArrayNode arrayValue = getArray(nodeKey, node, false, location, result); if (arrayValue != null) { return arrayValue; } } } return null; }
Source:
public FieldBridge provideFieldBridge(ExtendedBridgeProviderContext context) { AnnotatedElement annotatedElement = context.getAnnotatedElement(); if ( Date.class.isAssignableFrom( context.getReturnType() ) ) { if ( annotatedElement.isAnnotationPresent( org.hibernate.search.annotations.DateBridge.class ) ) { DateBridge dateBridgeAnnotation = annotatedElement.getAnnotation( org.hibernate.search.annotations.DateBridge.class ); return getDateFieldBridge( dateBridgeAnnotation.resolution() ); } else { return getDateFieldBridge( Resolution.MILLISECOND ); } } else if ( Calendar.class.isAssignableFrom( context.getReturnType() ) ) { if ( annotatedElement.isAnnotationPresent( org.hibernate.search.annotations.DateBridge.class ) ) { DateBridge dateBridgeAnnotation = annotatedElement.getAnnotation( org.hibernate.search.annotations.DateBridge.class ); return getCalendarFieldBridge( dateBridgeAnnotation.resolution() ); } else { return getCalendarFieldBridge( Resolution.MILLISECOND ); } } return null; }

Target:
public FieldBridge provideFieldBridge(ExtendedBridgeProviderContext context) { AnnotatedElement annotatedElement = context.getAnnotatedElement(); if ( Date.class.isAssignableFrom( context.getReturnType() ) ) { if ( annotatedElement.isAnnotationPresent( DateBridge.class ) ) { DateBridge dateBridgeAnnotation = annotatedElement.getAnnotation( DateBridge.class ); return getDateFieldBridge( dateBridgeAnnotation.resolution() ); } else { return getDateFieldBridge( Resolution.MILLISECOND ); } } else if ( Calendar.class.isAssignableFrom( context.getReturnType() ) ) { if ( annotatedElement.isAnnotationPresent( DateBridge.class ) ) { DateBridge dateBridgeAnnotation = annotatedElement.getAnnotation( DateBridge.class ); return getCalendarFieldBridge( dateBridgeAnnotation.resolution() ); } else { return getCalendarFieldBridge( Resolution.MILLISECOND ); } } return null; }
Source:
public boolean shouldUpload(JAXBElement<TVAMainType> tvaElem) { BroadcastEventType broadcastEvent = extractBroadcastEvent(tvaElem); Optional<String> broadcastPcrid = getPcrid(broadcastEvent); String crid = broadcastEvent.getProgram().getCrid(); String broadcastImi = broadcastEvent.getInstanceMetadataId(); if (!broadcastPcrid.isPresent()) { return true; } if(broadcastImi.equals(sentBroadcastProgramUrlStore.getSentBroadcastEventImi(crid, broadcastPcrid.get()).get())){ if(sentBroadcastProgramUrlStore. getSentBroadcastEventTransmissionDate(crid, broadcastPcrid.get()).get().isBefore(LocalDate.now().minusDays(51))) { return true; } } return false; }

Target:
public boolean shouldUpload(JAXBElement<TVAMainType> tvaElem) { BroadcastEventType broadcastEvent = extractBroadcastEvent(tvaElem); Optional<String> broadcastPcrid = getPcrid(broadcastEvent); String crid = broadcastEvent.getProgram().getCrid(); String broadcastImi = broadcastEvent.getInstanceMetadataId(); Optional<BroadcastEventRecord> broadcastEventRecords = sentBroadcastProgramUrlStore .getSentBroadcastEventRecords(crid, broadcastPcrid.get()); if(!broadcastEventRecords.isPresent()) { return true; } if(!broadcastPcrid.isPresent()) { return true; } if(broadcastImi.equals(broadcastEventRecords.get().getBroadcastEventImi())) { return true; } if(broadcastEventRecords.get() .getBroadcastTransmissionDate() .isBefore(LocalDate.now().minusDays(DAYS_BROADCAST_LAST_SENT))) { return true; } LOGGER.trace("Broadcast is not uploaded, since it has been last sent for less than " + DAYS_BROADCAST_LAST_SENT + " days or its ProgramURL has already been associated with this service ID and item"); return false; }
Source:
public List<String> getBrokers() { List<String> brokerList = new ArrayList<>(); for (JsonNode broker : _brokers) { String[] brokerPath = broker.textValue().split("_"); if(brokerPath.length < 3){ throw new RuntimeException("Invalid Broker Name found in controller: " + broker.textValue()); } String brokerHostPort = String.format("%s:%s", brokerPath[1], brokerPath[2]); brokerList.add(brokerHostPort); } return brokerList; }

Target:
public List<String> getBrokers() { List<String> brokerList = new ArrayList<>(); for (JsonNode broker : _brokers) { String hostName = broker.get("host").textValue(); Integer port = broker.get("port").intValue(); String brokerIP = hostName; if(hostName.contains("_")) { String[] hostNamePart = hostName.split("_"); brokerIP = hostNamePart[hostNamePart.length - 1]; } String brokerIPPort = String.format("%s:%d", brokerIP, port); brokerList.add(brokerIPPort); } return brokerList; }
Source:
private Notification createFrom(Talk talk) { NotificationCompat.Builder notificationBuilder = createDefaultBuilder(1); notificationBuilder .setContentIntent(createPendingIntentForSingleSession(talk.getId())) .setContentTitle(talk.getName()) .setContentText(talk.getRooms().get(0).getName()) .setGroup(GROUP_KEY_NOTIFY_SESSION); NotificationCompat.BigTextStyle richNotification = createBigTextRichNotification(notificationBuilder, talk); return richNotification.build(); }

Target:
private Notification createFrom(Talk talk) { NotificationCompat.Builder notificationBuilder = createDefaultBuilder(1); notificationBuilder .setContentIntent(createPendingIntentForSingleSession(talk.getId())) .setContentTitle(talk.getName()) .setContentText(getRoomName(talk)) .setGroup(GROUP_KEY_NOTIFY_SESSION); NotificationCompat.BigTextStyle richNotification = createBigTextRichNotification(notificationBuilder, talk); return richNotification.build(); }
Source:
public SaslClient createSaslClient(final String[] mechanisms, final String authorizationId, final String protocol, final String serverName, Map<String, ?> props, final CallbackHandler cbh) throws SaslException { Assert.checkNotNullParam("cbh", cbh); if (props == null) props = Collections.emptyMap(); if (PlainSasl.isMatched(props, true)) for (String mechanism : mechanisms) { if (SaslMechanismInformation.Names.PLAIN.equals(mechanism)) { return new PlainSaslClient(authorizationId, cbh); } } return null; }

Target:
public SaslClient createSaslClient(final String[] mechanisms, final String authorizationId, final String protocol, final String serverName, Map<String, ?> props, final CallbackHandler cbh) throws SaslException { Assert.checkNotNullParam("cbh", cbh); if (props == null) props = Collections.emptyMap(); if (PlainSasl.isMatched(props, false)) for (String mechanism : mechanisms) { if (SaslMechanismInformation.Names.PLAIN.equals(mechanism)) { return new PlainSaslClient(authorizationId, cbh); } } return null; }
Source:
public IosRSAPublicKey(byte[] encoded) { try { iosSecKey = createPublicSecKeyRef (encoded); } catch (Exception e) { throw new ProviderException(e); } }

Target:
public IosRSAPublicKey(byte[] encoded) { try { iosSecKey = createPublicSecKeyRef (encoded); } catch (Exception exp) { throw new ProviderException(exp); } }
Source:
public static void main(String[] args) { if (args.length != 4) { System.out.println("usage: FunctionalTest <ENDPOINT> <ACCESSKEY> <SECRETKEY> <REGION>"); System.exit(-1); } if (System.getenv("MINIO_MINT") != null) { mintEnv = true; String dataDir = System.getenv("DATA_DIR"); dataFile1Mb = Paths.get(dataDir + "/datafile-1-MB"); dataFile65Mb = Paths.get(dataDir + "/datafile-65-MB"); } endpoint = args[0]; accessKey = args[1]; secretKey = args[2]; region = args[3]; try { client = new MinioClient(endpoint, accessKey, secretKey); FunctionalTest.runTests(); client = new MinioClient(endpoint, accessKey, secretKey, region); FunctionalTest.runFastTests(); } catch (Exception e) { e.printStackTrace(); System.exit(-1); } }

Target:
public static void main(String[] args) { if (args.length != 4) { System.out.println("usage: FunctionalTest <ENDPOINT> <ACCESSKEY> <SECRETKEY> <REGION>"); System.exit(-1); } String dataDir = System.getenv("MINT_DATA_DIR"); if (dataDir != null && !dataDir.equals("")) { mintEnv = true; dataFile1Mb = Paths.get(dataDir, "datafile-1-MB"); dataFile65Mb = Paths.get(dataDir, "datafile-65-MB"); } endpoint = args[0]; accessKey = args[1]; secretKey = args[2]; region = args[3]; try { client = new MinioClient(endpoint, accessKey, secretKey); FunctionalTest.runTests(); client = new MinioClient(endpoint, accessKey, secretKey, region); FunctionalTest.runFastTests(); } catch (Exception e) { e.printStackTrace(); System.exit(-1); } }
Source:
protected void addAbnormalMaOntology(){ String sqlQuery="SELECT pp.id as id, ot.name as name, stable_id, ontology_acc FROM phenotype_parameter pp " + " INNER JOIN phenotype_parameter_lnk_ontology_annotation pploa ON pp.id = pploa.parameter_id " + " INNER JOIN phenotype_parameter_ontology_annotation ppoa ON ppoa.id = pploa.annotation_id " + " INNER JOIN ontology_term ot ON ot.acc = ppoa.ontology_acc " + " WHERE ppoa.ontology_db_id=8 LIMIT 10000"; try (PreparedStatement p = komp2DbConnection.prepareStatement(sqlQuery)) { System.out.println("PipelineIndexer: sql= " + sqlQuery); ResultSet resultSet = p.executeQuery(); while (resultSet.next()) { String parameterId = resultSet.getString("stable_id"); paramIdToParameter.get(parameterId).setMaId(resultSet.getString("ontology_acc")); paramIdToParameter.get(parameterId).setMaName(resultSet.getString("name")); } } catch (Exception e) { e.printStackTrace(); } }

Target:
protected void addAbnormalMaOntology(){ String sqlQuery="SELECT pp.id as id, ot.name as name, stable_id, ontology_acc FROM phenotype_parameter pp " + " INNER JOIN phenotype_parameter_lnk_ontology_annotation pploa ON pp.id = pploa.parameter_id " + " INNER JOIN phenotype_parameter_ontology_annotation ppoa ON ppoa.id = pploa.annotation_id " + " INNER JOIN ontology_term ot ON ot.acc = ppoa.ontology_acc " + " WHERE ppoa.ontology_db_id=8 LIMIT 10000"; try (PreparedStatement p = komp2DbConnection.prepareStatement(sqlQuery)) { ResultSet resultSet = p.executeQuery(); while (resultSet.next()) { String parameterId = resultSet.getString("stable_id"); paramIdToParameter.get(parameterId).setMaId(resultSet.getString("ontology_acc")); paramIdToParameter.get(parameterId).setMaName(resultSet.getString("name")); } } catch (Exception e) { e.printStackTrace(); } }
Source:
public void stopModuleSkipRefresh(Module module, ServletContext servletContext) { try { Method stopModule = WebModuleUtil.class.getDeclaredMethod("stopModule", Module.class, ServletContext.class, Boolean.TYPE); stopModule.setAccessible(true); stopModule.invoke(null, module, servletContext, true); } catch (NoSuchMethodException e) { throw new RuntimeException(); } catch (InvocationTargetException e) { throw new RuntimeException(); } catch (IllegalAccessException e) { throw new RuntimeException(); } }

Target:
public void stopModuleSkipRefresh(Module module, ServletContext servletContext) { ModuleFactory.stopModule(module); try { Method stopModule = WebModuleUtil.class.getDeclaredMethod("stopModule", Module.class, ServletContext.class, Boolean.TYPE); stopModule.setAccessible(true); stopModule.invoke(null, module, servletContext, true); } catch (NoSuchMethodException e) { throw new RuntimeException(STOP_MODULE_SKIP_REFRESH_EXCEPTION_MESSAGE, e); } catch (InvocationTargetException e) { throw new RuntimeException(STOP_MODULE_SKIP_REFRESH_EXCEPTION_MESSAGE, e); } catch (IllegalAccessException e) { throw new RuntimeException(STOP_MODULE_SKIP_REFRESH_EXCEPTION_MESSAGE, e); } }
Source:
public boolean isFieldPresent(String fieldName, String documentType) { if (documentType == null) { documentType = ""; } for (int i = 0; i < inputs.length; i++) { DCInput field = inputs[i]; String fullName = field.getElement() + "." + field.getQualifier(); if (fullName.equals(fieldName) ) { if (field.isAllowedFor(documentType)) { return true; } } } return false; }

Target:
public boolean isFieldPresent(String fieldName, String documentType) { if (documentType == null) { documentType = ""; } for (int i = 0; i < inputs.length; i++) { DCInput field = inputs[i]; String fullName = field.getFieldName(); if (fullName.equals(fieldName) ) { if (field.isAllowedFor(documentType)) { return true; } } } return false; }
Source:
private CoreModule() { addDeserializer(String.class, new StdScalarDeserializer<String>(String.class) { private static final long serialVersionUID = 6977627268309308664L; @Override public String deserialize(final JsonParser jp, final DeserializationContext ctx) throws IOException { return StringUtils.trim(jp.getValueAsString()); } }); }

Target:
private CoreModule() { addDeserializer(String.class, new StdScalarDeserializer<String>(String.class) { private static final long serialVersionUID = 6977627268309308664L; private final StringDeserializer STRING_DESERIALIZER = new StringDeserializer(); @Override public String deserialize(final JsonParser jp, final DeserializationContext ctx) throws IOException { return StringUtils.trim(STRING_DESERIALIZER.deserialize(jp, ctx)); } }); }
Source:
public List<String> checkIndex(PairDataSet index, String indexName, KeyHashDecoder indexKeyDecoder, ExecRow indexKey, LeadingIndexColumnInfo leadingIndexColumnInfo) throws Exception { this.indexName = indexName; this.indexKeyDecoder = indexKeyDecoder; this.indexKeyTemplate = indexKey; this.leadingIndexColumnInfo = leadingIndexColumnInfo; List<String> messages = Lists.newLinkedList(); JavaFutureAction<Long> tableCountFuture = null; filteredTable = baseTable.filter(new IndexFilter<>(leadingIndexColumnInfo)).index(new KeyByRowIdFunction<>()); if (baseTableCount == 0 || leadingIndexColumnInfo != null) { SpliceSpark.pushScope(String.format("Count table %s.%s", schemaName, tableName)); tableCountFuture = ((SparkPairDataSet) filteredTable).rdd.countAsync(); SpliceSpark.popScope(); } SpliceSpark.pushScope(String.format("Count index %s.%s", schemaName, indexName)); JavaFutureAction<Long> indexCountFuture = ((SparkPairDataSet)index).rdd.countAsync(); SpliceSpark.popScope(); messages.addAll(checkMissingIndexes(filteredTable, index)); messages.addAll(checkInvalidIndexes(filteredTable, index)); if (tableCountFuture != null) { if (leadingIndexColumnInfo == null) { baseTableCount = tableCountFuture.get(); } else { filteredTableCount = tableCountFuture.get(); } } indexCount = indexCountFuture.get(); long count = leadingIndexColumnInfo != null ? filteredTableCount : baseTableCount; if (indexCount - invalidIndexCount > count - missingIndexCount) { messages.addAll(checkDuplicateIndexes(index)); } return messages; }

Target:
public List<String> checkIndex(PairDataSet index, String indexName, KeyHashDecoder indexKeyDecoder, ExecRow indexKey, LeadingIndexColumnInfo leadingIndexColumnInfo) throws Exception { this.indexName = indexName; this.indexKeyDecoder = indexKeyDecoder; this.indexKeyTemplate = indexKey; this.leadingIndexColumnInfo = leadingIndexColumnInfo; List<String> messages = Lists.newLinkedList(); JavaFutureAction<Long> tableCountFuture = null; filteredTable = baseTable.filter(new IndexFilter<>(leadingIndexColumnInfo)).index(new KeyByRowIdFunction<>()); if (baseTableCount == 0 || leadingIndexColumnInfo != null) { SpliceSpark.pushScope(String.format("Count table %s.%s", schemaName, tableName)); tableCountFuture = ((SparkPairDataSet) filteredTable).rdd.countAsync(); SpliceSpark.popScope(); } SpliceSpark.pushScope(String.format("Count index %s.%s", schemaName, indexName)); JavaFutureAction<Long> indexCountFuture = ((SparkPairDataSet)index).rdd.countAsync(); SpliceSpark.popScope(); messages.addAll(checkMissingIndexes(filteredTable, index)); if (tableCountFuture != null) { if (leadingIndexColumnInfo == null) { baseTableCount = tableCountFuture.get(); } else { filteredTableCount = tableCountFuture.get(); } } indexCount = indexCountFuture.get(); long tableCount = leadingIndexColumnInfo != null ? filteredTableCount : baseTableCount; if (indexCount != tableCount || missingIndexCount != 0) { messages.addAll(checkInvalidIndexes(filteredTable, index)); } if (indexCount - invalidIndexCount > tableCount - missingIndexCount) { messages.addAll(checkDuplicateIndexes(index)); } return messages; }
Source:
protected GsonBuilder createGsonBuilder() { final GsonBuilder g = super.createGsonBuilder(); g.registerTypeAdapter(com.google.gerrit.prettify.common.BaseEdit.class, new com.google.gerrit.prettify.common.EditDeserializer()); return g; }

Target:
protected GsonBuilder createGsonBuilder() { final GsonBuilder g = super.createGsonBuilder(); g.registerTypeAdapter(com.google.gerrit.prettify.common.LineEdit.class, new com.google.gerrit.prettify.common.EditDeserializer()); return g; }
Source:
public static AggregateFunction get(String functionName) { if (functionName.equals("COUNT")) { return new CountAggregateFunction(); } else if (functionName.equals("AVG")) { return new AverageAggregateFunction(); } else if (functionName.equals("SUM")) { return new SumAggregateFunction(); } else if (functionName.equals("MAX")) { return new MaxAggregateFunction(); } else if (functionName.equals("MIN")) { return new MinAggregateFunction(); } else { return null; } }

Target:
public static AggregateFunction get(String functionName) { if (functionName.equals("COUNT")) { return FunctionType.COUNT; } else if (functionName.equals("AVG")) { return FunctionType.AVG; } else if (functionName.equals("SUM")) { return FunctionType.SUM; } else if (functionName.equals("MAX")) { return FunctionType.MAX; } else if (functionName.equals("MIN")) { return FunctionType.MIN; } else { return null; } }
Source:
public void testArray_385750() throws Exception { AssertionHelper a = getCPPAssertionHelper(); a.assertReadWriteFlags("int* a = new int[10]", "a", WRITE); a.assertReadWriteFlags("*a = 5", "a", WRITE); a.assertReadWriteFlags("a[1] = 1", "a", WRITE); a.assertReadWriteFlags("++a[1]", "a", READ | WRITE); a.assertReadWriteFlags("a[1]--", "a", READ | WRITE); a.assertReadWriteFlags("a[1] += 1", "a", READ | WRITE); a.assertReadWriteFlags("&(a[1]) = 1", "a", WRITE); a.assertReadWriteFlags("b = a[0]", "a", READ); a.assertReadWriteFlags("b += a[0]", "a", READ); a.assertReadWriteFlags("c[1][2] = 1", "c", WRITE); a.assertReadWriteFlags("c[1][2]++", "c", READ | WRITE); a.assertReadWriteFlags("d[1][2][3] = 1", "d", WRITE); }

Target:
public void testArray_385750() throws Exception { AssertionHelper a = getCPPAssertionHelper(); a.assertReadWriteFlags("int* a = new int[10]", "a", WRITE); a.assertReadWriteFlags("a[1] = 1", "a", WRITE); a.assertReadWriteFlags("++a[1]", "a", READ | WRITE); a.assertReadWriteFlags("a[1]--", "a", READ | WRITE); a.assertReadWriteFlags("a[1] += 1", "a", READ | WRITE); a.assertReadWriteFlags("b = a[0]", "a", READ); a.assertReadWriteFlags("b = *a", "a", READ); a.assertReadWriteFlags("b += a[0]", "a", READ); a.assertReadWriteFlags("c[1][2] = 1", "c", WRITE); a.assertReadWriteFlags("*c[1][2] = 1", "c", WRITE); a.assertReadWriteFlags("c[1][2]++", "c", READ | WRITE); a.assertReadWriteFlags("d[1][2][3] = 1", "d", WRITE); }
Source:
missingFailureHandler(Class<?> cls, Class<? extends Message> failureClass) { final String msg = format( "Missing failure handler for failure class %s in the class %s", failureClass, cls ); return new IllegalStateException(msg); }

Target:
private static IllegalStateException missingFailureHandler( Class<?> cls, Class<? extends Message> failureClass) { final String msg = format( "Missing failure handler for failure class %s in the class %s", failureClass, cls ); return new IllegalStateException(msg); }
Source:
public void verifyTableSize(int width, int height) { waitForElementByElement(tables.get(tables.size()-1)); int chromeWidth = width - 1; int chromeHeight = height - 1; Assertion.assertTrue( tables.get(tables.size()-1).getCssValue("width").equals(Integer.toString(width) + "px") || tables.get(tables.size()-1).getCssValue("width").equals(Integer.toString(chromeWidth) + "px") ); Assertion.assertTrue( tables.get(tables.size()-1).getCssValue("height").equals(Integer.toString(height) + "px") || tables.get(tables.size()-1).getCssValue("height").equals(Integer.toString(chromeHeight) + "px") ); PageObjectLogging.log("verifyTableSize", "table has correct size", true); }

Target:
public void verifyTableSize(int width, int height) { waitForElementByElement(table); Dimension size = table.getSize(); Assertion.assertEquals(size.getHeight(), height); Assertion.assertEquals(size.getWidth(), width); PageObjectLogging.log("verifyTableSize", "table has correct size", true); }
Source:
protected Control createCustomArea(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(2, false)); composite.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL)); checkButton = new Button(composite, SWT.CHECK); checkButton.setText(checkBoxMessage); checkButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { checked = checkButton.getSelection(); } }); return composite; }

Target:
protected Control createCustomArea(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(2, false)); composite.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL)); checkButton = new Button(composite, SWT.CHECK); checkButton.setText(Strings.isValid(checkBoxMessage) ? checkBoxMessage : "<NONE>"); checkButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { checked = checkButton.getSelection(); } }); return composite; }
Source:
public void install() { DownloadResolver resolver = Entities.newDownloader(this); List<String> urls = resolver.getTargets(); String saveAs = resolver.getFilename(); List<String> commands = ImmutableList.<String>builder() .addAll(BashCommands.commandsToDownloadUrlsAs(urls, saveAs)) .add(BashCommands.installJavaLatestOrFail()) .add(String.format("tar zxvf %s", saveAs)) .build(); newScript(INSTALLING).body.append(commands).execute(); setExpandedInstallDir(getInstallDir() + "/" + resolver.getUnpackedDirectoryName(format("elasticsearch-%s", getVersion()))); }

Target:
public void install() { DownloadResolver resolver = Entities.newDownloader(this); List<String> urls = resolver.getTargets(); String saveAs = resolver.getFilename(); List<String> commands = ImmutableList.<String>builder() .add(BashCommands.installJavaLatestOrFail()) .addAll(BashCommands.commandsToDownloadUrlsAs(urls, saveAs)) .add(String.format("tar zxvf %s", saveAs)) .build(); newScript(INSTALLING).body.append(commands).execute(); setExpandedInstallDir(getInstallDir() + "/" + resolver.getUnpackedDirectoryName(format("elasticsearch-%s", getVersion()))); }
Source:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_search_compilations: getBaseActivity().startSupportActionMode(searchActionModeCallback); return true; default: return super.onOptionsItemSelected(item); } }

Target:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_search_compilations: ((AppCompatActivity) getActivity()).startSupportActionMode(searchActionModeCallback); return true; default: return super.onOptionsItemSelected(item); } }
Source:
public void setRetentionPolicy(RetentionPolicyType policyType, Object... params) { assert(m_retentionPolicy == null); switch(policyType) { case TIME_MS: m_retentionPolicy = RetentionPolicyMgr.getInstance().addTimeBasedRetentionPolicy(this, params); break; case MAX_BYTES: m_retentionPolicy = RetentionPolicyMgr.getInstance().addMaxBytesRetentionPolicy(this, params); break; } }

Target:
public void setRetentionPolicy(RetentionPolicyType policyType, Object... params) { assert(m_retentionPolicy == null); m_retentionPolicy = RetentionPolicyMgr.getInstance().addRetentionPolicy(policyType, this, params); }
Source:
public void shouldNeverConsiderCompletelyParsed() { Source source = null; SpiderHtmlFormParser htmlParser = createSpiderHtmlFormParser(); HttpMessage messageHtmlResponse = createMessageWith("NoForms.html"); boolean completelyParsed = htmlParser.parseResource(messageHtmlResponse, source, BASE_DEPTH); assertThat(completelyParsed, is(equalTo(false))); }

Target:
public void shouldNeverConsiderCompletelyParsed() { SpiderHtmlFormParser htmlParser = createSpiderHtmlFormParser(); HttpMessage messageHtmlResponse = createMessageWith("NoForms.html"); Source source = createSource(messageHtmlResponse); boolean completelyParsed = htmlParser.parseResource(messageHtmlResponse, source, BASE_DEPTH); assertThat(completelyParsed, is(equalTo(false))); }
Source:
public void stop() throws LifecycleException { try { target.stop(); } catch (LifecycleException ex) { throw(ex); } }

Target:
public void stop() throws LifecycleException { target.stop(); }
Source:
public void onTimer(MessageCollector collector, TaskCoordinator coordinator) { KeyValueStore<K, PartialJoinMessage<M>> thisState = thisPartialJoinFn.getState(); KeyValueIterator<K, PartialJoinMessage<M>> iterator = thisState.all(); List<K> keysToRemove = new ArrayList<>(); long now = System.currentTimeMillis(); while (iterator.hasNext()) { Entry<K, PartialJoinMessage<M>> entry = iterator.next(); if (entry.getValue().getTimestamp() < now - ttlMs) { keysToRemove.add(entry.getKey()); } else { break; } } thisState.deleteAll(keysToRemove); this.propagateTimer(collector, coordinator); }

Target:
public void onTimer(MessageCollector collector, TaskCoordinator coordinator) { long now = System.currentTimeMillis(); KeyValueStore<K, PartialJoinMessage<M>> thisState = thisPartialJoinFn.getState(); KeyValueIterator<K, PartialJoinMessage<M>> iterator = thisState.all(); List<K> keysToRemove = new ArrayList<>(); while (iterator.hasNext()) { Entry<K, PartialJoinMessage<M>> entry = iterator.next(); if (entry.getValue().getReceivedTimeMs() < now - ttlMs) { keysToRemove.add(entry.getKey()); } else { break; } } iterator.close(); thisState.deleteAll(keysToRemove); LOGGER.info("Operator ID onTimer self time: ms", opId, System.currentTimeMillis() - now); this.propagateTimer(collector, coordinator); }
Source:
public void sync(byte[] bytes) { if (dynamicConfigurationPassiveSync != null) { Set<Require> requires; try { requires = dynamicConfigurationPassiveSync.sync(DynamicConfigSyncData.decode(bytes)); } catch (NomadException n) { throw new RuntimeException(n); } catch (RuntimeException e) { throw e; } if (requires.contains(RESTART_REQUIRED)) { if (requires.contains(ZAP_REQUIRED)) { ServerEnv.getServer().warn("Zapping server"); ServerEnv.getServer().stop(StopAction.ZAP, StopAction.RESTART); } else { ServerEnv.getServer().stop(StopAction.RESTART); } } warnIfPreparedChange(); } }

Target:
public void sync(byte[] bytes) { if (dynamicConfigurationPassiveSync != null) { Set<Require> requires; try { requires = dynamicConfigurationPassiveSync.sync(DynamicConfigSyncData.decode(bytes)); } catch (NomadException n) { throw new RuntimeException(n); } if (requires.contains(RESTART_REQUIRED)) { if (requires.contains(ZAP_REQUIRED)) { ServerEnv.getServer().warn("Zapping server"); ServerEnv.getServer().stop(StopAction.ZAP, StopAction.RESTART); } else { ServerEnv.getServer().stop(StopAction.RESTART); } } warnIfPreparedChange(); } }
Source:
public List<Cohort> getCohortsContainingPatientId(Integer patientId, Boolean voided) throws DAOException { Disjunction orDisjunction = Restrictions.disjunction(); orDisjunction.add(Restrictions.isNull("m.endDate")); orDisjunction.add(Restrictions.gt("m.endDate", new Date())); return (List<Cohort>) sessionFactory.getCurrentSession().createCriteria(Cohort.class) .add(Restrictions.eq("voided", voided)) .createAlias("members", "m") .add(Restrictions.le("m.startDate", new Date())) .add(orDisjunction) .createAlias("m.patient", "p") .add(Restrictions.eq("p.patientId", patientId)) .setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY) .list(); }

Target:
public List<Cohort> getCohortsContainingPatientId(Integer patientId, Boolean voided) throws DAOException { Disjunction orDisjunction = Restrictions.disjunction(); orDisjunction.add(Restrictions.isNull("m.endDate")); orDisjunction.add(Restrictions.gt("m.endDate", new Date())); Patient p = new Patient(patientId); return (List<Cohort>) sessionFactory.getCurrentSession().createCriteria(Cohort.class) .add(Restrictions.eq("voided", voided)) .createAlias("members", "m") .add(Restrictions.le("m.startDate", new Date())) .add(orDisjunction) .add(Restrictions.eq("m.patient", p)) .setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY) .list(); }
Source:
void analyzeFiles(List<InputFile> inputFiles) throws IOException { List<String> tsConfigs = tsConfigs(); splitAnalysisByTsConfig(inputFiles, tsConfigs); }

Target:
void analyzeFiles(List<InputFile> inputFiles) throws IOException { List<String> tsConfigs = tsConfigs(); Map<TsConfigFile, List<InputFile>> filesByTsConfig = TsConfigFile.inputFilesByTsConfig(loadTsConfigs(tsConfigs), inputFiles); for (Map.Entry<TsConfigFile, List<InputFile>> entry : filesByTsConfig.entrySet()) { TsConfigFile tsConfigFile = entry.getKey(); List<InputFile> files = entry.getValue(); if (TsConfigFile.UNMATCHED_CONFIG.equals(tsConfigFile)) { LOG.info("Skipping files with no tsconfig.json", files.size()); LOG.debug("Skipped files: " + files.stream().map(InputFile::toString).collect(Collectors.joining("\n"))); continue; } LOG.info("Analyzing files using tsconfig: {}", files.size(), tsConfigFile); analyzeFilesWithTsConfig(files, tsConfigFile); eslintBridgeServer.newTsConfig(); } }
Source:
public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag) { ModifierNBT.IntegerNBT data = ModifierNBT.readInteger(modifierTag); boolean harvest = false; for(Category category : TagUtil.getCategories(rootCompound)) { if(category == Category.HARVEST) harvest = true; } ToolNBT toolData = TagUtil.getOriginalToolStats(rootCompound); NBTTagCompound tag = TagUtil.getToolTag(rootCompound); int level = data.current / max; if(harvest) { float speed = toolData.speed; for(int count = data.current; count > 0; count--) { if(speed <= 10f) { speed += 0.15f - 0.05f * speed / 10f; } else if(speed <= 20f) { speed += 0.1f - 0.05 * speed / 20f; } else { speed += 0.05; } } speed += level * 0.5f; speed -= toolData.speed; speed += tag.getFloat(Tags.MININGSPEED); tag.setFloat(Tags.MININGSPEED, speed); } float attackSpeed = 1.0f + (level * 0.2f); attackSpeed -= toolData.attackSpeed; attackSpeed += tag.getFloat(Tags.ATTACKSPEED); tag.setFloat(Tags.ATTACKSPEED, attackSpeed); }

Target:
public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag) { ModifierNBT.IntegerNBT modData = ModifierNBT.readInteger(modifierTag); boolean harvest = false; for(Category category : TagUtil.getCategories(rootCompound)) { if(category == Category.HARVEST) harvest = true; } ToolNBT data = TagUtil.getToolStats(rootCompound); int level = modData.current / max; if(harvest) { float speed = data.speed; for(int count = modData.current; count > 0; count--) { if(speed <= 10f) { speed += 0.15f - 0.05f * speed / 10f; } else if(speed <= 20f) { speed += 0.1f - 0.05 * speed / 20f; } else { speed += 0.05; } } speed += level * 0.5f; data.speed = speed; } data.attackSpeedMultiplier += (0.2f * modData.current / max); TagUtil.setToolTag(rootCompound, data.get()); }
Source:
protected Function1D<Double, Double> generate(BasisFunctionKnots data, final int index) { ArgumentChecker.notNull(data, "data"); ArgumentChecker.isTrue(index >= 0 && index < data.getNumSplines(), "index must be in range {] to (exclusive)", 0, data.getNumSplines()); return generate(data.getKnots(), data.getDegree(), index); }

Target:
protected Function1D<Double, Double> generate(BasisFunctionKnots data, final int index) { ArgumentChecker.notNull(data, "data"); ArgumentChecker.isTrue(index >= 0 && index < data.getNumSplines(), "index must be in range to (exclusive)", 0, data.getNumSplines()); return generate(data.getKnots(), data.getDegree(), index); }