auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void terminateOutdatedJobsTask() { long terminated = jobExecutionDao.readAllPending().stream().filter(this::isOutdated).peek(this::terminate).count(); if (terminated > 0) { <START> LOGGER.info("{} jobs has been terminated.", terminated); <END> } else { LOGGER.debug("{} jobs has been terminated.", terminated); } }</code><technical_language>log jobs terminated</technical_language>

Target:
public void terminateOutdatedJobsTask() { jobExecutionDao.readAllPending().stream() .filter(this::isOutdated) .peek(this::terminate) .peek(jobExec -> LOGGER.info("{} has been terminated.", jobExec.getJob())); }
Source:
<code>public static int maximumGap(int[] nums) { if(nums == null || nums.length < 2){ return 0; } int max = Integer.MIN_VALUE; int min = Integer.MAX_VALUE; int length = nums.length; int maxGap = 0; for(int i : nums){ max = Math.max(max, i); min = Math.min(min, i); } if(min == max){ return 0; } <START> int bicketSize = (max - min) / (length - 1); <END> if(bicketSize == 0){ bicketSize = 1; } int bicketCount = (max - min) / bicketSize + 1; int[] left = new int[bicketCount]; int[] right = new int[bicketCount]; Arrays.fill(left, -1); Arrays.fill(right, -1); for(int i = 0; i < length ; i ++){ int loc = (nums[i] - min) / bicketSize; if(left[loc] == -1){ left[loc] = nums[i]; right[loc] = nums[i]; } else{ left[loc] = Math.min(left[loc], nums[i]); right[loc] = Math.max(right[loc], nums[i]); } } int locLeft; int locRight = -1; for(int i = 0; i < bicketCount; i++){ if(left[i] != -1 && locRight == -1){ locRight = right[i]; } else if(left[i] != -1 && locRight != -1){ locLeft = left[i]; maxGap= Math.max(maxGap, locLeft - locRight ); locRight = right[i]; } } return maxGap; }</code><technical_language>bicket? bucket</technical_language>

Target:
public static int maximumGap(int[] nums) { if(nums == null || nums.length < 2){ return 0; } int max = Integer.MIN_VALUE; int min = Integer.MAX_VALUE; int length = nums.length; int maxGap = 0; for(int i : nums){ max = Math.max(max, i); min = Math.min(min, i); } if(min == max){ return 0; } int bucketSize = (max - min) / (length - 1); if(bucketSize == 0){ bucketSize = 1; } int bucketCount = (max - min) / bucketSize + 1; int[] left = new int[bucketCount]; int[] right = new int[bucketCount]; Arrays.fill(left, -1); Arrays.fill(right, -1); for(int i = 0; i < length ; i++){ int loc = (nums[i] - min) / bucketSize; if(left[loc] == -1){ left[loc] = nums[i]; right[loc] = nums[i]; } else{ left[loc] = Math.min(left[loc], nums[i]); right[loc] = Math.max(right[loc], nums[i]); } } int locLeft; int locRight = -1; for(int i = 0; i < bucketCount; i++){ if(left[i] != -1 && locRight == -1){ locRight = right[i]; } else if(left[i] != -1 && locRight != -1){ locLeft = left[i]; maxGap= Math.max(maxGap, locLeft - locRight ); locRight = right[i]; } } return maxGap; }
Source:
<code>public List<Observation> observationEntityToObservation(List<ObservationEntity> observationEntityList) { List<Observation> observationList = new ArrayList<>(); for (ObservationEntity entity : observationEntityList) { Observation obs = new Observation(); <START> obs.setId(entity.getId()); <END> obs.setEncounterID(entity.getEncounterKeyID()); obs.setUuid(entity.getUuid()); obs.setDisplay(entity.getDisplay()); obs.setDisplayValue(entity.getDisplayValue()); obs.setDiagnosisOrder(entity.getDiagnosisOrder()); obs.setDiagnosisList(entity.getDiagnosisList()); obs.setDiagnosisCertanity(entity.getDiagnosisCertainty()); obs.setDiagnosisNote(entity.getDiagnosisNote()); ConceptEntity concept = new ConceptEntity(); concept.setUuid(entity.getConceptuuid()); obs.setConcept(concept); observationList.add(obs); } return observationList; }</code><technical_language>Move this Observation.java</technical_language>

Target:
public static List<Observation> observationEntityToObservation(List<ObservationEntity> observationEntityList) { List<Observation> observationList = new ArrayList<>(); for (ObservationEntity entity : observationEntityList) { Observation obs = new Observation(); obs.setId(entity.getId()); obs.setEncounterID(entity.getEncounterKeyID()); obs.setUuid(entity.getUuid()); obs.setDisplay(entity.getDisplay()); obs.setDisplayValue(entity.getDisplayValue()); obs.setDiagnosisOrder(entity.getDiagnosisOrder()); obs.setDiagnosisList(entity.getDiagnosisList()); obs.setDiagnosisCertanity(entity.getDiagnosisCertainty()); obs.setDiagnosisNote(entity.getDiagnosisNote()); ConceptEntity concept = new ConceptEntity(); concept.setUuid(entity.getConceptuuid()); obs.setConcept(concept); observationList.add(obs); } return observationList; }
Source:
<code>public HdfsSystemConsumer(String systemName, Config config, HdfsSystemConsumerMetrics consumerMetrics) { super(consumerMetrics.getMetricsRegistry()); hdfsConfig = new HdfsConfig(config); readerType = HdfsReaderFactory.getType(hdfsConfig.getFileReaderType(systemName)); stagingDirectory = hdfsConfig.getStagingDirectory(); bufferCapacity = hdfsConfig.getConsumerBufferCapacity(systemName); numMaxRetires = hdfsConfig.getConsumerNumMaxRetries(systemName); readers = new ConcurrentHashMap<>(); readerRunnableStatus = new ConcurrentHashMap<>(); isShutdown = false; this.consumerMetrics = consumerMetrics; cachedPartitionDescriptorMap = CacheBuilder.newBuilder().build(new CacheLoader<String, Map<Partition, List<String>>>() { @Override public Map<Partition, List<String>> load(String streamName) throws Exception { Validate.notEmpty(streamName); if (StringUtils.isBlank(stagingDirectory)) { throw new SamzaException("Staging directory can't be empty. " + "Is this not a yarn job (currently hdfs system consumer only works in " + "the same yarn environment on which hdfs is running)? " <START> + "Is STAGING_DIRECTORY not set (see HdfsConfig.scala)?"); <END> } return HdfsSystemAdmin.obtainPartitionDescriptorMap(stagingDirectory, streamName); } }); }</code><technical_language>put real config name here</technical_language>

Target:
public HdfsSystemConsumer(String systemName, Config config, HdfsSystemConsumerMetrics consumerMetrics) { super(consumerMetrics.getMetricsRegistry()); hdfsConfig = new HdfsConfig(config); readerType = HdfsReaderFactory.getType(hdfsConfig.getFileReaderType(systemName)); stagingDirectory = hdfsConfig.getStagingDirectory(); bufferCapacity = hdfsConfig.getConsumerBufferCapacity(systemName); numMaxRetires = hdfsConfig.getConsumerNumMaxRetries(systemName); readers = new ConcurrentHashMap<>(); readerRunnableStatus = new ConcurrentHashMap<>(); isShutdown = false; this.consumerMetrics = consumerMetrics; cachedPartitionDescriptorMap = CacheBuilder.newBuilder().build(new CacheLoader<String, Map<Partition, List<String>>>() { @Override public Map<Partition, List<String>> load(String streamName) throws Exception { Validate.notEmpty(streamName); if (StringUtils.isBlank(stagingDirectory)) { throw new SamzaException("Staging directory can't be empty. " + "Is this not a yarn job (currently hdfs system consumer only works in " + "the same yarn environment on which hdfs is running)? " + "Is STAGING_DIRECTORY (" + HdfsConfig.STAGING_DIRECTORY() + ") not set (see HdfsConfig.scala)?"); } return HdfsSystemAdmin.obtainPartitionDescriptorMap(stagingDirectory, streamName); } }); }
Source:
<code>private void bindNamed(Binding params, PreparedStatement statement) { List<String> paramList = stmt.getParams(); if (paramList.contains(POSITIONAL_PARAM)) { String msg = "Cannot mix named and positional parameters in a SQL statement: " + Joiner.on(", ").join(paramList); throw new UnableToExecuteStatementException(msg, context); } for (int i = 0; i < paramList.size(); i++) { String param = paramList.get(i); Argument a = params.findForName(param) .orElseThrow(() -> { String msg = String.format("Unable to execute, no named parameter matches \"%s\".", param); <START> return new UnableToExecuteStatementException(msg, context); <END> }); try { a.apply(i + 1, statement, this.context); } catch (SQLException e) { throw new UnableToCreateStatementException(String.format("Exception while binding '%s'", param), e, context); } } }</code><technical_language>I if a more terse form: java () -> new UnableToExecuteStatementException( String.format("Unable execute, named parameter matches \"%s\".", param), context)</technical_language>

Target:
private void bindNamed(Binding params, PreparedStatement statement) { List<String> paramList = stmt.getParams(); if (paramList.contains(POSITIONAL_PARAM)) { throw new UnableToExecuteStatementException( "Cannot mix named and positional parameters in a SQL statement: " + Joiner.on(", ").join(paramList), context); } for (int i = 0; i < paramList.size(); i++) { String param = paramList.get(i); try { params.findForName(param) .orElseThrow(() -> new UnableToExecuteStatementException( String.format("Unable to execute, no named parameter matches '%s'.", param), context)) .apply(i + 1, statement, context); } catch (SQLException e) { throw new UnableToCreateStatementException( String.format("Exception while binding named parameter '%s'", param), e, context); } } }
Source:
<code>public void testKieSessionsPool() { KieContainerSessionsPool pool = getKieContainer().newKieSessionsPool( 1 ); KieSession ksession = pool.newKieSession(); checkKieSession( ksession ); <START> ksession.dispose(); <END> try { ksession.insert( "test2" ); fail("it shouldn't be possible to operate on a disposed session even if created from a pool"); } catch (Exception e) { } KieSession ksession2 = pool.newKieSession(); assertSame( ksession, ksession2 ); assertNull( ksession2.getGlobal( "list" ) ); checkKieSession( ksession2 ); pool.shutdown(); try { ksession.insert( "test3" ); fail("after pool shutdown all sessions created from it should be disposed"); } catch (Exception e) { } try { pool.newKieSession(); fail("after pool shutdown it shouldn't be possible to get sessions from it"); } catch (Exception e) { } }</code><technical_language>I this is simple use, please add ksession.dispose() pool.shutdown() a finally block</technical_language>

Target:
public void testKieSessionsPool() { KieContainerSessionsPool pool = getKieContainer().newKieSessionsPool( 1 ); KieSession ksession = pool.newKieSession(); try { checkKieSession( ksession ); } finally { ksession.dispose(); } try { ksession.insert( "test2" ); fail("it shouldn't be possible to operate on a disposed session even if created from a pool"); } catch (Exception e) { } KieSession ksession2 = pool.newKieSession(); assertSame( ksession, ksession2 ); assertNull( ksession2.getGlobal( "list" ) ); checkKieSession( ksession2 ); pool.shutdown(); try { ksession.insert( "test3" ); fail("after pool shutdown all sessions created from it should be disposed"); } catch (IllegalStateException e) { } try { pool.newKieSession(); fail("after pool shutdown it shouldn't be possible to get sessions from it"); } catch (IllegalStateException e) { } }
Source:
<code>private BKHttpServiceProvider(BookieServer bookieServer, AutoRecoveryMain autoRecovery, ServerConfiguration serverConf) throws IOException, KeeperException, InterruptedException { this.bookieServer = bookieServer; this.autoRecovery = autoRecovery; this.serverConf = serverConf; this.zk = ZooKeeperClient.newBuilder() .connectString(serverConf.getZkServers()) .sessionTimeoutMs(serverConf.getZkTimeout()) .build(); ClientConfiguration clientConfiguration = new ClientConfiguration(serverConf) .setZkServers(serverConf.getZkServers()); this.bka = new BookKeeperAdmin(clientConfiguration); this.executor = Executors.newSingleThreadExecutor( <START> new ThreadFactoryBuilder().setNameFormat("BKHttpServiceThread").build()); <END> }</code><technical_language>thread factory create daemon threads, thread hold process open shutdown. shutdown executor if possible</technical_language>

Target:
private BKHttpServiceProvider(BookieServer bookieServer, AutoRecoveryMain autoRecovery, ServerConfiguration serverConf) throws IOException, KeeperException, InterruptedException { this.bookieServer = bookieServer; this.autoRecovery = autoRecovery; this.serverConf = serverConf; this.zk = ZooKeeperClient.newBuilder() .connectString(serverConf.getZkServers()) .sessionTimeoutMs(serverConf.getZkTimeout()) .build(); ClientConfiguration clientConfiguration = new ClientConfiguration(serverConf) .setZkServers(serverConf.getZkServers()); this.bka = new BookKeeperAdmin(clientConfiguration); this.executor = Executors.newSingleThreadExecutor( new ThreadFactoryBuilder().setNameFormat("BKHttpServiceThread").setDaemon(true).build()); }
Source:
<code>public void onCreate() { super.onCreate(); Collect.setStaticApplicationContext(this); AndroidClassHasher.registerAndroidClassHashStrategy(); AndroidUtil.initializeStaticHandlers(); CommCareApplication.app = this; PreInitLogger pil = new PreInitLogger(); Logger.registerLogger(pil); System.setProperty("http.keepAlive", "false"); Thread.setDefaultUncaughtExceptionHandler(new CommCareExceptionHandler(Thread.getDefaultUncaughtExceptionHandler())); PropertyManager.setPropertyManager(new ODKPropertyManager()); SQLiteDatabase.loadLibs(this); setRoots(); prepareTemporaryStorage(); dbState = initGlobalDb(); try { LegacyInstallUtils.checkForLegacyInstall(this, this.getGlobalStorage(ApplicationRecord.class)); } catch(StorageFullException sfe) { throw new RuntimeException(sfe); } finally { Logger.registerLogger(new AndroidLogger(this.getGlobalStorage(AndroidLogEntry.STORAGE_KEY, AndroidLogEntry.class))); pil.dumpToNewLogger(); } intializeDefaultLocalizerData(); resourceState = STATE_UNINSTALLED; <START> <END> resourceState = initializeAppResources(); ACRA.init(this); this.initACRA(); }</code><technical_language>tab changes? clean, right? IE: tabs -> spaces, spces -> tabs, right</technical_language>

Target:
public void onCreate() { super.onCreate(); Collect.setStaticApplicationContext(this); AndroidClassHasher.registerAndroidClassHashStrategy(); AndroidUtil.initializeStaticHandlers(); CommCareApplication.app = this; PreInitLogger pil = new PreInitLogger(); Logger.registerLogger(pil); System.setProperty("http.keepAlive", "false"); Thread.setDefaultUncaughtExceptionHandler(new CommCareExceptionHandler(Thread.getDefaultUncaughtExceptionHandler())); PropertyManager.setPropertyManager(new ODKPropertyManager()); SQLiteDatabase.loadLibs(this); setRoots(); prepareTemporaryStorage(); dbState = initGlobalDb(); try { LegacyInstallUtils.checkForLegacyInstall(this, this.getGlobalStorage(ApplicationRecord.class)); } catch (StorageFullException sfe) { throw new RuntimeException(sfe); } finally { Logger.registerLogger(new AndroidLogger(this.getGlobalStorage(AndroidLogEntry.STORAGE_KEY, AndroidLogEntry.class))); pil.dumpToNewLogger(); } intializeDefaultLocalizerData(); resourceState = initializeAppResources(); ACRA.init(this); this.initACRA(); }
Source:
<code>public CircuitBreakerRegistry circuitBreakerRegistry( EventConsumerRegistry<CircuitBreakerEvent> eventConsumerRegistry, RegistryEventConsumer<CircuitBreaker> circuitBreakerRegistryEventConsumer) { CircuitBreakerRegistry circuitBreakerRegistry = circuitBreakerConfiguration.createCircuitBreakerRegistry(circuitBreakerProperties, circuitBreakerRegistryEventConsumer); circuitBreakerConfiguration.registerEventConsumer(circuitBreakerRegistry, eventConsumerRegistry); HashMap<String, String> allTags = getAllTags(); <START> circuitBreakerConfiguration.initCircuitBreakerRegistry(circuitBreakerRegistry,allTags); <END> return circuitBreakerRegistry; }</code><technical_language>add space ,? I need checkstyle</technical_language>

Target:
public CircuitBreakerRegistry circuitBreakerRegistry( EventConsumerRegistry<CircuitBreakerEvent> eventConsumerRegistry, RegistryEventConsumer<CircuitBreaker> circuitBreakerRegistryEventConsumer) { CircuitBreakerRegistry circuitBreakerRegistry = circuitBreakerConfiguration.createCircuitBreakerRegistry(circuitBreakerProperties, circuitBreakerRegistryEventConsumer); circuitBreakerConfiguration .registerEventConsumer(circuitBreakerRegistry, eventConsumerRegistry); circuitBreakerConfiguration.initCircuitBreakerRegistry(circuitBreakerRegistry); return circuitBreakerRegistry; }
Source:
<code>public void bindDiscountCode(DiscountCode discountCode) { <START> String code = Utils.checkStringEmpty(discountCode.getCode()); <END> String discountUrl = Utils.checkStringEmpty(discountCode.getDiscount_url()); String tickets = Utils.checkStringEmpty(discountCode.getTickets()); String usedFor = Utils.checkStringEmpty(discountCode.getUsed_for()); int minQuantity = discountCode.getMin_quantity(); int maxQuantity = discountCode.getMax_quantity(); float value = discountCode.getValue(); setStringFieldWithPrefix(discountCodeTextView, code, ""); setStringFieldWithPrefix(discountCodeValue, "Value : "+value, ""); setStringFieldWithPrefix(discountMinQuantity, "Minimum Quantity : "+minQuantity, ""); setStringFieldWithPrefix(discountMaxQuantity, "Maximum Quantity :"+maxQuantity, ""); setStringFieldWithPrefix(discountTicket, tickets, "Tickets : "); setStringFieldWithPrefix(discountUsedFor, usedFor, "Used For : "); setStringFieldWithPrefix(this.discountUrl, discountUrl, "Discount URL : "); }</code><technical_language>extra lines</technical_language>

Target:
public void bindDiscountCode(DiscountCode discountCode) { String code = Utils.checkStringEmpty(discountCode.getCode()); String discountUrl = Utils.checkStringEmpty(discountCode.getDiscount_url()); String tickets = Utils.checkStringEmpty(discountCode.getTickets()); String usedFor = Utils.checkStringEmpty(discountCode.getUsed_for()); Resources res = context.getResources(); String minQuantity = String.format(res.getString(R.string.discount_code_min_quantity), discountCode.getMin_quantity()); String maxQuantity = String.format(res.getString(R.string.discount_code_max_quantity), discountCode.getMax_quantity()); String value = String.format(res.getString(R.string.discount_code_value), discountCode.getValue()); setStringFieldWithPrefix(discountCodeTextView, code, null); setStringFieldWithPrefix(discountCodeValue, value, null); setStringFieldWithPrefix(discountMinQuantity, minQuantity, null); setStringFieldWithPrefix(discountMaxQuantity, maxQuantity, null); setStringFieldWithPrefix(discountTicket, tickets, "Tickets : "); setStringFieldWithPrefix(discountUsedFor, usedFor, "Used For : "); setStringFieldWithPrefix(this.discountUrl, discountUrl, "Discount URL : "); }
Source:
<code>void sendMessageFailsIfConnectionNotOpened() { when(webSocketClient.isOpen()).thenReturn(false); assertThrows(IllegalStateException.class, () -> webSocketConnection.sendMessage(MESSAGE)); <START> verify(webSocketClient, times(0)).send(MESSAGE); <END> }</code><technical_language>nit: Mockito.never() AFAIK is preferred times(0) (in isEmpty() is preferred length == 0)</technical_language>

Target:
void sendMessageFailsIfConnectionNotOpened() { when(webSocketClient.isOpen()).thenReturn(false); assertThrows(IllegalStateException.class, () -> webSocketConnection.sendMessage(MESSAGE)); verify(webSocketClient, never()).send(MESSAGE); }
Source:
<code>private static Topology getTopology(final Properties streamsConfig, final String queryableStoreName, final boolean leftJoin) { final StreamsBuilder builder = new StreamsBuilder(); final KTable<Integer, Float> left = builder.table(LEFT_TABLE, Consumed.with(Serdes.Integer(), Serdes.Float())); final KTable<String, Long> right = builder.table(RIGHT_TABLE, Consumed.with(Serdes.String(), Serdes.Long())); final Materialized<Integer, String, KeyValueStore<Bytes, byte[]>> materialized = Materialized.<Integer, String>as(Stores.inMemoryKeyValueStore(queryableStoreName)) .withKeySerde(Serdes.Integer()) .withValueSerde(Serdes.String()) <START> .withCachingDisabled(); <END> final Function<Float, String> extractor = value -> Integer.toString((int) value.floatValue()); final ValueJoiner<Float, Long, String> joiner = (value1, value2) -> "value1=" + value1 + ",value2=" + value2; if (leftJoin) left.leftJoin(right, extractor, joiner, Named.as("customName"), materialized) .toStream() .to(OUTPUT, Produced.with(Serdes.Integer(), Serdes.String())); else left.join(right, extractor, joiner, Named.as("customName"), materialized) .toStream() .to(OUTPUT, Produced.with(Serdes.Integer(), Serdes.String())); return builder.build(streamsConfig); }</code><technical_language>test caching (to execute caching code path)? Note TDD flushes pipeInput() anyway</technical_language>

Target:
private static Topology getTopology(final Properties streamsConfig, final String queryableStoreName, final boolean leftJoin) { final StreamsBuilder builder = new StreamsBuilder(); final KTable<String, String> left = builder.table(LEFT_TABLE, Consumed.with(Serdes.String(), Serdes.String())); final KTable<String, String> right = builder.table(RIGHT_TABLE, Consumed.with(Serdes.String(), Serdes.String())); final Materialized<String, String, KeyValueStore<Bytes, byte[]>> materialized = Materialized.<String, String>as(Stores.inMemoryKeyValueStore(queryableStoreName)) .withKeySerde(Serdes.String()) .withValueSerde(Serdes.String()) .withCachingDisabled(); final Function<String, String> extractor = value -> value.split("\\|")[1]; final ValueJoiner<String, String, String> joiner = (value1, value2) -> "(" + value1 + "," + value2 + ")"; if (leftJoin) left.leftJoin(right, extractor, joiner, materialized) .toStream() .to(OUTPUT, Produced.with(Serdes.String(), Serdes.String())); else left.join(right, extractor, joiner, materialized) .toStream() .to(OUTPUT, Produced.with(Serdes.String(), Serdes.String())); return builder.build(streamsConfig); }
Source:
<code>ILogData read(long address) { if (!runtime.getParameters().isCacheDisabled()) { try { <START> readCache.get(address, () -> fetch(address)); <END> } catch (ExecutionException | UncheckedExecutionException e) { Throwable cause = e.getCause(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } else { throw new RuntimeException(cause); } } } return fetch(address); }</code><technical_language>Putting fetch get() good. If this api blocks writer, writer starve fetch a long time due hole fills. If this api block writer, NoRollBackException issue occur this reader override writer's undo record</technical_language>

Target:
ILogData read(long address) { if (!runtime.getParameters().isCacheDisabled()) { ILogData data = readCache.getIfPresent(address); if (data == null) { final ILogData loadedVal = fetch(address); return cacheLoadAndGet(readCache, address, loadedVal); } return data; } return fetch(address); }
Source:
<code>protected void executeVdsBrokerCommand() { <START> log.info("-- executeVdsBrokerCommand: calling 'merge'"); <END> status = getBroker().mergeSubchain(getParameters().getStorageJobId().toString(), SubchainInfoHelper.prepareSubchainInfoForVdsCommand(getParameters().getSubchainInfo())); proceedProxyReturnValue(); }</code><technical_language>/s/mergeSubcharin</technical_language>

Target:
protected void executeVdsBrokerCommand() { log.info("-- executeVdsBrokerCommand: calling 'mergeSubchain'"); status = getBroker().mergeSubchain(getParameters().getJobId().toString(), SubchainInfoHelper.prepareSubchainInfoForVdsCommand(getParameters().getSubchainInfo())); proceedProxyReturnValue(); }
Source:
<code>public SegmentLoaderLocalCacheManager( IndexIO indexIO, SegmentLoaderConfig config, @Json ObjectMapper mapper ) { this.indexIO = indexIO; this.config = config; this.jsonMapper = mapper; this.locations = new ArrayList<>(); for (StorageLocationConfig locationConfig : config.getLocations()) { locations.add( new StorageLocation( locationConfig.getPath(), locationConfig.getMaxSize(), locationConfig.getFreeSpacePercent() ) ); } this.strategy = config.getStorageLocationSelectorStrategy(); <START> this.strategy.setStorageLocations(ImmutableList.copyOf(locations)); <END> }</code><technical_language>locations effectively immutable. need a copy of it</technical_language>

Target:
public SegmentLoaderLocalCacheManager( IndexIO indexIO, SegmentLoaderConfig config, @Json ObjectMapper mapper ) { this.indexIO = indexIO; this.config = config; this.jsonMapper = mapper; this.locations = new ArrayList<>(); for (StorageLocationConfig locationConfig : config.getLocations()) { locations.add( new StorageLocation( locationConfig.getPath(), locationConfig.getMaxSize(), locationConfig.getFreeSpacePercent() ) ); } this.strategy = config.getStorageLocationSelectorStrategy(locations); }
Source:
<code>public void setFlows(final Map<String, Flow> flows) { <START> this.flows = new HashMap<>(flows); <END> }</code><technical_language>if want immutable, consider this.flows = Collections.unmodifiableMap(flows), for jobPropsMap propsList</technical_language>

Target:
public void setFlows(final Map<String, Flow> flows) { this.flows = ImmutableMap.copyOf(flows); }
Source:
<code>void peekBatchMessages() { final String messageId = UUID.randomUUID().toString(); final String contents = "Some-contents"; final ServiceBusMessage message = TestUtils.getServiceBusMessage(contents, messageId, 0); int maxMessages = 2; <START> StepVerifier.create(sender.send(message) <END> .then(sender.send(message)) .thenMany(receiver.peekBatch(maxMessages))) .expectNextCount(maxMessages) .verifyComplete(); }</code><technical_language>replace with: Mono.when()</technical_language>

Target:
void peekBatchMessages() { final String messageId = UUID.randomUUID().toString(); final String contents = "Some-contents"; final ServiceBusMessage message = TestUtils.getServiceBusMessage(contents, messageId, 0); int maxMessages = 2; StepVerifier.create(Mono.when(sender.send(message), sender.send(message)) .thenMany(receiver.peekBatch(maxMessages))) .expectNextCount(maxMessages) .verifyComplete(); }
Source:
<code>public static boolean deleteFileOrDir(File f) { if (!f.exists()) { return true; } if (f.isDirectory()) { for (File child : f.listFiles()) { if (!deleteFileOrDir(child)) { return false; } } } <START> Log.i(LOG_TOKEN, "Attempting to delete file: " + f.getAbsolutePath()); <END> return f.delete(); }</code><technical_language>this incredibly verbose. nix tihs</technical_language>

Target:
public static boolean deleteFileOrDir(File f) { if (!f.exists()) { return true; } if (f.isDirectory()) { for (File child : f.listFiles()) { if (!deleteFileOrDir(child)) { return false; } } } return f.delete(); }
Source:
<code>private List<String> fetchAllDatastreamNamesFromZk() { String path = KeyBuilder.datastreams(_cluster); if (_zkclient.exists(path)) { return _zkclient.getChildren(path, true); } <START> return Collections.emptyList(); <END> }</code><technical_language>add a warning message path exists</technical_language>

Target:
private List<String> fetchAllDatastreamNamesFromZk() { String path = KeyBuilder.datastreams(_cluster); if (_zkclient.exists(path)) { return _zkclient.getChildren(path, true); } else { LOG.warn("Brooklin cluster '{}' is not initialize yet.", _cluster); return Collections.emptyList(); } }
Source:
<code><START> public void verifyLogging() throws Exception { <END> GatewayResponse gatewayResponse = providerWillAuthorise(); walletAuthoriseService.doAuthorise(charge.getExternalId(), validApplePayDetails); ArgumentCaptor<LoggingEvent> loggingEventArgumentCaptor = ArgumentCaptor.forClass(LoggingEvent.class); verify(mockAppender, times(4)).doAppend(loggingEventArgumentCaptor.capture()); List<LoggingEvent> loggingEvents = loggingEventArgumentCaptor.getAllValues(); assertThat(loggingEvents.stream().anyMatch(le -> le.getFormattedMessage().contains( format("apple-pay authorisation success - charge_external_id=%s, payment provider response=%s", charge.getExternalId(), gatewayResponse.toString())) ), is(true)); }</code><technical_language>Nice test for logging</technical_language>

Target:
public void verifyLogging() throws Exception { GatewayResponse gatewayResponse = providerWillAuthorise(); walletAuthoriseService.doAuthorise(charge.getExternalId(), validApplePayDetails); ArgumentCaptor<LoggingEvent> loggingEventArgumentCaptor = ArgumentCaptor.forClass(LoggingEvent.class); verify(mockAppender, times(4)).doAppend(loggingEventArgumentCaptor.capture()); List<LoggingEvent> loggingEvents = loggingEventArgumentCaptor.getAllValues(); assertThat(loggingEvents.stream().anyMatch(le -> le.getFormattedMessage().contains( format("APPLE_PAY authorisation success - charge_external_id=%s, payment provider response=%s", charge.getExternalId(), gatewayResponse.toString())) ), is(true)); }
Source:
<code>public boolean start() { <START> List<SnapshotVO> dsnapshots = _snapshotDao.listAllByStatus(Snapshot.State.Destroying); <END> for (SnapshotVO snapshotVO : dsnapshots) { try { if (!deleteSnapshot(snapshotVO.getId())) { s_logger.debug("Failed to delete snapshot in destroying state with id " + snapshotVO.getUuid()); } } catch (Exception e) { s_logger.debug("Failed to delete snapshot in destroying state with id " + snapshotVO.getUuid()); } } return true; }</code><technical_language>Simply snapshots instead of 'dsnapshots'</technical_language>

Target:
public boolean start() { List<SnapshotVO> snapshots = _snapshotDao.listAllByStatus(Snapshot.State.Destroying); for (SnapshotVO snapshotVO : snapshots) { try { if (!deleteSnapshot(snapshotVO.getId())) { s_logger.debug("Failed to delete snapshot in destroying state with id " + snapshotVO.getUuid()); } } catch (Exception e) { s_logger.debug("Failed to delete snapshot in destroying state with id " + snapshotVO.getUuid()); } } return true; }
Source:
<code>protected void onLoadFailure(final String resultMessage) { <START> Log.e(Battlelog.TAG, "resultMessage => " + resultMessage); <END> }</code><technical_language>SharedGameEventUiBinder.class.getSimpleName() instead of generic TAG</technical_language>

Target:
protected void onLoadFailure(final String resultMessage) { Log.e(getClass().getSimpleName(), "resultMessage => " + resultMessage); }
Source:
<code>private static double megaBitToBit(double megaBit) { return megaBit * <START> 1000000; <END> }</code><technical_language>This is more readable if write this: 1_000_000</technical_language>

Target:
private static double megaBitToBit(double megaBit) { return megaBit * 1_000_000; }
Source:
<code>public void sendNowSync(Event event) { <START> sendNowSync(event); <END> }</code><technical_language>This is throwing a StackOverflowException if invoked. sendNow(event)</technical_language>

Target:
public void sendNowSync(Event event) { sendNow(event); }
Source:
<code>public Object getAdapter(@SuppressWarnings("rawtypes") final Class adapter) { Object result; <START> if ("interface org.eclipse.emf.facet.widgets.table.ui.internal.exported.ITableWidgetProvider".equals(adapter.toString())) { System.out.println(); } <END> if (adapter.isInstance(this)) { result = this; } else { result = this.widget.getAdapter(adapter); if (result == null) { result = super.getAdapter(adapter); } } return result; }</code><technical_language>I assume expect commit :-D</technical_language>

Target:
public Object getAdapter(@SuppressWarnings("rawtypes") final Class adapter) { Object result; if (adapter.isInstance(this)) { result = this; } else { result = this.widget.getAdapter(adapter); if (result == null) { result = super.getAdapter(adapter); } } return result; }
Source:
<code>private void txBeginInternal(boolean allowNestedTransactions) { if (TransactionalContext.isInTransaction()) { TxnContext txnContext = TransactionalContext.getRootContext().getTxnContext(); if (!allowNestedTransactions) { log.error("Current thread already has a transaction started and nested transactions are disabled!"); throw new TransactionAlreadyStartedException(TransactionalContext.getRootContext().toString()); } if (txnContext != null) { log.error("Cannot start new transaction in this thread without ending previous one"); throw new TransactionAlreadyStartedException(TransactionalContext.getRootContext().toString()); } <START> this.txnStartTime = System.nanoTime(); <END> log.warn("Reusing the transactional context created outside this layer!"); return; } this.txnStartTime = System.nanoTime(); Transaction.TransactionBuilder transactionBuilder = this.objectsView .TXBuild() .type(TransactionType.WRITE_AFTER_WRITE); if (isolationLevel.getTimestamp() != Token.UNINITIALIZED) { transactionBuilder.snapshot(isolationLevel.getTimestamp()); } transactionBuilder.build().begin(); TransactionalContext.getRootContext().setTxnContext(this); }</code><technical_language>Is this correct</technical_language>

Target:
private void txBeginInternal(boolean allowNestedTransactions) { if (TransactionalContext.isInTransaction()) { TxnContext txnContext = TransactionalContext.getRootContext().getTxnContext(); if (!allowNestedTransactions) { log.error("Nested transactions are disabled & current thread already has a transaction started at..."); for (StackTraceElement st : TransactionalContext.getRootContext().getBeginTxnStackTrace()) { log.error("{}", st); } throw new TransactionAlreadyStartedException(TransactionalContext.getRootContext().toString()); } if (txnContext != null) { log.error("Cannot start new CorfuStore transaction in this thread without ending previous one at..."); for (StackTraceElement st : TransactionalContext.getRootContext().getBeginTxnStackTrace()) { log.error("{}", st); } throw new TransactionAlreadyStartedException(TransactionalContext.getRootContext().toString()); } this.txnStartTime = System.nanoTime(); log.warn("Reusing the transactional context created outside this layer!"); this.iDidNotStartCorfuTxn = true; TransactionalContext.getRootContext().setTxnContext(this); return; } log.debug("TxnContext: begin transaction in namespace {}", namespace); this.txnStartTime = System.nanoTime(); Transaction.TransactionBuilder transactionBuilder = this.objectsView .TXBuild() .type(TransactionType.WRITE_AFTER_WRITE); if (isolationLevel.getTimestamp() != Token.UNINITIALIZED) { transactionBuilder.snapshot(isolationLevel.getTimestamp()); } transactionBuilder.build().begin(); TransactionalContext.getRootContext().setTxnContext(this); }
Source:
<code><START> public List<String> getDownloadedPluginFilenames() { <END> List<String> names = new ArrayList<>(); for (File file : listPlugins(this.downloadDir)) { names.add(file.getName()); } return names; }</code><technical_language>public</technical_language>

Target:
List<String> getDownloadedPluginFilenames() { List<String> names = new ArrayList<>(); for (File file : listPlugins(this.downloadDir)) { names.add(file.getName()); } return names; }
Source:
<code>public void refresh() { _vdcOptionCache.clear(); List<VdcOption> list = getVdcOptionDao().getAll(); <START> list = moveDependentToEnd(list); <END> for (VdcOption option : list) { try { if (!_vdcOptionCache.containsKey(option.getOptionName()) || !_vdcOptionCache.get(option.getOptionName()).containsKey(option.getVersion()) || isReloadable(option.getOptionName())) { updateOption(option); } } catch (NoSuchFieldException e) { log.error("Not refreshing field '{}': does not exist in class {}.", option.getOptionName(), ConfigValues.class.getSimpleName()); } } }</code><technical_language>Please simplify: List<VdcOption> list = moveDependentToEnd(getVdcOptionDao().getAll());</technical_language>

Target:
public void refresh() { _vdcOptionCache.clear(); List<VdcOption> list = moveDependentToEnd(getVdcOptionDao().getAll()); for (VdcOption option : list) { try { if (!_vdcOptionCache.containsKey(option.getOptionName()) || !_vdcOptionCache.get(option.getOptionName()).containsKey(option.getVersion()) || isReloadable(option.getOptionName())) { updateOption(option); } } catch (NoSuchFieldException e) { log.error("Not refreshing field '{}': does not exist in class {}.", option.getOptionName(), ConfigValues.class.getSimpleName()); } } }
Source:
<code><START> public WebSocketClientHandshaker07(URI webSocketURL, WebSocketVersion version, String subprotocol, <END> boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength, boolean performMasking, boolean allowMaskMismatch, long forceCloseTimeoutMillis, boolean absoluteUpgradeUrl, String httpRequestEncoderName, String httpResponseDecoderName) { super(webSocketURL, version, subprotocol, customHeaders, maxFramePayloadLength, forceCloseTimeoutMillis, absoluteUpgradeUrl, httpRequestEncoderName, httpResponseDecoderName); this.allowExtensions = allowExtensions; this.performMasking = performMasking; this.allowMaskMismatch = allowMaskMismatch; }</code><technical_language>this package-private for</technical_language>

Target:
WebSocketClientHandshaker07(URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength, boolean performMasking, boolean allowMaskMismatch, long forceCloseTimeoutMillis, boolean absoluteUpgradeUrl, String httpRequestEncoderName, String httpResponseDecoderName) { super(webSocketURL, version, subprotocol, customHeaders, maxFramePayloadLength, forceCloseTimeoutMillis, absoluteUpgradeUrl, httpRequestEncoderName, httpResponseDecoderName); this.allowExtensions = allowExtensions; this.performMasking = performMasking; this.allowMaskMismatch = allowMaskMismatch; }
Source:
<code>private Source getSource(final String uriParam) throws XPathException { try { final URI uri = new URI(uriParam); if (uri.getFragment() != null) { throw new XPathException(this, ErrorCodes.FOUT1170, "href argument may not contain fragment identifier"); } final Source source = SourceFactory.getSource(context.getBroker(), "", uri.toASCIIString(), false); if (source == null) { throw new XPathException(this, ErrorCodes.FOUT1170, "Could not find source for: " + uriParam); } <START> if (source.getInputStream()==null) { <END> throw new XPathException(this, ErrorCodes.FOUT1170, "Unable to retrieve bytestream from " + uriParam); } if (source instanceof FileSource && !context.getBroker().getCurrentSubject().hasDbaRole()) { throw new PermissionDeniedException("non-dba user not allowed to read from file system"); } return source; } catch (final IOException | PermissionDeniedException | URISyntaxException e) { throw new XPathException(this, ErrorCodes.FOUT1170, e.getMessage()); } }</code><technical_language>I this is safe do. In some instances calling source.getInputStream is idempotent operation</technical_language>

Target:
private Source getSource(final String uriParam) throws XPathException { try { final URI uri = new URI(uriParam); if (uri.getFragment() != null) { throw new XPathException(this, ErrorCodes.FOUT1170, "href argument may not contain fragment identifier"); } final Source source = SourceFactory.getSource(context.getBroker(), "", uri.toASCIIString(), false); if (source == null) { throw new XPathException(this, ErrorCodes.FOUT1170, "Could not find source for: " + uriParam); } if (source instanceof FileSource && !context.getBroker().getCurrentSubject().hasDbaRole()) { throw new PermissionDeniedException("non-dba user not allowed to read from file system"); } return source; } catch (final IOException | PermissionDeniedException | URISyntaxException e) { throw new XPathException(this, ErrorCodes.FOUT1170, e.getMessage()); } }
Source:
<code>public Map<String, Object> convert(Map<String, Object> claims) { Assert.notNull(claims, "claims cannot be null"); Map<String, Object> mappedClaims = new HashMap<>(claims); for (Map.Entry<String, Converter<Object, ?>> entry : this.attributeConverters.entrySet()) { <START> Converter<Object, ?> converter = this.attributeConverters.get(entry.getKey()); <END> if (converter != null) { Object claim = claims.get(entry.getKey()); Object mappedClaim = converter.convert(claim); put(mappedClaims, entry.getKey(), mappedClaim); } } Instant issuedAt = (Instant) mappedClaims.get(JwtClaimNames.IAT); Instant expiresAt = (Instant) mappedClaims.get(JwtClaimNames.EXP); if (issuedAt == null && expiresAt != null) { mappedClaims.put(JwtClaimNames.IAT, expiresAt.minusSeconds(1)); } return mappedClaims; }</code><technical_language>get converter entry.getValue() slightly performance</technical_language>

Target:
public Map<String, Object> convert(Map<String, Object> claims) { Assert.notNull(claims, "claims cannot be null"); Map<String, Object> mappedClaims = new HashMap<>(claims); for (Map.Entry<String, Converter<Object, ?>> entry : this.claimConverters.entrySet()) { String claimName = entry.getKey(); Converter<Object, ?> converter = entry.getValue(); if (converter != null) { Object claim = claims.get(claimName); Object mappedClaim = converter.convert(claim); mappedClaims.compute(claimName, (key, value) -> mappedClaim); } } Instant issuedAt = (Instant) mappedClaims.get(JwtClaimNames.IAT); Instant expiresAt = (Instant) mappedClaims.get(JwtClaimNames.EXP); if (issuedAt == null && expiresAt != null) { mappedClaims.put(JwtClaimNames.IAT, expiresAt.minusSeconds(1)); } return mappedClaims; }
Source:
<code>public String toString() { return "LdapAuthenticationConfig [url=" + url + ", socketFactoryClassName=" + socketFactoryClassName + ", systemUserDn=" <START> + systemUserDn + ", systemUserPassword=" + systemUserPassword + ", parseDn=" + parseDn + ", roleContext=" <END> + roleContext + ", roleFilter=" + roleFilter + ", roleMappingAttribute=" + roleMappingAttribute + ", roleMappingMode=" + roleMappingMode + ", roleNameAttribute=" + roleNameAttribute + ", roleRecursionMaxDepth=" + roleRecursionMaxDepth + ", roleSearchScope=" + roleSearchScope + ", userNameAttribute=" + userNameAttribute + ", passwordAttribute=" + passwordAttribute + ", userContext=" + userContext + ", userFilter=" + userFilter + ", userSearchScope=" + userSearchScope + ", skipAuthentication=" + skipAuthentication + ", getSkipIdentity()=" + getSkipIdentity() + ", getSkipEndpoint()=" + getSkipEndpoint() + ", getSkipRole()=" + getSkipRole() + "]"; }</code><technical_language>do print a secret systemUserPassword here</technical_language>

Target:
public String toString() { return "LdapAuthenticationConfig [url=" + url + ", socketFactoryClassName=" + socketFactoryClassName + ", systemUserDn=" + systemUserDn + ", systemUserPassword=***, parseDn=" + parseDn + ", roleContext=" + roleContext + ", roleFilter=" + roleFilter + ", roleMappingAttribute=" + roleMappingAttribute + ", roleMappingMode=" + roleMappingMode + ", roleNameAttribute=" + roleNameAttribute + ", roleRecursionMaxDepth=" + roleRecursionMaxDepth + ", roleSearchScope=" + roleSearchScope + ", userNameAttribute=" + userNameAttribute + ", passwordAttribute=" + passwordAttribute + ", userContext=" + userContext + ", userFilter=" + userFilter + ", userSearchScope=" + userSearchScope + ", skipAuthentication=" + skipAuthentication + ", getSkipIdentity()=" + getSkipIdentity() + ", getSkipEndpoint()=" + getSkipEndpoint() + ", getSkipRole()=" + getSkipRole() + "]"; }
Source:
<code>for (int i = -12; i <= 14; i++) { TimeZone timeZone; String pgZoneName; if (i == 0) { timeZone = TimeZone.getTimeZone("GMT"); pgZoneName = "GMT"; } else { timeZone = TimeZone.getTimeZone("GMT" + (i <= 0 ? "+" : "-") + Math.abs(i)); pgZoneName = "GMT" + (i >= 0 ? "+" : "-"); } if (i == 0) { GMT_ZONES.put(pgZoneName, timeZone); continue; } GMT_ZONES.put(pgZoneName + Math.abs(i), timeZone); <START> GMT_ZONES.put(pgZoneName + Arrays.toString(NUMBERS[Math.abs(i)]), timeZone); <END> }</code><technical_language>Please new String(NUMBERS[Math.abs(i)]) here. deserve PR, however, fine if fix here. idea is Math.abs(i) produces 7 while new String(NUMBERS[Math.abs(i)]) produce 07</technical_language>

Target:
for (int i = -12; i <= 14; i++) { TimeZone timeZone; String pgZoneName; if (i == 0) { timeZone = TimeZone.getTimeZone("GMT"); pgZoneName = "GMT"; } else { timeZone = TimeZone.getTimeZone("GMT" + (i <= 0 ? "+" : "-") + Math.abs(i)); pgZoneName = "GMT" + (i >= 0 ? "+" : "-"); } if (i == 0) { GMT_ZONES.put(pgZoneName, timeZone); continue; } GMT_ZONES.put(pgZoneName + Math.abs(i), timeZone); GMT_ZONES.put(pgZoneName + new String(NUMBERS[Math.abs(i)]), timeZone); }
Source:
<code><START> public void setCcJudgment(CommonCourtJudgment ccJudgment) { <END> this.ccJudgment = ccJudgment; }</code><technical_language>I do setters package private</technical_language>

Target:
void setCcJudgment(CommonCourtJudgment ccJudgment) { this.ccJudgment = ccJudgment; }
Source:
<code>public static Test suite() { final TestSuite suite = new TestSuite("Sirius tests"); String testClassQualifiedName = System.getenv("TEST_CLASS_NAME"); if (testClassQualifiedName != null && testClassQualifiedName.length() > 0) { try { Class<?> testToLaunch = <START> Class.forName(testClassQualifiedName); <END> if (TestCase.class.isAssignableFrom(testToLaunch)) { suite.addTestSuite((Class<? extends TestCase>) testToLaunch); } } catch (ClassNotFoundException e) { fail("The class " + testClassQualifiedName + ", to launch for test specific case, has not been found."); } } else { addGerritPart(suite); AllCommonPluginTests.addNonGerritPart(suite); AllDiagramPluginsTests.addNonGerritPart(suite); } return suite; }</code><technical_language>I SiriusTestsPlugin.getDefault().getBundle().loadClass(fqn) more reliable in OSGi context</technical_language>

Target:
public static Test suite() { final TestSuite suite = new TestSuite("Sirius tests"); String testClassQualifiedName = System.getenv("TEST_CLASS_NAME"); if (testClassQualifiedName != null && testClassQualifiedName.length() > 0) { try { Class<?> testToLaunch = SiriusTestsPlugin.getDefault().getBundle().loadClass(testClassQualifiedName); if (TestCase.class.isAssignableFrom(testToLaunch)) { suite.addTestSuite((Class<? extends TestCase>) testToLaunch); } } catch (ClassNotFoundException e) { fail("The class " + testClassQualifiedName + ", to launch for test specific case, has not been found."); } } else { addGerritPart(suite); AllCommonPluginTests.addNonGerritPart(suite); AllDiagramPluginsTests.addNonGerritPart(suite); } return suite; }
Source:
<code>public void doRss( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { <START> Jenkins.get().checkPermission(Jenkins.SYSTEM_READ); <END> LogRecorderManager.doRss(req,rsp,getLogRecords()); }</code><technical_language>Redundant <LINK_1> <LINK_0></technical_language>

Target:
public void doRss( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { LogRecorderManager.doRss(req,rsp,getLogRecords()); }
Source:
<code>public void tick(Level level) { this.motion = this.motion.add(newMotion); this.newMotion = new Point(0, 0); double x = this.motion.getX(); this.motion.setX( Math.max(Math.min(x, GameConstants.MAX_X_SPEED), <START> -GameConstants.MAX_X_SPEED) * this.getUnitSpeedMultiplier()); <END> Point movement = motion.divide(GameConstants.TICKS_PER_SEC); this.handler = new CollisionHandler(level); this.handler.checkUnitsAABB(this); this.location = handler.findNextPosition(this).getPoint(); if (!movement.equals(new Point(0, 0))) { addToLog("[MOVER]\tMoved to " + this.location.toString()); } applyGravity(); ArtificialIntelligence artificialintelligence = new ArtificialIntelligence(level); artificialintelligence.aiMover(); }</code><technical_language>identation is a mess. < layout</technical_language>

Target:
public void tick(Level level) { this.motion = this.motion.add(newMotion); this.newMotion = new Point(0, 0); double x = this.motion.getX(); this.motion.setX( Math.max(Math.min(x, GameConstants.MAX_X_SPEED), -GameConstants.MAX_X_SPEED) * this.getSpeedMultiplier()); Point movement = motion.divide(GameConstants.TICKS_PER_SEC); this.handler = new CollisionHandler(level); this.handler.checkUnitsAABB(this); this.location = handler.findNextPosition(this).getPoint(); if (!movement.equals(new Point(0, 0))) { addToLog("[MOVER]\tMoved to " + this.location.toString()); } applyGravity(); ArtificialIntelligence artificialintelligence = new ArtificialIntelligence(level); artificialintelligence.aiMover(); }