auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public IdLookup idLookup() { final DimensionSelector keySelector = getKeySelector(); final DimensionSelector valueSelector = getValueSelector(); final IdLookup valueLookup = valueSelector.idLookup(); if (valueLookup != null) { final IndexedInts keyIndices = keySelector.getRow(); final IndexedInts valueIndices = valueSelector.getRow(); final int limit = Math.min(keyIndices.size(), valueIndices.size()); final int valueIndex = IntStream .range(0, limit) .filter(i -> subColumnName.equals(keySelector.lookupName(keyIndices.get(i)))) .findAny() .orElse(-1); return name -> { final int candidate = valueLookup.lookupId(name); if (candidate == valueIndex) { return candidate; } return -1; }; } else { return null; } }

Target:
public IdLookup idLookup() { final DimensionSelector valueSelector = getValueSelector(); final IdLookup valueLookup = valueSelector.idLookup(); if (valueLookup != null) { final int valueIndex = findValueIndicesIndexForSubColumn(); return name -> { final int candidate = valueLookup.lookupId(name); if (candidate == valueIndex) { return candidate; } return -1; }; } else { return null; } }
Source:
public void assertNoMBeans() { Set<ObjectInstance> instances = queryOurInstances(); assertEquals(Arrays.toString(instances.toArray()), 0, instances.size()); }

Target:
public void assertNoMBeans() { Set<ObjectInstance> instances = queryOurInstances(); assertEquals(0, instances.size()); }
Source:
public void testConfigLoad() { try { ServerConfiguration configuration = ConfigurationFileLoader.loadConfiguration(); assertEquals(configuration.getBooleanProperty(USE_CROSS_SITE_ORIGIN_FILTER), false); assertEquals(configuration.getProperty(ROOT_PACKAGE_FOR_CLASSPATH_SCAN), null); } catch (Exception e) { fail("Error in test", e); } }

Target:
public void testConfigLoad() { try { final ServerConfiguration configuration = ConfigurationFileLoader.loadConfiguration(); assertEquals(configuration.getBooleanProperty(USE_CROSS_SITE_ORIGIN_FILTER), false); assertEquals(configuration.getProperty(ROOT_PACKAGE_FOR_CLASSPATH_SCAN), null); } catch (Exception e) { fail("Error in test", e); } }
Source:
public void status() { final HttpServletResponse sresp = new HttpServletResponseFake( new RsEmpty() ); sresp.setStatus(502); MatcherAssert.assertThat( "Can't set a status in servlet response", sresp.getHeaders("HTTP/1.1"), Matchers.hasItem("HTTP/1.1 502 Bad Gateway") ); }

Target:
public void status() { final HttpServletResponse sresp = new HttpServletResponseFake( new RsEmpty() ); sresp.setStatus(502); new Assertion<>( "Can't set a status in servlet response", sresp.getHeaders(HttpServletResponseFakeTest.VERSION), new HasValues<>( HttpServletResponseFakeTest.ERROR ) ).affirm(); }
Source:
public void getCandidateApplicationsByCandidateShouldReturnAListWithThreeElements() { given(candidateRepository.findOne(FIRST_ID)).willReturn(candidateEntity); given(applicationsRepository.findByCandidateEntity(candidateEntity)).willReturn(applicationEntityListWithThreeElements); given(statesRepository.findTopByApplicationEntityOrderByStateIndexDesc(applicationEntity)).willReturn(stateEntity); Collection<CandidateApplicationDTO> candidateApplicationDTOCollection = statesService.getCandidateApplicationsByCandidateId(FIRST_ID); assertCandidateApplicationDTOCollection(candidateApplicationDTOCollection, getExpectedCandidateApplicationDTOListFromApplicationEntityListAndStateEntity(applicationEntityListWithThreeElements, stateEntity)); then(candidateRepository).should(times(AT_ONE_TIME)).findOne(FIRST_ID); then(applicationsRepository).should(times(AT_ONE_TIME)).findByCandidateEntity(candidateEntity); then(statesRepository).should(times(THREE_TIMES)).findTopByApplicationEntityOrderByStateIndexDesc(applicationEntity); }

Target:
public void getCandidateApplicationsByCandidateShouldReturnAListWithThreeElements() { given(candidateRepository.findOne(FIRST_ID)).willReturn(firstCandidateEntity); given(applicationsRepository.findByCandidateEntity(firstCandidateEntity)).willReturn(applicationEntityListWithThreeElements); given(statesRepository.findTopByApplicationEntityOrderByStateIndexDesc(firstApplicationEntity)).willReturn(firstStateEntity); given(statesRepository.findTopByApplicationEntityOrderByStateIndexDesc(secondApplicationEntity)).willReturn(secondStateEntity); given(statesRepository.findTopByApplicationEntityOrderByStateIndexDesc(thirdApplicationEntity)).willReturn(thirdStateEntity); Collection<CandidateApplicationDTO> candidateApplicationDTOCollection = statesService.getCandidateApplicationsByCandidateId(FIRST_ID); assertCandidateApplicationDTOCollection(candidateApplicationDTOCollection, candidateApplicationDTOListWithThreeElements); then(candidateRepository).should().findOne(FIRST_ID); then(applicationsRepository).should().findByCandidateEntity(firstCandidateEntity); then(statesRepository).should().findTopByApplicationEntityOrderByStateIndexDesc(firstApplicationEntity); then(statesRepository).should().findTopByApplicationEntityOrderByStateIndexDesc(secondApplicationEntity); then(statesRepository).should().findTopByApplicationEntityOrderByStateIndexDesc(thirdApplicationEntity); }
Source:
public Take route(final RqRegex req) throws IOException { final String path = req.matcher().group("path"); Response response = new RsWithType( new RsWithBody("Success!"), "text/html" ); try { this.storage.put( path, req.body() ); } catch (final IOException ex) { Logger.info( this, String.format( "Internal error saving to storage at %s: %s", path, ex.getMessage() ) ); response = new RsWithStatus( new RsWithBody( String.format( "Internal error saving to storage at %s", path ) ), 500 ); } return new TkFixed(response); }

Target:
public Take route(final RqRegex req) throws IOException { final String path = req.matcher().group("path"); Response response = new RsWithType( new RsWithBody("Success!"), "text/html" ); try { this.storage.put( path, req.body() ); } catch (final IOException ex) { Logger.error( this, String.format( "Internal error saving to storage at %s: %s", path, ex.getMessage() ) ); response = new RsWithStatus( new RsWithBody( String.format( "Internal error saving to storage at %s", path ) ), 500 ); } return new TkFixed(response); }
Source:
private InternalContainerResource createAndMapContainerResource(final WorkerResourceSpec workerResourceSpec) { final TaskExecutorProcessSpec taskExecutorProcessSpec = TaskExecutorProcessUtils.processSpecFromWorkerResourceSpec(flinkConfig, workerResourceSpec); final InternalContainerResource internalContainerResource = new InternalContainerResource( normalize(taskExecutorProcessSpec.getTotalProcessMemorySize().getMebiBytes(), unitMemMB), normalize(taskExecutorProcessSpec.getCpuCores().getValue().intValue(), unitVcore), externalResourceConfigs); if (resourceWithinMaxAllocation(internalContainerResource)) { containerResourceToWorkerSpecs.computeIfAbsent(internalContainerResource, ignored -> new HashSet<>()) .add(workerResourceSpec); containerMemoryToContainerResource.computeIfAbsent(internalContainerResource.memory, ignored -> new HashSet<>()) .add(internalContainerResource); return internalContainerResource; } else { LOG.warn("Requested container resource exceeds yarn max allocation {}. Will not allocate resource.", internalContainerResource, new InternalContainerResource(maxMemMB, maxVcore, Collections.emptyMap())); return null; } }

Target:
private InternalContainerResource createAndMapContainerResource(final WorkerResourceSpec workerResourceSpec) { final TaskExecutorProcessSpec taskExecutorProcessSpec = TaskExecutorProcessUtils.processSpecFromWorkerResourceSpec(flinkConfig, workerResourceSpec); final InternalContainerResource internalContainerResource = new InternalContainerResource( normalize(taskExecutorProcessSpec.getTotalProcessMemorySize().getMebiBytes(), minMemMB, unitMemMB), normalize(taskExecutorProcessSpec.getCpuCores().getValue().intValue(), minVcore, unitVcore), externalResourceConfigs); if (resourceWithinMaxAllocation(internalContainerResource)) { containerResourceToWorkerSpecs.computeIfAbsent(internalContainerResource, ignored -> new HashSet<>()) .add(workerResourceSpec); containerMemoryToContainerResource.computeIfAbsent(internalContainerResource.memory, ignored -> new HashSet<>()) .add(internalContainerResource); return internalContainerResource; } else { LOG.warn("Requested container resource exceeds yarn max allocation {}. Will not allocate resource.", internalContainerResource, new InternalContainerResource(maxMemMB, maxVcore, Collections.emptyMap())); return null; } }
Source:
public void testGetGroupsForUserFullRepresentation() { RealmResource realm = adminClient.realms().realm("test"); String userName = "averagejoe"; String groupName = "groupWithAttribute"; Map<String, List<String>> attributes = new HashMap<String, List<String>>(); attributes.put("attribute1", Arrays.asList("attribute1","attribute2")); try (Creator<GroupResource> g = Creator.create(realm, GroupBuilder.create().name(groupName).attributes(attributes).build())) { String groupId = g.resource().toRepresentation().getId(); UserRepresentation userRepresentation = UserBuilder .edit(createUserRepresentation(userName, "joe@average.com", "average", "joe", true)) .addPassword("password") .build(); try (Creator<UserResource> u = Creator.create(realm, userRepresentation)) { UserResource user = u.resource(); user.joinGroup(groupId); List<GroupRepresentation> userGroups = user.groups(0, 100, false); assertFalse(userGroups.isEmpty()); assertTrue(userGroups.get(0).getAttributes().containsKey("attribute1")); } } }

Target:
public void testGetGroupsForUserFullRepresentation() { RealmResource realm = adminClient.realms().realm("test"); String userName = "averagejoe"; String groupName = "groupWithAttribute"; Map<String, List<String>> attributes = new HashMap<String, List<String>>(); attributes.put("attribute1", Arrays.asList("attribute1","attribute2")); UserRepresentation userRepresentation = UserBuilder .edit(createUserRepresentation(userName, "joe@average.com", "average", "joe", true)) .addPassword("password") .build(); try (Creator<UserResource> u = Creator.create(realm, userRepresentation); Creator<GroupResource> g = Creator.create(realm, GroupBuilder.create().name(groupName).attributes(attributes).build())) { String groupId = g.id(); UserResource user = u.resource(); user.joinGroup(groupId); List<GroupRepresentation> userGroups = user.groups(0, 100, false); assertFalse(userGroups.isEmpty()); assertTrue(userGroups.get(0).getAttributes().containsKey("attribute1")); } }
Source:
private Operation<Void> actionComplete(final List<ResourceBasedNode<?>> nodes) { final ProjectConfigDto project = appContext.getCurrentProject().getRootProject(); return new Operation<Void>() { @Override public void apply(Void arg) throws OperationException { if (actionCompletedCallBack != null) { actionCompletedCallBack.onSuccess(null); } Map<String, List<String>> atributes = project.getAttributes(); if (!(atributes.containsKey("vcs.provider.name") && atributes.get("vcs.provider.name").contains("git")) || nodes.get(0) instanceof ProjectNode) { return; } final Unmarshallable<Status> unmarshall = dtoUnmarshallerFactory.newUnmarshaller(Status.class); gitService.status(project, new AsyncRequestCallback<Status>(unmarshall) { @Override protected void onSuccess(final Status result) { if (!result.getMissing().isEmpty()) { askAddToIndex(project, nodes, result.getMissing()); } } @Override protected void onFailure(Throwable exception) { notificationManager.notify("Git", exception.getMessage()); } }); } }; }

Target:
private Operation<Void> actionComplete(final List<ResourceBasedNode<?>> nodes) { final ProjectConfigDto project = appContext.getCurrentProject().getRootProject(); return new Operation<Void>() { @Override public void apply(Void arg) throws OperationException { if (actionCompletedCallBack != null) { actionCompletedCallBack.onSuccess(null); } Map<String, List<String>> atributes = project.getAttributes(); if (!(atributes.containsKey("vcs.provider.name") && atributes.get("vcs.provider.name").contains("git")) || nodes.get(0) instanceof ProjectNode) { return; } final Unmarshallable<Status> unmarshall = dtoUnmarshallerFactory.newUnmarshaller(Status.class); gitService.status(project, new AsyncRequestCallback<Status>(unmarshall) { @Override protected void onSuccess(final Status result) { if (!result.getMissing().isEmpty()) { askAddToIndex(project, nodes, result.getMissing()); } } @Override protected void onFailure(Throwable exception) { notificationManager.notify(exception.getMessage()); } }); } }; }
Source:
private String getSpecialName(MethodReference methodReference) { MethodReader method = classSource.resolve(methodReference); ClassReader cls = classSource.get(method.getReference().getClassName()); if (method == null) { return null; } AnnotationReader exportAnnot = method.getAnnotations().get(Export.class.getName()); if (exportAnnot != null && !ModelUtils.isScalaInternalClass(cls)) { return exportAnnot.getValue("name").getString(); } AnnotationReader importAnnot = method.getAnnotations().get(Import.class.getName()); if (importAnnot != null) { return importAnnot.getValue("name").getString(); } return null; }

Target:
private String getSpecialName(MethodReference methodReference) { MethodReader method = classSource.resolve(methodReference); if (method == null) { return null; } AnnotationReader exportAnnot = method.getAnnotations().get(Export.class.getName()); if (exportAnnot != null) { return exportAnnot.getValue("name").getString(); } AnnotationReader importAnnot = method.getAnnotations().get(Import.class.getName()); if (importAnnot != null) { return importAnnot.getValue("name").getString(); } return null; }
Source:
public Dialog build(Controller controller, Object... arguments) { String infoMessage = (String) arguments[0]; Skin skin = controller.getApplicationAssets().getSkin(); dialogController = new DialogController(skin, false, false); TopBottomLayout messageContainer = new TopBottomLayout(); TextArea text = new TextArea(infoMessage, skin); text.setLineCharacters(200); text.setDisabled(true); text.setPreferredLines(3); messageContainer.addTop(text); messageContainer.layout(); return dialogController.title("").root(messageContainer).getDialog(); }

Target:
public Dialog build(Controller controller, Object... arguments) { String infoMessage = (String) arguments[0]; Skin skin = controller.getApplicationAssets().getSkin(); dialogController = new DialogController(skin, false, false); TopBottomLayout messageContainer = new TopBottomLayout(); Label label = new Label(infoMessage, skin); messageContainer.addTop(label); return dialogController.title("").root(messageContainer).getDialog(); }
Source:
public Response retrieveMetadata() throws WSSecurityException, CertificateEncodingException { X509Certificate issuerCert = findCertificate(systemCrypto.getSignatureAlias(), systemCrypto.getSignatureCrypto()); X509Certificate encryptionCert = findCertificate(systemCrypto.getEncryptionAlias(), systemCrypto.getEncryptionCrypto()); String hostname = SystemBaseUrl.EXTERNAL.getHost(); String port = SystemBaseUrl.EXTERNAL.getPort(); String rootContext = SystemBaseUrl.EXTERNAL.getRootContext(); String entityId = String.format("https://%s:%s%s/saml", hostname, port, rootContext); String logoutLocation = String.format("https://%s:%s%s/saml/logout", hostname, port, rootContext); String assertionConsumerServiceLocation = String.format("https://%s:%s%s/saml/sso", hostname, port, rootContext); EntityDescriptor entityDescriptor = SamlProtocol.createSpMetadata( entityId, Base64.getEncoder().encodeToString(issuerCert.getEncoded()), Base64.getEncoder().encodeToString(encryptionCert.getEncoded()), logoutLocation, assertionConsumerServiceLocation, assertionConsumerServiceLocation, assertionConsumerServiceLocation); Document doc = DOMUtils.createDocument(); doc.appendChild(doc.createElement("root")); return Response.ok(DOM2Writer.nodeToString(OpenSAMLUtil.toDom(entityDescriptor, doc, false))) .build(); }

Target:
public Response retrieveMetadata() throws WSSecurityException, CertificateEncodingException { X509Certificate issuerCert = findCertificate(systemCrypto.getSignatureAlias(), systemCrypto.getSignatureCrypto()); X509Certificate encryptionCert = findCertificate(systemCrypto.getEncryptionAlias(), systemCrypto.getEncryptionCrypto()); String hostname = SystemBaseUrl.INTERNAL.getHost(); String port = SystemBaseUrl.INTERNAL.getPort(); String rootContext = SystemBaseUrl.INTERNAL.getRootContext(); String entityId = String.format("https://%s:%s%s/saml", hostname, port, rootContext); String logoutLocation = String.format("https://%s:%s%s/saml/logout", hostname, port, rootContext); String assertionConsumerServiceLocation = String.format("https://%s:%s%s/saml/sso", hostname, port, rootContext); EntityDescriptor entityDescriptor = SamlProtocol.createSpMetadata( entityId, Base64.getEncoder().encodeToString(issuerCert.getEncoded()), Base64.getEncoder().encodeToString(encryptionCert.getEncoded()), logoutLocation, assertionConsumerServiceLocation, assertionConsumerServiceLocation, assertionConsumerServiceLocation); Document doc = DOMUtils.createDocument(); doc.appendChild(doc.createElement("root")); return Response.ok(DOM2Writer.nodeToString(OpenSAMLUtil.toDom(entityDescriptor, doc, false))) .build(); }
Source:
private List<Map<String, Object>> parseDisks(XmlDocument document, List<VmDevice> devices) { List<VmDevice> dbDevices = filterDevices(devices, VmDeviceGeneralType.DISK); MemoizingSupplier<Map<Guid, String>> diskToLunSupplier = new MemoizingSupplier<>( () -> diskLunMapDao.getAll().stream().collect(Collectors.toMap( DiskLunMap::getDiskId, DiskLunMap::getLunId))); List<Map<String, Object>> result = new ArrayList<>(); for (XmlNode node : selectNodes(document, VmDeviceGeneralType.DISK)) { Map<String, Object> dev = new HashMap<>(); dev.put(VdsProperties.Type, VmDeviceGeneralType.DISK.getValue()); String diskType = parseAttribute(node, DEVICE); dev.put(VdsProperties.Device, diskType); dev.put(VdsProperties.Address, parseAddress(node)); dev.put(VdsProperties.Alias, parseAlias(node)); String path = parseDiskPath(node); VmDevice dbDev = dbDevices.stream() .filter(d -> { switch(diskType) { case "cdrom": String devicePath = (String) d.getSpecParams().get("path"); return devicePath == null || path.contains(devicePath); case "floppy": return true; default: Guid diskId = d.getId().getDeviceId(); return path.contains(diskId.toString()) || isPathContainsLunIdOfDisk(path, diskId, diskToLunSupplier); } }) .findFirst() .orElse(null); if (dbDev == null) { log.warn("unmanaged disk with path '{}' is ignored", path); continue; } dbDevices.remove(dbDev); dev.put(VdsProperties.DeviceId, dbDev.getId().getDeviceId().toString()); dev.put(VdsProperties.SpecParams, dbDev.getSpecParams()); result.add(dev); } return result; }

Target:
private List<Map<String, Object>> parseDisks(XmlDocument document, List<VmDevice> devices) { List<VmDevice> dbDevices = filterDevices(devices, VmDeviceGeneralType.DISK); MemoizingSupplier<Map<Guid, String>> diskToLunSupplier = new MemoizingSupplier<>( () -> diskLunMapDao.getAll().stream().collect(Collectors.toMap( DiskLunMap::getDiskId, DiskLunMap::getLunId))); List<Map<String, Object>> result = new ArrayList<>(); for (XmlNode node : selectNodes(document, VmDeviceGeneralType.DISK)) { Map<String, Object> dev = new HashMap<>(); dev.put(VdsProperties.Type, VmDeviceGeneralType.DISK.getValue()); String diskType = parseAttribute(node, DEVICE); dev.put(VdsProperties.Device, diskType); dev.put(VdsProperties.Address, parseAddress(node)); dev.put(VdsProperties.Alias, parseAlias(node)); String path = parseDiskPath(node); VmDevice dbDev = dbDevices.stream() .filter(d -> { switch(diskType) { case "cdrom": if (!diskType.equals(d.getDevice())) { return false; } String devicePath = (String) d.getSpecParams().get("path"); return devicePath == null || path.contains(devicePath); case "floppy": return diskType.equals(d.getDevice()); default: Guid diskId = d.getId().getDeviceId(); return path.contains(diskId.toString()) || isPathContainsLunIdOfDisk(path, diskId, diskToLunSupplier); } }) .findFirst() .orElse(null); if (dbDev == null) { log.warn("unmanaged disk with path '{}' is ignored", path); continue; } dbDevices.remove(dbDev); dev.put(VdsProperties.DeviceId, dbDev.getId().getDeviceId().toString()); dev.put(VdsProperties.SpecParams, dbDev.getSpecParams()); result.add(dev); } return result; }
Source:
public long getReadyTimestamp(Constraints viewConstraints) { String normalizedConstraints = getNormalizedConstraints(viewConstraints); Path signalPath = new Path(signalDirectory, normalizedConstraints); try { try { FileStatus signalStatus = rootFileSystem.getFileStatus(signalPath); return signalStatus.getModificationTime(); } catch (final FileNotFoundException ex) { } return -1; } catch (NumberFormatException e) { throw new DatasetException("Signal contents were modified to not be a number: " + signalPath, e); } catch (IOException e) { throw new DatasetIOException("Could not access signal path: " + signalPath, e); } }

Target:
public long getReadyTimestamp(Constraints viewConstraints) { String normalizedConstraints = getNormalizedConstraints(viewConstraints); Path signalPath = new Path(signalDirectory, normalizedConstraints); try { try { FileStatus signalStatus = rootFileSystem.getFileStatus(signalPath); return signalStatus.getModificationTime(); } catch (final FileNotFoundException ex) { } return -1; } catch (IOException e) { throw new DatasetIOException("Could not access signal path: " + signalPath, e); } }
Source:
public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { super.eventRaised(ev, sender, args); if (this.equals(sender)) { getChoiceGroupNone().setIsChangable(getIsChangable()); getChoiceGroupTotal().setIsChangable(getIsChangable()); getChoiceGroupReadWrite().setIsChangable(getIsChangable()); } else if (((EntityModel) sender).getEntity() == Boolean.TRUE) { if (!getChoiceGroupNone().equals(sender)) { getChoiceGroupNone().setEntity(false); } if (!getChoiceGroupTotal().equals(sender)) { getChoiceGroupTotal().setEntity(false); getTotal().setEntity(null); } if (!getChoiceGroupReadWrite().equals(sender)) { getChoiceGroupReadWrite().setEntity(false); getRead().setEntity(null); getWrite().setEntity(null); } updateChangeability(); } }

Target:
public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { super.eventRaised(ev, sender, args); if (this.equals(sender)) { getChoiceGroupNone().setIsChangable(getIsChangable()); getChoiceGroupTotal().setIsChangable(getIsChangable()); getChoiceGroupReadWrite().setIsChangable(getIsChangable()); } else if ((sender instanceof EntityModel) && ((EntityModel) sender).getEntity() == Boolean.TRUE) { if (!getChoiceGroupNone().equals(sender)) { getChoiceGroupNone().setEntity(false); } if (!getChoiceGroupTotal().equals(sender)) { getChoiceGroupTotal().setEntity(false); getTotal().setEntity(null); } if (!getChoiceGroupReadWrite().equals(sender)) { getChoiceGroupReadWrite().setEntity(false); getRead().setEntity(null); getWrite().setEntity(null); } updateChangeability(); } }
Source:
private void umount(String localRootPath) { if (!mountExists(localRootPath)) { return; } Script command = new Script(true, "umount", timeout, s_logger); command.add(localRootPath); String result = command.execute(); if (result != null) { String errMsg = "Unable to umount " + localRootPath + " due to " + result; s_logger.error(errMsg); throw new CloudRuntimeException(errMsg); } deleteMountPath(localRootPath); s_logger.debug("Successfully umounted " + localRootPath); }

Target:
private void umount(String localRootPath) { if (!mountExists(localRootPath)) { return; } Script command = new Script(true, "umount", timeout, s_logger); command.add(localRootPath); String result = command.execute(); if (result != null) { String errMsg = "Unable to umount " + localRootPath + " due to " + result; s_logger.error(errMsg); throw new CloudRuntimeException(errMsg); } deleteMountPath(localRootPath); s_logger.info("Successfully umounted " + localRootPath); }
Source:
private Boolean isValidIndex(int index) { Boolean isValid; if (index >= 0 && index <= this.actions.size()) { isValid = true; } else { isValid = false; } return isValid; }

Target:
private Boolean isValidIndex(int index) { return index >= 0 && index <= this.actions.size(); }
Source:
public void onAttach(Context context) { super.onAttach(context); rangePickerViewModel = new ViewModelProvider(requireActivity(), new ViewModelProvider.NewInstanceFactory()).get(RangePickerViewModel.class); }

Target:
public void onAttach(Context context) { super.onAttach(context); try { listener = (NumberPickerListener) context; } catch (ClassCastException e) { throw new ClassCastException(context.toString() + " must implement OnHeadlineSelectedListener"); } }
Source:
public void process(JSONRequestContext jsonRequestContext) { StudentGroupDAO studentGroupDAO = DAOFactory.getInstance().getStudentGroupDAO(); StudentGroupContactLogEntryDAO contactLogEntryDAO = DAOFactory.getInstance().getStudentGroupContactLogEntryDAO(); try { Long studentGroupId = NumberUtils.createLong(jsonRequestContext.getRequest().getParameter("studentGroupId")); StudentGroup studentGroup = studentGroupDAO.findById(studentGroupId); String entryText = jsonRequestContext.getRequest().getParameter("entryText"); String entryCreator = jsonRequestContext.getRequest().getParameter("entryCreatorName"); Date entryDate = new Date(NumberUtils.createLong(jsonRequestContext.getRequest().getParameter("entryDate"))); StudentContactLogEntryType entryType = StudentContactLogEntryType.valueOf(jsonRequestContext.getString("entryType")); StudentGroupContactLogEntry entry = contactLogEntryDAO.create(studentGroup, entryType, entryText, entryDate, entryCreator); Map<String, Object> info = new HashMap<String, Object>(); info.put("id", entry.getId()); info.put("creatorName", entry.getCreatorName()); info.put("timestamp", entry.getEntryDate().getTime()); info.put("text", entry.getText()); info.put("type", entry.getType()); info.put("studentGroupId", studentGroupId); jsonRequestContext.addResponseParameter("results", info); } catch (Exception e) { throw new SmvcRuntimeException(e); } }

Target:
public void process(JSONRequestContext jsonRequestContext) { StudentGroupDAO studentGroupDAO = DAOFactory.getInstance().getStudentGroupDAO(); StudentGroupContactLogEntryDAO contactLogEntryDAO = DAOFactory.getInstance().getStudentGroupContactLogEntryDAO(); Long studentGroupId = jsonRequestContext.getLong("studentGroupId"); if (studentGroupId == null) throw new SmvcRuntimeException(StatusCode.UNDEFINED, "StudentGroupId was not defined."); try { StudentGroup studentGroup = studentGroupDAO.findById(studentGroupId); String entryText = jsonRequestContext.getString("entryText"); String entryCreator = jsonRequestContext.getString("entryCreatorName"); Date entryDate = jsonRequestContext.getDate("entryDate"); StudentContactLogEntryType entryType = StudentContactLogEntryType.valueOf(jsonRequestContext.getString("entryType")); StudentGroupContactLogEntry entry = contactLogEntryDAO.create(studentGroup, entryType, entryText, entryDate, entryCreator); Map<String, Object> info = new HashMap<String, Object>(); info.put("id", entry.getId()); info.put("creatorName", entry.getCreatorName()); info.put("timestamp", entry.getEntryDate() != null ? entry.getEntryDate().getTime() : ""); info.put("text", entry.getText()); info.put("type", entry.getType()); info.put("studentGroupId", studentGroupId); jsonRequestContext.addResponseParameter("results", info); } catch (Exception e) { throw new SmvcRuntimeException(e); } }
Source:
private <T> List<T> getOpenEditorsByType(Class<T> clazz) { return FluentIterable.from(Arrays.asList(page.getEditorReferences())) .transform(new Function<IEditorReference, IEditorPart>() { @Override public IEditorPart apply(IEditorReference ref) { return ref.getEditor(true); } }) .filter(clazz) .toList(); }

Target:
private <T> Set<T> getOpenEditorsByType(Class<T> clazz) { return FluentIterable.from(Arrays.asList(page.getEditorReferences())) .transform(new Function<IEditorReference, IEditorPart>() { @Override public IEditorPart apply(IEditorReference ref) { return ref.getEditor(true); } }) .filter(clazz) .toSet(); }
Source:
public void testEquals() throws Exception { FixedWidthConfiguration conf1 = new FixedWidthConfiguration(1, "UTF8", 10, true, false, true); FixedWidthConfiguration conf2 = new FixedWidthConfiguration(1, "UTF8", 10, true, false, true); assertEquals(conf1, conf2); FixedWidthConfiguration conf3 = new FixedWidthConfiguration(1, "UTF8", 10, false, false, true); assertFalse(conf1.equals(conf3)); }

Target:
public void testEquals() throws Exception { FixedWidthConfiguration conf1 = new FixedWidthConfiguration(1, "UTF8", 10, true); FixedWidthConfiguration conf2 = new FixedWidthConfiguration(1, "UTF8", 10, true); assertEquals(conf1, conf2); FixedWidthConfiguration conf3 = new FixedWidthConfiguration(1, "UTF8", 10, false); assertFalse(conf1.equals(conf3)); }
Source:
protected void executeVdsBrokerCommand() { try { DeviceInfoReturn deviceInfoReturn = getBroker().attachManagedBlockStorageVolume(getParameters().getVolumeId(), JsonHelper.mapToJson(getParameters().getConnectionInfo())); setReturnValue(deviceInfoReturn.getDeviceInfo()); } catch (IOException e) { log.error("attachment of managed block storage device failed {}", e); return; } }

Target:
protected void executeVdsBrokerCommand() { DeviceInfoReturn deviceInfoReturn = getBroker().attachManagedBlockStorageVolume(getParameters().getVolumeId(), getParameters().getConnectionInfo()); setReturnValue(deviceInfoReturn.getDeviceInfo()); }
Source:
private void ensurePowerOfTwo(String parameter, int number) { if (Integer.bitCount(number) > 1) { LOG.debug("Parameter should be power of two but was {}", parameter, number); } }

Target:
private void ensurePowerOfTwo(String parameter, int number) { if (Integer.bitCount(number) > 1) { LOG.warn("Parameter should be power of two but was {}", parameter, number); } }
Source:
JoystickOptionsPanel(JoystickOptionsPanelController controller) { super(controller); joystickService = CentralLookup.getDefault().lookup(JoystickServiceImpl.class); joystickService.addListener(this); super.setLayout(new BorderLayout()); }

Target:
JoystickOptionsPanel(JoystickOptionsPanelController controller) { super(controller); joystickService = CentralLookup.getDefault().lookup(JoystickService.class); joystickService.addListener(this); super.setLayout(new BorderLayout()); }
Source:
public void processRecord(ComputationContext context, String inputStreamName, Record record) { Codec<DataBucket> codec = BulkCodecs.getDataBucketCodec(); DataBucket in = codec.decode(record.getData()); String commandId = in.getCommandId(); String storeName = Framework.getService(BulkService.class).getStatus(commandId).getAction(); Blob tmpBlob = getBlob(in.getDataAsString(), storeName); tmpBlob = sort(tmpBlob, commandId); Path path = createTemp(commandId); try (InputStream is = tmpBlob.getStream(); FileOutputStream os = new FileOutputStream(path.toFile(), true)) { os.write(in.getHeader()); IOUtils.copy(is, os); os.write(in.getFooter()); os.flush(); tmpBlob.getFile().delete(); } catch (IOException e) { log.error("Unable to copy header/footer", e); } storeBlob(new FileBlob(path.toFile()), commandId, storeName); BulkCommand command = Framework.getService(BulkService.class).getCommand(commandId); if (command.getParam(ZIP_PARAMETER) != null) { zip = command.getParam(ZIP_PARAMETER); } String outputStream = zip ? OUTPUT_1 : OUTPUT_2; DataBucket out = new DataBucket(commandId, in.getCount(), getTransientStoreKey(commandId)); context.produceRecord(outputStream, Record.of(commandId, codec.encode(out))); context.askForCheckpoint(); }

Target:
public void processRecord(ComputationContext context, String inputStreamName, Record record) { Codec<DataBucket> codec = BulkCodecs.getDataBucketCodec(); DataBucket in = codec.decode(record.getData()); String commandId = in.getCommandId(); String storeName = Framework.getService(BulkService.class).getStatus(commandId).getAction(); Blob tmpBlob = getBlob(in.getDataAsString(), storeName); tmpBlob = sort(tmpBlob, commandId); Path path = createTemp(commandId); try (InputStream is = tmpBlob.getStream(); FileOutputStream os = new FileOutputStream(path.toFile(), true)) { os.write(in.getHeader()); IOUtils.copy(is, os); os.write(in.getFooter()); os.flush(); tmpBlob.getFile().delete(); } catch (IOException e) { log.error("Unable to copy header/footer", e); } storeBlob(new FileBlob(path.toFile()), commandId, storeName); BulkCommand command = Framework.getService(BulkService.class).getCommand(commandId); boolean zip = command.getParam(ZIP_PARAMETER) != null ? command.getParam(ZIP_PARAMETER) : false; String outputStream = zip ? ZIP_STREAM : EXPOSE_BLOB_STREAM; DataBucket out = new DataBucket(commandId, in.getCount(), getTransientStoreKey(commandId)); context.produceRecord(outputStream, Record.of(commandId, codec.encode(out))); context.askForCheckpoint(); }
Source:
private static String formatTimeRelative(long time, Resolution resolution) { StringBuffer str = new StringBuffer(); if (time < 0) { str.append('-'); } long totalSecond = 0; long ns = Math.abs(time); long seconds = TimeUnit.NANOSECONDS.toSeconds(ns); long minutes = TimeUnit.NANOSECONDS.toMinutes(ns); long hours = TimeUnit.NANOSECONDS.toHours(ns); long days = TimeUnit.NANOSECONDS.toDays(ns); if (days > 0) { totalSecond = days * SECONDS_PER_DAY; } if (hours > 0) { totalSecond = hours * SECONDS_PER_HOUR; } if (minutes > 0) { totalSecond = minutes * SECONDS_PER_MIN; } str.append(totalSecond + seconds); str.append('.'); str.append(formatNs(time, resolution)); str.append("s"); if (seconds == 0) { str.append(" ("); str.append(new DecimalUnitFormat(1.0 / SEC_IN_NS).format(time)); str.append("s)"); } return str.toString(); }

Target:
private static String formatTimeRelative(long time, Resolution resolution) { StringBuffer str = new StringBuffer(); if (time < 0) { str.append('-'); } long ns = Math.abs(time); long seconds = TimeUnit.NANOSECONDS.toSeconds(ns); str.append(seconds); str.append('.'); str.append(formatNs(time, resolution)); str.append('s'); if (seconds == 0) { str.append(" ("); str.append(new DecimalUnitFormat(1.0 / SEC_IN_NS).format(time)); str.append("s)"); } return str.toString(); }
Source:
public void setPlayerTest() { worldManager.setPlayer(p1); assertTrue(worldManager.getPlayer().equals(new Player(physicsWorld, new Vector2(0, 0), new Vector2(20, 20)))); worldManager.setPlayer(new Player(physicsWorld, new Vector2(1, 0), new Vector2(20, 20))); assertTrue(worldManager.getPlayer().equals(new Player(physicsWorld, new Vector2(1, 0), new Vector2(20, 20)))); }

Target:
public void setPlayerTest() { worldManager.setPlayer(p1); assertEquals(worldManager.getPlayer(), new Player(physicsWorld, new Vector2(0, 0), new Vector2(20, 20))); worldManager.setPlayer(new Player(physicsWorld, new Vector2(1, 0), new Vector2(20, 20))); assertEquals(worldManager.getPlayer(), new Player(physicsWorld, new Vector2(1, 0), new Vector2(20, 20))); }
Source:
public void performFiltering() { CallFilter dummyStart = new CallFilter(); mDummyComplete = new CallFilter(); for (CallFilter filter : mFiltersList) { addEdge(dummyStart, filter); } for (CallFilter filter : mFiltersList) { addEdge(filter, mDummyComplete); } addEdge(dummyStart, mDummyComplete); mHandler.post(() -> scheduleFilter(dummyStart)); }

Target:
public void performFiltering() { CallFilter dummyStart = new CallFilter(); mDummyComplete = new CallFilter(); for (CallFilter filter : mFiltersList) { addEdge(dummyStart, filter); } for (CallFilter filter : mFiltersList) { addEdge(filter, mDummyComplete); } addEdge(dummyStart, mDummyComplete); scheduleFilter(dummyStart); mHandler.postDelayed(() -> { if (!mFinished) { Log.i(this, "Graph timed out when perform filtering."); mListener.onCallFilteringComplete(mCall, mCurrentResult); mFinished = true; } }, mTimeoutsAdapter.getCallScreeningTimeoutMillis(mContext.getContentResolver())); }
Source:
public Object[] transform(InputRow inputRow) { final Charset usedCharset = Charset.forName(charset); final String requestBody = applyVariablesToString(this.requestBody, inputRow); final String url = applyVariablesToString(this.url, inputRow); final HttpUriRequest request = method.createRequest(url); if (requestBody != null && request instanceof HttpEntityEnclosingRequest) { HttpEntity entity = new StringEntity(requestBody, usedCharset); ((HttpEntityEnclosingRequest) request).setEntity(entity); } if (headers != null) { final Set<Entry<String, String>> entries = headers.entrySet(); for (Entry<String, String> entry : entries) { request.setHeader(entry.getKey(), entry.getValue()); } } final ServiceResult<Object[]> result = _session.invokeService(new Callable<Object[]>() { @Override public Object[] call() throws Exception { final HttpResponse response = _httpClient.execute(request); final int statusCode = response.getStatusLine().getStatusCode(); final String body = EntityUtils.toString(response.getEntity(), usedCharset); return new Object[] { statusCode, body }; } }); if (!result.isSuccesfull()) { final Throwable error = result.getError(); if (error instanceof RuntimeException) { throw (RuntimeException) error; } throw new RuntimeException(error); } return result.getResponse(); }

Target:
public Object[] transform(InputRow inputRow) { final Charset usedCharset = Charset.forName(charset); final String requestBody = applyVariablesToString(this.requestBody, inputRow); final String url = applyVariablesToString(this.url, inputRow); final HttpUriRequest request = method.createRequest(url); if (!Strings.isNullOrEmpty(requestBody) && request instanceof HttpEntityEnclosingRequest) { final HttpEntity entity = new StringEntity(requestBody, usedCharset); ((HttpEntityEnclosingRequest) request).setEntity(entity); } if (headers != null) { final Set<Entry<String, String>> entries = headers.entrySet(); for (Entry<String, String> entry : entries) { request.setHeader(entry.getKey(), entry.getValue()); } } final ServiceResult<Object[]> result = _session.invokeService(new Callable<Object[]>() { @Override public Object[] call() throws Exception { final HttpResponse response = _httpClient.execute(request); final int statusCode = response.getStatusLine().getStatusCode(); final String body = EntityUtils.toString(response.getEntity(), usedCharset); return new Object[] { statusCode, body }; } }); if (!result.isSuccesfull()) { final Throwable error = result.getError(); if (error instanceof RuntimeException) { throw (RuntimeException) error; } throw new RuntimeException(error); } return result.getResponse(); }
Source:
private void setCohort(Cohort cohort) { this.cohort = cohort; }

Target:
protected void setCohort(Cohort cohort) { this.cohort = cohort; }
Source:
public void testSplitKeys() throws IOException { byte[][] splits = new byte[][] { Bytes.toBytes("AAA"), Bytes.toBytes("BBB"), Bytes.toBytes("CCC"), }; Admin admin = getConnection().getAdmin(); TableName tableName = TableName.valueOf("TestTableWithSplits"); HTableDescriptor descriptor = new HTableDescriptor(tableName); descriptor.addFamily(new HColumnDescriptor(COLUMN_FAMILY)); try { if (admin.tableExists(tableName)) { LOG.warn("Not creating the table since it exists: %s", tableName); } else { admin.createTable(descriptor, splits); RegionLocator locator = getConnection().getRegionLocator(tableName); List<HRegionLocation> regions = locator.getAllRegionLocations(); Assert.assertEquals(splits.length + 1, regions.size()); for (int i = 0; i < regions.size(); i++) { HRegionLocation region = regions.get(i); String start_key = new String(region.getRegionInfo().getStartKey()); String end_key = new String(region.getRegionInfo().getEndKey()); if (i == 0) { Assert.assertEquals(new String(splits[0]), end_key); } else if (i == regions.size() - 1) { Assert.assertEquals(new String(splits[splits.length - 1]), start_key); } else { Assert.assertEquals(new String(splits[i-1]), start_key); Assert.assertEquals(new String(splits[i]), end_key); } } } } finally { try { admin.disableTable(tableName); admin.deleteTable(tableName); } catch (Throwable t) { LOG.warn("Error cleaning up the table", t); } } }

Target:
public void testSplitKeys() throws IOException { byte[][] splits = new byte[][] { Bytes.toBytes("AAA"), Bytes.toBytes("BBB"), Bytes.toBytes("CCC"), }; Admin admin = getConnection().getAdmin(); TableName tableName = TableName.valueOf("TestTableWithSplits"); HTableDescriptor descriptor = new HTableDescriptor(tableName); descriptor.addFamily(new HColumnDescriptor(COLUMN_FAMILY)); try { if (admin.tableExists(tableName)) { LOG.warn("Not creating the table since it exists: %s", tableName); } else { admin.createTable(descriptor, splits); List<HRegionLocation> regions = null; try (RegionLocator locator = getConnection().getRegionLocator(tableName)) { regions = locator.getAllRegionLocations(); } Assert.assertEquals(splits.length + 1, regions.size()); for (int i = 0; i < regions.size(); i++) { HRegionLocation region = regions.get(i); String start_key = Bytes.toString( region.getRegionInfo().getStartKey()); String end_key = Bytes.toString(region.getRegionInfo().getEndKey()); if (i == 0) { Assert.assertEquals(Bytes.toString(splits[0]), end_key); } else if (i == regions.size() - 1) { Assert.assertEquals(Bytes.toString(splits[splits.length - 1]), start_key); } else { Assert.assertEquals(Bytes.toString(splits[i-1]), start_key); Assert.assertEquals(Bytes.toString(splits[i]), end_key); } } } } finally { try { admin.disableTable(tableName); admin.deleteTable(tableName); } catch (Throwable t) { LOG.warn("Error cleaning up the table", t); } } }
Source:
public void set(Subscription s) { if (s == null) { throw new IllegalArgumentException("Subscription can not be null"); } State oldState; State newState; do { oldState = state.get(); if (oldState.isUnsubscribed) { s.unsubscribe(); return; } else { newState = oldState.set(s); } } while (!state.compareAndSet(oldState, newState)); }

Target:
public void set(Subscription s) { if (s == null) { throw new IllegalArgumentException("Subscription can not be null"); } State oldState; State newState; final AtomicReference<State> localState = this.state; do { oldState = localState.get(); if (oldState.isUnsubscribed) { s.unsubscribe(); return; } else { newState = oldState.set(s); } } while (!localState.compareAndSet(oldState, newState)); }
Source:
protected void applyRow(SnomedAssociationRefSetMember member, AssociatingRefSetRow row, Collection<SnomedAssociationRefSetMember> componentsToAttach) { member.setUuid(row.getUuid().toString()); if (row.getEffectiveTime() != null) { member.setEffectiveTime(row.getEffectiveTime()); member.setReleased(true); } else { member.unsetEffectiveTime(); } member.setRefSet(getOrCreateRefSet(row.getRefSetId(), row.getReferencedComponentId())); member.setActive(row.isActive()); member.setModuleId(row.getModuleId()); member.setReferencedComponentId(row.getReferencedComponentId()); member.setTargetComponentId(row.getAssociatedComponentId()); }

Target:
protected void applyRow(SnomedAssociationRefSetMember member, AssociatingRefSetRow row, Collection<SnomedAssociationRefSetMember> componentsToAttach) { if (row.getEffectiveTime() != null) { member.setEffectiveTime(row.getEffectiveTime()); member.setReleased(true); } else { member.unsetEffectiveTime(); } member.setRefSet(getOrCreateRefSet(row.getRefSetId(), row.getReferencedComponentId())); member.setActive(row.isActive()); member.setModuleId(row.getModuleId()); member.setReferencedComponentId(row.getReferencedComponentId()); member.setTargetComponentId(row.getAssociatedComponentId()); }
Source:
public Object getRecordState(Object record, Schema schema) { return null; }

Target:
protected Object getRecordState(Object record, Schema schema) { return null; }
Source:
public ValueType get(final Object key) { if (key instanceof Tuple) { final Object value = ((Tuple) key).get(((Tuple) key).getSize() - 1); final Object unwrappedValue = this.runtimeContext.unwrapElement(value); return this.mappings.get(unwrappedValue); } else { return null; } }

Target:
public ValueType get(final Object key) { if (key instanceof Tuple) { final Object value = ((Tuple) key).get(this.groupSize); final Object unwrappedValue = this.runtimeContext.unwrapElement(value); return this.mappings.get(unwrappedValue); } else { return null; } }
Source:
private HashSet<String> getIgnoredViews() { if (ignoredViews == null) { ignoredViews = new HashSet<>(); IExtensionRegistry registry = RegistryFactory.getRegistry(); IExtensionPoint ep = registry.getExtensionPoint(EXT_POINT); if (ep != null) { IExtension[] extensions = ep.getExtensions(); for (int i = 0; i < extensions.length; i++) { IConfigurationElement[] elements = extensions[i].getConfigurationElements(); for (int j = 0; j < elements.length; j++) { if ("excludeSources".equalsIgnoreCase(elements[j].getName())) { String id = elements[j].getAttribute("id"); if (id != null) ignoredViews.add(id); } } } } } return ignoredViews; }

Target:
private Set<String> getIgnoredViews() { if (ignoredViews == null) { ignoredViews = new HashSet<>(); IExtensionRegistry registry = RegistryFactory.getRegistry(); IExtensionPoint ep = registry.getExtensionPoint(EXT_POINT); if (ep != null) { IExtension[] extensions = ep.getExtensions(); for (IExtension extension : extensions) { IConfigurationElement[] elements = extension.getConfigurationElements(); for (IConfigurationElement element : elements) { if ("excludeSources".equalsIgnoreCase(element.getName())) { String id = element.getAttribute("id"); if (id != null) ignoredViews.add(id); } } } } } return ignoredViews; }
Source:
public FilterBuilder withVariantTypes(VariantType variantType) { if (variantType != null) { filters.add(new VariantRepositoryTypeFilter(new ArrayList<>(Arrays.asList(variantType)))); } return this; }

Target:
public FilterBuilder withVariantTypes(VariantType variantType) { if (variantType != null) { filters.add(new VariantRepositoryTypeFilter(Collections.singletonList(variantType))); } return this; }
Source:
private boolean shouldProcessAuthorizationResponse(HttpServletRequest request) { OAuth2AuthorizationRequest authorizationRequest = this.authorizationRequestRepository.loadAuthorizationRequest(request); if (authorizationRequest == null) { return false; } MultiValueMap<String, String> params = OAuth2AuthorizationResponseUtils.toMultiMap(request.getParameterMap()); if (isValidRedirectUrl(request, authorizationRequest.getRedirectUri()) && OAuth2AuthorizationResponseUtils.isAuthorizationResponse(params)) { return true; } return false; }

Target:
private boolean shouldProcessAuthorizationResponse(HttpServletRequest request) { OAuth2AuthorizationRequest authorizationRequest = this.authorizationRequestRepository.loadAuthorizationRequest(request); if (authorizationRequest == null) { return false; } MultiValueMap<String, String> params = OAuth2AuthorizationResponseUtils.toMultiMap(request.getParameterMap()); if (OAuth2AuthorizationResponseUtils.isAuthorizationResponse(params) && isValidRedirectUrl(request, authorizationRequest.getRedirectUri())) { return true; } return false; }
Source:
private static RealMatrix tangentNormalize(final RealMatrix normals, final RealMatrix input, final RealMatrix betaHats) { if (input.getColumnDimension() != betaHats.getColumnDimension()) { throw new IllegalArgumentException(String.format("the input count column count (%d) does not match the number of columns in the beta-hats (%d)", input.getColumnDimension(), betaHats.getColumnDimension())); } if (normals.getColumnDimension() != betaHats.getRowDimension()) { throw new IllegalArgumentException(String.format("beta-hats component count (%d) does not match the number of samples in the PoN (%d)", normals.getRowDimension(), normals.getColumnDimension())); } final RealMatrix projection = normals.multiply(betaHats); return input.subtract(projection); }

Target:
private static RealMatrix tangentNormalize(final RealMatrix normals, final RealMatrix input, final RealMatrix betaHats) { Utils.validateArg(input.getColumnDimension() == betaHats.getColumnDimension(), String.format("the input count column count (%d) does not match the number of columns in the beta-hats (%d)", input.getColumnDimension(), betaHats.getColumnDimension())); Utils.validateArg(normals.getColumnDimension() == betaHats.getRowDimension(), String.format("beta-hats component count (%d) does not match the number of samples in the PoN (%d)", normals.getRowDimension(), normals.getColumnDimension())); final RealMatrix projection = normals.multiply(betaHats); return input.subtract(projection); }