id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
149,600
javagl/Common
src/main/java/de/javagl/common/beans/BeanUtils.java
BeanUtils.getMutablePropertyNamesOptional
public static List<String> getMutablePropertyNamesOptional( Class<?> beanClass) { List<PropertyDescriptor> propertyDescriptors = getPropertyDescriptorsOptional(beanClass); List<String> result = new ArrayList<String>(); for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { String propertyName = propertyDescriptor.getName(); Method readMethod = getReadMethodOptional(beanClass, propertyName); Method writeMethod = getWriteMethodOptional(beanClass, propertyName); if (readMethod != null && writeMethod != null) { result.add(propertyName); } } return Collections.unmodifiableList(result); }
java
public static List<String> getMutablePropertyNamesOptional( Class<?> beanClass) { List<PropertyDescriptor> propertyDescriptors = getPropertyDescriptorsOptional(beanClass); List<String> result = new ArrayList<String>(); for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { String propertyName = propertyDescriptor.getName(); Method readMethod = getReadMethodOptional(beanClass, propertyName); Method writeMethod = getWriteMethodOptional(beanClass, propertyName); if (readMethod != null && writeMethod != null) { result.add(propertyName); } } return Collections.unmodifiableList(result); }
[ "public", "static", "List", "<", "String", ">", "getMutablePropertyNamesOptional", "(", "Class", "<", "?", ">", "beanClass", ")", "{", "List", "<", "PropertyDescriptor", ">", "propertyDescriptors", "=", "getPropertyDescriptorsOptional", "(", "beanClass", ")", ";", "List", "<", "String", ">", "result", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "PropertyDescriptor", "propertyDescriptor", ":", "propertyDescriptors", ")", "{", "String", "propertyName", "=", "propertyDescriptor", ".", "getName", "(", ")", ";", "Method", "readMethod", "=", "getReadMethodOptional", "(", "beanClass", ",", "propertyName", ")", ";", "Method", "writeMethod", "=", "getWriteMethodOptional", "(", "beanClass", ",", "propertyName", ")", ";", "if", "(", "readMethod", "!=", "null", "&&", "writeMethod", "!=", "null", ")", "{", "result", ".", "add", "(", "propertyName", ")", ";", "}", "}", "return", "Collections", ".", "unmodifiableList", "(", "result", ")", ";", "}" ]
Returns an unmodifiable list of all property names of the given bean class for which a read method and a write method exists. If the bean class can not be introspected, an empty list will be returned. @param beanClass The bean class @return The property names
[ "Returns", "an", "unmodifiable", "list", "of", "all", "property", "names", "of", "the", "given", "bean", "class", "for", "which", "a", "read", "method", "and", "a", "write", "method", "exists", ".", "If", "the", "bean", "class", "can", "not", "be", "introspected", "an", "empty", "list", "will", "be", "returned", "." ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/beans/BeanUtils.java#L257-L276
149,601
javagl/Common
src/main/java/de/javagl/common/beans/BeanUtils.java
BeanUtils.getWriteMethodOptional
public static Method getWriteMethodOptional( Class<?> beanClass, String propertyName) { PropertyDescriptor propertyDescriptor = getPropertyDescriptorOptional(beanClass, propertyName); if (propertyDescriptor == null) { return null; } return propertyDescriptor.getWriteMethod(); }
java
public static Method getWriteMethodOptional( Class<?> beanClass, String propertyName) { PropertyDescriptor propertyDescriptor = getPropertyDescriptorOptional(beanClass, propertyName); if (propertyDescriptor == null) { return null; } return propertyDescriptor.getWriteMethod(); }
[ "public", "static", "Method", "getWriteMethodOptional", "(", "Class", "<", "?", ">", "beanClass", ",", "String", "propertyName", ")", "{", "PropertyDescriptor", "propertyDescriptor", "=", "getPropertyDescriptorOptional", "(", "beanClass", ",", "propertyName", ")", ";", "if", "(", "propertyDescriptor", "==", "null", ")", "{", "return", "null", ";", "}", "return", "propertyDescriptor", ".", "getWriteMethod", "(", ")", ";", "}" ]
Returns the write method for the property with the given name in the given bean class. @param beanClass The bean class @param propertyName The property name @return The write method, or <code>null</code> if no appropriate write method is found.
[ "Returns", "the", "write", "method", "for", "the", "property", "with", "the", "given", "name", "in", "the", "given", "bean", "class", "." ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/beans/BeanUtils.java#L314-L324
149,602
javagl/Common
src/main/java/de/javagl/common/beans/BeanUtils.java
BeanUtils.getReadMethodOptional
public static Method getReadMethodOptional( Class<?> beanClass, String propertyName) { PropertyDescriptor propertyDescriptor = getPropertyDescriptorOptional(beanClass, propertyName); if (propertyDescriptor == null) { return null; } return propertyDescriptor.getReadMethod(); }
java
public static Method getReadMethodOptional( Class<?> beanClass, String propertyName) { PropertyDescriptor propertyDescriptor = getPropertyDescriptorOptional(beanClass, propertyName); if (propertyDescriptor == null) { return null; } return propertyDescriptor.getReadMethod(); }
[ "public", "static", "Method", "getReadMethodOptional", "(", "Class", "<", "?", ">", "beanClass", ",", "String", "propertyName", ")", "{", "PropertyDescriptor", "propertyDescriptor", "=", "getPropertyDescriptorOptional", "(", "beanClass", ",", "propertyName", ")", ";", "if", "(", "propertyDescriptor", "==", "null", ")", "{", "return", "null", ";", "}", "return", "propertyDescriptor", ".", "getReadMethod", "(", ")", ";", "}" ]
Returns the read method for the property with the given name in the given bean class. @param beanClass The bean class @param propertyName The property name @return The read method for the property, or <code>null</code> if no appropriate read method is found.
[ "Returns", "the", "read", "method", "for", "the", "property", "with", "the", "given", "name", "in", "the", "given", "bean", "class", "." ]
5a4876b48c3a2dc61d21324733cf37512d721c33
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/beans/BeanUtils.java#L335-L345
149,603
Viascom/groundwork
foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/authorization/DefaultAuthorizationStrategy.java
DefaultAuthorizationStrategy.getAuthorization
@Override public List<FoxHttpAuthorization> getAuthorization(URLConnection connection, FoxHttpAuthorizationScope foxHttpAuthorizationScope, FoxHttpClient foxHttpClient) { ArrayList<FoxHttpAuthorization> foxHttpAuthorizationList = new ArrayList<>(); for (Map.Entry<String, ArrayList<FoxHttpAuthorization>> entry : foxHttpAuthorizations.entrySet()) { if (RegexUtil.doesURLMatch(foxHttpAuthorizationScope.toString(), foxHttpClient.getFoxHttpPlaceholderStrategy().processPlaceholders(entry.getKey(), foxHttpClient))) { foxHttpAuthorizationList.addAll(entry.getValue()); } } if (foxHttpAuthorizations.containsKey(FoxHttpAuthorizationScope.ANY.toString()) && (foxHttpAuthorizationList.isEmpty())) { foxHttpAuthorizationList.addAll(foxHttpAuthorizations.get(FoxHttpAuthorizationScope.ANY.toString())); } return foxHttpAuthorizationList; }
java
@Override public List<FoxHttpAuthorization> getAuthorization(URLConnection connection, FoxHttpAuthorizationScope foxHttpAuthorizationScope, FoxHttpClient foxHttpClient) { ArrayList<FoxHttpAuthorization> foxHttpAuthorizationList = new ArrayList<>(); for (Map.Entry<String, ArrayList<FoxHttpAuthorization>> entry : foxHttpAuthorizations.entrySet()) { if (RegexUtil.doesURLMatch(foxHttpAuthorizationScope.toString(), foxHttpClient.getFoxHttpPlaceholderStrategy().processPlaceholders(entry.getKey(), foxHttpClient))) { foxHttpAuthorizationList.addAll(entry.getValue()); } } if (foxHttpAuthorizations.containsKey(FoxHttpAuthorizationScope.ANY.toString()) && (foxHttpAuthorizationList.isEmpty())) { foxHttpAuthorizationList.addAll(foxHttpAuthorizations.get(FoxHttpAuthorizationScope.ANY.toString())); } return foxHttpAuthorizationList; }
[ "@", "Override", "public", "List", "<", "FoxHttpAuthorization", ">", "getAuthorization", "(", "URLConnection", "connection", ",", "FoxHttpAuthorizationScope", "foxHttpAuthorizationScope", ",", "FoxHttpClient", "foxHttpClient", ")", "{", "ArrayList", "<", "FoxHttpAuthorization", ">", "foxHttpAuthorizationList", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "ArrayList", "<", "FoxHttpAuthorization", ">", ">", "entry", ":", "foxHttpAuthorizations", ".", "entrySet", "(", ")", ")", "{", "if", "(", "RegexUtil", ".", "doesURLMatch", "(", "foxHttpAuthorizationScope", ".", "toString", "(", ")", ",", "foxHttpClient", ".", "getFoxHttpPlaceholderStrategy", "(", ")", ".", "processPlaceholders", "(", "entry", ".", "getKey", "(", ")", ",", "foxHttpClient", ")", ")", ")", "{", "foxHttpAuthorizationList", ".", "addAll", "(", "entry", ".", "getValue", "(", ")", ")", ";", "}", "}", "if", "(", "foxHttpAuthorizations", ".", "containsKey", "(", "FoxHttpAuthorizationScope", ".", "ANY", ".", "toString", "(", ")", ")", "&&", "(", "foxHttpAuthorizationList", ".", "isEmpty", "(", ")", ")", ")", "{", "foxHttpAuthorizationList", ".", "addAll", "(", "foxHttpAuthorizations", ".", "get", "(", "FoxHttpAuthorizationScope", ".", "ANY", ".", "toString", "(", ")", ")", ")", ";", "}", "return", "foxHttpAuthorizationList", ";", "}" ]
Returns a list of matching FoxHttpAuthorizations based on the given FoxHttpAuthorizationScope @param connection connection of the request @param foxHttpAuthorizationScope looking for scope @return
[ "Returns", "a", "list", "of", "matching", "FoxHttpAuthorizations", "based", "on", "the", "given", "FoxHttpAuthorizationScope" ]
d3f7d0df65e2e75861fc7db938090683f2cdf919
https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/authorization/DefaultAuthorizationStrategy.java#L36-L51
149,604
Viascom/groundwork
foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/authorization/DefaultAuthorizationStrategy.java
DefaultAuthorizationStrategy.addAuthorization
@Override public void addAuthorization(FoxHttpAuthorizationScope foxHttpAuthorizationScope, FoxHttpAuthorization foxHttpAuthorization) { if (foxHttpAuthorizations.containsKey(foxHttpAuthorizationScope.toString())) { foxHttpAuthorizations.get(foxHttpAuthorizationScope.toString()).add(foxHttpAuthorization); } else { foxHttpAuthorizations.put(foxHttpAuthorizationScope.toString(), new ArrayList<>(Collections.singletonList(foxHttpAuthorization))); } }
java
@Override public void addAuthorization(FoxHttpAuthorizationScope foxHttpAuthorizationScope, FoxHttpAuthorization foxHttpAuthorization) { if (foxHttpAuthorizations.containsKey(foxHttpAuthorizationScope.toString())) { foxHttpAuthorizations.get(foxHttpAuthorizationScope.toString()).add(foxHttpAuthorization); } else { foxHttpAuthorizations.put(foxHttpAuthorizationScope.toString(), new ArrayList<>(Collections.singletonList(foxHttpAuthorization))); } }
[ "@", "Override", "public", "void", "addAuthorization", "(", "FoxHttpAuthorizationScope", "foxHttpAuthorizationScope", ",", "FoxHttpAuthorization", "foxHttpAuthorization", ")", "{", "if", "(", "foxHttpAuthorizations", ".", "containsKey", "(", "foxHttpAuthorizationScope", ".", "toString", "(", ")", ")", ")", "{", "foxHttpAuthorizations", ".", "get", "(", "foxHttpAuthorizationScope", ".", "toString", "(", ")", ")", ".", "add", "(", "foxHttpAuthorization", ")", ";", "}", "else", "{", "foxHttpAuthorizations", ".", "put", "(", "foxHttpAuthorizationScope", ".", "toString", "(", ")", ",", "new", "ArrayList", "<>", "(", "Collections", ".", "singletonList", "(", "foxHttpAuthorization", ")", ")", ")", ";", "}", "}" ]
Add a new FoxHttpAuthorization to the AuthorizationStrategy @param foxHttpAuthorizationScope scope in which the authorization is used @param foxHttpAuthorization authorization itself
[ "Add", "a", "new", "FoxHttpAuthorization", "to", "the", "AuthorizationStrategy" ]
d3f7d0df65e2e75861fc7db938090683f2cdf919
https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/authorization/DefaultAuthorizationStrategy.java#L59-L67
149,605
Viascom/groundwork
foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/authorization/DefaultAuthorizationStrategy.java
DefaultAuthorizationStrategy.removeAuthorization
@Override public void removeAuthorization(FoxHttpAuthorizationScope foxHttpAuthorizationScope, FoxHttpAuthorization foxHttpAuthorization) { ArrayList<FoxHttpAuthorization> authorizations = foxHttpAuthorizations.get(foxHttpAuthorizationScope.toString()); ArrayList<FoxHttpAuthorization> cleandAuthorizations = new ArrayList<>(); for (FoxHttpAuthorization authorization : authorizations) { if (authorization.getClass() != foxHttpAuthorization.getClass()) { cleandAuthorizations.add(authorization); } } foxHttpAuthorizations.put(foxHttpAuthorizationScope.toString(), cleandAuthorizations); }
java
@Override public void removeAuthorization(FoxHttpAuthorizationScope foxHttpAuthorizationScope, FoxHttpAuthorization foxHttpAuthorization) { ArrayList<FoxHttpAuthorization> authorizations = foxHttpAuthorizations.get(foxHttpAuthorizationScope.toString()); ArrayList<FoxHttpAuthorization> cleandAuthorizations = new ArrayList<>(); for (FoxHttpAuthorization authorization : authorizations) { if (authorization.getClass() != foxHttpAuthorization.getClass()) { cleandAuthorizations.add(authorization); } } foxHttpAuthorizations.put(foxHttpAuthorizationScope.toString(), cleandAuthorizations); }
[ "@", "Override", "public", "void", "removeAuthorization", "(", "FoxHttpAuthorizationScope", "foxHttpAuthorizationScope", ",", "FoxHttpAuthorization", "foxHttpAuthorization", ")", "{", "ArrayList", "<", "FoxHttpAuthorization", ">", "authorizations", "=", "foxHttpAuthorizations", ".", "get", "(", "foxHttpAuthorizationScope", ".", "toString", "(", ")", ")", ";", "ArrayList", "<", "FoxHttpAuthorization", ">", "cleandAuthorizations", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "FoxHttpAuthorization", "authorization", ":", "authorizations", ")", "{", "if", "(", "authorization", ".", "getClass", "(", ")", "!=", "foxHttpAuthorization", ".", "getClass", "(", ")", ")", "{", "cleandAuthorizations", ".", "add", "(", "authorization", ")", ";", "}", "}", "foxHttpAuthorizations", ".", "put", "(", "foxHttpAuthorizationScope", ".", "toString", "(", ")", ",", "cleandAuthorizations", ")", ";", "}" ]
Remove a defined FoxHttpAuthorization from the AuthorizationStrategy @param foxHttpAuthorizationScope scope in which the authorization is used @param foxHttpAuthorization object of the same authorization
[ "Remove", "a", "defined", "FoxHttpAuthorization", "from", "the", "AuthorizationStrategy" ]
d3f7d0df65e2e75861fc7db938090683f2cdf919
https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/authorization/DefaultAuthorizationStrategy.java#L75-L85
149,606
Viascom/groundwork
service-result/src/main/java/ch/viascom/groundwork/serviceresult/ServiceResult.java
ServiceResult.setContent
public ServiceResult<T> setContent(T serviceResultContent) { content = serviceResultContent; setHash(ObjectHasher.hash(content)); return this; }
java
public ServiceResult<T> setContent(T serviceResultContent) { content = serviceResultContent; setHash(ObjectHasher.hash(content)); return this; }
[ "public", "ServiceResult", "<", "T", ">", "setContent", "(", "T", "serviceResultContent", ")", "{", "content", "=", "serviceResultContent", ";", "setHash", "(", "ObjectHasher", ".", "hash", "(", "content", ")", ")", ";", "return", "this", ";", "}" ]
Set the content of the ServiceResult @param serviceResultContent @return
[ "Set", "the", "content", "of", "the", "ServiceResult" ]
d3f7d0df65e2e75861fc7db938090683f2cdf919
https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/service-result/src/main/java/ch/viascom/groundwork/serviceresult/ServiceResult.java#L63-L67
149,607
Viascom/groundwork
service-result/src/main/java/ch/viascom/groundwork/serviceresult/ServiceResult.java
ServiceResult.addMetadata
public ServiceResult<T> addMetadata(String key, Metadata metadata) { this.getMetadata().put(key, metadata); return this; }
java
public ServiceResult<T> addMetadata(String key, Metadata metadata) { this.getMetadata().put(key, metadata); return this; }
[ "public", "ServiceResult", "<", "T", ">", "addMetadata", "(", "String", "key", ",", "Metadata", "metadata", ")", "{", "this", ".", "getMetadata", "(", ")", ".", "put", "(", "key", ",", "metadata", ")", ";", "return", "this", ";", "}" ]
Add a new set of Metadata @param key @param metadata @return
[ "Add", "a", "new", "set", "of", "Metadata" ]
d3f7d0df65e2e75861fc7db938090683f2cdf919
https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/service-result/src/main/java/ch/viascom/groundwork/serviceresult/ServiceResult.java#L76-L79
149,608
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/output/BeanOutputHandler.java
BeanOutputHandler.handle
public T handle(List<QueryParameters> outputList) throws MjdbcException { return (T) this.outputProcessor.toBean(outputList, this.type); }
java
public T handle(List<QueryParameters> outputList) throws MjdbcException { return (T) this.outputProcessor.toBean(outputList, this.type); }
[ "public", "T", "handle", "(", "List", "<", "QueryParameters", ">", "outputList", ")", "throws", "MjdbcException", "{", "return", "(", "T", ")", "this", ".", "outputProcessor", ".", "toBean", "(", "outputList", ",", "this", ".", "type", ")", ";", "}" ]
Converts first row of query output into Bean @param outputList Query output @return Bean converted from first row of query output @throws org.midao.jdbc.core.exception.MjdbcException
[ "Converts", "first", "row", "of", "query", "output", "into", "Bean" ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/output/BeanOutputHandler.java#L67-L69
149,609
cloudbees/bees-maven-components
src/main/java/com/cloudbees/sdk/maven/RepositoryService.java
RepositoryService.resolveArtifact
public ArtifactResult resolveArtifact( Artifact artifact ) throws ArtifactResolutionException { return resolveArtifact(new ArtifactRequest(artifact,remoteRepositories,null)); }
java
public ArtifactResult resolveArtifact( Artifact artifact ) throws ArtifactResolutionException { return resolveArtifact(new ArtifactRequest(artifact,remoteRepositories,null)); }
[ "public", "ArtifactResult", "resolveArtifact", "(", "Artifact", "artifact", ")", "throws", "ArtifactResolutionException", "{", "return", "resolveArtifact", "(", "new", "ArtifactRequest", "(", "artifact", ",", "remoteRepositories", ",", "null", ")", ")", ";", "}" ]
Resolves a single artifact and returns it.
[ "Resolves", "a", "single", "artifact", "and", "returns", "it", "." ]
b4410c4826c38a83c209286dad847f3bdfad682a
https://github.com/cloudbees/bees-maven-components/blob/b4410c4826c38a83c209286dad847f3bdfad682a/src/main/java/com/cloudbees/sdk/maven/RepositoryService.java#L217-L219
149,610
cloudbees/bees-maven-components
src/main/java/com/cloudbees/sdk/maven/RepositoryService.java
RepositoryService.resolveArtifacts
public List<ArtifactResult> resolveArtifacts( Collection<? extends ArtifactRequest> requests ) throws ArtifactResolutionException { return repository.resolveArtifacts(session, requests); }
java
public List<ArtifactResult> resolveArtifacts( Collection<? extends ArtifactRequest> requests ) throws ArtifactResolutionException { return repository.resolveArtifacts(session, requests); }
[ "public", "List", "<", "ArtifactResult", ">", "resolveArtifacts", "(", "Collection", "<", "?", "extends", "ArtifactRequest", ">", "requests", ")", "throws", "ArtifactResolutionException", "{", "return", "repository", ".", "resolveArtifacts", "(", "session", ",", "requests", ")", ";", "}" ]
Resolves the paths for a collection of artifacts. Artifacts will be downloaded if necessary. Artifacts that are already resolved will be skipped and are not re-resolved. Note that this method assumes that any relocations have already been processed. @param requests The resolution requests, must not be {@code null} @return The resolution results (in request order), never {@code null}. @throws ArtifactResolutionException If any artifact could not be resolved. @see org.sonatype.aether.artifact.Artifact#getFile()
[ "Resolves", "the", "paths", "for", "a", "collection", "of", "artifacts", ".", "Artifacts", "will", "be", "downloaded", "if", "necessary", ".", "Artifacts", "that", "are", "already", "resolved", "will", "be", "skipped", "and", "are", "not", "re", "-", "resolved", ".", "Note", "that", "this", "method", "assumes", "that", "any", "relocations", "have", "already", "been", "processed", "." ]
b4410c4826c38a83c209286dad847f3bdfad682a
https://github.com/cloudbees/bees-maven-components/blob/b4410c4826c38a83c209286dad847f3bdfad682a/src/main/java/com/cloudbees/sdk/maven/RepositoryService.java#L231-L233
149,611
cloudbees/bees-maven-components
src/main/java/com/cloudbees/sdk/maven/RepositoryService.java
RepositoryService.resolveMetadata
public List<MetadataResult> resolveMetadata( Collection<? extends MetadataRequest> requests ) { return repository.resolveMetadata(session, requests); }
java
public List<MetadataResult> resolveMetadata( Collection<? extends MetadataRequest> requests ) { return repository.resolveMetadata(session, requests); }
[ "public", "List", "<", "MetadataResult", ">", "resolveMetadata", "(", "Collection", "<", "?", "extends", "MetadataRequest", ">", "requests", ")", "{", "return", "repository", ".", "resolveMetadata", "(", "session", ",", "requests", ")", ";", "}" ]
Resolves the paths for a collection of metadata. Metadata will be downloaded if necessary. @param requests The resolution requests, must not be {@code null} @return The resolution results (in request order), never {@code null}. @see org.sonatype.aether.metadata.Metadata#getFile()
[ "Resolves", "the", "paths", "for", "a", "collection", "of", "metadata", ".", "Metadata", "will", "be", "downloaded", "if", "necessary", "." ]
b4410c4826c38a83c209286dad847f3bdfad682a
https://github.com/cloudbees/bees-maven-components/blob/b4410c4826c38a83c209286dad847f3bdfad682a/src/main/java/com/cloudbees/sdk/maven/RepositoryService.java#L242-L244
149,612
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/xml/XmlRepositoryFactory.java
XmlRepositoryFactory.addAll
public static void addAll(Document document) { List<Element> elementList = getElements(document); List<String> elementIds = getElementsId(elementList); addAll(elementList); }
java
public static void addAll(Document document) { List<Element> elementList = getElements(document); List<String> elementIds = getElementsId(elementList); addAll(elementList); }
[ "public", "static", "void", "addAll", "(", "Document", "document", ")", "{", "List", "<", "Element", ">", "elementList", "=", "getElements", "(", "document", ")", ";", "List", "<", "String", ">", "elementIds", "=", "getElementsId", "(", "elementList", ")", ";", "addAll", "(", "elementList", ")", ";", "}" ]
Adds all queries from XML file into Repository @param document document which would be read
[ "Adds", "all", "queries", "from", "XML", "file", "into", "Repository" ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/xml/XmlRepositoryFactory.java#L196-L202
149,613
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/xml/XmlRepositoryFactory.java
XmlRepositoryFactory.removeAll
public static void removeAll(Document document) { List<String> elementsId = null; elementsId = getElementsId(document); removeAll(elementsId); }
java
public static void removeAll(Document document) { List<String> elementsId = null; elementsId = getElementsId(document); removeAll(elementsId); }
[ "public", "static", "void", "removeAll", "(", "Document", "document", ")", "{", "List", "<", "String", ">", "elementsId", "=", "null", ";", "elementsId", "=", "getElementsId", "(", "document", ")", ";", "removeAll", "(", "elementsId", ")", ";", "}" ]
Removes all queries in the XML file from the Repository @param document document which would be used as source for query names to remove from repository
[ "Removes", "all", "queries", "in", "the", "XML", "file", "from", "the", "Repository" ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/xml/XmlRepositoryFactory.java#L230-L236
149,614
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/xml/XmlRepositoryFactory.java
XmlRepositoryFactory.getElementsId
private static List<String> getElementsId(Document document) { List<String> result = new ArrayList<String>(); List<Element> elementList = getElements(document); result = getElementsId(elementList); return result; }
java
private static List<String> getElementsId(Document document) { List<String> result = new ArrayList<String>(); List<Element> elementList = getElements(document); result = getElementsId(elementList); return result; }
[ "private", "static", "List", "<", "String", ">", "getElementsId", "(", "Document", "document", ")", "{", "List", "<", "String", ">", "result", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "List", "<", "Element", ">", "elementList", "=", "getElements", "(", "document", ")", ";", "result", "=", "getElementsId", "(", "elementList", ")", ";", "return", "result", ";", "}" ]
Reads XML document and returns it content as list of query names @param document document which would be read @return list of queries names
[ "Reads", "XML", "document", "and", "returns", "it", "content", "as", "list", "of", "query", "names" ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/xml/XmlRepositoryFactory.java#L362-L370
149,615
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/xml/XmlRepositoryFactory.java
XmlRepositoryFactory.createBeanOutputHandler
private static OutputHandler createBeanOutputHandler(AbstractXmlInputOutputHandler inputHandler, String className) { OutputHandler result = null; Constructor constructor = null; try { Class clazz = Class.forName(className); Class outputClass = inputHandler.getOutputType(); AssertUtils.assertNotNull(outputClass, "Since output handler was used which handles Beans - Bean.class should be set via constructor of XmlInputOutputHandler"); constructor = clazz.getConstructor(Class.class); result = (OutputHandler) constructor.newInstance(outputClass); } catch (Exception ex) { throw new MjdbcRuntimeException("Cannot initialize bean output handler: " + className + "\nIf you are trying to use non-standard output handler - please add it to allowed map " + "\nvia getDefaultOutputHandlers of MjdbcConfig class", ex); } return result; }
java
private static OutputHandler createBeanOutputHandler(AbstractXmlInputOutputHandler inputHandler, String className) { OutputHandler result = null; Constructor constructor = null; try { Class clazz = Class.forName(className); Class outputClass = inputHandler.getOutputType(); AssertUtils.assertNotNull(outputClass, "Since output handler was used which handles Beans - Bean.class should be set via constructor of XmlInputOutputHandler"); constructor = clazz.getConstructor(Class.class); result = (OutputHandler) constructor.newInstance(outputClass); } catch (Exception ex) { throw new MjdbcRuntimeException("Cannot initialize bean output handler: " + className + "\nIf you are trying to use non-standard output handler - please add it to allowed map " + "\nvia getDefaultOutputHandlers of MjdbcConfig class", ex); } return result; }
[ "private", "static", "OutputHandler", "createBeanOutputHandler", "(", "AbstractXmlInputOutputHandler", "inputHandler", ",", "String", "className", ")", "{", "OutputHandler", "result", "=", "null", ";", "Constructor", "constructor", "=", "null", ";", "try", "{", "Class", "clazz", "=", "Class", ".", "forName", "(", "className", ")", ";", "Class", "outputClass", "=", "inputHandler", ".", "getOutputType", "(", ")", ";", "AssertUtils", ".", "assertNotNull", "(", "outputClass", ",", "\"Since output handler was used which handles Beans - Bean.class should be set via constructor of XmlInputOutputHandler\"", ")", ";", "constructor", "=", "clazz", ".", "getConstructor", "(", "Class", ".", "class", ")", ";", "result", "=", "(", "OutputHandler", ")", "constructor", ".", "newInstance", "(", "outputClass", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "new", "MjdbcRuntimeException", "(", "\"Cannot initialize bean output handler: \"", "+", "className", "+", "\"\\nIf you are trying to use non-standard output handler - please add it to allowed map \"", "+", "\"\\nvia getDefaultOutputHandlers of MjdbcConfig class\"", ",", "ex", ")", ";", "}", "return", "result", ";", "}" ]
Unlike standard output handlers - beans output handlers require bean type via constructor, hence cannot be prototyped. This function is invoked to create new instance of Bean output handler @param inputHandler XML input/output handler for which {@link OutputHandler} is constructed @param className Bean output handler class name @return Bean output handler instance
[ "Unlike", "standard", "output", "handlers", "-", "beans", "output", "handlers", "require", "bean", "type", "via", "constructor", "hence", "cannot", "be", "prototyped", ".", "This", "function", "is", "invoked", "to", "create", "new", "instance", "of", "Bean", "output", "handler" ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/xml/XmlRepositoryFactory.java#L449-L469
149,616
Omertron/api-fanarttv
src/main/java/com/omertron/fanarttvapi/tools/ApiBuilder.java
ApiBuilder.getImageUrl
public URL getImageUrl(BaseType baseType, String id) throws FanartTvException { StringBuilder url = getBaseUrl(baseType); // Add the ID url.append(id); // Add the API Key url.append(DELIMITER_APIKEY).append(apiKey); // Add the client API Key if (StringUtils.isNotBlank(clientKey)) { url.append(DELIMITER_CLIENT_KEY).append(clientKey); } return convertUrl(url); }
java
public URL getImageUrl(BaseType baseType, String id) throws FanartTvException { StringBuilder url = getBaseUrl(baseType); // Add the ID url.append(id); // Add the API Key url.append(DELIMITER_APIKEY).append(apiKey); // Add the client API Key if (StringUtils.isNotBlank(clientKey)) { url.append(DELIMITER_CLIENT_KEY).append(clientKey); } return convertUrl(url); }
[ "public", "URL", "getImageUrl", "(", "BaseType", "baseType", ",", "String", "id", ")", "throws", "FanartTvException", "{", "StringBuilder", "url", "=", "getBaseUrl", "(", "baseType", ")", ";", "// Add the ID", "url", ".", "append", "(", "id", ")", ";", "// Add the API Key", "url", ".", "append", "(", "DELIMITER_APIKEY", ")", ".", "append", "(", "apiKey", ")", ";", "// Add the client API Key", "if", "(", "StringUtils", ".", "isNotBlank", "(", "clientKey", ")", ")", "{", "url", ".", "append", "(", "DELIMITER_CLIENT_KEY", ")", ".", "append", "(", "clientKey", ")", ";", "}", "return", "convertUrl", "(", "url", ")", ";", "}" ]
Generate the URL for the artwork requests @param baseType @param id @return @throws FanartTvException
[ "Generate", "the", "URL", "for", "the", "artwork", "requests" ]
2a1854c840d8111935d0f6abe5232e2c3c3f318b
https://github.com/Omertron/api-fanarttv/blob/2a1854c840d8111935d0f6abe5232e2c3c3f318b/src/main/java/com/omertron/fanarttvapi/tools/ApiBuilder.java#L103-L118
149,617
Omertron/api-fanarttv
src/main/java/com/omertron/fanarttvapi/tools/ApiBuilder.java
ApiBuilder.convertUrl
private URL convertUrl(StringBuilder searchUrl) throws FanartTvException { try { LOG.trace("URL: {}", searchUrl.toString()); return new URL(searchUrl.toString()); } catch (MalformedURLException ex) { LOG.warn(FAILED_TO_CREATE_URL, searchUrl.toString(), ex.toString()); throw new FanartTvException(ApiExceptionType.INVALID_URL, "Unable to conver String to URL", 0, searchUrl.toString(), ex); } }
java
private URL convertUrl(StringBuilder searchUrl) throws FanartTvException { try { LOG.trace("URL: {}", searchUrl.toString()); return new URL(searchUrl.toString()); } catch (MalformedURLException ex) { LOG.warn(FAILED_TO_CREATE_URL, searchUrl.toString(), ex.toString()); throw new FanartTvException(ApiExceptionType.INVALID_URL, "Unable to conver String to URL", 0, searchUrl.toString(), ex); } }
[ "private", "URL", "convertUrl", "(", "StringBuilder", "searchUrl", ")", "throws", "FanartTvException", "{", "try", "{", "LOG", ".", "trace", "(", "\"URL: {}\"", ",", "searchUrl", ".", "toString", "(", ")", ")", ";", "return", "new", "URL", "(", "searchUrl", ".", "toString", "(", ")", ")", ";", "}", "catch", "(", "MalformedURLException", "ex", ")", "{", "LOG", ".", "warn", "(", "FAILED_TO_CREATE_URL", ",", "searchUrl", ".", "toString", "(", ")", ",", "ex", ".", "toString", "(", ")", ")", ";", "throw", "new", "FanartTvException", "(", "ApiExceptionType", ".", "INVALID_URL", ",", "\"Unable to conver String to URL\"", ",", "0", ",", "searchUrl", ".", "toString", "(", ")", ",", "ex", ")", ";", "}", "}" ]
Convert the string into a URL @param searchUrl @return @throws FanartTvException
[ "Convert", "the", "string", "into", "a", "URL" ]
2a1854c840d8111935d0f6abe5232e2c3c3f318b
https://github.com/Omertron/api-fanarttv/blob/2a1854c840d8111935d0f6abe5232e2c3c3f318b/src/main/java/com/omertron/fanarttvapi/tools/ApiBuilder.java#L154-L162
149,618
greese/dasein-util
src/main/java/org/dasein/attributes/DataType.java
DataType.getParameters
public final Collection<String> getParameters() { ArrayList<String> params = new ArrayList<String>(); if( parameters == null ) { return params; } // we copy to guarantee that the caller does not screw up our internal storage params.addAll(Arrays.asList(parameters)); return params; }
java
public final Collection<String> getParameters() { ArrayList<String> params = new ArrayList<String>(); if( parameters == null ) { return params; } // we copy to guarantee that the caller does not screw up our internal storage params.addAll(Arrays.asList(parameters)); return params; }
[ "public", "final", "Collection", "<", "String", ">", "getParameters", "(", ")", "{", "ArrayList", "<", "String", ">", "params", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "if", "(", "parameters", "==", "null", ")", "{", "return", "params", ";", "}", "// we copy to guarantee that the caller does not screw up our internal storage", "params", ".", "addAll", "(", "Arrays", ".", "asList", "(", "parameters", ")", ")", ";", "return", "params", ";", "}" ]
Type parameters tell a data type how to constrain values. What these parameters are and how they are interpreted are left entirely up to the implementing classes. @return the constraining parameters for this data type
[ "Type", "parameters", "tell", "a", "data", "type", "how", "to", "constrain", "values", ".", "What", "these", "parameters", "are", "and", "how", "they", "are", "interpreted", "are", "left", "entirely", "up", "to", "the", "implementing", "classes", "." ]
648606dcb4bd382e3287a6c897a32e65d553dc47
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/attributes/DataType.java#L230-L239
149,619
greese/dasein-util
src/main/java/org/dasein/attributes/DataType.java
DataType.getValues
@SuppressWarnings("unchecked") public Collection<V> getValues(Object src) { ArrayList<V> values = new ArrayList<V>(); if( src instanceof String ) { String[] words = ((String)src).split(","); if( words.length < 1 ) { values.add(getValue(src)); } else { for( String word : words ) { values.add(getValue(word)); } } return values; } else if( src instanceof Collection ) { for( Object ob : (Collection<Object>)src ) { values.add(getValue(ob)); } return values; } throw new InvalidAttributeException("Invalid attribute: " + src); }
java
@SuppressWarnings("unchecked") public Collection<V> getValues(Object src) { ArrayList<V> values = new ArrayList<V>(); if( src instanceof String ) { String[] words = ((String)src).split(","); if( words.length < 1 ) { values.add(getValue(src)); } else { for( String word : words ) { values.add(getValue(word)); } } return values; } else if( src instanceof Collection ) { for( Object ob : (Collection<Object>)src ) { values.add(getValue(ob)); } return values; } throw new InvalidAttributeException("Invalid attribute: " + src); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "Collection", "<", "V", ">", "getValues", "(", "Object", "src", ")", "{", "ArrayList", "<", "V", ">", "values", "=", "new", "ArrayList", "<", "V", ">", "(", ")", ";", "if", "(", "src", "instanceof", "String", ")", "{", "String", "[", "]", "words", "=", "(", "(", "String", ")", "src", ")", ".", "split", "(", "\",\"", ")", ";", "if", "(", "words", ".", "length", "<", "1", ")", "{", "values", ".", "add", "(", "getValue", "(", "src", ")", ")", ";", "}", "else", "{", "for", "(", "String", "word", ":", "words", ")", "{", "values", ".", "add", "(", "getValue", "(", "word", ")", ")", ";", "}", "}", "return", "values", ";", "}", "else", "if", "(", "src", "instanceof", "Collection", ")", "{", "for", "(", "Object", "ob", ":", "(", "Collection", "<", "Object", ">", ")", "src", ")", "{", "values", ".", "add", "(", "getValue", "(", "ob", ")", ")", ";", "}", "return", "values", ";", "}", "throw", "new", "InvalidAttributeException", "(", "\"Invalid attribute: \"", "+", "src", ")", ";", "}" ]
When a data type is multi-valued, this method is called to convert raw data into a collection of values matching this data type. If the raw value is a string, this method assumes that the string represents a comma-delimited, multi-value attribute. @param src the raw source value @return the converted value
[ "When", "a", "data", "type", "is", "multi", "-", "valued", "this", "method", "is", "called", "to", "convert", "raw", "data", "into", "a", "collection", "of", "values", "matching", "this", "data", "type", ".", "If", "the", "raw", "value", "is", "a", "string", "this", "method", "assumes", "that", "the", "string", "represents", "a", "comma", "-", "delimited", "multi", "-", "value", "attribute", "." ]
648606dcb4bd382e3287a6c897a32e65d553dc47
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/attributes/DataType.java#L293-L317
149,620
jboss/jboss-jad-api_spec
src/main/java/javax/enterprise/deploy/shared/ModuleType.java
ModuleType.getModuleExtension
public String getModuleExtension() { if (value >= moduleExtensions.length) return Integer.toString(value); return moduleExtensions[value]; }
java
public String getModuleExtension() { if (value >= moduleExtensions.length) return Integer.toString(value); return moduleExtensions[value]; }
[ "public", "String", "getModuleExtension", "(", ")", "{", "if", "(", "value", ">=", "moduleExtensions", ".", "length", ")", "return", "Integer", ".", "toString", "(", "value", ")", ";", "return", "moduleExtensions", "[", "value", "]", ";", "}" ]
Get the file extension for this module @return the file extension
[ "Get", "the", "file", "extension", "for", "this", "module" ]
b5ebffc7082aadf327023d81a799ae6567d20cef
https://github.com/jboss/jboss-jad-api_spec/blob/b5ebffc7082aadf327023d81a799ae6567d20cef/src/main/java/javax/enterprise/deploy/shared/ModuleType.java#L106-L111
149,621
workplacesystems/queuj
src/main/java/com/workplacesystems/queuj/Resilience.java
Resilience.createRunOnceResilience
public static Resilience createRunOnceResilience(int retry_count, int retry_interval) { Resilience resilience = new RunOnlyOnce(); RunFiniteTimes failure_occurrence = new RunFiniteTimes(retry_count); resilience.setFailureSchedule(failure_occurrence); for (int i=0 ; i < retry_count ; i++) { RelativeScheduleBuilder rsb = failure_occurrence.newRelativeScheduleBuilder(); rsb.setRunDelayMinutes(retry_interval * (i+1)); rsb.createSchedule(); } return resilience; }
java
public static Resilience createRunOnceResilience(int retry_count, int retry_interval) { Resilience resilience = new RunOnlyOnce(); RunFiniteTimes failure_occurrence = new RunFiniteTimes(retry_count); resilience.setFailureSchedule(failure_occurrence); for (int i=0 ; i < retry_count ; i++) { RelativeScheduleBuilder rsb = failure_occurrence.newRelativeScheduleBuilder(); rsb.setRunDelayMinutes(retry_interval * (i+1)); rsb.createSchedule(); } return resilience; }
[ "public", "static", "Resilience", "createRunOnceResilience", "(", "int", "retry_count", ",", "int", "retry_interval", ")", "{", "Resilience", "resilience", "=", "new", "RunOnlyOnce", "(", ")", ";", "RunFiniteTimes", "failure_occurrence", "=", "new", "RunFiniteTimes", "(", "retry_count", ")", ";", "resilience", ".", "setFailureSchedule", "(", "failure_occurrence", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "retry_count", ";", "i", "++", ")", "{", "RelativeScheduleBuilder", "rsb", "=", "failure_occurrence", ".", "newRelativeScheduleBuilder", "(", ")", ";", "rsb", ".", "setRunDelayMinutes", "(", "retry_interval", "*", "(", "i", "+", "1", ")", ")", ";", "rsb", ".", "createSchedule", "(", ")", ";", "}", "return", "resilience", ";", "}" ]
create a simple Resilience object so process can restart - runs once, with retries as parameters
[ "create", "a", "simple", "Resilience", "object", "so", "process", "can", "restart", "-", "runs", "once", "with", "retries", "as", "parameters" ]
4293116b412b4a20ead99963b9b05a135812c501
https://github.com/workplacesystems/queuj/blob/4293116b412b4a20ead99963b9b05a135812c501/src/main/java/com/workplacesystems/queuj/Resilience.java#L57-L71
149,622
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/output/ScalarOutputHandler.java
ScalarOutputHandler.handle
public T handle(List<QueryParameters> output) { T result = null; String parameterName = null; Object parameterValue = null; if (output.size() > 1) { if (this.columnName == null) { parameterName = output.get(1).getNameByPosition(columnIndex); parameterValue = output.get(1).getValue(parameterName); result = (T) parameterValue; } else { parameterValue = output.get(1).getValue(this.columnName); result = (T) parameterValue; } } return result; }
java
public T handle(List<QueryParameters> output) { T result = null; String parameterName = null; Object parameterValue = null; if (output.size() > 1) { if (this.columnName == null) { parameterName = output.get(1).getNameByPosition(columnIndex); parameterValue = output.get(1).getValue(parameterName); result = (T) parameterValue; } else { parameterValue = output.get(1).getValue(this.columnName); result = (T) parameterValue; } } return result; }
[ "public", "T", "handle", "(", "List", "<", "QueryParameters", ">", "output", ")", "{", "T", "result", "=", "null", ";", "String", "parameterName", "=", "null", ";", "Object", "parameterValue", "=", "null", ";", "if", "(", "output", ".", "size", "(", ")", ">", "1", ")", "{", "if", "(", "this", ".", "columnName", "==", "null", ")", "{", "parameterName", "=", "output", ".", "get", "(", "1", ")", ".", "getNameByPosition", "(", "columnIndex", ")", ";", "parameterValue", "=", "output", ".", "get", "(", "1", ")", ".", "getValue", "(", "parameterName", ")", ";", "result", "=", "(", "T", ")", "parameterValue", ";", "}", "else", "{", "parameterValue", "=", "output", ".", "get", "(", "1", ")", ".", "getValue", "(", "this", ".", "columnName", ")", ";", "result", "=", "(", "T", ")", "parameterValue", ";", "}", "}", "return", "result", ";", "}" ]
Reads specified column of first row of Query output @param output Query output @return Value returned from specified (via constructor) column of first row of query output
[ "Reads", "specified", "column", "of", "first", "row", "of", "Query", "output" ]
ed9048ed2c792a4794a2116a25779dfb84cd9447
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/output/ScalarOutputHandler.java#L82-L101
149,623
matthewhorridge/binaryowl
src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java
BinaryOWLMetadata.setValue
private <O> void setValue(Map<String, O> nameValueMap, String name, O value) { checkForNull(name, value); nameValueMap.put(name, value); }
java
private <O> void setValue(Map<String, O> nameValueMap, String name, O value) { checkForNull(name, value); nameValueMap.put(name, value); }
[ "private", "<", "O", ">", "void", "setValue", "(", "Map", "<", "String", ",", "O", ">", "nameValueMap", ",", "String", "name", ",", "O", "value", ")", "{", "checkForNull", "(", "name", ",", "value", ")", ";", "nameValueMap", ".", "put", "(", "name", ",", "value", ")", ";", "}" ]
Sets the value of an attribute. @param nameValueMap A map which maps attribute names to attribute values. @param name The name of the attribute. Not null. @param value The value of the attribute. Not null. @throws NullPointerException if name is null, or value is null.
[ "Sets", "the", "value", "of", "an", "attribute", "." ]
7fccfe804120f86b38ca855ddbb569a81a042257
https://github.com/matthewhorridge/binaryowl/blob/7fccfe804120f86b38ca855ddbb569a81a042257/src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java#L148-L151
149,624
matthewhorridge/binaryowl
src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java
BinaryOWLMetadata.getValue
private <O> O getValue(Map<String, O> nameValueMap, String attributeName, O defaultValue) { if(attributeName == null) { throw new NullPointerException("name must not be null"); } if(nameValueMap == null) { return defaultValue; } O value = nameValueMap.get(attributeName); if(value == null) { return defaultValue; } return value; }
java
private <O> O getValue(Map<String, O> nameValueMap, String attributeName, O defaultValue) { if(attributeName == null) { throw new NullPointerException("name must not be null"); } if(nameValueMap == null) { return defaultValue; } O value = nameValueMap.get(attributeName); if(value == null) { return defaultValue; } return value; }
[ "private", "<", "O", ">", "O", "getValue", "(", "Map", "<", "String", ",", "O", ">", "nameValueMap", ",", "String", "attributeName", ",", "O", "defaultValue", ")", "{", "if", "(", "attributeName", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"name must not be null\"", ")", ";", "}", "if", "(", "nameValueMap", "==", "null", ")", "{", "return", "defaultValue", ";", "}", "O", "value", "=", "nameValueMap", ".", "get", "(", "attributeName", ")", ";", "if", "(", "value", "==", "null", ")", "{", "return", "defaultValue", ";", "}", "return", "value", ";", "}" ]
Gets the value, or default value, of an attribute. @param nameValueMap The name attribute value map which maps attribute names to attribute values. @param attributeName The name of the attribute to retrieve. @param defaultValue A default value, which will be returned if there is no set value for the specified attribute name in the specified attribute name value map. @param <O> The type of attribute value @return The attribute value that is set for the specified name in the specified map, or the value specified by the defaultValue parameter if no attribute with the specified name is set in the specified map.
[ "Gets", "the", "value", "or", "default", "value", "of", "an", "attribute", "." ]
7fccfe804120f86b38ca855ddbb569a81a042257
https://github.com/matthewhorridge/binaryowl/blob/7fccfe804120f86b38ca855ddbb569a81a042257/src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java#L178-L190
149,625
matthewhorridge/binaryowl
src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java
BinaryOWLMetadata.createCopy
public BinaryOWLMetadata createCopy() { BinaryOWLMetadata copy = new BinaryOWLMetadata(); copy.stringAttributes.putAll(stringAttributes); copy.intAttributes.putAll(intAttributes); copy.longAttributes.putAll(longAttributes); copy.doubleAttributes.putAll(doubleAttributes); copy.booleanAttributes.putAll(booleanAttributes); copy.byteArrayAttributes.putAll(byteArrayAttributes); for(String key : owlObjectAttributes.keySet()) { List<OWLObject> objectList = new ArrayList<OWLObject>(owlObjectAttributes.get(key)); copy.owlObjectAttributes.put(key, objectList); } return copy; }
java
public BinaryOWLMetadata createCopy() { BinaryOWLMetadata copy = new BinaryOWLMetadata(); copy.stringAttributes.putAll(stringAttributes); copy.intAttributes.putAll(intAttributes); copy.longAttributes.putAll(longAttributes); copy.doubleAttributes.putAll(doubleAttributes); copy.booleanAttributes.putAll(booleanAttributes); copy.byteArrayAttributes.putAll(byteArrayAttributes); for(String key : owlObjectAttributes.keySet()) { List<OWLObject> objectList = new ArrayList<OWLObject>(owlObjectAttributes.get(key)); copy.owlObjectAttributes.put(key, objectList); } return copy; }
[ "public", "BinaryOWLMetadata", "createCopy", "(", ")", "{", "BinaryOWLMetadata", "copy", "=", "new", "BinaryOWLMetadata", "(", ")", ";", "copy", ".", "stringAttributes", ".", "putAll", "(", "stringAttributes", ")", ";", "copy", ".", "intAttributes", ".", "putAll", "(", "intAttributes", ")", ";", "copy", ".", "longAttributes", ".", "putAll", "(", "longAttributes", ")", ";", "copy", ".", "doubleAttributes", ".", "putAll", "(", "doubleAttributes", ")", ";", "copy", ".", "booleanAttributes", ".", "putAll", "(", "booleanAttributes", ")", ";", "copy", ".", "byteArrayAttributes", ".", "putAll", "(", "byteArrayAttributes", ")", ";", "for", "(", "String", "key", ":", "owlObjectAttributes", ".", "keySet", "(", ")", ")", "{", "List", "<", "OWLObject", ">", "objectList", "=", "new", "ArrayList", "<", "OWLObject", ">", "(", "owlObjectAttributes", ".", "get", "(", "key", ")", ")", ";", "copy", ".", "owlObjectAttributes", ".", "put", "(", "key", ",", "objectList", ")", ";", "}", "return", "copy", ";", "}" ]
Creates a copy of this metadata object. Modifications to this object don't affect the copy, and vice versa. @return A copy of this metadata object.
[ "Creates", "a", "copy", "of", "this", "metadata", "object", ".", "Modifications", "to", "this", "object", "don", "t", "affect", "the", "copy", "and", "vice", "versa", "." ]
7fccfe804120f86b38ca855ddbb569a81a042257
https://github.com/matthewhorridge/binaryowl/blob/7fccfe804120f86b38ca855ddbb569a81a042257/src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java#L204-L217
149,626
matthewhorridge/binaryowl
src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java
BinaryOWLMetadata.getStringAttribute
public String getStringAttribute(String name, String defaultValue) { return getValue(stringAttributes, name, defaultValue); }
java
public String getStringAttribute(String name, String defaultValue) { return getValue(stringAttributes, name, defaultValue); }
[ "public", "String", "getStringAttribute", "(", "String", "name", ",", "String", "defaultValue", ")", "{", "return", "getValue", "(", "stringAttributes", ",", "name", ",", "defaultValue", ")", ";", "}" ]
Gets the string value of an attribute. @param name The name of the attribute. Not null. @param defaultValue The default value for the attribute. May be null. This value will be returned if this metadata object does not contain a string value for the specified attribute name. @return Either the string value of the attribute with the specified name, or the value specified by the defaultValue object if this metadata object does not contain a string value for the specified attribute name. @throws NullPointerException if name is null.
[ "Gets", "the", "string", "value", "of", "an", "attribute", "." ]
7fccfe804120f86b38ca855ddbb569a81a042257
https://github.com/matthewhorridge/binaryowl/blob/7fccfe804120f86b38ca855ddbb569a81a042257/src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java#L247-L249
149,627
matthewhorridge/binaryowl
src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java
BinaryOWLMetadata.getIntAttribute
public Integer getIntAttribute(String name, Integer defaultValue) { return getValue(intAttributes, name, defaultValue); }
java
public Integer getIntAttribute(String name, Integer defaultValue) { return getValue(intAttributes, name, defaultValue); }
[ "public", "Integer", "getIntAttribute", "(", "String", "name", ",", "Integer", "defaultValue", ")", "{", "return", "getValue", "(", "intAttributes", ",", "name", ",", "defaultValue", ")", ";", "}" ]
Gets the int value of an attribute. @param name The name of the attribute. Not null. @param defaultValue The default value for the attribute. May be null. This value will be returned if this metadata object does not contain an int value for the specified attribute name. @return Either the int value of the attribute with the specified name, or the value specified by the defaultValue object if this metadata object does not contain an int value for the specified attribute name. @throws NullPointerException if name is null.
[ "Gets", "the", "int", "value", "of", "an", "attribute", "." ]
7fccfe804120f86b38ca855ddbb569a81a042257
https://github.com/matthewhorridge/binaryowl/blob/7fccfe804120f86b38ca855ddbb569a81a042257/src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java#L289-L291
149,628
matthewhorridge/binaryowl
src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java
BinaryOWLMetadata.getLongAttribute
public Long getLongAttribute(String name, Long defaultValue) { return getValue(longAttributes, name, defaultValue); }
java
public Long getLongAttribute(String name, Long defaultValue) { return getValue(longAttributes, name, defaultValue); }
[ "public", "Long", "getLongAttribute", "(", "String", "name", ",", "Long", "defaultValue", ")", "{", "return", "getValue", "(", "longAttributes", ",", "name", ",", "defaultValue", ")", ";", "}" ]
Gets the long value of an attribute. @param name The name of the attribute. Not null. @param defaultValue The default value for the attribute. May be null. This value will be returned if this metadata object does not contain a long value for the specified attribute name. @return Either the long value of the attribute with the specified name, or the value specified by the defaultValue object if this metadata object does not contain a long value for the specified attribute name. @throws NullPointerException if name is null.
[ "Gets", "the", "long", "value", "of", "an", "attribute", "." ]
7fccfe804120f86b38ca855ddbb569a81a042257
https://github.com/matthewhorridge/binaryowl/blob/7fccfe804120f86b38ca855ddbb569a81a042257/src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java#L323-L325
149,629
matthewhorridge/binaryowl
src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java
BinaryOWLMetadata.getBooleanAttribute
public Boolean getBooleanAttribute(String name, Boolean defaultValue) { return getValue(booleanAttributes, name, defaultValue); }
java
public Boolean getBooleanAttribute(String name, Boolean defaultValue) { return getValue(booleanAttributes, name, defaultValue); }
[ "public", "Boolean", "getBooleanAttribute", "(", "String", "name", ",", "Boolean", "defaultValue", ")", "{", "return", "getValue", "(", "booleanAttributes", ",", "name", ",", "defaultValue", ")", ";", "}" ]
Gets the boolean value of an attribute. @param name The name of the attribute. Not null. @param defaultValue The default value for the attribute. May be null. This value will be returned if this metadata object does not contain a boolean value for the specified attribute name. @return Either the boolean value of the attribute with the specified name, or the value specified by the defaultValue object if this metadata object does not contain a boolean value for the specified attribute name. @throws NullPointerException if name is null.
[ "Gets", "the", "boolean", "value", "of", "an", "attribute", "." ]
7fccfe804120f86b38ca855ddbb569a81a042257
https://github.com/matthewhorridge/binaryowl/blob/7fccfe804120f86b38ca855ddbb569a81a042257/src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java#L356-L358
149,630
matthewhorridge/binaryowl
src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java
BinaryOWLMetadata.getDoubleAttribute
public Double getDoubleAttribute(String name, Double defaultValue) { return getValue(doubleAttributes, name, defaultValue); }
java
public Double getDoubleAttribute(String name, Double defaultValue) { return getValue(doubleAttributes, name, defaultValue); }
[ "public", "Double", "getDoubleAttribute", "(", "String", "name", ",", "Double", "defaultValue", ")", "{", "return", "getValue", "(", "doubleAttributes", ",", "name", ",", "defaultValue", ")", ";", "}" ]
Gets the double value of an attribute. @param name The name of the attribute. Not null. @param defaultValue The default value for the attribute. May be null. This value will be returned if this metadata object does not contain a double value for the specified attribute name. @return Either the double value of the attribute with the specified name, or the value specified by the defaultValue object if this metadata object does not contain a double value for the specified attribute name. @throws NullPointerException if name is null.
[ "Gets", "the", "double", "value", "of", "an", "attribute", "." ]
7fccfe804120f86b38ca855ddbb569a81a042257
https://github.com/matthewhorridge/binaryowl/blob/7fccfe804120f86b38ca855ddbb569a81a042257/src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java#L390-L392
149,631
mike10004/common-helper
native-helper/src/main/java/com/github/mike10004/nativehelper/subprocess/ProcessMissionControl.java
ProcessMissionControl.waitFor
@Nullable private Integer waitFor(Process process) { try { return process.waitFor(); } catch (InterruptedException e) { log.info("interrupted in Process.waitFor"); return null; } }
java
@Nullable private Integer waitFor(Process process) { try { return process.waitFor(); } catch (InterruptedException e) { log.info("interrupted in Process.waitFor"); return null; } }
[ "@", "Nullable", "private", "Integer", "waitFor", "(", "Process", "process", ")", "{", "try", "{", "return", "process", ".", "waitFor", "(", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "log", ".", "info", "(", "\"interrupted in Process.waitFor\"", ")", ";", "return", "null", ";", "}", "}" ]
Wait for a given process. @param process the process one wants to wait for.
[ "Wait", "for", "a", "given", "process", "." ]
744f82d9b0768a9ad9c63a57a37ab2c93bf408f4
https://github.com/mike10004/common-helper/blob/744f82d9b0768a9ad9c63a57a37ab2c93bf408f4/native-helper/src/main/java/com/github/mike10004/nativehelper/subprocess/ProcessMissionControl.java#L201-L209
149,632
cloudbees/bees-maven-components
src/main/java/com/cloudbees/sdk/maven/ResolvedDependenciesCache.java
ResolvedDependenciesCache.loadFromCache
private List<File> loadFromCache(Properties props) { String ts = props.getProperty("timestamp"); if (ts==null) return null; long timestamp = Long.valueOf(ts); if (isStale(timestamp)) return null; List<File> files = new ArrayList<File>(); for (Object k : props.keySet()) { String key = k.toString(); if (key.startsWith("pom.")) { File f = new File(props.getProperty(key)); if (!isUpToDate(f,timestamp)) return null; } if (key.startsWith("jar.")) { File f = new File(props.getProperty(key)); if (!isUpToDate(f, timestamp)) return null; files.add(f); } } return files; }
java
private List<File> loadFromCache(Properties props) { String ts = props.getProperty("timestamp"); if (ts==null) return null; long timestamp = Long.valueOf(ts); if (isStale(timestamp)) return null; List<File> files = new ArrayList<File>(); for (Object k : props.keySet()) { String key = k.toString(); if (key.startsWith("pom.")) { File f = new File(props.getProperty(key)); if (!isUpToDate(f,timestamp)) return null; } if (key.startsWith("jar.")) { File f = new File(props.getProperty(key)); if (!isUpToDate(f, timestamp)) return null; files.add(f); } } return files; }
[ "private", "List", "<", "File", ">", "loadFromCache", "(", "Properties", "props", ")", "{", "String", "ts", "=", "props", ".", "getProperty", "(", "\"timestamp\"", ")", ";", "if", "(", "ts", "==", "null", ")", "return", "null", ";", "long", "timestamp", "=", "Long", ".", "valueOf", "(", "ts", ")", ";", "if", "(", "isStale", "(", "timestamp", ")", ")", "return", "null", ";", "List", "<", "File", ">", "files", "=", "new", "ArrayList", "<", "File", ">", "(", ")", ";", "for", "(", "Object", "k", ":", "props", ".", "keySet", "(", ")", ")", "{", "String", "key", "=", "k", ".", "toString", "(", ")", ";", "if", "(", "key", ".", "startsWith", "(", "\"pom.\"", ")", ")", "{", "File", "f", "=", "new", "File", "(", "props", ".", "getProperty", "(", "key", ")", ")", ";", "if", "(", "!", "isUpToDate", "(", "f", ",", "timestamp", ")", ")", "return", "null", ";", "}", "if", "(", "key", ".", "startsWith", "(", "\"jar.\"", ")", ")", "{", "File", "f", "=", "new", "File", "(", "props", ".", "getProperty", "(", "key", ")", ")", ";", "if", "(", "!", "isUpToDate", "(", "f", ",", "timestamp", ")", ")", "return", "null", ";", "files", ".", "add", "(", "f", ")", ";", "}", "}", "return", "files", ";", "}" ]
Loads a list of jars from the cache, with up-to-date check. @return null if the data is stale
[ "Loads", "a", "list", "of", "jars", "from", "the", "cache", "with", "up", "-", "to", "-", "date", "check", "." ]
b4410c4826c38a83c209286dad847f3bdfad682a
https://github.com/cloudbees/bees-maven-components/blob/b4410c4826c38a83c209286dad847f3bdfad682a/src/main/java/com/cloudbees/sdk/maven/ResolvedDependenciesCache.java#L138-L164
149,633
io7m/jcanephora
com.io7m.jcanephora.core/src/main/java/com/io7m/jcanephora/core/JCGLResources.java
JCGLResources.checkNotDeleted
public static <R extends JCGLResourceUsableType> R checkNotDeleted( final R r) throws JCGLExceptionDeleted { NullCheck.notNull(r, "Resource"); if (r.isDeleted()) { throw new JCGLExceptionDeleted( String.format( "Cannot perform operation: OpenGL object %s has been deleted.", r)); } return r; }
java
public static <R extends JCGLResourceUsableType> R checkNotDeleted( final R r) throws JCGLExceptionDeleted { NullCheck.notNull(r, "Resource"); if (r.isDeleted()) { throw new JCGLExceptionDeleted( String.format( "Cannot perform operation: OpenGL object %s has been deleted.", r)); } return r; }
[ "public", "static", "<", "R", "extends", "JCGLResourceUsableType", ">", "R", "checkNotDeleted", "(", "final", "R", "r", ")", "throws", "JCGLExceptionDeleted", "{", "NullCheck", ".", "notNull", "(", "r", ",", "\"Resource\"", ")", ";", "if", "(", "r", ".", "isDeleted", "(", ")", ")", "{", "throw", "new", "JCGLExceptionDeleted", "(", "String", ".", "format", "(", "\"Cannot perform operation: OpenGL object %s has been deleted.\"", ",", "r", ")", ")", ";", "}", "return", "r", ";", "}" ]
Check that the current object has not been deleted. @param r The object. @param <R> A deletable object. @return The object. @throws JCGLExceptionDeleted If the object has been deleted. @see JCGLResourceUsableType#isDeleted()
[ "Check", "that", "the", "current", "object", "has", "not", "been", "deleted", "." ]
0004c1744b7f0969841d04cd4fa693f402b10980
https://github.com/io7m/jcanephora/blob/0004c1744b7f0969841d04cd4fa693f402b10980/com.io7m.jcanephora.core/src/main/java/com/io7m/jcanephora/core/JCGLResources.java#L45-L58
149,634
craterdog/java-general-utilities
src/main/java/craterdog/utils/UniversalHashFunction.java
UniversalHashFunction.hashValue
public int hashValue(Object object) { int x; // make sure the hash value is consistent across JVM invocations if (object instanceof Boolean || object instanceof Character || object instanceof String || object instanceof Number || object instanceof Date) { x = object.hashCode(); } else if (object.getClass().isArray()) { Object[] array = (Object[]) object; x = Arrays.toString(array).hashCode(); // array.hashCode() returns the memory address of the array! } else { x = object.toString().hashCode(); // make sure it isn't calling Object.hashCode()! } int hash = (a * x + b) >>> d; // unsigned shift right return hash; }
java
public int hashValue(Object object) { int x; // make sure the hash value is consistent across JVM invocations if (object instanceof Boolean || object instanceof Character || object instanceof String || object instanceof Number || object instanceof Date) { x = object.hashCode(); } else if (object.getClass().isArray()) { Object[] array = (Object[]) object; x = Arrays.toString(array).hashCode(); // array.hashCode() returns the memory address of the array! } else { x = object.toString().hashCode(); // make sure it isn't calling Object.hashCode()! } int hash = (a * x + b) >>> d; // unsigned shift right return hash; }
[ "public", "int", "hashValue", "(", "Object", "object", ")", "{", "int", "x", ";", "// make sure the hash value is consistent across JVM invocations", "if", "(", "object", "instanceof", "Boolean", "||", "object", "instanceof", "Character", "||", "object", "instanceof", "String", "||", "object", "instanceof", "Number", "||", "object", "instanceof", "Date", ")", "{", "x", "=", "object", ".", "hashCode", "(", ")", ";", "}", "else", "if", "(", "object", ".", "getClass", "(", ")", ".", "isArray", "(", ")", ")", "{", "Object", "[", "]", "array", "=", "(", "Object", "[", "]", ")", "object", ";", "x", "=", "Arrays", ".", "toString", "(", "array", ")", ".", "hashCode", "(", ")", ";", "// array.hashCode() returns the memory address of the array!", "}", "else", "{", "x", "=", "object", ".", "toString", "(", ")", ".", "hashCode", "(", ")", ";", "// make sure it isn't calling Object.hashCode()!", "}", "int", "hash", "=", "(", "a", "*", "x", "+", "b", ")", ">>>", "d", ";", "// unsigned shift right", "return", "hash", ";", "}" ]
This method generates a hash value for the specified object using the universal hash function parameters specified in the constructor. The result will be a hash value containing the hash width number of bits. @param object The object to be hashed. @return A universal hash of the object.
[ "This", "method", "generates", "a", "hash", "value", "for", "the", "specified", "object", "using", "the", "universal", "hash", "function", "parameters", "specified", "in", "the", "constructor", ".", "The", "result", "will", "be", "a", "hash", "value", "containing", "the", "hash", "width", "number", "of", "bits", "." ]
a3ff45eaa00c2b8ed5c53efe9fe5166065fc1f57
https://github.com/craterdog/java-general-utilities/blob/a3ff45eaa00c2b8ed5c53efe9fe5166065fc1f57/src/main/java/craterdog/utils/UniversalHashFunction.java#L87-L100
149,635
seedstack/jms-addon
src/main/java/org/seedstack/jms/internal/ManagedSession.java
ManagedSession.reset
void reset() { sessionLock.writeLock().lock(); try { LOGGER.debug("Resetting managed JMS session {}", this); session = null; for (ManagedMessageConsumer managedMessageConsumer : messageConsumers) { managedMessageConsumer.reset(); } } finally { sessionLock.writeLock().unlock(); } }
java
void reset() { sessionLock.writeLock().lock(); try { LOGGER.debug("Resetting managed JMS session {}", this); session = null; for (ManagedMessageConsumer managedMessageConsumer : messageConsumers) { managedMessageConsumer.reset(); } } finally { sessionLock.writeLock().unlock(); } }
[ "void", "reset", "(", ")", "{", "sessionLock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "LOGGER", ".", "debug", "(", "\"Resetting managed JMS session {}\"", ",", "this", ")", ";", "session", "=", "null", ";", "for", "(", "ManagedMessageConsumer", "managedMessageConsumer", ":", "messageConsumers", ")", "{", "managedMessageConsumer", ".", "reset", "(", ")", ";", "}", "}", "finally", "{", "sessionLock", ".", "writeLock", "(", ")", ".", "unlock", "(", ")", ";", "}", "}" ]
Reset the session and the message consumers in cascade.
[ "Reset", "the", "session", "and", "the", "message", "consumers", "in", "cascade", "." ]
d6014811daaac29f591b32bfd2358500fb25d804
https://github.com/seedstack/jms-addon/blob/d6014811daaac29f591b32bfd2358500fb25d804/src/main/java/org/seedstack/jms/internal/ManagedSession.java#L80-L91
149,636
mlhartme/mork
src/main/java/net/oneandone/mork/mapping/Path.java
Path.translate
public static void translate(Syntax syntax, Definition source, Definition target) throws GenericException { List<Definition> targets; IntBitSet stopper; targets = new ArrayList<Definition>(); targets.add(target); stopper = new IntBitSet(); stopper.add(target.getAttribute().symbol); translate(syntax, ISOLATED, source, targets, new int[] {}, new IntBitSet[] { stopper }); }
java
public static void translate(Syntax syntax, Definition source, Definition target) throws GenericException { List<Definition> targets; IntBitSet stopper; targets = new ArrayList<Definition>(); targets.add(target); stopper = new IntBitSet(); stopper.add(target.getAttribute().symbol); translate(syntax, ISOLATED, source, targets, new int[] {}, new IntBitSet[] { stopper }); }
[ "public", "static", "void", "translate", "(", "Syntax", "syntax", ",", "Definition", "source", ",", "Definition", "target", ")", "throws", "GenericException", "{", "List", "<", "Definition", ">", "targets", ";", "IntBitSet", "stopper", ";", "targets", "=", "new", "ArrayList", "<", "Definition", ">", "(", ")", ";", "targets", ".", "add", "(", "target", ")", ";", "stopper", "=", "new", "IntBitSet", "(", ")", ";", "stopper", ".", "add", "(", "target", ".", "getAttribute", "(", ")", ".", "symbol", ")", ";", "translate", "(", "syntax", ",", "ISOLATED", ",", "source", ",", "targets", ",", "new", "int", "[", "]", "{", "}", ",", "new", "IntBitSet", "[", "]", "{", "stopper", "}", ")", ";", "}" ]
Creates a path with no steps
[ "Creates", "a", "path", "with", "no", "steps" ]
a069b087750c4133bfeebaf1f599c3bc96762113
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/mapping/Path.java#L58-L67
149,637
mlhartme/mork
src/main/java/net/oneandone/mork/mapping/Path.java
Path.translate
public static void translate(Syntax syntax, Definition source, int[] moves, int[] symbols, Definition target, int modifier) throws GenericException { IntBitSet[] stoppers; List<Definition> targets; int i; if (moves.length - 1 != symbols.length) { throw new IllegalArgumentException(); } stoppers = new IntBitSet[moves.length]; targets = new ArrayList<Definition>(); targets.add(target); for (i = 0; i < symbols.length; i++) { stoppers[i] = new IntBitSet(); stoppers[i].add(symbols[i]); } stoppers[i] = new IntBitSet(); stoppers[i].add(target.getAttribute().symbol); translate(syntax, modifier, source, targets, moves, stoppers); }
java
public static void translate(Syntax syntax, Definition source, int[] moves, int[] symbols, Definition target, int modifier) throws GenericException { IntBitSet[] stoppers; List<Definition> targets; int i; if (moves.length - 1 != symbols.length) { throw new IllegalArgumentException(); } stoppers = new IntBitSet[moves.length]; targets = new ArrayList<Definition>(); targets.add(target); for (i = 0; i < symbols.length; i++) { stoppers[i] = new IntBitSet(); stoppers[i].add(symbols[i]); } stoppers[i] = new IntBitSet(); stoppers[i].add(target.getAttribute().symbol); translate(syntax, modifier, source, targets, moves, stoppers); }
[ "public", "static", "void", "translate", "(", "Syntax", "syntax", ",", "Definition", "source", ",", "int", "[", "]", "moves", ",", "int", "[", "]", "symbols", ",", "Definition", "target", ",", "int", "modifier", ")", "throws", "GenericException", "{", "IntBitSet", "[", "]", "stoppers", ";", "List", "<", "Definition", ">", "targets", ";", "int", "i", ";", "if", "(", "moves", ".", "length", "-", "1", "!=", "symbols", ".", "length", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "stoppers", "=", "new", "IntBitSet", "[", "moves", ".", "length", "]", ";", "targets", "=", "new", "ArrayList", "<", "Definition", ">", "(", ")", ";", "targets", ".", "add", "(", "target", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "symbols", ".", "length", ";", "i", "++", ")", "{", "stoppers", "[", "i", "]", "=", "new", "IntBitSet", "(", ")", ";", "stoppers", "[", "i", "]", ".", "add", "(", "symbols", "[", "i", "]", ")", ";", "}", "stoppers", "[", "i", "]", "=", "new", "IntBitSet", "(", ")", ";", "stoppers", "[", "i", "]", ".", "add", "(", "target", ".", "getAttribute", "(", ")", ".", "symbol", ")", ";", "translate", "(", "syntax", ",", "modifier", ",", "source", ",", "targets", ",", "moves", ",", "stoppers", ")", ";", "}" ]
Creates a path with 1+ steps
[ "Creates", "a", "path", "with", "1", "+", "steps" ]
a069b087750c4133bfeebaf1f599c3bc96762113
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/mapping/Path.java#L72-L93
149,638
mlhartme/mork
src/main/java/net/oneandone/mork/mapping/Path.java
Path.translate
private static void translate(Syntax syntax, int modifier, Definition source, List<Definition> targets, int[] moves, IntBitSet[] stoppers) throws GenericException { Path path; int count; path = new Path(syntax.getGrammar(), modifier, source, targets, moves, stoppers); count = path.translate(); if (count == 0 && source.getAttribute().symbol != syntax.getGrammar().getStart()) { // TODO: improved error message throw new GenericException("dead-end path for attribute " + source.getName()); } }
java
private static void translate(Syntax syntax, int modifier, Definition source, List<Definition> targets, int[] moves, IntBitSet[] stoppers) throws GenericException { Path path; int count; path = new Path(syntax.getGrammar(), modifier, source, targets, moves, stoppers); count = path.translate(); if (count == 0 && source.getAttribute().symbol != syntax.getGrammar().getStart()) { // TODO: improved error message throw new GenericException("dead-end path for attribute " + source.getName()); } }
[ "private", "static", "void", "translate", "(", "Syntax", "syntax", ",", "int", "modifier", ",", "Definition", "source", ",", "List", "<", "Definition", ">", "targets", ",", "int", "[", "]", "moves", ",", "IntBitSet", "[", "]", "stoppers", ")", "throws", "GenericException", "{", "Path", "path", ";", "int", "count", ";", "path", "=", "new", "Path", "(", "syntax", ".", "getGrammar", "(", ")", ",", "modifier", ",", "source", ",", "targets", ",", "moves", ",", "stoppers", ")", ";", "count", "=", "path", ".", "translate", "(", ")", ";", "if", "(", "count", "==", "0", "&&", "source", ".", "getAttribute", "(", ")", ".", "symbol", "!=", "syntax", ".", "getGrammar", "(", ")", ".", "getStart", "(", ")", ")", "{", "// TODO: improved error message", "throw", "new", "GenericException", "(", "\"dead-end path for attribute \"", "+", "source", ".", "getName", "(", ")", ")", ";", "}", "}" ]
The method actually doing the work
[ "The", "method", "actually", "doing", "the", "work" ]
a069b087750c4133bfeebaf1f599c3bc96762113
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/mapping/Path.java#L98-L109
149,639
Terradue/jcatalogue-client
impl/src/main/java/com/terradue/jcatalogue/ChecksumUtils.java
ChecksumUtils.calc
public static Map<String, String> calc( File dataFile, String...algos ) throws IOException { Map<String, String> results = new LinkedHashMap<String, String>(); Map<String, MessageDigest> digests = new LinkedHashMap<String, MessageDigest>(); for ( String algo : algos ) { try { digests.put( algo, MessageDigest.getInstance( algo ) ); } catch ( NoSuchAlgorithmException e ) { results.put( algo, null ); } } FileInputStream fis = new FileInputStream( dataFile ); try { for ( byte[] buffer = new byte[32 * 1024];; ) { int read = fis.read( buffer ); if ( read < 0 ) { break; } for ( MessageDigest digest : digests.values() ) { digest.update( buffer, 0, read ); } } } finally { closeQuietly( fis ); } for ( Map.Entry<String, MessageDigest> entry : digests.entrySet() ) { byte[] bytes = entry.getValue().digest(); results.put( entry.getKey(), toHexString( bytes ) ); } return results; }
java
public static Map<String, String> calc( File dataFile, String...algos ) throws IOException { Map<String, String> results = new LinkedHashMap<String, String>(); Map<String, MessageDigest> digests = new LinkedHashMap<String, MessageDigest>(); for ( String algo : algos ) { try { digests.put( algo, MessageDigest.getInstance( algo ) ); } catch ( NoSuchAlgorithmException e ) { results.put( algo, null ); } } FileInputStream fis = new FileInputStream( dataFile ); try { for ( byte[] buffer = new byte[32 * 1024];; ) { int read = fis.read( buffer ); if ( read < 0 ) { break; } for ( MessageDigest digest : digests.values() ) { digest.update( buffer, 0, read ); } } } finally { closeQuietly( fis ); } for ( Map.Entry<String, MessageDigest> entry : digests.entrySet() ) { byte[] bytes = entry.getValue().digest(); results.put( entry.getKey(), toHexString( bytes ) ); } return results; }
[ "public", "static", "Map", "<", "String", ",", "String", ">", "calc", "(", "File", "dataFile", ",", "String", "...", "algos", ")", "throws", "IOException", "{", "Map", "<", "String", ",", "String", ">", "results", "=", "new", "LinkedHashMap", "<", "String", ",", "String", ">", "(", ")", ";", "Map", "<", "String", ",", "MessageDigest", ">", "digests", "=", "new", "LinkedHashMap", "<", "String", ",", "MessageDigest", ">", "(", ")", ";", "for", "(", "String", "algo", ":", "algos", ")", "{", "try", "{", "digests", ".", "put", "(", "algo", ",", "MessageDigest", ".", "getInstance", "(", "algo", ")", ")", ";", "}", "catch", "(", "NoSuchAlgorithmException", "e", ")", "{", "results", ".", "put", "(", "algo", ",", "null", ")", ";", "}", "}", "FileInputStream", "fis", "=", "new", "FileInputStream", "(", "dataFile", ")", ";", "try", "{", "for", "(", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "32", "*", "1024", "]", ";", ";", ")", "{", "int", "read", "=", "fis", ".", "read", "(", "buffer", ")", ";", "if", "(", "read", "<", "0", ")", "{", "break", ";", "}", "for", "(", "MessageDigest", "digest", ":", "digests", ".", "values", "(", ")", ")", "{", "digest", ".", "update", "(", "buffer", ",", "0", ",", "read", ")", ";", "}", "}", "}", "finally", "{", "closeQuietly", "(", "fis", ")", ";", "}", "for", "(", "Map", ".", "Entry", "<", "String", ",", "MessageDigest", ">", "entry", ":", "digests", ".", "entrySet", "(", ")", ")", "{", "byte", "[", "]", "bytes", "=", "entry", ".", "getValue", "(", ")", ".", "digest", "(", ")", ";", "results", ".", "put", "(", "entry", ".", "getKey", "(", ")", ",", "toHexString", "(", "bytes", ")", ")", ";", "}", "return", "results", ";", "}" ]
Calculates checksums for the specified file. @param dataFile The file for which to calculate checksums, must not be {@code null}. @param algos The names of checksum algorithms (cf. {@link MessageDigest#getInstance(String)} to use, must not be {@code null}. @return The calculated checksums, indexed by algorithm name, or the exception that occurred while trying to calculate it, never {@code null}. @throws IOException If the data file could not be read.
[ "Calculates", "checksums", "for", "the", "specified", "file", "." ]
1f24c4da952d8ad2373c4fa97eed48b0b8a88d21
https://github.com/Terradue/jcatalogue-client/blob/1f24c4da952d8ad2373c4fa97eed48b0b8a88d21/impl/src/main/java/com/terradue/jcatalogue/ChecksumUtils.java#L104-L151
149,640
eurekaclinical/datastore
src/main/java/org/eurekaclinical/datastore/bdb/BdbUtil.java
BdbUtil.uniqueEnvironment
public static String uniqueEnvironment(String prefix, String suffix, File directory) throws IOException { File tmpDir = UNIQUE_DIRECTORY_CREATOR.create(prefix, suffix, directory); String randomFilename = UUID.randomUUID().toString(); File envNameAsFile = new File(tmpDir, randomFilename); return envNameAsFile.getAbsolutePath(); }
java
public static String uniqueEnvironment(String prefix, String suffix, File directory) throws IOException { File tmpDir = UNIQUE_DIRECTORY_CREATOR.create(prefix, suffix, directory); String randomFilename = UUID.randomUUID().toString(); File envNameAsFile = new File(tmpDir, randomFilename); return envNameAsFile.getAbsolutePath(); }
[ "public", "static", "String", "uniqueEnvironment", "(", "String", "prefix", ",", "String", "suffix", ",", "File", "directory", ")", "throws", "IOException", "{", "File", "tmpDir", "=", "UNIQUE_DIRECTORY_CREATOR", ".", "create", "(", "prefix", ",", "suffix", ",", "directory", ")", ";", "String", "randomFilename", "=", "UUID", ".", "randomUUID", "(", ")", ".", "toString", "(", ")", ";", "File", "envNameAsFile", "=", "new", "File", "(", "tmpDir", ",", "randomFilename", ")", ";", "return", "envNameAsFile", ".", "getAbsolutePath", "(", ")", ";", "}" ]
Creates a unique directory for housing a BDB environment, and returns its name. @param prefix a prefix for the temporary directory's name. Cannot be <code>null</code>. @param suffix a suffix for the temporary directory's name. @return the environment name to use. @param directory the parent directory to use. @throws IOException if an error occurred in creating the temporary directory.
[ "Creates", "a", "unique", "directory", "for", "housing", "a", "BDB", "environment", "and", "returns", "its", "name", "." ]
a03a70819bb562ba45eac66ca49f778035ee45e0
https://github.com/eurekaclinical/datastore/blob/a03a70819bb562ba45eac66ca49f778035ee45e0/src/main/java/org/eurekaclinical/datastore/bdb/BdbUtil.java#L48-L55
149,641
mlhartme/mork
src/main/java/net/oneandone/mork/scanner/FA.java
FA.add
public int add(Object label) { ensureCapacity(used); states[used] = new State(label); return used++; }
java
public int add(Object label) { ensureCapacity(used); states[used] = new State(label); return used++; }
[ "public", "int", "add", "(", "Object", "label", ")", "{", "ensureCapacity", "(", "used", ")", ";", "states", "[", "used", "]", "=", "new", "State", "(", "label", ")", ";", "return", "used", "++", ";", "}" ]
Inserts a new states to the automaton. New states are allocated at the end. @param label label for the state created.
[ "Inserts", "a", "new", "states", "to", "the", "automaton", ".", "New", "states", "are", "allocated", "at", "the", "end", "." ]
a069b087750c4133bfeebaf1f599c3bc96762113
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/scanner/FA.java#L99-L103
149,642
mlhartme/mork
src/main/java/net/oneandone/mork/scanner/FA.java
FA.not
public void not() { IntBitSet tmp; tmp = new IntBitSet(); tmp.addRange(0, used - 1); tmp.removeAll(ends); ends = tmp; }
java
public void not() { IntBitSet tmp; tmp = new IntBitSet(); tmp.addRange(0, used - 1); tmp.removeAll(ends); ends = tmp; }
[ "public", "void", "not", "(", ")", "{", "IntBitSet", "tmp", ";", "tmp", "=", "new", "IntBitSet", "(", ")", ";", "tmp", ".", "addRange", "(", "0", ",", "used", "-", "1", ")", ";", "tmp", ".", "removeAll", "(", "ends", ")", ";", "ends", "=", "tmp", ";", "}" ]
Negates normal states and end states. If the automaton is deterministic, the accepted language is negated.
[ "Negates", "normal", "states", "and", "end", "states", ".", "If", "the", "automaton", "is", "deterministic", "the", "accepted", "language", "is", "negated", "." ]
a069b087750c4133bfeebaf1f599c3bc96762113
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/scanner/FA.java#L257-L264
149,643
mlhartme/mork
src/main/java/net/oneandone/mork/scanner/FA.java
FA.append
private int append(FA add) { int relocation; int idx; relocation = used; ensureCapacity(used + add.used); for (idx = 0; idx < add.used; idx++) { states[relocation + idx] = new State(add.states[idx], relocation); } used += add.used; return relocation; }
java
private int append(FA add) { int relocation; int idx; relocation = used; ensureCapacity(used + add.used); for (idx = 0; idx < add.used; idx++) { states[relocation + idx] = new State(add.states[idx], relocation); } used += add.used; return relocation; }
[ "private", "int", "append", "(", "FA", "add", ")", "{", "int", "relocation", ";", "int", "idx", ";", "relocation", "=", "used", ";", "ensureCapacity", "(", "used", "+", "add", ".", "used", ")", ";", "for", "(", "idx", "=", "0", ";", "idx", "<", "add", ".", "used", ";", "idx", "++", ")", "{", "states", "[", "relocation", "+", "idx", "]", "=", "new", "State", "(", "add", ".", "states", "[", "idx", "]", ",", "relocation", ")", ";", "}", "used", "+=", "add", ".", "used", ";", "return", "relocation", ";", "}" ]
Adds a copy of all states and transitions from the automaton specified. No transition is added between old and new states. States and transitions are relocated with the offsets specified.
[ "Adds", "a", "copy", "of", "all", "states", "and", "transitions", "from", "the", "automaton", "specified", ".", "No", "transition", "is", "added", "between", "old", "and", "new", "states", ".", "States", "and", "transitions", "are", "relocated", "with", "the", "offsets", "specified", "." ]
a069b087750c4133bfeebaf1f599c3bc96762113
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/scanner/FA.java#L271-L283
149,644
mlhartme/mork
src/main/java/net/oneandone/mork/scanner/FA.java
FA.epsilonClosures
public IntBitSet[] epsilonClosures() { int si; int nextSize; IntBitSet[] result; IntBitSet tmp; int[] size; boolean repeat; result = new IntBitSet[used]; size = new int[used]; for (si = 0; si < used; si++) { tmp = new IntBitSet(); states[si].epsilonClosure(tmp); result[si] = tmp; size[si] = tmp.size(); } do { repeat = false; for (si = 0; si < used; si++) { result[si].addAllSets(result); nextSize = result[si].size(); if (nextSize > size[si]) { size[si] = nextSize; repeat = true; } } } while (repeat); return result; }
java
public IntBitSet[] epsilonClosures() { int si; int nextSize; IntBitSet[] result; IntBitSet tmp; int[] size; boolean repeat; result = new IntBitSet[used]; size = new int[used]; for (si = 0; si < used; si++) { tmp = new IntBitSet(); states[si].epsilonClosure(tmp); result[si] = tmp; size[si] = tmp.size(); } do { repeat = false; for (si = 0; si < used; si++) { result[si].addAllSets(result); nextSize = result[si].size(); if (nextSize > size[si]) { size[si] = nextSize; repeat = true; } } } while (repeat); return result; }
[ "public", "IntBitSet", "[", "]", "epsilonClosures", "(", ")", "{", "int", "si", ";", "int", "nextSize", ";", "IntBitSet", "[", "]", "result", ";", "IntBitSet", "tmp", ";", "int", "[", "]", "size", ";", "boolean", "repeat", ";", "result", "=", "new", "IntBitSet", "[", "used", "]", ";", "size", "=", "new", "int", "[", "used", "]", ";", "for", "(", "si", "=", "0", ";", "si", "<", "used", ";", "si", "++", ")", "{", "tmp", "=", "new", "IntBitSet", "(", ")", ";", "states", "[", "si", "]", ".", "epsilonClosure", "(", "tmp", ")", ";", "result", "[", "si", "]", "=", "tmp", ";", "size", "[", "si", "]", "=", "tmp", ".", "size", "(", ")", ";", "}", "do", "{", "repeat", "=", "false", ";", "for", "(", "si", "=", "0", ";", "si", "<", "used", ";", "si", "++", ")", "{", "result", "[", "si", "]", ".", "addAllSets", "(", "result", ")", ";", "nextSize", "=", "result", "[", "si", "]", ".", "size", "(", ")", ";", "if", "(", "nextSize", ">", "size", "[", "si", "]", ")", "{", "size", "[", "si", "]", "=", "nextSize", ";", "repeat", "=", "true", ";", "}", "}", "}", "while", "(", "repeat", ")", ";", "return", "result", ";", "}" ]
Its too expensive to compute a single epsilong closure.
[ "Its", "too", "expensive", "to", "compute", "a", "single", "epsilong", "closure", "." ]
a069b087750c4133bfeebaf1f599c3bc96762113
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/scanner/FA.java#L290-L320
149,645
bwkimmel/jdcp
jdcp-console/src/main/java/ca/eandb/jdcp/client/SynchronizeCommand.java
SynchronizeCommand.synchronize
private void synchronize(String pkg, File path, Configuration conf) { if (!path.isDirectory()) { throw new IllegalArgumentException(path.getAbsolutePath().concat(" is not a directory.")); } for (File file : path.listFiles()) { if (file.isDirectory()) { synchronize(combine(pkg, file.getName()), file, conf); } else { String fileName = file.getName(); int extensionSeparator = fileName.lastIndexOf('.'); if (extensionSeparator >= 0) { String extension = fileName.substring(extensionSeparator + 1); if (extension.equals("class")) { String className = combine(pkg, fileName.substring(0, extensionSeparator)); try { byte[] digest = conf.getJobService().getClassDigest(className); byte[] def = FileUtil.getFileContents(file); byte[] localDigest = getDigest(def, conf); if (digest == null || !Arrays.equals(digest, localDigest)) { conf.getJobService().setClassDefinition(className, def); System.out.print(digest == null ? "+ " : "U "); System.out.println(className); } else if (conf.verbose) { System.out.print("= "); System.out.println(className); } } catch (FileNotFoundException e) { throw new UnexpectedException(e); } catch (IOException e) { System.out.print("E "); System.out.println(className); } } } } } }
java
private void synchronize(String pkg, File path, Configuration conf) { if (!path.isDirectory()) { throw new IllegalArgumentException(path.getAbsolutePath().concat(" is not a directory.")); } for (File file : path.listFiles()) { if (file.isDirectory()) { synchronize(combine(pkg, file.getName()), file, conf); } else { String fileName = file.getName(); int extensionSeparator = fileName.lastIndexOf('.'); if (extensionSeparator >= 0) { String extension = fileName.substring(extensionSeparator + 1); if (extension.equals("class")) { String className = combine(pkg, fileName.substring(0, extensionSeparator)); try { byte[] digest = conf.getJobService().getClassDigest(className); byte[] def = FileUtil.getFileContents(file); byte[] localDigest = getDigest(def, conf); if (digest == null || !Arrays.equals(digest, localDigest)) { conf.getJobService().setClassDefinition(className, def); System.out.print(digest == null ? "+ " : "U "); System.out.println(className); } else if (conf.verbose) { System.out.print("= "); System.out.println(className); } } catch (FileNotFoundException e) { throw new UnexpectedException(e); } catch (IOException e) { System.out.print("E "); System.out.println(className); } } } } } }
[ "private", "void", "synchronize", "(", "String", "pkg", ",", "File", "path", ",", "Configuration", "conf", ")", "{", "if", "(", "!", "path", ".", "isDirectory", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "path", ".", "getAbsolutePath", "(", ")", ".", "concat", "(", "\" is not a directory.\"", ")", ")", ";", "}", "for", "(", "File", "file", ":", "path", ".", "listFiles", "(", ")", ")", "{", "if", "(", "file", ".", "isDirectory", "(", ")", ")", "{", "synchronize", "(", "combine", "(", "pkg", ",", "file", ".", "getName", "(", ")", ")", ",", "file", ",", "conf", ")", ";", "}", "else", "{", "String", "fileName", "=", "file", ".", "getName", "(", ")", ";", "int", "extensionSeparator", "=", "fileName", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "extensionSeparator", ">=", "0", ")", "{", "String", "extension", "=", "fileName", ".", "substring", "(", "extensionSeparator", "+", "1", ")", ";", "if", "(", "extension", ".", "equals", "(", "\"class\"", ")", ")", "{", "String", "className", "=", "combine", "(", "pkg", ",", "fileName", ".", "substring", "(", "0", ",", "extensionSeparator", ")", ")", ";", "try", "{", "byte", "[", "]", "digest", "=", "conf", ".", "getJobService", "(", ")", ".", "getClassDigest", "(", "className", ")", ";", "byte", "[", "]", "def", "=", "FileUtil", ".", "getFileContents", "(", "file", ")", ";", "byte", "[", "]", "localDigest", "=", "getDigest", "(", "def", ",", "conf", ")", ";", "if", "(", "digest", "==", "null", "||", "!", "Arrays", ".", "equals", "(", "digest", ",", "localDigest", ")", ")", "{", "conf", ".", "getJobService", "(", ")", ".", "setClassDefinition", "(", "className", ",", "def", ")", ";", "System", ".", "out", ".", "print", "(", "digest", "==", "null", "?", "\"+ \"", ":", "\"U \"", ")", ";", "System", ".", "out", ".", "println", "(", "className", ")", ";", "}", "else", "if", "(", "conf", ".", "verbose", ")", "{", "System", ".", "out", ".", "print", "(", "\"= \"", ")", ";", "System", ".", "out", ".", "println", "(", "className", ")", ";", "}", "}", "catch", "(", "FileNotFoundException", "e", ")", "{", "throw", "new", "UnexpectedException", "(", "e", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "System", ".", "out", ".", "print", "(", "\"E \"", ")", ";", "System", ".", "out", ".", "println", "(", "className", ")", ";", "}", "}", "}", "}", "}", "}" ]
Synchronizes all classes in the given directory tree to the server. @param pkg The name of the package associated with the root of the directory tree. @param path The <code>File</code> indicating the root of the directory tree. @param conf The application command line options.
[ "Synchronizes", "all", "classes", "in", "the", "given", "directory", "tree", "to", "the", "server", "." ]
630c5150c245054e2556ff370f4bad2ec793dfb7
https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-console/src/main/java/ca/eandb/jdcp/client/SynchronizeCommand.java#L62-L99
149,646
bwkimmel/jdcp
jdcp-console/src/main/java/ca/eandb/jdcp/client/SynchronizeCommand.java
SynchronizeCommand.combine
private String combine(String parent, String child) { if (parent.length() > 0) { return parent.concat(".").concat(child); } else { return child; } }
java
private String combine(String parent, String child) { if (parent.length() > 0) { return parent.concat(".").concat(child); } else { return child; } }
[ "private", "String", "combine", "(", "String", "parent", ",", "String", "child", ")", "{", "if", "(", "parent", ".", "length", "(", ")", ">", "0", ")", "{", "return", "parent", ".", "concat", "(", "\".\"", ")", ".", "concat", "(", "child", ")", ";", "}", "else", "{", "return", "child", ";", "}", "}" ]
Combines package path. @param parent The parent package. @param child The name of the child package. @return The combined package name.
[ "Combines", "package", "path", "." ]
630c5150c245054e2556ff370f4bad2ec793dfb7
https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-console/src/main/java/ca/eandb/jdcp/client/SynchronizeCommand.java#L122-L128
149,647
Metrink/croquet
croquet-examples/src/main/java/com/metrink/croquet/examples/crm/pages/AbstractFormPage.java
AbstractFormPage.createNewBean
protected T createNewBean() throws InstantiationException { try { return beanClass.getConstructor().newInstance(); } catch (final InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { // fold it all into one type of exception throw new InstantiationException(e.getMessage()); } }
java
protected T createNewBean() throws InstantiationException { try { return beanClass.getConstructor().newInstance(); } catch (final InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { // fold it all into one type of exception throw new InstantiationException(e.getMessage()); } }
[ "protected", "T", "createNewBean", "(", ")", "throws", "InstantiationException", "{", "try", "{", "return", "beanClass", ".", "getConstructor", "(", ")", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "final", "InstantiationException", "|", "IllegalAccessException", "|", "IllegalArgumentException", "|", "InvocationTargetException", "|", "NoSuchMethodException", "|", "SecurityException", "e", ")", "{", "// fold it all into one type of exception", "throw", "new", "InstantiationException", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}" ]
Creates a new bean. @return a new bean. @throws InstantiationException if anything goes wrong.
[ "Creates", "a", "new", "bean", "." ]
1b0ed1327a104cf1f809ce4c3c5bf30a3d95384b
https://github.com/Metrink/croquet/blob/1b0ed1327a104cf1f809ce4c3c5bf30a3d95384b/croquet-examples/src/main/java/com/metrink/croquet/examples/crm/pages/AbstractFormPage.java#L166-L178
149,648
Metrink/croquet
croquet-examples/src/main/java/com/metrink/croquet/examples/crm/pages/AbstractFormPage.java
AbstractFormPage.setForm
protected void setForm(final T bean, final AjaxRequestTarget target) { LOG.debug("Setting form to {}", bean); // update the model with the new bean formModel.setObject(bean); // add the form to the target target.add(form); // update the button updateSaveButton.setModel(Model.of("Update")); target.add(updateSaveButton); }
java
protected void setForm(final T bean, final AjaxRequestTarget target) { LOG.debug("Setting form to {}", bean); // update the model with the new bean formModel.setObject(bean); // add the form to the target target.add(form); // update the button updateSaveButton.setModel(Model.of("Update")); target.add(updateSaveButton); }
[ "protected", "void", "setForm", "(", "final", "T", "bean", ",", "final", "AjaxRequestTarget", "target", ")", "{", "LOG", ".", "debug", "(", "\"Setting form to {}\"", ",", "bean", ")", ";", "// update the model with the new bean", "formModel", ".", "setObject", "(", "bean", ")", ";", "// add the form to the target", "target", ".", "add", "(", "form", ")", ";", "// update the button", "updateSaveButton", ".", "setModel", "(", "Model", ".", "of", "(", "\"Update\"", ")", ")", ";", "target", ".", "add", "(", "updateSaveButton", ")", ";", "}" ]
Sets the form to the bean passed in, updating the form via AJAX. @param bean the bean to set the form to. @param target the target of whatever triggers the form fill action.
[ "Sets", "the", "form", "to", "the", "bean", "passed", "in", "updating", "the", "form", "via", "AJAX", "." ]
1b0ed1327a104cf1f809ce4c3c5bf30a3d95384b
https://github.com/Metrink/croquet/blob/1b0ed1327a104cf1f809ce4c3c5bf30a3d95384b/croquet-examples/src/main/java/com/metrink/croquet/examples/crm/pages/AbstractFormPage.java#L185-L197
149,649
mlhartme/mork
src/main/java/net/oneandone/mork/compiler/MorkMapper.java
MorkMapper.invokeMapper
private Object invokeMapper(File source) throws IOException { Object[] results; String name; Reader src; name = source.getPath(); mork.output.verbose("mapping " + name); results = run(name); mork.output.verbose("finished mapping " + name); if (results == null) { return null; } else { return results[0]; } }
java
private Object invokeMapper(File source) throws IOException { Object[] results; String name; Reader src; name = source.getPath(); mork.output.verbose("mapping " + name); results = run(name); mork.output.verbose("finished mapping " + name); if (results == null) { return null; } else { return results[0]; } }
[ "private", "Object", "invokeMapper", "(", "File", "source", ")", "throws", "IOException", "{", "Object", "[", "]", "results", ";", "String", "name", ";", "Reader", "src", ";", "name", "=", "source", ".", "getPath", "(", ")", ";", "mork", ".", "output", ".", "verbose", "(", "\"mapping \"", "+", "name", ")", ";", "results", "=", "run", "(", "name", ")", ";", "mork", ".", "output", ".", "verbose", "(", "\"finished mapping \"", "+", "name", ")", ";", "if", "(", "results", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "return", "results", "[", "0", "]", ";", "}", "}" ]
Read input. Wraps mapper.read with Mork-specific error handling. Return type depends on the mapper actually used. @return null if an error has been reported
[ "Read", "input", ".", "Wraps", "mapper", ".", "read", "with", "Mork", "-", "specific", "error", "handling", ".", "Return", "type", "depends", "on", "the", "mapper", "actually", "used", "." ]
a069b087750c4133bfeebaf1f599c3bc96762113
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/compiler/MorkMapper.java#L75-L89
149,650
vikingbrain/thedavidbox-client4j
src/main/java/com/vikingbrain/nmt/responses/system/ResponseGetNmtServiceStatus.java
ResponseGetNmtServiceStatus.getServiceStatus
public final ServiceStatusType getServiceStatus(){ //Initial value for status just in case "true" of "false" is not found ServiceStatusType serviceStatus = ServiceStatusType.UNKNOWN; if ("true".equals(status)){ serviceStatus = ServiceStatusType.RUNNING; } else if ("false".equals(status)){ serviceStatus = ServiceStatusType.STOPPED; } return serviceStatus; }
java
public final ServiceStatusType getServiceStatus(){ //Initial value for status just in case "true" of "false" is not found ServiceStatusType serviceStatus = ServiceStatusType.UNKNOWN; if ("true".equals(status)){ serviceStatus = ServiceStatusType.RUNNING; } else if ("false".equals(status)){ serviceStatus = ServiceStatusType.STOPPED; } return serviceStatus; }
[ "public", "final", "ServiceStatusType", "getServiceStatus", "(", ")", "{", "//Initial value for status just in case \"true\" of \"false\" is not found", "ServiceStatusType", "serviceStatus", "=", "ServiceStatusType", ".", "UNKNOWN", ";", "if", "(", "\"true\"", ".", "equals", "(", "status", ")", ")", "{", "serviceStatus", "=", "ServiceStatusType", ".", "RUNNING", ";", "}", "else", "if", "(", "\"false\"", ".", "equals", "(", "status", ")", ")", "{", "serviceStatus", "=", "ServiceStatusType", ".", "STOPPED", ";", "}", "return", "serviceStatus", ";", "}" ]
Get the service status. @return serviceStatusType RUNNING, STOPPED or UNKNOWN
[ "Get", "the", "service", "status", "." ]
b2375a59b30fc3bd5dae34316bda68e01d006535
https://github.com/vikingbrain/thedavidbox-client4j/blob/b2375a59b30fc3bd5dae34316bda68e01d006535/src/main/java/com/vikingbrain/nmt/responses/system/ResponseGetNmtServiceStatus.java#L50-L59
149,651
mlhartme/mork
src/main/java/net/oneandone/mork/classfile/InstructionType.java
InstructionType.ofsToIdx
public void ofsToIdx(Code context, int ofs, Object[] argValues) { int i; IntArrayList branchesW; switch (encoding) { case TS: i = ((Integer) argValues[0]).intValue(); argValues[0] = new Integer(context.findIdx(ofs + i)); branchesW = (IntArrayList) argValues[3]; for (i = 0; i < branchesW.size(); i++) { branchesW.set(i, context.findIdx(ofs + branchesW.get(i))); } break; case LS: i = ((Integer) argValues[0]).intValue(); argValues[0] = new Integer(context.findIdx(ofs + i)); branchesW = (IntArrayList) argValues[2]; for (i = 0; i < branchesW.size(); i++) { branchesW.set(i, context.findIdx(ofs + branchesW.get(i))); } break; case BRANCH: case VBRANCH: i = ((Integer) argValues[0]).intValue(); argValues[0] = new Integer(context.findIdx(ofs + i)); break; default: // do nothing break; } }
java
public void ofsToIdx(Code context, int ofs, Object[] argValues) { int i; IntArrayList branchesW; switch (encoding) { case TS: i = ((Integer) argValues[0]).intValue(); argValues[0] = new Integer(context.findIdx(ofs + i)); branchesW = (IntArrayList) argValues[3]; for (i = 0; i < branchesW.size(); i++) { branchesW.set(i, context.findIdx(ofs + branchesW.get(i))); } break; case LS: i = ((Integer) argValues[0]).intValue(); argValues[0] = new Integer(context.findIdx(ofs + i)); branchesW = (IntArrayList) argValues[2]; for (i = 0; i < branchesW.size(); i++) { branchesW.set(i, context.findIdx(ofs + branchesW.get(i))); } break; case BRANCH: case VBRANCH: i = ((Integer) argValues[0]).intValue(); argValues[0] = new Integer(context.findIdx(ofs + i)); break; default: // do nothing break; } }
[ "public", "void", "ofsToIdx", "(", "Code", "context", ",", "int", "ofs", ",", "Object", "[", "]", "argValues", ")", "{", "int", "i", ";", "IntArrayList", "branchesW", ";", "switch", "(", "encoding", ")", "{", "case", "TS", ":", "i", "=", "(", "(", "Integer", ")", "argValues", "[", "0", "]", ")", ".", "intValue", "(", ")", ";", "argValues", "[", "0", "]", "=", "new", "Integer", "(", "context", ".", "findIdx", "(", "ofs", "+", "i", ")", ")", ";", "branchesW", "=", "(", "IntArrayList", ")", "argValues", "[", "3", "]", ";", "for", "(", "i", "=", "0", ";", "i", "<", "branchesW", ".", "size", "(", ")", ";", "i", "++", ")", "{", "branchesW", ".", "set", "(", "i", ",", "context", ".", "findIdx", "(", "ofs", "+", "branchesW", ".", "get", "(", "i", ")", ")", ")", ";", "}", "break", ";", "case", "LS", ":", "i", "=", "(", "(", "Integer", ")", "argValues", "[", "0", "]", ")", ".", "intValue", "(", ")", ";", "argValues", "[", "0", "]", "=", "new", "Integer", "(", "context", ".", "findIdx", "(", "ofs", "+", "i", ")", ")", ";", "branchesW", "=", "(", "IntArrayList", ")", "argValues", "[", "2", "]", ";", "for", "(", "i", "=", "0", ";", "i", "<", "branchesW", ".", "size", "(", ")", ";", "i", "++", ")", "{", "branchesW", ".", "set", "(", "i", ",", "context", ".", "findIdx", "(", "ofs", "+", "branchesW", ".", "get", "(", "i", ")", ")", ")", ";", "}", "break", ";", "case", "BRANCH", ":", "case", "VBRANCH", ":", "i", "=", "(", "(", "Integer", ")", "argValues", "[", "0", "]", ")", ".", "intValue", "(", ")", ";", "argValues", "[", "0", "]", "=", "new", "Integer", "(", "context", ".", "findIdx", "(", "ofs", "+", "i", ")", ")", ";", "break", ";", "default", ":", "// do nothing", "break", ";", "}", "}" ]
Fixup. Turn ofs into idx.
[ "Fixup", ".", "Turn", "ofs", "into", "idx", "." ]
a069b087750c4133bfeebaf1f599c3bc96762113
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/classfile/InstructionType.java#L238-L268
149,652
mlhartme/mork
src/main/java/net/oneandone/mork/scanner/Pages.java
Pages.fillLast
private boolean fillLast() throws IOException { int count; if (lastFilled == pageSize) { throw new IllegalStateException(); } count = src.read(pages[lastNo], lastFilled, pageSize - lastFilled); if (count <= 0) { if (count == 0) { throw new IllegalStateException(); } return false; } lastFilled += count; return true; }
java
private boolean fillLast() throws IOException { int count; if (lastFilled == pageSize) { throw new IllegalStateException(); } count = src.read(pages[lastNo], lastFilled, pageSize - lastFilled); if (count <= 0) { if (count == 0) { throw new IllegalStateException(); } return false; } lastFilled += count; return true; }
[ "private", "boolean", "fillLast", "(", ")", "throws", "IOException", "{", "int", "count", ";", "if", "(", "lastFilled", "==", "pageSize", ")", "{", "throw", "new", "IllegalStateException", "(", ")", ";", "}", "count", "=", "src", ".", "read", "(", "pages", "[", "lastNo", "]", ",", "lastFilled", ",", "pageSize", "-", "lastFilled", ")", ";", "if", "(", "count", "<=", "0", ")", "{", "if", "(", "count", "==", "0", ")", "{", "throw", "new", "IllegalStateException", "(", ")", ";", "}", "return", "false", ";", "}", "lastFilled", "+=", "count", ";", "return", "true", ";", "}" ]
Reads bytes to fill the last page. @return false for eof
[ "Reads", "bytes", "to", "fill", "the", "last", "page", "." ]
a069b087750c4133bfeebaf1f599c3bc96762113
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/scanner/Pages.java#L99-L114
149,653
mlhartme/mork
src/main/java/net/oneandone/mork/scanner/Pages.java
Pages.grow
private void grow() { char[][] newPages; if (lastFilled != pageSize) { throw new IllegalStateException(); } lastNo++; if (lastNo >= pages.length) { newPages = new char[lastNo * 5 / 2][]; System.arraycopy(pages, 0, newPages, 0, lastNo); pages = newPages; } if (pages[lastNo] == null) { pages[lastNo] = new char[pageSize]; } lastFilled = 0; }
java
private void grow() { char[][] newPages; if (lastFilled != pageSize) { throw new IllegalStateException(); } lastNo++; if (lastNo >= pages.length) { newPages = new char[lastNo * 5 / 2][]; System.arraycopy(pages, 0, newPages, 0, lastNo); pages = newPages; } if (pages[lastNo] == null) { pages[lastNo] = new char[pageSize]; } lastFilled = 0; }
[ "private", "void", "grow", "(", ")", "{", "char", "[", "]", "[", "]", "newPages", ";", "if", "(", "lastFilled", "!=", "pageSize", ")", "{", "throw", "new", "IllegalStateException", "(", ")", ";", "}", "lastNo", "++", ";", "if", "(", "lastNo", ">=", "pages", ".", "length", ")", "{", "newPages", "=", "new", "char", "[", "lastNo", "*", "5", "/", "2", "]", "[", "", "]", ";", "System", ".", "arraycopy", "(", "pages", ",", "0", ",", "newPages", ",", "0", ",", "lastNo", ")", ";", "pages", "=", "newPages", ";", "}", "if", "(", "pages", "[", "lastNo", "]", "==", "null", ")", "{", "pages", "[", "lastNo", "]", "=", "new", "char", "[", "pageSize", "]", ";", "}", "lastFilled", "=", "0", ";", "}" ]
Adds a page at the end
[ "Adds", "a", "page", "at", "the", "end" ]
a069b087750c4133bfeebaf1f599c3bc96762113
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/scanner/Pages.java#L117-L133
149,654
mlhartme/mork
src/main/java/net/oneandone/mork/scanner/Pages.java
Pages.shrink
public void shrink(int count) { char[] keepAllocated; if (count == 0) { throw new IllegalArgumentException(); } if (count > lastNo) { throw new IllegalArgumentException(count + " vs " + lastNo); } lastNo -= count; keepAllocated = pages[0]; System.arraycopy(pages, count, pages, 0, lastNo + 1); pages[lastNo + 1] = keepAllocated; for (int i = lastNo + 2; i < pages.length; i++) { pages[i] = null; } }
java
public void shrink(int count) { char[] keepAllocated; if (count == 0) { throw new IllegalArgumentException(); } if (count > lastNo) { throw new IllegalArgumentException(count + " vs " + lastNo); } lastNo -= count; keepAllocated = pages[0]; System.arraycopy(pages, count, pages, 0, lastNo + 1); pages[lastNo + 1] = keepAllocated; for (int i = lastNo + 2; i < pages.length; i++) { pages[i] = null; } }
[ "public", "void", "shrink", "(", "int", "count", ")", "{", "char", "[", "]", "keepAllocated", ";", "if", "(", "count", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "if", "(", "count", ">", "lastNo", ")", "{", "throw", "new", "IllegalArgumentException", "(", "count", "+", "\" vs \"", "+", "lastNo", ")", ";", "}", "lastNo", "-=", "count", ";", "keepAllocated", "=", "pages", "[", "0", "]", ";", "System", ".", "arraycopy", "(", "pages", ",", "count", ",", "pages", ",", "0", ",", "lastNo", "+", "1", ")", ";", "pages", "[", "lastNo", "+", "1", "]", "=", "keepAllocated", ";", "for", "(", "int", "i", "=", "lastNo", "+", "2", ";", "i", "<", "pages", ".", "length", ";", "i", "++", ")", "{", "pages", "[", "i", "]", "=", "null", ";", "}", "}" ]
Remove count pages from the beginning
[ "Remove", "count", "pages", "from", "the", "beginning" ]
a069b087750c4133bfeebaf1f599c3bc96762113
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/scanner/Pages.java#L136-L152
149,655
mlhartme/mork
src/main/java/net/oneandone/mork/scanner/FABuilder.java
FABuilder.run
public static FABuilder run(Rule[] rules, IntBitSet terminals, StringArrayList symbolTable, PrintWriter verbose) throws ActionException { FA alt; int i; Expander expander; FABuilder builder; Label label; RegExpr expanded; Minimizer minimizer; expander = new Expander(rules, symbolTable); builder = new FABuilder(symbolTable); builder.fa = (FA) new Choice().visit(builder); if (verbose != null) { verbose.println("building NFA"); } for (i = 0; i < rules.length; i++) { if (terminals.contains(rules[i].getLeft())) { expanded = (RegExpr) rules[i].getRight().visit(expander); alt = (FA) expanded.visit(builder); label = new Label(rules[i].getLeft()); alt.setEndLabels(label); builder.fa.alternate(alt); } } if (verbose != null) { verbose.println("building DFA"); } builder.fa = DFA.create(builder.fa); if (verbose != null) { verbose.println("complete DFA"); } builder.errorSi = builder.fa.add(null); builder.fa = CompleteFA.create(builder.fa, builder.errorSi); if (verbose != null) { verbose.println("minimized DFA"); } minimizer = new Minimizer(builder.fa); builder.fa = minimizer.run(); builder.errorSi = minimizer.getNewSi(builder.errorSi); builder.inlines = expander.getUsed(); if (builder.fa.isEnd(builder.fa.getStart())) { label = (Label) builder.fa.get(builder.fa.getStart()).getLabel(); throw new ActionException("Scanner accepts the empty word for symbol " + symbolTable.get(label.getSymbol()) + ".\nThis is illegal because it might cause infinite loops when scanning."); } return builder; }
java
public static FABuilder run(Rule[] rules, IntBitSet terminals, StringArrayList symbolTable, PrintWriter verbose) throws ActionException { FA alt; int i; Expander expander; FABuilder builder; Label label; RegExpr expanded; Minimizer minimizer; expander = new Expander(rules, symbolTable); builder = new FABuilder(symbolTable); builder.fa = (FA) new Choice().visit(builder); if (verbose != null) { verbose.println("building NFA"); } for (i = 0; i < rules.length; i++) { if (terminals.contains(rules[i].getLeft())) { expanded = (RegExpr) rules[i].getRight().visit(expander); alt = (FA) expanded.visit(builder); label = new Label(rules[i].getLeft()); alt.setEndLabels(label); builder.fa.alternate(alt); } } if (verbose != null) { verbose.println("building DFA"); } builder.fa = DFA.create(builder.fa); if (verbose != null) { verbose.println("complete DFA"); } builder.errorSi = builder.fa.add(null); builder.fa = CompleteFA.create(builder.fa, builder.errorSi); if (verbose != null) { verbose.println("minimized DFA"); } minimizer = new Minimizer(builder.fa); builder.fa = minimizer.run(); builder.errorSi = minimizer.getNewSi(builder.errorSi); builder.inlines = expander.getUsed(); if (builder.fa.isEnd(builder.fa.getStart())) { label = (Label) builder.fa.get(builder.fa.getStart()).getLabel(); throw new ActionException("Scanner accepts the empty word for symbol " + symbolTable.get(label.getSymbol()) + ".\nThis is illegal because it might cause infinite loops when scanning."); } return builder; }
[ "public", "static", "FABuilder", "run", "(", "Rule", "[", "]", "rules", ",", "IntBitSet", "terminals", ",", "StringArrayList", "symbolTable", ",", "PrintWriter", "verbose", ")", "throws", "ActionException", "{", "FA", "alt", ";", "int", "i", ";", "Expander", "expander", ";", "FABuilder", "builder", ";", "Label", "label", ";", "RegExpr", "expanded", ";", "Minimizer", "minimizer", ";", "expander", "=", "new", "Expander", "(", "rules", ",", "symbolTable", ")", ";", "builder", "=", "new", "FABuilder", "(", "symbolTable", ")", ";", "builder", ".", "fa", "=", "(", "FA", ")", "new", "Choice", "(", ")", ".", "visit", "(", "builder", ")", ";", "if", "(", "verbose", "!=", "null", ")", "{", "verbose", ".", "println", "(", "\"building NFA\"", ")", ";", "}", "for", "(", "i", "=", "0", ";", "i", "<", "rules", ".", "length", ";", "i", "++", ")", "{", "if", "(", "terminals", ".", "contains", "(", "rules", "[", "i", "]", ".", "getLeft", "(", ")", ")", ")", "{", "expanded", "=", "(", "RegExpr", ")", "rules", "[", "i", "]", ".", "getRight", "(", ")", ".", "visit", "(", "expander", ")", ";", "alt", "=", "(", "FA", ")", "expanded", ".", "visit", "(", "builder", ")", ";", "label", "=", "new", "Label", "(", "rules", "[", "i", "]", ".", "getLeft", "(", ")", ")", ";", "alt", ".", "setEndLabels", "(", "label", ")", ";", "builder", ".", "fa", ".", "alternate", "(", "alt", ")", ";", "}", "}", "if", "(", "verbose", "!=", "null", ")", "{", "verbose", ".", "println", "(", "\"building DFA\"", ")", ";", "}", "builder", ".", "fa", "=", "DFA", ".", "create", "(", "builder", ".", "fa", ")", ";", "if", "(", "verbose", "!=", "null", ")", "{", "verbose", ".", "println", "(", "\"complete DFA\"", ")", ";", "}", "builder", ".", "errorSi", "=", "builder", ".", "fa", ".", "add", "(", "null", ")", ";", "builder", ".", "fa", "=", "CompleteFA", ".", "create", "(", "builder", ".", "fa", ",", "builder", ".", "errorSi", ")", ";", "if", "(", "verbose", "!=", "null", ")", "{", "verbose", ".", "println", "(", "\"minimized DFA\"", ")", ";", "}", "minimizer", "=", "new", "Minimizer", "(", "builder", ".", "fa", ")", ";", "builder", ".", "fa", "=", "minimizer", ".", "run", "(", ")", ";", "builder", ".", "errorSi", "=", "minimizer", ".", "getNewSi", "(", "builder", ".", "errorSi", ")", ";", "builder", ".", "inlines", "=", "expander", ".", "getUsed", "(", ")", ";", "if", "(", "builder", ".", "fa", ".", "isEnd", "(", "builder", ".", "fa", ".", "getStart", "(", ")", ")", ")", "{", "label", "=", "(", "Label", ")", "builder", ".", "fa", ".", "get", "(", "builder", ".", "fa", ".", "getStart", "(", ")", ")", ".", "getLabel", "(", ")", ";", "throw", "new", "ActionException", "(", "\"Scanner accepts the empty word for symbol \"", "+", "symbolTable", ".", "get", "(", "label", ".", "getSymbol", "(", ")", ")", "+", "\".\\nThis is illegal because it might cause infinite loops when scanning.\"", ")", ";", "}", "return", "builder", ";", "}" ]
Translates only those rules where the left-hand.side is contained in the specified terminals set. The remaining rules are used for inlining.
[ "Translates", "only", "those", "rules", "where", "the", "left", "-", "hand", ".", "side", "is", "contained", "in", "the", "specified", "terminals", "set", ".", "The", "remaining", "rules", "are", "used", "for", "inlining", "." ]
a069b087750c4133bfeebaf1f599c3bc96762113
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/scanner/FABuilder.java#L35-L82
149,656
Waikato/jclasslocator
src/main/java/nz/ac/waikato/cms/locator/ClassCache.java
ClassCache.getLogger
public synchronized Logger getLogger() { if (m_Logger == null) { m_Logger = Logger.getLogger(getClass().getName()); m_Logger.setLevel(LoggingHelper.getLevel(getClass())); } return m_Logger; }
java
public synchronized Logger getLogger() { if (m_Logger == null) { m_Logger = Logger.getLogger(getClass().getName()); m_Logger.setLevel(LoggingHelper.getLevel(getClass())); } return m_Logger; }
[ "public", "synchronized", "Logger", "getLogger", "(", ")", "{", "if", "(", "m_Logger", "==", "null", ")", "{", "m_Logger", "=", "Logger", ".", "getLogger", "(", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "m_Logger", ".", "setLevel", "(", "LoggingHelper", ".", "getLevel", "(", "getClass", "(", ")", ")", ")", ";", "}", "return", "m_Logger", ";", "}" ]
Returns the logger in use. @return the logger
[ "Returns", "the", "logger", "in", "use", "." ]
c899072fff607a56ee7f8c2d01fbeb15157ad144
https://github.com/Waikato/jclasslocator/blob/c899072fff607a56ee7f8c2d01fbeb15157ad144/src/main/java/nz/ac/waikato/cms/locator/ClassCache.java#L152-L158
149,657
Waikato/jclasslocator
src/main/java/nz/ac/waikato/cms/locator/ClassCache.java
ClassCache.remove
public boolean remove(String classname) { String pkgname; HashSet<String> names; classname = ClassPathTraversal.cleanUp(classname); pkgname = ClassPathTraversal.extractPackage(classname); names = m_NameCache.get(pkgname); if (names != null) return names.remove(classname); else return false; }
java
public boolean remove(String classname) { String pkgname; HashSet<String> names; classname = ClassPathTraversal.cleanUp(classname); pkgname = ClassPathTraversal.extractPackage(classname); names = m_NameCache.get(pkgname); if (names != null) return names.remove(classname); else return false; }
[ "public", "boolean", "remove", "(", "String", "classname", ")", "{", "String", "pkgname", ";", "HashSet", "<", "String", ">", "names", ";", "classname", "=", "ClassPathTraversal", ".", "cleanUp", "(", "classname", ")", ";", "pkgname", "=", "ClassPathTraversal", ".", "extractPackage", "(", "classname", ")", ";", "names", "=", "m_NameCache", ".", "get", "(", "pkgname", ")", ";", "if", "(", "names", "!=", "null", ")", "return", "names", ".", "remove", "(", "classname", ")", ";", "else", "return", "false", ";", "}" ]
Removes the classname from the cache. @param classname the classname to remove @return true if the removal changed the cache
[ "Removes", "the", "classname", "from", "the", "cache", "." ]
c899072fff607a56ee7f8c2d01fbeb15157ad144
https://github.com/Waikato/jclasslocator/blob/c899072fff607a56ee7f8c2d01fbeb15157ad144/src/main/java/nz/ac/waikato/cms/locator/ClassCache.java#L166-L177
149,658
Waikato/jclasslocator
src/main/java/nz/ac/waikato/cms/locator/ClassCache.java
ClassCache.getClassnames
public HashSet<String> getClassnames(String pkgname) { if (m_NameCache.containsKey(pkgname)) return m_NameCache.get(pkgname); else return new HashSet<>(); }
java
public HashSet<String> getClassnames(String pkgname) { if (m_NameCache.containsKey(pkgname)) return m_NameCache.get(pkgname); else return new HashSet<>(); }
[ "public", "HashSet", "<", "String", ">", "getClassnames", "(", "String", "pkgname", ")", "{", "if", "(", "m_NameCache", ".", "containsKey", "(", "pkgname", ")", ")", "return", "m_NameCache", ".", "get", "(", "pkgname", ")", ";", "else", "return", "new", "HashSet", "<>", "(", ")", ";", "}" ]
Returns all the classes for the given package. @param pkgname the package to get the classes for @return the classes (sorted by name)
[ "Returns", "all", "the", "classes", "for", "the", "given", "package", "." ]
c899072fff607a56ee7f8c2d01fbeb15157ad144
https://github.com/Waikato/jclasslocator/blob/c899072fff607a56ee7f8c2d01fbeb15157ad144/src/main/java/nz/ac/waikato/cms/locator/ClassCache.java#L194-L199
149,659
Waikato/jclasslocator
src/main/java/nz/ac/waikato/cms/locator/ClassCache.java
ClassCache.initialize
protected void initialize(ClassTraversal traversal) { Listener listener; listener = new Listener(); traversal.traverse(listener); m_NameCache = listener.getNameCache(); }
java
protected void initialize(ClassTraversal traversal) { Listener listener; listener = new Listener(); traversal.traverse(listener); m_NameCache = listener.getNameCache(); }
[ "protected", "void", "initialize", "(", "ClassTraversal", "traversal", ")", "{", "Listener", "listener", ";", "listener", "=", "new", "Listener", "(", ")", ";", "traversal", ".", "traverse", "(", "listener", ")", ";", "m_NameCache", "=", "listener", ".", "getNameCache", "(", ")", ";", "}" ]
Initializes the cache.
[ "Initializes", "the", "cache", "." ]
c899072fff607a56ee7f8c2d01fbeb15157ad144
https://github.com/Waikato/jclasslocator/blob/c899072fff607a56ee7f8c2d01fbeb15157ad144/src/main/java/nz/ac/waikato/cms/locator/ClassCache.java#L204-L211
149,660
thiagohp/tapestry-url-rewriter
src/main/java/org/apache/tapestry5/services/UrlRewriterModule.java
UrlRewriterModule.contributeRequestHandler
public void contributeRequestHandler( OrderedConfiguration<RequestFilter> configuration, URLRewriter urlRewriter) { // we just need the URLRewriterRequestFilter if we have URL rewriter // rules, of course. if (urlRewriter.hasRequestRules()) { URLRewriterRequestFilter urlRewriterRequestFilter = new URLRewriterRequestFilter( urlRewriter); configuration.add("URLRewriter", urlRewriterRequestFilter, "before:StaticFiles"); } }
java
public void contributeRequestHandler( OrderedConfiguration<RequestFilter> configuration, URLRewriter urlRewriter) { // we just need the URLRewriterRequestFilter if we have URL rewriter // rules, of course. if (urlRewriter.hasRequestRules()) { URLRewriterRequestFilter urlRewriterRequestFilter = new URLRewriterRequestFilter( urlRewriter); configuration.add("URLRewriter", urlRewriterRequestFilter, "before:StaticFiles"); } }
[ "public", "void", "contributeRequestHandler", "(", "OrderedConfiguration", "<", "RequestFilter", ">", "configuration", ",", "URLRewriter", "urlRewriter", ")", "{", "// we just need the URLRewriterRequestFilter if we have URL rewriter", "// rules, of course.", "if", "(", "urlRewriter", ".", "hasRequestRules", "(", ")", ")", "{", "URLRewriterRequestFilter", "urlRewriterRequestFilter", "=", "new", "URLRewriterRequestFilter", "(", "urlRewriter", ")", ";", "configuration", ".", "add", "(", "\"URLRewriter\"", ",", "urlRewriterRequestFilter", ",", "\"before:StaticFiles\"", ")", ";", "}", "}" ]
Contributes the URL rewriter request filter if there are URL rewriter rules. @param configuration an {@link OrderedConfiguration}. @param urlRewriter an {@link URLRewriter}.
[ "Contributes", "the", "URL", "rewriter", "request", "filter", "if", "there", "are", "URL", "rewriter", "rules", "." ]
adec4fe43eb36e75c6ba199abdf7d23db66479ed
https://github.com/thiagohp/tapestry-url-rewriter/blob/adec4fe43eb36e75c6ba199abdf7d23db66479ed/src/main/java/org/apache/tapestry5/services/UrlRewriterModule.java#L36-L50
149,661
bwkimmel/jdcp
jdcp-server-app/src/main/java/ca/eandb/jdcp/server/JobServerMain.java
JobServerMain.main
public static void main(String[] args) throws IOException { Properties props = new Properties(System.getProperties()); props.load(JobServerMain.class.getResourceAsStream("system.properties")); System.setProperties(props); javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { startServer(); } }); }
java
public static void main(String[] args) throws IOException { Properties props = new Properties(System.getProperties()); props.load(JobServerMain.class.getResourceAsStream("system.properties")); System.setProperties(props); javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { startServer(); } }); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "IOException", "{", "Properties", "props", "=", "new", "Properties", "(", "System", ".", "getProperties", "(", ")", ")", ";", "props", ".", "load", "(", "JobServerMain", ".", "class", ".", "getResourceAsStream", "(", "\"system.properties\"", ")", ")", ";", "System", ".", "setProperties", "(", "props", ")", ";", "javax", ".", "swing", ".", "SwingUtilities", ".", "invokeLater", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "startServer", "(", ")", ";", "}", "}", ")", ";", "}" ]
Runs the JDCP server application. @param args Command line arguments. @throws IOException if an I/O error occurs while running the application
[ "Runs", "the", "JDCP", "server", "application", "." ]
630c5150c245054e2556ff370f4bad2ec793dfb7
https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-server-app/src/main/java/ca/eandb/jdcp/server/JobServerMain.java#L62-L71
149,662
bwkimmel/jdcp
jdcp-server-app/src/main/java/ca/eandb/jdcp/server/JobServerMain.java
JobServerMain.startServer
private static void startServer() { try { JdcpUtil.initialize(); Class.forName("org.apache.derby.jdbc.EmbeddedDriver"); EmbeddedDataSource ds = new EmbeddedDataSource(); ds.setConnectionAttributes("create=true"); ds.setDatabaseName("classes"); System.err.print("Initializing progress monitor..."); ProgressPanel panel = new ProgressPanel(); panel.setPreferredSize(new Dimension(500, 350)); System.err.println("OK"); System.err.print("Initializing folders..."); Preferences pref = Preferences .userNodeForPackage(JobServer.class); String path = pref.get("rootDirectory", "./server"); File rootDirectory = new File(path); File jobsDirectory = new File(rootDirectory, "jobs"); rootDirectory.mkdir(); jobsDirectory.mkdir(); System.err.println("OK"); System.err.print("Initializing service..."); DbClassManager classManager = new DbClassManager(ds); classManager.prepareDataSource(); TaskScheduler scheduler = new PrioritySerialTaskScheduler(); Executor executor = Executors.newCachedThreadPool(); JobServer jobServer = new JobServer(jobsDirectory, panel, scheduler, classManager, executor); AuthenticationServer authServer = new AuthenticationServer(jobServer, JdcpUtil.DEFAULT_PORT); System.err.println("OK"); System.err.print("Exporting service stubs..."); // JobService jobStub = (JobService) UnicastRemoteObject.exportObject( // jobServer, 0); System.err.println("OK"); System.err.print("Binding service..."); final Registry registry = LocateRegistry.createRegistry(JdcpUtil.DEFAULT_PORT); registry.bind("AuthenticationService", authServer); System.err.println("OK"); System.err.println("Server ready"); JFrame frame = new JFrame("JDCP Server"); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.getContentPane().add(panel); frame.pack(); frame.addWindowListener(new WindowAdapter() { public void windowClosed(WindowEvent event) { System.err.print("Shutting down..."); try { registry.unbind("AuthenticationService"); System.err.println("OK"); } catch (Exception e) { e.printStackTrace(); } System.exit(0); } }); frame.setVisible(true); } catch (Exception e) { System.err.println("Server exception:"); e.printStackTrace(); } }
java
private static void startServer() { try { JdcpUtil.initialize(); Class.forName("org.apache.derby.jdbc.EmbeddedDriver"); EmbeddedDataSource ds = new EmbeddedDataSource(); ds.setConnectionAttributes("create=true"); ds.setDatabaseName("classes"); System.err.print("Initializing progress monitor..."); ProgressPanel panel = new ProgressPanel(); panel.setPreferredSize(new Dimension(500, 350)); System.err.println("OK"); System.err.print("Initializing folders..."); Preferences pref = Preferences .userNodeForPackage(JobServer.class); String path = pref.get("rootDirectory", "./server"); File rootDirectory = new File(path); File jobsDirectory = new File(rootDirectory, "jobs"); rootDirectory.mkdir(); jobsDirectory.mkdir(); System.err.println("OK"); System.err.print("Initializing service..."); DbClassManager classManager = new DbClassManager(ds); classManager.prepareDataSource(); TaskScheduler scheduler = new PrioritySerialTaskScheduler(); Executor executor = Executors.newCachedThreadPool(); JobServer jobServer = new JobServer(jobsDirectory, panel, scheduler, classManager, executor); AuthenticationServer authServer = new AuthenticationServer(jobServer, JdcpUtil.DEFAULT_PORT); System.err.println("OK"); System.err.print("Exporting service stubs..."); // JobService jobStub = (JobService) UnicastRemoteObject.exportObject( // jobServer, 0); System.err.println("OK"); System.err.print("Binding service..."); final Registry registry = LocateRegistry.createRegistry(JdcpUtil.DEFAULT_PORT); registry.bind("AuthenticationService", authServer); System.err.println("OK"); System.err.println("Server ready"); JFrame frame = new JFrame("JDCP Server"); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.getContentPane().add(panel); frame.pack(); frame.addWindowListener(new WindowAdapter() { public void windowClosed(WindowEvent event) { System.err.print("Shutting down..."); try { registry.unbind("AuthenticationService"); System.err.println("OK"); } catch (Exception e) { e.printStackTrace(); } System.exit(0); } }); frame.setVisible(true); } catch (Exception e) { System.err.println("Server exception:"); e.printStackTrace(); } }
[ "private", "static", "void", "startServer", "(", ")", "{", "try", "{", "JdcpUtil", ".", "initialize", "(", ")", ";", "Class", ".", "forName", "(", "\"org.apache.derby.jdbc.EmbeddedDriver\"", ")", ";", "EmbeddedDataSource", "ds", "=", "new", "EmbeddedDataSource", "(", ")", ";", "ds", ".", "setConnectionAttributes", "(", "\"create=true\"", ")", ";", "ds", ".", "setDatabaseName", "(", "\"classes\"", ")", ";", "System", ".", "err", ".", "print", "(", "\"Initializing progress monitor...\"", ")", ";", "ProgressPanel", "panel", "=", "new", "ProgressPanel", "(", ")", ";", "panel", ".", "setPreferredSize", "(", "new", "Dimension", "(", "500", ",", "350", ")", ")", ";", "System", ".", "err", ".", "println", "(", "\"OK\"", ")", ";", "System", ".", "err", ".", "print", "(", "\"Initializing folders...\"", ")", ";", "Preferences", "pref", "=", "Preferences", ".", "userNodeForPackage", "(", "JobServer", ".", "class", ")", ";", "String", "path", "=", "pref", ".", "get", "(", "\"rootDirectory\"", ",", "\"./server\"", ")", ";", "File", "rootDirectory", "=", "new", "File", "(", "path", ")", ";", "File", "jobsDirectory", "=", "new", "File", "(", "rootDirectory", ",", "\"jobs\"", ")", ";", "rootDirectory", ".", "mkdir", "(", ")", ";", "jobsDirectory", ".", "mkdir", "(", ")", ";", "System", ".", "err", ".", "println", "(", "\"OK\"", ")", ";", "System", ".", "err", ".", "print", "(", "\"Initializing service...\"", ")", ";", "DbClassManager", "classManager", "=", "new", "DbClassManager", "(", "ds", ")", ";", "classManager", ".", "prepareDataSource", "(", ")", ";", "TaskScheduler", "scheduler", "=", "new", "PrioritySerialTaskScheduler", "(", ")", ";", "Executor", "executor", "=", "Executors", ".", "newCachedThreadPool", "(", ")", ";", "JobServer", "jobServer", "=", "new", "JobServer", "(", "jobsDirectory", ",", "panel", ",", "scheduler", ",", "classManager", ",", "executor", ")", ";", "AuthenticationServer", "authServer", "=", "new", "AuthenticationServer", "(", "jobServer", ",", "JdcpUtil", ".", "DEFAULT_PORT", ")", ";", "System", ".", "err", ".", "println", "(", "\"OK\"", ")", ";", "System", ".", "err", ".", "print", "(", "\"Exporting service stubs...\"", ")", ";", "// JobService jobStub = (JobService) UnicastRemoteObject.exportObject(", "// jobServer, 0);", "System", ".", "err", ".", "println", "(", "\"OK\"", ")", ";", "System", ".", "err", ".", "print", "(", "\"Binding service...\"", ")", ";", "final", "Registry", "registry", "=", "LocateRegistry", ".", "createRegistry", "(", "JdcpUtil", ".", "DEFAULT_PORT", ")", ";", "registry", ".", "bind", "(", "\"AuthenticationService\"", ",", "authServer", ")", ";", "System", ".", "err", ".", "println", "(", "\"OK\"", ")", ";", "System", ".", "err", ".", "println", "(", "\"Server ready\"", ")", ";", "JFrame", "frame", "=", "new", "JFrame", "(", "\"JDCP Server\"", ")", ";", "frame", ".", "setDefaultCloseOperation", "(", "JFrame", ".", "DISPOSE_ON_CLOSE", ")", ";", "frame", ".", "getContentPane", "(", ")", ".", "add", "(", "panel", ")", ";", "frame", ".", "pack", "(", ")", ";", "frame", ".", "addWindowListener", "(", "new", "WindowAdapter", "(", ")", "{", "public", "void", "windowClosed", "(", "WindowEvent", "event", ")", "{", "System", ".", "err", ".", "print", "(", "\"Shutting down...\"", ")", ";", "try", "{", "registry", ".", "unbind", "(", "\"AuthenticationService\"", ")", ";", "System", ".", "err", ".", "println", "(", "\"OK\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "System", ".", "exit", "(", "0", ")", ";", "}", "}", ")", ";", "frame", ".", "setVisible", "(", "true", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"Server exception:\"", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
Starts the JDCP server.
[ "Starts", "the", "JDCP", "server", "." ]
630c5150c245054e2556ff370f4bad2ec793dfb7
https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-server-app/src/main/java/ca/eandb/jdcp/server/JobServerMain.java#L76-L153
149,663
eurekaclinical/javautil
src/main/java/org/arp/javautil/stat/UpdatingVarCalc.java
UpdatingVarCalc.addValue
public void addValue(double val) { numItems++; double valMinusMean = val - mean; sumsq += valMinusMean * valMinusMean * (numItems - 1) / numItems; mean += valMinusMean / numItems; }
java
public void addValue(double val) { numItems++; double valMinusMean = val - mean; sumsq += valMinusMean * valMinusMean * (numItems - 1) / numItems; mean += valMinusMean / numItems; }
[ "public", "void", "addValue", "(", "double", "val", ")", "{", "numItems", "++", ";", "double", "valMinusMean", "=", "val", "-", "mean", ";", "sumsq", "+=", "valMinusMean", "*", "valMinusMean", "*", "(", "numItems", "-", "1", ")", "/", "numItems", ";", "mean", "+=", "valMinusMean", "/", "numItems", ";", "}" ]
Update the variance with a new value. @param val a new value.
[ "Update", "the", "variance", "with", "a", "new", "value", "." ]
779bbc5bf096c75f8eed4f99ca45b99c1d44df43
https://github.com/eurekaclinical/javautil/blob/779bbc5bf096c75f8eed4f99ca45b99c1d44df43/src/main/java/org/arp/javautil/stat/UpdatingVarCalc.java#L53-L58
149,664
vikingbrain/thedavidbox-client4j
src/main/java/com/vikingbrain/nmt/operations/TheDavidboxOperationFactory.java
TheDavidboxOperationFactory.execute
protected <T extends DavidBoxResponse> T execute(DavidBoxOperation operation, Class<T> responseTargetClass) throws TheDavidBoxClientException{ //Build the additional http arguments for the operation if there is additioanl http parameters LinkedHashMap<String, String> operationArguments = operation.buildHttpArguments(); // Build the get request with the arguments String urlGet = remoteHttpService.buildGetRequest(remoteHost, operation.getOperationType(), operationArguments); T responseObject = sendAndParse(urlGet, responseTargetClass); return responseObject; }
java
protected <T extends DavidBoxResponse> T execute(DavidBoxOperation operation, Class<T> responseTargetClass) throws TheDavidBoxClientException{ //Build the additional http arguments for the operation if there is additioanl http parameters LinkedHashMap<String, String> operationArguments = operation.buildHttpArguments(); // Build the get request with the arguments String urlGet = remoteHttpService.buildGetRequest(remoteHost, operation.getOperationType(), operationArguments); T responseObject = sendAndParse(urlGet, responseTargetClass); return responseObject; }
[ "protected", "<", "T", "extends", "DavidBoxResponse", ">", "T", "execute", "(", "DavidBoxOperation", "operation", ",", "Class", "<", "T", ">", "responseTargetClass", ")", "throws", "TheDavidBoxClientException", "{", "//Build the additional http arguments for the operation if there is additioanl http parameters\r", "LinkedHashMap", "<", "String", ",", "String", ">", "operationArguments", "=", "operation", ".", "buildHttpArguments", "(", ")", ";", "// Build the get request with the arguments\r", "String", "urlGet", "=", "remoteHttpService", ".", "buildGetRequest", "(", "remoteHost", ",", "operation", ".", "getOperationType", "(", ")", ",", "operationArguments", ")", ";", "T", "responseObject", "=", "sendAndParse", "(", "urlGet", ",", "responseTargetClass", ")", ";", "return", "responseObject", ";", "}" ]
It executes a davidbox operation. Builds the http get request, sends, receive and fit the response in the response target object @param operation the davidbox operation @param responseTargetClass the response target class @return the response object with the result of the operation @throws TheDavidBoxClientException exception in the client
[ "It", "executes", "a", "davidbox", "operation", ".", "Builds", "the", "http", "get", "request", "sends", "receive", "and", "fit", "the", "response", "in", "the", "response", "target", "object" ]
b2375a59b30fc3bd5dae34316bda68e01d006535
https://github.com/vikingbrain/thedavidbox-client4j/blob/b2375a59b30fc3bd5dae34316bda68e01d006535/src/main/java/com/vikingbrain/nmt/operations/TheDavidboxOperationFactory.java#L92-L101
149,665
vikingbrain/thedavidbox-client4j
src/main/java/com/vikingbrain/nmt/operations/TheDavidboxOperationFactory.java
TheDavidboxOperationFactory.sendAndParse
private <T extends DavidBoxResponse> T sendAndParse(String urlGet, Class<T> responseTargetClass) throws TheDavidBoxClientException{ logger.debug("urlGet: " + urlGet); //Notify the listener about the request notifyRequest(urlGet); // Call the davidbox service to get the xml response String xmlResponse = ""; try { xmlResponse = getRemoteHttpService().sendGetRequest(urlGet); } catch (TheDavidBoxClientException e1) { throw new TheDavidBoxClientException(e1, urlGet, xmlResponse); } //Notify the listener about the response notifyResponse(xmlResponse); // Parse the response into a business object T responseObject = null; try { responseObject = getDavidBoxPaser().parse(responseTargetClass, xmlResponse); } catch (TheDavidBoxClientException e2) { throw new TheDavidBoxClientException(e2, urlGet, xmlResponse); } return responseObject; }
java
private <T extends DavidBoxResponse> T sendAndParse(String urlGet, Class<T> responseTargetClass) throws TheDavidBoxClientException{ logger.debug("urlGet: " + urlGet); //Notify the listener about the request notifyRequest(urlGet); // Call the davidbox service to get the xml response String xmlResponse = ""; try { xmlResponse = getRemoteHttpService().sendGetRequest(urlGet); } catch (TheDavidBoxClientException e1) { throw new TheDavidBoxClientException(e1, urlGet, xmlResponse); } //Notify the listener about the response notifyResponse(xmlResponse); // Parse the response into a business object T responseObject = null; try { responseObject = getDavidBoxPaser().parse(responseTargetClass, xmlResponse); } catch (TheDavidBoxClientException e2) { throw new TheDavidBoxClientException(e2, urlGet, xmlResponse); } return responseObject; }
[ "private", "<", "T", "extends", "DavidBoxResponse", ">", "T", "sendAndParse", "(", "String", "urlGet", ",", "Class", "<", "T", ">", "responseTargetClass", ")", "throws", "TheDavidBoxClientException", "{", "logger", ".", "debug", "(", "\"urlGet: \"", "+", "urlGet", ")", ";", "//Notify the listener about the request\r", "notifyRequest", "(", "urlGet", ")", ";", "// Call the davidbox service to get the xml response\r", "String", "xmlResponse", "=", "\"\"", ";", "try", "{", "xmlResponse", "=", "getRemoteHttpService", "(", ")", ".", "sendGetRequest", "(", "urlGet", ")", ";", "}", "catch", "(", "TheDavidBoxClientException", "e1", ")", "{", "throw", "new", "TheDavidBoxClientException", "(", "e1", ",", "urlGet", ",", "xmlResponse", ")", ";", "}", "//Notify the listener about the response\r", "notifyResponse", "(", "xmlResponse", ")", ";", "// Parse the response into a business object\r", "T", "responseObject", "=", "null", ";", "try", "{", "responseObject", "=", "getDavidBoxPaser", "(", ")", ".", "parse", "(", "responseTargetClass", ",", "xmlResponse", ")", ";", "}", "catch", "(", "TheDavidBoxClientException", "e2", ")", "{", "throw", "new", "TheDavidBoxClientException", "(", "e2", ",", "urlGet", ",", "xmlResponse", ")", ";", "}", "return", "responseObject", ";", "}" ]
It sends the url get to the service and parse the response in the desired response target class. @param urlGet the url to send to the service @param responseTargetClass the response target class @return the response object filled with the xml result @throws TheDavidBoxClientException exception in the client
[ "It", "sends", "the", "url", "get", "to", "the", "service", "and", "parse", "the", "response", "in", "the", "desired", "response", "target", "class", "." ]
b2375a59b30fc3bd5dae34316bda68e01d006535
https://github.com/vikingbrain/thedavidbox-client4j/blob/b2375a59b30fc3bd5dae34316bda68e01d006535/src/main/java/com/vikingbrain/nmt/operations/TheDavidboxOperationFactory.java#L110-L137
149,666
Metrink/croquet
croquet-core/src/main/java/com/metrink/croquet/CroquetRest.java
CroquetRest.getPUNameProvider
protected Provider<String> getPUNameProvider() { final String puName = settings.getDatabaseSettings().getPersistenceUnit(); return Providers.<String>of(puName == null ? "croquet" : puName); }
java
protected Provider<String> getPUNameProvider() { final String puName = settings.getDatabaseSettings().getPersistenceUnit(); return Providers.<String>of(puName == null ? "croquet" : puName); }
[ "protected", "Provider", "<", "String", ">", "getPUNameProvider", "(", ")", "{", "final", "String", "puName", "=", "settings", ".", "getDatabaseSettings", "(", ")", ".", "getPersistenceUnit", "(", ")", ";", "return", "Providers", ".", "<", "String", ">", "of", "(", "puName", "==", "null", "?", "\"croquet\"", ":", "puName", ")", ";", "}" ]
Provides the name of the persistence unit. @return the name of the persistence unit.
[ "Provides", "the", "name", "of", "the", "persistence", "unit", "." ]
1b0ed1327a104cf1f809ce4c3c5bf30a3d95384b
https://github.com/Metrink/croquet/blob/1b0ed1327a104cf1f809ce4c3c5bf30a3d95384b/croquet-core/src/main/java/com/metrink/croquet/CroquetRest.java#L144-L148
149,667
Metrink/croquet
croquet-core/src/main/java/com/metrink/croquet/CroquetRest.java
CroquetRest.createAndStartModules
protected List<ManagedModule> createAndStartModules() { final List<ManagedModule> managedModuleInstances = new ArrayList<>(); // create and start each managed module for(final Class<? extends ManagedModule> module:managedModules) { final ManagedModule mm = injector.getInstance(module); managedModuleInstances.add(mm); mm.start(); } return managedModuleInstances; }
java
protected List<ManagedModule> createAndStartModules() { final List<ManagedModule> managedModuleInstances = new ArrayList<>(); // create and start each managed module for(final Class<? extends ManagedModule> module:managedModules) { final ManagedModule mm = injector.getInstance(module); managedModuleInstances.add(mm); mm.start(); } return managedModuleInstances; }
[ "protected", "List", "<", "ManagedModule", ">", "createAndStartModules", "(", ")", "{", "final", "List", "<", "ManagedModule", ">", "managedModuleInstances", "=", "new", "ArrayList", "<>", "(", ")", ";", "// create and start each managed module", "for", "(", "final", "Class", "<", "?", "extends", "ManagedModule", ">", "module", ":", "managedModules", ")", "{", "final", "ManagedModule", "mm", "=", "injector", ".", "getInstance", "(", "module", ")", ";", "managedModuleInstances", ".", "add", "(", "mm", ")", ";", "mm", ".", "start", "(", ")", ";", "}", "return", "managedModuleInstances", ";", "}" ]
Creates and starts all the managed modules. @return a list of the managed module instances.
[ "Creates", "and", "starts", "all", "the", "managed", "modules", "." ]
1b0ed1327a104cf1f809ce4c3c5bf30a3d95384b
https://github.com/Metrink/croquet/blob/1b0ed1327a104cf1f809ce4c3c5bf30a3d95384b/croquet-core/src/main/java/com/metrink/croquet/CroquetRest.java#L170-L181
149,668
Metrink/croquet
croquet-core/src/main/java/com/metrink/croquet/CroquetRest.java
CroquetRest.run
@SuppressFBWarnings("DM_EXIT") public void run() { status = CroquetStatus.STARTING; // create the injector createInjector(); // configure the Jetty server jettyServer = configureJetty(settings.getPort()); // add a life-cycle listener to remove drop the PID jettyServer.addLifeCycleListener(new AbstractLifeCycleListener() { @Override public void lifeCycleStarted(final LifeCycle event) { final String pidFile = settings.getPidFile(); // when a pid-file is configured, drop it upon successfully binding to the port. if (pidFile != null) { LOG.info("Dropping PID file: {}", pidFile); // the PidManager will automatically remove the pid file on shutdown new PidManager(pidFile).dropPidOrDie(); } else { LOG.warn("No PID file specified, so not file will be dropped. " + "Set a file via code or in the config file to drop a pid file."); } } }); // start the server try { jettyServer.start(); //CHECKSTYLE:OFF the only exception that is thrown } catch (final Exception e) { //CHECKSTYLE:ON LOG.error("Error starting Jetty: {}", e.getMessage(), e); System.err.println("Error starting Jetty: " + e.getMessage()); System.exit(-1); throw new RuntimeException(e); // throw this so the whole app stops } // create and start the modules final List<ManagedModule> managedModuleInstances = createAndStartModules(); // install the shutdown hook Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { status = CroquetStatus.STOPPING; try { jettyServer.stop(); //CHECKSTYLE:OFF the only exception that is thrown } catch (final Exception e) { //CHECKSTYLE:ON LOG.error("Error stopping Jetty: {}", e.getMessage(), e); } // go through the modules stopping them for(final ManagedModule module:managedModuleInstances) { module.stop(); } status = CroquetStatus.STOPPED; LOG.info("Croquet has stopped"); } }); status = CroquetStatus.RUNNING; LOG.info("Croquet is running on port {}", settings.getPort()); }
java
@SuppressFBWarnings("DM_EXIT") public void run() { status = CroquetStatus.STARTING; // create the injector createInjector(); // configure the Jetty server jettyServer = configureJetty(settings.getPort()); // add a life-cycle listener to remove drop the PID jettyServer.addLifeCycleListener(new AbstractLifeCycleListener() { @Override public void lifeCycleStarted(final LifeCycle event) { final String pidFile = settings.getPidFile(); // when a pid-file is configured, drop it upon successfully binding to the port. if (pidFile != null) { LOG.info("Dropping PID file: {}", pidFile); // the PidManager will automatically remove the pid file on shutdown new PidManager(pidFile).dropPidOrDie(); } else { LOG.warn("No PID file specified, so not file will be dropped. " + "Set a file via code or in the config file to drop a pid file."); } } }); // start the server try { jettyServer.start(); //CHECKSTYLE:OFF the only exception that is thrown } catch (final Exception e) { //CHECKSTYLE:ON LOG.error("Error starting Jetty: {}", e.getMessage(), e); System.err.println("Error starting Jetty: " + e.getMessage()); System.exit(-1); throw new RuntimeException(e); // throw this so the whole app stops } // create and start the modules final List<ManagedModule> managedModuleInstances = createAndStartModules(); // install the shutdown hook Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { status = CroquetStatus.STOPPING; try { jettyServer.stop(); //CHECKSTYLE:OFF the only exception that is thrown } catch (final Exception e) { //CHECKSTYLE:ON LOG.error("Error stopping Jetty: {}", e.getMessage(), e); } // go through the modules stopping them for(final ManagedModule module:managedModuleInstances) { module.stop(); } status = CroquetStatus.STOPPED; LOG.info("Croquet has stopped"); } }); status = CroquetStatus.RUNNING; LOG.info("Croquet is running on port {}", settings.getPort()); }
[ "@", "SuppressFBWarnings", "(", "\"DM_EXIT\"", ")", "public", "void", "run", "(", ")", "{", "status", "=", "CroquetStatus", ".", "STARTING", ";", "// create the injector", "createInjector", "(", ")", ";", "// configure the Jetty server", "jettyServer", "=", "configureJetty", "(", "settings", ".", "getPort", "(", ")", ")", ";", "// add a life-cycle listener to remove drop the PID", "jettyServer", ".", "addLifeCycleListener", "(", "new", "AbstractLifeCycleListener", "(", ")", "{", "@", "Override", "public", "void", "lifeCycleStarted", "(", "final", "LifeCycle", "event", ")", "{", "final", "String", "pidFile", "=", "settings", ".", "getPidFile", "(", ")", ";", "// when a pid-file is configured, drop it upon successfully binding to the port.", "if", "(", "pidFile", "!=", "null", ")", "{", "LOG", ".", "info", "(", "\"Dropping PID file: {}\"", ",", "pidFile", ")", ";", "// the PidManager will automatically remove the pid file on shutdown", "new", "PidManager", "(", "pidFile", ")", ".", "dropPidOrDie", "(", ")", ";", "}", "else", "{", "LOG", ".", "warn", "(", "\"No PID file specified, so not file will be dropped. \"", "+", "\"Set a file via code or in the config file to drop a pid file.\"", ")", ";", "}", "}", "}", ")", ";", "// start the server", "try", "{", "jettyServer", ".", "start", "(", ")", ";", "//CHECKSTYLE:OFF the only exception that is thrown", "}", "catch", "(", "final", "Exception", "e", ")", "{", "//CHECKSTYLE:ON", "LOG", ".", "error", "(", "\"Error starting Jetty: {}\"", ",", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "System", ".", "err", ".", "println", "(", "\"Error starting Jetty: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "System", ".", "exit", "(", "-", "1", ")", ";", "throw", "new", "RuntimeException", "(", "e", ")", ";", "// throw this so the whole app stops", "}", "// create and start the modules", "final", "List", "<", "ManagedModule", ">", "managedModuleInstances", "=", "createAndStartModules", "(", ")", ";", "// install the shutdown hook", "Runtime", ".", "getRuntime", "(", ")", ".", "addShutdownHook", "(", "new", "Thread", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "status", "=", "CroquetStatus", ".", "STOPPING", ";", "try", "{", "jettyServer", ".", "stop", "(", ")", ";", "//CHECKSTYLE:OFF the only exception that is thrown", "}", "catch", "(", "final", "Exception", "e", ")", "{", "//CHECKSTYLE:ON", "LOG", ".", "error", "(", "\"Error stopping Jetty: {}\"", ",", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "// go through the modules stopping them", "for", "(", "final", "ManagedModule", "module", ":", "managedModuleInstances", ")", "{", "module", ".", "stop", "(", ")", ";", "}", "status", "=", "CroquetStatus", ".", "STOPPED", ";", "LOG", ".", "info", "(", "\"Croquet has stopped\"", ")", ";", "}", "}", ")", ";", "status", "=", "CroquetStatus", ".", "RUNNING", ";", "LOG", ".", "info", "(", "\"Croquet is running on port {}\"", ",", "settings", ".", "getPort", "(", ")", ")", ";", "}" ]
Starts the Croquet framework.
[ "Starts", "the", "Croquet", "framework", "." ]
1b0ed1327a104cf1f809ce4c3c5bf30a3d95384b
https://github.com/Metrink/croquet/blob/1b0ed1327a104cf1f809ce4c3c5bf30a3d95384b/croquet-core/src/main/java/com/metrink/croquet/CroquetRest.java#L211-L287
149,669
seedstack/audit-addon
specs/src/main/java/org/seedstack/audit/AuditEvent.java
AuditEvent.getFormattedDate
public String getFormattedDate(String format) { SimpleDateFormat dateFormat = new SimpleDateFormat(format); return dateFormat.format(date); }
java
public String getFormattedDate(String format) { SimpleDateFormat dateFormat = new SimpleDateFormat(format); return dateFormat.format(date); }
[ "public", "String", "getFormattedDate", "(", "String", "format", ")", "{", "SimpleDateFormat", "dateFormat", "=", "new", "SimpleDateFormat", "(", "format", ")", ";", "return", "dateFormat", ".", "format", "(", "date", ")", ";", "}" ]
Formats the date of the event with the given format @param format the format @return the formatted date
[ "Formats", "the", "date", "of", "the", "event", "with", "the", "given", "format" ]
a2a91da236727eecd9fcc3df328ae2081cfe115b
https://github.com/seedstack/audit-addon/blob/a2a91da236727eecd9fcc3df328ae2081cfe115b/specs/src/main/java/org/seedstack/audit/AuditEvent.java#L56-L59
149,670
agmip/dome
src/main/java/org/agmip/dome/Command.java
Command.getPathOr
public static String getPathOr(String var, String def) { String path = AcePathfinder.INSTANCE.getPath(var); if (path == null) { path = def; } return path; }
java
public static String getPathOr(String var, String def) { String path = AcePathfinder.INSTANCE.getPath(var); if (path == null) { path = def; } return path; }
[ "public", "static", "String", "getPathOr", "(", "String", "var", ",", "String", "def", ")", "{", "String", "path", "=", "AcePathfinder", ".", "INSTANCE", ".", "getPath", "(", "var", ")", ";", "if", "(", "path", "==", "null", ")", "{", "path", "=", "def", ";", "}", "return", "path", ";", "}" ]
Get a valid path from the pathfiner, or if not found, a user-specified path.
[ "Get", "a", "valid", "path", "from", "the", "pathfiner", "or", "if", "not", "found", "a", "user", "-", "specified", "path", "." ]
ca7c15bf2bae09bb7e8d51160e77592bbda9343d
https://github.com/agmip/dome/blob/ca7c15bf2bae09bb7e8d51160e77592bbda9343d/src/main/java/org/agmip/dome/Command.java#L115-L121
149,671
leadware/jpersistence-tools
jpersistence-tools-api/src/main/java/net/leadware/persistence/tools/api/utils/OrderContainer.java
OrderContainer.add
public OrderContainer add(String property, OrderType orderType) { // Si la ppt est nulle if(property == null || property.trim().length() == 0) return this; // Si le Type d'ordre est null if(orderType == null) return this; // Ajout orders.put(property.trim(), orderType); // On retourne le conteneur return this; }
java
public OrderContainer add(String property, OrderType orderType) { // Si la ppt est nulle if(property == null || property.trim().length() == 0) return this; // Si le Type d'ordre est null if(orderType == null) return this; // Ajout orders.put(property.trim(), orderType); // On retourne le conteneur return this; }
[ "public", "OrderContainer", "add", "(", "String", "property", ",", "OrderType", "orderType", ")", "{", "// Si la ppt est nulle\r", "if", "(", "property", "==", "null", "||", "property", ".", "trim", "(", ")", ".", "length", "(", ")", "==", "0", ")", "return", "this", ";", "// Si le Type d'ordre est null\r", "if", "(", "orderType", "==", "null", ")", "return", "this", ";", "// Ajout\r", "orders", ".", "put", "(", "property", ".", "trim", "(", ")", ",", "orderType", ")", ";", "// On retourne le conteneur\r", "return", "this", ";", "}" ]
Methode d'ajout d'un ordre de tri @param property Propriete a ordonner @param orderType Type d'ordre @return Conteneur d'ordre de tri
[ "Methode", "d", "ajout", "d", "un", "ordre", "de", "tri" ]
4c15372993584579d7dbb9b23dd4c0c0fdc9e789
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-api/src/main/java/net/leadware/persistence/tools/api/utils/OrderContainer.java#L62-L75
149,672
Waikato/jclasslocator
src/main/java/nz/ac/waikato/cms/locator/ClassPathTraversal.java
ClassPathTraversal.traverse
public void traverse(String classname, TraversalState state) { classname = cleanUp(classname); state.getListener().traversing(classname, state.getURL()); }
java
public void traverse(String classname, TraversalState state) { classname = cleanUp(classname); state.getListener().traversing(classname, state.getURL()); }
[ "public", "void", "traverse", "(", "String", "classname", ",", "TraversalState", "state", ")", "{", "classname", "=", "cleanUp", "(", "classname", ")", ";", "state", ".", "getListener", "(", ")", ".", "traversing", "(", "classname", ",", "state", ".", "getURL", "(", ")", ")", ";", "}" ]
Traverses the class, calls the listener available through the state. @param classname the classname, automatically removes ".class" and turns "/" or "\" into "." @param state the traversal state
[ "Traverses", "the", "class", "calls", "the", "listener", "available", "through", "the", "state", "." ]
c899072fff607a56ee7f8c2d01fbeb15157ad144
https://github.com/Waikato/jclasslocator/blob/c899072fff607a56ee7f8c2d01fbeb15157ad144/src/main/java/nz/ac/waikato/cms/locator/ClassPathTraversal.java#L148-L151
149,673
Waikato/jclasslocator
src/main/java/nz/ac/waikato/cms/locator/ClassPathTraversal.java
ClassPathTraversal.traverseManifest
protected void traverseManifest(Manifest manifest, TraversalState state) { Attributes atts; String cp; String[] parts; if (manifest == null) return; atts = manifest.getMainAttributes(); cp = atts.getValue("Class-Path"); if (cp == null) return; parts = cp.split(" "); for (String part: parts) { if (part.trim().length() == 0) return; if (part.toLowerCase().endsWith(".jar") || !part.equals(".")) traverseClasspathPart(part, state); } }
java
protected void traverseManifest(Manifest manifest, TraversalState state) { Attributes atts; String cp; String[] parts; if (manifest == null) return; atts = manifest.getMainAttributes(); cp = atts.getValue("Class-Path"); if (cp == null) return; parts = cp.split(" "); for (String part: parts) { if (part.trim().length() == 0) return; if (part.toLowerCase().endsWith(".jar") || !part.equals(".")) traverseClasspathPart(part, state); } }
[ "protected", "void", "traverseManifest", "(", "Manifest", "manifest", ",", "TraversalState", "state", ")", "{", "Attributes", "atts", ";", "String", "cp", ";", "String", "[", "]", "parts", ";", "if", "(", "manifest", "==", "null", ")", "return", ";", "atts", "=", "manifest", ".", "getMainAttributes", "(", ")", ";", "cp", "=", "atts", ".", "getValue", "(", "\"Class-Path\"", ")", ";", "if", "(", "cp", "==", "null", ")", "return", ";", "parts", "=", "cp", ".", "split", "(", "\" \"", ")", ";", "for", "(", "String", "part", ":", "parts", ")", "{", "if", "(", "part", ".", "trim", "(", ")", ".", "length", "(", ")", "==", "0", ")", "return", ";", "if", "(", "part", ".", "toLowerCase", "(", ")", ".", "endsWith", "(", "\".jar\"", ")", "||", "!", "part", ".", "equals", "(", "\".\"", ")", ")", "traverseClasspathPart", "(", "part", ",", "state", ")", ";", "}", "}" ]
Analyzes the MANIFEST.MF file of a jar whether additional jars are listed in the "Class-Path" key. @param manifest the manifest to analyze @param state the traversal state
[ "Analyzes", "the", "MANIFEST", ".", "MF", "file", "of", "a", "jar", "whether", "additional", "jars", "are", "listed", "in", "the", "Class", "-", "Path", "key", "." ]
c899072fff607a56ee7f8c2d01fbeb15157ad144
https://github.com/Waikato/jclasslocator/blob/c899072fff607a56ee7f8c2d01fbeb15157ad144/src/main/java/nz/ac/waikato/cms/locator/ClassPathTraversal.java#L205-L225
149,674
Waikato/jclasslocator
src/main/java/nz/ac/waikato/cms/locator/ClassPathTraversal.java
ClassPathTraversal.traverseJar
protected void traverseJar(File file, TraversalState state) { JarFile jar; JarEntry entry; Enumeration enm; if (isLoggingEnabled()) getLogger().log(Level.INFO, "Analyzing jar: " + file); if (!file.exists()) { getLogger().log(Level.WARNING, "Jar does not exist: " + file); return; } try { jar = new JarFile(file); enm = jar.entries(); while (enm.hasMoreElements()) { entry = (JarEntry) enm.nextElement(); if (entry.getName().endsWith(".class")) traverse(entry.getName(), state); } traverseManifest(jar.getManifest(), state); } catch (Exception e) { getLogger().log(Level.SEVERE, "Failed to inspect: " + file, e); } }
java
protected void traverseJar(File file, TraversalState state) { JarFile jar; JarEntry entry; Enumeration enm; if (isLoggingEnabled()) getLogger().log(Level.INFO, "Analyzing jar: " + file); if (!file.exists()) { getLogger().log(Level.WARNING, "Jar does not exist: " + file); return; } try { jar = new JarFile(file); enm = jar.entries(); while (enm.hasMoreElements()) { entry = (JarEntry) enm.nextElement(); if (entry.getName().endsWith(".class")) traverse(entry.getName(), state); } traverseManifest(jar.getManifest(), state); } catch (Exception e) { getLogger().log(Level.SEVERE, "Failed to inspect: " + file, e); } }
[ "protected", "void", "traverseJar", "(", "File", "file", ",", "TraversalState", "state", ")", "{", "JarFile", "jar", ";", "JarEntry", "entry", ";", "Enumeration", "enm", ";", "if", "(", "isLoggingEnabled", "(", ")", ")", "getLogger", "(", ")", ".", "log", "(", "Level", ".", "INFO", ",", "\"Analyzing jar: \"", "+", "file", ")", ";", "if", "(", "!", "file", ".", "exists", "(", ")", ")", "{", "getLogger", "(", ")", ".", "log", "(", "Level", ".", "WARNING", ",", "\"Jar does not exist: \"", "+", "file", ")", ";", "return", ";", "}", "try", "{", "jar", "=", "new", "JarFile", "(", "file", ")", ";", "enm", "=", "jar", ".", "entries", "(", ")", ";", "while", "(", "enm", ".", "hasMoreElements", "(", ")", ")", "{", "entry", "=", "(", "JarEntry", ")", "enm", ".", "nextElement", "(", ")", ";", "if", "(", "entry", ".", "getName", "(", ")", ".", "endsWith", "(", "\".class\"", ")", ")", "traverse", "(", "entry", ".", "getName", "(", ")", ",", "state", ")", ";", "}", "traverseManifest", "(", "jar", ".", "getManifest", "(", ")", ",", "state", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "getLogger", "(", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "\"Failed to inspect: \"", "+", "file", ",", "e", ")", ";", "}", "}" ]
Fills the class cache with classes from the specified jar. @param file the jar to inspect @param state the traversal state
[ "Fills", "the", "class", "cache", "with", "classes", "from", "the", "specified", "jar", "." ]
c899072fff607a56ee7f8c2d01fbeb15157ad144
https://github.com/Waikato/jclasslocator/blob/c899072fff607a56ee7f8c2d01fbeb15157ad144/src/main/java/nz/ac/waikato/cms/locator/ClassPathTraversal.java#L233-L259
149,675
Waikato/jclasslocator
src/main/java/nz/ac/waikato/cms/locator/ClassPathTraversal.java
ClassPathTraversal.traverseClasspathPart
protected void traverseClasspathPart(String part, TraversalState state) { File file; file = null; if (part.startsWith("file:")) { part = part.replace(" ", "%20"); try { file = new File(new java.net.URI(part)); } catch (URISyntaxException e) { getLogger().log(Level.SEVERE, "Failed to generate URI: " + part, e); } } else { file = new File(part); } if (file == null) { if (isLoggingEnabled()) getLogger().log(Level.INFO, "Skipping: " + part); return; } // find classes if (file.isDirectory()) traverseDir(file, state); else if (file.exists()) traverseJar(file, state); }
java
protected void traverseClasspathPart(String part, TraversalState state) { File file; file = null; if (part.startsWith("file:")) { part = part.replace(" ", "%20"); try { file = new File(new java.net.URI(part)); } catch (URISyntaxException e) { getLogger().log(Level.SEVERE, "Failed to generate URI: " + part, e); } } else { file = new File(part); } if (file == null) { if (isLoggingEnabled()) getLogger().log(Level.INFO, "Skipping: " + part); return; } // find classes if (file.isDirectory()) traverseDir(file, state); else if (file.exists()) traverseJar(file, state); }
[ "protected", "void", "traverseClasspathPart", "(", "String", "part", ",", "TraversalState", "state", ")", "{", "File", "file", ";", "file", "=", "null", ";", "if", "(", "part", ".", "startsWith", "(", "\"file:\"", ")", ")", "{", "part", "=", "part", ".", "replace", "(", "\" \"", ",", "\"%20\"", ")", ";", "try", "{", "file", "=", "new", "File", "(", "new", "java", ".", "net", ".", "URI", "(", "part", ")", ")", ";", "}", "catch", "(", "URISyntaxException", "e", ")", "{", "getLogger", "(", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "\"Failed to generate URI: \"", "+", "part", ",", "e", ")", ";", "}", "}", "else", "{", "file", "=", "new", "File", "(", "part", ")", ";", "}", "if", "(", "file", "==", "null", ")", "{", "if", "(", "isLoggingEnabled", "(", ")", ")", "getLogger", "(", ")", ".", "log", "(", "Level", ".", "INFO", ",", "\"Skipping: \"", "+", "part", ")", ";", "return", ";", "}", "// find classes", "if", "(", "file", ".", "isDirectory", "(", ")", ")", "traverseDir", "(", "file", ",", "state", ")", ";", "else", "if", "(", "file", ".", "exists", "(", ")", ")", "traverseJar", "(", "file", ",", "state", ")", ";", "}" ]
Analyzes a part of the classpath. @param part the part to analyze @param state the traversal state
[ "Analyzes", "a", "part", "of", "the", "classpath", "." ]
c899072fff607a56ee7f8c2d01fbeb15157ad144
https://github.com/Waikato/jclasslocator/blob/c899072fff607a56ee7f8c2d01fbeb15157ad144/src/main/java/nz/ac/waikato/cms/locator/ClassPathTraversal.java#L267-L294
149,676
eurekaclinical/javautil
src/main/java/org/arp/javautil/arrays/Arrays.java
Arrays.contains
public static boolean contains(Object[] arr, Object obj) { if (arr != null) { for (int i = 0; i < arr.length; i++) { Object arri = arr[i]; if (arri == obj || (arri != null && arri.equals(obj))) { return true; } } } return false; }
java
public static boolean contains(Object[] arr, Object obj) { if (arr != null) { for (int i = 0; i < arr.length; i++) { Object arri = arr[i]; if (arri == obj || (arri != null && arri.equals(obj))) { return true; } } } return false; }
[ "public", "static", "boolean", "contains", "(", "Object", "[", "]", "arr", ",", "Object", "obj", ")", "{", "if", "(", "arr", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arr", ".", "length", ";", "i", "++", ")", "{", "Object", "arri", "=", "arr", "[", "i", "]", ";", "if", "(", "arri", "==", "obj", "||", "(", "arri", "!=", "null", "&&", "arri", ".", "equals", "(", "obj", ")", ")", ")", "{", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}" ]
Returns where an object is in a given array. @param arr the <code>Object[]</code> to search. @param obj the <code>Object</code> to search for. @return <code>true</code> of <code>obj</code> is in <code>arr</code>, <code>false</code> otherwise. Returns <code>false</code> if <code>arr</code> is <code>null</code>.
[ "Returns", "where", "an", "object", "is", "in", "a", "given", "array", "." ]
779bbc5bf096c75f8eed4f99ca45b99c1d44df43
https://github.com/eurekaclinical/javautil/blob/779bbc5bf096c75f8eed4f99ca45b99c1d44df43/src/main/java/org/arp/javautil/arrays/Arrays.java#L85-L95
149,677
eurekaclinical/javautil
src/main/java/org/arp/javautil/arrays/Arrays.java
Arrays.addAll
@SafeVarargs public static <E> void addAll(Collection<E> collection, E[]... arr) { if (collection == null) { throw new IllegalArgumentException("collection cannot be null"); } for (E[] oarr : arr) { for (E o : oarr) { collection.add(o); } } }
java
@SafeVarargs public static <E> void addAll(Collection<E> collection, E[]... arr) { if (collection == null) { throw new IllegalArgumentException("collection cannot be null"); } for (E[] oarr : arr) { for (E o : oarr) { collection.add(o); } } }
[ "@", "SafeVarargs", "public", "static", "<", "E", ">", "void", "addAll", "(", "Collection", "<", "E", ">", "collection", ",", "E", "[", "]", "...", "arr", ")", "{", "if", "(", "collection", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"collection cannot be null\"", ")", ";", "}", "for", "(", "E", "[", "]", "oarr", ":", "arr", ")", "{", "for", "(", "E", "o", ":", "oarr", ")", "{", "collection", ".", "add", "(", "o", ")", ";", "}", "}", "}" ]
Adds the contents of one or more arrays to a collection. @param collection a {@link Collection}. Cannot be <code>null</code>. @param arr zero or more <code>E[]</code>.
[ "Adds", "the", "contents", "of", "one", "or", "more", "arrays", "to", "a", "collection", "." ]
779bbc5bf096c75f8eed4f99ca45b99c1d44df43
https://github.com/eurekaclinical/javautil/blob/779bbc5bf096c75f8eed4f99ca45b99c1d44df43/src/main/java/org/arp/javautil/arrays/Arrays.java#L121-L131
149,678
eurekaclinical/javautil
src/main/java/org/arp/javautil/arrays/Arrays.java
Arrays.asList
@SafeVarargs public static <E> List<E> asList(E[]... arrs) { int size = 0; for (E[] arr : arrs) { if (arr == null) { throw new IllegalArgumentException("Null arrays not allowed"); } size += arr.length; } List<E> result = new ArrayList<>(size); addAll(result, arrs); return result; }
java
@SafeVarargs public static <E> List<E> asList(E[]... arrs) { int size = 0; for (E[] arr : arrs) { if (arr == null) { throw new IllegalArgumentException("Null arrays not allowed"); } size += arr.length; } List<E> result = new ArrayList<>(size); addAll(result, arrs); return result; }
[ "@", "SafeVarargs", "public", "static", "<", "E", ">", "List", "<", "E", ">", "asList", "(", "E", "[", "]", "...", "arrs", ")", "{", "int", "size", "=", "0", ";", "for", "(", "E", "[", "]", "arr", ":", "arrs", ")", "{", "if", "(", "arr", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Null arrays not allowed\"", ")", ";", "}", "size", "+=", "arr", ".", "length", ";", "}", "List", "<", "E", ">", "result", "=", "new", "ArrayList", "<>", "(", "size", ")", ";", "addAll", "(", "result", ",", "arrs", ")", ";", "return", "result", ";", "}" ]
Returns a newly created random access list with the contents of the provided arrays. @param <E> any class. @param arrs one or more <code>E[]</code>. @return a newly created random access {@link List}.
[ "Returns", "a", "newly", "created", "random", "access", "list", "with", "the", "contents", "of", "the", "provided", "arrays", "." ]
779bbc5bf096c75f8eed4f99ca45b99c1d44df43
https://github.com/eurekaclinical/javautil/blob/779bbc5bf096c75f8eed4f99ca45b99c1d44df43/src/main/java/org/arp/javautil/arrays/Arrays.java#L141-L153
149,679
bwkimmel/jdcp
jdcp-server/src/main/java/ca/eandb/jdcp/server/classmanager/FileClassManager.java
FileClassManager.moveClass
private void moveClass(File fromDirectory, String name, File toDirectory) { String baseName = getBaseFileName(name); File fromClassFile = new File(fromDirectory, baseName + CLASS_EXTENSION); File toClassFile = new File(toDirectory, baseName + CLASS_EXTENSION); File fromDigestFile = new File(fromDirectory, baseName + DIGEST_EXTENSION); File toDigestFile = new File(toDirectory, baseName + DIGEST_EXTENSION); File toClassDirectory = toClassFile.getParentFile(); toClassDirectory.mkdirs(); fromClassFile.renameTo(toClassFile); fromDigestFile.renameTo(toDigestFile); }
java
private void moveClass(File fromDirectory, String name, File toDirectory) { String baseName = getBaseFileName(name); File fromClassFile = new File(fromDirectory, baseName + CLASS_EXTENSION); File toClassFile = new File(toDirectory, baseName + CLASS_EXTENSION); File fromDigestFile = new File(fromDirectory, baseName + DIGEST_EXTENSION); File toDigestFile = new File(toDirectory, baseName + DIGEST_EXTENSION); File toClassDirectory = toClassFile.getParentFile(); toClassDirectory.mkdirs(); fromClassFile.renameTo(toClassFile); fromDigestFile.renameTo(toDigestFile); }
[ "private", "void", "moveClass", "(", "File", "fromDirectory", ",", "String", "name", ",", "File", "toDirectory", ")", "{", "String", "baseName", "=", "getBaseFileName", "(", "name", ")", ";", "File", "fromClassFile", "=", "new", "File", "(", "fromDirectory", ",", "baseName", "+", "CLASS_EXTENSION", ")", ";", "File", "toClassFile", "=", "new", "File", "(", "toDirectory", ",", "baseName", "+", "CLASS_EXTENSION", ")", ";", "File", "fromDigestFile", "=", "new", "File", "(", "fromDirectory", ",", "baseName", "+", "DIGEST_EXTENSION", ")", ";", "File", "toDigestFile", "=", "new", "File", "(", "toDirectory", ",", "baseName", "+", "DIGEST_EXTENSION", ")", ";", "File", "toClassDirectory", "=", "toClassFile", ".", "getParentFile", "(", ")", ";", "toClassDirectory", ".", "mkdirs", "(", ")", ";", "fromClassFile", ".", "renameTo", "(", "toClassFile", ")", ";", "fromDigestFile", ".", "renameTo", "(", "toDigestFile", ")", ";", "}" ]
Moves a class definition from the specified directory tree to another specified directory tree. @param fromDirectory The root of the directory tree from which to move the class definition. @param name The fully qualified name of the class to move. @param toDirectory The root of the directory tree to move the class definition to.
[ "Moves", "a", "class", "definition", "from", "the", "specified", "directory", "tree", "to", "another", "specified", "directory", "tree", "." ]
630c5150c245054e2556ff370f4bad2ec793dfb7
https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-server/src/main/java/ca/eandb/jdcp/server/classmanager/FileClassManager.java#L202-L213
149,680
bwkimmel/jdcp
jdcp-server/src/main/java/ca/eandb/jdcp/server/classmanager/FileClassManager.java
FileClassManager.classExists
private boolean classExists(File directory, String name) { String baseName = getBaseFileName(name); File classFile = new File(directory, baseName + CLASS_EXTENSION); File digestFile = new File(directory, baseName + DIGEST_EXTENSION); return classFile.isFile() && digestFile.isFile(); }
java
private boolean classExists(File directory, String name) { String baseName = getBaseFileName(name); File classFile = new File(directory, baseName + CLASS_EXTENSION); File digestFile = new File(directory, baseName + DIGEST_EXTENSION); return classFile.isFile() && digestFile.isFile(); }
[ "private", "boolean", "classExists", "(", "File", "directory", ",", "String", "name", ")", "{", "String", "baseName", "=", "getBaseFileName", "(", "name", ")", ";", "File", "classFile", "=", "new", "File", "(", "directory", ",", "baseName", "+", "CLASS_EXTENSION", ")", ";", "File", "digestFile", "=", "new", "File", "(", "directory", ",", "baseName", "+", "DIGEST_EXTENSION", ")", ";", "return", "classFile", ".", "isFile", "(", ")", "&&", "digestFile", ".", "isFile", "(", ")", ";", "}" ]
Determines if the specified class exists in the specified directory tree. @param directory The root of the directory tree to examine. @param name The fully qualified name of the class. @return A value indicating if the class exists in the given directory tree.
[ "Determines", "if", "the", "specified", "class", "exists", "in", "the", "specified", "directory", "tree", "." ]
630c5150c245054e2556ff370f4bad2ec793dfb7
https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-server/src/main/java/ca/eandb/jdcp/server/classmanager/FileClassManager.java#L223-L229
149,681
bwkimmel/jdcp
jdcp-server/src/main/java/ca/eandb/jdcp/server/classmanager/FileClassManager.java
FileClassManager.getFileContents
private byte[] getFileContents(File file) { if (file.exists()) { try { return FileUtil.getFileContents(file); } catch (IOException e) { e.printStackTrace(); } } return null; }
java
private byte[] getFileContents(File file) { if (file.exists()) { try { return FileUtil.getFileContents(file); } catch (IOException e) { e.printStackTrace(); } } return null; }
[ "private", "byte", "[", "]", "getFileContents", "(", "File", "file", ")", "{", "if", "(", "file", ".", "exists", "(", ")", ")", "{", "try", "{", "return", "FileUtil", ".", "getFileContents", "(", "file", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "return", "null", ";", "}" ]
Gets the contents of the specified file, or null if the file does not exist. @param file The <code>File</code> whose contents to obtain. @return The file contents, or null if the file does not exist.
[ "Gets", "the", "contents", "of", "the", "specified", "file", "or", "null", "if", "the", "file", "does", "not", "exist", "." ]
630c5150c245054e2556ff370f4bad2ec793dfb7
https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-server/src/main/java/ca/eandb/jdcp/server/classmanager/FileClassManager.java#L237-L246
149,682
bwkimmel/jdcp
jdcp-server/src/main/java/ca/eandb/jdcp/server/classmanager/FileClassManager.java
FileClassManager.getClassDigest
private byte[] getClassDigest(File directory, String name) { String baseName = getBaseFileName(name); File digestFile = new File(directory, baseName + DIGEST_EXTENSION); return getFileContents(digestFile); }
java
private byte[] getClassDigest(File directory, String name) { String baseName = getBaseFileName(name); File digestFile = new File(directory, baseName + DIGEST_EXTENSION); return getFileContents(digestFile); }
[ "private", "byte", "[", "]", "getClassDigest", "(", "File", "directory", ",", "String", "name", ")", "{", "String", "baseName", "=", "getBaseFileName", "(", "name", ")", ";", "File", "digestFile", "=", "new", "File", "(", "directory", ",", "baseName", "+", "DIGEST_EXTENSION", ")", ";", "return", "getFileContents", "(", "digestFile", ")", ";", "}" ]
Gets the MD5 digest of a class definition. @param directory The root of the directory tree containing the class. @param name The fully qualified name of the class. @return The MD5 digest of the class definition.
[ "Gets", "the", "MD5", "digest", "of", "a", "class", "definition", "." ]
630c5150c245054e2556ff370f4bad2ec793dfb7
https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-server/src/main/java/ca/eandb/jdcp/server/classmanager/FileClassManager.java#L254-L258
149,683
bwkimmel/jdcp
jdcp-server/src/main/java/ca/eandb/jdcp/server/classmanager/FileClassManager.java
FileClassManager.getClassDefinition
private ByteBuffer getClassDefinition(File directory, String name) { String baseName = getBaseFileName(name); File digestFile = new File(directory, baseName + CLASS_EXTENSION); return ByteBuffer.wrap(getFileContents(digestFile)); }
java
private ByteBuffer getClassDefinition(File directory, String name) { String baseName = getBaseFileName(name); File digestFile = new File(directory, baseName + CLASS_EXTENSION); return ByteBuffer.wrap(getFileContents(digestFile)); }
[ "private", "ByteBuffer", "getClassDefinition", "(", "File", "directory", ",", "String", "name", ")", "{", "String", "baseName", "=", "getBaseFileName", "(", "name", ")", ";", "File", "digestFile", "=", "new", "File", "(", "directory", ",", "baseName", "+", "CLASS_EXTENSION", ")", ";", "return", "ByteBuffer", ".", "wrap", "(", "getFileContents", "(", "digestFile", ")", ")", ";", "}" ]
Gets the definition of a class. @param directory The root of the directory tree containing the class definition. @param name The fully qualified name of the class. @return A <code>ByteBuffer</code> containing the class definition.
[ "Gets", "the", "definition", "of", "a", "class", "." ]
630c5150c245054e2556ff370f4bad2ec793dfb7
https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-server/src/main/java/ca/eandb/jdcp/server/classmanager/FileClassManager.java#L267-L271
149,684
bwkimmel/jdcp
jdcp-server/src/main/java/ca/eandb/jdcp/server/classmanager/FileClassManager.java
FileClassManager.computeClassDigest
private byte[] computeClassDigest(ByteBuffer def) { try { MessageDigest alg = MessageDigest.getInstance(DIGEST_ALGORITHM); def.mark(); alg.update(def); def.reset(); return alg.digest(); } catch (NoSuchAlgorithmException e) { throw new UnexpectedException(e); } }
java
private byte[] computeClassDigest(ByteBuffer def) { try { MessageDigest alg = MessageDigest.getInstance(DIGEST_ALGORITHM); def.mark(); alg.update(def); def.reset(); return alg.digest(); } catch (NoSuchAlgorithmException e) { throw new UnexpectedException(e); } }
[ "private", "byte", "[", "]", "computeClassDigest", "(", "ByteBuffer", "def", ")", "{", "try", "{", "MessageDigest", "alg", "=", "MessageDigest", ".", "getInstance", "(", "DIGEST_ALGORITHM", ")", ";", "def", ".", "mark", "(", ")", ";", "alg", ".", "update", "(", "def", ")", ";", "def", ".", "reset", "(", ")", ";", "return", "alg", ".", "digest", "(", ")", ";", "}", "catch", "(", "NoSuchAlgorithmException", "e", ")", "{", "throw", "new", "UnexpectedException", "(", "e", ")", ";", "}", "}" ]
Computes the MD5 digest of the given class definition. @param def A <code>ByteBuffer</code> containing the class definition. @return The MD5 digest of the class definition.
[ "Computes", "the", "MD5", "digest", "of", "the", "given", "class", "definition", "." ]
630c5150c245054e2556ff370f4bad2ec793dfb7
https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-server/src/main/java/ca/eandb/jdcp/server/classmanager/FileClassManager.java#L278-L288
149,685
eurekaclinical/javautil
src/main/java/org/arp/javautil/sql/DataSourceConnectionSpec.java
DataSourceConnectionSpec.getOrCreate
@Override public Connection getOrCreate() throws SQLException { Connection con; if (this.user == null && this.password == null) { con = this.dataSource.getConnection(); } else { con = this.dataSource.getConnection(this.user, this.password); } con.setAutoCommit(isAutoCommitEnabled()); return con; }
java
@Override public Connection getOrCreate() throws SQLException { Connection con; if (this.user == null && this.password == null) { con = this.dataSource.getConnection(); } else { con = this.dataSource.getConnection(this.user, this.password); } con.setAutoCommit(isAutoCommitEnabled()); return con; }
[ "@", "Override", "public", "Connection", "getOrCreate", "(", ")", "throws", "SQLException", "{", "Connection", "con", ";", "if", "(", "this", ".", "user", "==", "null", "&&", "this", ".", "password", "==", "null", ")", "{", "con", "=", "this", ".", "dataSource", ".", "getConnection", "(", ")", ";", "}", "else", "{", "con", "=", "this", ".", "dataSource", ".", "getConnection", "(", "this", ".", "user", ",", "this", ".", "password", ")", ";", "}", "con", ".", "setAutoCommit", "(", "isAutoCommitEnabled", "(", ")", ")", ";", "return", "con", ";", "}" ]
Creates a database connection or gets an existing connection with the JNDI name, username and password specified in the constructor. @return a {@link Connection}. @throws SQLException if an error occurred creating/getting a {@link Connection}, possibly because the JNDI name, username and/or password are invalid.
[ "Creates", "a", "database", "connection", "or", "gets", "an", "existing", "connection", "with", "the", "JNDI", "name", "username", "and", "password", "specified", "in", "the", "constructor", "." ]
779bbc5bf096c75f8eed4f99ca45b99c1d44df43
https://github.com/eurekaclinical/javautil/blob/779bbc5bf096c75f8eed4f99ca45b99c1d44df43/src/main/java/org/arp/javautil/sql/DataSourceConnectionSpec.java#L126-L136
149,686
bwkimmel/jdcp
jdcp-core/src/main/java/ca/eandb/jdcp/JdcpUtil.java
JdcpUtil.connect
public static JobService connect(String host, String username, String password) throws RemoteException, NotBoundException, LoginException, ProtocolVersionException { Registry registry = LocateRegistry.getRegistry(host, DEFAULT_PORT); AuthenticationService auth = (AuthenticationService) registry.lookup("AuthenticationService"); return auth.authenticate(username, password, PROTOCOL_VERSION_ID); }
java
public static JobService connect(String host, String username, String password) throws RemoteException, NotBoundException, LoginException, ProtocolVersionException { Registry registry = LocateRegistry.getRegistry(host, DEFAULT_PORT); AuthenticationService auth = (AuthenticationService) registry.lookup("AuthenticationService"); return auth.authenticate(username, password, PROTOCOL_VERSION_ID); }
[ "public", "static", "JobService", "connect", "(", "String", "host", ",", "String", "username", ",", "String", "password", ")", "throws", "RemoteException", ",", "NotBoundException", ",", "LoginException", ",", "ProtocolVersionException", "{", "Registry", "registry", "=", "LocateRegistry", ".", "getRegistry", "(", "host", ",", "DEFAULT_PORT", ")", ";", "AuthenticationService", "auth", "=", "(", "AuthenticationService", ")", "registry", ".", "lookup", "(", "\"AuthenticationService\"", ")", ";", "return", "auth", ".", "authenticate", "(", "username", ",", "password", ",", "PROTOCOL_VERSION_ID", ")", ";", "}" ]
Connects to a JDCP server. @param host The host name of the server to send the job to. @param username The user name to use to authenticate with the server. @param password The password to use to authenticate with the server. @return The <code>JobService</code> to use to communicate with the server. @throws RemoteException If a failure occurs in attempting to communicate with the server. @throws LoginException If the login attempt fails. @throws NotBoundException If the <code>AuthenticationService</code> could not be found at the server. @throws ProtocolVersionException If this client is incompatible with the server.
[ "Connects", "to", "a", "JDCP", "server", "." ]
630c5150c245054e2556ff370f4bad2ec793dfb7
https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-core/src/main/java/ca/eandb/jdcp/JdcpUtil.java#L79-L85
149,687
bwkimmel/jdcp
jdcp-core/src/main/java/ca/eandb/jdcp/JdcpUtil.java
JdcpUtil.submitJob
public static UUID submitJob(ParallelizableJob job, String description, String host, String username, String password) throws SecurityException, RemoteException, ClassNotFoundException, JobExecutionException, LoginException, NotBoundException, ProtocolVersionException { Serialized<ParallelizableJob> payload = new Serialized<ParallelizableJob>(job); JobService service = connect(host, username, password); return service.submitJob(payload, description); }
java
public static UUID submitJob(ParallelizableJob job, String description, String host, String username, String password) throws SecurityException, RemoteException, ClassNotFoundException, JobExecutionException, LoginException, NotBoundException, ProtocolVersionException { Serialized<ParallelizableJob> payload = new Serialized<ParallelizableJob>(job); JobService service = connect(host, username, password); return service.submitJob(payload, description); }
[ "public", "static", "UUID", "submitJob", "(", "ParallelizableJob", "job", ",", "String", "description", ",", "String", "host", ",", "String", "username", ",", "String", "password", ")", "throws", "SecurityException", ",", "RemoteException", ",", "ClassNotFoundException", ",", "JobExecutionException", ",", "LoginException", ",", "NotBoundException", ",", "ProtocolVersionException", "{", "Serialized", "<", "ParallelizableJob", ">", "payload", "=", "new", "Serialized", "<", "ParallelizableJob", ">", "(", "job", ")", ";", "JobService", "service", "=", "connect", "(", "host", ",", "username", ",", "password", ")", ";", "return", "service", ".", "submitJob", "(", "payload", ",", "description", ")", ";", "}" ]
Submits a job to a server for processing. @param job The <code>ParallelizableJob</code> to be processed. @param description A description of the job. @param host The host name of the server to send the job to. @param username The user name to use to authenticate with the server. @param password The password to use to authenticate with the server. @return The <code>UUID</code> assigned to the job. @throws SecurityException If the user does not have access to perform the requested action on the server. @throws RemoteException If a failure occurs in attempting to communicate with the server. @throws ClassNotFoundException If deserialization of the job at the server requires a class that could not be found on the server. @throws JobExecutionException If the submitted job threw an exception at the server during initialization. @throws LoginException If the login attempt fails. @throws NotBoundException If the <code>AuthenticationService</code> could not be found at the server. @throws ProtocolVersionException If this client is incompatible with the server.
[ "Submits", "a", "job", "to", "a", "server", "for", "processing", "." ]
630c5150c245054e2556ff370f4bad2ec793dfb7
https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-core/src/main/java/ca/eandb/jdcp/JdcpUtil.java#L109-L119
149,688
bwkimmel/jdcp
jdcp-core/src/main/java/ca/eandb/jdcp/JdcpUtil.java
JdcpUtil.registerTaskService
public static void registerTaskService(String name, TaskService taskService, String host, String username, String password) throws SecurityException, RemoteException, ClassNotFoundException, JobExecutionException, LoginException, NotBoundException, ProtocolVersionException { JobService service = connect(host, username, password); service.registerTaskService(name, taskService); }
java
public static void registerTaskService(String name, TaskService taskService, String host, String username, String password) throws SecurityException, RemoteException, ClassNotFoundException, JobExecutionException, LoginException, NotBoundException, ProtocolVersionException { JobService service = connect(host, username, password); service.registerTaskService(name, taskService); }
[ "public", "static", "void", "registerTaskService", "(", "String", "name", ",", "TaskService", "taskService", ",", "String", "host", ",", "String", "username", ",", "String", "password", ")", "throws", "SecurityException", ",", "RemoteException", ",", "ClassNotFoundException", ",", "JobExecutionException", ",", "LoginException", ",", "NotBoundException", ",", "ProtocolVersionException", "{", "JobService", "service", "=", "connect", "(", "host", ",", "username", ",", "password", ")", ";", "service", ".", "registerTaskService", "(", "name", ",", "taskService", ")", ";", "}" ]
Connects to a job server and provides a source of tasks to be processed. @param name The name to assign to the <code>TaskService</code>. This may be used to manage this <code>TaskService</code> in later calls. @param taskService The <code>TaskService</code> to submit. @param host The host name of the server to send the job to. @param username The user name to use to authenticate with the server. @param password The password to use to authenticate with the server. @throws SecurityException If the user does not have access to perform the requested action on the server. @throws RemoteException If a failure occurs in attempting to communicate with the server. @throws ClassNotFoundException If deserialization of the job at the server requires a class that could not be found on the server. @throws JobExecutionException If the submitted job threw an exception at the server during initialization. @throws LoginException If the login attempt fails. @throws NotBoundException If the <code>AuthenticationService</code> could not be found at the server. @throws ProtocolVersionException If this client is incompatible with the server.
[ "Connects", "to", "a", "job", "server", "and", "provides", "a", "source", "of", "tasks", "to", "be", "processed", "." ]
630c5150c245054e2556ff370f4bad2ec793dfb7
https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-core/src/main/java/ca/eandb/jdcp/JdcpUtil.java#L143-L151
149,689
bwkimmel/jdcp
jdcp-core/src/main/java/ca/eandb/jdcp/JdcpUtil.java
JdcpUtil.initialize
public static void initialize() { String homeDirName = System.getProperty("jdcp.home"); File homeDir; if (homeDirName != null) { homeDir = new File(homeDirName); } else { homeDir = FileUtil.getApplicationDataDirectory("jdcp"); System.setProperty("jdcp.home", homeDir.getPath()); } homeDir.mkdir(); if (System.getProperty("derby.system.home") == null) { System.setProperty("derby.system.home", homeDir.getPath()); } }
java
public static void initialize() { String homeDirName = System.getProperty("jdcp.home"); File homeDir; if (homeDirName != null) { homeDir = new File(homeDirName); } else { homeDir = FileUtil.getApplicationDataDirectory("jdcp"); System.setProperty("jdcp.home", homeDir.getPath()); } homeDir.mkdir(); if (System.getProperty("derby.system.home") == null) { System.setProperty("derby.system.home", homeDir.getPath()); } }
[ "public", "static", "void", "initialize", "(", ")", "{", "String", "homeDirName", "=", "System", ".", "getProperty", "(", "\"jdcp.home\"", ")", ";", "File", "homeDir", ";", "if", "(", "homeDirName", "!=", "null", ")", "{", "homeDir", "=", "new", "File", "(", "homeDirName", ")", ";", "}", "else", "{", "homeDir", "=", "FileUtil", ".", "getApplicationDataDirectory", "(", "\"jdcp\"", ")", ";", "System", ".", "setProperty", "(", "\"jdcp.home\"", ",", "homeDir", ".", "getPath", "(", ")", ")", ";", "}", "homeDir", ".", "mkdir", "(", ")", ";", "if", "(", "System", ".", "getProperty", "(", "\"derby.system.home\"", ")", "==", "null", ")", "{", "System", ".", "setProperty", "(", "\"derby.system.home\"", ",", "homeDir", ".", "getPath", "(", ")", ")", ";", "}", "}" ]
Performs initialization for the currently running JDCP application.
[ "Performs", "initialization", "for", "the", "currently", "running", "JDCP", "application", "." ]
630c5150c245054e2556ff370f4bad2ec793dfb7
https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-core/src/main/java/ca/eandb/jdcp/JdcpUtil.java#L176-L189
149,690
Waikato/jclasslocator
src/main/java/nz/ac/waikato/cms/locator/ClassLocator.java
ClassLocator.findPackages
public List<String> findPackages() { List<String> result; Iterator<String> packages; result = new ArrayList<>(); packages = m_Cache.packages(); while (packages.hasNext()) result.add(packages.next()); Collections.sort(result, new StringCompare()); return result; }
java
public List<String> findPackages() { List<String> result; Iterator<String> packages; result = new ArrayList<>(); packages = m_Cache.packages(); while (packages.hasNext()) result.add(packages.next()); Collections.sort(result, new StringCompare()); return result; }
[ "public", "List", "<", "String", ">", "findPackages", "(", ")", "{", "List", "<", "String", ">", "result", ";", "Iterator", "<", "String", ">", "packages", ";", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "packages", "=", "m_Cache", ".", "packages", "(", ")", ";", "while", "(", "packages", ".", "hasNext", "(", ")", ")", "result", ".", "add", "(", "packages", ".", "next", "(", ")", ")", ";", "Collections", ".", "sort", "(", "result", ",", "new", "StringCompare", "(", ")", ")", ";", "return", "result", ";", "}" ]
Lists all packages it can find in the classpath. @return a list with all the found packages
[ "Lists", "all", "packages", "it", "can", "find", "in", "the", "classpath", "." ]
c899072fff607a56ee7f8c2d01fbeb15157ad144
https://github.com/Waikato/jclasslocator/blob/c899072fff607a56ee7f8c2d01fbeb15157ad144/src/main/java/nz/ac/waikato/cms/locator/ClassLocator.java#L450-L461
149,691
Waikato/jclasslocator
src/main/java/nz/ac/waikato/cms/locator/ClassLocator.java
ClassLocator.initCache
protected void initCache(ClassTraversal traversal) { if (m_CacheNames == null) m_CacheNames = new HashMap<>(); if (m_CacheClasses == null) m_CacheClasses = new HashMap<>(); if (m_BlackListed == null) m_BlackListed = new HashSet<>(); if (m_Cache == null) m_Cache = newClassCache(traversal); }
java
protected void initCache(ClassTraversal traversal) { if (m_CacheNames == null) m_CacheNames = new HashMap<>(); if (m_CacheClasses == null) m_CacheClasses = new HashMap<>(); if (m_BlackListed == null) m_BlackListed = new HashSet<>(); if (m_Cache == null) m_Cache = newClassCache(traversal); }
[ "protected", "void", "initCache", "(", "ClassTraversal", "traversal", ")", "{", "if", "(", "m_CacheNames", "==", "null", ")", "m_CacheNames", "=", "new", "HashMap", "<>", "(", ")", ";", "if", "(", "m_CacheClasses", "==", "null", ")", "m_CacheClasses", "=", "new", "HashMap", "<>", "(", ")", ";", "if", "(", "m_BlackListed", "==", "null", ")", "m_BlackListed", "=", "new", "HashSet", "<>", "(", ")", ";", "if", "(", "m_Cache", "==", "null", ")", "m_Cache", "=", "newClassCache", "(", "traversal", ")", ";", "}" ]
initializes the cache for the classnames. @param traversal how to traverse the classes, can be null
[ "initializes", "the", "cache", "for", "the", "classnames", "." ]
c899072fff607a56ee7f8c2d01fbeb15157ad144
https://github.com/Waikato/jclasslocator/blob/c899072fff607a56ee7f8c2d01fbeb15157ad144/src/main/java/nz/ac/waikato/cms/locator/ClassLocator.java#L478-L487
149,692
Waikato/jclasslocator
src/main/java/nz/ac/waikato/cms/locator/ClassLocator.java
ClassLocator.addCache
protected void addCache(Class cls, String pkgname, List<String> classnames, List<Class> classes) { m_CacheNames.put(cls.getName() + "-" + pkgname, classnames); m_CacheClasses.put(cls.getName() + "-" + pkgname, classes); }
java
protected void addCache(Class cls, String pkgname, List<String> classnames, List<Class> classes) { m_CacheNames.put(cls.getName() + "-" + pkgname, classnames); m_CacheClasses.put(cls.getName() + "-" + pkgname, classes); }
[ "protected", "void", "addCache", "(", "Class", "cls", ",", "String", "pkgname", ",", "List", "<", "String", ">", "classnames", ",", "List", "<", "Class", ">", "classes", ")", "{", "m_CacheNames", ".", "put", "(", "cls", ".", "getName", "(", ")", "+", "\"-\"", "+", "pkgname", ",", "classnames", ")", ";", "m_CacheClasses", ".", "put", "(", "cls", ".", "getName", "(", ")", "+", "\"-\"", "+", "pkgname", ",", "classes", ")", ";", "}" ]
adds the list of classnames to the cache. @param cls the class to cache the classnames for @param pkgname the package name the classes were found in @param classnames the list of classnames to cache
[ "adds", "the", "list", "of", "classnames", "to", "the", "cache", "." ]
c899072fff607a56ee7f8c2d01fbeb15157ad144
https://github.com/Waikato/jclasslocator/blob/c899072fff607a56ee7f8c2d01fbeb15157ad144/src/main/java/nz/ac/waikato/cms/locator/ClassLocator.java#L496-L499
149,693
Waikato/jclasslocator
src/main/java/nz/ac/waikato/cms/locator/ClassLocator.java
ClassLocator.getNameCache
protected List<String> getNameCache(Class cls, String pkgname) { return m_CacheNames.get(cls.getName() + "-" + pkgname); }
java
protected List<String> getNameCache(Class cls, String pkgname) { return m_CacheNames.get(cls.getName() + "-" + pkgname); }
[ "protected", "List", "<", "String", ">", "getNameCache", "(", "Class", "cls", ",", "String", "pkgname", ")", "{", "return", "m_CacheNames", ".", "get", "(", "cls", ".", "getName", "(", ")", "+", "\"-\"", "+", "pkgname", ")", ";", "}" ]
returns the list of classnames associated with this class and package, if available, otherwise null. @param cls the class to get the classnames for @param pkgname the package name for the classes @return the classnames if found, otherwise null
[ "returns", "the", "list", "of", "classnames", "associated", "with", "this", "class", "and", "package", "if", "available", "otherwise", "null", "." ]
c899072fff607a56ee7f8c2d01fbeb15157ad144
https://github.com/Waikato/jclasslocator/blob/c899072fff607a56ee7f8c2d01fbeb15157ad144/src/main/java/nz/ac/waikato/cms/locator/ClassLocator.java#L509-L511
149,694
Waikato/jclasslocator
src/main/java/nz/ac/waikato/cms/locator/ClassLocator.java
ClassLocator.getClassCache
protected List<Class> getClassCache(Class cls, String pkgname) { return m_CacheClasses.get(cls.getName() + "-" + pkgname); }
java
protected List<Class> getClassCache(Class cls, String pkgname) { return m_CacheClasses.get(cls.getName() + "-" + pkgname); }
[ "protected", "List", "<", "Class", ">", "getClassCache", "(", "Class", "cls", ",", "String", "pkgname", ")", "{", "return", "m_CacheClasses", ".", "get", "(", "cls", ".", "getName", "(", ")", "+", "\"-\"", "+", "pkgname", ")", ";", "}" ]
returns the list of classes associated with this class and package, if available, otherwise null. @param cls the class to get the classes for @param pkgname the package name for the classes @return the classes if found, otherwise null
[ "returns", "the", "list", "of", "classes", "associated", "with", "this", "class", "and", "package", "if", "available", "otherwise", "null", "." ]
c899072fff607a56ee7f8c2d01fbeb15157ad144
https://github.com/Waikato/jclasslocator/blob/c899072fff607a56ee7f8c2d01fbeb15157ad144/src/main/java/nz/ac/waikato/cms/locator/ClassLocator.java#L521-L523
149,695
mlhartme/mork
src/main/java/net/oneandone/mork/reflect/Function.java
Function.matches
public boolean matches(Class<?>[] args) { int i; Class<?>[] paras; paras = getParameterTypes(); if (args.length != paras.length) { return false; } for (i = 0; i < args.length; i++) { if (!paras[i].isAssignableFrom(args[i])) { return false; } } return true; }
java
public boolean matches(Class<?>[] args) { int i; Class<?>[] paras; paras = getParameterTypes(); if (args.length != paras.length) { return false; } for (i = 0; i < args.length; i++) { if (!paras[i].isAssignableFrom(args[i])) { return false; } } return true; }
[ "public", "boolean", "matches", "(", "Class", "<", "?", ">", "[", "]", "args", ")", "{", "int", "i", ";", "Class", "<", "?", ">", "[", "]", "paras", ";", "paras", "=", "getParameterTypes", "(", ")", ";", "if", "(", "args", ".", "length", "!=", "paras", ".", "length", ")", "{", "return", "false", ";", "}", "for", "(", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "if", "(", "!", "paras", "[", "i", "]", ".", "isAssignableFrom", "(", "args", "[", "i", "]", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Tests if the functions can be called with arguments of the specified types. @param args arguement types @return true, if the function can be called with these types
[ "Tests", "if", "the", "functions", "can", "be", "called", "with", "arguments", "of", "the", "specified", "types", "." ]
a069b087750c4133bfeebaf1f599c3bc96762113
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/reflect/Function.java#L96-L110
149,696
leadware/jpersistence-tools
jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/validator/base/AbstractExpressionBasedDAOValidatorRule.java
AbstractExpressionBasedDAOValidatorRule.buildQuery
protected Query buildQuery(Object target) { // Si le modele est null if(expressionModel == null) return null; // Instanciation de la requete Query query = this.entityManager.createQuery(expressionModel.getComputedExpression()); // MAP des parametres Map<String, String> parameters = expressionModel.getParameters(); // Si la MAP n'est pas vide if(parameters != null && parameters.size() > 0) { // Ensemble des cles Set<String> keys = parameters.keySet(); // Parcours de l'ensemble des cles for (String key : keys) { // Ajout du parametre query.setParameter(key, DAOValidatorHelper.evaluateValueExpression(parameters.get(key), target)); } } // On retourne la requete return query; }
java
protected Query buildQuery(Object target) { // Si le modele est null if(expressionModel == null) return null; // Instanciation de la requete Query query = this.entityManager.createQuery(expressionModel.getComputedExpression()); // MAP des parametres Map<String, String> parameters = expressionModel.getParameters(); // Si la MAP n'est pas vide if(parameters != null && parameters.size() > 0) { // Ensemble des cles Set<String> keys = parameters.keySet(); // Parcours de l'ensemble des cles for (String key : keys) { // Ajout du parametre query.setParameter(key, DAOValidatorHelper.evaluateValueExpression(parameters.get(key), target)); } } // On retourne la requete return query; }
[ "protected", "Query", "buildQuery", "(", "Object", "target", ")", "{", "// Si le modele est null\r", "if", "(", "expressionModel", "==", "null", ")", "return", "null", ";", "// Instanciation de la requete\r", "Query", "query", "=", "this", ".", "entityManager", ".", "createQuery", "(", "expressionModel", ".", "getComputedExpression", "(", ")", ")", ";", "// MAP des parametres\r", "Map", "<", "String", ",", "String", ">", "parameters", "=", "expressionModel", ".", "getParameters", "(", ")", ";", "// Si la MAP n'est pas vide\r", "if", "(", "parameters", "!=", "null", "&&", "parameters", ".", "size", "(", ")", ">", "0", ")", "{", "// Ensemble des cles\r", "Set", "<", "String", ">", "keys", "=", "parameters", ".", "keySet", "(", ")", ";", "// Parcours de l'ensemble des cles\r", "for", "(", "String", "key", ":", "keys", ")", "{", "// Ajout du parametre\r", "query", ".", "setParameter", "(", "key", ",", "DAOValidatorHelper", ".", "evaluateValueExpression", "(", "parameters", ".", "get", "(", "key", ")", ",", "target", ")", ")", ";", "}", "}", "// On retourne la requete\r", "return", "query", ";", "}" ]
Methode de construction de la requete @param target Objet cible @return Requete
[ "Methode", "de", "construction", "de", "la", "requete" ]
4c15372993584579d7dbb9b23dd4c0c0fdc9e789
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/validator/base/AbstractExpressionBasedDAOValidatorRule.java#L119-L146
149,697
leadware/jpersistence-tools
jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/validator/base/AbstractExpressionBasedDAOValidatorRule.java
AbstractExpressionBasedDAOValidatorRule.isProcessable
protected boolean isProcessable() { // Comparaison des modes boolean correctMode = DAOValidatorHelper.arraryContains(getAnnotationMode(), this.systemDAOMode); // Comparaison des instants d'evaluation boolean correctTime = DAOValidatorHelper.arraryContains(getAnnotationEvaluationTime(), this.systemEvaluationTime); // On retourne la comparaison des deux return correctMode && correctTime; }
java
protected boolean isProcessable() { // Comparaison des modes boolean correctMode = DAOValidatorHelper.arraryContains(getAnnotationMode(), this.systemDAOMode); // Comparaison des instants d'evaluation boolean correctTime = DAOValidatorHelper.arraryContains(getAnnotationEvaluationTime(), this.systemEvaluationTime); // On retourne la comparaison des deux return correctMode && correctTime; }
[ "protected", "boolean", "isProcessable", "(", ")", "{", "// Comparaison des modes\r", "boolean", "correctMode", "=", "DAOValidatorHelper", ".", "arraryContains", "(", "getAnnotationMode", "(", ")", ",", "this", ".", "systemDAOMode", ")", ";", "// Comparaison des instants d'evaluation\r", "boolean", "correctTime", "=", "DAOValidatorHelper", ".", "arraryContains", "(", "getAnnotationEvaluationTime", "(", ")", ",", "this", ".", "systemEvaluationTime", ")", ";", "// On retourne la comparaison des deux\r", "return", "correctMode", "&&", "correctTime", ";", "}" ]
methode permettant de tester si l'annotation doit-etre executee @return Etat d'execution de l'annotation
[ "methode", "permettant", "de", "tester", "si", "l", "annotation", "doit", "-", "etre", "executee" ]
4c15372993584579d7dbb9b23dd4c0c0fdc9e789
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/validator/base/AbstractExpressionBasedDAOValidatorRule.java#L152-L162
149,698
craterdog/java-general-utilities
src/main/java/craterdog/utils/Base32Utils.java
Base32Utils.encode
static public String encode(byte[] bytes, String indentation) { StringBuilder result = new StringBuilder(); int length = bytes.length; if (length == 0) return ""; // empty byte array if (indentation != null) result.append(indentation); encodeBytes(bytes[0], bytes[0], 0, result); for (int i = 1; i < length; i++) { if (i % 50 == 0) { // format to indented 80 character blocks result.append("\n"); if (indentation != null) result.append(indentation); } encodeBytes(bytes[i - 1], bytes[i], i, result); } encodeLastByte(bytes[length - 1], length - 1, result); return result.toString(); }
java
static public String encode(byte[] bytes, String indentation) { StringBuilder result = new StringBuilder(); int length = bytes.length; if (length == 0) return ""; // empty byte array if (indentation != null) result.append(indentation); encodeBytes(bytes[0], bytes[0], 0, result); for (int i = 1; i < length; i++) { if (i % 50 == 0) { // format to indented 80 character blocks result.append("\n"); if (indentation != null) result.append(indentation); } encodeBytes(bytes[i - 1], bytes[i], i, result); } encodeLastByte(bytes[length - 1], length - 1, result); return result.toString(); }
[ "static", "public", "String", "encode", "(", "byte", "[", "]", "bytes", ",", "String", "indentation", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "int", "length", "=", "bytes", ".", "length", ";", "if", "(", "length", "==", "0", ")", "return", "\"\"", ";", "// empty byte array", "if", "(", "indentation", "!=", "null", ")", "result", ".", "append", "(", "indentation", ")", ";", "encodeBytes", "(", "bytes", "[", "0", "]", ",", "bytes", "[", "0", "]", ",", "0", ",", "result", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "i", "%", "50", "==", "0", ")", "{", "// format to indented 80 character blocks", "result", ".", "append", "(", "\"\\n\"", ")", ";", "if", "(", "indentation", "!=", "null", ")", "result", ".", "append", "(", "indentation", ")", ";", "}", "encodeBytes", "(", "bytes", "[", "i", "-", "1", "]", ",", "bytes", "[", "i", "]", ",", "i", ",", "result", ")", ";", "}", "encodeLastByte", "(", "bytes", "[", "length", "-", "1", "]", ",", "length", "-", "1", ",", "result", ")", ";", "return", "result", ".", "toString", "(", ")", ";", "}" ]
This function encodes a byte array using base 32 with a specific indentation of new lines. @param bytes The byte array to be encoded. @param indentation The indentation string to be inserted before each new line. @return The base 32 encoded string.
[ "This", "function", "encodes", "a", "byte", "array", "using", "base", "32", "with", "a", "specific", "indentation", "of", "new", "lines", "." ]
a3ff45eaa00c2b8ed5c53efe9fe5166065fc1f57
https://github.com/craterdog/java-general-utilities/blob/a3ff45eaa00c2b8ed5c53efe9fe5166065fc1f57/src/main/java/craterdog/utils/Base32Utils.java#L39-L55
149,699
craterdog/java-general-utilities
src/main/java/craterdog/utils/Base32Utils.java
Base32Utils.decode
static public byte[] decode(String base32) { String string = base32.replaceAll("\\s", ""); // remove all white space int length = string.length(); byte[] bytes = new byte[(int) (length * 5.0 / 8.0)]; for (int i = 0; i < length - 1; i++) { char character = string.charAt(i); byte chunk = (byte) lookupTable.indexOf((int) character); if (chunk < 0) throw new NumberFormatException("Attempted to decode a string that is not base 32: " + string); decodeCharacter(chunk, i, bytes, 0); } if (length > 0) { char character = string.charAt(length - 1); byte chunk = (byte) lookupTable.indexOf((int) character); if (chunk < 0) throw new NumberFormatException("Attempted to decode a string that is not base 32: " + string); decodeLastCharacter(chunk, length - 1, bytes, 0); } return bytes; }
java
static public byte[] decode(String base32) { String string = base32.replaceAll("\\s", ""); // remove all white space int length = string.length(); byte[] bytes = new byte[(int) (length * 5.0 / 8.0)]; for (int i = 0; i < length - 1; i++) { char character = string.charAt(i); byte chunk = (byte) lookupTable.indexOf((int) character); if (chunk < 0) throw new NumberFormatException("Attempted to decode a string that is not base 32: " + string); decodeCharacter(chunk, i, bytes, 0); } if (length > 0) { char character = string.charAt(length - 1); byte chunk = (byte) lookupTable.indexOf((int) character); if (chunk < 0) throw new NumberFormatException("Attempted to decode a string that is not base 32: " + string); decodeLastCharacter(chunk, length - 1, bytes, 0); } return bytes; }
[ "static", "public", "byte", "[", "]", "decode", "(", "String", "base32", ")", "{", "String", "string", "=", "base32", ".", "replaceAll", "(", "\"\\\\s\"", ",", "\"\"", ")", ";", "// remove all white space", "int", "length", "=", "string", ".", "length", "(", ")", ";", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "(", "int", ")", "(", "length", "*", "5.0", "/", "8.0", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", "-", "1", ";", "i", "++", ")", "{", "char", "character", "=", "string", ".", "charAt", "(", "i", ")", ";", "byte", "chunk", "=", "(", "byte", ")", "lookupTable", ".", "indexOf", "(", "(", "int", ")", "character", ")", ";", "if", "(", "chunk", "<", "0", ")", "throw", "new", "NumberFormatException", "(", "\"Attempted to decode a string that is not base 32: \"", "+", "string", ")", ";", "decodeCharacter", "(", "chunk", ",", "i", ",", "bytes", ",", "0", ")", ";", "}", "if", "(", "length", ">", "0", ")", "{", "char", "character", "=", "string", ".", "charAt", "(", "length", "-", "1", ")", ";", "byte", "chunk", "=", "(", "byte", ")", "lookupTable", ".", "indexOf", "(", "(", "int", ")", "character", ")", ";", "if", "(", "chunk", "<", "0", ")", "throw", "new", "NumberFormatException", "(", "\"Attempted to decode a string that is not base 32: \"", "+", "string", ")", ";", "decodeLastCharacter", "(", "chunk", ",", "length", "-", "1", ",", "bytes", ",", "0", ")", ";", "}", "return", "bytes", ";", "}" ]
This function decodes a base 32 string into its corresponding byte array. @param base32 The base 32 encoded string. @return The corresponding byte array.
[ "This", "function", "decodes", "a", "base", "32", "string", "into", "its", "corresponding", "byte", "array", "." ]
a3ff45eaa00c2b8ed5c53efe9fe5166065fc1f57
https://github.com/craterdog/java-general-utilities/blob/a3ff45eaa00c2b8ed5c53efe9fe5166065fc1f57/src/main/java/craterdog/utils/Base32Utils.java#L64-L81