auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean isInsideStructure(World worldIn, String structureName, BlockPos position) { if (this.baseGenerator instanceof SpongeGenerationPopulator) { return ((SpongeGenerationPopulator) this.baseGenerator).getHandle(this.world).isInsideStructure(worldIn, structureName, position); } Class<? extends MapGenStructure> target = null; if ("Stronghold".equals(structureName)) { target = MapGenStronghold.class; } else if ("Mansion".equals(structureName)) { target = WoodlandMansion.class; } else if ("Monument".equals(structureName)) { target = StructureOceanMonument.class; } else if ("Village".equals(structureName)) { target = MapGenVillage.class; } else if ("Mineshaft".equals(structureName)) { target = MapGenMineshaft.class; } else if ("Temple".equals(structureName)) { target = MapGenScatteredFeature.class; } else if ("Fortress".equals(structureName)) { target = MapGenNetherBridge.class; } else if ("EndCity".equals(structureName)) { target = MapGenEndCity.class; } if (target == null) { return false; } for (GenerationPopulator gen : this.genpop) { if (target.isInstance(gen)) { return ((MapGenStructure) gen).isInsideStructure(position); } } return false; }

Target:
public boolean isInsideStructure(World worldIn, String structureName, BlockPos position) { Class<? extends MapGenStructure> target = null; if ("Stronghold".equals(structureName)) { target = MapGenStronghold.class; } else if ("Mansion".equals(structureName)) { target = WoodlandMansion.class; } else if ("Monument".equals(structureName)) { target = StructureOceanMonument.class; } else if ("Village".equals(structureName)) { target = MapGenVillage.class; } else if ("Mineshaft".equals(structureName)) { target = MapGenMineshaft.class; } else if ("Temple".equals(structureName)) { target = MapGenScatteredFeature.class; } else if ("Fortress".equals(structureName)) { target = MapGenNetherBridge.class; } else if ("EndCity".equals(structureName)) { target = MapGenEndCity.class; } if (target != null) { for (GenerationPopulator gen : this.genpop) { if (target.isInstance(gen)) { return ((MapGenStructure) gen).isInsideStructure(position); } } } if (this.baseGenerator instanceof SpongeGenerationPopulator) { return ((SpongeGenerationPopulator) this.baseGenerator).getHandle(this.world).isInsideStructure(worldIn, structureName, position); } return false; }
Source:
public void start() { if (getBoolean(IGNITE_JVM_PAUSE_DETECTOR_DISABLED, false)) { if (LOG.isDebugEnabled()) LOG.debug("JVM Pause Detector is disabled."); return; } final Thread worker = new Thread("jvm-pause-detector-worker") { private long prev = System.currentTimeMillis(); @Override public void run() { if (LOG.isDebugEnabled()) LOG.debug(getName() + " has been started."); while (true) { try { Thread.sleep(PRECISION); final long now = System.currentTimeMillis(); final long pause = now - PRECISION - prev; prev = now; if (pause >= THRESHOLD) { LOG.warning("Possible too long JVM pause: " + pause + " milliseconds."); synchronized (LongJVMPauseDetector.class) { final int next = (int)(longPausesCnt % EVT_CNT); longPausesCnt++; longPausesTotalDuration += pause; longPausesTimestamps[next] = now; longPausesDurations[next] = pause; } } } catch (InterruptedException e) { LOG.error(getName() + " has been interrupted", e); break; } } } }; if (!workerRef.compareAndSet(null, worker)) { LOG.warning(LongJVMPauseDetector.class.getSimpleName() + " already started!"); return; } worker.setDaemon(true); worker.start(); }

Target:
public void start() { if (getBoolean(IGNITE_JVM_PAUSE_DETECTOR_DISABLED, false)) { if (log.isDebugEnabled()) log.debug("JVM Pause Detector is disabled."); return; } final Thread worker = new Thread("jvm-pause-detector-worker") { private long prev = System.currentTimeMillis(); @Override public void run() { if (log.isDebugEnabled()) log.debug(getName() + " has been started."); while (true) { try { Thread.sleep(PRECISION); final long now = System.currentTimeMillis(); final long pause = now - PRECISION - prev; prev = now; if (pause >= THRESHOLD) { log.warning("Possible too long JVM pause: " + pause + " milliseconds."); synchronized (LongJVMPauseDetector.this) { final int next = (int)(longPausesCnt % EVT_CNT); longPausesCnt++; longPausesTotalDuration += pause; longPausesTimestamps[next] = now; longPausesDurations[next] = pause; } } } catch (InterruptedException e) { log.error(getName() + " has been interrupted", e); break; } } } }; if (!workerRef.compareAndSet(null, worker)) { log.warning(LongJVMPauseDetector.class.getSimpleName() + " already started!"); return; } worker.setDaemon(true); worker.start(); if (log.isDebugEnabled()) log.debug("LongJVMPauseDetector was successfully started"); }
Source:
public synchronized void renameRSGroup(String oldName, String newName) throws IOException { if (oldName.equals(RSGroupInfo.DEFAULT_GROUP)) { throw new ConstraintException(RSGroupInfo.DEFAULT_GROUP + " can't be rename"); } checkGroupName(newName); RSGroupInfo oldRSG = getRSGroupInfo(oldName); Map<String, RSGroupInfo> rsGroupMap = holder.groupName2Group; if (rsGroupMap.get(newName) != null) { throw new ConstraintException("Group already exists: " + newName); } Map<String, RSGroupInfo> newGroupMap = Maps.newHashMap(rsGroupMap); newGroupMap.remove(oldRSG.getName()); RSGroupInfo newRSG = new RSGroupInfo(newName, oldRSG.getServers()); newGroupMap.put(newName, newRSG); flushConfig(newGroupMap); Set<TableName> updateTables = masterServices.getTableDescriptors().getAll().values() .stream() .filter(t -> oldName.equals(t.getRegionServerGroup().orElse(null))) .map(TableDescriptor::getTableName) .collect(Collectors.toSet()); setRSGroup(updateTables, newName); }

Target:
public synchronized void renameRSGroup(String oldName, String newName) throws IOException { if (oldName.equals(RSGroupInfo.DEFAULT_GROUP)) { throw new ConstraintException(RSGroupInfo.DEFAULT_GROUP + " can't be rename"); } checkGroupName(newName); RSGroupInfo oldRSG = getRSGroupInfo(oldName); Map<String, RSGroupInfo> rsGroupMap = holder.groupName2Group; if (rsGroupMap.containsKey(newName)) { throw new ConstraintException("Group already exists: " + newName); } Map<String, RSGroupInfo> newGroupMap = Maps.newHashMap(rsGroupMap); newGroupMap.remove(oldRSG.getName()); RSGroupInfo newRSG = new RSGroupInfo(newName, oldRSG.getServers()); newGroupMap.put(newName, newRSG); flushConfig(newGroupMap); Set<TableName> updateTables = masterServices.getTableDescriptors().getAll().values() .stream() .filter(t -> oldName.equals(t.getRegionServerGroup().orElse(null))) .map(TableDescriptor::getTableName) .collect(Collectors.toSet()); setRSGroup(updateTables, newName); }
Source:
private boolean keyEquals(ByteBuffer curKeyBuffer, ByteBuffer buffer, int bufferOffset) { int i = 0; for (; i + Long.BYTES <= keySize; i += Long.BYTES) { if (curKeyBuffer.getLong(i) != buffer.getLong(bufferOffset + i)) { return false; } } for (; i + Integer.BYTES <= keySize; i += Integer.BYTES) { if (curKeyBuffer.getInt(i) != buffer.getInt(bufferOffset + i)) { return false; } } for (; i < keySize; i++) { if (curKeyBuffer.get(i) != buffer.get(bufferOffset + i)) { return false; } } return true; }

Target:
private boolean keyEquals(ByteBuffer curKeyBuffer, ByteBuffer buffer, int bufferOffset) { int i = 0; for (; i + Long.BYTES <= keySize; i += Long.BYTES) { if (curKeyBuffer.getLong(i) != buffer.getLong(bufferOffset + i)) { return false; } } if (i + Integer.BYTES <= keySize) { if (curKeyBuffer.getInt(i) != buffer.getInt(bufferOffset + i)) { return false; } i += Integer.BYTES; } for (; i < keySize; i++) { if (curKeyBuffer.get(i) != buffer.get(bufferOffset + i)) { return false; } } return true; }
Source:
public final String handleDigest(String method, String uri, List<Map<String, String>> challenges, Supplier<byte[]> entityBodySupplier) { authorizationPipeliningType.set(DIGEST); Map<String, List<Map<String, String>>> challengesByType = partitionByChallengeType(challenges); for (String algorithm : ALGORITHM_PREFERENCE_ORDER) { if (!challengesByType.containsKey(algorithm)) { continue; } Function<byte[], byte[]> digestFunction = getDigestFunction(algorithm); if (digestFunction == null) { continue; } Map<String, String> challenge = new ConcurrentHashMap<>(challengesByType.get(algorithm).get(0)); lastChallenge.set(challenge); return createDigestAuthorizationHeader(method, uri, challenge, algorithm, entityBodySupplier, digestFunction); } return null; }

Target:
public final String handleDigest(String method, String uri, List<Map<String, String>> challenges, Supplier<byte[]> entityBodySupplier) { authorizationPipeliningType.set(DIGEST); Map<String, List<Map<String, String>>> challengesByType = partitionByChallengeType(challenges); for (String algorithm : ALGORITHM_PREFERENCE_ORDER) { if (!challengesByType.containsKey(algorithm)) { continue; } Function<byte[], byte[]> digestFunction = getDigestFunction(algorithm); if (digestFunction == null) { continue; } ConcurrentHashMap<String, String> challenge = new ConcurrentHashMap<>(challengesByType.get(algorithm) .get(0)); lastChallenge.set(challenge); return createDigestAuthorizationHeader(method, uri, challenge, algorithm, entityBodySupplier, digestFunction); } return null; }
Source:
public String getFrameworkRole() { return Optional.fromNullable(frameworkRole).or("*"); }

Target:
public String getFrameworkRole() { return Optional.fromNullable(frameworkRole).or(DEFAULT_ROLE); }
Source:
@Override protected void configure() { BouncyCastle.require(); bind(Clock.class).toInstance(Clock.systemUTC()); install(new CookieModule(config.getCookieKey())); install(new CryptoModule(config.getDerivationProviderClass(), config.getContentKeyStore())); bind(CookieConfig.class).annotatedWith(SessionCookie.class) .toInstance(config.getSessionCookieConfig()); bind(CookieConfig.class).annotatedWith(Xsrf.class) .toInstance(config.getXsrfCookieConfig()); bind(Environment.class).toInstance(environment); bind(Configuration.class).toInstance(config); bind(KeywhizConfig.class).toInstance(config); install(new SecretGeneratorBindingModule() { @Override protected void configure() { bindSecretGenerator("templated", TemplatedSecretGenerator.class); } }); environment.healthChecks().register("postgres-readonly-health", new HealthCheck() { @Override protected Result check() { try (Connection connection = readonlyDataSource(environment, config).getConnection()) { DSLContext readOnlyDB = DSL.using(connection); readOnlyDB.selectOne().execute(); return Result.healthy(); } catch (DataAccessException|SQLException e) { return Result.unhealthy("Unhealthy connection to readonly database."); } } }); }

Target:
@Override protected void configure() { BouncyCastle.require(); bind(Clock.class).toInstance(Clock.systemUTC()); install(new CookieModule(config.getCookieKey())); install(new CryptoModule(config.getDerivationProviderClass(), config.getContentKeyStore())); bind(CookieConfig.class).annotatedWith(SessionCookie.class) .toInstance(config.getSessionCookieConfig()); bind(CookieConfig.class).annotatedWith(Xsrf.class) .toInstance(config.getXsrfCookieConfig()); bind(Environment.class).toInstance(environment); bind(Configuration.class).toInstance(config); bind(KeywhizConfig.class).toInstance(config); install(new SecretGeneratorBindingModule() { @Override protected void configure() { bindSecretGenerator("templated", TemplatedSecretGenerator.class); } }); }
Source:
public List<Integer> queryDailyMetrics(String targetType, String targetId, String name, LocalDate from, LocalDate to) { List<Integer> result = new ArrayList<>(); LocalDate date = from; while (!date.isAfter(to)) { result.add(queryMetric(getDailyMetricType(), targetType, targetId, name, date.getYear(), date.getMonthValue(), date.getDayOfMonth())); date = date.plusDays(1); } return result; }

Target:
public List<Integer> queryDailyMetrics(String targetType, String targetId, String name, LocalDate from, LocalDate to) { List<Integer> result = new ArrayList<>(); LocalDate date = from; AtomicInteger limit = new AtomicInteger(MAX_DAILY_METRICS); while (!date.isAfter(to) && limit.decrementAndGet() > 0) { result.add(queryMetric(getDailyMetricType(), targetType, targetId, name, date.getYear(), date.getMonthValue(), date.getDayOfMonth())); date = date.plusDays(1); } return result; }
Source:
public void contextInitialized(ServletContextEvent sce) { try { String log4jPropertyFile = sce.getServletContext().getInitParameter(LOG_PROPERTIES_FILE_KEY); if (log4jPropertyFile != null && !log4jPropertyFile.isEmpty()) { String basePath = sce.getServletContext().getRealPath("/"); System.out.println("Application BasePath:" + basePath); PropertyConfigurator.configure(basePath + "/" + log4jPropertyFile); } else { System.err.println("WARN - Empty value for " + LOG_PROPERTIES_FILE_KEY + ", using BasicConfigurator"); BasicConfigurator.configure(); } } catch (Exception exc) { System.err.println("WARNING - log4j property configurator gave error, falling back to basic configurator"); exc.printStackTrace(); BasicConfigurator.configure(); } HiveConf conf = new HiveConf(); GrillServices services = GrillServices.get(); services.init(conf); services.start(); GrillApplication.init(conf); Runtime.getRuntime().addShutdownHook(new Thread(new CompositeService.CompositeServiceShutdownHook(services))); }

Target:
public void contextInitialized(ServletContextEvent sce) { try { String log4jPropertyFile = sce.getServletContext().getInitParameter(LOG_PROPERTIES_FILE_KEY); if (log4jPropertyFile != null && !log4jPropertyFile.isEmpty()) { String basePath = sce.getServletContext().getRealPath("/"); System.out.println("Application BasePath:" + basePath); PropertyConfigurator.configure(basePath + "/" + log4jPropertyFile); } else { System.err.println("WARN - Empty value for " + LOG_PROPERTIES_FILE_KEY + ", using BasicConfigurator"); BasicConfigurator.configure(); } } catch (Exception exc) { System.err.println("WARNING - log4j property configurator gave error, falling back to basic configurator"); exc.printStackTrace(); BasicConfigurator.configure(); } HiveConf conf = GrillServerConf.get(); GrillServices services = GrillServices.get(); services.init(conf); services.start(); Runtime.getRuntime().addShutdownHook(new Thread(new CompositeService.CompositeServiceShutdownHook(services))); }
Source:
public void onResume() { super.onResume(); mMapView.resume(); if (mHotspotMapImageLayer != null) { addLayerToMapView(mHotspotMapImageLayer, mMapView); if (mHotspotMapImageLayer.getLoadStatus() == LoadStatus.LOADED) { mMapView.setViewpoint(new Viewpoint(mHotspotMapImageLayer.getFullExtent())); } } }

Target:
public void onResume() { super.onResume(); mMapView.resume(); }
Source:
public String getId() { return this.instructorId; }

Target:
public String getId() { return id; }
Source:
public ColumnNamingSession startColumnNamingSession() { return new ColumnNamingSession() { private final Set<String> names = new HashSet<>(); @Override public String getNextColumnName(ColumnNamingContext ctx) { final String intrinsicName = ctx.getIntrinsicColumnName(); boolean unique = names.add(intrinsicName); if (unique) { return intrinsicName; } String newName = null; for (int i = 2; !unique; i++) { newName = intrinsicName + i; unique = names.add(newName); } return newName; } @Override public void close() { } }; }

Target:
public ColumnNamingSession startColumnNamingSession() { return new ColumnNamingSession() { private final Set<String> names = new HashSet<>(); @Override public String getNextColumnName(ColumnNamingContext ctx) { final String intrinsicName = ctx.getIntrinsicColumnName(); boolean unique = names.add(intrinsicName); if (unique) { return intrinsicName; } String newName = null; for (int i = 2; !unique; i++) { newName = intrinsicName + '_' + i; unique = names.add(newName); } return newName; } @Override public void close() { } }; }
Source:
public DeeprootWaters(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}"); this.addAbility(new SpellCastControllerTriggeredAbility(new CreateTokenEffect(new MerfolkHexproofToken(), 1, true, false), filter, false)); }

Target:
public DeeprootWaters(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}"); this.addAbility(new SpellCastControllerTriggeredAbility(new CreateTokenEffect(new MerfolkHexproofToken()), filter, false)); }
Source:
public NodeMetadata apply(Server from) { NodeMetadataBuilder builder = new NodeMetadataBuilder(); builder.ids(from.getId() + ""); builder.name(from.getName()); builder.hostname(from.getName()); builder.location(new LocationBuilder().scope(LocationScope.HOST).id(from.getHostId()).description( from.getHostId()).parent(location.get()).build()); addMetadataAndParseTagsFromCommaDelimitedValue(builder, from.getMetadata()); if (from.getMetadata().get("jclouds-group") != null) { builder.group(from.getMetadata().get("jclouds-group")); } else { builder.group(nodeNamingConvention.groupInUniqueNameOrNull(from.getName())); } builder.imageId(from.getImageId() + ""); builder.operatingSystem(parseOperatingSystem(from)); builder.hardware(parseHardware(from)); builder.status(serverToNodeStatus.get(from.getStatus())); builder.publicAddresses(from.getAddresses().getPublicAddresses()); builder.privateAddresses(from.getAddresses().getPrivateAddresses()); return builder.build(); }

Target:
public NodeMetadata apply(Server from) { NodeMetadataBuilder builder = new NodeMetadataBuilder(); builder.ids(from.getId() + ""); builder.name(from.getName()); builder.hostname(from.getName()); builder.location(new LocationBuilder().scope(LocationScope.HOST).id(from.getHostId()).description( from.getHostId()).parent(location.get()).build()); addMetadataAndParseTagsFromCommaDelimitedValue(builder, from.getMetadata()); builder.group(groupFromMapOrName(from.getMetadata(), from.getName(), nodeNamingConvention)); builder.imageId(from.getImageId() + ""); builder.operatingSystem(parseOperatingSystem(from)); builder.hardware(parseHardware(from)); builder.status(serverToNodeStatus.get(from.getStatus())); builder.publicAddresses(from.getAddresses().getPublicAddresses()); builder.privateAddresses(from.getAddresses().getPrivateAddresses()); return builder.build(); }
Source:
public GenericRow extract(Map<String, Object> from, GenericRow to) { if (_extractAll) { from.forEach((fieldName, value) -> to.putValue(fieldName, convert(value))); } else { for (String fieldName : _fields) { Object value = from.get(fieldName); Object convertedValue = convert(value); to.putValue(fieldName, convertedValue); } } return to; }

Target:
public GenericRow extract(Map<String, Object> from, GenericRow to) { if (_extractAll) { for (Map.Entry<String, Object> fieldToVal : from.entrySet()) { Object value = fieldToVal.getValue(); if (value != null) { value = convert(value); } to.putValue(fieldToVal.getKey(), value); } } else { for (String fieldName : _fields) { Object value = from.get(fieldName); if (value != null) { value = convert(value); } to.putValue(fieldName, value); } } return to; }
Source:
private List<Map<String, String>> availableConsoles(String userIdAsString) { List<Map<String, String>> jsonVms = new ArrayList<>(); Guid userGuid = null; try { if (StringUtils.isNotEmpty(userIdAsString)) { userGuid = Guid.createGuidFromString(userIdAsString); } } catch (IllegalArgumentException e) { log.debug("Could not read User GUID"); } if (userGuid != null) { VdcReturnValueBase retValue1 = backend.runInternalAction(VdcActionType.LoginOnBehalf, new LoginOnBehalfParameters(userGuid)); IdQueryParameters userParam = new IdQueryParameters(userGuid); VdcQueryReturnValue retVms = backend.runInternalQuery(VdcQueryType.GetAllVms, userParam); if (retVms != null) { List<VM> vmsList = retVms.getReturnValue(); for (VM vm : vmsList) { Map<String, String> jsonVm = new HashMap<String, String>(); if (vm.getRunOnVds() != null) { VdcQueryReturnValue retValue = backend.runInternalQuery(VdcQueryType.GetVdsByVdsId, new IdQueryParameters(vm.getRunOnVds())); if (retValue != null && retValue.getReturnValue() != null) { VDS vds = (VDS) retValue.getReturnValue(); jsonVm.put("vmid", vm.getId().toString()); jsonVm.put("vmname", vm.getName()); jsonVm.put("host", vds.getHostName()); jsonVm.put("console", "default"); jsonVms.add(jsonVm); } } } } } return jsonVms; }

Target:
private List<Map<String, String>> availableConsoles(String userIdAsString) { List<Map<String, String>> jsonVms = new ArrayList<>(); Guid userGuid = null; try { if (StringUtils.isNotEmpty(userIdAsString)) { userGuid = Guid.createGuidFromString(userIdAsString); } } catch (IllegalArgumentException e) { log.debug("Could not read User GUID"); } if (userGuid != null) { VdcReturnValueBase loginResult = backend.runInternalAction(VdcActionType.LoginOnBehalf, new LoginOnBehalfParameters(userGuid)); String engineSessionId = loginResult.getActionReturnValue(); try { IdQueryParameters userParam = new IdQueryParameters(userGuid); VdcQueryReturnValue retVms = backend.runInternalQuery(VdcQueryType.GetAllVms, userParam); if (retVms != null) { List<VM> vmsList = retVms.getReturnValue(); for (VM vm : vmsList) { Map<String, String> jsonVm = new HashMap<String, String>(); if (vm.getRunOnVds() != null) { VdcQueryReturnValue retValue = backend.runInternalQuery(VdcQueryType.GetVdsByVdsId, new IdQueryParameters(vm.getRunOnVds())); if (retValue != null && retValue.getReturnValue() != null) { VDS vds = (VDS) retValue.getReturnValue(); jsonVm.put("vmid", vm.getId().toString()); jsonVm.put("vmname", vm.getName()); jsonVm.put("host", vds.getHostName()); jsonVm.put("console", "default"); jsonVms.add(jsonVm); } } } } } finally { if (StringUtils.isNotEmpty(engineSessionId)) { backend.runInternalAction(VdcActionType.LogoutSession, new VdcActionParametersBase(engineSessionId)); } } } return jsonVms; }
Source:
private static List<RelNode> substitute( RelNode root, RelOptMaterialization materialization) { if (materialization.starTable != null) { RelNode newRoot = RelOptMaterialization.tryUseStar(root, materialization.starRelOptTable); if (newRoot != null) { root = newRoot; } } RelNode target = materialization.queryRel; root = trimUnusedfields(root); HepProgram program = new HepProgramBuilder() .addRuleInstance(FilterProjectTransposeRule.INSTANCE) .addRuleInstance(FilterMergeRule.INSTANCE) .addRuleInstance(FilterJoinRule.FILTER_ON_JOIN) .addRuleInstance(FilterJoinRule.JOIN) .addRuleInstance(FilterAggregateTransposeRule.INSTANCE) .addRuleInstance(ProjectMergeRule.INSTANCE) .addRuleInstance(ProjectRemoveRule.INSTANCE) .addRuleInstance(ProjectJoinTransposeRule.INSTANCE) .addRuleInstance(ProjectSetOpTransposeRule.INSTANCE) .addRuleInstance(FilterToCalcRule.INSTANCE) .addRuleInstance(ProjectToCalcRule.INSTANCE) .addRuleInstance(FilterCalcMergeRule.INSTANCE) .addRuleInstance(ProjectCalcMergeRule.INSTANCE) .addRuleInstance(CalcMergeRule.INSTANCE) .build(); final HepPlanner hepPlanner = new HepPlanner(program); hepPlanner.setRoot(target); target = hepPlanner.findBestExp(); hepPlanner.setRoot(root); root = hepPlanner.findBestExp(); return new SubstitutionVisitor(target, root).go(materialization.tableRel); }

Target:
private static List<RelNode> substitute( RelNode root, RelOptMaterialization materialization) { if (materialization.starTable != null) { RelNode newRoot = RelOptMaterialization.tryUseStar(root, materialization.starRelOptTable); if (newRoot != null) { root = newRoot; } } RelNode target = materialization.queryRel; root = trimUnusedfields(root); target = trimUnusedfields(target); HepProgram program = new HepProgramBuilder() .addRuleInstance(FilterProjectTransposeRule.INSTANCE) .addRuleInstance(FilterMergeRule.INSTANCE) .addRuleInstance(FilterJoinRule.FILTER_ON_JOIN) .addRuleInstance(FilterJoinRule.JOIN) .addRuleInstance(FilterAggregateTransposeRule.INSTANCE) .addRuleInstance(ProjectMergeRule.INSTANCE) .addRuleInstance(ProjectRemoveRule.INSTANCE) .addRuleInstance(ProjectJoinTransposeRule.INSTANCE) .addRuleInstance(ProjectSetOpTransposeRule.INSTANCE) .addRuleInstance(FilterToCalcRule.INSTANCE) .addRuleInstance(ProjectToCalcRule.INSTANCE) .addRuleInstance(FilterCalcMergeRule.INSTANCE) .addRuleInstance(ProjectCalcMergeRule.INSTANCE) .addRuleInstance(CalcMergeRule.INSTANCE) .build(); final HepPlanner hepPlanner = new HepPlanner(program); hepPlanner.setRoot(target); target = hepPlanner.findBestExp(); hepPlanner.setRoot(root); root = hepPlanner.findBestExp(); return new SubstitutionVisitor(target, root).go(materialization.tableRel); }
Source:
private static Optional<Domain> getPathDomain(TupleDomain<? extends ColumnHandle> domainPredicate) { if (domainPredicate.isNone()) { return Optional.empty(); } return domainPredicate.transform(HiveColumnHandle.class::cast).getDomains().get().entrySet().stream() .filter(entry -> isPathColumnHandle(entry.getKey())) .findFirst() .map(Map.Entry::getValue); }

Target:
private static Optional<Domain> getPathDomain(TupleDomain<? extends ColumnHandle> domainPredicate) { checkArgument(!domainPredicate.isNone(), "Unexpected domain predicate: none"); return domainPredicate.transform(HiveColumnHandle.class::cast).getDomains().get().entrySet().stream() .filter(entry -> isPathColumnHandle(entry.getKey())) .findFirst() .map(Map.Entry::getValue); }
Source:
boolean maybeOverrideCodeGen(Node n) { switch (n.getToken()) { case INDEX_SIGNATURE: Node first = n.getFirstChild(); if (null != first) { add("{["); add(first); add(":"); add(first.getDeclaredTypeExpression()); add("]:"); add(n.getDeclaredTypeExpression()); add("}"); } return true; case UNDEFINED_TYPE: add("undefined"); return true; case CAST: add("("); add(n.getFirstChild()); add(" as "); add(n.getDeclaredTypeExpression()); add(")"); return true; case NAME: if (n.getParent().isParamList()) { Visibility visibility = (Visibility) n.getProp(Node.ACCESS_MODIFIER); if (visibility != null) { switch (visibility) { case PRIVATE: add("private "); break; case PROTECTED: add("protected "); break; case PUBLIC: add("public "); break; default: break; } } if (n.getBooleanProp(Node.IS_CONSTANT_NAME)) { add("readonly "); } } return false; case ANY_TYPE: String anyTypeName = externsMap.get("any"); if (anyTypeName != null) { add(anyTypeName); return true; } return false; case EXPORT: if (1 != n.getChildCount()) { return false; } if (n.getFirstChild().getToken() == Token.TYPE_ALIAS) { add("export"); add(n.getFirstChild()); return true; } return false; default: return false; } }

Target:
boolean maybeOverrideCodeGen(Node n) { switch (n.getToken()) { case INDEX_SIGNATURE: Node first = n.getFirstChild(); if (null != first) { add("{["); add(first); add(":"); add(first.getDeclaredTypeExpression()); add("]:"); add(n.getDeclaredTypeExpression()); add("}"); } return true; case UNDEFINED_TYPE: add("undefined"); return true; case CAST: add("("); add(n.getFirstChild()); add(" as "); add(n.getDeclaredTypeExpression()); add(")"); return true; case NAME: if (n.getParent().isParamList()) { Visibility visibility = (Visibility) n.getProp(Node.ACCESS_MODIFIER); if (visibility != null) { switch (visibility) { case PRIVATE: add("private "); break; case PROTECTED: add("protected "); break; case PUBLIC: add("public "); break; default: break; } } if (n.getBooleanProp(Node.IS_CONSTANT_NAME)) { add("readonly "); } } return false; case ANY_TYPE: String anyTypeName = externsMap.get("any"); if (anyTypeName != null) { add(anyTypeName); return true; } return false; case EXPORT: if (n.getChildCount() != 1) { return false; } if (n.getFirstChild().getToken() == Token.TYPE_ALIAS) { add("export"); add(n.getFirstChild()); return true; } return false; default: return false; } }
Source:
private Set<String> getSchemaSQLServerNames(DatabaseMetaData metaData) throws SQLException { final Set<String> schemas = new HashSet<>(); ResultSet resultSet = null; try { resultSet = metaData.getSchemas(); while (resultSet.next()) { if (resultSet.getString("TABLE_SCHEM").equals(DEFAULT_SCHEMA_NAME_SQLSERVER)) { schemas.add(DEFAULT_SCHEMA_NAME_SQLSERVER); break; } } } finally { FileHelper.safeClose(resultSet); } try { resultSet = metaData.getTables(_catalogName, null, null, JdbcUtils.getTableTypesAsStrings(_tableTypes)); while (resultSet.next()) { schemas.add(resultSet.getString("TABLE_SCHEM")); } } finally { FileHelper.safeClose(resultSet); } return schemas; }

Target:
private Set<String> getSchemaSQLServerNames(DatabaseMetaData metaData) throws SQLException { final Set<String> schemas = new HashSet<>(); if (hasDefaultSQLServerSchema(metaData)) { schemas.add(DEFAULT_SCHEMA_NAME_SQLSERVER); } try (ResultSet tables = metaData .getTables(_catalogName, null, null, JdbcUtils.getTableTypesAsStrings(_tableTypes))) { while (tables.next()) { schemas.add(tables.getString(SCHEMA_NAME_IDENTIFIER)); } } return schemas; }
Source:
private <T extends AcsResponse> T parseAcsResponse(AcsRequest<T> request, HttpResponse baseResponse) throws ServerException, ClientException { FormatType format = baseResponse.getHttpContentType(); if (baseResponse.isSuccess()) { return readResponse(request.getResponseClass(), baseResponse, format); } else { AcsError error = readError(baseResponse, format); if (500 <= baseResponse.getStatus()) { throw new ServerException(error.getErrorCode(), error.getErrorMessage(), error.getRequestId()); } else if ("IncompleteSignature".equals(error.getErrorCode())) { String strToSign = request.strToSign; String errorMessage = error.getErrorMessage(); Pattern startPattern = Pattern.compile("string to sign is:"); Matcher startMatcher = startPattern.matcher(errorMessage); startMatcher.find(); int start = startMatcher.end(); String errorStrToSign = errorMessage.substring(start); if (strToSign.equals(errorStrToSign)) { throw new ClientException("SDK.InvalidAccessSecret", "Specified Access Key Secret is not valid.", error.getRequestId()); } } throw new ClientException(error.getErrorCode(), error.getErrorMessage(), error.getRequestId()); } }

Target:
private <T extends AcsResponse> T parseAcsResponse(AcsRequest<T> request, HttpResponse baseResponse) throws ServerException, ClientException { FormatType format = baseResponse.getHttpContentType(); if (baseResponse.isSuccess()) { return readResponse(request.getResponseClass(), baseResponse, format); } else { AcsError error = readError(baseResponse, format); if (500 <= baseResponse.getStatus()) { throw new ServerException(error.getErrorCode(), error.getErrorMessage(), error.getRequestId()); } else if ("IncompleteSignature".equals(error.getErrorCode())) { String strToSign = request.strToSign; String errorMessage = error.getErrorMessage(); Pattern startPattern = Pattern.compile(SIGNATURE_BEGIN); Matcher startMatcher = startPattern.matcher(errorMessage); startMatcher.find(); int start = startMatcher.end(); String errorStrToSign = errorMessage.substring(start); if (strToSign.equals(errorStrToSign)) { throw new ClientException("InvalidAccessSecret", "Specified Access Key Secret is not valid.", error.getRequestId()); } } throw new ClientException(error.getErrorCode(), error.getErrorMessage(), error.getRequestId()); } }
Source:
public Optional<Metacard> apply(InputStream document, WfsMetadata<FeatureTypeType> metadata) { XStream xStream = new XStream(new WstxDriver()); xStream.addPermission(NoTypePermission.NONE); xStream.allowTypeHierarchy(Metacard.class); xStream.setClassLoader(this.getClass().getClassLoader()); xStream.registerConverter(new GmlGeometryConverter()); xStream.registerConverter(new GmlEnvelopeConverter()); xStream.alias(metadata.getActiveFeatureMemberNodeName(), Metacard.class); FeatureTypeType featureType = null; for (FeatureTypeType ft : metadata.getDescriptors()) { if (ft.getName().getLocalPart().equals(metadata.getActiveFeatureMemberNodeName())) { featureType = ft; } } lookupFeatureConverter(metadata, featureType).ifPresent(xStream::registerConverter); Metacard metacard = null; try { metacard = (Metacard) xStream.fromXML(document); } catch (XStreamException e) { LOGGER.trace("Failed to parse FeatureMember into Metacard", e); } return Optional.ofNullable(metacard); }

Target:
public Optional<Metacard> apply(InputStream document, WfsMetadata<FeatureTypeType> metadata) { XStream xStream = new XStream(new WstxDriver()); xStream.addPermission(NoTypePermission.NONE); xStream.allowTypeHierarchy(Metacard.class); xStream.setClassLoader(this.getClass().getClassLoader()); xStream.registerConverter(new GmlGeometryConverter()); xStream.registerConverter(new GmlEnvelopeConverter()); xStream.alias(metadata.getActiveFeatureMemberNodeName(), Metacard.class); FeatureTypeType featureType = null; for (FeatureTypeType ft : metadata.getDescriptors()) { if (ft.getName() != null && metadata.getActiveFeatureMemberNodeName().equals(ft.getName().getLocalPart())) { featureType = ft; } } lookupFeatureConverter(metadata, featureType).ifPresent(xStream::registerConverter); Metacard metacard = null; try { metacard = (Metacard) xStream.fromXML(document); } catch (XStreamException e) { LOGGER.trace("Failed to parse FeatureMember into Metacard", e); } return Optional.ofNullable(metacard); }
Source:
public void suggestions() { SuggestionsWsRequest.More more = SuggestionsWsRequest.More.BRC; String s = randomAlphanumeric(20); underTest.suggestions(SuggestionsWsRequest.builder() .setMore(more) .setS(s) .setRecentlyBrowsed(asList("key-1", "key-2")) .build()); serviceTester.assertThat(serviceTester.getGetRequest()) .hasPath("suggestions") .hasParam("more", more.toString()) .hasParam("s", s) .hasParam("recentlyBrowsed", "key-1,key-2") .andNoOtherParam(); }

Target:
public void suggestions() { SuggestionsWsRequest.More more = SuggestionsWsRequest.More.BRC; String s = randomAlphanumeric(20); underTest.suggestions(SuggestionsWsRequest.builder() .setMore(more) .setS(s) .setRecentlyBrowsed(asList("key-1", "key-2")) .build()); assertThat(serviceTester.getGetParser()).isNull(); serviceTester.assertThat(serviceTester.getGetRequest()) .hasPath("suggestions") .hasParam("more", more.toString()) .hasParam("s", s) .hasParam("recentlyBrowsed", "key-1,key-2") .andNoOtherParam(); }
Source:
public Optional<String> getCountryCode(String wktLocation, int radius) throws GeoEntryQueryException, ParseException { String wkt; try { Point center = WKT_READER_THREAD_LOCAL.get().read(wktLocation).getCentroid(); wkt = WKT_WRITER_THREAD_LOCAL.get().write(center.buffer(radius / KM_PER_DEGREE)); } catch (org.locationtech.jts.io.ParseException e) { LOGGER.debug("Could not parse wkt: {}", wktLocation, e); throw new GeoEntryQueryException("Could not parse wkt", e); } SolrQuery solrQuery = new SolrQuery( String.format( "location_geo_index:\"Intersects( %s )\"", ClientUtils.escapeQueryChars(wkt))); solrQuery.setRows(1); QueryResponse response; try { response = client.query(solrQuery, METHOD.POST); } catch (SolrServerException | IOException e) { LOGGER.debug("Could not query for country code ({})", wktLocation, e); throw new GeoEntryQueryException("Error encountered when querying", e); } return response .getResults() .stream() .findFirst() .map(doc -> getField(doc, Location.COUNTRY_CODE + "_txt", String.class)); }

Target:
public Optional<String> getCountryCode(String wktLocation, int radius) throws GeoEntryQueryException, ParseException { String wkt; try { Point center = WKT_READER_THREAD_LOCAL .get() .read(fixSelfIntersectingGeometry(wktLocation)) .getCentroid(); wkt = WKT_WRITER_THREAD_LOCAL.get().write(center.buffer(convertKilometerToDegree(radius))); } catch (org.locationtech.jts.io.ParseException e) { LOGGER.debug("Could not parse wkt: {}", wktLocation, e); throw new GeoEntryQueryException("Could not parse wkt", e); } SolrQuery solrQuery = new SolrQuery( String.format( "%s_index:\"Intersects( %s )\"", LOCATION, ClientUtils.escapeQueryChars(wkt))); solrQuery.setRows(1); QueryResponse response; try { response = client.query(solrQuery, METHOD.POST); } catch (SolrServerException | IOException e) { LOGGER.debug("Could not query for country code ({})", wktLocation, e); throw new GeoEntryQueryException("Error encountered when querying", e); } return response .getResults() .stream() .findFirst() .map(doc -> getField(doc, COUNTRY_CODE, String.class)); }
Source:
private static Config loadNeo4jConfig( Path homeDir, Path configDir, String databaseName, Map<String,String> additionalConfig ) { return Config.fromFile( configDir.resolve( "neo4j.conf" ) ) .withHome( homeDir ) .withSetting( DatabaseManagementSystemSettings.active_database, databaseName ) .withSettings( additionalConfig ) .withConnectorsDisabled().build(); }

Target:
private static Config loadNeo4jConfig( Path homeDir, Path configDir, String databaseName, Map<String,String> additionalConfig ) { return Config.fromFile( configDir.resolve( Config.DEFAULT_CONFIG_FILE_NAME ) ) .withHome( homeDir ) .withSetting( DatabaseManagementSystemSettings.active_database, databaseName ) .withSettings( additionalConfig ) .withConnectorsDisabled().build(); }
Source:
public HikariCPCollector add(String name, PoolStats poolStats) { poolStatsMap.put(name, poolStats); return this; }

Target:
protected HikariCPCollector add(String name, PoolStats poolStats) { poolStatsMap.put(name, poolStats); return this; }
Source:
public void sendText(String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent) { mPhone.getContext().enforceCallingPermission( "android.permission.SEND_SMS", "Sending SMS message"); if (Log.isLoggable("SMS", Log.VERBOSE)) { log("sendText: destAddr=" + destAddr + " scAddr=" + scAddr + " text='"+ text + "' sentIntent=" + sentIntent + " deliveryIntent=" + deliveryIntent); } Intent broadcastIntent = new Intent(Intent.ACTION_NEW_OUTGOING_SMS); broadcastIntent.putExtra(Intent.EXTRA_PHONE_NUMBER, destAddr); broadcastIntent.putExtra(EXTRA_SC_ADDRESS, scAddr); broadcastIntent.putExtra(EXTRA_TEXT, text); broadcastIntent.putExtra(EXTRA_SENT_INTENT, sentIntent); broadcastIntent.putExtra(EXTRA_DELIVERY_INTENT, deliveryIntent); mContext.sendOrderedBroadcast(broadcastIntent, PERMISSION, new OutgoingSmsReceiver(), null, Activity.RESULT_OK, destAddr, null); }

Target:
public void sendText(String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent) { mPhone.getContext().enforceCallingPermission( "android.permission.SEND_SMS", "Sending SMS message"); if (Log.isLoggable("SMS", Log.VERBOSE)) { log("sendText: destAddr=" + destAddr + " scAddr=" + scAddr + " text='"+ text + "' sentIntent=" + sentIntent + " deliveryIntent=" + deliveryIntent); } Intent broadcastIntent = new Intent(SmsManager.ACTION_NEW_OUTGOING_SMS); broadcastIntent.putExtra(Intent.EXTRA_PHONE_NUMBER, destAddr); broadcastIntent.putExtra(EXTRA_SC_ADDRESS, scAddr); broadcastIntent.putExtra(SmsManager.EXTRA_TEXT, text); broadcastIntent.putExtra(EXTRA_SENT_INTENT, sentIntent); broadcastIntent.putExtra(EXTRA_DELIVERY_INTENT, deliveryIntent); mContext.sendOrderedBroadcast(broadcastIntent, PERMISSION, new OutgoingSmsReceiver(), null, Activity.RESULT_OK, destAddr, null); }
Source:
public CodeVisitor[] checkClasses() { List<CodeVisitor> visitors = Lists.newArrayList(); for (JavaIssueFilter issueFilter : issueFilters) { visitors.add(issueFilter); } for (Checks<JavaCheck> checksElement : checks) { Collection<JavaCheck> checksCollection = checksElement.all(); if (!checksCollection.isEmpty()) { visitors.addAll(checksCollection); } } return visitors.toArray(new CodeVisitor[visitors.size()]); }

Target:
public CodeVisitor[] checkClasses() { List<CodeVisitor> visitors = Lists.newArrayList(); for (Checks<JavaCheck> checksElement : checks) { Collection<JavaCheck> checksCollection = checksElement.all(); if (!checksCollection.isEmpty()) { visitors.addAll(checksCollection); } } return visitors.toArray(new CodeVisitor[visitors.size()]); }
Source:
private void cleanSweepableCells(ShardAndStrategy shardStrategy, long oldProgress, long newProgress) { if (firstIterationOfSweep(oldProgress)) { return; } long lastSweptPartitionPreviously = SweepQueueUtils.tsPartitionFine(oldProgress); long minimumSweepPartitionNextIteration = SweepQueueUtils.tsPartitionFine(newProgress + 1); if (minimumSweepPartitionNextIteration > lastSweptPartitionPreviously) { cleanDedicatedRows(shardStrategy, lastSweptPartitionPreviously); cleanNonDedicatedRow(shardStrategy, lastSweptPartitionPreviously); log.info("Deleted persisted sweep queue information in table SweepableCells for partition {}.", lastSweptPartitionPreviously); } }

Target:
private void cleanSweepableCells(ShardAndStrategy shardStrategy, long oldProgress, long newProgress) { if (firstIterationOfSweep(oldProgress)) { return; } long lastSweptPartitionPreviously = SweepQueueUtils.tsPartitionFine(oldProgress); long minimumSweepPartitionNextIteration = SweepQueueUtils.tsPartitionFine(newProgress + 1); if (minimumSweepPartitionNextIteration > lastSweptPartitionPreviously) { cleanDedicatedRows(shardStrategy, lastSweptPartitionPreviously); cleanNonDedicatedRow(shardStrategy, lastSweptPartitionPreviously); log.info("Deleted persisted sweep queue information in table for partition {}.", LoggingArgs.tableRef(TargetedSweepTableFactory.of().getSweepableCellsTable(null).getTableRef()), SafeArg.of("partition", lastSweptPartitionPreviously)); } }
Source:
public Integer getNumberOfLocalConnections() { return Integer.valueOf(acceptedChannels.size()); }

Target:
public Integer getNumberOfLocalConnections() { return acceptedChannels.size(); }
Source:
public void executeSystemStatement(String sql) throws IgniteCheckedException { Statement stmt = null; try { stmt = sysConn.createStatement(); stmt.executeUpdate(sql); } catch (SQLException e) { U.close(sysConn, log); IgniteSQLException ex = new IgniteSQLException("Failed to execute system statement: " + sql, e); throw new IgniteCheckedException("Failed to execute system statement: " + sql, e); } finally { U.close(stmt, log); } }

Target:
public void executeSystemStatement(String sql) throws IgniteCheckedException { Statement stmt = null; try { stmt = sysConn.createStatement(); stmt.executeUpdate(sql); } catch (SQLException e) { U.close(sysConn, log); throw new IgniteCheckedException("Failed to execute system statement: " + sql, e); } finally { U.close(stmt, log); } }
Source:
private void thin(File sourceFatJar) throws ZipException, IOException, NoSuchAlgorithmException { File targetThinJar = new File(outputDirectory, "thin-" + sourceFatJar.getName()); File libIndexCache = new File(outputDirectory, "lib.index.cache"); getLog().info("Thinning " + getArtifactExtension() + ": " + targetThinJar.getAbsolutePath()); getLog().info("Lib index cache: " + libIndexCache.getAbsolutePath()); SpringBootThinUtil thinUtil = new SpringBootThinUtil(sourceFatJar, targetThinJar, libIndexCache, null); thinUtil.execute(); }

Target:
private void thin(File sourceFatJar) throws ZipException, IOException, NoSuchAlgorithmException, SpringBootThinException { File targetThinJar = new File(outputDirectory, "thin-" + sourceFatJar.getName()); File libIndexCache = new File(outputDirectory, "lib.index.cache"); getLog().info("Thinning " + getArtifactExtension() + ": " + targetThinJar.getAbsolutePath()); getLog().info("Lib index cache: " + libIndexCache.getAbsolutePath()); SpringBootThinUtil thinUtil = new SpringBootThinUtil(sourceFatJar, targetThinJar, libIndexCache, null); thinUtil.execute(); }
Source:
public void sendLastNEndpointsChangeEvent( Collection<String> forwardedEndpoints, Collection<String> endpointsEnteringLastN, Collection<String> conferenceEndpoints) { if (endpointsEnteringLastN == null) { endpointsEnteringLastN = forwardedEndpoints; } String msg = createLastNEndpointsChangeEvent( forwardedEndpoints, endpointsEnteringLastN, conferenceEndpoints); sendMessage(msg); notifyForwardedEndpointsChanged(forwardedEndpoints, endpointsEnteringLastN, conferenceEndpoints); }

Target:
private void sendLastNEndpointsChangeEvent( Collection<String> forwardedEndpoints, Collection<String> endpointsEnteringLastN, Collection<String> conferenceEndpoints) { if (endpointsEnteringLastN == null) { endpointsEnteringLastN = forwardedEndpoints; } String msg = createLastNEndpointsChangeEvent( forwardedEndpoints, endpointsEnteringLastN, conferenceEndpoints); sendMessage(msg); }
Source:
public void setUp() throws IOException { existingTempFile = File.createTempFile("FiletypeTest.", ".tmp"); existingTempFile.deleteOnExit(); systemTempDir = System.getProperty("java.io.tmpdir"); final File tmpDir = new File(systemTempDir); inMemoryFileSystem = Jimfs.newFileSystem(Configuration.unix());; if (!tmpDir.isDirectory()) tmpDir.mkdir(); if (!tmpDir.isDirectory()) throw new RuntimeException("java.io.tmpdir (" + systemTempDir + ") is not a directory"); systemUser = System.getProperty("user.name"); WORDS_LONG = Files.createTempFile("words_long", ".txt"); WORDS_LONG.toFile().deleteOnExit(); List<String> wordsList = new ArrayList<String>(); try (Stream<String> dictStream = Files.lines(TEST_DATA_DIR.resolve("dictionary_english_short.dic"))) { wordsList = dictStream.collect(Collectors.toList()); } final int numberOfWords = 300000; final int seed = 345987345; final Random rand = new Random(seed); try (final BufferedWriter writer = Files.newBufferedWriter(WORDS_LONG)) { for (int i = 0; i < numberOfWords; i++) { writer.write(wordsList.get(rand.nextInt(wordsList.size()))); } } }

Target:
public void setUp() throws IOException { existingTempFile = File.createTempFile("FiletypeTest.", ".tmp"); existingTempFile.deleteOnExit(); systemTempDir = System.getProperty("java.io.tmpdir"); final File tmpDir = new File(systemTempDir); inMemoryFileSystem = Jimfs.newFileSystem(Configuration.unix());; if (!tmpDir.isDirectory()) tmpDir.mkdir(); if (!tmpDir.isDirectory()) throw new RuntimeException("java.io.tmpdir (" + systemTempDir + ") is not a directory"); systemUser = System.getProperty("user.name"); WORDS_LONG = Files.createTempFile("words_long", ".txt"); WORDS_LONG.toFile().deleteOnExit(); final List<String> wordsList = Files.lines(TEST_DATA_DIR.resolve("dictionary_english_short.dic")).collect(Collectors.toList()); final int numberOfWords = 300000; final int seed = 345987345; final Random rand = new Random(seed); try (final BufferedWriter writer = Files.newBufferedWriter(WORDS_LONG)) { for (int i = 0; i < numberOfWords; i++) { writer.write(wordsList.get(rand.nextInt(wordsList.size()))); } } }
Source:
public void fqn_by_package_with_subpackage() { assertThat(SymbolUtils.fullyQualifiedModuleName("", "foo.py")).isEqualTo("foo"); assertThat(SymbolUtils.fullyQualifiedModuleName("foo", "__init__.py")).isEqualTo("foo"); assertThat(SymbolUtils.fullyQualifiedModuleName("foo", "foo.py")).isEqualTo("foo"); assertThat(SymbolUtils.fullyQualifiedModuleName("foo", "foo")).isEqualTo("foo"); assertThat(SymbolUtils.fullyQualifiedModuleName("curses.ascii", "ascii.py")).isEqualTo("curses.ascii"); assertThat(SymbolUtils.fullyQualifiedModuleName("curses", "ascii.py")).isEqualTo("curses.ascii"); }

Target:
public void fqn_by_package_with_subpackage() { assertThat(SymbolUtils.fullyQualifiedModuleName("", "foo.py")).isEqualTo("foo"); assertThat(SymbolUtils.fullyQualifiedModuleName("foo", "__init__.py")).isEqualTo("foo"); assertThat(SymbolUtils.fullyQualifiedModuleName("foo", "foo.py")).isEqualTo("foo.foo"); assertThat(SymbolUtils.fullyQualifiedModuleName("foo", "foo")).isEqualTo("foo.foo"); assertThat(SymbolUtils.fullyQualifiedModuleName("curses", "ascii.py")).isEqualTo("curses.ascii"); }
Source:
public void testExecuteOnNull() { Object obj = mock(Object.class); CommandManager manager = mock(CommandManager.class); when(registryFactory.newCommandRegistry()).thenReturn(commandRegistry); when(commandRegistry.isEmpty()).thenReturn(true); CommandResult expectedResult = mock(CommandResult.class); when(commandRegistry.peek()).thenReturn(command1); when(manager.execute(obj, command1)).thenReturn(expectedResult); tested = new RedoCommandHandler(registryFactory); assertEquals(null, tested.execute(obj, manager)); }

Target:
public void testExecuteOnNull() { Object obj = mock(Object.class); CommandManager manager = mock(CommandManager.class); when(registryFactory.newCommandRegistry()).thenReturn(commandRegistry); when(commandRegistry.isEmpty()).thenReturn(true); tested = new RedoCommandHandler(registryFactory); tested.execute(obj, manager); }