auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void createContentIfNotCreated(DataSource ds) { try { datasource = ds; Connection conn = ds.getConnection(); DatabaseMetaData dbmeta = conn.getMetaData(); final String dbName = dbmeta.getDatabaseProductName().replace(' ', '_'); if (!hasOskariTables(dbmeta)) { getLog().info("Creating db for " + dbName); executeSqlFromFile(conn, dbName, "create-base-tables.sql"); createContent(conn, dbName, "register-bundles.json"); executeSqlFromFile(conn, dbName, "add-default-roles.sql"); executeSqlFromFile(conn, dbName, "add-internal-dataprovider.sql"); createContent(conn, dbName); try { if(!conn.getAutoCommit()) { conn.commit(); } } catch (SQLException e) { getLog().error(e, "Couldn't commit changes!"); } } else { getLog().info("Existing tables found in db. Not creating initial tables"); } } catch (Exception e) { getLog().error(e, "Error creating db content!"); } }

Target:
public static void createContentIfNotCreated(DataSource ds) { try { datasource = ds; Connection conn = ds.getConnection(); DatabaseMetaData dbmeta = conn.getMetaData(); final String dbName = dbmeta.getDatabaseProductName().replace(' ', '_'); if (doesNotHaveOskariTables(dbmeta)) { getLog().info("Creating db for " + dbName); executeSqlFromFile(conn, dbName, "create-base-tables.sql"); createContent(conn, dbName, "register-bundles.json"); executeSqlFromFile(conn, dbName, "add-default-roles.sql"); executeSqlFromFile(conn, dbName, "add-internal-dataprovider.sql"); createContent(conn, dbName); try { if(!conn.getAutoCommit()) { conn.commit(); } } catch (SQLException e) { getLog().error(e, "Couldn't commit changes!"); } } else { getLog().info("Existing tables found in db. Not creating initial tables"); } } catch (Exception e) { getLog().error(e, "Error creating db content!"); } }
Source:
public void showSourceFeedback(Request request) { MoveEdgeGroupManager nodesGroupMoveManager = new MoveEdgeGroupManager(request); if (nodesGroupMoveManager.isToolActivated()) { nodesGroupMoveManager.showGroupFeedback(); } else { nodesGroupMoveManager.eraseGroupFeedback(); if (getLineSegMode() != LineMode.OBLIQUE) { if (REQ_CREATE_BENDPOINT.equals(request.getType())) { showMoveLineSegFeedback((BendpointRequest) request); } else if (REQ_MOVE_BENDPOINT.equals(request.getType())) { showMoveOrthogonalBendpointFeedback2((BendpointRequest) request); } } else { if (REQ_MOVE_BENDPOINT.equals(request.getType())) { showMoveBendpointFeedback((BendpointRequest) request); } else if (REQ_CREATE_BENDPOINT.equals(request.getType())) { showCreateBendpointFeedback((BendpointRequest) request); } } super.showSourceFeedback(request); } }

Target:
public void showSourceFeedback(Request request) { MoveEdgeGroupManager nodesGroupMoveManager = new MoveEdgeGroupManager(request); if (nodesGroupMoveManager.isToolActivated()) { nodesGroupMoveManager.showGroupFeedback(); } else { nodesGroupMoveManager.eraseGroupFeedback(); if (getLineSegMode() != LineMode.OBLIQUE) { if (REQ_CREATE_BENDPOINT.equals(request.getType())) { showMoveLineSegFeedback((BendpointRequest) request); } else if (REQ_MOVE_BENDPOINT.equals(request.getType())) { showMoveOrthogonalBendpointFeedback2((BendpointRequest) request); } } else { if (REQ_MOVE_BENDPOINT.equals(request.getType())) { showMoveBendpointFeedback((BendpointRequest) request); } else if (REQ_CREATE_BENDPOINT.equals(request.getType())) { showCreateBendpointFeedback((BendpointRequest) request); } } } }
Source:
private void indexNotNullArray(String name, Object value, Document document, LuceneOptions luceneOptions) { for ( int i = 0, length = Array.getLength( value ) ; i < length ; ++i ) { Object entry = Array.get( value, i ); indexEntry( name, entry, document, luceneOptions ); } }

Target:
private void indexNotNullArray(String name, Object value, Document document, LuceneOptions luceneOptions) { for ( Object entry : CollectionHelper.iterableFromArray( value ) ) { indexEntry( name, entry, document, luceneOptions ); } }
Source:
public void clearDFA() { }

Target:
public void clearDFA() { throw new UnsupportedOperationException("This ATN simulator does not support clearing the DFA."); }
Source:
public void success() { CommCareApplication._().getCurrentApp().setResourcesValidated(); if(Intent.ACTION_VIEW.equals(CommCareVerificationActivity.this.getIntent().getAction())) { Intent i = new Intent(getApplicationContext(), CommCareHomeActivity.class); i.putExtra(KEY_REQUIRE_REFRESH, true); startActivity(i); startActivity(i); } else { Intent i = new Intent(getIntent()); i.putExtra(KEY_REQUIRE_REFRESH, true); setResult(RESULT_OK, i); } finish(); }

Target:
public void success() { CommCareApplication._().getCurrentApp().setMMResourcesValidated(); if(Intent.ACTION_VIEW.equals(CommCareVerificationActivity.this.getIntent().getAction())) { Intent i = new Intent(getApplicationContext(), CommCareHomeActivity.class); i.putExtra(KEY_REQUIRE_REFRESH, true); startActivity(i); } else { Intent i = new Intent(getIntent()); i.putExtra(KEY_REQUIRE_REFRESH, true); setResult(RESULT_OK, i); } finish(); }
Source:
public void updateQueryResults( final TransactionBase tx, final VisibilityBindingSet childBindingSet, final QueryMetadata queryMetadata) throws Exception { checkNotNull(tx); checkNotNull(childBindingSet); checkNotNull(queryMetadata); log.trace( "Transaction ID: " + tx.getStartTimestamp() + "\n" + "Join Node ID: " + queryMetadata.getNodeId() + "\n" + "Child Node ID: " + queryMetadata.getChildNodeId() + "\n" + "Child Binding Set:\n" + childBindingSet + "\n"); final VariableOrder queryVarOrder = queryMetadata.getVariableOrder(); final Bytes resultRow = getRowKey(queryMetadata.getNodeId(), queryVarOrder, childBindingSet); final Bytes nodeValueBytes = BS_SERDE.serialize(childBindingSet); log.trace( "Transaction ID: " + tx.getStartTimestamp() + "\n" + "New Binding Set: " + childBindingSet + "\n"); tx.set(resultRow, FluoQueryColumns.QUERY_BINDING_SET, nodeValueBytes); }

Target:
public void updateQueryResults( final TransactionBase tx, final VisibilityBindingSet childBindingSet, final QueryMetadata queryMetadata) throws Exception { checkNotNull(tx); checkNotNull(childBindingSet); checkNotNull(queryMetadata); log.trace( "Transaction ID: " + tx.getStartTimestamp() + "\n" + "Join Node ID: " + queryMetadata.getNodeId() + "\n" + "Child Node ID: " + queryMetadata.getChildNodeId() + "\n" + "Child Binding Set:\n" + childBindingSet + "\n"); final VariableOrder queryVarOrder = queryMetadata.getVariableOrder(); final Bytes resultRow = makeRowKey(queryMetadata.getNodeId(), queryVarOrder, childBindingSet); final Bytes nodeValueBytes = BS_SERDE.serialize(childBindingSet); log.trace( "Transaction ID: " + tx.getStartTimestamp() + "\n" + "New Binding Set: " + childBindingSet + "\n"); tx.set(resultRow, FluoQueryColumns.QUERY_BINDING_SET, nodeValueBytes); }
Source:
public void load(final String text) { fTestFiles.clear(); fVariables.clear(); fCodeFragments.clear(); fFlags.clear(); try { final XMLMemento memento = XMLMemento.createReadRoot(new StringReader(text)); final IMemento testsNode = memento.getChild(XML_NODE_TESTFILES); if (testsNode != null) { for (final IMemento node : testsNode.getChildren(XML_NODE_TESTFILE)) fTestFiles.add(node.getTextData()); } final IMemento variablesNode = memento.getChild(XML_NODE_VARIABLES); if (variablesNode != null) { for (final IMemento node : variablesNode.getChildren(XML_NODE_VARIABLE)) { String pathVariable = node.getString(XML_ATTRIBUTE_PATH); if (pathVariable == null) pathVariable = NAME_ROOT_NODE; fVariables.add(new Variable(node.getString(XML_ATTRIBUTE_NAME), node.getTextData(), node.getString(XML_ATTRIBUTE_DESCRIPTION), new Path(pathVariable))); } } final IMemento codeFragmentsNode = memento.getChild(XML_NODE_CODE_FRAGMENTS); if (codeFragmentsNode != null) { for (final IMemento node : codeFragmentsNode.getChildren(XML_NODE_CODE_FRAGMENT)) fCodeFragments.put(node.getString(XML_ATTRIBUTE_NAME), node.getTextData()); } final IMemento flagsNode = memento.getChild(XML_NODE_FLAGS); if (flagsNode != null) { for (final IMemento node : flagsNode.getChildren(XML_NODE_FLAG)) setFlag(node.getString(XML_ATTRIBUTE_NAME), node.getTextData()); } final IMemento descriptionNode = memento.getChild(XML_NODE_DESCRIPTION); fDescription = (descriptionNode != null) ? descriptionNode.getTextData() : ""; fDirty = false; } catch (final WorkbenchException e) { } }

Target:
public void load(final String text) { fTestFiles.clear(); fVariables.clear(); fCodeFragments.clear(); fFlags.clear(); try { final XMLMemento memento = XMLMemento.createReadRoot(new StringReader(text)); final IMemento testsNode = memento.getChild(XML_NODE_TESTFILES); if (testsNode != null) { for (final IMemento node : testsNode.getChildren(XML_NODE_TESTFILE)) fTestFiles.add(node.getTextData()); } final IMemento variablesNode = memento.getChild(XML_NODE_VARIABLES); if (variablesNode != null) { for (final IMemento node : variablesNode.getChildren(XML_NODE_VARIABLE)) { String pathVariable = node.getString(XML_ATTRIBUTE_PATH); final IPath path = (pathVariable == null) ? Path.ROOT : new Path(pathVariable); if (pathVariable == null) pathVariable = Path.ROOT.toString(); fVariables.add(new Variable(node.getString(XML_ATTRIBUTE_NAME), node.getTextData(), node.getString(XML_ATTRIBUTE_DESCRIPTION), path)); } } final IMemento codeFragmentsNode = memento.getChild(XML_NODE_CODE_FRAGMENTS); if (codeFragmentsNode != null) { for (final IMemento node : codeFragmentsNode.getChildren(XML_NODE_CODE_FRAGMENT)) fCodeFragments.put(node.getString(XML_ATTRIBUTE_NAME), node.getTextData()); } final IMemento flagsNode = memento.getChild(XML_NODE_FLAGS); if (flagsNode != null) { for (final IMemento node : flagsNode.getChildren(XML_NODE_FLAG)) setFlag(node.getString(XML_ATTRIBUTE_NAME), node.getTextData()); } final IMemento descriptionNode = memento.getChild(XML_NODE_DESCRIPTION); fDescription = (descriptionNode != null) ? descriptionNode.getTextData() : ""; fDirty = false; } catch (final WorkbenchException e) { } }
Source:
public void visitNode(Tree tree) { ForLoopVariableTypeCheck.this.reportIssue(forEachStatement.variable().type(), String.format(PRIMARY_MESSAGE, variableType.name()), getSecondaryLocations(), 0); }

Target:
public void visitNode(Tree tree) { if (blockAlreadyFlagged) { return; } ExpressionTree expression = ((TypeCastTree) tree).expression(); if (expression.is(Tree.Kind.IDENTIFIER) && ((IdentifierTree) expression).symbol().equals(variable.symbol())) { ForLoopVariableTypeCheck.this.reportIssue(forEachStatement.variable().type(), String.format(PRIMARY_MESSAGE, variable.type().symbolType().name()), getSecondaryLocations(), 0); blockAlreadyFlagged = true; } }
Source:
public void placeRadiologyOrder_shouldCreateRadiologyOrderEncounterWithOrdererAttachedToNewActiveVisitIfPatientWithoutActiveVisit() throws Exception { RadiologyOrder radiologyOrder = getUnsavedRadiologyOrder(); assertThat(encounterService.getEncountersByPatient(radiologyOrder.getPatient()), is(empty())); assertThat(visitService.getActiveVisitsByPatient(radiologyOrder.getPatient()), is(empty())); assertThat(radiologyOrder.getEncounter(), is(nullValue())); radiologyOrder = radiologyService.placeRadiologyOrder(radiologyOrder); Encounter encounter = radiologyOrder.getEncounter(); assertThat(encounter, is(not(nullValue()))); assertThat(encounter.getEncounterProviders() .size(), is(1)); Iterator<EncounterProvider> encounterProviderIterator = encounter.getEncounterProviders() .iterator(); while (encounterProviderIterator.hasNext()) { EncounterProvider encounterProvider = encounterProviderIterator.next(); assertThat(encounterProvider.getProvider(), is(radiologyOrder.getOrderer())); } assertThat(encounterService.getEncountersByPatient(radiologyOrder.getPatient()) .size(), is(1)); assertThat(visitService.getActiveVisitsByPatient(radiologyOrder.getPatient()) .size(), is(1)); assertThat(orderService.getAllOrdersByPatient(radiologyOrder.getPatient()) .size(), is(1)); }

Target:
public void placeRadiologyOrder_shouldCreateRadiologyOrderEncounterWithOrdererAttachedToNewActiveVisitIfPatientWithoutActiveVisit() throws Exception { RadiologyOrder radiologyOrder = getUnsavedRadiologyOrder(); assertThat(encounterService.getEncountersByPatient(radiologyOrder.getPatient()), is(empty())); assertThat(visitService.getActiveVisitsByPatient(radiologyOrder.getPatient()), is(empty())); assertThat(radiologyOrder.getEncounter(), is(nullValue())); radiologyOrder = radiologyService.placeRadiologyOrder(radiologyOrder); Encounter encounter = radiologyOrder.getEncounter(); assertThat(encounter, is(not(nullValue()))); assertThat(encounter.getEncounterProviders() .size(), is(1)); assertThat(encounter.getEncounterProviders() .iterator() .next() .getProvider(), is(radiologyOrder.getOrderer())); assertThat(encounterService.getEncountersByPatient(radiologyOrder.getPatient()) .size(), is(1)); assertThat(visitService.getActiveVisitsByPatient(radiologyOrder.getPatient()) .size(), is(1)); assertThat(visitService.getActiveVisitsByPatient(radiologyOrder.getPatient()) .get(0) .getEncounters(), hasItem(encounter)); assertThat(orderService.getAllOrdersByPatient(radiologyOrder.getPatient()) .size(), is(1)); }
Source:
public void testGetAllForClusterFilteredWithPermissions() { List<network> result = dao.getAllForCluster(cluster, PRIVILEGED_USER_ID, true); assertNotNull(result); assertFalse(result.isEmpty()); }

Target:
public void testGetAllForClusterFilteredWithPermissions() { List<network> result = dao.getAllForCluster(cluster, PRIVILEGED_USER_ID, true); assertGetAllForClusterResult(result); }
Source:
public ClientHandshaker(DTLSSession session, RecordLayer recordLayer, SessionListener sessionListener, DtlsConnectorConfig config, int maxTransmissionUnit) { super(true, session, recordLayer, sessionListener, config.getTrustStore(), maxTransmissionUnit, config.getRpkTrustStore()); this.privateKey = config.getPrivateKey(); this.certificateChain = config.getCertificateChain(); this.publicKey = config.getPublicKey(); this.pskStore = config.getPskStore(); this.serverNameResolver = config.getServerNameResolver(); this.preferredCipherSuites = config.getSupportedCipherSuites(); this.maxFragmentLengthCode = config.getMaxFragmentLengthCode(); this.supportedServerCertificateTypes = new ArrayList<>(); this.supportedClientCertificateTypes = new ArrayList<>(); if (config.useEcdheEcdsa()) { this.supportedServerCertificateTypes.add(CertificateType.RAW_PUBLIC_KEY); if (rootCertificates != null && rootCertificates.length > 0) { int index = config.isSendRawKey() ? 1 : 0; this.supportedServerCertificateTypes.add(index, CertificateType.X_509); } if (privateKey != null && publicKey != null) { if (certificateChain == null || certificateChain.length == 0) { this.supportedClientCertificateTypes.add(CertificateType.RAW_PUBLIC_KEY); } else if (config.isSendRawKey()) { this.supportedClientCertificateTypes.add(CertificateType.RAW_PUBLIC_KEY); this.supportedClientCertificateTypes.add(CertificateType.X_509); } else { this.supportedClientCertificateTypes.add(CertificateType.X_509); this.supportedClientCertificateTypes.add(CertificateType.RAW_PUBLIC_KEY); } } } }

Target:
public ClientHandshaker(DTLSSession session, RecordLayer recordLayer, SessionListener sessionListener, DtlsConnectorConfig config, int maxTransmissionUnit) { super(true, session, recordLayer, sessionListener, config.getTrustStore(), maxTransmissionUnit, config.getRpkTrustStore()); this.privateKey = config.getPrivateKey(); this.certificateChain = config.getCertificateChain(); this.publicKey = config.getPublicKey(); this.pskStore = config.getPskStore(); this.serverNameResolver = config.getServerNameResolver(); this.preferredCipherSuites = Arrays.asList(config.getSupportedCipherSuites()); this.maxFragmentLengthCode = config.getMaxFragmentLengthCode(); this.supportedServerCertificateTypes = new ArrayList<>(); this.supportedClientCertificateTypes = new ArrayList<>(); if (CipherSuite.containsEccBasedCipherSuite(preferredCipherSuites)) { this.supportedServerCertificateTypes.add(CertificateType.RAW_PUBLIC_KEY); if (rootCertificates != null && rootCertificates.length > 0) { int index = config.isSendRawKey() ? 1 : 0; this.supportedServerCertificateTypes.add(index, CertificateType.X_509); } if (privateKey != null && publicKey != null) { if (certificateChain == null || certificateChain.length == 0) { this.supportedClientCertificateTypes.add(CertificateType.RAW_PUBLIC_KEY); } else if (config.isSendRawKey()) { this.supportedClientCertificateTypes.add(CertificateType.RAW_PUBLIC_KEY); this.supportedClientCertificateTypes.add(CertificateType.X_509); } else { this.supportedClientCertificateTypes.add(CertificateType.X_509); this.supportedClientCertificateTypes.add(CertificateType.RAW_PUBLIC_KEY); } } } }
Source:
public boolean isSet(String name) { return isMapped(name) && myMapping.get(name) < myValues.size(); }

Target:
public boolean isSet(String name) { return isMapped(name) && myMapping.get(name) >= 0 && myMapping.get(name) < myValues.size(); }
Source:
protected boolean validate() { if (!super.validate()) { return false; } if (getVm().getStatus() != VMStatus.Up) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_VM_NEEDS_TO_BE_UP, ReplacementUtils.createSetVariableString( "vmId", getVmId()), ReplacementUtils.createSetVariableString( "vmName", getVm().getName()), ReplacementUtils.createSetVariableString( "currentVmState", getVm().getStatus())); } if (getDeviceToHotUnplug() == null) { return failValidation( EngineMessage.ACTION_TYPE_FAILED_VM_MEMORY_DEVICE_NOT_FOUND, ReplacementUtils.createSetVariableString( "memorySize", getParameters().getMemorySizeMb()), ReplacementUtils.createSetVariableString( "vmId", getVmId()), ReplacementUtils.createSetVariableString( "vmName", getVm().getName())); } return true; }

Target:
protected boolean validate() { if (!super.validate()) { return false; } if (getVm().getStatus() != VMStatus.Up) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_VM_IS_NOT_UP); } if (getDeviceToHotUnplug() == null) { return failValidation( EngineMessage.ACTION_TYPE_FAILED_VM_MEMORY_DEVICE_NOT_FOUND, ReplacementUtils.createSetVariableString( "memorySize", getParameters().getMemorySizeMb())); } return true; }
Source:
public void testBin2Level(final int bin, final int expectedLevel, final String ignored) { Assert.assertEquals(GenomicIndexUtil.bin2level(bin), expectedLevel); System.out.println(GenomicIndexUtil.bin2Region(bin)); }

Target:
public void testBin2Level(final int bin, final int expectedLevel, final String ignored) { Assert.assertEquals(GenomicIndexUtil.binTolevel(bin), expectedLevel); }
Source:
public void testInvalidFieldQueryParam() { final Response response = target("/valid/bar") .queryParam("sort", "foo") .request() .get(); assertThat(response.getStatus()).isEqualTo(422); }

Target:
public void testInvalidFieldQueryParam() { final Response response = target("/valid/bar") .queryParam("sort", "foo") .request() .get(); assertThat(response.getStatus()).isEqualTo(422); assertThat(response.readEntity(String.class)) .containsOnlyOnce("sortParam must match \\\"^(asc|desc)$\\\""); }
Source:
private void collisions$runCollisions(EntityLivingBase self) { try (PhaseContext<?> ignored = EntityPhase.State.COLLISION.createPhaseContext() .source(this).buildAndSwitch()) { this.collideWithNearbyEntities(); } }

Target:
private void impl$runCollisions(EntityLivingBase self) { if (((WorldBridge) this.world).bridge$isFake()) { this.shadow$collideWithNearbyEntities(); } else { try (PhaseContext<?> ignored = EntityPhase.State.COLLISION.createPhaseContext() .source(this).buildAndSwitch()) { this.shadow$collideWithNearbyEntities(); } } }
Source:
public void select(final GridWidget selectedGridWidget) { this.selectedGridWidget = Optional.of(selectedGridWidget); boolean selectionChanged = false; for (GridWidget gridWidget : getAllGridWidgets()) { if (!gridWidget.equals(selectedGridWidget)) { selectionChanged = true; gridWidget.deselect(); } else if (gridWidget.equals(selectedGridWidget)) { selectionChanged = true; gridWidget.select(); } } if (selectionChanged) { batch(); } }

Target:
public void select(final GridWidget selectedGridWidget) { this.selectedGridWidget = Optional.of(selectedGridWidget); boolean selectionChanged = false; for (GridWidget gridWidget : getAllGridWidgets()) { if (!Objects.equals(gridWidget, selectedGridWidget)) { selectionChanged = true; gridWidget.deselect(); } else if (Objects.equals(gridWidget, selectedGridWidget)) { selectionChanged = true; gridWidget.select(); } } if (selectionChanged) { batch(); } }
Source:
public void updateTableStatistics(String databaseName, String tableName, Function<PartitionStatistics, PartitionStatistics> update) { throw new UnsupportedOperationException("updateTableStatistics"); }

Target:
public void updateTableStatistics(String databaseName, String tableName, Function<PartitionStatistics, PartitionStatistics> update) { throw new UnsupportedOperationException("updateTableStatistics is not supported in AlluxioHiveMetastore"); }
Source:
public String serialize() { if(hard != null && soft != null) return name + "="+hard+":"+soft; else if(hard != null && soft == null) return name + "="+hard; else if(hard == null && soft != null) return name + "=:"+soft; else return null; }

Target:
public String serialize() { if(hard != null && soft != null) return name + "="+hard+":"+soft; else if(hard != null) return name + "="+hard; else if(soft != null) return name + "=:"+soft; else return null; }
Source:
protected void link(ProducedType type) throws IOException { if(type == null) return; TypeDeclaration decl = type.getDeclaration(); if(decl instanceof UnionType){ UnionType ut = (UnionType) decl; if (ut.getCaseTypes().size()==2) { Unit unit = decl.getUnit(); Class nothingDeclaration = unit.getNothingDeclaration(); if (com.redhat.ceylon.compiler.typechecker.model.Util.isElementOfUnion(ut, nothingDeclaration)) { ProducedType nonOptionalType = null; for (ProducedType ct : ut.getCaseTypes()) { TypeDeclaration ctd = ct.getDeclaration(); if (ctd instanceof Class && ctd.equals(nothingDeclaration)) { continue; } else { nonOptionalType = ct; break; } } link(nonOptionalType); write("?"); return; } if (com.redhat.ceylon.compiler.typechecker.model.Util.isElementOfUnion(ut, unit.getEmptyDeclaration()) && com.redhat.ceylon.compiler.typechecker.model.Util.isElementOfUnion(ut, unit.getSequenceDeclaration())) { link(unit.getElementType(type)); write("[]"); return; } } boolean first = true; for(ProducedType ud : ut.getCaseTypes()){ if(first){ first = false; }else{ write("|"); } link(ud); } }else if(decl instanceof IntersectionType){ IntersectionType it = (IntersectionType) decl; boolean first = true; for(ProducedType id : it.getSatisfiedTypes()){ if(first){ first = false; }else{ write("&amp;"); } link(id); } }else if(decl instanceof ClassOrInterface){ link((ClassOrInterface) decl, type.getTypeArgumentList()); } else if (decl instanceof TypeParameter) { around("span class='type-parameter'", decl.getName()); } else { write(type.getProducedTypeName()); } }

Target:
protected void link(ProducedType type) throws IOException { if(type == null) return; TypeDeclaration decl = type.getDeclaration(); if(decl instanceof UnionType){ UnionType ut = (UnionType) decl; if (ut.getCaseTypes().size()==2) { Unit unit = decl.getUnit(); if (com.redhat.ceylon.compiler.typechecker.model.Util.isElementOfUnion(ut, unit.getNothingDeclaration())) { link(getDefiniteTypeForDisplay(ut)); write("?"); return; } if (com.redhat.ceylon.compiler.typechecker.model.Util.isElementOfUnion(ut, unit.getEmptyDeclaration()) && com.redhat.ceylon.compiler.typechecker.model.Util.isElementOfUnion(ut, unit.getSequenceDeclaration())) { link(unit.getElementType(type)); write("[]"); return; } } boolean first = true; for(ProducedType ud : ut.getCaseTypes()){ if(first){ first = false; }else{ write("|"); } link(ud); } }else if(decl instanceof IntersectionType){ IntersectionType it = (IntersectionType) decl; boolean first = true; for(ProducedType id : it.getSatisfiedTypes()){ if(first){ first = false; }else{ write("&amp;"); } link(id); } }else if(decl instanceof ClassOrInterface){ link((ClassOrInterface) decl, type.getTypeArgumentList()); } else if (decl instanceof TypeParameter) { around("span class='type-parameter'", decl.getName()); } else { write(type.getProducedTypeName()); } }
Source:
private List<FileStatus> getStoreFilesForSnapshot(SnapshotMock.SnapshotBuilder builder) throws IOException { final List<FileStatus> allStoreFiles = Lists.newArrayList(); SnapshotReferenceUtil .visitReferencedFiles(UTIL.getConfiguration(), fs, builder.getSnapshotsDir(), new SnapshotReferenceUtil.SnapshotVisitor() { @Override public void storeFile(RegionInfo regionInfo, String familyName, SnapshotProtos.SnapshotRegionManifest.StoreFile storeFile) throws IOException { FileStatus status = mockStoreFile(storeFile.getName()); allStoreFiles.add(status); } }); return allStoreFiles; }

Target:
private List<FileStatus> getStoreFilesForSnapshot(SnapshotMock.SnapshotBuilder builder) throws IOException { final List<FileStatus> allStoreFiles = Lists.newArrayList(); SnapshotReferenceUtil .visitReferencedFiles(conf, fs, builder.getSnapshotsDir(), new SnapshotReferenceUtil.SnapshotVisitor() { @Override public void storeFile(RegionInfo regionInfo, String familyName, SnapshotProtos.SnapshotRegionManifest.StoreFile storeFile) throws IOException { FileStatus status = mockStoreFile(storeFile.getName()); allStoreFiles.add(status); } }); return allStoreFiles; }
Source:
private RegistryObjectType extractRegistryObject(RegistryObjectListType registryList) { RegistryObjectType registryObj = null; if (registryList != null && NullChecker.isNotNullish(registryList.getIdentifiable())) { List<JAXBElement<? extends IdentifiableType>> identifiers = registryList.getIdentifiable(); for (JAXBElement<? extends IdentifiableType> object : identifiers) { if (object.getDeclaredType() != null && object.getDeclaredType().equals(RegistryPackageType.class)) { registryObj = (RegistryObjectType) object.getValue(); break; } } } else { LOG.error("RegistryPackage is null."); } return registryObj; }

Target:
private RegistryObjectType extractRegistryObject(RegistryObjectListType registryList) { RegistryObjectType registryObj = null; if (registryList != null && registryList.getIdentifiable() != null) { for (JAXBElement<? extends IdentifiableType> object : registryList.getIdentifiable()) { if (object.getDeclaredType() != null && object.getDeclaredType().equals(RegistryPackageType.class)) { registryObj = (RegistryObjectType) object.getValue(); break; } } } if (registryObj == null) { LOG.error("RegistryPackage is null."); } return registryObj; }
Source:
public void testSetupProjectTouchesTheDirSizeFile() throws Exception { final ProjectVersion pv = new ProjectVersion(12, 34, new File(this.projectsDir, "sample_project_01")); this.instance.setupProject(pv); final long lastModifiedTime1 = new File(Paths.get(pv.getInstalledDir().getPath(), Constants .PROJECT_DIR_SIZE_FILE_NAME).toString()).lastModified(); Thread.sleep(1000); this.instance.setupProject(pv); final long lastModifiedTime2 = new File(Paths.get(pv.getInstalledDir().getPath(), Constants .PROJECT_DIR_SIZE_FILE_NAME).toString()).lastModified(); assertThat(lastModifiedTime2).isGreaterThan(lastModifiedTime1); }

Target:
public void testSetupProjectTouchesTheDirSizeFile() throws Exception { final ProjectVersion pv = new ProjectVersion(12, 34, new File(this.projectsDir, "sample_project_01")); this.instance.setupProject(pv); verify(this.instance, never()).touchIfExists( Paths.get(pv.getInstalledDir().getPath(), FlowPreparer.PROJECT_DIR_SIZE_FILE_NAME)); this.instance.setupProject(pv); verify(this.instance).touchIfExists( Paths.get(pv.getInstalledDir().getPath(), FlowPreparer.PROJECT_DIR_SIZE_FILE_NAME)); }
Source:
public void addDropDownOption( TerminationConfigOption terminationConfigOption ) { if ( terminationConfigOption == TerminationConfigOption.NESTED ) { return; } AnchorListItem li1 = new AnchorListItem( dropDownNameMap.get( terminationConfigOption ) ); li1.addClickHandler( h -> { presenter.onTerminationTypeSelected( terminationConfigOption.name() ); } ); for ( int i = 0; i < dropdownMenuList.getWidgetCount(); i++ ) { AnchorListItem item = (AnchorListItem) dropdownMenuList.getWidget( i ); if ( terminationConfigOption.ordinal() < getDropDownOption( item.getText() ).ordinal() ) { dropdownMenuList.insert( li1, i ); break; } if ( i == dropdownMenuList.getWidgetCount() - 1 ) { dropdownMenuList.add( li1 ); } } }

Target:
public void addDropDownOption( TerminationConfigOption terminationConfigOption ) { if ( terminationConfigOption == TerminationConfigOption.NESTED ) { return; } AnchorListItem li1 = new AnchorListItem( dropDownNameMap.get( terminationConfigOption ) ); li1.addClickHandler( h -> { presenter.onTerminationTypeSelected( terminationConfigOption.name() ); } ); for ( int i = 0; i < dropdownMenuList.getWidgetCount(); i++ ) { AnchorListItem item = (AnchorListItem) dropdownMenuList.getWidget( i ); TerminationConfigOption dropDownTerminationConfigOption = getDropDownOption( item.getText() ); if ( dropDownTerminationConfigOption == null || terminationConfigOption.ordinal() < dropDownTerminationConfigOption.ordinal() ) { dropdownMenuList.insert( li1, i ); break; } if ( i == dropdownMenuList.getWidgetCount() - 1 ) { dropdownMenuList.add( li1 ); } } }
Source:
private KieCompilationResponse compileAndLoadKieJarMetadataAllResourcesPackagedJar() { String alternateSettingsAbsPath = TestUtilMaven.getSettingsFile(); Path tmpRoot = Files.createTempDirectory("repo_" + UUID.randomUUID().toString()); Path tmp = Files.createDirectories(Paths.get(tmpRoot.toString(), "dummy")); try { TestUtil.copyTree(Paths.get(ResourcesConstants.KJAR_2_ALL_RESOURCES), tmp); } catch (Exception e) { logger.error(e.getMessage()); } final KieCompilationResponse res; try { final AFCompiler compiler = KieMavenCompilerFactory.getCompiler(EnumSet.of(KieDecorator.STORE_KIE_OBJECTS, KieDecorator.ENABLE_LOGGING)); final WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(tmp); final CompilationRequest req = new DefaultCompilationRequest(mavenRepoPath, info, new String[]{ MavenCLIArgs.COMPILE, MavenCLIArgs.ALTERNATE_USER_SETTINGS + alternateSettingsAbsPath }, Boolean.FALSE); res = (KieCompilationResponse) compiler.compile(req); logger.info("\nFinished " + res.isSuccessful() + " all Metadata tmp:" + tmp + " UUID:" + req.getRequestUUID() + " res.getMavenOutput().isEmpty():" + res.getMavenOutput().isEmpty()); if (!res.isSuccessful()) { try { logger.error("writing output on target folder:" + tmp); TestUtil.writeMavenOutputIntoTargetFolder(tmp, res.getMavenOutput(), "ConcurrentBuildTest.compileAndLoadKieJarMetadataAllResourcesPackagedJar_" + req.getRequestUUID()); } catch (Exception e) { logger.error(e.getMessage()); } } } finally { latch.countDown(); } return res; }

Target:
private KieCompilationResponse compileAndLoadKieJarMetadataAllResourcesPackagedJar() { String alternateSettingsAbsPath = TestUtilMaven.getSettingsFile(); Path tmpRoot = Files.createTempDirectory("repo_" + UUID.randomUUID().toString()); Path tmp = Files.createDirectories(Paths.get(tmpRoot.toString(), "dummy")); try { TestUtil.copyTree(Paths.get(ResourcesConstants.KJAR_2_ALL_RESOURCES), tmp); } catch (Exception e) { logger.error(e.getMessage()); } final AFCompiler compiler = KieMavenCompilerFactory.getCompiler(EnumSet.of(KieDecorator.STORE_KIE_OBJECTS, KieDecorator.ENABLE_LOGGING)); final KieCompilationResponse res; try { final WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(tmp); final CompilationRequest req = new DefaultCompilationRequest(mavenRepoPath, info, new String[]{ MavenCLIArgs.COMPILE, MavenCLIArgs.ALTERNATE_USER_SETTINGS + alternateSettingsAbsPath }, Boolean.FALSE); res = (KieCompilationResponse) compiler.compile(req); logger.info("\nFinished " + res.isSuccessful() + " all Metadata tmp:{} UUID:{} res.getMavenOutput().isEmpty():{}", tmp , req.getRequestUUID(), res.getMavenOutput().isEmpty()); if (!res.isSuccessful()) { try { logger.error("writing output on target folder:{}", tmp); TestUtil.writeMavenOutputIntoTargetFolder(tmp, res.getMavenOutput(), "ConcurrentBuildTest.compileAndLoadKieJarMetadataAllResourcesPackagedJar_" + req.getRequestUUID()); } catch (Exception e) { logger.error(e.getMessage()); } } } finally { latch.countDown(); } return res; }
Source:
@Override public ClientProtos.GetResponse get(RpcController controller, ClientProtos.GetRequest request) throws ServiceException { try { if (doDelay) { Thread.sleep(DELAY_GET); } } catch (InterruptedException e) { LOG.error("Sleep interrupted during get operation", e); } return super.get(controller, request); }

Target:
@Override public ClientProtos.GetResponse get(RpcController controller, ClientProtos.GetRequest request) throws ServiceException { try { if (doDelay) { Thread.sleep(DELAY_GET); } } catch (InterruptedException e) { LOGGER.error("Sleep interrupted during get operation", e); } return super.get(controller, request); }
Source:
public KafkaRecordSupplier( Map<String, Object> consumerProperties, ObjectMapper sortingMapper ) { this.consumerProperties = consumerProperties; this.sortingMapper = sortingMapper; this.consumer = getKafkaConsumer(); }

Target:
public KafkaRecordSupplier( Map<String, Object> consumerProperties, ObjectMapper sortingMapper ) { this(consumerProperties, sortingMapper, getKafkaConsumer(sortingMapper, consumerProperties)); }
Source:
public static void writeIgniteUuid(ByteBuffer buf, IgniteUuid uuid) { buf.putLong(uuid.globalId().getMostSignificantBits()); buf.putLong(uuid.globalId().getLeastSignificantBits()); buf.putLong(uuid.localId()); }

Target:
static void writeIgniteUuid(ByteBuffer buf, IgniteUuid uuid) { buf.putLong(uuid.globalId().getMostSignificantBits()); buf.putLong(uuid.globalId().getLeastSignificantBits()); buf.putLong(uuid.localId()); }
Source:
public List<Object> getAllCombo(List<Multimap<List<Object>, Object>> accu) { List<Object> result = new ArrayList<>(); int leftStreamIndex = getLeftStreamIndex(); Multimap<List<Object>, Object> leftStream = accu.get(leftStreamIndex); Multimap<List<Object>, Object> rightStream = ArrayListMultimap.create(accu.get((leftStreamIndex + 1) % 2)); Map<String,PojoUtils.Getter> leftGettersStream = leftStreamIndex == 0 ? gettersStream1 : gettersStream2; Map<String,PojoUtils.Getter> rightGettersStream = leftStreamIndex == 1 ? gettersStream1 : gettersStream2; for (List lMap : leftStream.keySet()) { Collection<Object> left = leftStream.get(lMap); if (rightStream.containsKey(lMap)) { Collection<Object> right = rightStream.get(lMap); Object o; try { o = outClass.newInstance(); } catch (Throwable e) { throw Throwables.propagate(e); } for (Object lObj:left) { for (Object rObj:right) { setObjectForResult(leftGettersStream, lObj,o); setObjectForResult(rightGettersStream, rObj,o); } result.add(o); } rightStream.removeAll(lMap); } else { addNonMatchingResult(left, leftGettersStream, result); } } addNonMatchingRightStream(rightStream, rightGettersStream, result); return result; }

Target:
private List<Object> getAllCombo(List<Multimap<List<Object>, Object>> accu) { List<Object> result = new ArrayList<>(); int leftStreamIndex = getLeftStreamIndex(); Multimap<List<Object>, Object> leftStream = accu.get(leftStreamIndex); Multimap<List<Object>, Object> rightStream = ArrayListMultimap.create(accu.get((leftStreamIndex + 1) % 2)); Map<String,PojoUtils.Getter> leftGettersStream = leftStreamIndex == 0 ? gettersStream1 : gettersStream2; Map<String,PojoUtils.Getter> rightGettersStream = leftStreamIndex == 1 ? gettersStream1 : gettersStream2; for (List lMap : leftStream.keySet()) { Collection<Object> left = leftStream.get(lMap); if (rightStream.containsKey(lMap)) { Collection<Object> right = rightStream.get(lMap); Object o; try { o = outClass.newInstance(); } catch (Throwable e) { throw Throwables.propagate(e); } for (Object lObj:left) { for (Object rObj:right) { setObjectForResult(leftGettersStream, lObj,o); setObjectForResult(rightGettersStream, rObj,o); } result.add(o); } rightStream.removeAll(lMap); } else { addNonMatchingResult(left, leftGettersStream, result); } } addNonMatchingRightStream(rightStream, rightGettersStream, result); return result; }
Source:
private static ResourceMapping getResourceMapping(Object o) { if (o instanceof ResourceMapping) return (ResourceMapping) o; if (o instanceof IAdaptable) { IAdaptable adaptable = (IAdaptable) o; Object adapted = adaptable.getAdapter(ResourceMapping.class); if (adapted instanceof ResourceMapping) { return (ResourceMapping) adapted; } adapted = adaptable.getAdapter(IContributorResourceAdapter.class); if (adapted instanceof IContributorResourceAdapter2) { IContributorResourceAdapter2 cra = (IContributorResourceAdapter2) adapted; return cra.getAdaptedResourceMapping(adaptable); } } else { Object adapted = Platform.getAdapterManager().getAdapter(o, ResourceMapping.class); if (adapted instanceof ResourceMapping) { return (ResourceMapping) adapted; } } return null; }

Target:
private static ResourceMapping getResourceMapping(Object o) { if (o instanceof ResourceMapping) return (ResourceMapping) o; if (o instanceof IAdaptable) { IAdaptable adaptable = (IAdaptable) o; Object adapted = adaptable.getAdapter(ResourceMapping.class); if (adapted instanceof ResourceMapping) return (ResourceMapping) adapted; adapted = adaptable.getAdapter(IContributorResourceAdapter.class); if (adapted instanceof IContributorResourceAdapter2) { IContributorResourceAdapter2 cra = (IContributorResourceAdapter2) adapted; return cra.getAdaptedResourceMapping(adaptable); } } else { Object adapted = Platform.getAdapterManager().getAdapter(o, ResourceMapping.class); if (adapted instanceof ResourceMapping) return (ResourceMapping) adapted; } return null; }
Source:
public static List<AbstractInstance> loadMoboDataset() throws IOException { final BufferedReader br = new BufferedReader(new InputStreamReader((new GZIPInputStream(Benchmarks.class.getResourceAsStream("mobo1.json.gz"))))); final List<AbstractInstance> instances = Lists.newLinkedList(); int count = 0; while (true) { count++; final String line = br.readLine(); if (line == null) { break; } final JSONObject jo = (JSONObject) JSONValue.parse(line); final HashMapAttributes a = new HashMapAttributes(); a.putAll((JSONObject) jo.get("attributes")); AbstractInstance instance = new Instance(a, ((String) jo.get("output")).equals("none") ? "none" : "notNone"); instances.add(instance); } return instances; }

Target:
public static List<AbstractInstance> loadMoboDataset() throws IOException { final BufferedReader br = new BufferedReader(new InputStreamReader((new GZIPInputStream(Benchmarks.class.getResourceAsStream("mobo1.json.gz"))))); final List<AbstractInstance> instances = Lists.newLinkedList(); int count = 0; while (true) { count++; final String line = br.readLine(); if (line == null) { break; } final JSONObject jo = (JSONObject) JSONValue.parse(line); final HashMapAttributes a = new HashMapAttributes(); a.putAll((JSONObject) jo.get("attributes")); String binaryClassification = ((String) jo.get("output")).equals("none") ? "none" : "notNone"; AbstractInstance instance = new Instance(a, binaryClassification); instances.add(instance); } return instances; }
Source:
private boolean satisfiesCpuUtilizationCriteria() { final double maxCpuUtilizationConfig = this.azkabanProps. getDouble(ConfigurationKeys.AZKABAN_POLLING_CRITERIA_MAX_CPU_UTILIZATION_PCT, 100); if (maxCpuUtilizationConfig <= 0 || maxCpuUtilizationConfig >= 100) { return true; } final double cpuLoad = this.cpuUtil.getCpuLoad(); return (cpuLoad == -1) ? true : cpuLoad < maxCpuUtilizationConfig; }

Target:
private boolean satisfiesCpuUtilizationCriteria() { final double maxCpuUtilizationConfig = this.azkabanProps. getDouble(ConfigurationKeys.AZKABAN_POLLING_CRITERIA_MAX_CPU_UTILIZATION_PCT, 100); if (maxCpuUtilizationConfig <= 0 || maxCpuUtilizationConfig >= 100) { return true; } final double cpuLoad = this.cpuUtil.getCpuLoad(); if (cpuLoad == -1) { return true; } final boolean cpuLoadWithinParams = cpuLoad < maxCpuUtilizationConfig; if (this.isCpuLoadUnderMax != cpuLoadWithinParams) { this.isCpuLoadUnderMax = cpuLoadWithinParams; if (cpuLoadWithinParams) { FlowRunnerManager.logger.info("Polling criteria satisfied: Cpu utilization (" + cpuLoad + "%)."); } else { FlowRunnerManager.logger.info("Polling criteria NOT satisfied: Cpu utilization (" + cpuLoad + "%)."); } } return cpuLoadWithinParams; }
Source:
protected void drawIconText() { final String allegedIconFontName = FontFactory.getIconFont().getFontData()[0].getName(); if(Display.getDefault().getFontList(allegedIconFontName, true).length > 0){ renderIconText(); } else { log.warning("Problem loading icon font. Fallback font may not contain matching glyphs."); } }

Target:
protected void drawIconText() { final int spacing = textSize.y > 0 ? style.getSpacing() : 0; Font font; Rectangle bounds; if (FontFactory.checkIfFontLoaded(FontFactory.getIconFont())) { AdvancedScope scope = AdvancedGC.advancedScope(gc, !isWindows7()); if (isIconDropShadowStyle(style.getButtonEffects())) { for (TextIcon icon : button.getTextIcons()) { font = FontFactory.getIconFont(icon.getFontSize()); bounds = getIconTextBounds(icon, size.x, size.y, textSize, spacing); drawTextAtLocation(gc, icon.getText(), font, getForegroundColor(icon.getColorLabel(), ButtonColorEffect.DARKEN), bounds.x + SHADOW_OFFSET, bounds.y + SHADOW_OFFSET); } } for (TextIcon icon : button.getTextIcons()) { font = FontFactory.getIconFont(icon.getFontSize()); bounds = getIconTextBounds(icon, size.x, size.y, textSize, spacing); drawTextAtLocation(gc, icon.getText(), font, getForegroundColor(icon.getColorLabel(), style.getButtonColorEffect()), bounds.x, bounds.y); } scope.complete(); } }
Source:
public ResultHandlingInterceptorMember(MessageHandlingMember<T> original, Class<?> expectedResultType) { super(original); this.expectedResultType = expectedResultType; Method method = original.unwrap(Method.class).orElseThrow(() -> new AxonConfigurationException( "The @ExceptionHandler must be on method.")); boolean declaredInterceptorChain = Arrays.stream(method.getParameters()) .anyMatch(p -> p.getType().equals(InterceptorChain.class)); if (declaredInterceptorChain) { throw new AxonConfigurationException("@ExceptionHandler annotated methods should not delare an InterceptorChain parameter"); } }

Target:
public ResultHandlingInterceptorMember(MessageHandlingMember<T> original, Class<?> expectedResultType) { super(original); this.expectedResultType = expectedResultType; Method method = original.unwrap(Method.class).orElseThrow(() -> new AxonConfigurationException( "Only methods can be marked as MessageHandlerInterceptor. Violating handler: " + original.signature())); boolean declaredInterceptorChain = Arrays.stream(method.getParameters()) .anyMatch(p -> p.getType().equals(InterceptorChain.class)); if (declaredInterceptorChain) { throw new AxonConfigurationException("A MessageHandlerInterceptor acting on the invocation result must not declare a parameter of type InterceptorChain. Violating handler: " + original.signature()); } }
Source:
public void testIsLearn() { Parameters p = NetworkTestHarness.getParameters().copy(); p = p.union(NetworkTestHarness.getDayDemoTestEncoderParams()); p.set(KEY.COLUMN_DIMENSIONS, new int[] { 30 }); p.set(KEY.SYN_PERM_INACTIVE_DEC, 0.1); p.set(KEY.SYN_PERM_ACTIVE_INC, 0.1); p.set(KEY.SYN_PERM_TRIM_THRESHOLD, 0.05); p.set(KEY.SYN_PERM_CONNECTED, 0.4); p.set(KEY.MAX_BOOST, 10.0); p.set(KEY.DUTY_CYCLE_PERIOD, 7); p.set(KEY.RANDOM, new MersenneTwister(42)); Map<String, Object> params = new HashMap<>(); params.put(KEY_MODE, Mode.PURE); Network n = Network.create("test network", p) .add(Network.createRegion("r1") .add(Network.createLayer("1", p) .alterParameter(KEY.AUTO_CLASSIFY, false)) .add(Network.createLayer("2", p) .add(Anomaly.create(params))) .add(Network.createLayer("3", p) .add(new TemporalMemory())) .add(Network.createLayer("4", p) .add(new SpatialPooler()) .add(MultiEncoder.builder().name("").build())) .connect("1", "2") .connect("2", "3") .connect("3", "4")); n.lookup("r1").close(); n.setLearn(false); assertFalse(n.isLearn()); Region r1 = n.lookup("r1"); assertFalse(n.isLearn()); Layer<?> layer = r1.getTail(); assertFalse(layer.isLearn()); while(layer.getNext() != null) { layer = layer.getNext(); assertFalse(layer.isLearn()); } }

Target:
public void testIsLearn() { Parameters p = NetworkTestHarness.getParameters().copy(); p = p.union(NetworkTestHarness.getDayDemoTestEncoderParams()); p.set(KEY.COLUMN_DIMENSIONS, new int[] { 30 }); p.set(KEY.SYN_PERM_INACTIVE_DEC, 0.1); p.set(KEY.SYN_PERM_ACTIVE_INC, 0.1); p.set(KEY.SYN_PERM_TRIM_THRESHOLD, 0.05); p.set(KEY.SYN_PERM_CONNECTED, 0.4); p.set(KEY.MAX_BOOST, 10.0); p.set(KEY.DUTY_CYCLE_PERIOD, 7); p.set(KEY.RANDOM, new MersenneTwister(42)); p.set(KEY.INFERRED_FIELDS, getInferredFieldsMap("dayOfWeek", CLAClassifier.class)); Map<String, Object> params = new HashMap<>(); params.put(KEY_MODE, Mode.PURE); Network n = Network.create("test network", p) .add(Network.createRegion("r1") .add(Network.createLayer("1", p) .alterParameter(KEY.AUTO_CLASSIFY, Boolean.TRUE)) .add(Network.createLayer("2", p) .add(Anomaly.create(params))) .add(Network.createLayer("3", p) .add(new TemporalMemory())) .add(Network.createLayer("4", p) .add(new SpatialPooler()) .add(MultiEncoder.builder().name("").build())) .connect("1", "2") .connect("2", "3") .connect("3", "4")); n.lookup("r1").close(); n.setLearn(false); assertFalse(n.isLearn()); Region r1 = n.lookup("r1"); assertFalse(n.isLearn()); Layer<?> layer = r1.getTail(); assertFalse(layer.isLearn()); while(layer.getNext() != null) { layer = layer.getNext(); assertFalse(layer.isLearn()); } }
Source:
public void run() { long startTime = System.currentTimeMillis(); LOG.info("Recovering of runtimes is started."); for (RuntimeIdentity identity : identities) { try { getInternalRuntime(identity.getWorkspaceId()); } catch (Exception e) { LOG.error( "An error occurred while attempting to recover runtime '{}' using infrastructure '{}'. Reason: '{}'", identity.getWorkspaceId(), infrastructure.getName(), e.getMessage(), e); } } long finishTime = System.currentTimeMillis(); LOG.info( "All runtimes have been recovered in seconds.", TimeUnit.MILLISECONDS.toSeconds(finishTime - startTime)); }

Target:
public void run() { long startTime = System.currentTimeMillis(); LOG.info("Recovering of runtimes is started."); for (RuntimeIdentity identity : identities) { try (Unlocker ignored = lockService.writeLock(identity.getWorkspaceId())) { try { InternalRuntime<?> runtime = runtimes.get(identity.getWorkspaceId()); if (runtime == null) { LOG.info("Recovering runtime {}", identity.getWorkspaceId()); recoverOne(infrastructure, identity); } else { LOG.info("Runtime already restored. Skipping it.", identity.getWorkspaceId()); } } catch (Exception e) { LOG.error( "An error occurred while attempting to recover runtime '{}' using infrastructure '{}'. Reason: '{}'", identity.getWorkspaceId(), infrastructure.getName(), e.getMessage(), e); } } } long finishTime = System.currentTimeMillis(); LOG.info( "All runtimes have been recovered in seconds.", TimeUnit.MILLISECONDS.toSeconds(finishTime - startTime)); }
Source:
public boolean isInWater() { byte var1 = 5; int maxLoop = 4; double var5 = this.getEntityBoundingBox().minY + (this.getEntityBoundingBox().maxY - this.getEntityBoundingBox().minY) * (double)(maxLoop + 0) / (double)var1 - 0.125D; double var7 = this.getEntityBoundingBox().minY + (this.getEntityBoundingBox().maxY - this.getEntityBoundingBox().minY) * (double)(maxLoop + 1) / (double)var1 - 0.125D; AxisAlignedBB var9 = new AxisAlignedBB(this.getEntityBoundingBox().minX, var5, this.getEntityBoundingBox().minZ, this.getEntityBoundingBox().maxX, var7, this.getEntityBoundingBox().maxZ); if(this.worldObj.isAABBInMaterial(var9, Material.water)) { return true; } return false; }

Target:
public boolean isInWater() { int maxLoop = 4; double y1 = this.getEntityBoundingBox().minY + (this.getEntityBoundingBox().maxY - this.getEntityBoundingBox().minY) * (double)(maxLoop + 0) / (double)4.875; double z2 = this.getEntityBoundingBox().minY + (this.getEntityBoundingBox().maxY - this.getEntityBoundingBox().minY) * (double)(maxLoop + 1) / (double)4.875; AxisAlignedBB aabb = new AxisAlignedBB(this.getEntityBoundingBox().minX, 5, this.getEntityBoundingBox().minZ, this.getEntityBoundingBox().maxX, z2, this.getEntityBoundingBox().maxZ); return this.worldObj.isAABBInMaterial(aabb, Material.water); }