id
stringlengths
7
14
text
stringlengths
1
106k
4449830_0
public static IpCamDevice register(IpCamDevice ipcam) { for (WebcamDevice d : DEVICES) { String name = ipcam.getName(); if (d.getName().equals(name)) { throw new WebcamException(String.format("Webcam with name '%s' is already registered", name)); } } DEVICES.add(ipcam); rescan(); return ipcam; }
4449830_1
public static boolean isRegistered(IpCamDevice ipcam) { if (ipcam == null) { throw new IllegalArgumentException("IP camera device cannot be null"); } Iterator<IpCamDevice> di = DEVICES.iterator(); while (di.hasNext()) { if (di.next().getName().equals(ipcam.getName())) { return true; } } return false; }
4449830_2
public static boolean isRegistered(IpCamDevice ipcam) { if (ipcam == null) { throw new IllegalArgumentException("IP camera device cannot be null"); } Iterator<IpCamDevice> di = DEVICES.iterator(); while (di.hasNext()) { if (di.next().getName().equals(ipcam.getName())) { return true; } } return false; }
4449830_3
public static boolean isRegistered(IpCamDevice ipcam) { if (ipcam == null) { throw new IllegalArgumentException("IP camera device cannot be null"); } Iterator<IpCamDevice> di = DEVICES.iterator(); while (di.hasNext()) { if (di.next().getName().equals(ipcam.getName())) { return true; } } return false; }
4449830_4
@Override public String toString() { return String.format("%s[%s (%s)]", getClass().getSimpleName(), getName(), getMRL()); }
4449830_5
@Override public boolean accept(File dir, String name) { return dir.getName().equals("dev") && name.startsWith("video") && (name.length() > 5 && Character.isDigit(name.charAt(5))); }
4449830_6
public int getOperation() { return operation; }
4449830_7
@Override public BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel dstCM) { if (dstCM == null) { dstCM = src.getColorModel(); } return new BufferedImage(dstCM, dstCM.createCompatibleWritableRaster(src.getWidth(), src.getHeight()), dstCM.isAlphaPremultiplied(), null); }
4449830_8
@Override public Rectangle2D getBounds2D(BufferedImage src) { return new Rectangle(0, 0, src.getWidth(), src.getHeight()); }
4449830_9
@Override public Point2D getPoint2D(Point2D srcPt, Point2D dstPt) { if (dstPt == null) { dstPt = new Point2D.Double(); } dstPt.setLocation(srcPt.getX(), srcPt.getY()); return dstPt; }
4484894_0
public boolean set(V value) { return super.set(value); }
4484894_1
public boolean setException(Throwable e) { return super.setException(e); }
4484894_2
public boolean set(V value) { return super.set(value); }
4484894_3
public boolean set(V value) { return super.set(value); }
4484894_4
@SuppressWarnings("unchecked") public <T> DistributedFuture<GROUP, T> createFuture(HazeltaskTask<GROUP> task) { DistributedFuture<GROUP, T> future = new DistributedFuture<GROUP, T>(topologyService, task.getGroup(), task.getId()); this.futures.put(task.getId(), (DistributedFuture<GROUP, Serializable>) future); ...
4484894_5
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override protected void beforeExecute(Thread t, Runnable runnable) { for(ExecutorListener<?> listener : listeners) { try { listener.beforeExecute((HazeltaskTask)runnable); } catch(Throwable e) { //ignore and log log.er...
4484894_6
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override protected void afterExecute(Runnable runnable, Throwable exception) { for(ExecutorListener<?> listener : listeners) { try { listener.afterExecute((HazeltaskTask)runnable, exception); } catch(Throwable e) { //ignore and lo...
4484894_7
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override protected void afterExecute(Runnable runnable, Throwable exception) { for(ExecutorListener<?> listener : listeners) { try { listener.afterExecute((HazeltaskTask)runnable, exception); } catch(Throwable e) { //ignore and lo...
4484894_8
public ExecutorConfig<GROUP> disableWorkers() { this.disableWorkers = true; return this; }
4484894_9
@SuppressWarnings("unchecked") public TaskIdAdapter<? super Object, GROUP, ?> getTaskIdAdapter() { return (TaskIdAdapter<? super Object, GROUP, ?>) taskIdAdapter; }
4494450_0
@Override public final void execute() { try { presetParameters(); new LoggerUtils().loadConfiguration(); final FlexPmdXmlEngine engine = new FlexPmdXmlEngine( new FlexPmdParameters( packageToExclude, outputDirecto...
4494450_1
@Override public final void execute() { new LoggerUtils().loadConfiguration(); validateFields(); try { new FlexMetrics( sourceDirectory, mxmlFactor ).execute( outputFile ); } catch ( final DocumentException e ) { throw new BuildException( e ); } catch ( final IOException e ) { ...
4494450_2
static boolean startFlexMetrics( final String[] args ) throws JSAPException, PMDException, URISyntaxException, IOException, ...
4494450_3
public static List< File > computeSourceList( final String source ) { if ( !source.contains( "," ) ) { return null; } final List< File > sourceList = new ArrayList< File >(); for ( int i = 0; i < source.split( "," ).length; i++ ) { sourceList.add( new File( source.split( "," )[ i ] ) ); //...
4494450_4
public static void registerParameter( final JSAP jsap, final ICommandLineOptions option, final boolean required ) throws JSAPException { final String optionName = option.toString(); jsap.registerParameter( new FlaggedOption( optionName )....
4494450_5
static boolean areCommandLineOptionsCorrect( final String[] args ) throws JSAPException { final JSAP jsap = new JSAP(); config = parseCommandLineArguments( args, jsap ); if ( !config.success() ) { LOGGER.log( Level.SEVERE, "Usage: java " ...
4494450_6
static boolean startFlexCPD( final String[] args ) throws JSAPException, URISyntaxException, IOException, ReportException, ...
4494450_7
@Deprecated public Exception getReason() { return ( Exception ) getCause(); }
4494450_8
public void setSeverity( final int severityToBeSet ) { severity = severityToBeSet; }
4494450_9
public final boolean contains( final String stringToLookup, final Set< Integer > linesToBeIgnored ) { int lineIndex = 1; boolean found = false; for ( final String line : lines ) { if ( doesCurrentLineContain( line, stringToLookup ) ...
4514536_0
protected FileObject createFile( AbstractFileName name ) throws Exception { return new S3NFileObject( name, this ); }
4514536_1
protected FileSystem doCreateFileSystem( final FileName name, final FileSystemOptions fileSystemOptions ) throws FileSystemException { return new S3NFileSystem( name, fileSystemOptions ); }
4514536_2
public FileName parseUri( VfsComponentContext context, FileName base, String uri ) throws FileSystemException { StringBuilder name = new StringBuilder(); String scheme = UriParser.extractScheme( uri, name ); UriParser.canonicalizePath( name, 0, name.length(), this ); // Normalize separators in the path UriPar...
4514536_3
@Override public String getURI() { final StringBuilder buffer = new StringBuilder(); appendRootUri( buffer, false ); buffer.append( getPath() ); return buffer.toString(); }
4514536_4
public FileName createName( String absPath, FileType type ) { return new S3NFileName( getScheme(), bucketId, absPath, type ); }
4514536_5
@Override public String getURI() { final StringBuilder buffer = new StringBuilder(); appendRootUri( buffer, false ); buffer.append( getPath() ); return buffer.toString(); }
4514536_6
protected FileObject createFile( AbstractFileName name ) throws Exception { return new S3FileObject( name, this ); }
4514536_7
public int getPartSize() { long parsedPartSize = parsePartSize( s3KettleProperty.getPartSize() ); return convertToInt( parsedPartSize ); }
4514536_8
protected long parsePartSize( String partSizeString ) { long parsePartSize = convertToLong( partSizeString ); if ( parsePartSize < convertToLong( MIN_PART_SIZE ) ) { consoleLog.logBasic( BaseMessages.getString( PKG, "WARN.S3MultiPart.DefaultPartSize", partSizeString, MIN_PART_SIZE ) ); parsePartSize = conve...
4514536_9
protected int convertToInt( long parsedPartSize ) { return (int) Long.min( Integer.MAX_VALUE, parsedPartSize ); }
4522462_0
@Override public UriBuilder replaceMatrixParam(String name, Object... values) { checkSsp(); if (name == null) { throw new IllegalArgumentException("Name parameter is null"); } if (matrixParams == null) { int i = path.lastIndexOf("/"); if (i != -1) { i = 0; } ...
4522462_1
@Override public UriBuilder replaceQueryParam(String name, Object... values) { checkSsp(); if (queryParams == null) { queryParams = UriComponent.decodeQuery(query.toString(), false, false); query.setLength(0); } name = encode(name, UriComponent.Type.QUERY_PARAM); queryParams.remove(n...
4522462_2
protected static SAXSource getSAXSource(SAXParserFactory spf, InputStream entityStream) throws JAXBException { try { return new SAXSource( spf.newSAXParser().getXMLReader(), new InputSource(entityStream)); } catch (Exception ex) { throw new JAXBException("...
4522462_3
public static void appendQuotedIfNonToken(StringBuilder b, String value) { if (value==null) return; boolean quote = !GrammarUtil.isTokenString(value); if (quote) b.append('"'); appendEscapingQuotes(b, value); if (quote) b.append('"'); }
4522462_4
public static void appendQuotedIfWhitespace(StringBuilder b, String value) { if (value==null) return; boolean quote = GrammarUtil.containsWhiteSpace(value); if (quote) b.append('"'); appendEscapingQuotes(b, value); if (quote) b.append('"'); }
4522462_5
public static void appendQuoted(StringBuilder b, String value) { b.append('"'); appendEscapingQuotes(b, value); b.append('"'); }
4522462_6
public static void appendEscapingQuotes(StringBuilder b, String value) { for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (c == '"') b.append('\\'); b.append(c); } }
4522462_9
public Contact findContact(String username, String id) { try { Entry entry = service. path("contacts"). path(username). path(id). accept(ENTRY_MEDIA_TYPE). header(AUTHENTICATION_HEADER, authentication). get(Entry...
4536629_0
@Override public boolean validate(ConstraintValidatorContext context) { boolean isValid = true; for (String scope : scopes) { if (!scope.matches(ResourceServer.SCOPE_PATTERN)) { violation(context, "Scope '" + scope + "' contains invalid characters"); isValid = false; } } return isValid; }
4536629_1
@Override public boolean validate(ConstraintValidatorContext context) { boolean isValid = true; for (String scope : scopes) { if (!scope.matches(ResourceServer.SCOPE_PATTERN)) { violation(context, "Scope '" + scope + "' contains invalid characters"); isValid = false; } } return isValid; }
4536629_2
public boolean checkPassword(String password) { return this.password.equals(password); }
4536629_3
@GET public Response getAll(@Context HttpServletRequest request) { Response validateScopeResponse = validateScope(request, Collections.singletonList(AbstractResource.SCOPE_READ)); if (validateScopeResponse != null) { return validateScopeResponse; } List<AccessToken> tokens = getAllAccessTokens(request); r...
4536629_4
@SuppressWarnings("unchecked") protected void pruneClientScopes(final List<String> newScopes, List<String> oldScopes, Set<Client> clients) { if (!newScopes.containsAll(oldScopes)) { subtract(oldScopes, newScopes); Collection<String> outdatedScopes = subtract(oldScopes, newScopes); LOG.info("Resource serve...
4536629_5
protected String sanitizeClientName(String name) { return name.toLowerCase().replaceAll(" ", "-").replaceAll(FILTERED_CLIENT_ID_CHARS, ""); }
4536629_6
protected String generateClientId(Client client) { String clientId = sanitizeClientName(client.getName()); if (clientRepository.findByClientId(clientId) != null) { String baseClientId = clientId; /* if one with such name exists already, the next one would actually be number 2. Therefore, * start counti...
4536629_7
@PUT public Response put(@Context HttpServletRequest request, @PathParam("resourceServerId") Long resourceServerId, Client client) { Response validateScopeResponse = validateScope(request, Collections.singletonList(AbstractResource.SCOPE_WRITE)); if (validateScopeResponse != null) { return v...
4536629_8
@GET public Response getAll(@Context HttpServletRequest request) { Response validateScopeResponse = validateScope(request, Collections.singletonList(AbstractResource.SCOPE_READ)); if (validateScopeResponse != null) { return validateScopeResponse; } List<ResourceOwner> resourceOwners =...
4536629_9
@Override public AuthenticatedPrincipal authenticate(String username, String password) { ResourceOwner user = resourceOwnerRepository.findByUsername(username); if (user == null) { return null; } // Validate password if (!user.checkPassword(password)) { return null; } return new AuthenticatedPri...
4541580_0
public static String interpolateUnicode(String pattern, String text) { Preconditions.checkNotNull(pattern, "Pattern is required."); if (Strings.isNullOrEmpty(text)) { return text; } UnicodeInterpolator ui = createEmojiInterpolator(pattern); return ui.escape(text); }
4541580_1
public static String interpolateAlias(String pattern, String text) { return interpolate(text, EmojiInterpolator.EMOJI_ALIAS, new EmojiAliasReplacer(pattern)); }
4541580_2
public static EmojiChar findByCodePoint(String code) { return getInstance()._findByCodePoint(code); }
4541580_3
public static EmojiChar findByVendorCodePoint(Vendor vendor, String point) { Emoji emoji = Emoji.getInstance(); return emoji._findByVendorCodePoint(vendor, point); }
4541580_4
public static EmojiChar byHexCode(String hex) { return Emoji.findByHexCode(hex); }
4541580_5
public static EmojiChar byName(String name) { return Emoji.singleByAnnotations(name); }
4541580_6
public static EmojiChar byUnicode(String codePoint) { return Emoji.findByCodePoint(codePoint); }
4541580_7
public static String imageTagByUnicode(String codePoint) { return getInstance().interpolate(codePoint); }
4541580_8
public static String imageTagByUnicode(String codePoint) { return getInstance().interpolate(codePoint); }
4541580_9
public static String replaceUnicodeWithImages(String text) { return getInstance().interpolate(text); }
4544259_0
@Override public Repository create(String name) throws Exception { return create(name, null); }
4544259_1
@Override public void updateBundleRepositoryDescriptor(String name) throws Exception { if (repositories.get(name) == null) { throw new IllegalArgumentException("Repository " + name + " doesn't exist"); } if (repositories.get(name).getLocation() != null && !repositories.get(name).getLocation().isEmpt...
4544259_2
protected static Map<String, String> parseMvnUrl(String artifactUrl) { Matcher matcher = mvnPattern.matcher(artifactUrl); if (!matcher.matches()) { return null; } Map<String, String> result = new HashMap<>(); result.put("groupId", matcher.group(1)); result.put("artifactId", matcher.group...
4544259_3
protected static String convertMvnUrlToPath(String mvnUrl) { Map<String, String> coordinates = parseMvnUrl(mvnUrl); return convertMvnCoordinatesToPath(coordinates); }
4544982_0
public int getClassNumber() { return classCounter; }
4544982_1
public int getStatementNumber() { return statementCounter; }
4544982_2
public int getFunctionNumber() { return functionCounter; }
4544982_3
public static int complexity(Tree tree) { return complexityTrees(tree).size(); }
4544982_4
public static int complexity(Tree tree) { return complexityTrees(tree).size(); }
4544982_5
public static int complexity(Tree tree) { return complexityTrees(tree).size(); }
4544982_6
public FileMeasures getFileMeasures( PhpFile file, CompilationUnitTree tree, SymbolTable symbolTable, FileLinesContext fileLinesContext ) { this.fileMeasures = new FileMeasures(); this.fileLinesContext = fileLinesContext; super.analyze(file, tree, symbolTable); setCounterMeasures(); setLineAndCommentM...
4544982_7
public static CognitiveComplexity complexity(FunctionTree functionTree) { CognitiveComplexityVisitor cognitiveComplexityVisitor = new CognitiveComplexityVisitor(); cognitiveComplexityVisitor.scan(functionTree); return cognitiveComplexityVisitor.complexity; }
4544982_8
public static CognitiveComplexity complexity(FunctionTree functionTree) { CognitiveComplexityVisitor cognitiveComplexityVisitor = new CognitiveComplexityVisitor(); cognitiveComplexityVisitor.scan(functionTree); return cognitiveComplexityVisitor.complexity; }
4544982_9
public static CognitiveComplexity complexity(FunctionTree functionTree) { CognitiveComplexityVisitor cognitiveComplexityVisitor = new CognitiveComplexityVisitor(); cognitiveComplexityVisitor.scan(functionTree); return cognitiveComplexityVisitor.complexity; }
4546290_0
public AuthorizationContext convert(AvroAuthzContext authzContext) { if (authzContext == null) return null; Set<String> roles = new HashSet<String>(); for (String role : authzContext.getRoles()) { roles.add(role); } return new AuthorizationContext(authzContext.getName(), authzContext...
4546290_1
public AuthorizationContext convert(AvroAuthzContext authzContext) { if (authzContext == null) return null; Set<String> roles = new HashSet<String>(); for (String role : authzContext.getRoles()) { roles.add(role); } return new AuthorizationContext(authzContext.getName(), authzContext...
4546290_2
public AuthorizationContext convert(AvroAuthzContext authzContext) { if (authzContext == null) return null; Set<String> roles = new HashSet<String>(); for (String role : authzContext.getRoles()) { roles.add(role); } return new AuthorizationContext(authzContext.getName(), authzContext...
4546290_3
public AuthorizationContext convert(AvroAuthzContext authzContext) { if (authzContext == null) return null; Set<String> roles = new HashSet<String>(); for (String role : authzContext.getRoles()) { roles.add(role); } return new AuthorizationContext(authzContext.getName(), authzContext...
4546290_4
public AuthorizationContext convert(AvroAuthzContext authzContext) { if (authzContext == null) return null; Set<String> roles = new HashSet<String>(); for (String role : authzContext.getRoles()) { roles.add(role); } return new AuthorizationContext(authzContext.getName(), authzContext...
4546290_5
public AuthorizationContext convert(AvroAuthzContext authzContext) { if (authzContext == null) return null; Set<String> roles = new HashSet<String>(); for (String role : authzContext.getRoles()) { roles.add(role); } return new AuthorizationContext(authzContext.getName(), authzContext...
4546290_6
public AuthorizationContext convert(AvroAuthzContext authzContext) { if (authzContext == null) return null; Set<String> roles = new HashSet<String>(); for (String role : authzContext.getRoles()) { roles.add(role); } return new AuthorizationContext(authzContext.getName(), authzContext...
4546290_7
public AuthorizationContext convert(AvroAuthzContext authzContext) { if (authzContext == null) return null; Set<String> roles = new HashSet<String>(); for (String role : authzContext.getRoles()) { roles.add(role); } return new AuthorizationContext(authzContext.getName(), authzContext...
4546290_8
public AuthorizationContext convert(AvroAuthzContext authzContext) { if (authzContext == null) return null; Set<String> roles = new HashSet<String>(); for (String role : authzContext.getRoles()) { roles.add(role); } return new AuthorizationContext(authzContext.getName(), authzContext...
4546290_9
@Override public ByteBuffer delete(AvroAuthzContext authzContext, ByteBuffer recordId, String repositoryName, String tableName, List<AvroMutationCondition> conditions, Map<String,String> attributes) throws AvroRepositoryException, AvroInterruptedException { try { AuthorizationContextHolder.s...
4546424_0
@POST @Consumes (MediaType.APPLICATION_JSON) @Path (REST_API_APPTYPES) public Response createAppTypes(List<ApplicationType> appTypes) throws PhrescoException { if (isDebugEnabled) { S_LOGGER.debug("Entered into ComponentService.createAppTypes(List<ApplicationType> appTypes)"); } try { Converter<...
4546424_1
@GET @Path (REST_API_APPTYPES) @Produces (MediaType.APPLICATION_JSON) public Response findAppTypes(@QueryParam(REST_QUERY_CUSTOMERID) String customerId) throws PhrescoException { if (isDebugEnabled) { S_LOGGER.debug("Entered into ComponentService.findAppTypes()"); } List<ApplicationType> applicationT...
4546424_2
@PUT @Consumes (MediaType.APPLICATION_JSON) @Produces (MediaType.APPLICATION_JSON) @Path (REST_API_APPTYPES) public Response updateAppTypes(List<ApplicationType> appTypes) { if (isDebugEnabled) { S_LOGGER.debug("Entered into ComponentService.updateAppTypes(List<ApplicationType> appTypes)"); } try ...
4546424_3
@GET @Produces (MediaType.APPLICATION_JSON) @Path (REST_API_APPTYPES + REST_API_PATH_ID) public Response getApptype(@PathParam(REST_API_PATH_PARAM_ID) String id) { if (isDebugEnabled) { S_LOGGER.debug("Entered into ComponentService.getApptype(String id)" + id); } try { ApplicationType appType = mon...
4546424_4
@PUT @Consumes (MediaType.APPLICATION_JSON) @Produces (MediaType.APPLICATION_JSON) @Path (REST_API_APPTYPES + REST_API_PATH_ID) public Response updateAppType(@PathParam(REST_API_PATH_PARAM_ID) String id , ApplicationType appType) throws PhrescoException { if (isDebugEnabled) { S_LOGGER.debug("Entered into C...
4546424_5
@DELETE @Path (REST_API_APPTYPES + REST_API_PATH_ID) public Response deleteAppType(@PathParam(REST_API_PATH_PARAM_ID) String id) { if (isDebugEnabled) { S_LOGGER.debug("Entered into ComponentService.deleteAppType(String id)" + id); } try { mongoOperation.remove(APPTYPESDAO_COLLECTION_NAME, ...
4546424_6
@POST @Consumes (MediaType.APPLICATION_JSON) @Path (REST_API_SETTINGS) public Response createSettings(List<SettingsTemplate> settings) { if (isDebugEnabled) { S_LOGGER.debug("Entered into ComponentService.createSettings(List<SettingsTemplate> settings)"); } try { mongoOperation.insertList(SETTINGS_COLLECTIO...
4546424_7
@GET @Path (REST_API_SETTINGS) @Produces (MediaType.APPLICATION_JSON) public Response findSettings() { if (isDebugEnabled) { S_LOGGER.debug("Entered into ComponentService.findSettings()"); } try { List<SettingsTemplate> settingsList = mongoOperation.getCollection(SETTINGS_COLLECTION_NAME , Settings...