auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Collection<Object> getAppComponents(String extension, SupportedTransports type, Object... services) { if ( !OWNER_EXTENSION.equals( extension )) { return Collections.emptyList(); } BeanConfig beanConfig = new BeanConfig(); String contextRoot = KieServerEnvironment.getContextRoot(); if (contextRoot != null && !("".equals(contextRoot))) { beanConfig.setBasePath(contextRoot + "/services/rest"); } beanConfig.setResourcePackage(RESOURCE_PACKAGES); beanConfig.setScan(true); beanConfig.setPrettyPrint(true); List<Object> components = new ArrayList<Object>( 2 ); components.add(new KieApiListingResource()); components.add(new SwaggerSerializers()); return components; }

Target:
public Collection<Object> getAppComponents(String extension, SupportedTransports type, Object... services) { if (!OWNER_EXTENSION.equals(extension)) { return Collections.emptyList(); } List<Object> components = new ArrayList<Object>(2); components.add(new KieApiListingResource()); components.add(new SwaggerSerializers()); return components; }
Source:
private void pasteLiteral(Display display) { Clipboard clipboard = new Clipboard(display); TextTransfer textTransfer = TextTransfer.getInstance(); String clipboardText = (String) clipboard.getContents(textTransfer); clipboard.dispose(); if (clipboardText != null) { StringBuffer out = new StringBuffer(); char[] chars = clipboardText.toCharArray(); boolean lastWasBackslash = false; for (char c : chars) { if (c == '\\') { if (lastWasBackslash) { out.append(c); lastWasBackslash = false; } else { lastWasBackslash = true; } } else { out.append(c); } } txt_RegExp.insert(out.toString()); } }

Target:
private void pasteLiteral(Display display) { Clipboard clipboard = new Clipboard(display); TextTransfer textTransfer = TextTransfer.getInstance(); String clipboardText = (String) clipboard.getContents(textTransfer); clipboard.dispose(); if (clipboardText != null) { StringBuffer out = new StringBuffer(); char[] chars = clipboardText.toCharArray(); boolean lastWasBackslash = false; for (char character : chars) { if (character == '\\') { if (lastWasBackslash) { out.append(character); lastWasBackslash = false; } else { lastWasBackslash = true; } } else { out.append(character); } } txt_RegExp.insert(out.toString()); } }
Source:
public List<Project> getUserProjectsByRegex(User user, String regexPattern) { List<Project> array = new ArrayList<Project>(); Pattern pattern; try { pattern = Pattern.compile(regexPattern, Pattern.CASE_INSENSITIVE); } catch (PatternSyntaxException e) { logger.error("Bad regex pattern " + regexPattern); return array; } List<Project> projects = getProjects(); for (Project project : projects) { Permission perm = project.getUserPermission(user); if (perm != null && (perm.isPermissionSet(Type.ADMIN) || perm .isPermissionSet(Type.READ))) { if (pattern.matcher(project.getName()).find()) { array.add(project); } } } return array; }

Target:
public List<Project> getUserProjectsByRegex(User user, String regexPattern) { List<Project> userProjects = new ArrayList<>(); Pattern pattern; try { pattern = Pattern.compile(regexPattern, Pattern.CASE_INSENSITIVE); } catch (PatternSyntaxException e) { logger.error("Bad regex pattern " + regexPattern); return userProjects; } for (Project project : getProjects()) { Permission perm = project.getUserPermission(user); if (perm != null && (perm.isPermissionSet(Type.ADMIN) || perm .isPermissionSet(Type.READ))) { if (pattern.matcher(project.getName()).find()) { userProjects.add(project); } } } return userProjects; }
Source:
protected IMIBackend createBackendGDBService(DsfSession session, ILaunchConfiguration lc) { if (compareVersionWith(GDB_7_12_VERSION) >= 0 || compareVersionWith("7.11.50") >= 0 ) { return new GDBBackend_7_12(session, lc); } return new GDBBackend(session, lc); }

Target:
protected IMIBackend createBackendGDBService(DsfSession session, ILaunchConfiguration lc) { if (compareVersionWith(GDB_7_12_VERSION) >= 0) { return new GDBBackend_7_12(session, lc); } return new GDBBackend(session, lc); }
Source:
public int add(InputRow row) throws IndexSizeExceededException { if (currHydrant == null) { throw new IAE("No currHydrant but given row[%s]", row); } synchronized (hydrantLock) { if (!writable) { return -1; } IncrementalIndex index = currHydrant.getIndex(); if (index == null) { return -1; } return index.add(row); } }

Target:
public int add(InputRow row) throws IndexSizeExceededException { if (currHydrant == null) { throw new IAE("No currHydrant but given row[%s]", row); } synchronized (hydrantLock) { if (!writable) { return ADD_FAILED; } IncrementalIndex index = currHydrant.getIndex(); if (index == null) { return ADD_FAILED; } return index.add(row); } }
Source:
public List<Facility> getFacilitiesByAttribute(PerunSession sess, String attributeName, String attributeValue) throws InternalErrorException, PrivilegeException, AttributeNotExistsException, WrongAttributeAssignmentException { Utils.checkPerunSession(sess); if(!AuthzResolver.isAuthorized(sess, Role.SERVICEUSER)) { throw new PrivilegeException(sess, "getFacilitiesByAttribute"); } getPerunBl().getAttributesManagerBl().getAttributeDefinition(sess, attributeName); return getFacilitiesManagerBl().getFacilitiesByAttribute(sess, attributeName, attributeValue); }

Target:
public List<Facility> getFacilitiesByAttribute(PerunSession sess, String attributeName, String attributeValue) throws InternalErrorException, PrivilegeException, AttributeNotExistsException, WrongAttributeAssignmentException { Utils.checkPerunSession(sess); if(!AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN)) { throw new PrivilegeException(sess, "getFacilitiesByAttribute"); } AttributeDefinition attributeDef = getPerunBl().getAttributesManagerBl().getAttributeDefinition(sess, attributeName); List<Facility> facilities = getFacilitiesManagerBl().getFacilitiesByAttribute(sess, attributeName, attributeValue); Iterator<Facility> it = facilities.iterator(); while (it.hasNext()) { Facility facility = it.next(); if (!AuthzResolver.isAuthorizedForAttribute(sess, ActionType.READ, attributeDef, facility, null)) { it.remove(); } } return facilities; }
Source:
public void testBuildImageIdWithBuildargs() throws Exception { assumeTrue("Docker API should be at least v1.21 to support buildargs while building, got " + sut.version().apiVersion(), compareVersion(sut.version().apiVersion(), "1.21") >= 0); final String dockerDirectory = Resources.getResource("dockerDirectoryWithBuildargs").getPath(); final String buildargs = "{\"testargument\":\"22-12-2015\"}"; final DockerClient.BuildParam buildParam = DockerClient.BuildParam.create("buildargs", URLEncoder.encode(buildargs, "UTF-8")); sut.build( Paths.get(dockerDirectory), "test-buildargs", buildParam ); }

Target:
public void testBuildImageIdWithBuildargs() throws Exception { assumeTrue("We need Docker API >= v1.21 to run this test." + "This Docker API is " + sut.version().apiVersion(), compareVersion(sut.version().apiVersion(), "1.21") >= 0); final String dockerDirectory = Resources.getResource("dockerDirectoryWithBuildargs").getPath(); final String buildargs = "{\"testargument\":\"22-12-2015\"}"; final DockerClient.BuildParam buildParam = DockerClient.BuildParam.create("buildargs", URLEncoder.encode(buildargs, "UTF-8")); sut.build( Paths.get(dockerDirectory), "test-buildargs", buildParam ); }
Source:
public int read(byte[] b, int off, int len) throws IOException { int cnt = 0; while (0 < len) { if (!buf.hasRemaining()) { buf.rewind(); int nr = os.read(position, buf); if (nr < 0) { buf.position(buf.remaining()); break; } position += nr; buf.flip(); } int n = Math.min(len, buf.remaining()); buf.get(b, off, n); off += n; len -= n; cnt += n; } if (cnt == 0 && len > 0) return -1; return cnt; }

Target:
public int read(byte[] b, int off, int len) throws IOException { int cnt = 0; while (0 < len) { if (!buf.hasRemaining()) { buf.rewind(); int nr = DfsOutputStream.this.read(position, buf); if (nr < 0) { buf.position(buf.limit()); break; } position += nr; buf.flip(); } int n = Math.min(len, buf.remaining()); buf.get(b, off, n); off += n; len -= n; cnt += n; } if (cnt == 0 && len > 0) return -1; return cnt; }
Source:
public void writeInterval(ByteBuffer buffer) { final byte byteFromType = getByteFromType(sv.getType()); buffer.putLong(start); buffer.putLong(end - start); buffer.putInt(attribute); buffer.put(byteFromType); switch (byteFromType) { case TYPE_NULL: break; case TYPE_INTEGER: try { buffer.putInt(sv.unboxInt()); } catch (StateValueTypeException e) { throw new RuntimeException(e); } break; case TYPE_STRING: String string; try { string = sv.unboxStr(); } catch (StateValueTypeException e) { throw new RuntimeException(e); } buffer.put((byte) string.length()); buffer.put(string.getBytes()); buffer.put((byte) 0); break; case TYPE_LONG: try { buffer.putLong(sv.unboxLong()); } catch (StateValueTypeException e) { throw new RuntimeException(e); } break; case TYPE_DOUBLE: try { buffer.putDouble(sv.unboxDouble()); } catch (StateValueTypeException e) { throw new RuntimeException(e); } break; default: break; } }

Target:
public void writeInterval(ByteBuffer buffer) { final byte byteFromType = getByteFromType(sv.getType()); buffer.putLong(start); buffer.putLong(end); buffer.putInt(attribute); buffer.put(byteFromType); switch (byteFromType) { case TYPE_NULL: break; case TYPE_INTEGER: buffer.putInt(sv.unboxInt()); break; case TYPE_STRING: String string = sv.unboxStr(); buffer.put((byte) string.length()); buffer.put(string.getBytes()); buffer.put((byte) 0); break; case TYPE_LONG: buffer.putLong(sv.unboxLong()); break; case TYPE_DOUBLE: buffer.putDouble(sv.unboxDouble()); break; default: break; } }
Source:
@Override public void initializeFromHandshake(GridNioSession ses, ClientListenerProtocolVersion ver, BinaryReaderExImpl reader) throws IgniteCheckedException { EnumSet<ClientFeature> features = null; if (ClientProtocolContext.isFeaturesSupported(ver)) { byte cliFeatures = reader.readByteArray(); features = ClientFeature.enumSet(cliFeatures); features.retainAll(ClientFeature.allFeaturesAsEnumSet()); } currentProtocolContext = new ClientProtocolContext(ver, features); String user = null; String pwd = null; if (currentProtocolContext.isUserAttributesSupported()) userAttrs = reader.readMap(); if (currentProtocolContext.isAuthorizationSupported()) { boolean hasMore; try { hasMore = reader.available() > 0; } catch (IOException e) { throw new IgniteCheckedException("Handshake error: " + e.getMessage(), e); } if (hasMore) { user = reader.readString(); pwd = reader.readString(); } } AuthorizationContext authCtx = authenticate(ses.certificates(), user, pwd); handler = new ClientRequestHandler(this, authCtx, currentProtocolContext); parser = new ClientMessageParser(this, currentProtocolContext); }

Target:
@Override public void initializeFromHandshake(GridNioSession ses, ClientListenerProtocolVersion ver, BinaryReaderExImpl reader) throws IgniteCheckedException { EnumSet<ClientBitmaskFeature> features = null; if (ClientProtocolContext.isFeatureSupported(ver, BITMAP_FEATURES)) { byte cliFeatures = reader.readByteArray(); features = ClientBitmaskFeature.enumSet(cliFeatures); } currentProtocolContext = new ClientProtocolContext(ver, features); String user = null; String pwd = null; if (currentProtocolContext.isFeatureSupported(USER_ATTRIBUTES)) userAttrs = reader.readMap(); if (currentProtocolContext.isFeatureSupported(AUTHORIZATION)) { boolean hasMore; try { hasMore = reader.available() > 0; } catch (IOException e) { throw new IgniteCheckedException("Handshake error: " + e.getMessage(), e); } if (hasMore) { user = reader.readString(); pwd = reader.readString(); } } AuthorizationContext authCtx = authenticate(ses.certificates(), user, pwd); handler = new ClientRequestHandler(this, authCtx, currentProtocolContext); parser = new ClientMessageParser(this, currentProtocolContext); }
Source:
public OptionSet(OptionSet origin) { if (origin == null) throw new NullPointerException(); if_match_list = copyList(origin.if_match_list); uri_host = origin.uri_host; etag_list = copyList(origin.etag_list); if_none_match = origin.if_none_match; uri_port = origin.uri_port; location_path_list = copyList(origin.location_path_list); uri_path_list = copyList(origin.uri_path_list); content_format = origin.content_format; max_age = origin.max_age; uri_query_list = copyList(origin.uri_query_list); accept = origin.accept; location_query_list = copyList(origin.location_query_list); proxy_uri = origin.proxy_uri; proxy_scheme = origin.proxy_scheme; if (origin.block1 != null) block1 = new BlockOption(origin.block1); if (origin.block2 != null) block2 = new BlockOption(origin.block2); observe = origin.observe; oscore = origin.oscore.clone(); others = copyList(origin.others); }

Target:
public OptionSet(OptionSet origin) { if (origin == null) throw new NullPointerException(); if_match_list = copyList(origin.if_match_list); uri_host = origin.uri_host; etag_list = copyList(origin.etag_list); if_none_match = origin.if_none_match; uri_port = origin.uri_port; location_path_list = copyList(origin.location_path_list); uri_path_list = copyList(origin.uri_path_list); content_format = origin.content_format; max_age = origin.max_age; uri_query_list = copyList(origin.uri_query_list); accept = origin.accept; location_query_list = copyList(origin.location_query_list); proxy_uri = origin.proxy_uri; proxy_scheme = origin.proxy_scheme; if (origin.block1 != null) block1 = new BlockOption(origin.block1); if (origin.block2 != null) block2 = new BlockOption(origin.block2); observe = origin.observe; if(origin.oscore != null) oscore = origin.oscore.clone(); others = copyList(origin.others); }
Source:
public void passesCorrectBeanNameToTheImplementationDetector() { CustomRepositoryImplementationDetector detector = mock(CustomRepositoryImplementationDetector.class); CdiRepositoryBean<SampleRepository> bean = new CdiRepositoryBean<SampleRepository>( SINGLE_ANNOTATION, SampleRepository.class, beanManager, detector) { @Override protected SampleRepository create( CreationalContext<SampleRepository> creationalContext, Class<SampleRepository> repositoryType, Object customImplementation) { return null; } }; bean.create(mock(CreationalContext.class), SampleRepository.class); verify(detector).detectCustomImplementation( eq("CdiRepositoryBeanUnitTests.SampleRepositoryImpl"), eq("namedRepositoryImpl"), anySetOf(String.class), anySetOf(TypeFilter.class), Mockito.any(RepositoryBeanNameGenerator.class)); }

Target:
public void passesCorrectBeanNameToTheImplementationDetector() { CustomRepositoryImplementationDetector detector = mock(CustomRepositoryImplementationDetector.class); CdiRepositoryBean<SampleRepository> bean = new CdiRepositoryBean<SampleRepository>( SINGLE_ANNOTATION, SampleRepository.class, beanManager, Optional.of(detector) ) { @Override protected SampleRepository create( CreationalContext<SampleRepository> creationalContext, Class<SampleRepository> repositoryType, Optional<Object> customImplementation ) { return null; } }; bean.create(mock(CreationalContext.class), SampleRepository.class); verify(detector).detectCustomImplementation( eq("CdiRepositoryBeanUnitTests.SampleRepositoryImpl"), eq("namedRepositoryImpl"), anySet(), anySet(), Mockito.any(Function.class) ); }
Source:
public void onlyXrefsShouldBeConverted() { VariantAnnotation annotation = new VariantAnnotation("1", 1, 2, "A", "T"); annotation.setXrefs(Collections.singletonList(new Xref("OS01G0112100", "ensemblGene"))); DBObject dbObject = converter.convert(annotation); assertNull(dbObject.get(AnnotationFieldNames.CONSEQUENCE_TYPE_FIELD)); HashSet<BasicDBObject> xrefs = (HashSet) dbObject.get(AnnotationFieldNames.XREFS_FIELD); assertTrue(xrefs.size() == 1); assertTrue(isXrefPresent(xrefs, "OS01G0112100", "ensemblGene")); }

Target:
public void onlyXrefsShouldBeConverted() { VariantAnnotation annotation = new VariantAnnotation("1", 1, 2, "A", "T"); annotation.setXrefs(Collections.singletonList(new Xref("OS01G0112100", "ensemblGene"))); DBObject dbObject = converter.convert(annotation); assertNull(dbObject.get(AnnotationFieldNames.CONSEQUENCE_TYPE_FIELD)); HashSet<BasicDBObject> xrefs = (HashSet) dbObject.get(AnnotationFieldNames.XREFS_FIELD); assertEquals(1, xrefs.size()); assertTrue(isXrefPresent(xrefs, "OS01G0112100", "ensemblGene")); }
Source:
public CompletionStage<Void> removeRecoveryInformation(Collection<Address> lockOwners, Xid xid, GlobalTransaction gtx, boolean fromCluster) { log.tracef("Forgetting tx information for %s", gtx); if (rpcManager != null && !fromCluster) { TxCompletionNotificationCommand ftc = commandFactory.buildTxCompletionNotificationCommand(xid, gtx); return sendTxCompletionNotification(lockOwners, ftc) .thenRun(() -> removeRecoveryInformation(xid)); } else { removeRecoveryInformation(xid); return CompletableFutures.completedNull(); } }

Target:
public CompletionStage<Void> removeRecoveryInformation(Collection<Address> lockOwners, Xid xid, GlobalTransaction gtx, boolean fromCluster) { log.tracef("Forgetting tx information for %s", gtx); if (rpcManager != null && !fromCluster) { TxCompletionNotificationCommand ftc = commandFactory.buildTxCompletionNotificationCommand(xid, gtx); CompletionStage<Void> stage = sendTxCompletionNotification(lockOwners, ftc); removeRecoveryInformation(xid); return stage; } else { removeRecoveryInformation(xid); return CompletableFutures.completedNull(); } }
Source:
public void start(Map<String, Object> topoConf, int port) { try { hostName = dotToUnderScore(Utils.localHostname()); } catch (UnknownHostException e) { LOG.warn("Unable to determine hostname while starting the metrics system. Hostname will be reported" + " as 'localhost'."); } this.topologyName = (String) topoConf.get(Config.TOPOLOGY_NAME); this.port = port; LOG.info("Starting metrics reporters..."); List<Map<String, Object>> reporterList = (List<Map<String, Object>>) topoConf.get(Config.TOPOLOGY_METRICS_REPORTERS); if (reporterList != null && reporterList.size() > 0) { for (Map<String, Object> reporterConfig : reporterList) { startReporter(topoConf, reporterConfig); } } }

Target:
public void start(Map<String, Object> topoConf, int port) { try { hostName = dotToUnderScore(Utils.localHostname()); } catch (UnknownHostException e) { LOG.warn("Unable to determine hostname while starting the metrics system. Hostname will be reported" + " as 'localhost'."); } this.topologyId = (String) topoConf.get(Config.STORM_ID); this.port = port; LOG.info("Starting metrics reporters..."); List<Map<String, Object>> reporterList = (List<Map<String, Object>>) topoConf.get(Config.TOPOLOGY_METRICS_REPORTERS); if (reporterList != null && reporterList.size() > 0) { for (Map<String, Object> reporterConfig : reporterList) { startReporter(topoConf, reporterConfig); } } }
Source:
private boolean isDebug() { return getInitParameter("debug", false); }

Target:
private boolean isDebug() { return Integer.valueOf(getInitParameter("debug", "0")) == 1; }
Source:
private void subscribeLaunch() { if(checkCanSubscribe()) { getSubscriptionTracker().subscribe(entity, Attributes.SERVICE_STATE_ACTUAL, new EntityLaunchListener(this)); } }

Target:
private void subscribeLaunch() { subscribe(entity, Attributes.SERVICE_STATE_ACTUAL, new EntityLaunchListener(this)); }
Source:
public List<LdapUser> getUsersInGroup(String groupName, LdapContext context) throws NamingException { final SearchControls searchControls = new SearchControls(); searchControls.setSearchScope(_ldapConfiguration.getScope()); searchControls.setReturningAttributes(_ldapConfiguration.getReturnAttributes()); String basedn = _ldapConfiguration.getBaseDn(); if (StringUtils.isBlank(basedn)) { throw new IllegalArgumentException("ldap basedn is not configured"); } if (StringUtils.isBlank(groupName)) { throw new IllegalArgumentException("ldap group name cannot be blank"); } NamingEnumeration<SearchResult> results = context.search(basedn, generateADGroupSearchFilter(groupName), searchControls); final List<LdapUser> users = new ArrayList<LdapUser>(); while (results.hasMoreElements()) { final SearchResult result = results.nextElement(); users.add(createUser(result)); } return users; }

Target:
public List<LdapUser> getUsersInGroup(String groupName, LdapContext context) throws NamingException { if (StringUtils.isBlank(groupName)) { throw new IllegalArgumentException("ldap group name cannot be blank"); } String basedn = _ldapConfiguration.getBaseDn(); if (StringUtils.isBlank(basedn)) { throw new IllegalArgumentException("ldap basedn is not configured"); } final SearchControls searchControls = new SearchControls(); searchControls.setSearchScope(_ldapConfiguration.getScope()); searchControls.setReturningAttributes(_ldapConfiguration.getReturnAttributes()); NamingEnumeration<SearchResult> results = context.search(basedn, generateADGroupSearchFilter(groupName), searchControls); final List<LdapUser> users = new ArrayList<LdapUser>(); while (results.hasMoreElements()) { final SearchResult result = results.nextElement(); users.add(createUser(result)); } return users; }
Source:
CompactionDetails getCompactionDetails(BlobStore blobStore) throws StoreException { long usedCapacity = blobStore.getSizeInBytes(); long totalCapacity = blobStore.getCapacityInBytes(); CompactionDetails details = null; if (usedCapacity > (storeConfig.storeMinLogSizeToTriggerCompactionInPercent * totalCapacity / 100)) { List<String> potentialLogSegments = blobStore.getLogSegmentsOutsideJournal(); if (potentialLogSegments != null && potentialLogSegments.size() > 0) { details = new CompactionDetails(blobStore.getTime().milliseconds() - messageRetentionTimeInMs, potentialLogSegments); } } return details; }

Target:
CompactionDetails getCompactionDetails(BlobStore blobStore) throws StoreException { long usedCapacity = blobStore.getSizeInBytes(); long totalCapacity = blobStore.getCapacityInBytes(); CompactionDetails details = null; if (usedCapacity >= (storeConfig.storeMinUsedCapacityToTriggerCompactionInPercentage / 100.0) * totalCapacity) { List<String> potentialLogSegments = blobStore.getLogSegmentsNotInJournal(); if (potentialLogSegments != null) { details = new CompactionDetails(time.milliseconds() - messageRetentionTimeInMs, potentialLogSegments); } } return details; }
Source:
protected void onMethodInvocationFound(MethodInvocationTree mit) { if (mit.symbol().name().equals("isPresent")) { handleIsPresent(mit); } else if (mit.symbol().name().equals("anyMatch")) { handleAnyMatch(mit); } }

Target:
protected void onMethodInvocationFound(MethodInvocationTree mit) { String methodName = mit.symbol().name(); if (methodName.equals("isPresent")) { handleIsPresent(mit); } else if (methodName.equals("anyMatch")) { handleAnyMatch(mit); } }
Source:
public static Map<String, Set<Object>> deserializeToMap(FieldsDescriptor fieldsDescriptor, JSONObject dpou) { Map<String, Set<Object>> keyToValues = Maps.newHashMap(); for (String key : fieldsDescriptor.getFields().getFields()) { if (!dpou.has(key)) { throw new IllegalArgumentException("The given key " + key + " is not contained in the given JSON"); } Type type = fieldsDescriptor.getType(key); Set<Object> keyValues = Sets.newHashSet(); keyToValues.put(key, keyValues); Object keyValue; try { keyValue = dpou.get(key); } catch (JSONException ex) { throw new IllegalStateException("This should never happen", ex); } if (keyValue instanceof JSONArray) { JSONArray ja = (JSONArray) keyValue; for (int index = 0; index < ja.length(); index++) { Object val = getFieldFromJSON(type, ja, index); keyValues.add(val); } } else if (keyValue instanceof JSONObject) { throw new UnsupportedOperationException("Cannot extract objects from JSONObjects"); } else { Object val = getFieldFromJSON(fieldsDescriptor, key, dpou); keyValues.add(val); } } return keyToValues; }

Target:
public static Map<String, Set<Object>> deserializeToMap(FieldsDescriptor fieldsDescriptor, JSONObject dpou) { Map<String, Set<Object>> keyToValues = Maps.newHashMap(); for (String key : fieldsDescriptor.getFields().getFields()) { if (!dpou.has(key)) { throw new IllegalArgumentException("The given key " + key + " is not contained in the given JSON"); } Set<Object> keyValues; Object keyValue; try { keyValue = dpou.get(key); } catch (JSONException ex) { throw new IllegalStateException("This should never happen", ex); } if (keyValue instanceof JSONArray) { JSONArray ja = (JSONArray) keyValue; keyValues = Sets.newHashSetWithExpectedSize(ja.length()); Type type = fieldsDescriptor.getType(key); for (int index = 0; index < ja.length(); index++) { keyValues.add(getFieldFromJSON(type, ja, index)); } } else if (keyValue instanceof JSONObject) { throw new UnsupportedOperationException("Cannot extract objects from JSONObjects"); } else { keyValues = Sets.newHashSetWithExpectedSize(1); keyValues.add(getFieldFromJSON(fieldsDescriptor, key, dpou)); } keyToValues.put(key, keyValues); } return keyToValues; }
Source:
public void testClient() throws Exception { for (File f : Objects.requireNonNull(SERVER_PORTS_DIR.listFiles())) { LineNumberReader reader = new LineNumberReader(new FileReader(f)); int port = Integer.parseInt(reader.readLine()); System.out.println("Validating java client to " + f.getName() + " - " + port); Transceiver client = new SocketTransceiver(new InetSocketAddress("localhost", port)); proxy = SpecificRequestor.getClient(Simple.class, client); TestProtocolSpecific proto = new TestProtocolSpecific(); proto.testHello(); proto.testEcho(); proto.testEchoBytes(); proto.testError(); System.out.println("Done! Validation java client to " + f.getName() + " - " + port); reader.close(); } }

Target:
public void testClient() throws Exception { for (File f : Objects.requireNonNull(SERVER_PORTS_DIR.listFiles())) { try (LineNumberReader reader = new LineNumberReader(new FileReader(f))) { int port = Integer.parseInt(reader.readLine()); System.out.println("Validating java client to " + f.getName() + " - " + port); Transceiver client = new SocketTransceiver(new InetSocketAddress("localhost", port)); proxy = SpecificRequestor.getClient(Simple.class, client); TestProtocolSpecific proto = new TestProtocolSpecific(); proto.testHello(); proto.testEcho(); proto.testEchoBytes(); proto.testError(); System.out.println("Done! Validation java client to " + f.getName() + " - " + port); } } }
Source:
Options(String[] args) throws CmdLineException { CmdLineParser parser = new CmdLineParser(this); parser.parseArgument(args); if (skipEmitRegExp != null) { skipEmitPattern = Pattern.compile(skipEmitRegExp); } depgraph = Depgraph.parseFrom(depgraphFiles); if (filterSourcesWithDepgraphs) { Set<String> merged = Sets.union(depgraph.getRoots(), depgraph.getNonroots()); arguments.retainAll(merged); } Set<String> allExterns = new LinkedHashSet<>(); allExterns.addAll(depgraph.getRootExterns()); if (!partialInput) { allExterns.addAll(depgraph.getNonrootExterns()); } allExterns.addAll(externs); externs = new ArrayList<>(allExterns); arguments.removeAll(externs); if (!strictDeps) { depgraph = depgraph.withNonrootsAsRoots(); } if (arguments.isEmpty() && externs.isEmpty()) { throw new CmdLineException(parser, "No files or externs were given"); } if (googProvidesFile != null) { try { knownGoogProvides.addAll(Files.readLines(new File(googProvidesFile), UTF_8)); } catch (IOException e) { throw new RuntimeException("Error reading goog provides file " + googProvidesFile, e); } } if (knownClassAliasesFile != null) { try { for (String line : Files.readLines(new File(knownClassAliasesFile), UTF_8)) { String[] alias = line.split(","); knownClassAliases.put(alias[0], alias[1]); } } catch (IOException e) { throw new RuntimeException( "Error reading known class aliases file " + knownClassAliasesFile, e); } } }

Target:
Options(String[] args) throws CmdLineException { CmdLineParser parser = new CmdLineParser(this); parser.parseArgument(args); if (skipEmitRegExp != null) { skipEmitPattern = Pattern.compile(skipEmitRegExp); } depgraph = Depgraph.parseFrom(depgraphFiles); if (filterSourcesWithDepgraphs) { Set<String> merged = Sets.union(depgraph.getRoots(), depgraph.getNonroots()); arguments.retainAll(merged); } Set<String> allExterns = new LinkedHashSet<>(); allExterns.addAll(depgraph.getRootExterns()); if (!partialInput) { allExterns.addAll(depgraph.getNonrootExterns()); } allExterns.addAll(externs); externs = new ArrayList<>(allExterns); arguments.removeAll(externs); if (!strictDeps) { depgraph = depgraph.withNonrootsAsRoots(); } if (arguments.isEmpty() && externs.isEmpty()) { throw new CmdLineException(parser, "No files or externs were given"); } if (googProvidesFile != null) { try { knownGoogProvides.addAll(Files.readLines(new File(googProvidesFile), UTF_8)); } catch (IOException e) { throw new RuntimeException("Error reading goog provides file " + googProvidesFile, e); } } if (knownClassAliasesFile != null) { try { for (String line : Files.readLines(new File(knownClassAliasesFile), UTF_8)) { String[] alias = line.split(","); if (alias.length != 2) { throw new RuntimeException( "Badly formatted mapping in known class aliases file: " + line); } knownClassAliases.put(alias[0], alias[1]); } } catch (IOException e) { throw new RuntimeException( "Error reading known class aliases file " + knownClassAliasesFile, e); } } }
Source:
public void testFloats() { assertQueryUsingH2Cte("SELECT discount_real FROM lineitem_ex"); assertQueryUsingH2Cte("SELECT discount_real FROM lineitem_ex WHERE discount_real < 0.08"); assertQueryUsingH2Cte("SELECT count(*) FROM lineitem_ex WHERE tax_real > 0.1"); assertQueryUsingH2Cte("SELECT count(*) FROM lineitem_ex WHERE tax_real IS NOT NULL"); assertQueryUsingH2Cte("SELECT count(*) FROM lineitem_ex WHERE tax_real IS NULL"); assertQueryUsingH2Cte("SELECT discount_real, tax_real FROM lineitem_ex"); assertQueryUsingH2Cte("SELECT discount_real, tax_real FROM lineitem_ex WHERE tax_real < 0.03"); assertQueryUsingH2Cte("SELECT discount_real, tax_real FROM lineitem_ex WHERE ship_day = 1 AND ship_month = 1"); assertQueryUsingH2Cte("SELECT COUNT(*) FROM lineitem_ex WHERE discount_real IS NOT NULL AND tax_real > 0.001"); assertQueryUsingH2Cte("SELECT discount_real, tax_real FROM lineitem_ex WHERE discount_real > 0.01 AND tax_real > 0.01 AND (discount_real + tax_real) < 0.08"); }

Target:
public void testFloats() { assertQueryUsingH2Cte("SELECT discount_real, tax_real FROM lineitem_ex"); assertFilterProject("tax_real IS NOT NULL", "count(*)"); assertFilterProject("tax_real IS NULL", "count(*)"); assertFilterProject("tax_real > 0.1", "count(*)"); assertFilterProject("tax_real < 0.03", "discount_real, tax_real"); assertFilterProject("tax_real < 0.05 AND discount_real > 0.05", "discount_real"); assertFilterProject("tax_real = discount_real", "discount_real"); assertFilterProject("discount_real > 0.01 AND tax_real > 0.01 AND (discount_real + tax_real) < 0.08", "discount_real"); assertFilterProject("reals[1] > 0.01", "count(*)"); }
Source:
static TestSource fromUri(URI uri) { Preconditions.notNull(uri, "URI must not be null"); if (CLASSPATH_SCHEME.equals(uri.getScheme())) { return ClasspathResourceSource.from(uri); } else if (METHOD_SCHEME.equals(uri.getScheme())) { return MethodSourceUtils.fromUri(uri); } else { return UriSource.from(uri); } }

Target:
static TestSource fromUri(URI uri) { Preconditions.notNull(uri, "URI must not be null"); if (CLASSPATH_SCHEME.equals(uri.getScheme())) { return ClasspathResourceSource.from(uri); } if (METHOD_SCHEME.equals(uri.getScheme())) { return MethodSourceSupport.from(uri); } return UriSource.from(uri); }
Source:
protected GeckoDriverService createDriverService(File exe, int port, ImmutableList<String> args, ImmutableMap<String, String> environment) { try { Duration timeout = (firefoxBinary == null) ? Duration.ofSeconds(45) : Duration.ofMillis(firefoxBinary.getTimeout()); GeckoDriverService service = new GeckoDriverService(exe, port, args, environment, timeout); String firefoxLogFile = System.getProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE); if (firefoxLogFile != null) { if ("/dev/stdout".equals(firefoxLogFile)) { service.sendOutputTo(System.out); } else if ("/dev/stderr".equals(firefoxLogFile)) { service.sendOutputTo(System.err); } else if ("/dev/null".equals(firefoxLogFile)) { service.sendOutputTo(ByteStreams.nullOutputStream()); } else { service.sendOutputTo(new FileOutputStream(firefoxLogFile)); } } else { if (getLogFile() != null) { service.sendOutputTo(new FileOutputStream(getLogFile())); } else { service.sendOutputTo(System.err); } } return service; } catch (IOException e) { throw new WebDriverException(e); } }

Target:
protected GeckoDriverService createDriverService(File exe, int port, ImmutableList<String> args, ImmutableMap<String, String> environment) { try { GeckoDriverService service = new GeckoDriverService(exe, port, args, environment); String firefoxLogFile = System.getProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE); if (firefoxLogFile != null) { if ("/dev/stdout".equals(firefoxLogFile)) { service.sendOutputTo(System.out); } else if ("/dev/stderr".equals(firefoxLogFile)) { service.sendOutputTo(System.err); } else if ("/dev/null".equals(firefoxLogFile)) { service.sendOutputTo(ByteStreams.nullOutputStream()); } else { service.sendOutputTo(new FileOutputStream(firefoxLogFile)); } } else { if (getLogFile() != null) { service.sendOutputTo(new FileOutputStream(getLogFile())); } else { service.sendOutputTo(System.err); } } return service; } catch (IOException e) { throw new WebDriverException(e); } }
Source:
public Void processElement(ParserContext context, Element element) throws ConfigurationException { String phaseStr = element.getTextContent().trim(); Class<? extends RulePhase> phase = phaseFinder.findPhase(phaseStr); if (phase == null) { String phasesListing = phaseFinder.getAvailablePhases().stream().map(clazz -> clazz.getSimpleName()).collect(Collectors.joining(System.lineSeparator())); throw new IllegalArgumentException("Unrecognized phase \"" + phaseStr + "\". Available phases: \n " + phasesListing); } context.getBuilder().setPhase(phase); return null; }

Target:
public Void processElement(ParserContext context, Element element) throws ConfigurationException { String phaseStr = element.getTextContent().trim(); Class<? extends RulePhase> phase = phaseFinder.findPhase(phaseStr); if (phase == null) { String phasesListing = phaseFinder.getAvailablePhases().stream().map(clazz -> clazz.getSimpleName()).collect(Collectors.joining(System.lineSeparator()+" ")); throw new IllegalArgumentException("Unrecognized phase \"" + phaseStr + "\". Available phases: \n " + phasesListing); } context.getBuilder().setPhase(phase); return null; }
Source:
private ArrayList<String> readFile(MultipartFile file) throws IOException { BufferedReader br; ArrayList<String> subjectKeyList = new ArrayList<>(); String line; InputStream is = file.getInputStream(); br = new BufferedReader(new InputStreamReader(is)); while ((line = br.readLine()) != null && !(line.isEmpty())) { subjectKeyList.add(line); } return subjectKeyList; }

Target:
private ArrayList<String> readFile(MultipartFile file) throws IOException { ArrayList<String> subjectKeyList = new ArrayList<>(); try(Scanner sc = new Scanner(file.getInputStream())){ String line; while (sc.hasNextLine()) { line = sc.nextLine(); subjectKeyList.add(line); } } catch (Exception e) { log.error("Exception with cause = {}", e.getCause(), e.getMessage()); } return subjectKeyList; }
Source:
private void getRandomPage() { parent().getLoadStatusList().add(false); final int getLoadStatusListIndex = parent().getLoadStatusList().size() - 1; new RandomSummaryClient().request(WikipediaApp.getInstance().getWikiSite(), new RandomSummaryClient.Callback() { @Override public void onSuccess(@NonNull Call<RbPageSummary> call, @NonNull RbPageSummary pageSummary) { if (!isAdded()) { return; } setContents(pageSummary); parent().getLoadStatusList().set(getLoadStatusListIndex, true); if (getPagerPosition() == parent().randomPager.getCurrentItem()) { parent().enableSaveShareButton(true); } } @Override public void onError(@NonNull Call<RbPageSummary> call, @NonNull Throwable t) { if (!isAdded()) { return; } setErrorState(t); } }); }

Target:
private void getRandomPage() { new RandomSummaryClient().request(WikipediaApp.getInstance().getWikiSite(), new RandomSummaryClient.Callback() { @Override public void onSuccess(@NonNull Call<RbPageSummary> call, @NonNull RbPageSummary pageSummary) { loadComplete = true; callback.onChildLoaded(); if (!isAdded()) { return; } setContents(pageSummary); } @Override public void onError(@NonNull Call<RbPageSummary> call, @NonNull Throwable t) { if (!isAdded()) { return; } setErrorState(t); } }); }
Source:
private static String relativePathToZipCompliantName(Path path, boolean isDirectory) { log.trace("Generating zip-compliant filename from Path \"{}\", isDirectory: {}", path, isDirectory); final char separator = '/'; StringBuilder sb = new StringBuilder(); for (Path part : path) { sb.append(part); sb.append(separator); } if (sb.length() == 0) { log.trace("Path didn't have any name elements"); return path.toString(); } if (!isDirectory) { log.trace("Path wasn't a directory, removing trailing slash"); sb.deleteCharAt(sb.length() - 1); } return sb.toString(); }

Target:
private static String relativePathToZipCompliantName(Path path, boolean isDirectory) { log.trace("Generating zip-compliant filename from Path \"{}\", isDirectory: {}", path, isDirectory); StringBuilder sb = new StringBuilder(); for (Path part : path) { sb.append(part); sb.append(ZIP_SEPARATOR); } if (!isDirectory) { log.trace("Path wasn't a directory, removing trailing slash"); sb.deleteCharAt(sb.length() - 1); } return sb.toString(); }
Source:
private void prestartVms(Guid vmPoolId, int numOfVmsToPrestart) { List<VmPoolMap> vmPoolMaps = DbFacade.getInstance().getVmPoolDao() .getVmMapsInVmPoolByVmPoolIdAndStatus(vmPoolId, VMStatus.Down); int failedAttempts = 0; int prestartedVmsCounter = 0; final int maxFailedAttempts = Config.<Integer> getValue(ConfigValues.VmPoolMonitorMaxAttempts); Map<String, Integer> failureReasons = new HashMap<>(); if (vmPoolMaps != null && vmPoolMaps.size() > 0) { for (VmPoolMap map : vmPoolMaps) { if (failedAttempts < maxFailedAttempts && prestartedVmsCounter < numOfVmsToPrestart) { ArrayList<String> messages = new ArrayList<>(); if (prestartVm(map.getVmId(), messages)) { prestartedVmsCounter++; failedAttempts = 0; } else { failedAttempts++; collectVmPrestartFailureReasons(failureReasons, messages); } } else { logResultOfPrestartVms(prestartedVmsCounter, numOfVmsToPrestart, vmPoolId, failureReasons); break; } } } else { log.info("No Vms available for prestarting"); } }

Target:
private void prestartVms(Guid vmPoolId, int numOfVmsToPrestart) { List<VmPoolMap> vmPoolMaps = DbFacade.getInstance().getVmPoolDao() .getVmMapsInVmPoolByVmPoolIdAndStatus(vmPoolId, VMStatus.Down); int failedAttempts = 0; int prestartedVmsCounter = 0; final int maxFailedAttempts = Config.<Integer> getValue(ConfigValues.VmPoolMonitorMaxAttempts); Map<String, Integer> failureReasons = new HashMap<>(); if (vmPoolMaps != null && vmPoolMaps.size() > 0) { for (VmPoolMap map : vmPoolMaps) { if (failedAttempts < maxFailedAttempts && prestartedVmsCounter < numOfVmsToPrestart) { List<String> messages = new ArrayList<>(); if (prestartVm(map.getVmId(), messages)) { prestartedVmsCounter++; failedAttempts = 0; } else { failedAttempts++; collectVmPrestartFailureReasons(failureReasons, messages); } } else { logResultOfPrestartVms(prestartedVmsCounter, numOfVmsToPrestart, vmPoolId, failureReasons); break; } } } else { log.info("No VMs available for prestarting"); } }
Source:
public void run(StreamApplication app) { try { ExecutionPlan plan = getExecutionPlan(app); createStreams(plan.getIntermediateStreams()); if (plan.getJobConfigs().isEmpty()) { throw new SamzaException("No jobs to run."); } plan.getJobConfigs().forEach(jobConfig -> { log.debug("Starting job StreamProcessor with config {}", jobConfig.getName(), jobConfig); String processorId = getProcessorId(config); if (StringUtils.isEmpty(processorId)) { throw new SamzaException("processorId has to be defined when running StreamApplication locally."); } StreamProcessor processor = createStreamProcessor(processorId, jobConfig, app, new LocalStreamProcessorLifeCycleListener(processorId)); processor.start(); processors.add(processor); }); latch.await(); if (throwable.get() != null) { appStatus = ApplicationStatus.UnsuccessfulFinish; throw throwable.get(); } else { appStatus = ApplicationStatus.SuccessfulFinish; } } catch (Throwable t) { appStatus = ApplicationStatus.UnsuccessfulFinish; throw new SamzaException("Failed to run application", t); } finally { if (coordinationUtils != null) { coordinationUtils.reset(); } } }

Target:
public void run(StreamApplication app) { try { ExecutionPlan plan = getExecutionPlan(app); writePlanJsonFile(plan.getPlanAsJson()); createStreams(plan.getIntermediateStreams()); if (plan.getJobConfigs().isEmpty()) { throw new SamzaException("No jobs to run."); } plan.getJobConfigs().forEach(jobConfig -> { log.debug("Starting job StreamProcessor with config {}", jobConfig.getName(), jobConfig); LocalStreamProcessorLifeCycleListener listener = new LocalStreamProcessorLifeCycleListener(); StreamProcessor processor = createStreamProcessor(jobConfig, app, listener); listener.setProcessor(processor); processors.add(processor); }); numProcessorsToStart.set(processors.size()); processors.forEach(StreamProcessor::start); } catch (Exception e) { throw new SamzaException("Failed to start application", e); } }
Source:
public void testparseDeadlineStringStartEnd() { String repeatable1 = "[users:john]@[R2/2019-05-27T17:00:00Z/2019-05-27T13:00:00Z]"; List<Deadline> deadlines = HumanTaskHandlerHelper.parseDeadlineString(repeatable1, null, null); assertNotNull(deadlines); assertEquals(2, deadlines.size()); long diff = Math.abs(deadlines.get(1).getDate().getTime() - deadlines.get(0).getDate().getTime()); long diffHours = TimeUnit.HOURS.convert(diff, TimeUnit.MILLISECONDS); assertEquals(diffHours, 4); }

Target:
public void testparseDeadlineStringStartEnd() { String repeatable1 = "[users:john]@[R2/2019-05-27T13:00:00Z/2019-05-27T17:00:00Z]"; List<Deadline> deadlines = HumanTaskHandlerHelper.parseDeadlineString(repeatable1, null, null, false); assertNotNull(deadlines); assertEquals(2, deadlines.size()); long diff = Math.abs(deadlines.get(1).getDate().getTime() - deadlines.get(0).getDate().getTime()); long diffHours = TimeUnit.HOURS.convert(diff, TimeUnit.MILLISECONDS); assertEquals(diffHours, 4); }
Source:
public ScoredDocuments rerank(ScoredDocuments docs, RerankerContext context) { assert (docs.documents.length == docs.scores.length); IndexSearcher searcher = context.getIndexSearcher(); Query finalQuery = reformulateQuery(docs, context); Query filterQuery = null; TopDocs rs = null; if (this.condenseListGenerator .equals(QUERY_FILTER_RESCORER) || this.condenseListGenerator.equals(DOC_FILTER_RESCORER)) { filterQuery = this.condenseListGenerator.equals(QUERY_FILTER_RESCORER)? context.getQuery(): FilterQueryBuilder.buildSetQuery(LuceneDocumentGenerator.FIELD_ID, getFieldValues(docs, LuceneDocumentGenerator.FIELD_ID, searcher)); rs = rescoreWithTieBreaker(finalQuery,filterQuery,context,searcher); }else if (this.condenseListGenerator.equals(HIT_RESCORER)){ QueryRescorer rm3Rescoer = new RM3QueryRescorer(finalQuery); try { rs = rm3Rescoer.rescore(searcher,docs.topDocs,context.getSearchArgs().hits); } catch (IOException e) { e.printStackTrace(); } } return rs==null? docs:ScoredDocuments.fromTopDocs(rs, searcher); }

Target:
public ScoredDocuments rerank(ScoredDocuments docs, RerankerContext context) { assert (docs.documents.length == docs.scores.length); IndexSearcher searcher = context.getIndexSearcher(); Query finalQuery = reformulateQuery(docs, context); Query filterQuery = null; TopDocs rs = null; if (this.condenseListGenerator .equals(QUERY_FILTER) || this.condenseListGenerator.equals( DOC_FILTER)) { filterQuery = this.condenseListGenerator.equals(QUERY_FILTER)? context.getQuery(): FilterQueryBuilder.buildSetQuery(LuceneDocumentGenerator.FIELD_ID, getFieldValues(docs, LuceneDocumentGenerator.FIELD_ID, searcher)); rs = rescoreWithTieBreaker(finalQuery,filterQuery,context,searcher); } else if (this.condenseListGenerator.equals(HIT_RESCORER)){ QueryRescorer rm3Rescoer = new RM3QueryRescorer(finalQuery); try { rs = rm3Rescoer.rescore(searcher,docs.topDocs,context.getSearchArgs().hits); } catch (IOException e) { e.printStackTrace(); } } return rs==null? docs:ScoredDocuments.fromTopDocs(rs, searcher); }
Source:
public static void loadValue(ITimeGraphPresentationProvider presentationProvider, StateItem stateItem) { IPreferenceStore store = getStore(); String rgbKey = getRgbKey(presentationProvider, stateItem); String widthKey = getWidthKey(presentationProvider, stateItem); Map<String, Object> styleMap = stateItem.getStyleMap(); RGB defaultRgb = stateItem.getStateColor(); String defaultString = store.getDefaultString(rgbKey); if(defaultString.isEmpty()) { store.setDefault(rgbKey, new RGBAColor(defaultRgb.red, defaultRgb.green, defaultRgb.blue, 255).toString()); } int rgbColor = store.getInt(rgbKey); float defaultHeight = isLink(stateItem) ? 0.1f : 1.0f; float defaultWidth = (float) stateItem.getStyleMap().getOrDefault(ITimeEventStyleStrings.heightFactor(), defaultHeight); store.setDefault(widthKey, defaultWidth); float width = store.getFloat(widthKey); styleMap.put(ITimeEventStyleStrings.fillColor(), rgbColor); styleMap.put(ITimeEventStyleStrings.heightFactor(), width); }

Target:
public static void loadValue(ITimeGraphPresentationProvider presentationProvider, StateItem stateItem) { IPreferenceStore store = getStore(); String rgbKey = getRgbKey(presentationProvider, stateItem); String widthKey = getWidthKey(presentationProvider, stateItem); Map<String, Object> styleMap = stateItem.getStyleMap(); RGB defaultRgb = stateItem.getStateColor(); String defaultString = store.getDefaultString(rgbKey); if (defaultString.isEmpty()) { store.setDefault(rgbKey, new RGBAColor(defaultRgb.red, defaultRgb.green, defaultRgb.blue, 255).toString()); } String rgbColor = store.getString(rgbKey); if (store.getInt(ITimeEventStyleStrings.heightFactor()) == 0) { float defaultHeight = isLink(stateItem) ? 0.1f : 1.0f; float defaultWidth = (float) stateItem.getStyleMap().getOrDefault(ITimeEventStyleStrings.heightFactor(), defaultHeight); store.setDefault(widthKey, defaultWidth); } float width = store.getFloat(widthKey); RGBAColor rgba = RGBAColor.fromString(rgbColor); if (rgba != null) { styleMap.put(ITimeEventStyleStrings.fillColor(), rgba.toInt()); styleMap.put(ITimeEventStyleStrings.heightFactor(), width); } }
Source:
public Iterator<Vector2ic> iterator() { return new Iterator<Vector2ic>() { private int radius = 1; private int leg; private int x = -1; private int y; private int index; private Vector2i pos = new Vector2i(); @Override public Vector2ic next() { if (index >= maxArea) { throw new NoSuchElementException("radius has been reached"); } switch (leg) { case 0: ++x; if (x == radius) { ++leg; } break; case 1: ++y; if (y == radius) { ++leg; } break; case 2: --x; if (-x == radius) { ++leg; } break; case 3: --y; if (-y == radius) { leg = 0; ++radius; } break; } index++; int finalX = center.x() + x * scale; int finalY = center.y() + (clockwise ? y : -y) * scale; pos.set(finalX, finalY); return pos; } @Override public boolean hasNext() { return index < maxArea; } @Override public void remove() { throw new UnsupportedOperationException("remove"); } }; }

Target:
public Iterator<Vector2ic> iterator() { return new Iterator<Vector2ic>() { private int radius = 1; private int leg; private int x = -1; private int y; private int index; private final Vector2i pos = new Vector2i(); @Override public Vector2ic next() { if (index >= maxArea) { throw new NoSuchElementException("radius has been reached"); } switch (leg) { case 0: ++x; if (x == radius) { ++leg; } break; case 1: ++y; if (y == radius) { ++leg; } break; case 2: --x; if (-x == radius) { ++leg; } break; case 3: --y; if (-y == radius) { leg = 0; ++radius; } break; } index++; int finalX = center.x() + x * scale; int finalY = center.y() + (clockwise ? y : -y) * scale; pos.set(finalX, finalY); return pos; } @Override public boolean hasNext() { return index < maxArea; } @Override public void remove() { throw new UnsupportedOperationException("remove"); } }; }
Source:
public Description matchVariable(VariableTree tree, VisitorState state) { if (JMOCK_MOCKERY_MATCHER.matches(tree, state) && !(FIELD_A_RULE_ANNOTATION_MATHER.matches(tree, state) || CLASS_USING_JMOCK_RUNNER_MATCHER.matches(tree, state))) { return describeMatch(tree); } return Description.NO_MATCH; }

Target:
public Description matchVariable(VariableTree tree, VisitorState state) { if (BUG_PATTERN_MATCHER.matches(tree, state)) { return describeMatch(tree); } return Description.NO_MATCH; }