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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
146,000
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/os/BundleUtils.java
|
BundleUtils.buildKey
|
public static String buildKey(Class<?> clazz, String name) {
return new StringBuilder().append(clazz.getCanonicalName()).append(".").append(name).toString();
}
|
java
|
public static String buildKey(Class<?> clazz, String name) {
return new StringBuilder().append(clazz.getCanonicalName()).append(".").append(name).toString();
}
|
[
"public",
"static",
"String",
"buildKey",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"name",
")",
"{",
"return",
"new",
"StringBuilder",
"(",
")",
".",
"append",
"(",
"clazz",
".",
"getCanonicalName",
"(",
")",
")",
".",
"append",
"(",
"\".\"",
")",
".",
"append",
"(",
"name",
")",
".",
"toString",
"(",
")",
";",
"}"
] |
Build a custom bundle key name, to avoid conflict the bundle key name among the activities.
This is also useful to build a intent extra key name.
@param clazz the class.
@param name the key name, in most case the name is UPPER_UNDERSCORE.
@return the full qualified key name.
|
[
"Build",
"a",
"custom",
"bundle",
"key",
"name",
"to",
"avoid",
"conflict",
"the",
"bundle",
"key",
"name",
"among",
"the",
"activities",
".",
"This",
"is",
"also",
"useful",
"to",
"build",
"a",
"intent",
"extra",
"key",
"name",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L51-L53
|
146,001
|
OpenBEL/openbel-framework
|
org.openbel.framework.core/src/main/java/org/openbel/framework/core/indexer/JDBMLookup.java
|
JDBMLookup.open
|
public synchronized void open() throws IOException {
if (tmap != null) {
return;
}
final RecordManager rm = createRecordManager(indexPath);
if (valueSerializer == null) {
tmap = rm.treeMap(IndexerConstants.INDEX_TREE_KEY);
} else {
tmap = rm.treeMap(IndexerConstants.INDEX_TREE_KEY, valueSerializer);
}
if (tmap.isEmpty()) {
rm.close();
throw new IOException("tree map is empty");
}
invTmap = tmap.inverseHashView(IndexerConstants.INVERSE_KEY);
}
|
java
|
public synchronized void open() throws IOException {
if (tmap != null) {
return;
}
final RecordManager rm = createRecordManager(indexPath);
if (valueSerializer == null) {
tmap = rm.treeMap(IndexerConstants.INDEX_TREE_KEY);
} else {
tmap = rm.treeMap(IndexerConstants.INDEX_TREE_KEY, valueSerializer);
}
if (tmap.isEmpty()) {
rm.close();
throw new IOException("tree map is empty");
}
invTmap = tmap.inverseHashView(IndexerConstants.INVERSE_KEY);
}
|
[
"public",
"synchronized",
"void",
"open",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"tmap",
"!=",
"null",
")",
"{",
"return",
";",
"}",
"final",
"RecordManager",
"rm",
"=",
"createRecordManager",
"(",
"indexPath",
")",
";",
"if",
"(",
"valueSerializer",
"==",
"null",
")",
"{",
"tmap",
"=",
"rm",
".",
"treeMap",
"(",
"IndexerConstants",
".",
"INDEX_TREE_KEY",
")",
";",
"}",
"else",
"{",
"tmap",
"=",
"rm",
".",
"treeMap",
"(",
"IndexerConstants",
".",
"INDEX_TREE_KEY",
",",
"valueSerializer",
")",
";",
"}",
"if",
"(",
"tmap",
".",
"isEmpty",
"(",
")",
")",
"{",
"rm",
".",
"close",
"(",
")",
";",
"throw",
"new",
"IOException",
"(",
"\"tree map is empty\"",
")",
";",
"}",
"invTmap",
"=",
"tmap",
".",
"inverseHashView",
"(",
"IndexerConstants",
".",
"INVERSE_KEY",
")",
";",
"}"
] |
Opens the index, for subsequent lookups.
@throws IOException Thrown if an I/O related exception occurs while
creating or opening the record manager
|
[
"Opens",
"the",
"index",
"for",
"subsequent",
"lookups",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.core/src/main/java/org/openbel/framework/core/indexer/JDBMLookup.java#L162-L177
|
146,002
|
OpenBEL/openbel-framework
|
org.openbel.framework.core/src/main/java/org/openbel/framework/core/indexer/JDBMLookup.java
|
JDBMLookup.close
|
public synchronized void close() throws IOException {
if (tmap == null) {
throw new IllegalStateException("not open");
}
final RecordManager rm = tmap.getRecordManager();
rm.close();
tmap = null;
}
|
java
|
public synchronized void close() throws IOException {
if (tmap == null) {
throw new IllegalStateException("not open");
}
final RecordManager rm = tmap.getRecordManager();
rm.close();
tmap = null;
}
|
[
"public",
"synchronized",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"tmap",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"not open\"",
")",
";",
"}",
"final",
"RecordManager",
"rm",
"=",
"tmap",
".",
"getRecordManager",
"(",
")",
";",
"rm",
".",
"close",
"(",
")",
";",
"tmap",
"=",
"null",
";",
"}"
] |
Closes the index.
@throws IOException Thrown when one of the underlying I/O operations fail
@throws IllegalStateException Thrown if {@link #open()} has not been
invoked
|
[
"Closes",
"the",
"index",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.core/src/main/java/org/openbel/framework/core/indexer/JDBMLookup.java#L195-L202
|
146,003
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/models/RetryStrategy.java
|
RetryStrategy.doWait
|
private void doWait( int currentTries, long optDuration_ms )
{
if ( optDuration_ms < 0 ) {
optDuration_ms = ( long ) ( firstSleep_ms * ( Math.random() + 0.5 ) * ( 1L << ( currentTries - 1 ) ) );
}
LOGGER.debug( "Will retry request after {} millis", optDuration_ms );
try {
Thread.sleep( optDuration_ms );
} catch ( InterruptedException ex ) {
throw new CStorageException( "Retry waiting interrupted", ex );
}
}
|
java
|
private void doWait( int currentTries, long optDuration_ms )
{
if ( optDuration_ms < 0 ) {
optDuration_ms = ( long ) ( firstSleep_ms * ( Math.random() + 0.5 ) * ( 1L << ( currentTries - 1 ) ) );
}
LOGGER.debug( "Will retry request after {} millis", optDuration_ms );
try {
Thread.sleep( optDuration_ms );
} catch ( InterruptedException ex ) {
throw new CStorageException( "Retry waiting interrupted", ex );
}
}
|
[
"private",
"void",
"doWait",
"(",
"int",
"currentTries",
",",
"long",
"optDuration_ms",
")",
"{",
"if",
"(",
"optDuration_ms",
"<",
"0",
")",
"{",
"optDuration_ms",
"=",
"(",
"long",
")",
"(",
"firstSleep_ms",
"*",
"(",
"Math",
".",
"random",
"(",
")",
"+",
"0.5",
")",
"*",
"(",
"1L",
"<<",
"(",
"currentTries",
"-",
"1",
")",
")",
")",
";",
"}",
"LOGGER",
".",
"debug",
"(",
"\"Will retry request after {} millis\"",
",",
"optDuration_ms",
")",
";",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"optDuration_ms",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"ex",
")",
"{",
"throw",
"new",
"CStorageException",
"(",
"\"Retry waiting interrupted\"",
",",
"ex",
")",
";",
"}",
"}"
] |
Sleeps before retry ; default implementation is exponential back-off, or the specified duration
@param currentTries 1 after first fail, then 2, 3 ... up to nbTriesMax-1.
@param optDuration_ms if positive, the delay to apply
|
[
"Sleeps",
"before",
"retry",
";",
"default",
"implementation",
"is",
"exponential",
"back",
"-",
"off",
"or",
"the",
"specified",
"duration"
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/models/RetryStrategy.java#L93-L106
|
146,004
|
OpenBEL/openbel-framework
|
org.openbel.framework.api/src/main/java/org/openbel/framework/api/BasicPathFinder.java
|
BasicPathFinder.endOfBranch
|
private boolean endOfBranch(final SetStack<KamEdge> edgeStack,
KamEdge edge,
int edgeCount) {
if (edgeStack.contains(edge) && edgeCount == 1) {
return true;
}
return false;
}
|
java
|
private boolean endOfBranch(final SetStack<KamEdge> edgeStack,
KamEdge edge,
int edgeCount) {
if (edgeStack.contains(edge) && edgeCount == 1) {
return true;
}
return false;
}
|
[
"private",
"boolean",
"endOfBranch",
"(",
"final",
"SetStack",
"<",
"KamEdge",
">",
"edgeStack",
",",
"KamEdge",
"edge",
",",
"int",
"edgeCount",
")",
"{",
"if",
"(",
"edgeStack",
".",
"contains",
"(",
"edge",
")",
"&&",
"edgeCount",
"==",
"1",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Determines whether the end of a branch was found. This can indicate
that a path should be captures up to the leaf node.
@param edgeStack {@link Stack} of {@link KamEdge} that holds the edges
on the current path
@param edge {@link KamEdge}, the edge to evaluate
@param edgeCount <tt>int</tt>, the number of adjacent edges to the
last visited {@link KamNode}
@return <tt>true</tt> if this edge marks the end of a branch,
<tt>false</tt> otherwise if it does not
|
[
"Determines",
"whether",
"the",
"end",
"of",
"a",
"branch",
"was",
"found",
".",
"This",
"can",
"indicate",
"that",
"a",
"path",
"should",
"be",
"captures",
"up",
"to",
"the",
"leaf",
"node",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.api/src/main/java/org/openbel/framework/api/BasicPathFinder.java#L423-L431
|
146,005
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/document/features/DocumentGeneratorFactory.java
|
DocumentGeneratorFactory.getDescriptorElements
|
public static List<Element> getDescriptorElements(InputStream xmlDescriptorIn)
throws IOException {
List<Element> elements = new ArrayList<>();
org.w3c.dom.Document xmlDescriptorDOM = createDOM(xmlDescriptorIn);
XPath xPath = XPathFactory.newInstance().newXPath();
NodeList allElements;
try {
XPathExpression exp = xPath.compile("//*");
allElements = (NodeList) exp.evaluate(xmlDescriptorDOM.getDocumentElement(), XPathConstants.NODESET);
} catch (XPathExpressionException e) {
throw new IllegalStateException("The hard coded XPath expression should always be valid!");
}
for (int i = 0; i < allElements.getLength(); i++) {
if (allElements.item(i) instanceof Element) {
Element customElement = (Element) allElements.item(i);
elements.add(customElement);
}
}
return elements;
}
|
java
|
public static List<Element> getDescriptorElements(InputStream xmlDescriptorIn)
throws IOException {
List<Element> elements = new ArrayList<>();
org.w3c.dom.Document xmlDescriptorDOM = createDOM(xmlDescriptorIn);
XPath xPath = XPathFactory.newInstance().newXPath();
NodeList allElements;
try {
XPathExpression exp = xPath.compile("//*");
allElements = (NodeList) exp.evaluate(xmlDescriptorDOM.getDocumentElement(), XPathConstants.NODESET);
} catch (XPathExpressionException e) {
throw new IllegalStateException("The hard coded XPath expression should always be valid!");
}
for (int i = 0; i < allElements.getLength(); i++) {
if (allElements.item(i) instanceof Element) {
Element customElement = (Element) allElements.item(i);
elements.add(customElement);
}
}
return elements;
}
|
[
"public",
"static",
"List",
"<",
"Element",
">",
"getDescriptorElements",
"(",
"InputStream",
"xmlDescriptorIn",
")",
"throws",
"IOException",
"{",
"List",
"<",
"Element",
">",
"elements",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"org",
".",
"w3c",
".",
"dom",
".",
"Document",
"xmlDescriptorDOM",
"=",
"createDOM",
"(",
"xmlDescriptorIn",
")",
";",
"XPath",
"xPath",
"=",
"XPathFactory",
".",
"newInstance",
"(",
")",
".",
"newXPath",
"(",
")",
";",
"NodeList",
"allElements",
";",
"try",
"{",
"XPathExpression",
"exp",
"=",
"xPath",
".",
"compile",
"(",
"\"//*\"",
")",
";",
"allElements",
"=",
"(",
"NodeList",
")",
"exp",
".",
"evaluate",
"(",
"xmlDescriptorDOM",
".",
"getDocumentElement",
"(",
")",
",",
"XPathConstants",
".",
"NODESET",
")",
";",
"}",
"catch",
"(",
"XPathExpressionException",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"The hard coded XPath expression should always be valid!\"",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"allElements",
".",
"getLength",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"allElements",
".",
"item",
"(",
"i",
")",
"instanceof",
"Element",
")",
"{",
"Element",
"customElement",
"=",
"(",
"Element",
")",
"allElements",
".",
"item",
"(",
"i",
")",
";",
"elements",
".",
"add",
"(",
"customElement",
")",
";",
"}",
"}",
"return",
"elements",
";",
"}"
] |
Provides a list with all the elements in the xml feature descriptor.
@param xmlDescriptorIn the xml feature descriptor
@return a list containing all elements
@throws IOException if inputstream cannot be open
@throws InvalidFormatException if xml is not well-formed
|
[
"Provides",
"a",
"list",
"with",
"all",
"the",
"elements",
"in",
"the",
"xml",
"feature",
"descriptor",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/document/features/DocumentGeneratorFactory.java#L306-L327
|
146,006
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/WicketComponentExtensions.java
|
WicketComponentExtensions.getContextPath
|
@Deprecated
public static String getContextPath(final WebApplication application)
{
final String contextPath = application.getServletContext().getContextPath();
if ((null != contextPath) && !contextPath.isEmpty())
{
return contextPath;
}
return "";
}
|
java
|
@Deprecated
public static String getContextPath(final WebApplication application)
{
final String contextPath = application.getServletContext().getContextPath();
if ((null != contextPath) && !contextPath.isEmpty())
{
return contextPath;
}
return "";
}
|
[
"@",
"Deprecated",
"public",
"static",
"String",
"getContextPath",
"(",
"final",
"WebApplication",
"application",
")",
"{",
"final",
"String",
"contextPath",
"=",
"application",
".",
"getServletContext",
"(",
")",
".",
"getContextPath",
"(",
")",
";",
"if",
"(",
"(",
"null",
"!=",
"contextPath",
")",
"&&",
"!",
"contextPath",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"contextPath",
";",
"}",
"return",
"\"\"",
";",
"}"
] |
Gets the context path from the given WebApplication.
@param application
the WebApplication
@return the context path
@deprecated use instead {@link ApplicationExtensions#getContextPath(WebApplication)}
|
[
"Gets",
"the",
"context",
"path",
"from",
"the",
"given",
"WebApplication",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/WicketComponentExtensions.java#L82-L91
|
146,007
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/WicketComponentExtensions.java
|
WicketComponentExtensions.getHeaderContributorForFavicon
|
public static Behavior getHeaderContributorForFavicon()
{
return new Behavior()
{
private static final long serialVersionUID = 1L;
@Override
public void renderHead(final Component component, final IHeaderResponse response)
{
super.renderHead(component, response);
response.render(new StringHeaderItem(
"<link type=\"image/x-icon\" rel=\"shortcut icon\" href=\"favicon.ico\" />"));
}
};
}
|
java
|
public static Behavior getHeaderContributorForFavicon()
{
return new Behavior()
{
private static final long serialVersionUID = 1L;
@Override
public void renderHead(final Component component, final IHeaderResponse response)
{
super.renderHead(component, response);
response.render(new StringHeaderItem(
"<link type=\"image/x-icon\" rel=\"shortcut icon\" href=\"favicon.ico\" />"));
}
};
}
|
[
"public",
"static",
"Behavior",
"getHeaderContributorForFavicon",
"(",
")",
"{",
"return",
"new",
"Behavior",
"(",
")",
"{",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"1L",
";",
"@",
"Override",
"public",
"void",
"renderHead",
"(",
"final",
"Component",
"component",
",",
"final",
"IHeaderResponse",
"response",
")",
"{",
"super",
".",
"renderHead",
"(",
"component",
",",
"response",
")",
";",
"response",
".",
"render",
"(",
"new",
"StringHeaderItem",
"(",
"\"<link type=\\\"image/x-icon\\\" rel=\\\"shortcut icon\\\" href=\\\"favicon.ico\\\" />\"",
")",
")",
";",
"}",
"}",
";",
"}"
] |
Gets the header contributor for favicon.
@return the header contributor for favicon
|
[
"Gets",
"the",
"header",
"contributor",
"for",
"favicon",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/WicketComponentExtensions.java#L98-L112
|
146,008
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/WicketComponentExtensions.java
|
WicketComponentExtensions.getHttpServletRequest
|
public static HttpServletRequest getHttpServletRequest(final Request request)
{
final WebRequest webRequest = (WebRequest)request;
final HttpServletRequest httpServletRequest = (HttpServletRequest)webRequest
.getContainerRequest();
return httpServletRequest;
}
|
java
|
public static HttpServletRequest getHttpServletRequest(final Request request)
{
final WebRequest webRequest = (WebRequest)request;
final HttpServletRequest httpServletRequest = (HttpServletRequest)webRequest
.getContainerRequest();
return httpServletRequest;
}
|
[
"public",
"static",
"HttpServletRequest",
"getHttpServletRequest",
"(",
"final",
"Request",
"request",
")",
"{",
"final",
"WebRequest",
"webRequest",
"=",
"(",
"WebRequest",
")",
"request",
";",
"final",
"HttpServletRequest",
"httpServletRequest",
"=",
"(",
"HttpServletRequest",
")",
"webRequest",
".",
"getContainerRequest",
"(",
")",
";",
"return",
"httpServletRequest",
";",
"}"
] |
Gets the http servlet request.
@param request
the request
@return the http servlet request
|
[
"Gets",
"the",
"http",
"servlet",
"request",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/WicketComponentExtensions.java#L132-L138
|
146,009
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/WicketComponentExtensions.java
|
WicketComponentExtensions.getHttpServletResponse
|
public static HttpServletResponse getHttpServletResponse(final Response response)
{
final WebResponse webResponse = (WebResponse)response;
final HttpServletResponse httpServletResponse = (HttpServletResponse)webResponse
.getContainerResponse();
return httpServletResponse;
}
|
java
|
public static HttpServletResponse getHttpServletResponse(final Response response)
{
final WebResponse webResponse = (WebResponse)response;
final HttpServletResponse httpServletResponse = (HttpServletResponse)webResponse
.getContainerResponse();
return httpServletResponse;
}
|
[
"public",
"static",
"HttpServletResponse",
"getHttpServletResponse",
"(",
"final",
"Response",
"response",
")",
"{",
"final",
"WebResponse",
"webResponse",
"=",
"(",
"WebResponse",
")",
"response",
";",
"final",
"HttpServletResponse",
"httpServletResponse",
"=",
"(",
"HttpServletResponse",
")",
"webResponse",
".",
"getContainerResponse",
"(",
")",
";",
"return",
"httpServletResponse",
";",
"}"
] |
Gets the http servlet response.
@param response
the response
@return the http servlet response
|
[
"Gets",
"the",
"http",
"servlet",
"response",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/WicketComponentExtensions.java#L158-L164
|
146,010
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/WicketComponentExtensions.java
|
WicketComponentExtensions.setDefaultSecurityHeaders
|
public static void setDefaultSecurityHeaders(final WebResponse response)
{
// Category: Framing
WicketComponentExtensions.setSecurityFramingHeaders(response);
// Category: Transport
WicketComponentExtensions.setSecurityTransportHeaders(response);
// Category: XSS
WicketComponentExtensions.setSecurityXSSHeaders(response);
// Category: Caching
WicketComponentExtensions.setSecurityCachingHeaders(response);
}
|
java
|
public static void setDefaultSecurityHeaders(final WebResponse response)
{
// Category: Framing
WicketComponentExtensions.setSecurityFramingHeaders(response);
// Category: Transport
WicketComponentExtensions.setSecurityTransportHeaders(response);
// Category: XSS
WicketComponentExtensions.setSecurityXSSHeaders(response);
// Category: Caching
WicketComponentExtensions.setSecurityCachingHeaders(response);
}
|
[
"public",
"static",
"void",
"setDefaultSecurityHeaders",
"(",
"final",
"WebResponse",
"response",
")",
"{",
"// Category: Framing\r",
"WicketComponentExtensions",
".",
"setSecurityFramingHeaders",
"(",
"response",
")",
";",
"// Category: Transport\r",
"WicketComponentExtensions",
".",
"setSecurityTransportHeaders",
"(",
"response",
")",
";",
"// Category: XSS\r",
"WicketComponentExtensions",
".",
"setSecurityXSSHeaders",
"(",
"response",
")",
";",
"// Category: Caching\r",
"WicketComponentExtensions",
".",
"setSecurityCachingHeaders",
"(",
"response",
")",
";",
"}"
] |
Sets the security headers. You can check your setting on on the link below.
@see <a href="http://cyh.herokuapp.com/cyh">check headers</a>
@param response
the new security headers
|
[
"Sets",
"the",
"security",
"headers",
".",
"You",
"can",
"check",
"your",
"setting",
"on",
"on",
"the",
"link",
"below",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/WicketComponentExtensions.java#L294-L304
|
146,011
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/WicketComponentExtensions.java
|
WicketComponentExtensions.toAbsolutePath
|
public static String toAbsolutePath(final String relativePagePath)
{
final HttpServletRequest req = (HttpServletRequest)((WebRequest)RequestCycle.get()
.getRequest()).getContainerRequest();
return RequestUtils.toAbsolutePath(req.getRequestURL().toString(), relativePagePath);
}
|
java
|
public static String toAbsolutePath(final String relativePagePath)
{
final HttpServletRequest req = (HttpServletRequest)((WebRequest)RequestCycle.get()
.getRequest()).getContainerRequest();
return RequestUtils.toAbsolutePath(req.getRequestURL().toString(), relativePagePath);
}
|
[
"public",
"static",
"String",
"toAbsolutePath",
"(",
"final",
"String",
"relativePagePath",
")",
"{",
"final",
"HttpServletRequest",
"req",
"=",
"(",
"HttpServletRequest",
")",
"(",
"(",
"WebRequest",
")",
"RequestCycle",
".",
"get",
"(",
")",
".",
"getRequest",
"(",
")",
")",
".",
"getContainerRequest",
"(",
")",
";",
"return",
"RequestUtils",
".",
"toAbsolutePath",
"(",
"req",
".",
"getRequestURL",
"(",
")",
".",
"toString",
"(",
")",
",",
"relativePagePath",
")",
";",
"}"
] |
Helper method for the migration from wicket-version 1.5.x to 6.x.
@param relativePagePath
the relative page path
@return the string
|
[
"Helper",
"method",
"for",
"the",
"migration",
"from",
"wicket",
"-",
"version",
"1",
".",
"5",
".",
"x",
"to",
"6",
".",
"x",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/WicketComponentExtensions.java#L406-L411
|
146,012
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/resources/PredicateContext.java
|
PredicateContext.serialize
|
public void serialize(final OutputStream out) throws IOException {
final Writer writer = new BufferedWriter(new OutputStreamWriter(out));
for (final List<String> entry : this.predContexts) {
writer.write(
entry.get(0) + "\t" + entry.get(1) + "\t" + entry.get(2) + "\n");
}
writer.flush();
}
|
java
|
public void serialize(final OutputStream out) throws IOException {
final Writer writer = new BufferedWriter(new OutputStreamWriter(out));
for (final List<String> entry : this.predContexts) {
writer.write(
entry.get(0) + "\t" + entry.get(1) + "\t" + entry.get(2) + "\n");
}
writer.flush();
}
|
[
"public",
"void",
"serialize",
"(",
"final",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"final",
"Writer",
"writer",
"=",
"new",
"BufferedWriter",
"(",
"new",
"OutputStreamWriter",
"(",
"out",
")",
")",
";",
"for",
"(",
"final",
"List",
"<",
"String",
">",
"entry",
":",
"this",
".",
"predContexts",
")",
"{",
"writer",
".",
"write",
"(",
"entry",
".",
"get",
"(",
"0",
")",
"+",
"\"\\t\"",
"+",
"entry",
".",
"get",
"(",
"1",
")",
"+",
"\"\\t\"",
"+",
"entry",
".",
"get",
"(",
"2",
")",
"+",
"\"\\n\"",
")",
";",
"}",
"writer",
".",
"flush",
"(",
")",
";",
"}"
] |
Serialize the dictionary to original corpus format
@param out
the output stream
@throws IOException
if io problems
|
[
"Serialize",
"the",
"dictionary",
"to",
"original",
"corpus",
"format"
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/resources/PredicateContext.java#L111-L119
|
146,013
|
geomajas/geomajas-project-client-gwt2
|
api/src/main/java/org/geomajas/gwt2/client/map/View.java
|
View.getHint
|
@SuppressWarnings("unchecked")
public <T> T getHint(Hint<T> hint) {
return (T) hintValues.get(hint);
}
|
java
|
@SuppressWarnings("unchecked")
public <T> T getHint(Hint<T> hint) {
return (T) hintValues.get(hint);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"getHint",
"(",
"Hint",
"<",
"T",
">",
"hint",
")",
"{",
"return",
"(",
"T",
")",
"hintValues",
".",
"get",
"(",
"hint",
")",
";",
"}"
] |
Get a hint value.
@param hint
@return the value
@since 2.4.0
|
[
"Get",
"a",
"hint",
"value",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/api/src/main/java/org/geomajas/gwt2/client/map/View.java#L93-L96
|
146,014
|
ihaolin/session
|
session-api/src/main/java/me/hao0/session/core/HttpServletRequest2.java
|
HttpServletRequest2.doGetSession
|
private HttpSession doGetSession(boolean create) {
if (session == null) {
Cookie cookie = WebUtil.findCookie(this, getSessionCookieName());
if (cookie != null) {
String value = cookie.getValue();
log.debug("discovery session id from cookie: {}", value);
session = buildSession(value, false);
} else {
session = buildSession(create);
}
} else {
log.debug("Session[{}] was existed.", session.getId());
}
return session;
}
|
java
|
private HttpSession doGetSession(boolean create) {
if (session == null) {
Cookie cookie = WebUtil.findCookie(this, getSessionCookieName());
if (cookie != null) {
String value = cookie.getValue();
log.debug("discovery session id from cookie: {}", value);
session = buildSession(value, false);
} else {
session = buildSession(create);
}
} else {
log.debug("Session[{}] was existed.", session.getId());
}
return session;
}
|
[
"private",
"HttpSession",
"doGetSession",
"(",
"boolean",
"create",
")",
"{",
"if",
"(",
"session",
"==",
"null",
")",
"{",
"Cookie",
"cookie",
"=",
"WebUtil",
".",
"findCookie",
"(",
"this",
",",
"getSessionCookieName",
"(",
")",
")",
";",
"if",
"(",
"cookie",
"!=",
"null",
")",
"{",
"String",
"value",
"=",
"cookie",
".",
"getValue",
"(",
")",
";",
"log",
".",
"debug",
"(",
"\"discovery session id from cookie: {}\"",
",",
"value",
")",
";",
"session",
"=",
"buildSession",
"(",
"value",
",",
"false",
")",
";",
"}",
"else",
"{",
"session",
"=",
"buildSession",
"(",
"create",
")",
";",
"}",
"}",
"else",
"{",
"log",
".",
"debug",
"(",
"\"Session[{}] was existed.\"",
",",
"session",
".",
"getId",
"(",
")",
")",
";",
"}",
"return",
"session",
";",
"}"
] |
get session from session cookie name
@param create if true create
@return session
|
[
"get",
"session",
"from",
"session",
"cookie",
"name"
] |
322c3a9f47b305a39345135fa8163dd7e065b4f8
|
https://github.com/ihaolin/session/blob/322c3a9f47b305a39345135fa8163dd7e065b4f8/session-api/src/main/java/me/hao0/session/core/HttpServletRequest2.java#L133-L147
|
146,015
|
ihaolin/session
|
session-api/src/main/java/me/hao0/session/core/HttpServletRequest2.java
|
HttpServletRequest2.buildSession
|
private HttpSession2 buildSession(String id, boolean refresh) {
HttpSession2 session = new HttpSession2(id, sessionManager, request.getServletContext());
session.setMaxInactiveInterval(maxInactiveInterval);
if (refresh) {
WebUtil.addCookie(this, response, getSessionCookieName(), id,
getCookieDomain(), getCookieContextPath(), cookieMaxAge, true);
}
return session;
}
|
java
|
private HttpSession2 buildSession(String id, boolean refresh) {
HttpSession2 session = new HttpSession2(id, sessionManager, request.getServletContext());
session.setMaxInactiveInterval(maxInactiveInterval);
if (refresh) {
WebUtil.addCookie(this, response, getSessionCookieName(), id,
getCookieDomain(), getCookieContextPath(), cookieMaxAge, true);
}
return session;
}
|
[
"private",
"HttpSession2",
"buildSession",
"(",
"String",
"id",
",",
"boolean",
"refresh",
")",
"{",
"HttpSession2",
"session",
"=",
"new",
"HttpSession2",
"(",
"id",
",",
"sessionManager",
",",
"request",
".",
"getServletContext",
"(",
")",
")",
";",
"session",
".",
"setMaxInactiveInterval",
"(",
"maxInactiveInterval",
")",
";",
"if",
"(",
"refresh",
")",
"{",
"WebUtil",
".",
"addCookie",
"(",
"this",
",",
"response",
",",
"getSessionCookieName",
"(",
")",
",",
"id",
",",
"getCookieDomain",
"(",
")",
",",
"getCookieContextPath",
"(",
")",
",",
"cookieMaxAge",
",",
"true",
")",
";",
"}",
"return",
"session",
";",
"}"
] |
build a new session from session id
@param id session id
@param refresh refresh cookie or not
@return session
|
[
"build",
"a",
"new",
"session",
"from",
"session",
"id"
] |
322c3a9f47b305a39345135fa8163dd7e065b4f8
|
https://github.com/ihaolin/session/blob/322c3a9f47b305a39345135fa8163dd7e065b4f8/session-api/src/main/java/me/hao0/session/core/HttpServletRequest2.java#L155-L163
|
146,016
|
ihaolin/session
|
session-api/src/main/java/me/hao0/session/core/HttpServletRequest2.java
|
HttpServletRequest2.buildSession
|
private HttpSession2 buildSession(boolean create) {
if (create) {
session = buildSession(sessionManager.getSessionIdGenerator().generate(request), true);
log.debug("Build new session[{}].", session.getId());
return session;
} else {
return null;
}
}
|
java
|
private HttpSession2 buildSession(boolean create) {
if (create) {
session = buildSession(sessionManager.getSessionIdGenerator().generate(request), true);
log.debug("Build new session[{}].", session.getId());
return session;
} else {
return null;
}
}
|
[
"private",
"HttpSession2",
"buildSession",
"(",
"boolean",
"create",
")",
"{",
"if",
"(",
"create",
")",
"{",
"session",
"=",
"buildSession",
"(",
"sessionManager",
".",
"getSessionIdGenerator",
"(",
")",
".",
"generate",
"(",
"request",
")",
",",
"true",
")",
";",
"log",
".",
"debug",
"(",
"\"Build new session[{}].\"",
",",
"session",
".",
"getId",
"(",
")",
")",
";",
"return",
"session",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] |
build a new session
@param create create session or not
@return session
|
[
"build",
"a",
"new",
"session"
] |
322c3a9f47b305a39345135fa8163dd7e065b4f8
|
https://github.com/ihaolin/session/blob/322c3a9f47b305a39345135fa8163dd7e065b4f8/session-api/src/main/java/me/hao0/session/core/HttpServletRequest2.java#L170-L178
|
146,017
|
astrapi69/jaulp-wicket
|
jaulp-wicket-behaviors/src/main/java/de/alpharogroup/wicket/behaviors/FocusRequestBehavior.java
|
FocusRequestBehavior.newJavaScript
|
protected String newJavaScript(final Component component)
{
final StringBuilder sb = new StringBuilder();
sb.append("setTimeout(" + "function() {" + "var component = document.getElementById(\"")
.append(component.getMarkupId()).append("\");");
if (clearValue)
{
sb.append("component.value = \"\";");
}
sb.append("component.focus();");
sb.append("}, " + this.delay + ")");
return sb.toString();
}
|
java
|
protected String newJavaScript(final Component component)
{
final StringBuilder sb = new StringBuilder();
sb.append("setTimeout(" + "function() {" + "var component = document.getElementById(\"")
.append(component.getMarkupId()).append("\");");
if (clearValue)
{
sb.append("component.value = \"\";");
}
sb.append("component.focus();");
sb.append("}, " + this.delay + ")");
return sb.toString();
}
|
[
"protected",
"String",
"newJavaScript",
"(",
"final",
"Component",
"component",
")",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"setTimeout(\"",
"+",
"\"function() {\"",
"+",
"\"var component = document.getElementById(\\\"\"",
")",
".",
"append",
"(",
"component",
".",
"getMarkupId",
"(",
")",
")",
".",
"append",
"(",
"\"\\\");\"",
")",
";",
"if",
"(",
"clearValue",
")",
"{",
"sb",
".",
"append",
"(",
"\"component.value = \\\"\\\";\"",
")",
";",
"}",
"sb",
".",
"append",
"(",
"\"component.focus();\"",
")",
";",
"sb",
".",
"append",
"(",
"\"}, \"",
"+",
"this",
".",
"delay",
"+",
"\")\"",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Factory method that creates the java script code for request focus.
@param component
the component
@return the string
|
[
"Factory",
"method",
"that",
"creates",
"the",
"java",
"script",
"code",
"for",
"request",
"focus",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-behaviors/src/main/java/de/alpharogroup/wicket/behaviors/FocusRequestBehavior.java#L148-L160
|
146,018
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java
|
WicketUrlExtensions.absoluteUrlFor
|
public static <C extends Page> String absoluteUrlFor(final Class<C> page)
{
return absoluteUrlFor(page, null, false);
}
|
java
|
public static <C extends Page> String absoluteUrlFor(final Class<C> page)
{
return absoluteUrlFor(page, null, false);
}
|
[
"public",
"static",
"<",
"C",
"extends",
"Page",
">",
"String",
"absoluteUrlFor",
"(",
"final",
"Class",
"<",
"C",
">",
"page",
")",
"{",
"return",
"absoluteUrlFor",
"(",
"page",
",",
"null",
",",
"false",
")",
";",
"}"
] |
Returns the absolute url for the given page without the server port.
@param <C>
the generic type
@param page
the page
@return the string
|
[
"Returns",
"the",
"absolute",
"url",
"for",
"the",
"given",
"page",
"without",
"the",
"server",
"port",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java#L41-L44
|
146,019
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java
|
WicketUrlExtensions.absoluteUrlFor
|
public static <C extends Page> String absoluteUrlFor(final Class<C> page,
final boolean withServerPort)
{
return absoluteUrlFor(page, null, withServerPort);
}
|
java
|
public static <C extends Page> String absoluteUrlFor(final Class<C> page,
final boolean withServerPort)
{
return absoluteUrlFor(page, null, withServerPort);
}
|
[
"public",
"static",
"<",
"C",
"extends",
"Page",
">",
"String",
"absoluteUrlFor",
"(",
"final",
"Class",
"<",
"C",
">",
"page",
",",
"final",
"boolean",
"withServerPort",
")",
"{",
"return",
"absoluteUrlFor",
"(",
"page",
",",
"null",
",",
"withServerPort",
")",
";",
"}"
] |
Returns the absolute url for the given page and optionally with the server port.
@param <C>
the generic type
@param page
the page
@param withServerPort
the with server port
@return the string
|
[
"Returns",
"the",
"absolute",
"url",
"for",
"the",
"given",
"page",
"and",
"optionally",
"with",
"the",
"server",
"port",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java#L57-L61
|
146,020
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java
|
WicketUrlExtensions.absoluteUrlFor
|
public static <C extends Page> String absoluteUrlFor(final Class<C> page,
final PageParameters parameters, final boolean withServerPort)
{
final StringBuilder url = new StringBuilder();
url.append(WicketUrlExtensions.getDomainUrl(withServerPort));
url.append(WicketUrlExtensions.getBaseUrl(page, parameters).canonical().toString());
return url.toString();
}
|
java
|
public static <C extends Page> String absoluteUrlFor(final Class<C> page,
final PageParameters parameters, final boolean withServerPort)
{
final StringBuilder url = new StringBuilder();
url.append(WicketUrlExtensions.getDomainUrl(withServerPort));
url.append(WicketUrlExtensions.getBaseUrl(page, parameters).canonical().toString());
return url.toString();
}
|
[
"public",
"static",
"<",
"C",
"extends",
"Page",
">",
"String",
"absoluteUrlFor",
"(",
"final",
"Class",
"<",
"C",
">",
"page",
",",
"final",
"PageParameters",
"parameters",
",",
"final",
"boolean",
"withServerPort",
")",
"{",
"final",
"StringBuilder",
"url",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"url",
".",
"append",
"(",
"WicketUrlExtensions",
".",
"getDomainUrl",
"(",
"withServerPort",
")",
")",
";",
"url",
".",
"append",
"(",
"WicketUrlExtensions",
".",
"getBaseUrl",
"(",
"page",
",",
"parameters",
")",
".",
"canonical",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"return",
"url",
".",
"toString",
"(",
")",
";",
"}"
] |
Returns the absolute url for the given page with the parameters and optionally with the
server port.
@param <C>
the generic type
@param page
the page
@param parameters
the parameters
@param withServerPort
the with server port
@return the string
|
[
"Returns",
"the",
"absolute",
"url",
"for",
"the",
"given",
"page",
"with",
"the",
"parameters",
"and",
"optionally",
"with",
"the",
"server",
"port",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java#L77-L84
|
146,021
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java
|
WicketUrlExtensions.getBaseUrl
|
public static Url getBaseUrl(final Class<? extends Page> pageClass,
final PageParameters parameters)
{
return RequestCycle.get().mapUrlFor(pageClass, parameters);
}
|
java
|
public static Url getBaseUrl(final Class<? extends Page> pageClass,
final PageParameters parameters)
{
return RequestCycle.get().mapUrlFor(pageClass, parameters);
}
|
[
"public",
"static",
"Url",
"getBaseUrl",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Page",
">",
"pageClass",
",",
"final",
"PageParameters",
"parameters",
")",
"{",
"return",
"RequestCycle",
".",
"get",
"(",
")",
".",
"mapUrlFor",
"(",
"pageClass",
",",
"parameters",
")",
";",
"}"
] |
Gets the base url.
@param pageClass
the page class
@param parameters
the parameters
@return the base url
|
[
"Gets",
"the",
"base",
"url",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java#L117-L121
|
146,022
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java
|
WicketUrlExtensions.getDomainUrl
|
public static String getDomainUrl(final boolean ssl, final boolean withServerPort,
final boolean withSlashAtTheEnd)
{
return newDomainUrl(ssl ? Scheme.HTTPS.urlName() : Scheme.HTTP.urlName(),
WicketUrlExtensions.getServerName(),
WicketComponentExtensions.getHttpServletRequest().getServerPort(), withServerPort,
withSlashAtTheEnd);
}
|
java
|
public static String getDomainUrl(final boolean ssl, final boolean withServerPort,
final boolean withSlashAtTheEnd)
{
return newDomainUrl(ssl ? Scheme.HTTPS.urlName() : Scheme.HTTP.urlName(),
WicketUrlExtensions.getServerName(),
WicketComponentExtensions.getHttpServletRequest().getServerPort(), withServerPort,
withSlashAtTheEnd);
}
|
[
"public",
"static",
"String",
"getDomainUrl",
"(",
"final",
"boolean",
"ssl",
",",
"final",
"boolean",
"withServerPort",
",",
"final",
"boolean",
"withSlashAtTheEnd",
")",
"{",
"return",
"newDomainUrl",
"(",
"ssl",
"?",
"Scheme",
".",
"HTTPS",
".",
"urlName",
"(",
")",
":",
"Scheme",
".",
"HTTP",
".",
"urlName",
"(",
")",
",",
"WicketUrlExtensions",
".",
"getServerName",
"(",
")",
",",
"WicketComponentExtensions",
".",
"getHttpServletRequest",
"(",
")",
".",
"getServerPort",
"(",
")",
",",
"withServerPort",
",",
"withSlashAtTheEnd",
")",
";",
"}"
] |
Gets the domain url.
@param ssl
if the domain url is secure the scheme https will be added otherwise http
@param withServerPort
the with server port
@param withSlashAtTheEnd
the with slash at the end
@return the domain url
|
[
"Gets",
"the",
"domain",
"url",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java#L236-L243
|
146,023
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java
|
WicketUrlExtensions.getUrlAsString
|
public static String getUrlAsString(final Class<? extends Page> pageClass)
{
final Url pageUrl = getPageUrl(pageClass);
final Url url = getBaseUrl(pageClass);
url.resolveRelative(pageUrl);
final String contextPath = getContextPath();
return String.format("%s/%s", contextPath, url);
}
|
java
|
public static String getUrlAsString(final Class<? extends Page> pageClass)
{
final Url pageUrl = getPageUrl(pageClass);
final Url url = getBaseUrl(pageClass);
url.resolveRelative(pageUrl);
final String contextPath = getContextPath();
return String.format("%s/%s", contextPath, url);
}
|
[
"public",
"static",
"String",
"getUrlAsString",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Page",
">",
"pageClass",
")",
"{",
"final",
"Url",
"pageUrl",
"=",
"getPageUrl",
"(",
"pageClass",
")",
";",
"final",
"Url",
"url",
"=",
"getBaseUrl",
"(",
"pageClass",
")",
";",
"url",
".",
"resolveRelative",
"(",
"pageUrl",
")",
";",
"final",
"String",
"contextPath",
"=",
"getContextPath",
"(",
")",
";",
"return",
"String",
".",
"format",
"(",
"\"%s/%s\"",
",",
"contextPath",
",",
"url",
")",
";",
"}"
] |
Gets the url as string from the given WebPage class object.
@param pageClass
the page class
@return the url as string
|
[
"Gets",
"the",
"url",
"as",
"string",
"from",
"the",
"given",
"WebPage",
"class",
"object",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java#L330-L337
|
146,024
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java
|
WicketUrlExtensions.newDomainUrl
|
public static String newDomainUrl(final String scheme, final String domainName, final int port,
final boolean withServerPort, final boolean withSlashAtTheEnd)
{
final StringBuilder domainUrl = new StringBuilder();
domainUrl.append(scheme);
domainUrl.append("://");
domainUrl.append(domainName);
if (withServerPort)
{
domainUrl.append(":");
domainUrl.append(port);
}
if (withSlashAtTheEnd)
{
domainUrl.append("/");
}
return domainUrl.toString();
}
|
java
|
public static String newDomainUrl(final String scheme, final String domainName, final int port,
final boolean withServerPort, final boolean withSlashAtTheEnd)
{
final StringBuilder domainUrl = new StringBuilder();
domainUrl.append(scheme);
domainUrl.append("://");
domainUrl.append(domainName);
if (withServerPort)
{
domainUrl.append(":");
domainUrl.append(port);
}
if (withSlashAtTheEnd)
{
domainUrl.append("/");
}
return domainUrl.toString();
}
|
[
"public",
"static",
"String",
"newDomainUrl",
"(",
"final",
"String",
"scheme",
",",
"final",
"String",
"domainName",
",",
"final",
"int",
"port",
",",
"final",
"boolean",
"withServerPort",
",",
"final",
"boolean",
"withSlashAtTheEnd",
")",
"{",
"final",
"StringBuilder",
"domainUrl",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"domainUrl",
".",
"append",
"(",
"scheme",
")",
";",
"domainUrl",
".",
"append",
"(",
"\"://\"",
")",
";",
"domainUrl",
".",
"append",
"(",
"domainName",
")",
";",
"if",
"(",
"withServerPort",
")",
"{",
"domainUrl",
".",
"append",
"(",
"\":\"",
")",
";",
"domainUrl",
".",
"append",
"(",
"port",
")",
";",
"}",
"if",
"(",
"withSlashAtTheEnd",
")",
"{",
"domainUrl",
".",
"append",
"(",
"\"/\"",
")",
";",
"}",
"return",
"domainUrl",
".",
"toString",
"(",
")",
";",
"}"
] |
Creates a new domain url from the given parameters.
@param scheme
the scheme
@param domainName
the domain name
@param port
the port
@param withServerPort
the with server port
@param withSlashAtTheEnd
the with slash at the end
@return the string
|
[
"Creates",
"a",
"new",
"domain",
"url",
"from",
"the",
"given",
"parameters",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java#L366-L383
|
146,025
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java
|
WicketUrlExtensions.toBaseUrl
|
public static String toBaseUrl(final Class<? extends Page> pageClass,
final PageParameters parameters)
{
return getBaseUrl(pageClass, parameters).canonical().toString();
}
|
java
|
public static String toBaseUrl(final Class<? extends Page> pageClass,
final PageParameters parameters)
{
return getBaseUrl(pageClass, parameters).canonical().toString();
}
|
[
"public",
"static",
"String",
"toBaseUrl",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Page",
">",
"pageClass",
",",
"final",
"PageParameters",
"parameters",
")",
"{",
"return",
"getBaseUrl",
"(",
"pageClass",
",",
"parameters",
")",
".",
"canonical",
"(",
")",
".",
"toString",
"(",
")",
";",
"}"
] |
Gets the base ur as String.
@param pageClass
the page class
@param parameters
the parameters
@return the base url as String.
|
[
"Gets",
"the",
"base",
"ur",
"as",
"String",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java#L416-L420
|
146,026
|
ops4j/org.ops4j.pax.exam1
|
pax-exam-junit/src/main/java/org/ops4j/pax/exam/junit/options/MockitoBundlesOption.java
|
MockitoBundlesOption.version
|
public MockitoBundlesOption version( final String version )
{
( (MavenArtifactUrlReference) ( (WrappedUrlProvisionOption) getDelegate() ).getUrlReference() ).version(
version
);
return this;
}
|
java
|
public MockitoBundlesOption version( final String version )
{
( (MavenArtifactUrlReference) ( (WrappedUrlProvisionOption) getDelegate() ).getUrlReference() ).version(
version
);
return this;
}
|
[
"public",
"MockitoBundlesOption",
"version",
"(",
"final",
"String",
"version",
")",
"{",
"(",
"(",
"MavenArtifactUrlReference",
")",
"(",
"(",
"WrappedUrlProvisionOption",
")",
"getDelegate",
"(",
")",
")",
".",
"getUrlReference",
"(",
")",
")",
".",
"version",
"(",
"version",
")",
";",
"return",
"this",
";",
"}"
] |
Sets the Mockito version.
@param version Mockito version.
@return itself, for fluent api usage
|
[
"Sets",
"the",
"Mockito",
"version",
"."
] |
7c8742208117ff91bd24bcd3a185d2d019f7000f
|
https://github.com/ops4j/org.ops4j.pax.exam1/blob/7c8742208117ff91bd24bcd3a185d2d019f7000f/pax-exam-junit/src/main/java/org/ops4j/pax/exam/junit/options/MockitoBundlesOption.java#L66-L72
|
146,027
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamManager.java
|
KamManager.main
|
public static void main(String[] args) throws Exception {
KamManager app = new KamManager(args);
app.run();
}
|
java
|
public static void main(String[] args) throws Exception {
KamManager app = new KamManager(args);
app.run();
}
|
[
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"KamManager",
"app",
"=",
"new",
"KamManager",
"(",
"args",
")",
";",
"app",
".",
"run",
"(",
")",
";",
"}"
] |
Static main method to launch the KAM Manager tool.
@param args {@link String String[]} the command-line arguments
|
[
"Static",
"main",
"method",
"to",
"launch",
"the",
"KAM",
"Manager",
"tool",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamManager.java#L134-L138
|
146,028
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamManager.java
|
KamManager.determineCommand
|
private void determineCommand() {
command = null;
commandStr = null;
boolean tooManyCommands = false;
for (Command c : Command.values()) {
final String alias = c.getAlias();
if (hasOption(alias)) {
if (c == Command.HELP) {
// `--help` can be a command or just a long option for another command.
help = true;
} else if (command == null) {
// Found a command option
command = c;
commandStr = alias;
} else {
tooManyCommands = true;
}
}
}
if (tooManyCommands) {
command = null;
commandStr = null;
if (!help) {
reportable.error(format(
"You must specify only one command (%s).%n",
showCommandAliases()));
printHelp(true);
}
}
if (help && command == null) {
// `--help` is considered as the command if no other command is provided.
command = Command.HELP;
commandStr = command.getAlias();
} else if (command == null) {
// Print usage if no commands were specified
printUsage();
reportable.error("\n");
reportable
.error("No command option given. Please specify one of: "
+ showCommandAliases());
end();
}
}
|
java
|
private void determineCommand() {
command = null;
commandStr = null;
boolean tooManyCommands = false;
for (Command c : Command.values()) {
final String alias = c.getAlias();
if (hasOption(alias)) {
if (c == Command.HELP) {
// `--help` can be a command or just a long option for another command.
help = true;
} else if (command == null) {
// Found a command option
command = c;
commandStr = alias;
} else {
tooManyCommands = true;
}
}
}
if (tooManyCommands) {
command = null;
commandStr = null;
if (!help) {
reportable.error(format(
"You must specify only one command (%s).%n",
showCommandAliases()));
printHelp(true);
}
}
if (help && command == null) {
// `--help` is considered as the command if no other command is provided.
command = Command.HELP;
commandStr = command.getAlias();
} else if (command == null) {
// Print usage if no commands were specified
printUsage();
reportable.error("\n");
reportable
.error("No command option given. Please specify one of: "
+ showCommandAliases());
end();
}
}
|
[
"private",
"void",
"determineCommand",
"(",
")",
"{",
"command",
"=",
"null",
";",
"commandStr",
"=",
"null",
";",
"boolean",
"tooManyCommands",
"=",
"false",
";",
"for",
"(",
"Command",
"c",
":",
"Command",
".",
"values",
"(",
")",
")",
"{",
"final",
"String",
"alias",
"=",
"c",
".",
"getAlias",
"(",
")",
";",
"if",
"(",
"hasOption",
"(",
"alias",
")",
")",
"{",
"if",
"(",
"c",
"==",
"Command",
".",
"HELP",
")",
"{",
"// `--help` can be a command or just a long option for another command.",
"help",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"command",
"==",
"null",
")",
"{",
"// Found a command option",
"command",
"=",
"c",
";",
"commandStr",
"=",
"alias",
";",
"}",
"else",
"{",
"tooManyCommands",
"=",
"true",
";",
"}",
"}",
"}",
"if",
"(",
"tooManyCommands",
")",
"{",
"command",
"=",
"null",
";",
"commandStr",
"=",
"null",
";",
"if",
"(",
"!",
"help",
")",
"{",
"reportable",
".",
"error",
"(",
"format",
"(",
"\"You must specify only one command (%s).%n\"",
",",
"showCommandAliases",
"(",
")",
")",
")",
";",
"printHelp",
"(",
"true",
")",
";",
"}",
"}",
"if",
"(",
"help",
"&&",
"command",
"==",
"null",
")",
"{",
"// `--help` is considered as the command if no other command is provided.",
"command",
"=",
"Command",
".",
"HELP",
";",
"commandStr",
"=",
"command",
".",
"getAlias",
"(",
")",
";",
"}",
"else",
"if",
"(",
"command",
"==",
"null",
")",
"{",
"// Print usage if no commands were specified",
"printUsage",
"(",
")",
";",
"reportable",
".",
"error",
"(",
"\"\\n\"",
")",
";",
"reportable",
".",
"error",
"(",
"\"No command option given. Please specify one of: \"",
"+",
"showCommandAliases",
"(",
")",
")",
";",
"end",
"(",
")",
";",
"}",
"}"
] |
Initializes the member variables command, commandStr, and help, according to the command
option specified by the user in the command line.
|
[
"Initializes",
"the",
"member",
"variables",
"command",
"commandStr",
"and",
"help",
"according",
"to",
"the",
"command",
"option",
"specified",
"by",
"the",
"user",
"in",
"the",
"command",
"line",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamManager.java#L397-L443
|
146,029
|
geomajas/geomajas-project-client-gwt2
|
plugin/editing/common/src/main/java/org/geomajas/plugin/editing/client/handler/GeometryIndexSnapToDeleteHandler.java
|
GeometryIndexSnapToDeleteHandler.checkHover
|
private void checkHover(HumanInputEvent<?> event) {
// Check: editing state, selection (there must be 1 index selected, but not this one):
if (service.getEditingState() == GeometryEditState.DRAGGING
&& !service.getIndexStateService().isSelected(index)
&& service.getIndexStateService().getSelection().size() == 1) {
GeometryIndex selected = service.getIndexStateService().getSelection().get(0);
// Check: is the selected index of the same type, and is it a neighbor?
if (service.getIndexService().getType(index) == service.getIndexService().getType(selected)) {
// see if there are enough vertices left to delete one:
int siblingCount = service.getIndexService().getSiblingCount(service.getGeometry(), index);
try {
String geometryType = service.getIndexService().getGeometryType(service.getGeometry(), index);
if (geometryType.equals(Geometry.LINE_STRING)) {
if (siblingCount < 3) {
return; // 2 vertices is the minimum for a LineString.
}
} else if (geometryType.equals(Geometry.LINEAR_RING)) {
if (siblingCount < 5) {
return; // 4 vertices is the minimum for a LinearRing.
}
} else {
throw new IllegalStateException("Illegal type of geometry found.");
}
} catch (GeometryIndexNotFoundException e) {
throw new IllegalStateException(e);
}
if (!allowMoreThanNeighbours &&
!(service.getIndexService().isAdjacent(service.getGeometry(), index, selected))) {
// only allow neighbours to remove point + hovering over a not-neighbour
return;
}
// Mark the selected GeometryIndex for deletion:
indexToDelete = selected;
if (!service.getIndexStateService().isMarkedForDeletion(index)) {
service.getIndexStateService().markForDeletionBegin(Collections.singletonList(index));
}
// Than snap the selected vertex/edge to this one:
// if this where omitted, the selected vertex would not overlay index position.
if (service.getIndexService().getType(index) == GeometryIndexType.TYPE_VERTEX) {
try {
Coordinate location = service.getIndexService().getVertex(service.getGeometry(), index);
service.move(Collections.singletonList(selected),
Collections.singletonList(Collections.singletonList(location)));
event.stopPropagation();
} catch (GeometryIndexNotFoundException e) {
logger.log(Level.WARNING, "Index not found", e);
} catch (GeometryOperationFailedException e) {
logger.log(Level.WARNING, "Operation failed", e);
}
}
}
}
}
|
java
|
private void checkHover(HumanInputEvent<?> event) {
// Check: editing state, selection (there must be 1 index selected, but not this one):
if (service.getEditingState() == GeometryEditState.DRAGGING
&& !service.getIndexStateService().isSelected(index)
&& service.getIndexStateService().getSelection().size() == 1) {
GeometryIndex selected = service.getIndexStateService().getSelection().get(0);
// Check: is the selected index of the same type, and is it a neighbor?
if (service.getIndexService().getType(index) == service.getIndexService().getType(selected)) {
// see if there are enough vertices left to delete one:
int siblingCount = service.getIndexService().getSiblingCount(service.getGeometry(), index);
try {
String geometryType = service.getIndexService().getGeometryType(service.getGeometry(), index);
if (geometryType.equals(Geometry.LINE_STRING)) {
if (siblingCount < 3) {
return; // 2 vertices is the minimum for a LineString.
}
} else if (geometryType.equals(Geometry.LINEAR_RING)) {
if (siblingCount < 5) {
return; // 4 vertices is the minimum for a LinearRing.
}
} else {
throw new IllegalStateException("Illegal type of geometry found.");
}
} catch (GeometryIndexNotFoundException e) {
throw new IllegalStateException(e);
}
if (!allowMoreThanNeighbours &&
!(service.getIndexService().isAdjacent(service.getGeometry(), index, selected))) {
// only allow neighbours to remove point + hovering over a not-neighbour
return;
}
// Mark the selected GeometryIndex for deletion:
indexToDelete = selected;
if (!service.getIndexStateService().isMarkedForDeletion(index)) {
service.getIndexStateService().markForDeletionBegin(Collections.singletonList(index));
}
// Than snap the selected vertex/edge to this one:
// if this where omitted, the selected vertex would not overlay index position.
if (service.getIndexService().getType(index) == GeometryIndexType.TYPE_VERTEX) {
try {
Coordinate location = service.getIndexService().getVertex(service.getGeometry(), index);
service.move(Collections.singletonList(selected),
Collections.singletonList(Collections.singletonList(location)));
event.stopPropagation();
} catch (GeometryIndexNotFoundException e) {
logger.log(Level.WARNING, "Index not found", e);
} catch (GeometryOperationFailedException e) {
logger.log(Level.WARNING, "Operation failed", e);
}
}
}
}
}
|
[
"private",
"void",
"checkHover",
"(",
"HumanInputEvent",
"<",
"?",
">",
"event",
")",
"{",
"// Check: editing state, selection (there must be 1 index selected, but not this one):",
"if",
"(",
"service",
".",
"getEditingState",
"(",
")",
"==",
"GeometryEditState",
".",
"DRAGGING",
"&&",
"!",
"service",
".",
"getIndexStateService",
"(",
")",
".",
"isSelected",
"(",
"index",
")",
"&&",
"service",
".",
"getIndexStateService",
"(",
")",
".",
"getSelection",
"(",
")",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"GeometryIndex",
"selected",
"=",
"service",
".",
"getIndexStateService",
"(",
")",
".",
"getSelection",
"(",
")",
".",
"get",
"(",
"0",
")",
";",
"// Check: is the selected index of the same type, and is it a neighbor?",
"if",
"(",
"service",
".",
"getIndexService",
"(",
")",
".",
"getType",
"(",
"index",
")",
"==",
"service",
".",
"getIndexService",
"(",
")",
".",
"getType",
"(",
"selected",
")",
")",
"{",
"// see if there are enough vertices left to delete one:",
"int",
"siblingCount",
"=",
"service",
".",
"getIndexService",
"(",
")",
".",
"getSiblingCount",
"(",
"service",
".",
"getGeometry",
"(",
")",
",",
"index",
")",
";",
"try",
"{",
"String",
"geometryType",
"=",
"service",
".",
"getIndexService",
"(",
")",
".",
"getGeometryType",
"(",
"service",
".",
"getGeometry",
"(",
")",
",",
"index",
")",
";",
"if",
"(",
"geometryType",
".",
"equals",
"(",
"Geometry",
".",
"LINE_STRING",
")",
")",
"{",
"if",
"(",
"siblingCount",
"<",
"3",
")",
"{",
"return",
";",
"// 2 vertices is the minimum for a LineString.",
"}",
"}",
"else",
"if",
"(",
"geometryType",
".",
"equals",
"(",
"Geometry",
".",
"LINEAR_RING",
")",
")",
"{",
"if",
"(",
"siblingCount",
"<",
"5",
")",
"{",
"return",
";",
"// 4 vertices is the minimum for a LinearRing.",
"}",
"}",
"else",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Illegal type of geometry found.\"",
")",
";",
"}",
"}",
"catch",
"(",
"GeometryIndexNotFoundException",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"e",
")",
";",
"}",
"if",
"(",
"!",
"allowMoreThanNeighbours",
"&&",
"!",
"(",
"service",
".",
"getIndexService",
"(",
")",
".",
"isAdjacent",
"(",
"service",
".",
"getGeometry",
"(",
")",
",",
"index",
",",
"selected",
")",
")",
")",
"{",
"// only allow neighbours to remove point + hovering over a not-neighbour",
"return",
";",
"}",
"// Mark the selected GeometryIndex for deletion:",
"indexToDelete",
"=",
"selected",
";",
"if",
"(",
"!",
"service",
".",
"getIndexStateService",
"(",
")",
".",
"isMarkedForDeletion",
"(",
"index",
")",
")",
"{",
"service",
".",
"getIndexStateService",
"(",
")",
".",
"markForDeletionBegin",
"(",
"Collections",
".",
"singletonList",
"(",
"index",
")",
")",
";",
"}",
"// Than snap the selected vertex/edge to this one:",
"// if this where omitted, the selected vertex would not overlay index position.",
"if",
"(",
"service",
".",
"getIndexService",
"(",
")",
".",
"getType",
"(",
"index",
")",
"==",
"GeometryIndexType",
".",
"TYPE_VERTEX",
")",
"{",
"try",
"{",
"Coordinate",
"location",
"=",
"service",
".",
"getIndexService",
"(",
")",
".",
"getVertex",
"(",
"service",
".",
"getGeometry",
"(",
")",
",",
"index",
")",
";",
"service",
".",
"move",
"(",
"Collections",
".",
"singletonList",
"(",
"selected",
")",
",",
"Collections",
".",
"singletonList",
"(",
"Collections",
".",
"singletonList",
"(",
"location",
")",
")",
")",
";",
"event",
".",
"stopPropagation",
"(",
")",
";",
"}",
"catch",
"(",
"GeometryIndexNotFoundException",
"e",
")",
"{",
"logger",
".",
"log",
"(",
"Level",
".",
"WARNING",
",",
"\"Index not found\"",
",",
"e",
")",
";",
"}",
"catch",
"(",
"GeometryOperationFailedException",
"e",
")",
"{",
"logger",
".",
"log",
"(",
"Level",
".",
"WARNING",
",",
"\"Operation failed\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"}",
"}"
] |
Supports only vertices for now.
|
[
"Supports",
"only",
"vertices",
"for",
"now",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/editing/common/src/main/java/org/geomajas/plugin/editing/client/handler/GeometryIndexSnapToDeleteHandler.java#L103-L160
|
146,030
|
astrapi69/jaulp-wicket
|
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/menu/suckerfish/MenuItem.java
|
MenuItem.setMenuItems
|
public MenuItem setMenuItems(final List<MenuItem> menuItems)
{
this.children.clear();
this.children.addAll(menuItems);
return this;
}
|
java
|
public MenuItem setMenuItems(final List<MenuItem> menuItems)
{
this.children.clear();
this.children.addAll(menuItems);
return this;
}
|
[
"public",
"MenuItem",
"setMenuItems",
"(",
"final",
"List",
"<",
"MenuItem",
">",
"menuItems",
")",
"{",
"this",
".",
"children",
".",
"clear",
"(",
")",
";",
"this",
".",
"children",
".",
"addAll",
"(",
"menuItems",
")",
";",
"return",
"this",
";",
"}"
] |
Add all menus at once.
@param menuItems
the new menu items
@return this {@link MenuItem}
|
[
"Add",
"all",
"menus",
"at",
"once",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/menu/suckerfish/MenuItem.java#L143-L148
|
146,031
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/tok/RuleBasedTokenizer.java
|
RuleBasedTokenizer.getTokens
|
private String[] getTokens(String line) {
// these are fine because they do not affect offsets
line = line.trim();
line = doubleSpaces.matcher(line).replaceAll(" ");
// remove non printable stuff
line = asciiHex.matcher(line).replaceAll(" ");
line = generalBlankPunctuation.matcher(line).replaceAll(" ");
// separate question and exclamation marks
line = qexc.matcher(line).replaceAll(" $1 ");
// separate dash if before or after space
line = spaceDashSpace.matcher(line).replaceAll(" $1 ");
// tokenize everything but these characters [^\p{Alnum}s.'`,-?!/]
line = specials.matcher(line).replaceAll(" $1 ");
// do not separate multidots
line = generateMultidots(line);
// separate "," except if within numbers (1,200)
line = noDigitComma.matcher(line).replaceAll("$1 $2");
line = commaNoDigit.matcher(line).replaceAll("$1 $2");
// separate pre and post digit
line = digitCommaNoDigit.matcher(line).replaceAll("$1 $2 $3");
line = noDigitCommaDigit.matcher(line).replaceAll("$1 $2 $3");
// contractions it's, l'agila, c'est, don't
line = treatContractions(line);
// exceptions for period tokenization
line = this.nonBreaker.TokenizerNonBreaker(line);
// restore multidots
line = restoreMultidots(line);
// urls
// TODO normalize URLs after tokenization for offsets
line = detokenizeURLs(line);
line = beginLink.matcher(line).replaceAll("$1://");
line = endLink.matcher(line).replaceAll("$1$2");
// these are fine because they do not affect offsets
line = line.trim();
line = doubleSpaces.matcher(line).replaceAll(" ");
line = detokenParagraphs.matcher(line).replaceAll("$1$2");
if (DEBUG) {
System.out.println("->Tokens:" + line);
}
final String[] tokens = line.split(" ");
return tokens;
}
|
java
|
private String[] getTokens(String line) {
// these are fine because they do not affect offsets
line = line.trim();
line = doubleSpaces.matcher(line).replaceAll(" ");
// remove non printable stuff
line = asciiHex.matcher(line).replaceAll(" ");
line = generalBlankPunctuation.matcher(line).replaceAll(" ");
// separate question and exclamation marks
line = qexc.matcher(line).replaceAll(" $1 ");
// separate dash if before or after space
line = spaceDashSpace.matcher(line).replaceAll(" $1 ");
// tokenize everything but these characters [^\p{Alnum}s.'`,-?!/]
line = specials.matcher(line).replaceAll(" $1 ");
// do not separate multidots
line = generateMultidots(line);
// separate "," except if within numbers (1,200)
line = noDigitComma.matcher(line).replaceAll("$1 $2");
line = commaNoDigit.matcher(line).replaceAll("$1 $2");
// separate pre and post digit
line = digitCommaNoDigit.matcher(line).replaceAll("$1 $2 $3");
line = noDigitCommaDigit.matcher(line).replaceAll("$1 $2 $3");
// contractions it's, l'agila, c'est, don't
line = treatContractions(line);
// exceptions for period tokenization
line = this.nonBreaker.TokenizerNonBreaker(line);
// restore multidots
line = restoreMultidots(line);
// urls
// TODO normalize URLs after tokenization for offsets
line = detokenizeURLs(line);
line = beginLink.matcher(line).replaceAll("$1://");
line = endLink.matcher(line).replaceAll("$1$2");
// these are fine because they do not affect offsets
line = line.trim();
line = doubleSpaces.matcher(line).replaceAll(" ");
line = detokenParagraphs.matcher(line).replaceAll("$1$2");
if (DEBUG) {
System.out.println("->Tokens:" + line);
}
final String[] tokens = line.split(" ");
return tokens;
}
|
[
"private",
"String",
"[",
"]",
"getTokens",
"(",
"String",
"line",
")",
"{",
"// these are fine because they do not affect offsets",
"line",
"=",
"line",
".",
"trim",
"(",
")",
";",
"line",
"=",
"doubleSpaces",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\" \"",
")",
";",
"// remove non printable stuff",
"line",
"=",
"asciiHex",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\" \"",
")",
";",
"line",
"=",
"generalBlankPunctuation",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\" \"",
")",
";",
"// separate question and exclamation marks",
"line",
"=",
"qexc",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\" $1 \"",
")",
";",
"// separate dash if before or after space",
"line",
"=",
"spaceDashSpace",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\" $1 \"",
")",
";",
"// tokenize everything but these characters [^\\p{Alnum}s.'`,-?!/]",
"line",
"=",
"specials",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\" $1 \"",
")",
";",
"// do not separate multidots",
"line",
"=",
"generateMultidots",
"(",
"line",
")",
";",
"// separate \",\" except if within numbers (1,200)",
"line",
"=",
"noDigitComma",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\"$1 $2\"",
")",
";",
"line",
"=",
"commaNoDigit",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\"$1 $2\"",
")",
";",
"// separate pre and post digit",
"line",
"=",
"digitCommaNoDigit",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\"$1 $2 $3\"",
")",
";",
"line",
"=",
"noDigitCommaDigit",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\"$1 $2 $3\"",
")",
";",
"// contractions it's, l'agila, c'est, don't",
"line",
"=",
"treatContractions",
"(",
"line",
")",
";",
"// exceptions for period tokenization",
"line",
"=",
"this",
".",
"nonBreaker",
".",
"TokenizerNonBreaker",
"(",
"line",
")",
";",
"// restore multidots",
"line",
"=",
"restoreMultidots",
"(",
"line",
")",
";",
"// urls",
"// TODO normalize URLs after tokenization for offsets",
"line",
"=",
"detokenizeURLs",
"(",
"line",
")",
";",
"line",
"=",
"beginLink",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\"$1://\"",
")",
";",
"line",
"=",
"endLink",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\"$1$2\"",
")",
";",
"// these are fine because they do not affect offsets",
"line",
"=",
"line",
".",
"trim",
"(",
")",
";",
"line",
"=",
"doubleSpaces",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\" \"",
")",
";",
"line",
"=",
"detokenParagraphs",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\"$1$2\"",
")",
";",
"if",
"(",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"->Tokens:\"",
"+",
"line",
")",
";",
"}",
"final",
"String",
"[",
"]",
"tokens",
"=",
"line",
".",
"split",
"(",
"\" \"",
")",
";",
"return",
"tokens",
";",
"}"
] |
Actual tokenization function.
@param line
the sentence to be tokenized
@return an array containing the tokens for the sentence
|
[
"Actual",
"tokenization",
"function",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/tok/RuleBasedTokenizer.java#L264-L313
|
146,032
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/tok/RuleBasedTokenizer.java
|
RuleBasedTokenizer.restoreMultidots
|
private String restoreMultidots(String line) {
while (line.contains("DOTDOTMULTI")) {
line = line.replaceAll("DOTDOTMULTI", "DOTMULTI.");
}
line = line.replaceAll("DOTMULTI", ".");
return line;
}
|
java
|
private String restoreMultidots(String line) {
while (line.contains("DOTDOTMULTI")) {
line = line.replaceAll("DOTDOTMULTI", "DOTMULTI.");
}
line = line.replaceAll("DOTMULTI", ".");
return line;
}
|
[
"private",
"String",
"restoreMultidots",
"(",
"String",
"line",
")",
"{",
"while",
"(",
"line",
".",
"contains",
"(",
"\"DOTDOTMULTI\"",
")",
")",
"{",
"line",
"=",
"line",
".",
"replaceAll",
"(",
"\"DOTDOTMULTI\"",
",",
"\"DOTMULTI.\"",
")",
";",
"}",
"line",
"=",
"line",
".",
"replaceAll",
"(",
"\"DOTMULTI\"",
",",
"\".\"",
")",
";",
"return",
"line",
";",
"}"
] |
Restores the normalized multidots to its original state and it tokenizes
them.
@param line
the line
@return the tokenized multidots
|
[
"Restores",
"the",
"normalized",
"multidots",
"to",
"its",
"original",
"state",
"and",
"it",
"tokenizes",
"them",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/tok/RuleBasedTokenizer.java#L344-L351
|
146,033
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/tok/RuleBasedTokenizer.java
|
RuleBasedTokenizer.detokenizeURLs
|
private String detokenizeURLs(String line) {
final Matcher linkMatcher = wrongLink.matcher(line);
final StringBuffer sb = new StringBuffer();
while (linkMatcher.find()) {
linkMatcher.appendReplacement(sb,
linkMatcher.group().replaceAll("\\s", ""));
}
linkMatcher.appendTail(sb);
line = sb.toString();
return line;
}
|
java
|
private String detokenizeURLs(String line) {
final Matcher linkMatcher = wrongLink.matcher(line);
final StringBuffer sb = new StringBuffer();
while (linkMatcher.find()) {
linkMatcher.appendReplacement(sb,
linkMatcher.group().replaceAll("\\s", ""));
}
linkMatcher.appendTail(sb);
line = sb.toString();
return line;
}
|
[
"private",
"String",
"detokenizeURLs",
"(",
"String",
"line",
")",
"{",
"final",
"Matcher",
"linkMatcher",
"=",
"wrongLink",
".",
"matcher",
"(",
"line",
")",
";",
"final",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"while",
"(",
"linkMatcher",
".",
"find",
"(",
")",
")",
"{",
"linkMatcher",
".",
"appendReplacement",
"(",
"sb",
",",
"linkMatcher",
".",
"group",
"(",
")",
".",
"replaceAll",
"(",
"\"\\\\s\"",
",",
"\"\"",
")",
")",
";",
"}",
"linkMatcher",
".",
"appendTail",
"(",
"sb",
")",
";",
"line",
"=",
"sb",
".",
"toString",
"(",
")",
";",
"return",
"line",
";",
"}"
] |
De-tokenize wrongly tokenized URLs.
@param line
the sentence
@return the sentence containing the correct URL
|
[
"De",
"-",
"tokenize",
"wrongly",
"tokenized",
"URLs",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/tok/RuleBasedTokenizer.java#L385-L395
|
146,034
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/tok/RuleBasedTokenizer.java
|
RuleBasedTokenizer.printUntokenizable
|
private void printUntokenizable(final Properties properties) {
final String untokenizable = properties.getProperty("untokenizable");
if (untokenizable.equalsIgnoreCase("yes")) {
this.unTokenizable = true;
} else {
this.unTokenizable = false;
}
}
|
java
|
private void printUntokenizable(final Properties properties) {
final String untokenizable = properties.getProperty("untokenizable");
if (untokenizable.equalsIgnoreCase("yes")) {
this.unTokenizable = true;
} else {
this.unTokenizable = false;
}
}
|
[
"private",
"void",
"printUntokenizable",
"(",
"final",
"Properties",
"properties",
")",
"{",
"final",
"String",
"untokenizable",
"=",
"properties",
".",
"getProperty",
"(",
"\"untokenizable\"",
")",
";",
"if",
"(",
"untokenizable",
".",
"equalsIgnoreCase",
"(",
"\"yes\"",
")",
")",
"{",
"this",
".",
"unTokenizable",
"=",
"true",
";",
"}",
"else",
"{",
"this",
".",
"unTokenizable",
"=",
"false",
";",
"}",
"}"
] |
Process the untokenizable CLI option.
@param properties
the configuration properties
|
[
"Process",
"the",
"untokenizable",
"CLI",
"option",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/tok/RuleBasedTokenizer.java#L403-L410
|
146,035
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/tok/RuleBasedTokenizer.java
|
RuleBasedTokenizer.addTokens
|
private void addTokens(final Token curToken, final List<Token> tokens) {
if (curToken.tokenLength() != 0) {
if (this.unTokenizable) {
tokens.add(curToken);
} else if (!this.unTokenizable) {
if (!replacement.matcher(curToken.getTokenValue()).matches()) {
tokens.add(curToken);
}
}
}
}
|
java
|
private void addTokens(final Token curToken, final List<Token> tokens) {
if (curToken.tokenLength() != 0) {
if (this.unTokenizable) {
tokens.add(curToken);
} else if (!this.unTokenizable) {
if (!replacement.matcher(curToken.getTokenValue()).matches()) {
tokens.add(curToken);
}
}
}
}
|
[
"private",
"void",
"addTokens",
"(",
"final",
"Token",
"curToken",
",",
"final",
"List",
"<",
"Token",
">",
"tokens",
")",
"{",
"if",
"(",
"curToken",
".",
"tokenLength",
"(",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"this",
".",
"unTokenizable",
")",
"{",
"tokens",
".",
"add",
"(",
"curToken",
")",
";",
"}",
"else",
"if",
"(",
"!",
"this",
".",
"unTokenizable",
")",
"{",
"if",
"(",
"!",
"replacement",
".",
"matcher",
"(",
"curToken",
".",
"getTokenValue",
"(",
")",
")",
".",
"matches",
"(",
")",
")",
"{",
"tokens",
".",
"add",
"(",
"curToken",
")",
";",
"}",
"}",
"}",
"}"
] |
Add tokens if certain conditions are met.
@param curToken
the token to be added
@param tokens
the list of tokens
|
[
"Add",
"tokens",
"if",
"certain",
"conditions",
"are",
"met",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/tok/RuleBasedTokenizer.java#L420-L430
|
146,036
|
geomajas/geomajas-project-client-gwt2
|
plugin/tilebasedlayer/impl/src/main/java/org/geomajas/gwt2/plugin/tilebasedlayer/client/layer/DefaultTileRenderer.java
|
DefaultTileRenderer.getUrl
|
@Override
public String getUrl(TileCode tileCode) {
int y = isYAxisInverted() ? invertedY(tileCode) : tileCode.getY();
return fillPlaceHolders(getNextUrl(), tileCode.getX(), y, tileCode.getTileLevel());
}
|
java
|
@Override
public String getUrl(TileCode tileCode) {
int y = isYAxisInverted() ? invertedY(tileCode) : tileCode.getY();
return fillPlaceHolders(getNextUrl(), tileCode.getX(), y, tileCode.getTileLevel());
}
|
[
"@",
"Override",
"public",
"String",
"getUrl",
"(",
"TileCode",
"tileCode",
")",
"{",
"int",
"y",
"=",
"isYAxisInverted",
"(",
")",
"?",
"invertedY",
"(",
"tileCode",
")",
":",
"tileCode",
".",
"getY",
"(",
")",
";",
"return",
"fillPlaceHolders",
"(",
"getNextUrl",
"(",
")",
",",
"tileCode",
".",
"getX",
"(",
")",
",",
"y",
",",
"tileCode",
".",
"getTileLevel",
"(",
")",
")",
";",
"}"
] |
Get the URL that points to the image representing the given tile code.
@param tileCode The tile code to fetch an image for.
@return The image URL.
|
[
"Get",
"the",
"URL",
"that",
"points",
"to",
"the",
"image",
"representing",
"the",
"given",
"tile",
"code",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/tilebasedlayer/impl/src/main/java/org/geomajas/gwt2/plugin/tilebasedlayer/client/layer/DefaultTileRenderer.java#L65-L69
|
146,037
|
geomajas/geomajas-project-client-gwt2
|
plugin/tilebasedlayer/impl/src/main/java/org/geomajas/gwt2/plugin/tilebasedlayer/client/layer/DefaultTileRenderer.java
|
DefaultTileRenderer.getNextUrl
|
protected String getNextUrl() {
String url = urls.get(currentIndex);
currentIndex = (currentIndex + 1) % urls.size();
return url;
}
|
java
|
protected String getNextUrl() {
String url = urls.get(currentIndex);
currentIndex = (currentIndex + 1) % urls.size();
return url;
}
|
[
"protected",
"String",
"getNextUrl",
"(",
")",
"{",
"String",
"url",
"=",
"urls",
".",
"get",
"(",
"currentIndex",
")",
";",
"currentIndex",
"=",
"(",
"currentIndex",
"+",
"1",
")",
"%",
"urls",
".",
"size",
"(",
")",
";",
"return",
"url",
";",
"}"
] |
We use Round-Robin to determine the next URL to fetch tiles from.
@return The URL to fetch tiles from.
|
[
"We",
"use",
"Round",
"-",
"Robin",
"to",
"determine",
"the",
"next",
"URL",
"to",
"fetch",
"tiles",
"from",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/tilebasedlayer/impl/src/main/java/org/geomajas/gwt2/plugin/tilebasedlayer/client/layer/DefaultTileRenderer.java#L128-L132
|
146,038
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/content/IntentUtils.java
|
IntentUtils.buildAction
|
public static String buildAction(Class<?> clazz, String action) {
return new StringBuilder().append(clazz.getCanonicalName()).append(".").append(action).toString();
}
|
java
|
public static String buildAction(Class<?> clazz, String action) {
return new StringBuilder().append(clazz.getCanonicalName()).append(".").append(action).toString();
}
|
[
"public",
"static",
"String",
"buildAction",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"action",
")",
"{",
"return",
"new",
"StringBuilder",
"(",
")",
".",
"append",
"(",
"clazz",
".",
"getCanonicalName",
"(",
")",
")",
".",
"append",
"(",
"\".\"",
")",
".",
"append",
"(",
"action",
")",
".",
"toString",
"(",
")",
";",
"}"
] |
Build a custom intent action name, like "jp.co.nohana.amalgam.Sample.ACTION_SAMPLE".
@param clazz the class name.
@param action the action name.
@return the custom action name.
|
[
"Build",
"a",
"custom",
"intent",
"action",
"name",
"like",
"jp",
".",
"co",
".",
"nohana",
".",
"amalgam",
".",
"Sample",
".",
"ACTION_SAMPLE",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/IntentUtils.java#L33-L35
|
146,039
|
geomajas/geomajas-project-client-gwt2
|
impl/src/main/java/org/geomajas/gwt2/client/service/JsonService.java
|
JsonService.getChild
|
public static JSONObject getChild(JSONObject jsonObject, String key) throws JSONException {
checkArguments(jsonObject, key);
JSONValue value = jsonObject.get(key);
if (value != null) {
if (value.isObject() != null) {
return value.isObject();
} else if (value.isNull() != null) {
return null;
}
throw new JSONException("Child is not a JSONObject, but a: " + value.getClass());
}
return null;
}
|
java
|
public static JSONObject getChild(JSONObject jsonObject, String key) throws JSONException {
checkArguments(jsonObject, key);
JSONValue value = jsonObject.get(key);
if (value != null) {
if (value.isObject() != null) {
return value.isObject();
} else if (value.isNull() != null) {
return null;
}
throw new JSONException("Child is not a JSONObject, but a: " + value.getClass());
}
return null;
}
|
[
"public",
"static",
"JSONObject",
"getChild",
"(",
"JSONObject",
"jsonObject",
",",
"String",
"key",
")",
"throws",
"JSONException",
"{",
"checkArguments",
"(",
"jsonObject",
",",
"key",
")",
";",
"JSONValue",
"value",
"=",
"jsonObject",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"if",
"(",
"value",
".",
"isObject",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"value",
".",
"isObject",
"(",
")",
";",
"}",
"else",
"if",
"(",
"value",
".",
"isNull",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"null",
";",
"}",
"throw",
"new",
"JSONException",
"(",
"\"Child is not a JSONObject, but a: \"",
"+",
"value",
".",
"getClass",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Get a child JSON object from a parent JSON object.
@param jsonObject The parent JSON object.
@param key The name of the child object.
@return Returns the child JSON object if it could be found, or null if the value was null.
@throws JSONException In case something went wrong while searching for the child.
|
[
"Get",
"a",
"child",
"JSON",
"object",
"from",
"a",
"parent",
"JSON",
"object",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/impl/src/main/java/org/geomajas/gwt2/client/service/JsonService.java#L94-L106
|
146,040
|
geomajas/geomajas-project-client-gwt2
|
impl/src/main/java/org/geomajas/gwt2/client/service/JsonService.java
|
JsonService.getChildArray
|
public static JSONArray getChildArray(JSONObject jsonObject, String key) throws JSONException {
checkArguments(jsonObject, key);
JSONValue value = jsonObject.get(key);
if (value != null) {
if (value.isArray() != null) {
return value.isArray();
} else if (value.isNull() != null) {
return null;
}
throw new JSONException("Child is not a JSONArray, but a: " + value.getClass());
}
return null;
}
|
java
|
public static JSONArray getChildArray(JSONObject jsonObject, String key) throws JSONException {
checkArguments(jsonObject, key);
JSONValue value = jsonObject.get(key);
if (value != null) {
if (value.isArray() != null) {
return value.isArray();
} else if (value.isNull() != null) {
return null;
}
throw new JSONException("Child is not a JSONArray, but a: " + value.getClass());
}
return null;
}
|
[
"public",
"static",
"JSONArray",
"getChildArray",
"(",
"JSONObject",
"jsonObject",
",",
"String",
"key",
")",
"throws",
"JSONException",
"{",
"checkArguments",
"(",
"jsonObject",
",",
"key",
")",
";",
"JSONValue",
"value",
"=",
"jsonObject",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"if",
"(",
"value",
".",
"isArray",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"value",
".",
"isArray",
"(",
")",
";",
"}",
"else",
"if",
"(",
"value",
".",
"isNull",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"null",
";",
"}",
"throw",
"new",
"JSONException",
"(",
"\"Child is not a JSONArray, but a: \"",
"+",
"value",
".",
"getClass",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Get a child JSON array from a parent JSON object.
@param jsonObject The parent JSON object.
@param key The name of the child object.
@return Returns the child JSON array if it could be found, or null if the value was null.
@throws JSONException In case something went wrong while searching for the child.
|
[
"Get",
"a",
"child",
"JSON",
"array",
"from",
"a",
"parent",
"JSON",
"object",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/impl/src/main/java/org/geomajas/gwt2/client/service/JsonService.java#L116-L128
|
146,041
|
geomajas/geomajas-project-client-gwt2
|
impl/src/main/java/org/geomajas/gwt2/client/service/JsonService.java
|
JsonService.addToJson
|
public static void addToJson(JSONObject jsonObject, String key, Object value) throws JSONException {
if (jsonObject == null) {
throw new JSONException("Can't add key '" + key + "' to a null object.");
}
if (key == null) {
throw new JSONException("Can't add null key.");
}
JSONValue jsonValue = null;
if (value != null) {
if (value instanceof Date) {
jsonValue = new JSONString(JsonService.format((Date) value));
} else if (value instanceof JSONValue) {
jsonValue = (JSONValue) value;
} else {
jsonValue = new JSONString(value.toString());
}
}
jsonObject.put(key, jsonValue);
}
|
java
|
public static void addToJson(JSONObject jsonObject, String key, Object value) throws JSONException {
if (jsonObject == null) {
throw new JSONException("Can't add key '" + key + "' to a null object.");
}
if (key == null) {
throw new JSONException("Can't add null key.");
}
JSONValue jsonValue = null;
if (value != null) {
if (value instanceof Date) {
jsonValue = new JSONString(JsonService.format((Date) value));
} else if (value instanceof JSONValue) {
jsonValue = (JSONValue) value;
} else {
jsonValue = new JSONString(value.toString());
}
}
jsonObject.put(key, jsonValue);
}
|
[
"public",
"static",
"void",
"addToJson",
"(",
"JSONObject",
"jsonObject",
",",
"String",
"key",
",",
"Object",
"value",
")",
"throws",
"JSONException",
"{",
"if",
"(",
"jsonObject",
"==",
"null",
")",
"{",
"throw",
"new",
"JSONException",
"(",
"\"Can't add key '\"",
"+",
"key",
"+",
"\"' to a null object.\"",
")",
";",
"}",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"throw",
"new",
"JSONException",
"(",
"\"Can't add null key.\"",
")",
";",
"}",
"JSONValue",
"jsonValue",
"=",
"null",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"if",
"(",
"value",
"instanceof",
"Date",
")",
"{",
"jsonValue",
"=",
"new",
"JSONString",
"(",
"JsonService",
".",
"format",
"(",
"(",
"Date",
")",
"value",
")",
")",
";",
"}",
"else",
"if",
"(",
"value",
"instanceof",
"JSONValue",
")",
"{",
"jsonValue",
"=",
"(",
"JSONValue",
")",
"value",
";",
"}",
"else",
"{",
"jsonValue",
"=",
"new",
"JSONString",
"(",
"value",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"jsonObject",
".",
"put",
"(",
"key",
",",
"jsonValue",
")",
";",
"}"
] |
Add a certain object value to the given JSON object.
@param jsonObject The JSON object to add the value to.
@param key The key to be used when adding the value.
@param value The value to attach to the key in the JSON object.
@throws JSONException In case something went wrong while adding.
|
[
"Add",
"a",
"certain",
"object",
"value",
"to",
"the",
"given",
"JSON",
"object",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/impl/src/main/java/org/geomajas/gwt2/client/service/JsonService.java#L331-L349
|
146,042
|
geomajas/geomajas-project-client-gwt2
|
impl/src/main/java/org/geomajas/gwt2/client/service/JsonService.java
|
JsonService.isNullObject
|
public static boolean isNullObject(JSONObject jsonObject, String key) throws JSONException {
checkArguments(jsonObject, key);
JSONValue value = jsonObject.get(key);
boolean isNull = false;
if (value == null || value.isNull() != null) {
isNull = true;
}
return isNull;
}
|
java
|
public static boolean isNullObject(JSONObject jsonObject, String key) throws JSONException {
checkArguments(jsonObject, key);
JSONValue value = jsonObject.get(key);
boolean isNull = false;
if (value == null || value.isNull() != null) {
isNull = true;
}
return isNull;
}
|
[
"public",
"static",
"boolean",
"isNullObject",
"(",
"JSONObject",
"jsonObject",
",",
"String",
"key",
")",
"throws",
"JSONException",
"{",
"checkArguments",
"(",
"jsonObject",
",",
"key",
")",
";",
"JSONValue",
"value",
"=",
"jsonObject",
".",
"get",
"(",
"key",
")",
";",
"boolean",
"isNull",
"=",
"false",
";",
"if",
"(",
"value",
"==",
"null",
"||",
"value",
".",
"isNull",
"(",
")",
"!=",
"null",
")",
"{",
"isNull",
"=",
"true",
";",
"}",
"return",
"isNull",
";",
"}"
] |
checks if a certain object value is null.
@param jsonObject The object to get the key value from.
@param key The name of the key to search the value for.
@throws JSONException In case something went wrong while parsing.
|
[
"checks",
"if",
"a",
"certain",
"object",
"value",
"is",
"null",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/impl/src/main/java/org/geomajas/gwt2/client/service/JsonService.java#L358-L367
|
146,043
|
optimaize/command4j
|
src/main/java/com/optimaize/command4j/commands/Commands.java
|
Commands.and
|
public static <A, B> BaseListCommand<A, B> and(Iterable<? extends Command<A, B>> commands) {
return new AndCommand<>(commands);
}
|
java
|
public static <A, B> BaseListCommand<A, B> and(Iterable<? extends Command<A, B>> commands) {
return new AndCommand<>(commands);
}
|
[
"public",
"static",
"<",
"A",
",",
"B",
">",
"BaseListCommand",
"<",
"A",
",",
"B",
">",
"and",
"(",
"Iterable",
"<",
"?",
"extends",
"Command",
"<",
"A",
",",
"B",
">",
">",
"commands",
")",
"{",
"return",
"new",
"AndCommand",
"<>",
"(",
"commands",
")",
";",
"}"
] |
Returns a task that executes all tasks sequentially applying the same argument
to each. The result of the execution is an ArrayList containing one element per command
in the order the commands were specified here.
|
[
"Returns",
"a",
"task",
"that",
"executes",
"all",
"tasks",
"sequentially",
"applying",
"the",
"same",
"argument",
"to",
"each",
".",
"The",
"result",
"of",
"the",
"execution",
"is",
"an",
"ArrayList",
"containing",
"one",
"element",
"per",
"command",
"in",
"the",
"order",
"the",
"commands",
"were",
"specified",
"here",
"."
] |
6d550759a4593c7941a1e0d760b407fa88833d71
|
https://github.com/optimaize/command4j/blob/6d550759a4593c7941a1e0d760b407fa88833d71/src/main/java/com/optimaize/command4j/commands/Commands.java#L49-L51
|
146,044
|
astrapi69/jaulp-wicket
|
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/actions/AbstractActionPanel.java
|
AbstractActionPanel.newActionLinkLabel
|
protected Label newActionLinkLabel(final String id, final IModel<String> model)
{
final Label label = ComponentFactory.newLabel(id, model);
return label;
}
|
java
|
protected Label newActionLinkLabel(final String id, final IModel<String> model)
{
final Label label = ComponentFactory.newLabel(id, model);
return label;
}
|
[
"protected",
"Label",
"newActionLinkLabel",
"(",
"final",
"String",
"id",
",",
"final",
"IModel",
"<",
"String",
">",
"model",
")",
"{",
"final",
"Label",
"label",
"=",
"ComponentFactory",
".",
"newLabel",
"(",
"id",
",",
"model",
")",
";",
"return",
"label",
";",
"}"
] |
Factory method for creating the new Label. This method is invoked in the constructor from the
derived classes and can be overridden so users can provide their own version of a new Label.
@param id
the id
@param model
the model
@return the label
|
[
"Factory",
"method",
"for",
"creating",
"the",
"new",
"Label",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"derived",
"classes",
"and",
"can",
"be",
"overridden",
"so",
"users",
"can",
"provide",
"their",
"own",
"version",
"of",
"a",
"new",
"Label",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/actions/AbstractActionPanel.java#L83-L87
|
146,045
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/content/pm/PackageManagerUtils.java
|
PackageManagerUtils.getVersionCode
|
public static int getVersionCode(Context context, int fallback) {
try {
PackageManager manager = context.getPackageManager();
PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0);
return info.versionCode;
} catch (NameNotFoundException e) {
Log.e(TAG, "no such package installed on the device: ", e);
}
return fallback;
}
|
java
|
public static int getVersionCode(Context context, int fallback) {
try {
PackageManager manager = context.getPackageManager();
PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0);
return info.versionCode;
} catch (NameNotFoundException e) {
Log.e(TAG, "no such package installed on the device: ", e);
}
return fallback;
}
|
[
"public",
"static",
"int",
"getVersionCode",
"(",
"Context",
"context",
",",
"int",
"fallback",
")",
"{",
"try",
"{",
"PackageManager",
"manager",
"=",
"context",
".",
"getPackageManager",
"(",
")",
";",
"PackageInfo",
"info",
"=",
"manager",
".",
"getPackageInfo",
"(",
"context",
".",
"getPackageName",
"(",
")",
",",
"0",
")",
";",
"return",
"info",
".",
"versionCode",
";",
"}",
"catch",
"(",
"NameNotFoundException",
"e",
")",
"{",
"Log",
".",
"e",
"(",
"TAG",
",",
"\"no such package installed on the device: \"",
",",
"e",
")",
";",
"}",
"return",
"fallback",
";",
"}"
] |
Read version code from the manifest of the context.
@param context the context.
@param fallback fallback value of the version code.
@return the version code, or fallback value if not found.
|
[
"Read",
"version",
"code",
"from",
"the",
"manifest",
"of",
"the",
"context",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/pm/PackageManagerUtils.java#L54-L63
|
146,046
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/content/pm/PackageManagerUtils.java
|
PackageManagerUtils.getVersionName
|
public static String getVersionName(Context context) {
try {
PackageManager manager = context.getPackageManager();
PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0);
return info.versionName;
} catch (NameNotFoundException e) {
throw new IllegalStateException("no such package installed on the device: ", e);
}
}
|
java
|
public static String getVersionName(Context context) {
try {
PackageManager manager = context.getPackageManager();
PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0);
return info.versionName;
} catch (NameNotFoundException e) {
throw new IllegalStateException("no such package installed on the device: ", e);
}
}
|
[
"public",
"static",
"String",
"getVersionName",
"(",
"Context",
"context",
")",
"{",
"try",
"{",
"PackageManager",
"manager",
"=",
"context",
".",
"getPackageManager",
"(",
")",
";",
"PackageInfo",
"info",
"=",
"manager",
".",
"getPackageInfo",
"(",
"context",
".",
"getPackageName",
"(",
")",
",",
"0",
")",
";",
"return",
"info",
".",
"versionName",
";",
"}",
"catch",
"(",
"NameNotFoundException",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"no such package installed on the device: \"",
",",
"e",
")",
";",
"}",
"}"
] |
Read version name from the manifest of the context.
@param context the context.
@return the version name.
@throws java.lang.IllegalStateException if the target package is not installed.
|
[
"Read",
"version",
"name",
"from",
"the",
"manifest",
"of",
"the",
"context",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/pm/PackageManagerUtils.java#L71-L79
|
146,047
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/content/pm/PackageManagerUtils.java
|
PackageManagerUtils.isPackageInstalled
|
public static boolean isPackageInstalled(Context context, String targetPackage) {
PackageManager manager = context.getPackageManager();
Intent intent = new Intent();
intent.setPackage(targetPackage);
return manager.resolveActivity(intent, 0) != null;
}
|
java
|
public static boolean isPackageInstalled(Context context, String targetPackage) {
PackageManager manager = context.getPackageManager();
Intent intent = new Intent();
intent.setPackage(targetPackage);
return manager.resolveActivity(intent, 0) != null;
}
|
[
"public",
"static",
"boolean",
"isPackageInstalled",
"(",
"Context",
"context",
",",
"String",
"targetPackage",
")",
"{",
"PackageManager",
"manager",
"=",
"context",
".",
"getPackageManager",
"(",
")",
";",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
")",
";",
"intent",
".",
"setPackage",
"(",
"targetPackage",
")",
";",
"return",
"manager",
".",
"resolveActivity",
"(",
"intent",
",",
"0",
")",
"!=",
"null",
";",
"}"
] |
Checks if the target package is installed on this device.
@param context the context.
@param targetPackage the target package name.
@return {@code true} if installed, false otherwise.
|
[
"Checks",
"if",
"the",
"target",
"package",
"is",
"installed",
"on",
"this",
"device",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/pm/PackageManagerUtils.java#L87-L92
|
146,048
|
geomajas/geomajas-project-client-gwt2
|
impl/src/main/java/org/geomajas/gwt2/client/map/render/dom/container/HtmlImageImpl.java
|
HtmlImageImpl.onLoadingDone
|
public void onLoadingDone(Callback<String, String> onLoadingDone, int nrRetries) {
ImageReloader reloader = new ImageReloader(getSrc(), onLoadingDone, nrRetries);
asImage().addLoadHandler(reloader);
asImage().addErrorHandler(reloader);
}
|
java
|
public void onLoadingDone(Callback<String, String> onLoadingDone, int nrRetries) {
ImageReloader reloader = new ImageReloader(getSrc(), onLoadingDone, nrRetries);
asImage().addLoadHandler(reloader);
asImage().addErrorHandler(reloader);
}
|
[
"public",
"void",
"onLoadingDone",
"(",
"Callback",
"<",
"String",
",",
"String",
">",
"onLoadingDone",
",",
"int",
"nrRetries",
")",
"{",
"ImageReloader",
"reloader",
"=",
"new",
"ImageReloader",
"(",
"getSrc",
"(",
")",
",",
"onLoadingDone",
",",
"nrRetries",
")",
";",
"asImage",
"(",
")",
".",
"addLoadHandler",
"(",
"reloader",
")",
";",
"asImage",
"(",
")",
".",
"addErrorHandler",
"(",
"reloader",
")",
";",
"}"
] |
Apply a call-back that is executed when the image is done loading. This image is done loading when it has either
loaded successfully or when 5 attempts have failed. In any case, the callback's execute method will be invoked,
thereby indicating success or failure.
@param onLoadingDone
The call-back to be executed when loading has finished. The boolean value indicates whether or not it
was successful while loading. Both the success and failure type expect a String. This is used to pass
along the image URL.
@param nrRetries
Total number of retries should loading fail. Default is 0.
|
[
"Apply",
"a",
"call",
"-",
"back",
"that",
"is",
"executed",
"when",
"the",
"image",
"is",
"done",
"loading",
".",
"This",
"image",
"is",
"done",
"loading",
"when",
"it",
"has",
"either",
"loaded",
"successfully",
"or",
"when",
"5",
"attempts",
"have",
"failed",
".",
"In",
"any",
"case",
"the",
"callback",
"s",
"execute",
"method",
"will",
"be",
"invoked",
"thereby",
"indicating",
"success",
"or",
"failure",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/impl/src/main/java/org/geomajas/gwt2/client/map/render/dom/container/HtmlImageImpl.java#L177-L181
|
146,049
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/eval/DetailedEvaluationListener.java
|
DetailedEvaluationListener.printLine
|
private void printLine(int size) {
for (int i = 0; i < size; i++) {
printStream.append("-");
}
printStream.append("\n");
}
|
java
|
private void printLine(int size) {
for (int i = 0; i < size; i++) {
printStream.append("-");
}
printStream.append("\n");
}
|
[
"private",
"void",
"printLine",
"(",
"int",
"size",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"printStream",
".",
"append",
"(",
"\"-\"",
")",
";",
"}",
"printStream",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"}"
] |
Auxiliary method that prints a horizontal line of a given size
|
[
"Auxiliary",
"method",
"that",
"prints",
"a",
"horizontal",
"line",
"of",
"a",
"given",
"size"
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/eval/DetailedEvaluationListener.java#L448-L453
|
146,050
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/utils/XmlUtils.java
|
XmlUtils.getDomFromString
|
public static Document getDomFromString( String str )
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware( true );
try {
DocumentBuilder builder = factory.newDocumentBuilder();
return builder.parse( new InputSource( new StringReader( str ) ) );
} catch ( Exception e ) {
throw new CStorageException( "Error parsing the Xml response: " + str, e );
}
}
|
java
|
public static Document getDomFromString( String str )
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware( true );
try {
DocumentBuilder builder = factory.newDocumentBuilder();
return builder.parse( new InputSource( new StringReader( str ) ) );
} catch ( Exception e ) {
throw new CStorageException( "Error parsing the Xml response: " + str, e );
}
}
|
[
"public",
"static",
"Document",
"getDomFromString",
"(",
"String",
"str",
")",
"{",
"DocumentBuilderFactory",
"factory",
"=",
"DocumentBuilderFactory",
".",
"newInstance",
"(",
")",
";",
"factory",
".",
"setNamespaceAware",
"(",
"true",
")",
";",
"try",
"{",
"DocumentBuilder",
"builder",
"=",
"factory",
".",
"newDocumentBuilder",
"(",
")",
";",
"return",
"builder",
".",
"parse",
"(",
"new",
"InputSource",
"(",
"new",
"StringReader",
"(",
"str",
")",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"CStorageException",
"(",
"\"Error parsing the Xml response: \"",
"+",
"str",
",",
"e",
")",
";",
"}",
"}"
] |
Parses a string and build a DOM
@return DOM
|
[
"Parses",
"a",
"string",
"and",
"build",
"a",
"DOM"
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/utils/XmlUtils.java#L159-L170
|
146,051
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/content/res/AssetFileDescriptorUtils.java
|
AssetFileDescriptorUtils.close
|
public static void close(AssetFileDescriptor descriptor) {
if (descriptor == null) {
return;
}
try {
descriptor.close();
} catch (IOException e) {
Log.e(TAG, "something went wrong on close descriptor: ", e);
}
}
|
java
|
public static void close(AssetFileDescriptor descriptor) {
if (descriptor == null) {
return;
}
try {
descriptor.close();
} catch (IOException e) {
Log.e(TAG, "something went wrong on close descriptor: ", e);
}
}
|
[
"public",
"static",
"void",
"close",
"(",
"AssetFileDescriptor",
"descriptor",
")",
"{",
"if",
"(",
"descriptor",
"==",
"null",
")",
"{",
"return",
";",
"}",
"try",
"{",
"descriptor",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"Log",
".",
"e",
"(",
"TAG",
",",
"\"something went wrong on close descriptor: \"",
",",
"e",
")",
";",
"}",
"}"
] |
Close the descriptor, and if the exception during close will be logged.
@param descriptor to close.
|
[
"Close",
"the",
"descriptor",
"and",
"if",
"the",
"exception",
"during",
"close",
"will",
"be",
"logged",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/res/AssetFileDescriptorUtils.java#L23-L32
|
146,052
|
astrapi69/jaulp-wicket
|
jaulp-wicket-behaviors/src/main/java/de/alpharogroup/wicket/behaviors/datetime/CurrentDatetimeBehavior.java
|
CurrentDatetimeBehavior.generateJS
|
protected String generateJS(final TextTemplate textTemplate)
{
final Map<String, Object> variables = new HashMap<>();
variables.put("componentId", this.component.getMarkupId());
textTemplate.interpolate(variables);
return textTemplate.asString();
}
|
java
|
protected String generateJS(final TextTemplate textTemplate)
{
final Map<String, Object> variables = new HashMap<>();
variables.put("componentId", this.component.getMarkupId());
textTemplate.interpolate(variables);
return textTemplate.asString();
}
|
[
"protected",
"String",
"generateJS",
"(",
"final",
"TextTemplate",
"textTemplate",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"variables",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"variables",
".",
"put",
"(",
"\"componentId\"",
",",
"this",
".",
"component",
".",
"getMarkupId",
"(",
")",
")",
";",
"textTemplate",
".",
"interpolate",
"(",
"variables",
")",
";",
"return",
"textTemplate",
".",
"asString",
"(",
")",
";",
"}"
] |
Generate js.
@param textTemplate
the text template
@return the string
|
[
"Generate",
"js",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-behaviors/src/main/java/de/alpharogroup/wicket/behaviors/datetime/CurrentDatetimeBehavior.java#L78-L84
|
146,053
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/sequence/EvaluationErrorPrinter.java
|
EvaluationErrorPrinter.printError
|
protected void printError(final Span references[], final Span predictions[],
final T referenceSample, final T predictedSample, final String sentence) {
final List<Span> falseNegatives = new ArrayList<Span>();
final List<Span> falsePositives = new ArrayList<Span>();
findErrors(references, predictions, falseNegatives, falsePositives);
if (falsePositives.size() + falseNegatives.size() > 0) {
printSamples(referenceSample, predictedSample);
printErrors(falsePositives, falseNegatives, sentence);
}
}
|
java
|
protected void printError(final Span references[], final Span predictions[],
final T referenceSample, final T predictedSample, final String sentence) {
final List<Span> falseNegatives = new ArrayList<Span>();
final List<Span> falsePositives = new ArrayList<Span>();
findErrors(references, predictions, falseNegatives, falsePositives);
if (falsePositives.size() + falseNegatives.size() > 0) {
printSamples(referenceSample, predictedSample);
printErrors(falsePositives, falseNegatives, sentence);
}
}
|
[
"protected",
"void",
"printError",
"(",
"final",
"Span",
"references",
"[",
"]",
",",
"final",
"Span",
"predictions",
"[",
"]",
",",
"final",
"T",
"referenceSample",
",",
"final",
"T",
"predictedSample",
",",
"final",
"String",
"sentence",
")",
"{",
"final",
"List",
"<",
"Span",
">",
"falseNegatives",
"=",
"new",
"ArrayList",
"<",
"Span",
">",
"(",
")",
";",
"final",
"List",
"<",
"Span",
">",
"falsePositives",
"=",
"new",
"ArrayList",
"<",
"Span",
">",
"(",
")",
";",
"findErrors",
"(",
"references",
",",
"predictions",
",",
"falseNegatives",
",",
"falsePositives",
")",
";",
"if",
"(",
"falsePositives",
".",
"size",
"(",
")",
"+",
"falseNegatives",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"printSamples",
"(",
"referenceSample",
",",
"predictedSample",
")",
";",
"printErrors",
"(",
"falsePositives",
",",
"falseNegatives",
",",
"sentence",
")",
";",
"}",
"}"
] |
for the sentence detector
|
[
"for",
"the",
"sentence",
"detector"
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/sequence/EvaluationErrorPrinter.java#L42-L56
|
146,054
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/sequence/EvaluationErrorPrinter.java
|
EvaluationErrorPrinter.printError
|
protected void printError(final String id, final Span references[],
final Span predictions[], final T referenceSample,
final T predictedSample, final String[] sentenceTokens) {
final List<Span> falseNegatives = new ArrayList<Span>();
final List<Span> falsePositives = new ArrayList<Span>();
findErrors(references, predictions, falseNegatives, falsePositives);
if (falsePositives.size() + falseNegatives.size() > 0) {
if (id != null) {
this.printStream.println("Id: {" + id + "}");
}
printSamples(referenceSample, predictedSample);
printErrors(falsePositives, falseNegatives, sentenceTokens);
}
}
|
java
|
protected void printError(final String id, final Span references[],
final Span predictions[], final T referenceSample,
final T predictedSample, final String[] sentenceTokens) {
final List<Span> falseNegatives = new ArrayList<Span>();
final List<Span> falsePositives = new ArrayList<Span>();
findErrors(references, predictions, falseNegatives, falsePositives);
if (falsePositives.size() + falseNegatives.size() > 0) {
if (id != null) {
this.printStream.println("Id: {" + id + "}");
}
printSamples(referenceSample, predictedSample);
printErrors(falsePositives, falseNegatives, sentenceTokens);
}
}
|
[
"protected",
"void",
"printError",
"(",
"final",
"String",
"id",
",",
"final",
"Span",
"references",
"[",
"]",
",",
"final",
"Span",
"predictions",
"[",
"]",
",",
"final",
"T",
"referenceSample",
",",
"final",
"T",
"predictedSample",
",",
"final",
"String",
"[",
"]",
"sentenceTokens",
")",
"{",
"final",
"List",
"<",
"Span",
">",
"falseNegatives",
"=",
"new",
"ArrayList",
"<",
"Span",
">",
"(",
")",
";",
"final",
"List",
"<",
"Span",
">",
"falsePositives",
"=",
"new",
"ArrayList",
"<",
"Span",
">",
"(",
")",
";",
"findErrors",
"(",
"references",
",",
"predictions",
",",
"falseNegatives",
",",
"falsePositives",
")",
";",
"if",
"(",
"falsePositives",
".",
"size",
"(",
")",
"+",
"falseNegatives",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"if",
"(",
"id",
"!=",
"null",
")",
"{",
"this",
".",
"printStream",
".",
"println",
"(",
"\"Id: {\"",
"+",
"id",
"+",
"\"}\"",
")",
";",
"}",
"printSamples",
"(",
"referenceSample",
",",
"predictedSample",
")",
";",
"printErrors",
"(",
"falsePositives",
",",
"falseNegatives",
",",
"sentenceTokens",
")",
";",
"}",
"}"
] |
for namefinder, chunker...
|
[
"for",
"namefinder",
"chunker",
"..."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/sequence/EvaluationErrorPrinter.java#L59-L78
|
146,055
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/sequence/EvaluationErrorPrinter.java
|
EvaluationErrorPrinter.printError
|
protected void printError(final String references[],
final String predictions[], final T referenceSample,
final T predictedSample, final String[] sentenceTokens) {
final List<String> filteredDoc = new ArrayList<String>();
final List<String> filteredRefs = new ArrayList<String>();
final List<String> filteredPreds = new ArrayList<String>();
for (int i = 0; i < references.length; i++) {
if (!references[i].equals(predictions[i])) {
filteredDoc.add(sentenceTokens[i]);
filteredRefs.add(references[i]);
filteredPreds.add(predictions[i]);
}
}
if (filteredDoc.size() > 0) {
printSamples(referenceSample, predictedSample);
printErrors(filteredDoc, filteredRefs, filteredPreds);
}
}
|
java
|
protected void printError(final String references[],
final String predictions[], final T referenceSample,
final T predictedSample, final String[] sentenceTokens) {
final List<String> filteredDoc = new ArrayList<String>();
final List<String> filteredRefs = new ArrayList<String>();
final List<String> filteredPreds = new ArrayList<String>();
for (int i = 0; i < references.length; i++) {
if (!references[i].equals(predictions[i])) {
filteredDoc.add(sentenceTokens[i]);
filteredRefs.add(references[i]);
filteredPreds.add(predictions[i]);
}
}
if (filteredDoc.size() > 0) {
printSamples(referenceSample, predictedSample);
printErrors(filteredDoc, filteredRefs, filteredPreds);
}
}
|
[
"protected",
"void",
"printError",
"(",
"final",
"String",
"references",
"[",
"]",
",",
"final",
"String",
"predictions",
"[",
"]",
",",
"final",
"T",
"referenceSample",
",",
"final",
"T",
"predictedSample",
",",
"final",
"String",
"[",
"]",
"sentenceTokens",
")",
"{",
"final",
"List",
"<",
"String",
">",
"filteredDoc",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"final",
"List",
"<",
"String",
">",
"filteredRefs",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"final",
"List",
"<",
"String",
">",
"filteredPreds",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"references",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"references",
"[",
"i",
"]",
".",
"equals",
"(",
"predictions",
"[",
"i",
"]",
")",
")",
"{",
"filteredDoc",
".",
"add",
"(",
"sentenceTokens",
"[",
"i",
"]",
")",
";",
"filteredRefs",
".",
"add",
"(",
"references",
"[",
"i",
"]",
")",
";",
"filteredPreds",
".",
"add",
"(",
"predictions",
"[",
"i",
"]",
")",
";",
"}",
"}",
"if",
"(",
"filteredDoc",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"printSamples",
"(",
"referenceSample",
",",
"predictedSample",
")",
";",
"printErrors",
"(",
"filteredDoc",
",",
"filteredRefs",
",",
"filteredPreds",
")",
";",
"}",
"}"
] |
for pos tagger
|
[
"for",
"pos",
"tagger"
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/sequence/EvaluationErrorPrinter.java#L88-L110
|
146,056
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/sequence/EvaluationErrorPrinter.java
|
EvaluationErrorPrinter.printErrors
|
private void printErrors(final List<String> filteredDoc,
final List<String> filteredRefs, final List<String> filteredPreds) {
this.printStream.println("Errors: {");
this.printStream.println("Tok: Ref | Pred");
this.printStream.println("---------------");
for (int i = 0; i < filteredDoc.size(); i++) {
this.printStream.println(filteredDoc.get(i) + ": " + filteredRefs.get(i)
+ " | " + filteredPreds.get(i));
}
this.printStream.println("}\n");
}
|
java
|
private void printErrors(final List<String> filteredDoc,
final List<String> filteredRefs, final List<String> filteredPreds) {
this.printStream.println("Errors: {");
this.printStream.println("Tok: Ref | Pred");
this.printStream.println("---------------");
for (int i = 0; i < filteredDoc.size(); i++) {
this.printStream.println(filteredDoc.get(i) + ": " + filteredRefs.get(i)
+ " | " + filteredPreds.get(i));
}
this.printStream.println("}\n");
}
|
[
"private",
"void",
"printErrors",
"(",
"final",
"List",
"<",
"String",
">",
"filteredDoc",
",",
"final",
"List",
"<",
"String",
">",
"filteredRefs",
",",
"final",
"List",
"<",
"String",
">",
"filteredPreds",
")",
"{",
"this",
".",
"printStream",
".",
"println",
"(",
"\"Errors: {\"",
")",
";",
"this",
".",
"printStream",
".",
"println",
"(",
"\"Tok: Ref | Pred\"",
")",
";",
"this",
".",
"printStream",
".",
"println",
"(",
"\"---------------\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"filteredDoc",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"this",
".",
"printStream",
".",
"println",
"(",
"filteredDoc",
".",
"get",
"(",
"i",
")",
"+",
"\": \"",
"+",
"filteredRefs",
".",
"get",
"(",
"i",
")",
"+",
"\" | \"",
"+",
"filteredPreds",
".",
"get",
"(",
"i",
")",
")",
";",
"}",
"this",
".",
"printStream",
".",
"println",
"(",
"\"}\\n\"",
")",
";",
"}"
] |
Auxiliary method to print tag errors
@param filteredDoc
the document tokens which were tagged wrong
@param filteredRefs
the reference tags
@param filteredPreds
the predicted tags
|
[
"Auxiliary",
"method",
"to",
"print",
"tag",
"errors"
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/sequence/EvaluationErrorPrinter.java#L128-L138
|
146,057
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/sequence/EvaluationErrorPrinter.java
|
EvaluationErrorPrinter.print
|
private String print(final List<Span> spans, final String[] toks) {
return Arrays.toString(
Span.spansToStrings(spans.toArray(new Span[spans.size()]), toks));
}
|
java
|
private String print(final List<Span> spans, final String[] toks) {
return Arrays.toString(
Span.spansToStrings(spans.toArray(new Span[spans.size()]), toks));
}
|
[
"private",
"String",
"print",
"(",
"final",
"List",
"<",
"Span",
">",
"spans",
",",
"final",
"String",
"[",
"]",
"toks",
")",
"{",
"return",
"Arrays",
".",
"toString",
"(",
"Span",
".",
"spansToStrings",
"(",
"spans",
".",
"toArray",
"(",
"new",
"Span",
"[",
"spans",
".",
"size",
"(",
")",
"]",
")",
",",
"toks",
")",
")",
";",
"}"
] |
Auxiliary method to print spans
@param spans
the span list
@param toks
the tokens array
@return the spans as string
|
[
"Auxiliary",
"method",
"to",
"print",
"spans"
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/sequence/EvaluationErrorPrinter.java#L191-L194
|
146,058
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/sequence/EvaluationErrorPrinter.java
|
EvaluationErrorPrinter.printSamples
|
private <S> void printSamples(final S referenceSample,
final S predictedSample) {
final String details = "Expected: {\n" + referenceSample
+ "}\nPredicted: {\n" + predictedSample + "}";
this.printStream.println(details);
}
|
java
|
private <S> void printSamples(final S referenceSample,
final S predictedSample) {
final String details = "Expected: {\n" + referenceSample
+ "}\nPredicted: {\n" + predictedSample + "}";
this.printStream.println(details);
}
|
[
"private",
"<",
"S",
">",
"void",
"printSamples",
"(",
"final",
"S",
"referenceSample",
",",
"final",
"S",
"predictedSample",
")",
"{",
"final",
"String",
"details",
"=",
"\"Expected: {\\n\"",
"+",
"referenceSample",
"+",
"\"}\\nPredicted: {\\n\"",
"+",
"predictedSample",
"+",
"\"}\"",
";",
"this",
".",
"printStream",
".",
"println",
"(",
"details",
")",
";",
"}"
] |
Auxiliary method to print expected and predicted samples.
@param referenceSample
the reference sample
@param predictedSample
the predicted sample
|
[
"Auxiliary",
"method",
"to",
"print",
"expected",
"and",
"predicted",
"samples",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/sequence/EvaluationErrorPrinter.java#L204-L209
|
146,059
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/sequence/EvaluationErrorPrinter.java
|
EvaluationErrorPrinter.findErrors
|
private void findErrors(final Span references[], final Span predictions[],
final List<Span> falseNegatives, final List<Span> falsePositives) {
falseNegatives.addAll(Arrays.asList(references));
falsePositives.addAll(Arrays.asList(predictions));
for (final Span referenceName : references) {
for (final Span prediction : predictions) {
if (referenceName.equals(prediction)) {
// got it, remove from fn and fp
falseNegatives.remove(referenceName);
falsePositives.remove(prediction);
}
}
}
}
|
java
|
private void findErrors(final Span references[], final Span predictions[],
final List<Span> falseNegatives, final List<Span> falsePositives) {
falseNegatives.addAll(Arrays.asList(references));
falsePositives.addAll(Arrays.asList(predictions));
for (final Span referenceName : references) {
for (final Span prediction : predictions) {
if (referenceName.equals(prediction)) {
// got it, remove from fn and fp
falseNegatives.remove(referenceName);
falsePositives.remove(prediction);
}
}
}
}
|
[
"private",
"void",
"findErrors",
"(",
"final",
"Span",
"references",
"[",
"]",
",",
"final",
"Span",
"predictions",
"[",
"]",
",",
"final",
"List",
"<",
"Span",
">",
"falseNegatives",
",",
"final",
"List",
"<",
"Span",
">",
"falsePositives",
")",
"{",
"falseNegatives",
".",
"addAll",
"(",
"Arrays",
".",
"asList",
"(",
"references",
")",
")",
";",
"falsePositives",
".",
"addAll",
"(",
"Arrays",
".",
"asList",
"(",
"predictions",
")",
")",
";",
"for",
"(",
"final",
"Span",
"referenceName",
":",
"references",
")",
"{",
"for",
"(",
"final",
"Span",
"prediction",
":",
"predictions",
")",
"{",
"if",
"(",
"referenceName",
".",
"equals",
"(",
"prediction",
")",
")",
"{",
"// got it, remove from fn and fp",
"falseNegatives",
".",
"remove",
"(",
"referenceName",
")",
";",
"falsePositives",
".",
"remove",
"(",
"prediction",
")",
";",
"}",
"}",
"}",
"}"
] |
Outputs falseNegatives and falsePositives spans from the references and
predictions list.
@param references
@param predictions
@param falseNegatives
[out] the false negatives list
@param falsePositives
[out] the false positives list
|
[
"Outputs",
"falseNegatives",
"and",
"falsePositives",
"spans",
"from",
"the",
"references",
"and",
"predictions",
"list",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/sequence/EvaluationErrorPrinter.java#L222-L238
|
146,060
|
geomajas/geomajas-project-client-gwt2
|
impl/src/main/java/org/geomajas/gwt2/client/service/TileService.java
|
TileService.getWorldBoundsForTile
|
public static Bbox getWorldBoundsForTile(TileConfiguration tileConfiguration, TileCode tileCode) {
double resolution = tileConfiguration.getResolution(tileCode.getTileLevel());
double worldTileWidth = tileConfiguration.getTileWidth() * resolution;
double worldTileHeight = tileConfiguration.getTileHeight() * resolution;
double x = tileConfiguration.getTileOrigin().getX() + tileCode.getX() * worldTileWidth;
double y = tileConfiguration.getTileOrigin().getY() + tileCode.getY() * worldTileHeight;
return new Bbox(x, y, worldTileWidth, worldTileHeight);
}
|
java
|
public static Bbox getWorldBoundsForTile(TileConfiguration tileConfiguration, TileCode tileCode) {
double resolution = tileConfiguration.getResolution(tileCode.getTileLevel());
double worldTileWidth = tileConfiguration.getTileWidth() * resolution;
double worldTileHeight = tileConfiguration.getTileHeight() * resolution;
double x = tileConfiguration.getTileOrigin().getX() + tileCode.getX() * worldTileWidth;
double y = tileConfiguration.getTileOrigin().getY() + tileCode.getY() * worldTileHeight;
return new Bbox(x, y, worldTileWidth, worldTileHeight);
}
|
[
"public",
"static",
"Bbox",
"getWorldBoundsForTile",
"(",
"TileConfiguration",
"tileConfiguration",
",",
"TileCode",
"tileCode",
")",
"{",
"double",
"resolution",
"=",
"tileConfiguration",
".",
"getResolution",
"(",
"tileCode",
".",
"getTileLevel",
"(",
")",
")",
";",
"double",
"worldTileWidth",
"=",
"tileConfiguration",
".",
"getTileWidth",
"(",
")",
"*",
"resolution",
";",
"double",
"worldTileHeight",
"=",
"tileConfiguration",
".",
"getTileHeight",
"(",
")",
"*",
"resolution",
";",
"double",
"x",
"=",
"tileConfiguration",
".",
"getTileOrigin",
"(",
")",
".",
"getX",
"(",
")",
"+",
"tileCode",
".",
"getX",
"(",
")",
"*",
"worldTileWidth",
";",
"double",
"y",
"=",
"tileConfiguration",
".",
"getTileOrigin",
"(",
")",
".",
"getY",
"(",
")",
"+",
"tileCode",
".",
"getY",
"(",
")",
"*",
"worldTileHeight",
";",
"return",
"new",
"Bbox",
"(",
"x",
",",
"y",
",",
"worldTileWidth",
",",
"worldTileHeight",
")",
";",
"}"
] |
Given a tile for a layer, what are the tiles bounds in world space.
@param tileConfiguration The basic tile configuration.
@param tileCode The tile code.
@return The tile bounds in map CRS.
|
[
"Given",
"a",
"tile",
"for",
"a",
"layer",
"what",
"are",
"the",
"tiles",
"bounds",
"in",
"world",
"space",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/impl/src/main/java/org/geomajas/gwt2/client/service/TileService.java#L83-L91
|
146,061
|
geomajas/geomajas-project-client-gwt2
|
impl/src/main/java/org/geomajas/gwt2/client/service/TileService.java
|
TileService.getTileCodeForLocation
|
public static TileCode getTileCodeForLocation(TileConfiguration tileConfiguration, Coordinate location,
double resolution) {
int tileLevel = tileConfiguration.getResolutionIndex(resolution);
double actualResolution = tileConfiguration.getResolution(tileLevel);
double worldTileWidth = tileConfiguration.getTileWidth() * actualResolution;
double worldTileHeight = tileConfiguration.getTileHeight() * actualResolution;
Coordinate tileOrigin = tileConfiguration.getTileOrigin();
int x = (int) Math.floor((location.getX() - tileOrigin.getX()) / worldTileWidth);
int y = (int) Math.floor((location.getY() - tileOrigin.getY()) / worldTileHeight);
return new TileCode(tileLevel, x, y);
}
|
java
|
public static TileCode getTileCodeForLocation(TileConfiguration tileConfiguration, Coordinate location,
double resolution) {
int tileLevel = tileConfiguration.getResolutionIndex(resolution);
double actualResolution = tileConfiguration.getResolution(tileLevel);
double worldTileWidth = tileConfiguration.getTileWidth() * actualResolution;
double worldTileHeight = tileConfiguration.getTileHeight() * actualResolution;
Coordinate tileOrigin = tileConfiguration.getTileOrigin();
int x = (int) Math.floor((location.getX() - tileOrigin.getX()) / worldTileWidth);
int y = (int) Math.floor((location.getY() - tileOrigin.getY()) / worldTileHeight);
return new TileCode(tileLevel, x, y);
}
|
[
"public",
"static",
"TileCode",
"getTileCodeForLocation",
"(",
"TileConfiguration",
"tileConfiguration",
",",
"Coordinate",
"location",
",",
"double",
"resolution",
")",
"{",
"int",
"tileLevel",
"=",
"tileConfiguration",
".",
"getResolutionIndex",
"(",
"resolution",
")",
";",
"double",
"actualResolution",
"=",
"tileConfiguration",
".",
"getResolution",
"(",
"tileLevel",
")",
";",
"double",
"worldTileWidth",
"=",
"tileConfiguration",
".",
"getTileWidth",
"(",
")",
"*",
"actualResolution",
";",
"double",
"worldTileHeight",
"=",
"tileConfiguration",
".",
"getTileHeight",
"(",
")",
"*",
"actualResolution",
";",
"Coordinate",
"tileOrigin",
"=",
"tileConfiguration",
".",
"getTileOrigin",
"(",
")",
";",
"int",
"x",
"=",
"(",
"int",
")",
"Math",
".",
"floor",
"(",
"(",
"location",
".",
"getX",
"(",
")",
"-",
"tileOrigin",
".",
"getX",
"(",
")",
")",
"/",
"worldTileWidth",
")",
";",
"int",
"y",
"=",
"(",
"int",
")",
"Math",
".",
"floor",
"(",
"(",
"location",
".",
"getY",
"(",
")",
"-",
"tileOrigin",
".",
"getY",
"(",
")",
")",
"/",
"worldTileHeight",
")",
";",
"return",
"new",
"TileCode",
"(",
"tileLevel",
",",
"x",
",",
"y",
")",
";",
"}"
] |
Given a certain location at a certain scale, what tile lies there?
@param tileConfiguration The basic tile configuration.
@param location The location to retrieve a tile for.
@param resolution The resolution at which to retrieve a tile.
@return Returns the tile code for the requested location.
|
[
"Given",
"a",
"certain",
"location",
"at",
"a",
"certain",
"scale",
"what",
"tile",
"lies",
"there?"
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/impl/src/main/java/org/geomajas/gwt2/client/service/TileService.java#L101-L113
|
146,062
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/request/Headers.java
|
Headers.addHeader
|
public void addHeader( String name, String value )
{
headers.add( new BasicHeader( name, value ) );
}
|
java
|
public void addHeader( String name, String value )
{
headers.add( new BasicHeader( name, value ) );
}
|
[
"public",
"void",
"addHeader",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"headers",
".",
"add",
"(",
"new",
"BasicHeader",
"(",
"name",
",",
"value",
")",
")",
";",
"}"
] |
Add a new header to the list
@param name The header name
@param value The header value
|
[
"Add",
"a",
"new",
"header",
"to",
"the",
"list"
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/request/Headers.java#L52-L55
|
146,063
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/request/Headers.java
|
Headers.removeHeader
|
public void removeHeader( String name )
{
ListIterator<Header> it = headers.listIterator();
while ( it.hasNext() ) {
if ( it.next().getName().equals( name ) ) {
it.remove();
}
}
}
|
java
|
public void removeHeader( String name )
{
ListIterator<Header> it = headers.listIterator();
while ( it.hasNext() ) {
if ( it.next().getName().equals( name ) ) {
it.remove();
}
}
}
|
[
"public",
"void",
"removeHeader",
"(",
"String",
"name",
")",
"{",
"ListIterator",
"<",
"Header",
">",
"it",
"=",
"headers",
".",
"listIterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"if",
"(",
"it",
".",
"next",
"(",
")",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"name",
")",
")",
"{",
"it",
".",
"remove",
"(",
")",
";",
"}",
"}",
"}"
] |
Remove a header from the list
@param name The header name
|
[
"Remove",
"a",
"header",
"from",
"the",
"list"
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/request/Headers.java#L72-L80
|
146,064
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/request/Headers.java
|
Headers.contains
|
public boolean contains( String name )
{
for ( Header header : headers ) {
if ( header.getName().equals( name ) ) {
return true;
}
}
return false;
}
|
java
|
public boolean contains( String name )
{
for ( Header header : headers ) {
if ( header.getName().equals( name ) ) {
return true;
}
}
return false;
}
|
[
"public",
"boolean",
"contains",
"(",
"String",
"name",
")",
"{",
"for",
"(",
"Header",
"header",
":",
"headers",
")",
"{",
"if",
"(",
"header",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"name",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Indicates if a header exists with the given name
@param name The header name
@return true if a header exists with the given name, false otherwise
|
[
"Indicates",
"if",
"a",
"header",
"exists",
"with",
"the",
"given",
"name"
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/request/Headers.java#L88-L96
|
146,065
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/request/Headers.java
|
Headers.getHeaderValue
|
public String getHeaderValue( String name )
{
for ( Header header : headers ) {
if ( header.getName().equals( name ) ) {
return header.getValue();
}
}
return null;
}
|
java
|
public String getHeaderValue( String name )
{
for ( Header header : headers ) {
if ( header.getName().equals( name ) ) {
return header.getValue();
}
}
return null;
}
|
[
"public",
"String",
"getHeaderValue",
"(",
"String",
"name",
")",
"{",
"for",
"(",
"Header",
"header",
":",
"headers",
")",
"{",
"if",
"(",
"header",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"name",
")",
")",
"{",
"return",
"header",
".",
"getValue",
"(",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Get a header value
@param name The header name
@return The header value
|
[
"Get",
"a",
"header",
"value"
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/request/Headers.java#L114-L122
|
146,066
|
OpenBEL/openbel-framework
|
org.openbel.framework.common/src/main/java/org/openbel/framework/common/util/ValidationUtilities.java
|
ValidationUtilities.validateEnumeration
|
private static boolean validateEnumeration(
Collection<String> allowedValues, String value) {
return (allowedValues != null && allowedValues.contains(value));
}
|
java
|
private static boolean validateEnumeration(
Collection<String> allowedValues, String value) {
return (allowedValues != null && allowedValues.contains(value));
}
|
[
"private",
"static",
"boolean",
"validateEnumeration",
"(",
"Collection",
"<",
"String",
">",
"allowedValues",
",",
"String",
"value",
")",
"{",
"return",
"(",
"allowedValues",
"!=",
"null",
"&&",
"allowedValues",
".",
"contains",
"(",
"value",
")",
")",
";",
"}"
] |
Validate the given value against a collection of allowed values.
@param allowedValues
@param value Value to test
@return boolean {@code true} if {@code value} in {@code allowedValues}
|
[
"Validate",
"the",
"given",
"value",
"against",
"a",
"collection",
"of",
"allowed",
"values",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/util/ValidationUtilities.java#L130-L133
|
146,067
|
OpenBEL/openbel-framework
|
org.openbel.framework.common/src/main/java/org/openbel/framework/common/util/ValidationUtilities.java
|
ValidationUtilities.validateRegExp
|
protected static boolean validateRegExp(String pattern, String value)
throws PatternSyntaxException {
Pattern re = patternCache.get(pattern);
if (re == null) {
re = compile(pattern, MULTILINE | DOTALL);
patternCache.put(pattern, re);
}
return (re.matcher(value).matches());
}
|
java
|
protected static boolean validateRegExp(String pattern, String value)
throws PatternSyntaxException {
Pattern re = patternCache.get(pattern);
if (re == null) {
re = compile(pattern, MULTILINE | DOTALL);
patternCache.put(pattern, re);
}
return (re.matcher(value).matches());
}
|
[
"protected",
"static",
"boolean",
"validateRegExp",
"(",
"String",
"pattern",
",",
"String",
"value",
")",
"throws",
"PatternSyntaxException",
"{",
"Pattern",
"re",
"=",
"patternCache",
".",
"get",
"(",
"pattern",
")",
";",
"if",
"(",
"re",
"==",
"null",
")",
"{",
"re",
"=",
"compile",
"(",
"pattern",
",",
"MULTILINE",
"|",
"DOTALL",
")",
";",
"patternCache",
".",
"put",
"(",
"pattern",
",",
"re",
")",
";",
"}",
"return",
"(",
"re",
".",
"matcher",
"(",
"value",
")",
".",
"matches",
"(",
")",
")",
";",
"}"
] |
Validate the given value against a regular expression pattern
@param pattern Regular expression pattern
@param value Value to test
@return boolean {@code true} if {@code value} matches {@code pattern}
@throws PatternSyntaxException
if the given pattern is invalid
|
[
"Validate",
"the",
"given",
"value",
"against",
"a",
"regular",
"expression",
"pattern"
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/util/ValidationUtilities.java#L144-L153
|
146,068
|
geomajas/geomajas-project-client-gwt2
|
impl/src/main/java/org/geomajas/gwt2/client/gfx/VectorTileObject.java
|
VectorTileObject.setInnerSvg
|
public static void setInnerSvg(Element element, String svg) {
if (Dom.isFireFox()) {
setFireFoxInnerHTML(element,
"<g xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">" + svg
+ "</g>");
} else if (Dom.isWebkit()) {
setWebkitInnerHTML(element,
"<g xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">" + svg
+ "</g>");
}
}
|
java
|
public static void setInnerSvg(Element element, String svg) {
if (Dom.isFireFox()) {
setFireFoxInnerHTML(element,
"<g xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">" + svg
+ "</g>");
} else if (Dom.isWebkit()) {
setWebkitInnerHTML(element,
"<g xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">" + svg
+ "</g>");
}
}
|
[
"public",
"static",
"void",
"setInnerSvg",
"(",
"Element",
"element",
",",
"String",
"svg",
")",
"{",
"if",
"(",
"Dom",
".",
"isFireFox",
"(",
")",
")",
"{",
"setFireFoxInnerHTML",
"(",
"element",
",",
"\"<g xmlns=\\\"http://www.w3.org/2000/svg\\\" xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\">\"",
"+",
"svg",
"+",
"\"</g>\"",
")",
";",
"}",
"else",
"if",
"(",
"Dom",
".",
"isWebkit",
"(",
")",
")",
"{",
"setWebkitInnerHTML",
"(",
"element",
",",
"\"<g xmlns=\\\"http://www.w3.org/2000/svg\\\" xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\">\"",
"+",
"svg",
"+",
"\"</g>\"",
")",
";",
"}",
"}"
] |
Similar method to the "setInnerHTML", but specified for setting SVG. Using the regular setInnerHTML, it is not
possible to set a string of SVG on an object. This method can do that. On the other hand, this method is better
not used for setting normal HTML as an element's innerHTML.
@param element
The element onto which to set the SVG string.
@param svg
The string of SVG to set on the element.
|
[
"Similar",
"method",
"to",
"the",
"setInnerHTML",
"but",
"specified",
"for",
"setting",
"SVG",
".",
"Using",
"the",
"regular",
"setInnerHTML",
"it",
"is",
"not",
"possible",
"to",
"set",
"a",
"string",
"of",
"SVG",
"on",
"an",
"object",
".",
"This",
"method",
"can",
"do",
"that",
".",
"On",
"the",
"other",
"hand",
"this",
"method",
"is",
"better",
"not",
"used",
"for",
"setting",
"normal",
"HTML",
"as",
"an",
"element",
"s",
"innerHTML",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/impl/src/main/java/org/geomajas/gwt2/client/gfx/VectorTileObject.java#L59-L69
|
146,069
|
maxschuster/Vaadin-SignatureField
|
vaadin-signaturefield/src/main/java/eu/maxschuster/vaadin/signaturefield/SignatureFieldExtension.java
|
SignatureFieldExtension.setSignature
|
public void setSignature(String signature, boolean repaintIsNotNeeded) {
String oldSignature = this.signature;
if (!SharedUtil.equals(oldSignature, signature)) {
this.signature = signature;
if (!repaintIsNotNeeded) {
updateSignature();
}
}
}
|
java
|
public void setSignature(String signature, boolean repaintIsNotNeeded) {
String oldSignature = this.signature;
if (!SharedUtil.equals(oldSignature, signature)) {
this.signature = signature;
if (!repaintIsNotNeeded) {
updateSignature();
}
}
}
|
[
"public",
"void",
"setSignature",
"(",
"String",
"signature",
",",
"boolean",
"repaintIsNotNeeded",
")",
"{",
"String",
"oldSignature",
"=",
"this",
".",
"signature",
";",
"if",
"(",
"!",
"SharedUtil",
".",
"equals",
"(",
"oldSignature",
",",
"signature",
")",
")",
"{",
"this",
".",
"signature",
"=",
"signature",
";",
"if",
"(",
"!",
"repaintIsNotNeeded",
")",
"{",
"updateSignature",
"(",
")",
";",
"}",
"}",
"}"
] |
Set signature current signature value.
@param signature Signature
@param repaintIsNotNeeded Repaint is not needed
|
[
"Set",
"signature",
"current",
"signature",
"value",
"."
] |
b6f6b7042ea9c46060af54bd92d21770abfcccee
|
https://github.com/maxschuster/Vaadin-SignatureField/blob/b6f6b7042ea9c46060af54bd92d21770abfcccee/vaadin-signaturefield/src/main/java/eu/maxschuster/vaadin/signaturefield/SignatureFieldExtension.java#L170-L178
|
146,070
|
astrapi69/jaulp-wicket
|
jaulp-wicket-behaviors/src/main/java/de/alpharogroup/wicket/behaviors/AjaxDownloadBehavior.java
|
AjaxDownloadBehavior.initiate
|
public void initiate(final AjaxRequestTarget target)
{
String url = getCallbackUrl().toString();
if (antiCache)
{
url = url + (url.contains("?") ? "&" : "?");
url = url + "antiCache=" + System.currentTimeMillis();
}
// the timeout is needed to let Wicket release the channel
target.appendJavaScript("setTimeout(\"window.location.href='" + url + "'\", 100);");
}
|
java
|
public void initiate(final AjaxRequestTarget target)
{
String url = getCallbackUrl().toString();
if (antiCache)
{
url = url + (url.contains("?") ? "&" : "?");
url = url + "antiCache=" + System.currentTimeMillis();
}
// the timeout is needed to let Wicket release the channel
target.appendJavaScript("setTimeout(\"window.location.href='" + url + "'\", 100);");
}
|
[
"public",
"void",
"initiate",
"(",
"final",
"AjaxRequestTarget",
"target",
")",
"{",
"String",
"url",
"=",
"getCallbackUrl",
"(",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"antiCache",
")",
"{",
"url",
"=",
"url",
"+",
"(",
"url",
".",
"contains",
"(",
"\"?\"",
")",
"?",
"\"&\"",
":",
"\"?\"",
")",
";",
"url",
"=",
"url",
"+",
"\"antiCache=\"",
"+",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"}",
"// the timeout is needed to let Wicket release the channel",
"target",
".",
"appendJavaScript",
"(",
"\"setTimeout(\\\"window.location.href='\"",
"+",
"url",
"+",
"\"'\\\", 100);\"",
")",
";",
"}"
] |
Call this method to initiate the download.
@param target
the {@link AjaxRequestTarget}
|
[
"Call",
"this",
"method",
"to",
"initiate",
"the",
"download",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-behaviors/src/main/java/de/alpharogroup/wicket/behaviors/AjaxDownloadBehavior.java#L80-L91
|
146,071
|
ops4j/org.ops4j.pax.exam1
|
pax-exam-junit/src/main/java/org/ops4j/pax/exam/junit/options/JMockBundlesOption.java
|
JMockBundlesOption.version
|
public JMockBundlesOption version( final String version )
{
( (MavenArtifactUrlReference) ( (WrappedUrlProvisionOption) getDelegate() ).getUrlReference() ).version(
version
);
return itself();
}
|
java
|
public JMockBundlesOption version( final String version )
{
( (MavenArtifactUrlReference) ( (WrappedUrlProvisionOption) getDelegate() ).getUrlReference() ).version(
version
);
return itself();
}
|
[
"public",
"JMockBundlesOption",
"version",
"(",
"final",
"String",
"version",
")",
"{",
"(",
"(",
"MavenArtifactUrlReference",
")",
"(",
"(",
"WrappedUrlProvisionOption",
")",
"getDelegate",
"(",
")",
")",
".",
"getUrlReference",
"(",
")",
")",
".",
"version",
"(",
"version",
")",
";",
"return",
"itself",
"(",
")",
";",
"}"
] |
Sets the JMock version.
@param version JMock version.
@return itself, for fluent api usage
|
[
"Sets",
"the",
"JMock",
"version",
"."
] |
7c8742208117ff91bd24bcd3a185d2d019f7000f
|
https://github.com/ops4j/org.ops4j.pax.exam1/blob/7c8742208117ff91bd24bcd3a185d2d019f7000f/pax-exam-junit/src/main/java/org/ops4j/pax/exam/junit/options/JMockBundlesOption.java#L63-L69
|
146,072
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/features/PreviousMapFeatureGenerator.java
|
PreviousMapFeatureGenerator.updateAdaptiveData
|
@Override
public void updateAdaptiveData(final String[] tokens,
final String[] outcomes) {
for (int i = 0; i < tokens.length; i++) {
this.previousMap.put(tokens[i], outcomes[i]);
}
}
|
java
|
@Override
public void updateAdaptiveData(final String[] tokens,
final String[] outcomes) {
for (int i = 0; i < tokens.length; i++) {
this.previousMap.put(tokens[i], outcomes[i]);
}
}
|
[
"@",
"Override",
"public",
"void",
"updateAdaptiveData",
"(",
"final",
"String",
"[",
"]",
"tokens",
",",
"final",
"String",
"[",
"]",
"outcomes",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"tokens",
".",
"length",
";",
"i",
"++",
")",
"{",
"this",
".",
"previousMap",
".",
"put",
"(",
"tokens",
"[",
"i",
"]",
",",
"outcomes",
"[",
"i",
"]",
")",
";",
"}",
"}"
] |
Generates previous decision features for the token based on contents of the
previous map.
|
[
"Generates",
"previous",
"decision",
"features",
"for",
"the",
"token",
"based",
"on",
"contents",
"of",
"the",
"previous",
"map",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/features/PreviousMapFeatureGenerator.java#L45-L52
|
146,073
|
geomajas/geomajas-project-client-gwt2
|
plugin/corewidget/example-jar/src/main/java/org/geomajas/gwt2/plugin/corewidget/example/client/sample/message/MessageBox.java
|
MessageBox.showMessageBox
|
public static MessageBox showMessageBox(String title, String message) {
return showMessageBox(title, SafeHtmlUtils.fromString(message), MessageStyleType.INFO);
}
|
java
|
public static MessageBox showMessageBox(String title, String message) {
return showMessageBox(title, SafeHtmlUtils.fromString(message), MessageStyleType.INFO);
}
|
[
"public",
"static",
"MessageBox",
"showMessageBox",
"(",
"String",
"title",
",",
"String",
"message",
")",
"{",
"return",
"showMessageBox",
"(",
"title",
",",
"SafeHtmlUtils",
".",
"fromString",
"(",
"message",
")",
",",
"MessageStyleType",
".",
"INFO",
")",
";",
"}"
] |
This will show a MessageBox type Info.
|
[
"This",
"will",
"show",
"a",
"MessageBox",
"type",
"Info",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/corewidget/example-jar/src/main/java/org/geomajas/gwt2/plugin/corewidget/example/client/sample/message/MessageBox.java#L276-L278
|
146,074
|
geomajas/geomajas-project-client-gwt2
|
plugin/corewidget/example-jar/src/main/java/org/geomajas/gwt2/plugin/corewidget/example/client/sample/message/MessageBox.java
|
MessageBox.showMessageBox
|
public static MessageBox showMessageBox(String title, SafeHtml message, MessageStyleType styleType) {
MessageBox box = new MessageBox(title, message);
box.setMessageStyleType(styleType);
box.setMessageBoxType(MessageBoxType.MESSAGE);
box.center();
return box;
}
|
java
|
public static MessageBox showMessageBox(String title, SafeHtml message, MessageStyleType styleType) {
MessageBox box = new MessageBox(title, message);
box.setMessageStyleType(styleType);
box.setMessageBoxType(MessageBoxType.MESSAGE);
box.center();
return box;
}
|
[
"public",
"static",
"MessageBox",
"showMessageBox",
"(",
"String",
"title",
",",
"SafeHtml",
"message",
",",
"MessageStyleType",
"styleType",
")",
"{",
"MessageBox",
"box",
"=",
"new",
"MessageBox",
"(",
"title",
",",
"message",
")",
";",
"box",
".",
"setMessageStyleType",
"(",
"styleType",
")",
";",
"box",
".",
"setMessageBoxType",
"(",
"MessageBoxType",
".",
"MESSAGE",
")",
";",
"box",
".",
"center",
"(",
")",
";",
"return",
"box",
";",
"}"
] |
This will show a MessageBox.
|
[
"This",
"will",
"show",
"a",
"MessageBox",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/corewidget/example-jar/src/main/java/org/geomajas/gwt2/plugin/corewidget/example/client/sample/message/MessageBox.java#L290-L296
|
146,075
|
astrapi69/jaulp-wicket
|
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/up/SignupFormPanel.java
|
SignupFormPanel.initComponent
|
protected void initComponent()
{
addOrReplace(form = newForm("form", getModel()));
form.addOrReplace(signupPanel = newSignupPanel("signupPanel", getModel()));
form.addOrReplace(submitButton = newButton("signupButton"));
submitButton.add(
buttonLabel = newButtonLabel("buttonLabel", "global.button.sign.up.label", "Sign up"));
form.add(submitButton);
form.add(new EqualPasswordInputValidator(
signupPanel.getSigninPanel().getPassword().getPasswordTextField(),
signupPanel.getRepeatPassword().getPasswordTextField()));
}
|
java
|
protected void initComponent()
{
addOrReplace(form = newForm("form", getModel()));
form.addOrReplace(signupPanel = newSignupPanel("signupPanel", getModel()));
form.addOrReplace(submitButton = newButton("signupButton"));
submitButton.add(
buttonLabel = newButtonLabel("buttonLabel", "global.button.sign.up.label", "Sign up"));
form.add(submitButton);
form.add(new EqualPasswordInputValidator(
signupPanel.getSigninPanel().getPassword().getPasswordTextField(),
signupPanel.getRepeatPassword().getPasswordTextField()));
}
|
[
"protected",
"void",
"initComponent",
"(",
")",
"{",
"addOrReplace",
"(",
"form",
"=",
"newForm",
"(",
"\"form\"",
",",
"getModel",
"(",
")",
")",
")",
";",
"form",
".",
"addOrReplace",
"(",
"signupPanel",
"=",
"newSignupPanel",
"(",
"\"signupPanel\"",
",",
"getModel",
"(",
")",
")",
")",
";",
"form",
".",
"addOrReplace",
"(",
"submitButton",
"=",
"newButton",
"(",
"\"signupButton\"",
")",
")",
";",
"submitButton",
".",
"add",
"(",
"buttonLabel",
"=",
"newButtonLabel",
"(",
"\"buttonLabel\"",
",",
"\"global.button.sign.up.label\"",
",",
"\"Sign up\"",
")",
")",
";",
"form",
".",
"add",
"(",
"submitButton",
")",
";",
"form",
".",
"add",
"(",
"new",
"EqualPasswordInputValidator",
"(",
"signupPanel",
".",
"getSigninPanel",
"(",
")",
".",
"getPassword",
"(",
")",
".",
"getPasswordTextField",
"(",
")",
",",
"signupPanel",
".",
"getRepeatPassword",
"(",
")",
".",
"getPasswordTextField",
"(",
")",
")",
")",
";",
"}"
] |
Inits the component.
|
[
"Inits",
"the",
"component",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/up/SignupFormPanel.java#L85-L98
|
146,076
|
astrapi69/jaulp-wicket
|
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/up/SignupFormPanel.java
|
SignupFormPanel.newButtonLabel
|
protected Label newButtonLabel(final String id, final String resourceKey,
final String defaultValue)
{
final IModel<String> labelModel = ResourceModelFactory.newResourceModel(resourceKey, this,
defaultValue);
final Label label = new Label(id, labelModel);
label.setOutputMarkupId(true);
return label;
}
|
java
|
protected Label newButtonLabel(final String id, final String resourceKey,
final String defaultValue)
{
final IModel<String> labelModel = ResourceModelFactory.newResourceModel(resourceKey, this,
defaultValue);
final Label label = new Label(id, labelModel);
label.setOutputMarkupId(true);
return label;
}
|
[
"protected",
"Label",
"newButtonLabel",
"(",
"final",
"String",
"id",
",",
"final",
"String",
"resourceKey",
",",
"final",
"String",
"defaultValue",
")",
"{",
"final",
"IModel",
"<",
"String",
">",
"labelModel",
"=",
"ResourceModelFactory",
".",
"newResourceModel",
"(",
"resourceKey",
",",
"this",
",",
"defaultValue",
")",
";",
"final",
"Label",
"label",
"=",
"new",
"Label",
"(",
"id",
",",
"labelModel",
")",
";",
"label",
".",
"setOutputMarkupId",
"(",
"true",
")",
";",
"return",
"label",
";",
"}"
] |
Factory method for creating the Button Label. This method is invoked in the constructor from
the derived classes and can be overridden so users can provide their own version of a Label.
@param id
the id
@param resourceKey
the resource key
@param defaultValue
the default value
@return the label
|
[
"Factory",
"method",
"for",
"creating",
"the",
"Button",
"Label",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"derived",
"classes",
"and",
"can",
"be",
"overridden",
"so",
"users",
"can",
"provide",
"their",
"own",
"version",
"of",
"a",
"Label",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/up/SignupFormPanel.java#L135-L143
|
146,077
|
astrapi69/jaulp-wicket
|
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/up/SignupFormPanel.java
|
SignupFormPanel.newForm
|
@SuppressWarnings({ "unchecked", "rawtypes" })
protected Form<?> newForm(final String id,
final IModel<? extends BaseUsernameSignUpModel> model)
{
return new Form(id, model);
}
|
java
|
@SuppressWarnings({ "unchecked", "rawtypes" })
protected Form<?> newForm(final String id,
final IModel<? extends BaseUsernameSignUpModel> model)
{
return new Form(id, model);
}
|
[
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"protected",
"Form",
"<",
"?",
">",
"newForm",
"(",
"final",
"String",
"id",
",",
"final",
"IModel",
"<",
"?",
"extends",
"BaseUsernameSignUpModel",
">",
"model",
")",
"{",
"return",
"new",
"Form",
"(",
"id",
",",
"model",
")",
";",
"}"
] |
Factory method for creating the Form. This method is invoked in the constructor from the
derived classes and can be overridden so users can provide their own version of a Form.
@param id
the id
@param model
the model
@return the form
|
[
"Factory",
"method",
"for",
"creating",
"the",
"Form",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"derived",
"classes",
"and",
"can",
"be",
"overridden",
"so",
"users",
"can",
"provide",
"their",
"own",
"version",
"of",
"a",
"Form",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/up/SignupFormPanel.java#L155-L160
|
146,078
|
astrapi69/jaulp-wicket
|
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/up/SignupFormPanel.java
|
SignupFormPanel.newSignupPanel
|
protected SignupPanel<BaseUsernameSignUpModel> newSignupPanel(final String id,
final IModel<BaseUsernameSignUpModel> model)
{
return new SignupPanel<>(id, model);
}
|
java
|
protected SignupPanel<BaseUsernameSignUpModel> newSignupPanel(final String id,
final IModel<BaseUsernameSignUpModel> model)
{
return new SignupPanel<>(id, model);
}
|
[
"protected",
"SignupPanel",
"<",
"BaseUsernameSignUpModel",
">",
"newSignupPanel",
"(",
"final",
"String",
"id",
",",
"final",
"IModel",
"<",
"BaseUsernameSignUpModel",
">",
"model",
")",
"{",
"return",
"new",
"SignupPanel",
"<>",
"(",
"id",
",",
"model",
")",
";",
"}"
] |
Factory method for creating the SignupPanel. This method is invoked in the constructor from
the derived classes and can be overridden so users can provide their own version of a
SignupPanel.
@param id
the id
@param model
the model
@return the SignupPanel
|
[
"Factory",
"method",
"for",
"creating",
"the",
"SignupPanel",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"derived",
"classes",
"and",
"can",
"be",
"overridden",
"so",
"users",
"can",
"provide",
"their",
"own",
"version",
"of",
"a",
"SignupPanel",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/up/SignupFormPanel.java#L173-L177
|
146,079
|
astrapi69/jaulp-wicket
|
jaulp-wicket-dropdownchoices/src/main/java/de/alpharogroup/wicket/components/i18n/dropdownchoice/panels/DropdownAutocompleteTextFieldPanel.java
|
DropdownAutocompleteTextFieldPanel.onRootChoiceUpdate
|
protected void onRootChoiceUpdate(final AjaxRequestTarget target) {
childTextField.setModelObject(getModelObject().getSelectedChildOption());
target.add(DropdownAutocompleteTextFieldPanel.this.childTextField);
}
|
java
|
protected void onRootChoiceUpdate(final AjaxRequestTarget target) {
childTextField.setModelObject(getModelObject().getSelectedChildOption());
target.add(DropdownAutocompleteTextFieldPanel.this.childTextField);
}
|
[
"protected",
"void",
"onRootChoiceUpdate",
"(",
"final",
"AjaxRequestTarget",
"target",
")",
"{",
"childTextField",
".",
"setModelObject",
"(",
"getModelObject",
"(",
")",
".",
"getSelectedChildOption",
"(",
")",
")",
";",
"target",
".",
"add",
"(",
"DropdownAutocompleteTextFieldPanel",
".",
"this",
".",
"childTextField",
")",
";",
"}"
] |
Callback method that can be overwritten to provide an additional action
when root choice has updated.
@param target
the current request handler
|
[
"Callback",
"method",
"that",
"can",
"be",
"overwritten",
"to",
"provide",
"an",
"additional",
"action",
"when",
"root",
"choice",
"has",
"updated",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-dropdownchoices/src/main/java/de/alpharogroup/wicket/components/i18n/dropdownchoice/panels/DropdownAutocompleteTextFieldPanel.java#L349-L352
|
146,080
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/tok/RuleBasedSegmenter.java
|
RuleBasedSegmenter.segment
|
private String[] segment(final String builtText) {
// these are fine because they do not affect offsets
String line = builtText.trim();
line = RuleBasedTokenizer.doubleSpaces.matcher(line).replaceAll(" ");
if (this.isHardParagraph) {
// convert every (spurious) paragraph in newlines and keep them
line = paragraph.matcher(line).replaceAll("\n$1");
} else {
// end of sentence markers, paragraph mark and beginning of link
line = endPunctLinkPara.matcher(line).replaceAll("$1\n$2$3");
line = conventionalPara.matcher(line).replaceAll("$1\n$2$3");
line = endInsideQuotesPara.matcher(line).replaceAll("$1\n$3$4");
line = multiDotsParaStarters.matcher(line).replaceAll("$1\n$2$3");
// remove spurious paragraphs
line = alphaNumParaLowerNum.matcher(line).replaceAll("$1 $3");
line = spuriousParagraph.matcher(line).replaceAll(" $2");
}
// non-period end of sentence markers (?!) followed by sentence starters.
line = noPeriodSpaceEnd.matcher(line).replaceAll("$1\n$2");
// multi-dots followed by sentence starters
line = multiDotsSpaceStarters.matcher(line).replaceAll("$1\n$2");
// end of sentence inside quotes or brackets
line = endInsideQuotesSpace.matcher(line).replaceAll("$1\n$2");
// end of sentence marker, sentence starter punctuation and upper case.
line = punctSpaceUpper.matcher(line).replaceAll("$1\n$2");
// end of sentence markers, maybe space or paragraph mark and beginning of
// link
line = endPunctLinkSpace.matcher(line).replaceAll("$1\n$2");
// special case of multi-punctuation
line = punctSpaceMultiPunct.matcher(line).replaceAll("$1\n$2");
// non breaker segments everything else with some exceptions
final String[] lines = line.split("\n");
final String[] sentences = this.nonBreaker.segmenterExceptions(lines);
return sentences;
}
|
java
|
private String[] segment(final String builtText) {
// these are fine because they do not affect offsets
String line = builtText.trim();
line = RuleBasedTokenizer.doubleSpaces.matcher(line).replaceAll(" ");
if (this.isHardParagraph) {
// convert every (spurious) paragraph in newlines and keep them
line = paragraph.matcher(line).replaceAll("\n$1");
} else {
// end of sentence markers, paragraph mark and beginning of link
line = endPunctLinkPara.matcher(line).replaceAll("$1\n$2$3");
line = conventionalPara.matcher(line).replaceAll("$1\n$2$3");
line = endInsideQuotesPara.matcher(line).replaceAll("$1\n$3$4");
line = multiDotsParaStarters.matcher(line).replaceAll("$1\n$2$3");
// remove spurious paragraphs
line = alphaNumParaLowerNum.matcher(line).replaceAll("$1 $3");
line = spuriousParagraph.matcher(line).replaceAll(" $2");
}
// non-period end of sentence markers (?!) followed by sentence starters.
line = noPeriodSpaceEnd.matcher(line).replaceAll("$1\n$2");
// multi-dots followed by sentence starters
line = multiDotsSpaceStarters.matcher(line).replaceAll("$1\n$2");
// end of sentence inside quotes or brackets
line = endInsideQuotesSpace.matcher(line).replaceAll("$1\n$2");
// end of sentence marker, sentence starter punctuation and upper case.
line = punctSpaceUpper.matcher(line).replaceAll("$1\n$2");
// end of sentence markers, maybe space or paragraph mark and beginning of
// link
line = endPunctLinkSpace.matcher(line).replaceAll("$1\n$2");
// special case of multi-punctuation
line = punctSpaceMultiPunct.matcher(line).replaceAll("$1\n$2");
// non breaker segments everything else with some exceptions
final String[] lines = line.split("\n");
final String[] sentences = this.nonBreaker.segmenterExceptions(lines);
return sentences;
}
|
[
"private",
"String",
"[",
"]",
"segment",
"(",
"final",
"String",
"builtText",
")",
"{",
"// these are fine because they do not affect offsets",
"String",
"line",
"=",
"builtText",
".",
"trim",
"(",
")",
";",
"line",
"=",
"RuleBasedTokenizer",
".",
"doubleSpaces",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\" \"",
")",
";",
"if",
"(",
"this",
".",
"isHardParagraph",
")",
"{",
"// convert every (spurious) paragraph in newlines and keep them",
"line",
"=",
"paragraph",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\"\\n$1\"",
")",
";",
"}",
"else",
"{",
"// end of sentence markers, paragraph mark and beginning of link",
"line",
"=",
"endPunctLinkPara",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\"$1\\n$2$3\"",
")",
";",
"line",
"=",
"conventionalPara",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\"$1\\n$2$3\"",
")",
";",
"line",
"=",
"endInsideQuotesPara",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\"$1\\n$3$4\"",
")",
";",
"line",
"=",
"multiDotsParaStarters",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\"$1\\n$2$3\"",
")",
";",
"// remove spurious paragraphs",
"line",
"=",
"alphaNumParaLowerNum",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\"$1 $3\"",
")",
";",
"line",
"=",
"spuriousParagraph",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\" $2\"",
")",
";",
"}",
"// non-period end of sentence markers (?!) followed by sentence starters.",
"line",
"=",
"noPeriodSpaceEnd",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\"$1\\n$2\"",
")",
";",
"// multi-dots followed by sentence starters",
"line",
"=",
"multiDotsSpaceStarters",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\"$1\\n$2\"",
")",
";",
"// end of sentence inside quotes or brackets",
"line",
"=",
"endInsideQuotesSpace",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\"$1\\n$2\"",
")",
";",
"// end of sentence marker, sentence starter punctuation and upper case.",
"line",
"=",
"punctSpaceUpper",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\"$1\\n$2\"",
")",
";",
"// end of sentence markers, maybe space or paragraph mark and beginning of",
"// link",
"line",
"=",
"endPunctLinkSpace",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\"$1\\n$2\"",
")",
";",
"// special case of multi-punctuation",
"line",
"=",
"punctSpaceMultiPunct",
".",
"matcher",
"(",
"line",
")",
".",
"replaceAll",
"(",
"\"$1\\n$2\"",
")",
";",
"// non breaker segments everything else with some exceptions",
"final",
"String",
"[",
"]",
"lines",
"=",
"line",
".",
"split",
"(",
"\"\\n\"",
")",
";",
"final",
"String",
"[",
"]",
"sentences",
"=",
"this",
".",
"nonBreaker",
".",
"segmenterExceptions",
"(",
"lines",
")",
";",
"return",
"sentences",
";",
"}"
] |
Segments sentences and calls the NonPeriodBreaker for exceptions.
@param text
the text be segmented
@return the sentences
|
[
"Segments",
"sentences",
"and",
"calls",
"the",
"NonPeriodBreaker",
"for",
"exceptions",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/tok/RuleBasedSegmenter.java#L195-L233
|
146,081
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/tok/RuleBasedSegmenter.java
|
RuleBasedSegmenter.readText
|
public static String readText(final BufferedReader breader) {
String line;
final StringBuilder sb = new StringBuilder();
try {
while ((line = breader.readLine()) != null) {
sb.append(line).append(LINE_BREAK);
}
} catch (final IOException e) {
e.printStackTrace();
}
String text = sb.toString();
text = buildText(text);
return text;
}
|
java
|
public static String readText(final BufferedReader breader) {
String line;
final StringBuilder sb = new StringBuilder();
try {
while ((line = breader.readLine()) != null) {
sb.append(line).append(LINE_BREAK);
}
} catch (final IOException e) {
e.printStackTrace();
}
String text = sb.toString();
text = buildText(text);
return text;
}
|
[
"public",
"static",
"String",
"readText",
"(",
"final",
"BufferedReader",
"breader",
")",
"{",
"String",
"line",
";",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"try",
"{",
"while",
"(",
"(",
"line",
"=",
"breader",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"sb",
".",
"append",
"(",
"line",
")",
".",
"append",
"(",
"LINE_BREAK",
")",
";",
"}",
"}",
"catch",
"(",
"final",
"IOException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"String",
"text",
"=",
"sb",
".",
"toString",
"(",
")",
";",
"text",
"=",
"buildText",
"(",
"text",
")",
";",
"return",
"text",
";",
"}"
] |
Reads standard input text from the BufferedReader and adds a line break
mark for every line. The output of this functions is then further processed
by methods called in the constructors of the SentenceSegmenter and
Tokenizer.
@param breader
the buffered reader
@return the input text in a string object
|
[
"Reads",
"standard",
"input",
"text",
"from",
"the",
"BufferedReader",
"and",
"adds",
"a",
"line",
"break",
"mark",
"for",
"every",
"line",
".",
"The",
"output",
"of",
"this",
"functions",
"is",
"then",
"further",
"processed",
"by",
"methods",
"called",
"in",
"the",
"constructors",
"of",
"the",
"SentenceSegmenter",
"and",
"Tokenizer",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/tok/RuleBasedSegmenter.java#L245-L258
|
146,082
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/tok/RuleBasedSegmenter.java
|
RuleBasedSegmenter.buildText
|
private static String buildText(String text) {
// <JAR><JAR> to PARAGRAPH mark in unicode
text = doubleLineBreak.matcher(text).replaceAll(PARAGRAPH);
// <JAR> to " "
text = lineBreak.matcher(text).replaceAll(" ");
return text;
}
|
java
|
private static String buildText(String text) {
// <JAR><JAR> to PARAGRAPH mark in unicode
text = doubleLineBreak.matcher(text).replaceAll(PARAGRAPH);
// <JAR> to " "
text = lineBreak.matcher(text).replaceAll(" ");
return text;
}
|
[
"private",
"static",
"String",
"buildText",
"(",
"String",
"text",
")",
"{",
"// <JAR><JAR> to PARAGRAPH mark in unicode",
"text",
"=",
"doubleLineBreak",
".",
"matcher",
"(",
"text",
")",
".",
"replaceAll",
"(",
"PARAGRAPH",
")",
";",
"// <JAR> to \" \"",
"text",
"=",
"lineBreak",
".",
"matcher",
"(",
"text",
")",
".",
"replaceAll",
"(",
"\" \"",
")",
";",
"return",
"text",
";",
"}"
] |
Builds the text for Segmentation and Tokenization. This is original text,
namely, the string used to calculate the character offsets.
@param text
the text from the reader
@return the original text
|
[
"Builds",
"the",
"text",
"for",
"Segmentation",
"and",
"Tokenization",
".",
"This",
"is",
"original",
"text",
"namely",
"the",
"string",
"used",
"to",
"calculate",
"the",
"character",
"offsets",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/tok/RuleBasedSegmenter.java#L268-L274
|
146,083
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/content/SharedPreferencesUtils.java
|
SharedPreferencesUtils.getDouble
|
public static double getDouble(SharedPreferences preferences, String key, double defaultValue) {
String stored = preferences.getString(key, null);
if (TextUtils.isEmpty(stored)) {
return defaultValue;
}
return Double.parseDouble(stored);
}
|
java
|
public static double getDouble(SharedPreferences preferences, String key, double defaultValue) {
String stored = preferences.getString(key, null);
if (TextUtils.isEmpty(stored)) {
return defaultValue;
}
return Double.parseDouble(stored);
}
|
[
"public",
"static",
"double",
"getDouble",
"(",
"SharedPreferences",
"preferences",
",",
"String",
"key",
",",
"double",
"defaultValue",
")",
"{",
"String",
"stored",
"=",
"preferences",
".",
"getString",
"(",
"key",
",",
"null",
")",
";",
"if",
"(",
"TextUtils",
".",
"isEmpty",
"(",
"stored",
")",
")",
"{",
"return",
"defaultValue",
";",
"}",
"return",
"Double",
".",
"parseDouble",
"(",
"stored",
")",
";",
"}"
] |
Retrieve a double value from the preferences.
@param preferences the preferences
@param key the key
@param defaultValue default value if the key is not present
@return the double value.
|
[
"Retrieve",
"a",
"double",
"value",
"from",
"the",
"preferences",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/SharedPreferencesUtils.java#L23-L29
|
146,084
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/content/SharedPreferencesUtils.java
|
SharedPreferencesUtils.putDouble
|
public static SharedPreferences.Editor putDouble(SharedPreferences.Editor editor, String key, double value) {
return editor.putString(key, String.valueOf(value));
}
|
java
|
public static SharedPreferences.Editor putDouble(SharedPreferences.Editor editor, String key, double value) {
return editor.putString(key, String.valueOf(value));
}
|
[
"public",
"static",
"SharedPreferences",
".",
"Editor",
"putDouble",
"(",
"SharedPreferences",
".",
"Editor",
"editor",
",",
"String",
"key",
",",
"double",
"value",
")",
"{",
"return",
"editor",
".",
"putString",
"(",
"key",
",",
"String",
".",
"valueOf",
"(",
"value",
")",
")",
";",
"}"
] |
Set a double value in the preferences editor.
@see android.content.SharedPreferences.Editor
@param editor the editor
@param key The name of the preference to modify.
@param value The new value for the preference.
@return the editor.
|
[
"Set",
"a",
"double",
"value",
"in",
"the",
"preferences",
"editor",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/SharedPreferencesUtils.java#L39-L41
|
146,085
|
geomajas/geomajas-project-client-gwt2
|
server-extension/src/main/java/org/geomajas/gwt2/client/GeomajasServerExtension.java
|
GeomajasServerExtension.initializeMap
|
public void initializeMap(final MapPresenter mapPresenter, String applicationId, String id,
final DefaultMapWidget... mapWidgets) {
GwtCommand commandRequest = new GwtCommand(GetMapConfigurationRequest.COMMAND);
commandRequest.setCommandRequest(new GetMapConfigurationRequest(id, applicationId));
commandService.execute(commandRequest, new AbstractCommandCallback<GetMapConfigurationResponse>() {
public void execute(GetMapConfigurationResponse response) {
// Initialize the MapModel and ViewPort:
ClientMapInfo mapInfo = response.getMapInfo();
// Create the map configuration
MapConfiguration configuration = createMapConfiguration(mapInfo, mapPresenter);
// We must initialize the map first (without firing the event), as layer constructors may depend on it :
((MapPresenterImpl) mapPresenter).initialize(configuration, false, mapWidgets);
// Add all layers:
for (ClientLayerInfo layerInfo : mapInfo.getLayers()) {
ServerLayer<?> layer = createLayer(configuration, layerInfo, mapPresenter.getViewPort(),
mapPresenter.getEventBus());
mapPresenter.getLayersModel().addLayer(layer);
}
// All layers animated
LayersModelRenderer modelRenderer = mapPresenter.getLayersModelRenderer();
for (int i = 0; i < mapPresenter.getLayersModel().getLayerCount(); i++) {
modelRenderer.setAnimated(mapPresenter.getLayersModel().getLayer(i), true);
}
// Also add a renderer for feature selection:
FeatureSelectionRenderer renderer = new FeatureSelectionRenderer(mapPresenter);
renderer.initialize(mapInfo);
mapPresenter.getEventBus().addFeatureSelectionHandler(renderer);
mapPresenter.getEventBus().addLayerVisibilityHandler(renderer);
// now we can fire the initialization event
mapPresenter.getEventBus().fireEvent(new MapInitializationEvent(mapPresenter));
}
});
}
|
java
|
public void initializeMap(final MapPresenter mapPresenter, String applicationId, String id,
final DefaultMapWidget... mapWidgets) {
GwtCommand commandRequest = new GwtCommand(GetMapConfigurationRequest.COMMAND);
commandRequest.setCommandRequest(new GetMapConfigurationRequest(id, applicationId));
commandService.execute(commandRequest, new AbstractCommandCallback<GetMapConfigurationResponse>() {
public void execute(GetMapConfigurationResponse response) {
// Initialize the MapModel and ViewPort:
ClientMapInfo mapInfo = response.getMapInfo();
// Create the map configuration
MapConfiguration configuration = createMapConfiguration(mapInfo, mapPresenter);
// We must initialize the map first (without firing the event), as layer constructors may depend on it :
((MapPresenterImpl) mapPresenter).initialize(configuration, false, mapWidgets);
// Add all layers:
for (ClientLayerInfo layerInfo : mapInfo.getLayers()) {
ServerLayer<?> layer = createLayer(configuration, layerInfo, mapPresenter.getViewPort(),
mapPresenter.getEventBus());
mapPresenter.getLayersModel().addLayer(layer);
}
// All layers animated
LayersModelRenderer modelRenderer = mapPresenter.getLayersModelRenderer();
for (int i = 0; i < mapPresenter.getLayersModel().getLayerCount(); i++) {
modelRenderer.setAnimated(mapPresenter.getLayersModel().getLayer(i), true);
}
// Also add a renderer for feature selection:
FeatureSelectionRenderer renderer = new FeatureSelectionRenderer(mapPresenter);
renderer.initialize(mapInfo);
mapPresenter.getEventBus().addFeatureSelectionHandler(renderer);
mapPresenter.getEventBus().addLayerVisibilityHandler(renderer);
// now we can fire the initialization event
mapPresenter.getEventBus().fireEvent(new MapInitializationEvent(mapPresenter));
}
});
}
|
[
"public",
"void",
"initializeMap",
"(",
"final",
"MapPresenter",
"mapPresenter",
",",
"String",
"applicationId",
",",
"String",
"id",
",",
"final",
"DefaultMapWidget",
"...",
"mapWidgets",
")",
"{",
"GwtCommand",
"commandRequest",
"=",
"new",
"GwtCommand",
"(",
"GetMapConfigurationRequest",
".",
"COMMAND",
")",
";",
"commandRequest",
".",
"setCommandRequest",
"(",
"new",
"GetMapConfigurationRequest",
"(",
"id",
",",
"applicationId",
")",
")",
";",
"commandService",
".",
"execute",
"(",
"commandRequest",
",",
"new",
"AbstractCommandCallback",
"<",
"GetMapConfigurationResponse",
">",
"(",
")",
"{",
"public",
"void",
"execute",
"(",
"GetMapConfigurationResponse",
"response",
")",
"{",
"// Initialize the MapModel and ViewPort:",
"ClientMapInfo",
"mapInfo",
"=",
"response",
".",
"getMapInfo",
"(",
")",
";",
"// Create the map configuration",
"MapConfiguration",
"configuration",
"=",
"createMapConfiguration",
"(",
"mapInfo",
",",
"mapPresenter",
")",
";",
"// We must initialize the map first (without firing the event), as layer constructors may depend on it :",
"(",
"(",
"MapPresenterImpl",
")",
"mapPresenter",
")",
".",
"initialize",
"(",
"configuration",
",",
"false",
",",
"mapWidgets",
")",
";",
"// Add all layers:",
"for",
"(",
"ClientLayerInfo",
"layerInfo",
":",
"mapInfo",
".",
"getLayers",
"(",
")",
")",
"{",
"ServerLayer",
"<",
"?",
">",
"layer",
"=",
"createLayer",
"(",
"configuration",
",",
"layerInfo",
",",
"mapPresenter",
".",
"getViewPort",
"(",
")",
",",
"mapPresenter",
".",
"getEventBus",
"(",
")",
")",
";",
"mapPresenter",
".",
"getLayersModel",
"(",
")",
".",
"addLayer",
"(",
"layer",
")",
";",
"}",
"// All layers animated",
"LayersModelRenderer",
"modelRenderer",
"=",
"mapPresenter",
".",
"getLayersModelRenderer",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"mapPresenter",
".",
"getLayersModel",
"(",
")",
".",
"getLayerCount",
"(",
")",
";",
"i",
"++",
")",
"{",
"modelRenderer",
".",
"setAnimated",
"(",
"mapPresenter",
".",
"getLayersModel",
"(",
")",
".",
"getLayer",
"(",
"i",
")",
",",
"true",
")",
";",
"}",
"// Also add a renderer for feature selection:",
"FeatureSelectionRenderer",
"renderer",
"=",
"new",
"FeatureSelectionRenderer",
"(",
"mapPresenter",
")",
";",
"renderer",
".",
"initialize",
"(",
"mapInfo",
")",
";",
"mapPresenter",
".",
"getEventBus",
"(",
")",
".",
"addFeatureSelectionHandler",
"(",
"renderer",
")",
";",
"mapPresenter",
".",
"getEventBus",
"(",
")",
".",
"addLayerVisibilityHandler",
"(",
"renderer",
")",
";",
"// now we can fire the initialization event",
"mapPresenter",
".",
"getEventBus",
"(",
")",
".",
"fireEvent",
"(",
"new",
"MapInitializationEvent",
"(",
"mapPresenter",
")",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Initialize the map by fetching a configuration on the server.
@param mapPresenter The map to initialize.
@param applicationId The application ID in the backend configuration.
@param id The map ID in the backend configuration.
@param mapWidgets A set of widgets that should be added to the map by default.
|
[
"Initialize",
"the",
"map",
"by",
"fetching",
"a",
"configuration",
"on",
"the",
"server",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/server-extension/src/main/java/org/geomajas/gwt2/client/GeomajasServerExtension.java#L159-L197
|
146,086
|
geomajas/geomajas-project-client-gwt2
|
server-extension/src/main/java/org/geomajas/gwt2/client/GeomajasServerExtension.java
|
GeomajasServerExtension.createLayer
|
protected ServerLayer<?> createLayer(MapConfiguration mapConfiguration, ClientLayerInfo layerInfo,
ViewPort viewPort, MapEventBus eventBus) {
ServerLayer<?> layer = null;
switch (layerInfo.getLayerType()) {
case RASTER:
layer = new RasterServerLayerImpl(mapConfiguration, (ClientRasterLayerInfo) layerInfo, viewPort,
eventBus);
break;
default:
layer = new VectorServerLayerImpl(mapConfiguration, (ClientVectorLayerInfo) layerInfo, viewPort,
eventBus);
break;
}
return layer;
}
|
java
|
protected ServerLayer<?> createLayer(MapConfiguration mapConfiguration, ClientLayerInfo layerInfo,
ViewPort viewPort, MapEventBus eventBus) {
ServerLayer<?> layer = null;
switch (layerInfo.getLayerType()) {
case RASTER:
layer = new RasterServerLayerImpl(mapConfiguration, (ClientRasterLayerInfo) layerInfo, viewPort,
eventBus);
break;
default:
layer = new VectorServerLayerImpl(mapConfiguration, (ClientVectorLayerInfo) layerInfo, viewPort,
eventBus);
break;
}
return layer;
}
|
[
"protected",
"ServerLayer",
"<",
"?",
">",
"createLayer",
"(",
"MapConfiguration",
"mapConfiguration",
",",
"ClientLayerInfo",
"layerInfo",
",",
"ViewPort",
"viewPort",
",",
"MapEventBus",
"eventBus",
")",
"{",
"ServerLayer",
"<",
"?",
">",
"layer",
"=",
"null",
";",
"switch",
"(",
"layerInfo",
".",
"getLayerType",
"(",
")",
")",
"{",
"case",
"RASTER",
":",
"layer",
"=",
"new",
"RasterServerLayerImpl",
"(",
"mapConfiguration",
",",
"(",
"ClientRasterLayerInfo",
")",
"layerInfo",
",",
"viewPort",
",",
"eventBus",
")",
";",
"break",
";",
"default",
":",
"layer",
"=",
"new",
"VectorServerLayerImpl",
"(",
"mapConfiguration",
",",
"(",
"ClientVectorLayerInfo",
")",
"layerInfo",
",",
"viewPort",
",",
"eventBus",
")",
";",
"break",
";",
"}",
"return",
"layer",
";",
"}"
] |
Create a new layer, based upon a server-side layer configuration object.
@param mapConfiguration The map configuration.
@param layerInfo The server-side configuration object.
@param viewPort The map viewport.
@param eventBus The map eventBus.
@return The new layer object. It has NOT been added to the map just yet.
|
[
"Create",
"a",
"new",
"layer",
"based",
"upon",
"a",
"server",
"-",
"side",
"layer",
"configuration",
"object",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/server-extension/src/main/java/org/geomajas/gwt2/client/GeomajasServerExtension.java#L220-L234
|
146,087
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamSummarizer.java
|
KamSummarizer.summarizeKamNetwork
|
public static KamSummary summarizeKamNetwork(Collection<KamEdge> edges,
int statementCount) {
KamSummary summary = new KamSummary();
Set<KamNode> nodes = new HashSet<KamNode>(); //unique set of nodes
for (KamEdge edge : edges) {
nodes.add(edge.getSourceNode());
nodes.add(edge.getTargetNode());
}
summary.setNumOfBELStatements(statementCount);
summary.setNumOfNodes(nodes.size());
summary.setNumOfEdges(edges.size());
return summary;
}
|
java
|
public static KamSummary summarizeKamNetwork(Collection<KamEdge> edges,
int statementCount) {
KamSummary summary = new KamSummary();
Set<KamNode> nodes = new HashSet<KamNode>(); //unique set of nodes
for (KamEdge edge : edges) {
nodes.add(edge.getSourceNode());
nodes.add(edge.getTargetNode());
}
summary.setNumOfBELStatements(statementCount);
summary.setNumOfNodes(nodes.size());
summary.setNumOfEdges(edges.size());
return summary;
}
|
[
"public",
"static",
"KamSummary",
"summarizeKamNetwork",
"(",
"Collection",
"<",
"KamEdge",
">",
"edges",
",",
"int",
"statementCount",
")",
"{",
"KamSummary",
"summary",
"=",
"new",
"KamSummary",
"(",
")",
";",
"Set",
"<",
"KamNode",
">",
"nodes",
"=",
"new",
"HashSet",
"<",
"KamNode",
">",
"(",
")",
";",
"//unique set of nodes",
"for",
"(",
"KamEdge",
"edge",
":",
"edges",
")",
"{",
"nodes",
".",
"add",
"(",
"edge",
".",
"getSourceNode",
"(",
")",
")",
";",
"nodes",
".",
"add",
"(",
"edge",
".",
"getTargetNode",
"(",
")",
")",
";",
"}",
"summary",
".",
"setNumOfBELStatements",
"(",
"statementCount",
")",
";",
"summary",
".",
"setNumOfNodes",
"(",
"nodes",
".",
"size",
"(",
")",
")",
";",
"summary",
".",
"setNumOfEdges",
"(",
"edges",
".",
"size",
"(",
")",
")",
";",
"return",
"summary",
";",
"}"
] |
Summarize nodes and edges
@param edges
@param annotationStatements
@return
|
[
"Summarize",
"nodes",
"and",
"edges"
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamSummarizer.java#L239-L253
|
146,088
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamSummarizer.java
|
KamSummarizer.getNumRnaNodes
|
private int getNumRnaNodes(Collection<KamNode> nodes) {
int count = 0;
for (KamNode node : nodes) {
if (node.getFunctionType() == FunctionEnum.RNA_ABUNDANCE) {
count++;
}
}
return count;
}
|
java
|
private int getNumRnaNodes(Collection<KamNode> nodes) {
int count = 0;
for (KamNode node : nodes) {
if (node.getFunctionType() == FunctionEnum.RNA_ABUNDANCE) {
count++;
}
}
return count;
}
|
[
"private",
"int",
"getNumRnaNodes",
"(",
"Collection",
"<",
"KamNode",
">",
"nodes",
")",
"{",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"KamNode",
"node",
":",
"nodes",
")",
"{",
"if",
"(",
"node",
".",
"getFunctionType",
"(",
")",
"==",
"FunctionEnum",
".",
"RNA_ABUNDANCE",
")",
"{",
"count",
"++",
";",
"}",
"}",
"return",
"count",
";",
"}"
] |
returns the number of rnaAbundance nodes.
@param nodes
@return
|
[
"returns",
"the",
"number",
"of",
"rnaAbundance",
"nodes",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamSummarizer.java#L260-L268
|
146,089
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamSummarizer.java
|
KamSummarizer.getPhosphoProteinNodes
|
private int getPhosphoProteinNodes(Collection<KamNode> nodes) {
int count = 0;
for (KamNode node : nodes) {
if (node.getFunctionType() == FunctionEnum.PROTEIN_ABUNDANCE
&& node.getLabel().indexOf("proteinModification(P") > -1) {
count++;
}
}
return count;
}
|
java
|
private int getPhosphoProteinNodes(Collection<KamNode> nodes) {
int count = 0;
for (KamNode node : nodes) {
if (node.getFunctionType() == FunctionEnum.PROTEIN_ABUNDANCE
&& node.getLabel().indexOf("proteinModification(P") > -1) {
count++;
}
}
return count;
}
|
[
"private",
"int",
"getPhosphoProteinNodes",
"(",
"Collection",
"<",
"KamNode",
">",
"nodes",
")",
"{",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"KamNode",
"node",
":",
"nodes",
")",
"{",
"if",
"(",
"node",
".",
"getFunctionType",
"(",
")",
"==",
"FunctionEnum",
".",
"PROTEIN_ABUNDANCE",
"&&",
"node",
".",
"getLabel",
"(",
")",
".",
"indexOf",
"(",
"\"proteinModification(P\"",
")",
">",
"-",
"1",
")",
"{",
"count",
"++",
";",
"}",
"}",
"return",
"count",
";",
"}"
] |
return number of protein with phosphorylation modification
@param nodes
@return
|
[
"return",
"number",
"of",
"protein",
"with",
"phosphorylation",
"modification"
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamSummarizer.java#L275-L284
|
146,090
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamSummarizer.java
|
KamSummarizer.getUniqueGeneReference
|
private int getUniqueGeneReference(Collection<KamNode> nodes) {
//count all protienAbundance reference
Set<String> uniqueLabels = new HashSet<String>();
for (KamNode node : nodes) {
if (node.getFunctionType() == FunctionEnum.PROTEIN_ABUNDANCE
&& StringUtils.countMatches(node.getLabel(), "(") == 1
&& StringUtils.countMatches(node.getLabel(), ")") == 1) {
uniqueLabels.add(node.getLabel());
}
}
return uniqueLabels.size();
}
|
java
|
private int getUniqueGeneReference(Collection<KamNode> nodes) {
//count all protienAbundance reference
Set<String> uniqueLabels = new HashSet<String>();
for (KamNode node : nodes) {
if (node.getFunctionType() == FunctionEnum.PROTEIN_ABUNDANCE
&& StringUtils.countMatches(node.getLabel(), "(") == 1
&& StringUtils.countMatches(node.getLabel(), ")") == 1) {
uniqueLabels.add(node.getLabel());
}
}
return uniqueLabels.size();
}
|
[
"private",
"int",
"getUniqueGeneReference",
"(",
"Collection",
"<",
"KamNode",
">",
"nodes",
")",
"{",
"//count all protienAbundance reference",
"Set",
"<",
"String",
">",
"uniqueLabels",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"KamNode",
"node",
":",
"nodes",
")",
"{",
"if",
"(",
"node",
".",
"getFunctionType",
"(",
")",
"==",
"FunctionEnum",
".",
"PROTEIN_ABUNDANCE",
"&&",
"StringUtils",
".",
"countMatches",
"(",
"node",
".",
"getLabel",
"(",
")",
",",
"\"(\"",
")",
"==",
"1",
"&&",
"StringUtils",
".",
"countMatches",
"(",
"node",
".",
"getLabel",
"(",
")",
",",
"\")\"",
")",
"==",
"1",
")",
"{",
"uniqueLabels",
".",
"add",
"(",
"node",
".",
"getLabel",
"(",
")",
")",
";",
"}",
"}",
"return",
"uniqueLabels",
".",
"size",
"(",
")",
";",
"}"
] |
returns number unique gene reference
@param edges
@return
|
[
"returns",
"number",
"unique",
"gene",
"reference"
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamSummarizer.java#L291-L303
|
146,091
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamSummarizer.java
|
KamSummarizer.getIncreasesEdges
|
private int getIncreasesEdges(Collection<KamEdge> edges) {
int count = 0;
for (KamEdge edge : edges) {
if (edge.getRelationshipType() == RelationshipType.INCREASES
|| edge.getRelationshipType() == RelationshipType.DIRECTLY_INCREASES) {
count++;
}
}
return count;
}
|
java
|
private int getIncreasesEdges(Collection<KamEdge> edges) {
int count = 0;
for (KamEdge edge : edges) {
if (edge.getRelationshipType() == RelationshipType.INCREASES
|| edge.getRelationshipType() == RelationshipType.DIRECTLY_INCREASES) {
count++;
}
}
return count;
}
|
[
"private",
"int",
"getIncreasesEdges",
"(",
"Collection",
"<",
"KamEdge",
">",
"edges",
")",
"{",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"KamEdge",
"edge",
":",
"edges",
")",
"{",
"if",
"(",
"edge",
".",
"getRelationshipType",
"(",
")",
"==",
"RelationshipType",
".",
"INCREASES",
"||",
"edge",
".",
"getRelationshipType",
"(",
")",
"==",
"RelationshipType",
".",
"DIRECTLY_INCREASES",
")",
"{",
"count",
"++",
";",
"}",
"}",
"return",
"count",
";",
"}"
] |
returns number of inceases and directly_increases edges.
@param edges
@return
|
[
"returns",
"number",
"of",
"inceases",
"and",
"directly_increases",
"edges",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamSummarizer.java#L310-L319
|
146,092
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamSummarizer.java
|
KamSummarizer.getDecreasesEdges
|
private int getDecreasesEdges(Collection<KamEdge> edges) {
int count = 0;
for (KamEdge edge : edges) {
if (edge.getRelationshipType() == RelationshipType.DECREASES
|| edge.getRelationshipType() == RelationshipType.DIRECTLY_DECREASES) {
count++;
}
}
return count;
}
|
java
|
private int getDecreasesEdges(Collection<KamEdge> edges) {
int count = 0;
for (KamEdge edge : edges) {
if (edge.getRelationshipType() == RelationshipType.DECREASES
|| edge.getRelationshipType() == RelationshipType.DIRECTLY_DECREASES) {
count++;
}
}
return count;
}
|
[
"private",
"int",
"getDecreasesEdges",
"(",
"Collection",
"<",
"KamEdge",
">",
"edges",
")",
"{",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"KamEdge",
"edge",
":",
"edges",
")",
"{",
"if",
"(",
"edge",
".",
"getRelationshipType",
"(",
")",
"==",
"RelationshipType",
".",
"DECREASES",
"||",
"edge",
".",
"getRelationshipType",
"(",
")",
"==",
"RelationshipType",
".",
"DIRECTLY_DECREASES",
")",
"{",
"count",
"++",
";",
"}",
"}",
"return",
"count",
";",
"}"
] |
returns number of deceases and directly_decreases edges.
@param edges
@return
|
[
"returns",
"number",
"of",
"deceases",
"and",
"directly_decreases",
"edges",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamSummarizer.java#L326-L335
|
146,093
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamSummarizer.java
|
KamSummarizer.isCausal
|
private boolean isCausal(KamEdge edge) {
return edge.getRelationshipType() == RelationshipType.INCREASES
|| edge.getRelationshipType() == RelationshipType.DIRECTLY_INCREASES
|| edge.getRelationshipType() == RelationshipType.DECREASES
|| edge.getRelationshipType() == RelationshipType.DIRECTLY_DECREASES;
}
|
java
|
private boolean isCausal(KamEdge edge) {
return edge.getRelationshipType() == RelationshipType.INCREASES
|| edge.getRelationshipType() == RelationshipType.DIRECTLY_INCREASES
|| edge.getRelationshipType() == RelationshipType.DECREASES
|| edge.getRelationshipType() == RelationshipType.DIRECTLY_DECREASES;
}
|
[
"private",
"boolean",
"isCausal",
"(",
"KamEdge",
"edge",
")",
"{",
"return",
"edge",
".",
"getRelationshipType",
"(",
")",
"==",
"RelationshipType",
".",
"INCREASES",
"||",
"edge",
".",
"getRelationshipType",
"(",
")",
"==",
"RelationshipType",
".",
"DIRECTLY_INCREASES",
"||",
"edge",
".",
"getRelationshipType",
"(",
")",
"==",
"RelationshipType",
".",
"DECREASES",
"||",
"edge",
".",
"getRelationshipType",
"(",
")",
"==",
"RelationshipType",
".",
"DIRECTLY_DECREASES",
";",
"}"
] |
returns true if the edge has one of the 4 causal relationship types.
@param edge
@return
|
[
"returns",
"true",
"if",
"the",
"edge",
"has",
"one",
"of",
"the",
"4",
"causal",
"relationship",
"types",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamSummarizer.java#L396-L401
|
146,094
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamSummarizer.java
|
KamSummarizer.getAnnotationType
|
private AnnotationType getAnnotationType(final KAMStore kAMStore,
final Kam kam, final String name) throws KAMStoreException {
AnnotationType annoType = null;
List<BelDocumentInfo> belDocs =
kAMStore.getBelDocumentInfos(kam.getKamInfo());
//loop through all BEL documents used for this KAM
for (BelDocumentInfo doc : belDocs) {
//check annotation type on each document
List<AnnotationType> annoTypes = doc.getAnnotationTypes();
for (AnnotationType a : annoTypes) {
if (a.getName().equals(name)) {
annoType = a;
break;
}
}
if (annoType != null) {
break;
}
}
return annoType;
}
|
java
|
private AnnotationType getAnnotationType(final KAMStore kAMStore,
final Kam kam, final String name) throws KAMStoreException {
AnnotationType annoType = null;
List<BelDocumentInfo> belDocs =
kAMStore.getBelDocumentInfos(kam.getKamInfo());
//loop through all BEL documents used for this KAM
for (BelDocumentInfo doc : belDocs) {
//check annotation type on each document
List<AnnotationType> annoTypes = doc.getAnnotationTypes();
for (AnnotationType a : annoTypes) {
if (a.getName().equals(name)) {
annoType = a;
break;
}
}
if (annoType != null) {
break;
}
}
return annoType;
}
|
[
"private",
"AnnotationType",
"getAnnotationType",
"(",
"final",
"KAMStore",
"kAMStore",
",",
"final",
"Kam",
"kam",
",",
"final",
"String",
"name",
")",
"throws",
"KAMStoreException",
"{",
"AnnotationType",
"annoType",
"=",
"null",
";",
"List",
"<",
"BelDocumentInfo",
">",
"belDocs",
"=",
"kAMStore",
".",
"getBelDocumentInfos",
"(",
"kam",
".",
"getKamInfo",
"(",
")",
")",
";",
"//loop through all BEL documents used for this KAM",
"for",
"(",
"BelDocumentInfo",
"doc",
":",
"belDocs",
")",
"{",
"//check annotation type on each document",
"List",
"<",
"AnnotationType",
">",
"annoTypes",
"=",
"doc",
".",
"getAnnotationTypes",
"(",
")",
";",
"for",
"(",
"AnnotationType",
"a",
":",
"annoTypes",
")",
"{",
"if",
"(",
"a",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"name",
")",
")",
"{",
"annoType",
"=",
"a",
";",
"break",
";",
"}",
"}",
"if",
"(",
"annoType",
"!=",
"null",
")",
"{",
"break",
";",
"}",
"}",
"return",
"annoType",
";",
"}"
] |
Returns the first annotation type matching the specified name
@param kam
@param name
@return AnnotationType, maybe null
|
[
"Returns",
"the",
"first",
"annotation",
"type",
"matching",
"the",
"specified",
"name"
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamSummarizer.java#L423-L444
|
146,095
|
geomajas/geomajas-project-client-gwt2
|
plugin/editing/common/src/main/java/org/geomajas/plugin/editing/client/operation/InsertVertexOperation.java
|
InsertVertexOperation.insertAfterEdge
|
private void insertAfterEdge(Geometry geom, GeometryIndex index, Coordinate coordinate)
throws GeometryIndexNotFoundException {
// First we check the geometry type:
if (!Geometry.LINE_STRING.equals(geom.getGeometryType())
&& !Geometry.LINEAR_RING.equals(geom.getGeometryType())) {
throw new GeometryIndexNotFoundException("Could not match index with given geometry.");
}
if (index.getValue() < 0) {
throw new GeometryIndexNotFoundException("Cannot insert in a negative index.");
}
// Then we check if the edge exists:
if (geom.getCoordinates() != null && geom.getCoordinates().length > index.getValue() + 1) {
// Inserting on edges allows only to insert on existing edges. No adding at the end:
Coordinate[] result = new Coordinate[geom.getCoordinates().length + 1];
int count = 0;
for (int i = 0; i < geom.getCoordinates().length; i++) {
if (i == (index.getValue() + 1)) {
result[i] = coordinate;
count++;
}
result[i + count] = geom.getCoordinates()[i];
}
geom.setCoordinates(result);
} else {
throw new GeometryIndexNotFoundException("Cannot insert a vertex into an edge that does not exist.");
}
}
|
java
|
private void insertAfterEdge(Geometry geom, GeometryIndex index, Coordinate coordinate)
throws GeometryIndexNotFoundException {
// First we check the geometry type:
if (!Geometry.LINE_STRING.equals(geom.getGeometryType())
&& !Geometry.LINEAR_RING.equals(geom.getGeometryType())) {
throw new GeometryIndexNotFoundException("Could not match index with given geometry.");
}
if (index.getValue() < 0) {
throw new GeometryIndexNotFoundException("Cannot insert in a negative index.");
}
// Then we check if the edge exists:
if (geom.getCoordinates() != null && geom.getCoordinates().length > index.getValue() + 1) {
// Inserting on edges allows only to insert on existing edges. No adding at the end:
Coordinate[] result = new Coordinate[geom.getCoordinates().length + 1];
int count = 0;
for (int i = 0; i < geom.getCoordinates().length; i++) {
if (i == (index.getValue() + 1)) {
result[i] = coordinate;
count++;
}
result[i + count] = geom.getCoordinates()[i];
}
geom.setCoordinates(result);
} else {
throw new GeometryIndexNotFoundException("Cannot insert a vertex into an edge that does not exist.");
}
}
|
[
"private",
"void",
"insertAfterEdge",
"(",
"Geometry",
"geom",
",",
"GeometryIndex",
"index",
",",
"Coordinate",
"coordinate",
")",
"throws",
"GeometryIndexNotFoundException",
"{",
"// First we check the geometry type:",
"if",
"(",
"!",
"Geometry",
".",
"LINE_STRING",
".",
"equals",
"(",
"geom",
".",
"getGeometryType",
"(",
")",
")",
"&&",
"!",
"Geometry",
".",
"LINEAR_RING",
".",
"equals",
"(",
"geom",
".",
"getGeometryType",
"(",
")",
")",
")",
"{",
"throw",
"new",
"GeometryIndexNotFoundException",
"(",
"\"Could not match index with given geometry.\"",
")",
";",
"}",
"if",
"(",
"index",
".",
"getValue",
"(",
")",
"<",
"0",
")",
"{",
"throw",
"new",
"GeometryIndexNotFoundException",
"(",
"\"Cannot insert in a negative index.\"",
")",
";",
"}",
"// Then we check if the edge exists:",
"if",
"(",
"geom",
".",
"getCoordinates",
"(",
")",
"!=",
"null",
"&&",
"geom",
".",
"getCoordinates",
"(",
")",
".",
"length",
">",
"index",
".",
"getValue",
"(",
")",
"+",
"1",
")",
"{",
"// Inserting on edges allows only to insert on existing edges. No adding at the end:",
"Coordinate",
"[",
"]",
"result",
"=",
"new",
"Coordinate",
"[",
"geom",
".",
"getCoordinates",
"(",
")",
".",
"length",
"+",
"1",
"]",
";",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"geom",
".",
"getCoordinates",
"(",
")",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
"==",
"(",
"index",
".",
"getValue",
"(",
")",
"+",
"1",
")",
")",
"{",
"result",
"[",
"i",
"]",
"=",
"coordinate",
";",
"count",
"++",
";",
"}",
"result",
"[",
"i",
"+",
"count",
"]",
"=",
"geom",
".",
"getCoordinates",
"(",
")",
"[",
"i",
"]",
";",
"}",
"geom",
".",
"setCoordinates",
"(",
"result",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"GeometryIndexNotFoundException",
"(",
"\"Cannot insert a vertex into an edge that does not exist.\"",
")",
";",
"}",
"}"
] |
Insert a point into a given edge. There can be only edges if there are at least 2 points in a LineString
geometry.
|
[
"Insert",
"a",
"point",
"into",
"a",
"given",
"edge",
".",
"There",
"can",
"be",
"only",
"edges",
"if",
"there",
"are",
"at",
"least",
"2",
"points",
"in",
"a",
"LineString",
"geometry",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/editing/common/src/main/java/org/geomajas/plugin/editing/client/operation/InsertVertexOperation.java#L111-L138
|
146,096
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/SessionExtensions.java
|
SessionExtensions.getHttpSession
|
public static HttpSession getHttpSession()
{
final HttpServletRequest request = WicketComponentExtensions.getHttpServletRequest();
if (request != null)
{
final HttpSession session = request.getSession(false);
if (session != null)
{
return session;
}
}
return null;
}
|
java
|
public static HttpSession getHttpSession()
{
final HttpServletRequest request = WicketComponentExtensions.getHttpServletRequest();
if (request != null)
{
final HttpSession session = request.getSession(false);
if (session != null)
{
return session;
}
}
return null;
}
|
[
"public",
"static",
"HttpSession",
"getHttpSession",
"(",
")",
"{",
"final",
"HttpServletRequest",
"request",
"=",
"WicketComponentExtensions",
".",
"getHttpServletRequest",
"(",
")",
";",
"if",
"(",
"request",
"!=",
"null",
")",
"{",
"final",
"HttpSession",
"session",
"=",
"request",
".",
"getSession",
"(",
"false",
")",
";",
"if",
"(",
"session",
"!=",
"null",
")",
"{",
"return",
"session",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Gets the current http session.
@return the current http session.
|
[
"Gets",
"the",
"current",
"http",
"session",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/SessionExtensions.java#L42-L54
|
146,097
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/SessionExtensions.java
|
SessionExtensions.getRequestLogger
|
public static IRequestLogger getRequestLogger(final WebApplication webApplication)
{
IRequestLogger requestLogger;
if (webApplication == null)
{
requestLogger = ((WebApplication)Application.get()).getRequestLogger();
}
else
{
requestLogger = webApplication.getRequestLogger();
}
if (requestLogger == null)
{
requestLogger = new RequestLogger();
}
return requestLogger;
}
|
java
|
public static IRequestLogger getRequestLogger(final WebApplication webApplication)
{
IRequestLogger requestLogger;
if (webApplication == null)
{
requestLogger = ((WebApplication)Application.get()).getRequestLogger();
}
else
{
requestLogger = webApplication.getRequestLogger();
}
if (requestLogger == null)
{
requestLogger = new RequestLogger();
}
return requestLogger;
}
|
[
"public",
"static",
"IRequestLogger",
"getRequestLogger",
"(",
"final",
"WebApplication",
"webApplication",
")",
"{",
"IRequestLogger",
"requestLogger",
";",
"if",
"(",
"webApplication",
"==",
"null",
")",
"{",
"requestLogger",
"=",
"(",
"(",
"WebApplication",
")",
"Application",
".",
"get",
"(",
")",
")",
".",
"getRequestLogger",
"(",
")",
";",
"}",
"else",
"{",
"requestLogger",
"=",
"webApplication",
".",
"getRequestLogger",
"(",
")",
";",
"}",
"if",
"(",
"requestLogger",
"==",
"null",
")",
"{",
"requestLogger",
"=",
"new",
"RequestLogger",
"(",
")",
";",
"}",
"return",
"requestLogger",
";",
"}"
] |
Gets the request logger from the given WebApplication.
@param webApplication
the web application
@return the request logger
|
[
"Gets",
"the",
"request",
"logger",
"from",
"the",
"given",
"WebApplication",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/SessionExtensions.java#L93-L110
|
146,098
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/io/FileUtils.java
|
FileUtils.copy
|
public static long copy(File source, File destination) throws FileNotFoundException, IOException {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream(source);
out = new FileOutputStream(destination);
return copy(in, out);
} finally {
CloseableUtils.close(in);
CloseableUtils.close(out);
}
}
|
java
|
public static long copy(File source, File destination) throws FileNotFoundException, IOException {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream(source);
out = new FileOutputStream(destination);
return copy(in, out);
} finally {
CloseableUtils.close(in);
CloseableUtils.close(out);
}
}
|
[
"public",
"static",
"long",
"copy",
"(",
"File",
"source",
",",
"File",
"destination",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
"{",
"FileInputStream",
"in",
"=",
"null",
";",
"FileOutputStream",
"out",
"=",
"null",
";",
"try",
"{",
"in",
"=",
"new",
"FileInputStream",
"(",
"source",
")",
";",
"out",
"=",
"new",
"FileOutputStream",
"(",
"destination",
")",
";",
"return",
"copy",
"(",
"in",
",",
"out",
")",
";",
"}",
"finally",
"{",
"CloseableUtils",
".",
"close",
"(",
"in",
")",
";",
"CloseableUtils",
".",
"close",
"(",
"out",
")",
";",
"}",
"}"
] |
Copy the file from the source to the destination.
@param source the source file to be copied.
@param destination the destination file to copy.
@see java.nio.channels.FileChannel#transferTo(long, long, java.nio.channels.WritableByteChannel).
@return the transferred byte count.
@throws FileNotFoundException
@throws IOException
|
[
"Copy",
"the",
"file",
"from",
"the",
"source",
"to",
"the",
"destination",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/io/FileUtils.java#L50-L61
|
146,099
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/io/FileUtils.java
|
FileUtils.copy
|
public static long copy(FileInputStream in, FileOutputStream out) throws IOException {
FileChannel source = null;
FileChannel destination = null;
try {
source = in.getChannel();
destination = out.getChannel();
return source.transferTo(0, source.size(), destination);
} finally {
CloseableUtils.close(source);
CloseableUtils.close(destination);
}
}
|
java
|
public static long copy(FileInputStream in, FileOutputStream out) throws IOException {
FileChannel source = null;
FileChannel destination = null;
try {
source = in.getChannel();
destination = out.getChannel();
return source.transferTo(0, source.size(), destination);
} finally {
CloseableUtils.close(source);
CloseableUtils.close(destination);
}
}
|
[
"public",
"static",
"long",
"copy",
"(",
"FileInputStream",
"in",
",",
"FileOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"FileChannel",
"source",
"=",
"null",
";",
"FileChannel",
"destination",
"=",
"null",
";",
"try",
"{",
"source",
"=",
"in",
".",
"getChannel",
"(",
")",
";",
"destination",
"=",
"out",
".",
"getChannel",
"(",
")",
";",
"return",
"source",
".",
"transferTo",
"(",
"0",
",",
"source",
".",
"size",
"(",
")",
",",
"destination",
")",
";",
"}",
"finally",
"{",
"CloseableUtils",
".",
"close",
"(",
"source",
")",
";",
"CloseableUtils",
".",
"close",
"(",
"destination",
")",
";",
"}",
"}"
] |
Copy the file using streams.
@param in source.
@param out destination.
@see java.nio.channels.FileChannel#transferTo(long, long, java.nio.channels.WritableByteChannel)
@return the transferred byte count.
@throws IOException
|
[
"Copy",
"the",
"file",
"using",
"streams",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/io/FileUtils.java#L71-L82
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.