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,200
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseOneApplication.java
|
PhaseOneApplication.stage6
|
public boolean stage6(final Document doc, final ProtoNetwork pn) {
beginStage(PHASE1_STAGE6_HDR, "6", NUM_PHASES);
final StringBuilder bldr = new StringBuilder();
boolean stmtSuccess = false, termSuccess = false;
bldr.append("Expanding statements and terms");
stageOutput(bldr.toString());
long t1 = currentTimeMillis();
boolean stmtExpand = !hasOption(NO_NS_LONG_OPT);
p1.stage6Expansion(doc, pn, stmtExpand);
termSuccess = true;
stmtSuccess = true;
long t2 = currentTimeMillis();
bldr.setLength(0);
markTime(bldr, t1, t2);
markEndStage(bldr);
stageOutput(bldr.toString());
return stmtSuccess && termSuccess;
}
|
java
|
public boolean stage6(final Document doc, final ProtoNetwork pn) {
beginStage(PHASE1_STAGE6_HDR, "6", NUM_PHASES);
final StringBuilder bldr = new StringBuilder();
boolean stmtSuccess = false, termSuccess = false;
bldr.append("Expanding statements and terms");
stageOutput(bldr.toString());
long t1 = currentTimeMillis();
boolean stmtExpand = !hasOption(NO_NS_LONG_OPT);
p1.stage6Expansion(doc, pn, stmtExpand);
termSuccess = true;
stmtSuccess = true;
long t2 = currentTimeMillis();
bldr.setLength(0);
markTime(bldr, t1, t2);
markEndStage(bldr);
stageOutput(bldr.toString());
return stmtSuccess && termSuccess;
}
|
[
"public",
"boolean",
"stage6",
"(",
"final",
"Document",
"doc",
",",
"final",
"ProtoNetwork",
"pn",
")",
"{",
"beginStage",
"(",
"PHASE1_STAGE6_HDR",
",",
"\"6\"",
",",
"NUM_PHASES",
")",
";",
"final",
"StringBuilder",
"bldr",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"boolean",
"stmtSuccess",
"=",
"false",
",",
"termSuccess",
"=",
"false",
";",
"bldr",
".",
"append",
"(",
"\"Expanding statements and terms\"",
")",
";",
"stageOutput",
"(",
"bldr",
".",
"toString",
"(",
")",
")",
";",
"long",
"t1",
"=",
"currentTimeMillis",
"(",
")",
";",
"boolean",
"stmtExpand",
"=",
"!",
"hasOption",
"(",
"NO_NS_LONG_OPT",
")",
";",
"p1",
".",
"stage6Expansion",
"(",
"doc",
",",
"pn",
",",
"stmtExpand",
")",
";",
"termSuccess",
"=",
"true",
";",
"stmtSuccess",
"=",
"true",
";",
"long",
"t2",
"=",
"currentTimeMillis",
"(",
")",
";",
"bldr",
".",
"setLength",
"(",
"0",
")",
";",
"markTime",
"(",
"bldr",
",",
"t1",
",",
"t2",
")",
";",
"markEndStage",
"(",
"bldr",
")",
";",
"stageOutput",
"(",
"bldr",
".",
"toString",
"(",
")",
")",
";",
"return",
"stmtSuccess",
"&&",
"termSuccess",
";",
"}"
] |
Stage six expansion of the document.
@param doc the original {@link Document document} needed as a dependency
when using {@link ProtoNetworkBuilder proto network builder}
@param pn the {@link ProtoNetwork proto network} to expand into
|
[
"Stage",
"six",
"expansion",
"of",
"the",
"document",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseOneApplication.java#L569-L591
|
146,201
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseOneApplication.java
|
PhaseOneApplication.stage7
|
private boolean stage7(final ProtoNetwork pn, final Document doc) {
beginStage(PHASE1_STAGE7_HDR, "7", NUM_PHASES);
final StringBuilder bldr = new StringBuilder();
bldr.append("Saving proto-network for ");
bldr.append(doc.getName());
stageOutput(bldr.toString());
long t1 = currentTimeMillis();
String dir = artifactPath.getAbsolutePath();
final String path = asPath(dir, nextUniqueFolderName());
File pnpathname = new File(path);
boolean success = true;
try {
p1.stage7Saving(pn, pnpathname);
if (withDebug()) {
TextProtoNetworkExternalizer textExternalizer =
new TextProtoNetworkExternalizer();
textExternalizer.writeProtoNetwork(pn,
pnpathname.getAbsolutePath());
}
} catch (ProtoNetworkError e) {
success = false;
error("failed to save proto-network");
e.printStackTrace();
}
long t2 = currentTimeMillis();
bldr.setLength(0);
markTime(bldr, t1, t2);
markEndStage(bldr);
stageOutput(bldr.toString());
return success;
}
|
java
|
private boolean stage7(final ProtoNetwork pn, final Document doc) {
beginStage(PHASE1_STAGE7_HDR, "7", NUM_PHASES);
final StringBuilder bldr = new StringBuilder();
bldr.append("Saving proto-network for ");
bldr.append(doc.getName());
stageOutput(bldr.toString());
long t1 = currentTimeMillis();
String dir = artifactPath.getAbsolutePath();
final String path = asPath(dir, nextUniqueFolderName());
File pnpathname = new File(path);
boolean success = true;
try {
p1.stage7Saving(pn, pnpathname);
if (withDebug()) {
TextProtoNetworkExternalizer textExternalizer =
new TextProtoNetworkExternalizer();
textExternalizer.writeProtoNetwork(pn,
pnpathname.getAbsolutePath());
}
} catch (ProtoNetworkError e) {
success = false;
error("failed to save proto-network");
e.printStackTrace();
}
long t2 = currentTimeMillis();
bldr.setLength(0);
markTime(bldr, t1, t2);
markEndStage(bldr);
stageOutput(bldr.toString());
return success;
}
|
[
"private",
"boolean",
"stage7",
"(",
"final",
"ProtoNetwork",
"pn",
",",
"final",
"Document",
"doc",
")",
"{",
"beginStage",
"(",
"PHASE1_STAGE7_HDR",
",",
"\"7\"",
",",
"NUM_PHASES",
")",
";",
"final",
"StringBuilder",
"bldr",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"bldr",
".",
"append",
"(",
"\"Saving proto-network for \"",
")",
";",
"bldr",
".",
"append",
"(",
"doc",
".",
"getName",
"(",
")",
")",
";",
"stageOutput",
"(",
"bldr",
".",
"toString",
"(",
")",
")",
";",
"long",
"t1",
"=",
"currentTimeMillis",
"(",
")",
";",
"String",
"dir",
"=",
"artifactPath",
".",
"getAbsolutePath",
"(",
")",
";",
"final",
"String",
"path",
"=",
"asPath",
"(",
"dir",
",",
"nextUniqueFolderName",
"(",
")",
")",
";",
"File",
"pnpathname",
"=",
"new",
"File",
"(",
"path",
")",
";",
"boolean",
"success",
"=",
"true",
";",
"try",
"{",
"p1",
".",
"stage7Saving",
"(",
"pn",
",",
"pnpathname",
")",
";",
"if",
"(",
"withDebug",
"(",
")",
")",
"{",
"TextProtoNetworkExternalizer",
"textExternalizer",
"=",
"new",
"TextProtoNetworkExternalizer",
"(",
")",
";",
"textExternalizer",
".",
"writeProtoNetwork",
"(",
"pn",
",",
"pnpathname",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"}",
"catch",
"(",
"ProtoNetworkError",
"e",
")",
"{",
"success",
"=",
"false",
";",
"error",
"(",
"\"failed to save proto-network\"",
")",
";",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"long",
"t2",
"=",
"currentTimeMillis",
"(",
")",
";",
"bldr",
".",
"setLength",
"(",
"0",
")",
";",
"markTime",
"(",
"bldr",
",",
"t1",
",",
"t2",
")",
";",
"markEndStage",
"(",
"bldr",
")",
";",
"stageOutput",
"(",
"bldr",
".",
"toString",
"(",
")",
")",
";",
"return",
"success",
";",
"}"
] |
Stage seven saving of proto-network.
@param pn Proto-network
@param doc {@link Document}, the document
@return boolean true if success, false otherwise
|
[
"Stage",
"seven",
"saving",
"of",
"proto",
"-",
"network",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseOneApplication.java#L600-L636
|
146,202
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/utils/Flags.java
|
Flags.getClusterLexiconFiles
|
public static List<File> getClusterLexiconFiles(final String clusterPath) {
final List<File> clusterLexicons = new ArrayList<File>();
final String[] clusterPaths = clusterPath.split(",");
for (final String clusterName : clusterPaths) {
clusterLexicons.add(new File(clusterName));
}
return clusterLexicons;
}
|
java
|
public static List<File> getClusterLexiconFiles(final String clusterPath) {
final List<File> clusterLexicons = new ArrayList<File>();
final String[] clusterPaths = clusterPath.split(",");
for (final String clusterName : clusterPaths) {
clusterLexicons.add(new File(clusterName));
}
return clusterLexicons;
}
|
[
"public",
"static",
"List",
"<",
"File",
">",
"getClusterLexiconFiles",
"(",
"final",
"String",
"clusterPath",
")",
"{",
"final",
"List",
"<",
"File",
">",
"clusterLexicons",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",
")",
";",
"final",
"String",
"[",
"]",
"clusterPaths",
"=",
"clusterPath",
".",
"split",
"(",
"\",\"",
")",
";",
"for",
"(",
"final",
"String",
"clusterName",
":",
"clusterPaths",
")",
"{",
"clusterLexicons",
".",
"add",
"(",
"new",
"File",
"(",
"clusterName",
")",
")",
";",
"}",
"return",
"clusterLexicons",
";",
"}"
] |
Get a parameter in trainParams.prop file consisting of a list of clustering
lexicons separated by comma "," and return a list of files, one for each
lexicon.
@param clusterPath
the clustering parameter in the prop file
@return a list of files one for each lexicon
|
[
"Get",
"a",
"parameter",
"in",
"trainParams",
".",
"prop",
"file",
"consisting",
"of",
"a",
"list",
"of",
"clustering",
"lexicons",
"separated",
"by",
"comma",
"and",
"return",
"a",
"list",
"of",
"files",
"one",
"for",
"each",
"lexicon",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/utils/Flags.java#L763-L771
|
146,203
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/utils/Flags.java
|
Flags.isPOSBaselineFeatures
|
public static boolean isPOSBaselineFeatures(final TrainingParameters params) {
final String posFeatures = getPOSBaselineFeatures(params);
return !posFeatures.equalsIgnoreCase(Flags.DEFAULT_FEATURE_FLAG);
}
|
java
|
public static boolean isPOSBaselineFeatures(final TrainingParameters params) {
final String posFeatures = getPOSBaselineFeatures(params);
return !posFeatures.equalsIgnoreCase(Flags.DEFAULT_FEATURE_FLAG);
}
|
[
"public",
"static",
"boolean",
"isPOSBaselineFeatures",
"(",
"final",
"TrainingParameters",
"params",
")",
"{",
"final",
"String",
"posFeatures",
"=",
"getPOSBaselineFeatures",
"(",
"params",
")",
";",
"return",
"!",
"posFeatures",
".",
"equalsIgnoreCase",
"(",
"Flags",
".",
"DEFAULT_FEATURE_FLAG",
")",
";",
"}"
] |
Check if POS Baseline features are active.
@param params
the parameters
@return whether the pos baseline features are activated or not
|
[
"Check",
"if",
"POS",
"Baseline",
"features",
"are",
"active",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/utils/Flags.java#L898-L901
|
146,204
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/utils/Flags.java
|
Flags.isSuperSenseFeatures
|
public static boolean isSuperSenseFeatures(final TrainingParameters params) {
final String mfsFeatures = getSuperSenseFeatures(params);
return !mfsFeatures.equalsIgnoreCase(Flags.DEFAULT_FEATURE_FLAG);
}
|
java
|
public static boolean isSuperSenseFeatures(final TrainingParameters params) {
final String mfsFeatures = getSuperSenseFeatures(params);
return !mfsFeatures.equalsIgnoreCase(Flags.DEFAULT_FEATURE_FLAG);
}
|
[
"public",
"static",
"boolean",
"isSuperSenseFeatures",
"(",
"final",
"TrainingParameters",
"params",
")",
"{",
"final",
"String",
"mfsFeatures",
"=",
"getSuperSenseFeatures",
"(",
"params",
")",
";",
"return",
"!",
"mfsFeatures",
".",
"equalsIgnoreCase",
"(",
"Flags",
".",
"DEFAULT_FEATURE_FLAG",
")",
";",
"}"
] |
Check if supersense tagger features are active.
@param params
the parameters
@return whether the supersense features are activated or not
|
[
"Check",
"if",
"supersense",
"tagger",
"features",
"are",
"active",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/utils/Flags.java#L910-L913
|
146,205
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/utils/Flags.java
|
Flags.isMFSFeatures
|
public static boolean isMFSFeatures(final TrainingParameters params) {
final String mfsFeatures = getMFSFeatures(params);
return !mfsFeatures.equalsIgnoreCase(Flags.DEFAULT_FEATURE_FLAG);
}
|
java
|
public static boolean isMFSFeatures(final TrainingParameters params) {
final String mfsFeatures = getMFSFeatures(params);
return !mfsFeatures.equalsIgnoreCase(Flags.DEFAULT_FEATURE_FLAG);
}
|
[
"public",
"static",
"boolean",
"isMFSFeatures",
"(",
"final",
"TrainingParameters",
"params",
")",
"{",
"final",
"String",
"mfsFeatures",
"=",
"getMFSFeatures",
"(",
"params",
")",
";",
"return",
"!",
"mfsFeatures",
".",
"equalsIgnoreCase",
"(",
"Flags",
".",
"DEFAULT_FEATURE_FLAG",
")",
";",
"}"
] |
Check if mfs features are active.
@param params
the parameters
@return whether the mfs features are activated or not
|
[
"Check",
"if",
"mfs",
"features",
"are",
"active",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/utils/Flags.java#L922-L925
|
146,206
|
ops4j/org.ops4j.pax.exam1
|
pax-exam-container-rbc/src/main/java/org/ops4j/pax/exam/rbc/internal/RemoteBundleContextImpl.java
|
RemoteBundleContextImpl.getService
|
private <T> T getService( final Class<T> serviceType,
final long timeoutInMillis )
throws NoSuchServiceException
{
LOG.info( "Look up service [" + serviceType.getName() + "], timeout in " + timeoutInMillis + " millis" );
final ServiceReference ref = m_bundleContext.getServiceReference( serviceType.getName() );
if( ref != null )
{
final Object service = m_bundleContext.getService( ref );
if( service == null )
{
throw new NoSuchServiceException( serviceType );
}
return (T) service;
}
else
{
throw new NoSuchServiceException( serviceType );
}
}
|
java
|
private <T> T getService( final Class<T> serviceType,
final long timeoutInMillis )
throws NoSuchServiceException
{
LOG.info( "Look up service [" + serviceType.getName() + "], timeout in " + timeoutInMillis + " millis" );
final ServiceReference ref = m_bundleContext.getServiceReference( serviceType.getName() );
if( ref != null )
{
final Object service = m_bundleContext.getService( ref );
if( service == null )
{
throw new NoSuchServiceException( serviceType );
}
return (T) service;
}
else
{
throw new NoSuchServiceException( serviceType );
}
}
|
[
"private",
"<",
"T",
">",
"T",
"getService",
"(",
"final",
"Class",
"<",
"T",
">",
"serviceType",
",",
"final",
"long",
"timeoutInMillis",
")",
"throws",
"NoSuchServiceException",
"{",
"LOG",
".",
"info",
"(",
"\"Look up service [\"",
"+",
"serviceType",
".",
"getName",
"(",
")",
"+",
"\"], timeout in \"",
"+",
"timeoutInMillis",
"+",
"\" millis\"",
")",
";",
"final",
"ServiceReference",
"ref",
"=",
"m_bundleContext",
".",
"getServiceReference",
"(",
"serviceType",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"ref",
"!=",
"null",
")",
"{",
"final",
"Object",
"service",
"=",
"m_bundleContext",
".",
"getService",
"(",
"ref",
")",
";",
"if",
"(",
"service",
"==",
"null",
")",
"{",
"throw",
"new",
"NoSuchServiceException",
"(",
"serviceType",
")",
";",
"}",
"return",
"(",
"T",
")",
"service",
";",
"}",
"else",
"{",
"throw",
"new",
"NoSuchServiceException",
"(",
"serviceType",
")",
";",
"}",
"}"
] |
Lookup a service in the service registry.
@param serviceType service class
@param timeoutInMillis number of milliseconds to wait for service before failing
TODO timeout is not used!
@return a service published under the required service type
@throws NoSuchServiceException - If service cannot be found in the service registry
|
[
"Lookup",
"a",
"service",
"in",
"the",
"service",
"registry",
"."
] |
7c8742208117ff91bd24bcd3a185d2d019f7000f
|
https://github.com/ops4j/org.ops4j.pax.exam1/blob/7c8742208117ff91bd24bcd3a185d2d019f7000f/pax-exam-container-rbc/src/main/java/org/ops4j/pax/exam/rbc/internal/RemoteBundleContextImpl.java#L213-L232
|
146,207
|
ops4j/org.ops4j.pax.exam1
|
pax-exam-container-rbc/src/main/java/org/ops4j/pax/exam/rbc/internal/RemoteBundleContextImpl.java
|
RemoteBundleContextImpl.startBundle
|
private void startBundle( final Bundle bundle )
throws BundleException
{
// Don't start if bundle already active
int bundleState = bundle.getState();
if( bundleState == Bundle.ACTIVE )
{
return;
}
// Don't start if bundle is a fragment bundle
Dictionary bundleHeaders = bundle.getHeaders();
if( bundleHeaders.get( Constants.FRAGMENT_HOST ) != null )
{
return;
}
// Start bundle
bundle.start();
bundleState = bundle.getState();
if( bundleState != Bundle.ACTIVE )
{
long bundleId = bundle.getBundleId();
String bundleName = bundle.getSymbolicName();
String bundleStateStr = bundleStateToString( bundleState );
throw new BundleException(
"Bundle (" + bundleId + ", " + bundleName + ") not started (still " + bundleStateStr + ")"
);
}
}
|
java
|
private void startBundle( final Bundle bundle )
throws BundleException
{
// Don't start if bundle already active
int bundleState = bundle.getState();
if( bundleState == Bundle.ACTIVE )
{
return;
}
// Don't start if bundle is a fragment bundle
Dictionary bundleHeaders = bundle.getHeaders();
if( bundleHeaders.get( Constants.FRAGMENT_HOST ) != null )
{
return;
}
// Start bundle
bundle.start();
bundleState = bundle.getState();
if( bundleState != Bundle.ACTIVE )
{
long bundleId = bundle.getBundleId();
String bundleName = bundle.getSymbolicName();
String bundleStateStr = bundleStateToString( bundleState );
throw new BundleException(
"Bundle (" + bundleId + ", " + bundleName + ") not started (still " + bundleStateStr + ")"
);
}
}
|
[
"private",
"void",
"startBundle",
"(",
"final",
"Bundle",
"bundle",
")",
"throws",
"BundleException",
"{",
"// Don't start if bundle already active",
"int",
"bundleState",
"=",
"bundle",
".",
"getState",
"(",
")",
";",
"if",
"(",
"bundleState",
"==",
"Bundle",
".",
"ACTIVE",
")",
"{",
"return",
";",
"}",
"// Don't start if bundle is a fragment bundle",
"Dictionary",
"bundleHeaders",
"=",
"bundle",
".",
"getHeaders",
"(",
")",
";",
"if",
"(",
"bundleHeaders",
".",
"get",
"(",
"Constants",
".",
"FRAGMENT_HOST",
")",
"!=",
"null",
")",
"{",
"return",
";",
"}",
"// Start bundle",
"bundle",
".",
"start",
"(",
")",
";",
"bundleState",
"=",
"bundle",
".",
"getState",
"(",
")",
";",
"if",
"(",
"bundleState",
"!=",
"Bundle",
".",
"ACTIVE",
")",
"{",
"long",
"bundleId",
"=",
"bundle",
".",
"getBundleId",
"(",
")",
";",
"String",
"bundleName",
"=",
"bundle",
".",
"getSymbolicName",
"(",
")",
";",
"String",
"bundleStateStr",
"=",
"bundleStateToString",
"(",
"bundleState",
")",
";",
"throw",
"new",
"BundleException",
"(",
"\"Bundle (\"",
"+",
"bundleId",
"+",
"\", \"",
"+",
"bundleName",
"+",
"\") not started (still \"",
"+",
"bundleStateStr",
"+",
"\")\"",
")",
";",
"}",
"}"
] |
Starts a bundle.
@param bundle bundle to be started
@throws BundleException - If bundle cannot be started
|
[
"Starts",
"a",
"bundle",
"."
] |
7c8742208117ff91bd24bcd3a185d2d019f7000f
|
https://github.com/ops4j/org.ops4j.pax.exam1/blob/7c8742208117ff91bd24bcd3a185d2d019f7000f/pax-exam-container-rbc/src/main/java/org/ops4j/pax/exam/rbc/internal/RemoteBundleContextImpl.java#L241-L271
|
146,208
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/utils/Span.java
|
Span.trim
|
public Span trim(final CharSequence text) {
int newStartOffset = getStart();
for (int i = getStart(); i < getEnd()
&& StringUtil.isWhitespace(text.charAt(i)); i++) {
newStartOffset++;
}
int newEndOffset = getEnd();
for (int i = getEnd(); i > getStart()
&& StringUtil.isWhitespace(text.charAt(i - 1)); i--) {
newEndOffset--;
}
if (newStartOffset == getStart() && newEndOffset == getEnd()) {
return this;
} else if (newStartOffset > newEndOffset) {
return new Span(getStart(), getStart(), getType());
} else {
return new Span(newStartOffset, newEndOffset, getType());
}
}
|
java
|
public Span trim(final CharSequence text) {
int newStartOffset = getStart();
for (int i = getStart(); i < getEnd()
&& StringUtil.isWhitespace(text.charAt(i)); i++) {
newStartOffset++;
}
int newEndOffset = getEnd();
for (int i = getEnd(); i > getStart()
&& StringUtil.isWhitespace(text.charAt(i - 1)); i--) {
newEndOffset--;
}
if (newStartOffset == getStart() && newEndOffset == getEnd()) {
return this;
} else if (newStartOffset > newEndOffset) {
return new Span(getStart(), getStart(), getType());
} else {
return new Span(newStartOffset, newEndOffset, getType());
}
}
|
[
"public",
"Span",
"trim",
"(",
"final",
"CharSequence",
"text",
")",
"{",
"int",
"newStartOffset",
"=",
"getStart",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"getStart",
"(",
")",
";",
"i",
"<",
"getEnd",
"(",
")",
"&&",
"StringUtil",
".",
"isWhitespace",
"(",
"text",
".",
"charAt",
"(",
"i",
")",
")",
";",
"i",
"++",
")",
"{",
"newStartOffset",
"++",
";",
"}",
"int",
"newEndOffset",
"=",
"getEnd",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"getEnd",
"(",
")",
";",
"i",
">",
"getStart",
"(",
")",
"&&",
"StringUtil",
".",
"isWhitespace",
"(",
"text",
".",
"charAt",
"(",
"i",
"-",
"1",
")",
")",
";",
"i",
"--",
")",
"{",
"newEndOffset",
"--",
";",
"}",
"if",
"(",
"newStartOffset",
"==",
"getStart",
"(",
")",
"&&",
"newEndOffset",
"==",
"getEnd",
"(",
")",
")",
"{",
"return",
"this",
";",
"}",
"else",
"if",
"(",
"newStartOffset",
">",
"newEndOffset",
")",
"{",
"return",
"new",
"Span",
"(",
"getStart",
"(",
")",
",",
"getStart",
"(",
")",
",",
"getType",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"new",
"Span",
"(",
"newStartOffset",
",",
"newEndOffset",
",",
"getType",
"(",
")",
")",
";",
"}",
"}"
] |
Return a copy of this span with leading and trailing white spaces removed.
@param text
the text
@return the trimmed span or the same object if already trimmed
|
[
"Return",
"a",
"copy",
"of",
"this",
"span",
"with",
"leading",
"and",
"trailing",
"white",
"spaces",
"removed",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/utils/Span.java#L269-L291
|
146,209
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/utils/Span.java
|
Span.getTypesFromSpans
|
public static String[] getTypesFromSpans(final Span[] spans,
final String[] tokens) {
final List<String> tagsList = new ArrayList<String>();
for (final Span span : spans) {
tagsList.add(span.getType());
}
return tagsList.toArray(new String[tagsList.size()]);
}
|
java
|
public static String[] getTypesFromSpans(final Span[] spans,
final String[] tokens) {
final List<String> tagsList = new ArrayList<String>();
for (final Span span : spans) {
tagsList.add(span.getType());
}
return tagsList.toArray(new String[tagsList.size()]);
}
|
[
"public",
"static",
"String",
"[",
"]",
"getTypesFromSpans",
"(",
"final",
"Span",
"[",
"]",
"spans",
",",
"final",
"String",
"[",
"]",
"tokens",
")",
"{",
"final",
"List",
"<",
"String",
">",
"tagsList",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"final",
"Span",
"span",
":",
"spans",
")",
"{",
"tagsList",
".",
"add",
"(",
"span",
".",
"getType",
"(",
")",
")",
";",
"}",
"return",
"tagsList",
".",
"toArray",
"(",
"new",
"String",
"[",
"tagsList",
".",
"size",
"(",
")",
"]",
")",
";",
"}"
] |
Get an array of Spans and their associated tokens and obtains an array of
Strings containing the type for each Span.
@param spans
the array of Spans
@param tokens
the array of tokens
@return an array of string with the types
|
[
"Get",
"an",
"array",
"of",
"Spans",
"and",
"their",
"associated",
"tokens",
"and",
"obtains",
"an",
"array",
"of",
"Strings",
"containing",
"the",
"type",
"for",
"each",
"Span",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/utils/Span.java#L441-L448
|
146,210
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/utils/Span.java
|
Span.postProcessDuplicatedSpans
|
public static final void postProcessDuplicatedSpans(final List<Span> preList,
final Span[] postList) {
final List<Span> duplicatedSpans = new ArrayList<Span>();
for (final Span span1 : preList) {
for (final Span span2 : postList) {
if (span1.contains(span2)) {
duplicatedSpans.add(span1);
} else if (span2.contains(span1)) {
duplicatedSpans.add(span1);
}
}
}
preList.removeAll(duplicatedSpans);
}
|
java
|
public static final void postProcessDuplicatedSpans(final List<Span> preList,
final Span[] postList) {
final List<Span> duplicatedSpans = new ArrayList<Span>();
for (final Span span1 : preList) {
for (final Span span2 : postList) {
if (span1.contains(span2)) {
duplicatedSpans.add(span1);
} else if (span2.contains(span1)) {
duplicatedSpans.add(span1);
}
}
}
preList.removeAll(duplicatedSpans);
}
|
[
"public",
"static",
"final",
"void",
"postProcessDuplicatedSpans",
"(",
"final",
"List",
"<",
"Span",
">",
"preList",
",",
"final",
"Span",
"[",
"]",
"postList",
")",
"{",
"final",
"List",
"<",
"Span",
">",
"duplicatedSpans",
"=",
"new",
"ArrayList",
"<",
"Span",
">",
"(",
")",
";",
"for",
"(",
"final",
"Span",
"span1",
":",
"preList",
")",
"{",
"for",
"(",
"final",
"Span",
"span2",
":",
"postList",
")",
"{",
"if",
"(",
"span1",
".",
"contains",
"(",
"span2",
")",
")",
"{",
"duplicatedSpans",
".",
"add",
"(",
"span1",
")",
";",
"}",
"else",
"if",
"(",
"span2",
".",
"contains",
"(",
"span1",
")",
")",
"{",
"duplicatedSpans",
".",
"add",
"(",
"span1",
")",
";",
"}",
"}",
"}",
"preList",
".",
"removeAll",
"(",
"duplicatedSpans",
")",
";",
"}"
] |
Removes spans from the preList if the span is contained in the postList.
@param preList
the list of spans to be post-processed
@param postList
the list of spans to do the post-processing
|
[
"Removes",
"spans",
"from",
"the",
"preList",
"if",
"the",
"span",
"is",
"contained",
"in",
"the",
"postList",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/utils/Span.java#L458-L471
|
146,211
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/utils/Span.java
|
Span.concatenateSpans
|
public static final void concatenateSpans(final List<Span> allSpans,
final Span[] neSpans) {
for (final Span span : neSpans) {
allSpans.add(span);
}
}
|
java
|
public static final void concatenateSpans(final List<Span> allSpans,
final Span[] neSpans) {
for (final Span span : neSpans) {
allSpans.add(span);
}
}
|
[
"public",
"static",
"final",
"void",
"concatenateSpans",
"(",
"final",
"List",
"<",
"Span",
">",
"allSpans",
",",
"final",
"Span",
"[",
"]",
"neSpans",
")",
"{",
"for",
"(",
"final",
"Span",
"span",
":",
"neSpans",
")",
"{",
"allSpans",
".",
"add",
"(",
"span",
")",
";",
"}",
"}"
] |
Concatenates two span lists adding the spans of the second parameter to the
list in first parameter.
@param allSpans
the spans to which the other spans are added
@param neSpans
the spans to be added to allSpans
|
[
"Concatenates",
"two",
"span",
"lists",
"adding",
"the",
"spans",
"of",
"the",
"second",
"parameter",
"to",
"the",
"list",
"in",
"first",
"parameter",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/utils/Span.java#L482-L487
|
146,212
|
alb-i986/selenium-tinafw
|
src/main/java/me/alb_i986/selenium/tinafw/tasks/CompositeWebTask.java
|
CompositeWebTask.run
|
@Override
public WebPage run(WebPage initialPage) {
if(getUser() == null)
throw new IllegalStateException("the user set is null");
WebPage currentPage = initialPage;
for(WebTask task : this) {
logger.info("BEGIN subtask " + task.getClass().getSimpleName());
// before running the subtask, set the user
task.setUser(getUser());
currentPage = task.run(currentPage);
logger.info("END subtask " + task.getClass().getSimpleName());
}
return currentPage;
}
|
java
|
@Override
public WebPage run(WebPage initialPage) {
if(getUser() == null)
throw new IllegalStateException("the user set is null");
WebPage currentPage = initialPage;
for(WebTask task : this) {
logger.info("BEGIN subtask " + task.getClass().getSimpleName());
// before running the subtask, set the user
task.setUser(getUser());
currentPage = task.run(currentPage);
logger.info("END subtask " + task.getClass().getSimpleName());
}
return currentPage;
}
|
[
"@",
"Override",
"public",
"WebPage",
"run",
"(",
"WebPage",
"initialPage",
")",
"{",
"if",
"(",
"getUser",
"(",
")",
"==",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"the user set is null\"",
")",
";",
"WebPage",
"currentPage",
"=",
"initialPage",
";",
"for",
"(",
"WebTask",
"task",
":",
"this",
")",
"{",
"logger",
".",
"info",
"(",
"\"BEGIN subtask \"",
"+",
"task",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
")",
";",
"// before running the subtask, set the user",
"task",
".",
"setUser",
"(",
"getUser",
"(",
")",
")",
";",
"currentPage",
"=",
"task",
".",
"run",
"(",
"currentPage",
")",
";",
"logger",
".",
"info",
"(",
"\"END subtask \"",
"+",
"task",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
")",
";",
"}",
"return",
"currentPage",
";",
"}"
] |
Runs each subtask in order, and finally return the
page that the last task was visiting.
Each subtask will run with the same user as the composite.
@throws IllegalStateException if the user set in this composite is null
|
[
"Runs",
"each",
"subtask",
"in",
"order",
"and",
"finally",
"return",
"the",
"page",
"that",
"the",
"last",
"task",
"was",
"visiting",
".",
"Each",
"subtask",
"will",
"run",
"with",
"the",
"same",
"user",
"as",
"the",
"composite",
"."
] |
91c66720cda9f69751f96c58c0a0624b2222186e
|
https://github.com/alb-i986/selenium-tinafw/blob/91c66720cda9f69751f96c58c0a0624b2222186e/src/main/java/me/alb_i986/selenium/tinafw/tasks/CompositeWebTask.java#L55-L68
|
146,213
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/document/DocumentClassifierME.java
|
DocumentClassifierME.scoreMap
|
@Override
public Map<String, Double> scoreMap(String[] text) {
Map<String, Double> probDist = new HashMap<>();
double[] categorize = classifyProb(text);
int catSize = getNumberOfLabels();
for (int i = 0; i < catSize; i++) {
String category = getLabel(i);
probDist.put(category, categorize[getIndex(category)]);
}
return probDist;
}
|
java
|
@Override
public Map<String, Double> scoreMap(String[] text) {
Map<String, Double> probDist = new HashMap<>();
double[] categorize = classifyProb(text);
int catSize = getNumberOfLabels();
for (int i = 0; i < catSize; i++) {
String category = getLabel(i);
probDist.put(category, categorize[getIndex(category)]);
}
return probDist;
}
|
[
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"Double",
">",
"scoreMap",
"(",
"String",
"[",
"]",
"text",
")",
"{",
"Map",
"<",
"String",
",",
"Double",
">",
"probDist",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"double",
"[",
"]",
"categorize",
"=",
"classifyProb",
"(",
"text",
")",
";",
"int",
"catSize",
"=",
"getNumberOfLabels",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"catSize",
";",
"i",
"++",
")",
"{",
"String",
"category",
"=",
"getLabel",
"(",
"i",
")",
";",
"probDist",
".",
"put",
"(",
"category",
",",
"categorize",
"[",
"getIndex",
"(",
"category",
")",
"]",
")",
";",
"}",
"return",
"probDist",
";",
"}"
] |
Returns a map in which the key is the label name and the value is the score.
@param text the input text to classify
@return the score map
|
[
"Returns",
"a",
"map",
"in",
"which",
"the",
"key",
"is",
"the",
"label",
"name",
"and",
"the",
"value",
"is",
"the",
"score",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/document/DocumentClassifierME.java#L84-L95
|
146,214
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/document/DocumentClassifierME.java
|
DocumentClassifierME.sortedScoreMap
|
@Override
public SortedMap<Double, Set<String>> sortedScoreMap(String[] text) {
SortedMap<Double, Set<String>> descendingMap = new TreeMap<>();
double[] categorize = classifyProb(text);
int catSize = getNumberOfLabels();
for (int i = 0; i < catSize; i++) {
String category = getLabel(i);
double score = categorize[getIndex(category)];
if (descendingMap.containsKey(score)) {
descendingMap.get(score).add(category);
} else {
Set<String> newset = new HashSet<>();
newset.add(category);
descendingMap.put(score, newset);
}
}
return descendingMap;
}
|
java
|
@Override
public SortedMap<Double, Set<String>> sortedScoreMap(String[] text) {
SortedMap<Double, Set<String>> descendingMap = new TreeMap<>();
double[] categorize = classifyProb(text);
int catSize = getNumberOfLabels();
for (int i = 0; i < catSize; i++) {
String category = getLabel(i);
double score = categorize[getIndex(category)];
if (descendingMap.containsKey(score)) {
descendingMap.get(score).add(category);
} else {
Set<String> newset = new HashSet<>();
newset.add(category);
descendingMap.put(score, newset);
}
}
return descendingMap;
}
|
[
"@",
"Override",
"public",
"SortedMap",
"<",
"Double",
",",
"Set",
"<",
"String",
">",
">",
"sortedScoreMap",
"(",
"String",
"[",
"]",
"text",
")",
"{",
"SortedMap",
"<",
"Double",
",",
"Set",
"<",
"String",
">",
">",
"descendingMap",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"double",
"[",
"]",
"categorize",
"=",
"classifyProb",
"(",
"text",
")",
";",
"int",
"catSize",
"=",
"getNumberOfLabels",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"catSize",
";",
"i",
"++",
")",
"{",
"String",
"category",
"=",
"getLabel",
"(",
"i",
")",
";",
"double",
"score",
"=",
"categorize",
"[",
"getIndex",
"(",
"category",
")",
"]",
";",
"if",
"(",
"descendingMap",
".",
"containsKey",
"(",
"score",
")",
")",
"{",
"descendingMap",
".",
"get",
"(",
"score",
")",
".",
"add",
"(",
"category",
")",
";",
"}",
"else",
"{",
"Set",
"<",
"String",
">",
"newset",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"newset",
".",
"add",
"(",
"category",
")",
";",
"descendingMap",
".",
"put",
"(",
"score",
",",
"newset",
")",
";",
"}",
"}",
"return",
"descendingMap",
";",
"}"
] |
Returns a map with the score as a key in ascending order.
The value is a Set of categories with the score.
Many labels can have the same score, hence the Set as value.
@param text the input text to classify
@return the sorted score map
|
[
"Returns",
"a",
"map",
"with",
"the",
"score",
"as",
"a",
"key",
"in",
"ascending",
"order",
".",
"The",
"value",
"is",
"a",
"Set",
"of",
"categories",
"with",
"the",
"score",
".",
"Many",
"labels",
"can",
"have",
"the",
"same",
"score",
"hence",
"the",
"Set",
"as",
"value",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/document/DocumentClassifierME.java#L105-L122
|
146,215
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/parse/ShiftReduceParser.java
|
ShiftReduceParser.advanceTags
|
protected Parse[] advanceTags(final Parse p) {
final Parse[] children = p.getChildren();
final String[] words = new String[children.length];
final double[] probs = new double[words.length];
for (int i = 0, il = children.length; i < il; i++) {
words[i] = children[i].getCoveredText();
}
final Sequence[] ts = this.tagger.topKSequences(words);
if (ts.length == 0) {
System.err.println("no tag sequence");
}
final Parse[] newParses = new Parse[ts.length];
for (int i = 0; i < ts.length; i++) {
final String[] tags = ts[i].getOutcomes()
.toArray(new String[words.length]);
ts[i].getProbs(probs);
newParses[i] = (Parse) p.clone(); // copies top level
if (this.createDerivationString) {
newParses[i].getDerivation().append(i).append(".");
}
for (int j = 0; j < words.length; j++) {
final Parse word = children[j];
// System.err.println("inserting tag "+tags[j]);
final double prob = probs[j];
newParses[i].insert(new Parse(word.getText(), word.getSpan(),
tags[j].replaceAll("-" + BioCodec.START, ""), prob, j));
newParses[i].addProb(Math.log(prob));
// newParses[i].show();
}
}
return newParses;
}
|
java
|
protected Parse[] advanceTags(final Parse p) {
final Parse[] children = p.getChildren();
final String[] words = new String[children.length];
final double[] probs = new double[words.length];
for (int i = 0, il = children.length; i < il; i++) {
words[i] = children[i].getCoveredText();
}
final Sequence[] ts = this.tagger.topKSequences(words);
if (ts.length == 0) {
System.err.println("no tag sequence");
}
final Parse[] newParses = new Parse[ts.length];
for (int i = 0; i < ts.length; i++) {
final String[] tags = ts[i].getOutcomes()
.toArray(new String[words.length]);
ts[i].getProbs(probs);
newParses[i] = (Parse) p.clone(); // copies top level
if (this.createDerivationString) {
newParses[i].getDerivation().append(i).append(".");
}
for (int j = 0; j < words.length; j++) {
final Parse word = children[j];
// System.err.println("inserting tag "+tags[j]);
final double prob = probs[j];
newParses[i].insert(new Parse(word.getText(), word.getSpan(),
tags[j].replaceAll("-" + BioCodec.START, ""), prob, j));
newParses[i].addProb(Math.log(prob));
// newParses[i].show();
}
}
return newParses;
}
|
[
"protected",
"Parse",
"[",
"]",
"advanceTags",
"(",
"final",
"Parse",
"p",
")",
"{",
"final",
"Parse",
"[",
"]",
"children",
"=",
"p",
".",
"getChildren",
"(",
")",
";",
"final",
"String",
"[",
"]",
"words",
"=",
"new",
"String",
"[",
"children",
".",
"length",
"]",
";",
"final",
"double",
"[",
"]",
"probs",
"=",
"new",
"double",
"[",
"words",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"il",
"=",
"children",
".",
"length",
";",
"i",
"<",
"il",
";",
"i",
"++",
")",
"{",
"words",
"[",
"i",
"]",
"=",
"children",
"[",
"i",
"]",
".",
"getCoveredText",
"(",
")",
";",
"}",
"final",
"Sequence",
"[",
"]",
"ts",
"=",
"this",
".",
"tagger",
".",
"topKSequences",
"(",
"words",
")",
";",
"if",
"(",
"ts",
".",
"length",
"==",
"0",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"no tag sequence\"",
")",
";",
"}",
"final",
"Parse",
"[",
"]",
"newParses",
"=",
"new",
"Parse",
"[",
"ts",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ts",
".",
"length",
";",
"i",
"++",
")",
"{",
"final",
"String",
"[",
"]",
"tags",
"=",
"ts",
"[",
"i",
"]",
".",
"getOutcomes",
"(",
")",
".",
"toArray",
"(",
"new",
"String",
"[",
"words",
".",
"length",
"]",
")",
";",
"ts",
"[",
"i",
"]",
".",
"getProbs",
"(",
"probs",
")",
";",
"newParses",
"[",
"i",
"]",
"=",
"(",
"Parse",
")",
"p",
".",
"clone",
"(",
")",
";",
"// copies top level",
"if",
"(",
"this",
".",
"createDerivationString",
")",
"{",
"newParses",
"[",
"i",
"]",
".",
"getDerivation",
"(",
")",
".",
"append",
"(",
"i",
")",
".",
"append",
"(",
"\".\"",
")",
";",
"}",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"words",
".",
"length",
";",
"j",
"++",
")",
"{",
"final",
"Parse",
"word",
"=",
"children",
"[",
"j",
"]",
";",
"// System.err.println(\"inserting tag \"+tags[j]);",
"final",
"double",
"prob",
"=",
"probs",
"[",
"j",
"]",
";",
"newParses",
"[",
"i",
"]",
".",
"insert",
"(",
"new",
"Parse",
"(",
"word",
".",
"getText",
"(",
")",
",",
"word",
".",
"getSpan",
"(",
")",
",",
"tags",
"[",
"j",
"]",
".",
"replaceAll",
"(",
"\"-\"",
"+",
"BioCodec",
".",
"START",
",",
"\"\"",
")",
",",
"prob",
",",
"j",
")",
")",
";",
"newParses",
"[",
"i",
"]",
".",
"addProb",
"(",
"Math",
".",
"log",
"(",
"prob",
")",
")",
";",
"// newParses[i].show();",
"}",
"}",
"return",
"newParses",
";",
"}"
] |
Advances the parse by assigning it POS tags and returns multiple tag
sequences.
@param p
The parse to be tagged.
@return Parses with different POS-tag sequence assignments.
|
[
"Advances",
"the",
"parse",
"by",
"assigning",
"it",
"POS",
"tags",
"and",
"returns",
"multiple",
"tag",
"sequences",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/parse/ShiftReduceParser.java#L581-L612
|
146,216
|
ardoq/ardoq-java-client
|
src/main/java/com/ardoq/adapter/JsonUtils.java
|
JsonUtils.removeReservedNullVaules
|
public static void removeReservedNullVaules(JsonObject jsonObject) {
Set<Map.Entry<String, JsonElement>> entries = jsonObject.entrySet();
for (Map.Entry<String, JsonElement> entry : entries) {
if (entry.getValue().isJsonNull()) {
jsonObject.remove(entry.getKey());
}
}
}
|
java
|
public static void removeReservedNullVaules(JsonObject jsonObject) {
Set<Map.Entry<String, JsonElement>> entries = jsonObject.entrySet();
for (Map.Entry<String, JsonElement> entry : entries) {
if (entry.getValue().isJsonNull()) {
jsonObject.remove(entry.getKey());
}
}
}
|
[
"public",
"static",
"void",
"removeReservedNullVaules",
"(",
"JsonObject",
"jsonObject",
")",
"{",
"Set",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"JsonElement",
">",
">",
"entries",
"=",
"jsonObject",
".",
"entrySet",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"JsonElement",
">",
"entry",
":",
"entries",
")",
"{",
"if",
"(",
"entry",
".",
"getValue",
"(",
")",
".",
"isJsonNull",
"(",
")",
")",
"{",
"jsonObject",
".",
"remove",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"}",
"}",
"}"
] |
Removes keys from json object if they have null values. Won't touch fields as users may want to explicitly set them to null
@param jsonObject
|
[
"Removes",
"keys",
"from",
"json",
"object",
"if",
"they",
"have",
"null",
"values",
".",
"Won",
"t",
"touch",
"fields",
"as",
"users",
"may",
"want",
"to",
"explicitly",
"set",
"them",
"to",
"null"
] |
03731c3df864d850ef41b252364a104376dde983
|
https://github.com/ardoq/ardoq-java-client/blob/03731c3df864d850ef41b252364a104376dde983/src/main/java/com/ardoq/adapter/JsonUtils.java#L16-L23
|
146,217
|
ardoq/ardoq-java-client
|
src/main/java/com/ardoq/service/SimpleModelService.java
|
SimpleModelService.findOrCreateTemplate
|
public Model findOrCreateTemplate(String name, InputStream modelJson) throws IOException {
try {
Model m = getTemplateByName(name);
return m;
} catch (IllegalArgumentException ignore) {
}
String modelStr = IOUtils.toString(modelJson, "UTF-8");
return modelService.createModel(new TypedString(modelStr));
}
|
java
|
public Model findOrCreateTemplate(String name, InputStream modelJson) throws IOException {
try {
Model m = getTemplateByName(name);
return m;
} catch (IllegalArgumentException ignore) {
}
String modelStr = IOUtils.toString(modelJson, "UTF-8");
return modelService.createModel(new TypedString(modelStr));
}
|
[
"public",
"Model",
"findOrCreateTemplate",
"(",
"String",
"name",
",",
"InputStream",
"modelJson",
")",
"throws",
"IOException",
"{",
"try",
"{",
"Model",
"m",
"=",
"getTemplateByName",
"(",
"name",
")",
";",
"return",
"m",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"ignore",
")",
"{",
"}",
"String",
"modelStr",
"=",
"IOUtils",
".",
"toString",
"(",
"modelJson",
",",
"\"UTF-8\"",
")",
";",
"return",
"modelService",
".",
"createModel",
"(",
"new",
"TypedString",
"(",
"modelStr",
")",
")",
";",
"}"
] |
Tries to lookup the model by name, and returns it if it's found.
If not, it is created from the provided JSON input stream.
@param name
@param modelJson
@return model
@throws IOException
|
[
"Tries",
"to",
"lookup",
"the",
"model",
"by",
"name",
"and",
"returns",
"it",
"if",
"it",
"s",
"found",
".",
"If",
"not",
"it",
"is",
"created",
"from",
"the",
"provided",
"JSON",
"input",
"stream",
"."
] |
03731c3df864d850ef41b252364a104376dde983
|
https://github.com/ardoq/ardoq-java-client/blob/03731c3df864d850ef41b252364a104376dde983/src/main/java/com/ardoq/service/SimpleModelService.java#L91-L100
|
146,218
|
astrapi69/jaulp-wicket
|
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/up/SignupPanel.java
|
SignupPanel.newSigninPanel
|
protected SigninPanel<T> newSigninPanel(final String id, final IModel<T> model)
{
return new SigninPanel<>(id, model);
}
|
java
|
protected SigninPanel<T> newSigninPanel(final String id, final IModel<T> model)
{
return new SigninPanel<>(id, model);
}
|
[
"protected",
"SigninPanel",
"<",
"T",
">",
"newSigninPanel",
"(",
"final",
"String",
"id",
",",
"final",
"IModel",
"<",
"T",
">",
"model",
")",
"{",
"return",
"new",
"SigninPanel",
"<>",
"(",
"id",
",",
"model",
")",
";",
"}"
] |
Factory method for creating the SigninPanel that contains the TextField for the email and
password. This method is invoked in the constructor from the derived classes and can be
overridden so users can provide their own version of a Component that contains the TextField
for the email and password.
@param id
the id
@param model
the model
@return the Component
|
[
"Factory",
"method",
"for",
"creating",
"the",
"SigninPanel",
"that",
"contains",
"the",
"TextField",
"for",
"the",
"email",
"and",
"password",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"derived",
"classes",
"and",
"can",
"be",
"overridden",
"so",
"users",
"can",
"provide",
"their",
"own",
"version",
"of",
"a",
"Component",
"that",
"contains",
"the",
"TextField",
"for",
"the",
"email",
"and",
"password",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/up/SignupPanel.java#L124-L127
|
146,219
|
astrapi69/jaulp-wicket
|
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/up/SignupPanel.java
|
SignupPanel.newUsernameTextField
|
protected Component newUsernameTextField(final String id, final IModel<T> model)
{
final IModel<String> labelModel = ResourceModelFactory
.newResourceModel("global.username.label", this);
final IModel<String> placeholderModel = ResourceModelFactory
.newResourceModel("global.enter.your.username.label", this);
final LabeledTextFieldPanel<String, T> nameTextField = new LabeledTextFieldPanel<String, T>(
id, model, labelModel)
{
private static final long serialVersionUID = 1L;
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
protected TextField newTextField(final String id, final IModel<T> modelSuper)
{
final TextField<String> textField = new TextField<String>(id,
new PropertyModel<>(model, "username"));
textField.setOutputMarkupId(true);
textField.setRequired(true);
if (placeholderModel != null)
{
textField.add(new AttributeAppender("placeholder", placeholderModel));
}
return textField;
}
};
return nameTextField;
}
|
java
|
protected Component newUsernameTextField(final String id, final IModel<T> model)
{
final IModel<String> labelModel = ResourceModelFactory
.newResourceModel("global.username.label", this);
final IModel<String> placeholderModel = ResourceModelFactory
.newResourceModel("global.enter.your.username.label", this);
final LabeledTextFieldPanel<String, T> nameTextField = new LabeledTextFieldPanel<String, T>(
id, model, labelModel)
{
private static final long serialVersionUID = 1L;
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
protected TextField newTextField(final String id, final IModel<T> modelSuper)
{
final TextField<String> textField = new TextField<String>(id,
new PropertyModel<>(model, "username"));
textField.setOutputMarkupId(true);
textField.setRequired(true);
if (placeholderModel != null)
{
textField.add(new AttributeAppender("placeholder", placeholderModel));
}
return textField;
}
};
return nameTextField;
}
|
[
"protected",
"Component",
"newUsernameTextField",
"(",
"final",
"String",
"id",
",",
"final",
"IModel",
"<",
"T",
">",
"model",
")",
"{",
"final",
"IModel",
"<",
"String",
">",
"labelModel",
"=",
"ResourceModelFactory",
".",
"newResourceModel",
"(",
"\"global.username.label\"",
",",
"this",
")",
";",
"final",
"IModel",
"<",
"String",
">",
"placeholderModel",
"=",
"ResourceModelFactory",
".",
"newResourceModel",
"(",
"\"global.enter.your.username.label\"",
",",
"this",
")",
";",
"final",
"LabeledTextFieldPanel",
"<",
"String",
",",
"T",
">",
"nameTextField",
"=",
"new",
"LabeledTextFieldPanel",
"<",
"String",
",",
"T",
">",
"(",
"id",
",",
"model",
",",
"labelModel",
")",
"{",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"1L",
";",
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"protected",
"TextField",
"newTextField",
"(",
"final",
"String",
"id",
",",
"final",
"IModel",
"<",
"T",
">",
"modelSuper",
")",
"{",
"final",
"TextField",
"<",
"String",
">",
"textField",
"=",
"new",
"TextField",
"<",
"String",
">",
"(",
"id",
",",
"new",
"PropertyModel",
"<>",
"(",
"model",
",",
"\"username\"",
")",
")",
";",
"textField",
".",
"setOutputMarkupId",
"(",
"true",
")",
";",
"textField",
".",
"setRequired",
"(",
"true",
")",
";",
"if",
"(",
"placeholderModel",
"!=",
"null",
")",
"{",
"textField",
".",
"add",
"(",
"new",
"AttributeAppender",
"(",
"\"placeholder\"",
",",
"placeholderModel",
")",
")",
";",
"}",
"return",
"textField",
";",
"}",
"}",
";",
"return",
"nameTextField",
";",
"}"
] |
Factory method for creating the TextField for the username. This method is invoked in the
constructor from the derived classes and can be overridden so users can provide their own
version of a TextField for the username.
@param id
the id
@param model
the model
@return the text field
|
[
"Factory",
"method",
"for",
"creating",
"the",
"TextField",
"for",
"the",
"username",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"derived",
"classes",
"and",
"can",
"be",
"overridden",
"so",
"users",
"can",
"provide",
"their",
"own",
"version",
"of",
"a",
"TextField",
"for",
"the",
"username",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/up/SignupPanel.java#L140-L168
|
146,220
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/app/ActivityManagerUtils.java
|
ActivityManagerUtils.getPackageNameFromPid
|
public static String getPackageNameFromPid(Context context, int pid) {
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<RunningAppProcessInfo> processes = am.getRunningAppProcesses();
for (RunningAppProcessInfo info : processes) {
if (info.pid == pid) {
String[] packages = info.pkgList;
if (packages.length > 0) {
return packages[0];
}
break;
}
}
return null;
}
|
java
|
public static String getPackageNameFromPid(Context context, int pid) {
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<RunningAppProcessInfo> processes = am.getRunningAppProcesses();
for (RunningAppProcessInfo info : processes) {
if (info.pid == pid) {
String[] packages = info.pkgList;
if (packages.length > 0) {
return packages[0];
}
break;
}
}
return null;
}
|
[
"public",
"static",
"String",
"getPackageNameFromPid",
"(",
"Context",
"context",
",",
"int",
"pid",
")",
"{",
"ActivityManager",
"am",
"=",
"(",
"ActivityManager",
")",
"context",
".",
"getSystemService",
"(",
"Context",
".",
"ACTIVITY_SERVICE",
")",
";",
"List",
"<",
"RunningAppProcessInfo",
">",
"processes",
"=",
"am",
".",
"getRunningAppProcesses",
"(",
")",
";",
"for",
"(",
"RunningAppProcessInfo",
"info",
":",
"processes",
")",
"{",
"if",
"(",
"info",
".",
"pid",
"==",
"pid",
")",
"{",
"String",
"[",
"]",
"packages",
"=",
"info",
".",
"pkgList",
";",
"if",
"(",
"packages",
".",
"length",
">",
"0",
")",
"{",
"return",
"packages",
"[",
"0",
"]",
";",
"}",
"break",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Get package name of the process id.
@param context the context.
@param pid the process id.
@return the package name for the process id. {@code null} if no process found.
|
[
"Get",
"package",
"name",
"of",
"the",
"process",
"id",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/app/ActivityManagerUtils.java#L105-L118
|
146,221
|
geomajas/geomajas-project-client-gwt2
|
impl/src/main/java/org/geomajas/gwt2/client/map/feature/JsonFeatureFactory.java
|
JsonFeatureFactory.createCollection
|
public FeatureCollection createCollection(JSONObject jsonObject, FeaturesSupported layer) {
FeatureCollection dto = new FeatureCollection(layer);
String type = JsonService.getStringValue(jsonObject, "type");
if ("FeatureCollection".equals(type)) {
JSONArray features = JsonService.getChildArray(jsonObject, "features");
for (int i = 0; i < features.size(); i++) {
dto.getFeatures().add(createFeature((JSONObject) features.get(i), layer));
}
} else if ("Feature".equals(type)) {
dto.getFeatures().add(createFeature(jsonObject, layer));
}
return dto;
}
|
java
|
public FeatureCollection createCollection(JSONObject jsonObject, FeaturesSupported layer) {
FeatureCollection dto = new FeatureCollection(layer);
String type = JsonService.getStringValue(jsonObject, "type");
if ("FeatureCollection".equals(type)) {
JSONArray features = JsonService.getChildArray(jsonObject, "features");
for (int i = 0; i < features.size(); i++) {
dto.getFeatures().add(createFeature((JSONObject) features.get(i), layer));
}
} else if ("Feature".equals(type)) {
dto.getFeatures().add(createFeature(jsonObject, layer));
}
return dto;
}
|
[
"public",
"FeatureCollection",
"createCollection",
"(",
"JSONObject",
"jsonObject",
",",
"FeaturesSupported",
"layer",
")",
"{",
"FeatureCollection",
"dto",
"=",
"new",
"FeatureCollection",
"(",
"layer",
")",
";",
"String",
"type",
"=",
"JsonService",
".",
"getStringValue",
"(",
"jsonObject",
",",
"\"type\"",
")",
";",
"if",
"(",
"\"FeatureCollection\"",
".",
"equals",
"(",
"type",
")",
")",
"{",
"JSONArray",
"features",
"=",
"JsonService",
".",
"getChildArray",
"(",
"jsonObject",
",",
"\"features\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"features",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"dto",
".",
"getFeatures",
"(",
")",
".",
"add",
"(",
"createFeature",
"(",
"(",
"JSONObject",
")",
"features",
".",
"get",
"(",
"i",
")",
",",
"layer",
")",
")",
";",
"}",
"}",
"else",
"if",
"(",
"\"Feature\"",
".",
"equals",
"(",
"type",
")",
")",
"{",
"dto",
".",
"getFeatures",
"(",
")",
".",
"add",
"(",
"createFeature",
"(",
"jsonObject",
",",
"layer",
")",
")",
";",
"}",
"return",
"dto",
";",
"}"
] |
Create a feature collection for this layer.
@param jsonObject
@param layer the layer (optional)
@return the feature
|
[
"Create",
"a",
"feature",
"collection",
"for",
"this",
"layer",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/impl/src/main/java/org/geomajas/gwt2/client/map/feature/JsonFeatureFactory.java#L44-L56
|
146,222
|
OpenBEL/openbel-framework
|
org.openbel.framework.core/src/main/java/org/openbel/framework/core/equivalence/DefaultParameterEquivalencer.java
|
DefaultParameterEquivalencer.doFindEquivalence
|
private String doFindEquivalence(final String sourceNamespace,
final String destinationNamespace, final String sourceValue) {
JDBMEquivalenceLookup sourceLookup =
openEquivalences.get(sourceNamespace);
if (sourceLookup == null) {
return null;
}
final SkinnyUUID sourceUUID = sourceLookup.lookup(sourceValue);
if (sourceUUID == null) {
return null;
}
return doFindEquivalence(destinationNamespace, sourceUUID);
}
|
java
|
private String doFindEquivalence(final String sourceNamespace,
final String destinationNamespace, final String sourceValue) {
JDBMEquivalenceLookup sourceLookup =
openEquivalences.get(sourceNamespace);
if (sourceLookup == null) {
return null;
}
final SkinnyUUID sourceUUID = sourceLookup.lookup(sourceValue);
if (sourceUUID == null) {
return null;
}
return doFindEquivalence(destinationNamespace, sourceUUID);
}
|
[
"private",
"String",
"doFindEquivalence",
"(",
"final",
"String",
"sourceNamespace",
",",
"final",
"String",
"destinationNamespace",
",",
"final",
"String",
"sourceValue",
")",
"{",
"JDBMEquivalenceLookup",
"sourceLookup",
"=",
"openEquivalences",
".",
"get",
"(",
"sourceNamespace",
")",
";",
"if",
"(",
"sourceLookup",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"SkinnyUUID",
"sourceUUID",
"=",
"sourceLookup",
".",
"lookup",
"(",
"sourceValue",
")",
";",
"if",
"(",
"sourceUUID",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"doFindEquivalence",
"(",
"destinationNamespace",
",",
"sourceUUID",
")",
";",
"}"
] |
Obtain the destinationNamespace equivalent value of sourceValue in sourceNamespace
@param sourceNamespace resourceLocation of source namespace
@param destinationNamespace resourceLocation of destination namespace
@param sourceValue
@return equivalent value, may be null.
|
[
"Obtain",
"the",
"destinationNamespace",
"equivalent",
"value",
"of",
"sourceValue",
"in",
"sourceNamespace"
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.core/src/main/java/org/openbel/framework/core/equivalence/DefaultParameterEquivalencer.java#L267-L280
|
146,223
|
OpenBEL/openbel-framework
|
org.openbel.framework.core/src/main/java/org/openbel/framework/core/equivalence/DefaultParameterEquivalencer.java
|
DefaultParameterEquivalencer.doFindEquivalence
|
private String doFindEquivalence(final String destinationNamespace,
final SkinnyUUID sourceUUID) {
JDBMEquivalenceLookup destinationLookup = openEquivalences
.get(destinationNamespace);
return destinationLookup.reverseLookup(sourceUUID);
}
|
java
|
private String doFindEquivalence(final String destinationNamespace,
final SkinnyUUID sourceUUID) {
JDBMEquivalenceLookup destinationLookup = openEquivalences
.get(destinationNamespace);
return destinationLookup.reverseLookup(sourceUUID);
}
|
[
"private",
"String",
"doFindEquivalence",
"(",
"final",
"String",
"destinationNamespace",
",",
"final",
"SkinnyUUID",
"sourceUUID",
")",
"{",
"JDBMEquivalenceLookup",
"destinationLookup",
"=",
"openEquivalences",
".",
"get",
"(",
"destinationNamespace",
")",
";",
"return",
"destinationLookup",
".",
"reverseLookup",
"(",
"sourceUUID",
")",
";",
"}"
] |
Obtain the destinationNamespace equivalent value of the sourceUUID.
@param destinationNamespace resourceLocation of destination namespace
@param sourceUUID
@return equivalent value, may be null
|
[
"Obtain",
"the",
"destinationNamespace",
"equivalent",
"value",
"of",
"the",
"sourceUUID",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.core/src/main/java/org/openbel/framework/core/equivalence/DefaultParameterEquivalencer.java#L288-L294
|
146,224
|
ihaolin/session
|
session-api/src/main/java/me/hao0/session/core/SessionFilter.java
|
SessionFilter.initAttrs
|
private void initAttrs(FilterConfig config){
String param = config.getInitParameter(SESSION_COOKIE_NAME);
sessionCookieName = Strings.isNullOrEmpty(param) ? DEFAULT_SESSION_COOKIE_NAME : param;
param = config.getInitParameter(MAX_INACTIVE_INTERVAL);
maxInactiveInterval = Strings.isNullOrEmpty(param) ? DEFAULT_MAX_INACTIVE_INTERVAL : Integer.parseInt(param);
cookieDomain = config.getInitParameter(COOKIE_DOMAIN);
param = config.getInitParameter(COOKIE_CONTEXT_PATH);
cookieContextPath = Strings.isNullOrEmpty(param) ? DEFAULT_COOKIE_CONTEXT_PATH : param;
param = config.getInitParameter(COOKIE_MAX_AGE);
cookieMaxAge = Strings.isNullOrEmpty(param) ? DEFAULT_COOKIE_MAX_AGE : Integer.parseInt(param);
log.info("SessionFilter (sessionCookieName={},maxInactiveInterval={},cookieDomain={})", sessionCookieName, maxInactiveInterval, cookieDomain);
}
|
java
|
private void initAttrs(FilterConfig config){
String param = config.getInitParameter(SESSION_COOKIE_NAME);
sessionCookieName = Strings.isNullOrEmpty(param) ? DEFAULT_SESSION_COOKIE_NAME : param;
param = config.getInitParameter(MAX_INACTIVE_INTERVAL);
maxInactiveInterval = Strings.isNullOrEmpty(param) ? DEFAULT_MAX_INACTIVE_INTERVAL : Integer.parseInt(param);
cookieDomain = config.getInitParameter(COOKIE_DOMAIN);
param = config.getInitParameter(COOKIE_CONTEXT_PATH);
cookieContextPath = Strings.isNullOrEmpty(param) ? DEFAULT_COOKIE_CONTEXT_PATH : param;
param = config.getInitParameter(COOKIE_MAX_AGE);
cookieMaxAge = Strings.isNullOrEmpty(param) ? DEFAULT_COOKIE_MAX_AGE : Integer.parseInt(param);
log.info("SessionFilter (sessionCookieName={},maxInactiveInterval={},cookieDomain={})", sessionCookieName, maxInactiveInterval, cookieDomain);
}
|
[
"private",
"void",
"initAttrs",
"(",
"FilterConfig",
"config",
")",
"{",
"String",
"param",
"=",
"config",
".",
"getInitParameter",
"(",
"SESSION_COOKIE_NAME",
")",
";",
"sessionCookieName",
"=",
"Strings",
".",
"isNullOrEmpty",
"(",
"param",
")",
"?",
"DEFAULT_SESSION_COOKIE_NAME",
":",
"param",
";",
"param",
"=",
"config",
".",
"getInitParameter",
"(",
"MAX_INACTIVE_INTERVAL",
")",
";",
"maxInactiveInterval",
"=",
"Strings",
".",
"isNullOrEmpty",
"(",
"param",
")",
"?",
"DEFAULT_MAX_INACTIVE_INTERVAL",
":",
"Integer",
".",
"parseInt",
"(",
"param",
")",
";",
"cookieDomain",
"=",
"config",
".",
"getInitParameter",
"(",
"COOKIE_DOMAIN",
")",
";",
"param",
"=",
"config",
".",
"getInitParameter",
"(",
"COOKIE_CONTEXT_PATH",
")",
";",
"cookieContextPath",
"=",
"Strings",
".",
"isNullOrEmpty",
"(",
"param",
")",
"?",
"DEFAULT_COOKIE_CONTEXT_PATH",
":",
"param",
";",
"param",
"=",
"config",
".",
"getInitParameter",
"(",
"COOKIE_MAX_AGE",
")",
";",
"cookieMaxAge",
"=",
"Strings",
".",
"isNullOrEmpty",
"(",
"param",
")",
"?",
"DEFAULT_COOKIE_MAX_AGE",
":",
"Integer",
".",
"parseInt",
"(",
"param",
")",
";",
"log",
".",
"info",
"(",
"\"SessionFilter (sessionCookieName={},maxInactiveInterval={},cookieDomain={})\"",
",",
"sessionCookieName",
",",
"maxInactiveInterval",
",",
"cookieDomain",
")",
";",
"}"
] |
init basic attribute
@param config the filter config
|
[
"init",
"basic",
"attribute"
] |
322c3a9f47b305a39345135fa8163dd7e065b4f8
|
https://github.com/ihaolin/session/blob/322c3a9f47b305a39345135fa8163dd7e065b4f8/session-api/src/main/java/me/hao0/session/core/SessionFilter.java#L112-L129
|
146,225
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/pos/CliticSplitter.java
|
CliticSplitter.tagClitics
|
public List<String> tagClitics(String word, String posTag, String lemma,
MorfologikLemmatizer lemmatizer) throws IOException {
List<String> newCliticElems = new ArrayList<String>();
Clitic match = cliticMatcher(word, posTag);
if (match != null) {
addCliticComponents(word, posTag, lemmatizer, match, newCliticElems);
}
return newCliticElems;
}
|
java
|
public List<String> tagClitics(String word, String posTag, String lemma,
MorfologikLemmatizer lemmatizer) throws IOException {
List<String> newCliticElems = new ArrayList<String>();
Clitic match = cliticMatcher(word, posTag);
if (match != null) {
addCliticComponents(word, posTag, lemmatizer, match, newCliticElems);
}
return newCliticElems;
}
|
[
"public",
"List",
"<",
"String",
">",
"tagClitics",
"(",
"String",
"word",
",",
"String",
"posTag",
",",
"String",
"lemma",
",",
"MorfologikLemmatizer",
"lemmatizer",
")",
"throws",
"IOException",
"{",
"List",
"<",
"String",
">",
"newCliticElems",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"Clitic",
"match",
"=",
"cliticMatcher",
"(",
"word",
",",
"posTag",
")",
";",
"if",
"(",
"match",
"!=",
"null",
")",
"{",
"addCliticComponents",
"(",
"word",
",",
"posTag",
",",
"lemmatizer",
",",
"match",
",",
"newCliticElems",
")",
";",
"}",
"return",
"newCliticElems",
";",
"}"
] |
Takes word, posTag and lemma as input and finds if any clitic pronouns are
in verbs.
@param word
the original word possibly containing clitic pronoun
@param posTag
the postag
@param lemma
the lemma
@param lemmatizer
the lemmatizer
@return the new pos and lemma after clitic splitting
@throws IOException if io problems
|
[
"Takes",
"word",
"posTag",
"and",
"lemma",
"as",
"input",
"and",
"finds",
"if",
"any",
"clitic",
"pronouns",
"are",
"in",
"verbs",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/pos/CliticSplitter.java#L59-L67
|
146,226
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java
|
PhaseThreeApplication.failIndex
|
private void failIndex(PhaseThreeOptions phasecfg, String errorMessage) {
stageError(errorMessage);
final StringBuilder bldr = new StringBuilder();
bldr.append("Could not find resource index file.");
bldr.append("Expansion of protein families, named complexes, ");
bldr.append("gene scaffolding, and orthology will not occur.");
stageError(bldr.toString());
ResourceIndex.INSTANCE.loadIndex();
phasecfg.setInjectProteinFamilies(false);
phasecfg.setInjectNamedComplexes(false);
phasecfg.setInjectGeneScaffolding(false);
phasecfg.setInjectOrthology(false);
}
|
java
|
private void failIndex(PhaseThreeOptions phasecfg, String errorMessage) {
stageError(errorMessage);
final StringBuilder bldr = new StringBuilder();
bldr.append("Could not find resource index file.");
bldr.append("Expansion of protein families, named complexes, ");
bldr.append("gene scaffolding, and orthology will not occur.");
stageError(bldr.toString());
ResourceIndex.INSTANCE.loadIndex();
phasecfg.setInjectProteinFamilies(false);
phasecfg.setInjectNamedComplexes(false);
phasecfg.setInjectGeneScaffolding(false);
phasecfg.setInjectOrthology(false);
}
|
[
"private",
"void",
"failIndex",
"(",
"PhaseThreeOptions",
"phasecfg",
",",
"String",
"errorMessage",
")",
"{",
"stageError",
"(",
"errorMessage",
")",
";",
"final",
"StringBuilder",
"bldr",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"bldr",
".",
"append",
"(",
"\"Could not find resource index file.\"",
")",
";",
"bldr",
".",
"append",
"(",
"\"Expansion of protein families, named complexes, \"",
")",
";",
"bldr",
".",
"append",
"(",
"\"gene scaffolding, and orthology will not occur.\"",
")",
";",
"stageError",
"(",
"bldr",
".",
"toString",
"(",
")",
")",
";",
"ResourceIndex",
".",
"INSTANCE",
".",
"loadIndex",
"(",
")",
";",
"phasecfg",
".",
"setInjectProteinFamilies",
"(",
"false",
")",
";",
"phasecfg",
".",
"setInjectNamedComplexes",
"(",
"false",
")",
";",
"phasecfg",
".",
"setInjectGeneScaffolding",
"(",
"false",
")",
";",
"phasecfg",
".",
"setInjectOrthology",
"(",
"false",
")",
";",
"}"
] |
Logic to recover from a missing resource index.
@param phasecfg
@param errorMessage
|
[
"Logic",
"to",
"recover",
"from",
"a",
"missing",
"resource",
"index",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java#L295-L307
|
146,227
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java
|
PhaseThreeApplication.processNetwork
|
private void processNetwork(final ProtoNetwork pn) {
// Inject protein families
ProtoNetwork pfamMerged = stage1(pn);
// Inject named complexes
ProtoNetwork ncMerged = stage2(pfamMerged);
// Inject gene scaffolding
ProtoNetwork geneMerged = stage3(ncMerged);
// Inject homology knowledge
ProtoNetwork orthoMerged = stage4(geneMerged);
// Equivalence the network
ProtoNetwork equived = stage5(orthoMerged);
stage6(equived);
}
|
java
|
private void processNetwork(final ProtoNetwork pn) {
// Inject protein families
ProtoNetwork pfamMerged = stage1(pn);
// Inject named complexes
ProtoNetwork ncMerged = stage2(pfamMerged);
// Inject gene scaffolding
ProtoNetwork geneMerged = stage3(ncMerged);
// Inject homology knowledge
ProtoNetwork orthoMerged = stage4(geneMerged);
// Equivalence the network
ProtoNetwork equived = stage5(orthoMerged);
stage6(equived);
}
|
[
"private",
"void",
"processNetwork",
"(",
"final",
"ProtoNetwork",
"pn",
")",
"{",
"// Inject protein families",
"ProtoNetwork",
"pfamMerged",
"=",
"stage1",
"(",
"pn",
")",
";",
"// Inject named complexes",
"ProtoNetwork",
"ncMerged",
"=",
"stage2",
"(",
"pfamMerged",
")",
";",
"// Inject gene scaffolding",
"ProtoNetwork",
"geneMerged",
"=",
"stage3",
"(",
"ncMerged",
")",
";",
"// Inject homology knowledge",
"ProtoNetwork",
"orthoMerged",
"=",
"stage4",
"(",
"geneMerged",
")",
";",
"// Equivalence the network",
"ProtoNetwork",
"equived",
"=",
"stage5",
"(",
"orthoMerged",
")",
";",
"stage6",
"(",
"equived",
")",
";",
"}"
] |
Runs the phase three stages over the input proto-network.
@param pn Proto-network input by user
|
[
"Runs",
"the",
"phase",
"three",
"stages",
"over",
"the",
"input",
"proto",
"-",
"network",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java#L371-L383
|
146,228
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java
|
PhaseThreeApplication.failProteinFamilies
|
private ProtoNetwork failProteinFamilies(final ProtoNetwork pn,
final StringBuilder bldr, String pfLocation, String errorMessage) {
bldr.append("PROTEIN FAMILY RESOLUTION FAILURE in ");
bldr.append(pfLocation);
bldr.append("\n\treason: ");
bldr.append(errorMessage);
stageWarning(bldr.toString());
// could not resolve protein family resource so return original
// proto network.
return pn;
}
|
java
|
private ProtoNetwork failProteinFamilies(final ProtoNetwork pn,
final StringBuilder bldr, String pfLocation, String errorMessage) {
bldr.append("PROTEIN FAMILY RESOLUTION FAILURE in ");
bldr.append(pfLocation);
bldr.append("\n\treason: ");
bldr.append(errorMessage);
stageWarning(bldr.toString());
// could not resolve protein family resource so return original
// proto network.
return pn;
}
|
[
"private",
"ProtoNetwork",
"failProteinFamilies",
"(",
"final",
"ProtoNetwork",
"pn",
",",
"final",
"StringBuilder",
"bldr",
",",
"String",
"pfLocation",
",",
"String",
"errorMessage",
")",
"{",
"bldr",
".",
"append",
"(",
"\"PROTEIN FAMILY RESOLUTION FAILURE in \"",
")",
";",
"bldr",
".",
"append",
"(",
"pfLocation",
")",
";",
"bldr",
".",
"append",
"(",
"\"\\n\\treason: \"",
")",
";",
"bldr",
".",
"append",
"(",
"errorMessage",
")",
";",
"stageWarning",
"(",
"bldr",
".",
"toString",
"(",
")",
")",
";",
"// could not resolve protein family resource so return original",
"// proto network.",
"return",
"pn",
";",
"}"
] |
Logic to recover from a failed protein family document.
@param pn
@param bldr
@param pfLocation
@param e
@return
|
[
"Logic",
"to",
"recover",
"from",
"a",
"failed",
"protein",
"family",
"document",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java#L595-L606
|
146,229
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java
|
PhaseThreeApplication.failNamedComplexes
|
private ProtoNetwork failNamedComplexes(final ProtoNetwork pn,
final StringBuilder bldr, String ncLocation, String errorMessage) {
bldr.append("NAMED COMPLEXES RESOLUTION FAILURE in ");
bldr.append(ncLocation);
bldr.append("\n\treason: ");
bldr.append(errorMessage);
stageWarning(bldr.toString());
// could not resolve named complexes resource so return original
// proto network.
return pn;
}
|
java
|
private ProtoNetwork failNamedComplexes(final ProtoNetwork pn,
final StringBuilder bldr, String ncLocation, String errorMessage) {
bldr.append("NAMED COMPLEXES RESOLUTION FAILURE in ");
bldr.append(ncLocation);
bldr.append("\n\treason: ");
bldr.append(errorMessage);
stageWarning(bldr.toString());
// could not resolve named complexes resource so return original
// proto network.
return pn;
}
|
[
"private",
"ProtoNetwork",
"failNamedComplexes",
"(",
"final",
"ProtoNetwork",
"pn",
",",
"final",
"StringBuilder",
"bldr",
",",
"String",
"ncLocation",
",",
"String",
"errorMessage",
")",
"{",
"bldr",
".",
"append",
"(",
"\"NAMED COMPLEXES RESOLUTION FAILURE in \"",
")",
";",
"bldr",
".",
"append",
"(",
"ncLocation",
")",
";",
"bldr",
".",
"append",
"(",
"\"\\n\\treason: \"",
")",
";",
"bldr",
".",
"append",
"(",
"errorMessage",
")",
";",
"stageWarning",
"(",
"bldr",
".",
"toString",
"(",
")",
")",
";",
"// could not resolve named complexes resource so return original",
"// proto network.",
"return",
"pn",
";",
"}"
] |
Logic to recover from a failure to resolve a named complexes resource.
@param pn
@param bldr
@param ncLocation
@param errorMessage
@return
|
[
"Logic",
"to",
"recover",
"from",
"a",
"failure",
"to",
"resolve",
"a",
"named",
"complexes",
"resource",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java#L790-L801
|
146,230
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java
|
PhaseThreeApplication.failGeneScaffolding
|
private ProtoNetwork failGeneScaffolding(final ProtoNetwork pn,
final StringBuilder bldr, String gsLocation, String errorMessage) {
bldr.append("GENE SCAFFOLDING RESOURCE RESOLUTION FAILURE in ");
bldr.append(gsLocation);
bldr.append("\n\treason: ");
bldr.append(errorMessage);
stageWarning(bldr.toString());
// could not resolve gene scaffolding resource so return original
// proto network.
return pn;
}
|
java
|
private ProtoNetwork failGeneScaffolding(final ProtoNetwork pn,
final StringBuilder bldr, String gsLocation, String errorMessage) {
bldr.append("GENE SCAFFOLDING RESOURCE RESOLUTION FAILURE in ");
bldr.append(gsLocation);
bldr.append("\n\treason: ");
bldr.append(errorMessage);
stageWarning(bldr.toString());
// could not resolve gene scaffolding resource so return original
// proto network.
return pn;
}
|
[
"private",
"ProtoNetwork",
"failGeneScaffolding",
"(",
"final",
"ProtoNetwork",
"pn",
",",
"final",
"StringBuilder",
"bldr",
",",
"String",
"gsLocation",
",",
"String",
"errorMessage",
")",
"{",
"bldr",
".",
"append",
"(",
"\"GENE SCAFFOLDING RESOURCE RESOLUTION FAILURE in \"",
")",
";",
"bldr",
".",
"append",
"(",
"gsLocation",
")",
";",
"bldr",
".",
"append",
"(",
"\"\\n\\treason: \"",
")",
";",
"bldr",
".",
"append",
"(",
"errorMessage",
")",
";",
"stageWarning",
"(",
"bldr",
".",
"toString",
"(",
")",
")",
";",
"// could not resolve gene scaffolding resource so return original",
"// proto network.",
"return",
"pn",
";",
"}"
] |
Logic to recover from a failure to resolve the gene scaffolding resource.
@param pn
@param bldr
@param gsLocation
@param errorMessage
@return
|
[
"Logic",
"to",
"recover",
"from",
"a",
"failure",
"to",
"resolve",
"the",
"gene",
"scaffolding",
"resource",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java#L987-L998
|
146,231
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java
|
PhaseThreeApplication.stage4
|
private ProtoNetwork stage4(final ProtoNetwork pn) {
beginStage(PHASE3_STAGE4_HDR, "4", NUM_PHASES);
if (!getPhaseConfiguration().getInjectOrthology()) {
final StringBuilder bldr = new StringBuilder();
bldr.append(ORTHO_INJECTION_DISABLED);
markEndStage(bldr);
stageOutput(bldr.toString());
return pn;
}
// create output directory for orthologized proto network
artifactPath = createDirectoryArtifact(outputDirectory, DIR_ARTIFACT);
final Index index = ResourceIndex.INSTANCE.getIndex();
final Set<ResourceLocation> resources = index.getOrthologyResources();
if (noItems(resources)) {
final StringBuilder bldr = new StringBuilder();
bldr.append("No orthology documents included.");
markEndStage(bldr);
stageOutput(bldr.toString());
return pn;
}
// equivalence network first, before pruning
Set<EquivalenceDataIndex> equivs;
try {
equivs = p2.stage2LoadNamespaceEquivalences();
} catch (EquivalenceMapResolutionFailure e) {
stageError(e.getUserFacingMessage());
equivs = emptySet();
}
try {
p2.stage3EquivalenceParameters(pn, equivs);
} catch (IOException e) {
}
final Iterator<ResourceLocation> it = resources.iterator();
final ResourceLocation first = it.next();
final ProtoNetwork orthoMerge = pruneResource(pn, first);
while (it.hasNext()) {
final ResourceLocation resource = it.next();
final ProtoNetwork opn = pruneResource(pn, resource);
try {
p3.merge(orthoMerge, opn);
} catch (ProtoNetworkError e) {
e.printStackTrace();
}
}
try {
runPhaseThree(orthoMerge);
} catch (ProtoNetworkError e) {
stageError(e.getUserFacingMessage());
bail(ExitCode.GENERAL_FAILURE);
}
try {
p3.merge(pn, orthoMerge);
} catch (ProtoNetworkError e) {
stageError(e.getUserFacingMessage());
bail(ExitCode.GENERAL_FAILURE);
}
return pn;
}
|
java
|
private ProtoNetwork stage4(final ProtoNetwork pn) {
beginStage(PHASE3_STAGE4_HDR, "4", NUM_PHASES);
if (!getPhaseConfiguration().getInjectOrthology()) {
final StringBuilder bldr = new StringBuilder();
bldr.append(ORTHO_INJECTION_DISABLED);
markEndStage(bldr);
stageOutput(bldr.toString());
return pn;
}
// create output directory for orthologized proto network
artifactPath = createDirectoryArtifact(outputDirectory, DIR_ARTIFACT);
final Index index = ResourceIndex.INSTANCE.getIndex();
final Set<ResourceLocation> resources = index.getOrthologyResources();
if (noItems(resources)) {
final StringBuilder bldr = new StringBuilder();
bldr.append("No orthology documents included.");
markEndStage(bldr);
stageOutput(bldr.toString());
return pn;
}
// equivalence network first, before pruning
Set<EquivalenceDataIndex> equivs;
try {
equivs = p2.stage2LoadNamespaceEquivalences();
} catch (EquivalenceMapResolutionFailure e) {
stageError(e.getUserFacingMessage());
equivs = emptySet();
}
try {
p2.stage3EquivalenceParameters(pn, equivs);
} catch (IOException e) {
}
final Iterator<ResourceLocation> it = resources.iterator();
final ResourceLocation first = it.next();
final ProtoNetwork orthoMerge = pruneResource(pn, first);
while (it.hasNext()) {
final ResourceLocation resource = it.next();
final ProtoNetwork opn = pruneResource(pn, resource);
try {
p3.merge(orthoMerge, opn);
} catch (ProtoNetworkError e) {
e.printStackTrace();
}
}
try {
runPhaseThree(orthoMerge);
} catch (ProtoNetworkError e) {
stageError(e.getUserFacingMessage());
bail(ExitCode.GENERAL_FAILURE);
}
try {
p3.merge(pn, orthoMerge);
} catch (ProtoNetworkError e) {
stageError(e.getUserFacingMessage());
bail(ExitCode.GENERAL_FAILURE);
}
return pn;
}
|
[
"private",
"ProtoNetwork",
"stage4",
"(",
"final",
"ProtoNetwork",
"pn",
")",
"{",
"beginStage",
"(",
"PHASE3_STAGE4_HDR",
",",
"\"4\"",
",",
"NUM_PHASES",
")",
";",
"if",
"(",
"!",
"getPhaseConfiguration",
"(",
")",
".",
"getInjectOrthology",
"(",
")",
")",
"{",
"final",
"StringBuilder",
"bldr",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"bldr",
".",
"append",
"(",
"ORTHO_INJECTION_DISABLED",
")",
";",
"markEndStage",
"(",
"bldr",
")",
";",
"stageOutput",
"(",
"bldr",
".",
"toString",
"(",
")",
")",
";",
"return",
"pn",
";",
"}",
"// create output directory for orthologized proto network",
"artifactPath",
"=",
"createDirectoryArtifact",
"(",
"outputDirectory",
",",
"DIR_ARTIFACT",
")",
";",
"final",
"Index",
"index",
"=",
"ResourceIndex",
".",
"INSTANCE",
".",
"getIndex",
"(",
")",
";",
"final",
"Set",
"<",
"ResourceLocation",
">",
"resources",
"=",
"index",
".",
"getOrthologyResources",
"(",
")",
";",
"if",
"(",
"noItems",
"(",
"resources",
")",
")",
"{",
"final",
"StringBuilder",
"bldr",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"bldr",
".",
"append",
"(",
"\"No orthology documents included.\"",
")",
";",
"markEndStage",
"(",
"bldr",
")",
";",
"stageOutput",
"(",
"bldr",
".",
"toString",
"(",
")",
")",
";",
"return",
"pn",
";",
"}",
"// equivalence network first, before pruning",
"Set",
"<",
"EquivalenceDataIndex",
">",
"equivs",
";",
"try",
"{",
"equivs",
"=",
"p2",
".",
"stage2LoadNamespaceEquivalences",
"(",
")",
";",
"}",
"catch",
"(",
"EquivalenceMapResolutionFailure",
"e",
")",
"{",
"stageError",
"(",
"e",
".",
"getUserFacingMessage",
"(",
")",
")",
";",
"equivs",
"=",
"emptySet",
"(",
")",
";",
"}",
"try",
"{",
"p2",
".",
"stage3EquivalenceParameters",
"(",
"pn",
",",
"equivs",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"}",
"final",
"Iterator",
"<",
"ResourceLocation",
">",
"it",
"=",
"resources",
".",
"iterator",
"(",
")",
";",
"final",
"ResourceLocation",
"first",
"=",
"it",
".",
"next",
"(",
")",
";",
"final",
"ProtoNetwork",
"orthoMerge",
"=",
"pruneResource",
"(",
"pn",
",",
"first",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"final",
"ResourceLocation",
"resource",
"=",
"it",
".",
"next",
"(",
")",
";",
"final",
"ProtoNetwork",
"opn",
"=",
"pruneResource",
"(",
"pn",
",",
"resource",
")",
";",
"try",
"{",
"p3",
".",
"merge",
"(",
"orthoMerge",
",",
"opn",
")",
";",
"}",
"catch",
"(",
"ProtoNetworkError",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"try",
"{",
"runPhaseThree",
"(",
"orthoMerge",
")",
";",
"}",
"catch",
"(",
"ProtoNetworkError",
"e",
")",
"{",
"stageError",
"(",
"e",
".",
"getUserFacingMessage",
"(",
")",
")",
";",
"bail",
"(",
"ExitCode",
".",
"GENERAL_FAILURE",
")",
";",
"}",
"try",
"{",
"p3",
".",
"merge",
"(",
"pn",
",",
"orthoMerge",
")",
";",
"}",
"catch",
"(",
"ProtoNetworkError",
"e",
")",
"{",
"stageError",
"(",
"e",
".",
"getUserFacingMessage",
"(",
")",
")",
";",
"bail",
"(",
"ExitCode",
".",
"GENERAL_FAILURE",
")",
";",
"}",
"return",
"pn",
";",
"}"
] |
Runs stage four injecting of homology knowledge.
@param pn {@link ProtoNetwork}
@return the {@link ProtoNetwork} with homology knowledge injected
|
[
"Runs",
"stage",
"four",
"injecting",
"of",
"homology",
"knowledge",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java#L1006-L1074
|
146,232
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java
|
PhaseThreeApplication.stage5
|
private ProtoNetwork stage5(ProtoNetwork pn) {
beginStage(PHASE3_STAGE5_HDR, "5", NUM_PHASES);
final StringBuilder bldr = new StringBuilder();
if (!withGeneScaffoldingInjection() &&
!withNamedComplexInjection() &&
!withProteinFamilyInjection()) {
bldr.append(INJECTIONS_DISABLED);
markEndStage(bldr);
stageOutput(bldr.toString());
return pn;
}
// load equivalences
Set<EquivalenceDataIndex> equivs;
try {
equivs = p2.stage2LoadNamespaceEquivalences();
} catch (EquivalenceMapResolutionFailure e) {
stageError(e.getUserFacingMessage());
equivs = emptySet();
}
long t1 = currentTimeMillis();
int pct = stage5Parameter(pn, equivs, bldr);
stage5Term(pn, pct);
stage5Statement(pn, pct);
long t2 = currentTimeMillis();
final int paramct = pn.getParameterTable().getTableParameters().size();
final int termct = pn.getTermTable().getTermValues().size();
final int stmtct = pn.getStatementTable().getStatements().size();
bldr.setLength(0);
bldr.append(stmtct);
bldr.append(" statements, ");
bldr.append(termct);
bldr.append(" terms, ");
bldr.append(paramct);
bldr.append(" parameters");
stageOutput(bldr.toString());
bldr.setLength(0);
markTime(bldr, t1, t2);
markEndStage(bldr);
stageOutput(bldr.toString());
return pn;
}
|
java
|
private ProtoNetwork stage5(ProtoNetwork pn) {
beginStage(PHASE3_STAGE5_HDR, "5", NUM_PHASES);
final StringBuilder bldr = new StringBuilder();
if (!withGeneScaffoldingInjection() &&
!withNamedComplexInjection() &&
!withProteinFamilyInjection()) {
bldr.append(INJECTIONS_DISABLED);
markEndStage(bldr);
stageOutput(bldr.toString());
return pn;
}
// load equivalences
Set<EquivalenceDataIndex> equivs;
try {
equivs = p2.stage2LoadNamespaceEquivalences();
} catch (EquivalenceMapResolutionFailure e) {
stageError(e.getUserFacingMessage());
equivs = emptySet();
}
long t1 = currentTimeMillis();
int pct = stage5Parameter(pn, equivs, bldr);
stage5Term(pn, pct);
stage5Statement(pn, pct);
long t2 = currentTimeMillis();
final int paramct = pn.getParameterTable().getTableParameters().size();
final int termct = pn.getTermTable().getTermValues().size();
final int stmtct = pn.getStatementTable().getStatements().size();
bldr.setLength(0);
bldr.append(stmtct);
bldr.append(" statements, ");
bldr.append(termct);
bldr.append(" terms, ");
bldr.append(paramct);
bldr.append(" parameters");
stageOutput(bldr.toString());
bldr.setLength(0);
markTime(bldr, t1, t2);
markEndStage(bldr);
stageOutput(bldr.toString());
return pn;
}
|
[
"private",
"ProtoNetwork",
"stage5",
"(",
"ProtoNetwork",
"pn",
")",
"{",
"beginStage",
"(",
"PHASE3_STAGE5_HDR",
",",
"\"5\"",
",",
"NUM_PHASES",
")",
";",
"final",
"StringBuilder",
"bldr",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"!",
"withGeneScaffoldingInjection",
"(",
")",
"&&",
"!",
"withNamedComplexInjection",
"(",
")",
"&&",
"!",
"withProteinFamilyInjection",
"(",
")",
")",
"{",
"bldr",
".",
"append",
"(",
"INJECTIONS_DISABLED",
")",
";",
"markEndStage",
"(",
"bldr",
")",
";",
"stageOutput",
"(",
"bldr",
".",
"toString",
"(",
")",
")",
";",
"return",
"pn",
";",
"}",
"// load equivalences",
"Set",
"<",
"EquivalenceDataIndex",
">",
"equivs",
";",
"try",
"{",
"equivs",
"=",
"p2",
".",
"stage2LoadNamespaceEquivalences",
"(",
")",
";",
"}",
"catch",
"(",
"EquivalenceMapResolutionFailure",
"e",
")",
"{",
"stageError",
"(",
"e",
".",
"getUserFacingMessage",
"(",
")",
")",
";",
"equivs",
"=",
"emptySet",
"(",
")",
";",
"}",
"long",
"t1",
"=",
"currentTimeMillis",
"(",
")",
";",
"int",
"pct",
"=",
"stage5Parameter",
"(",
"pn",
",",
"equivs",
",",
"bldr",
")",
";",
"stage5Term",
"(",
"pn",
",",
"pct",
")",
";",
"stage5Statement",
"(",
"pn",
",",
"pct",
")",
";",
"long",
"t2",
"=",
"currentTimeMillis",
"(",
")",
";",
"final",
"int",
"paramct",
"=",
"pn",
".",
"getParameterTable",
"(",
")",
".",
"getTableParameters",
"(",
")",
".",
"size",
"(",
")",
";",
"final",
"int",
"termct",
"=",
"pn",
".",
"getTermTable",
"(",
")",
".",
"getTermValues",
"(",
")",
".",
"size",
"(",
")",
";",
"final",
"int",
"stmtct",
"=",
"pn",
".",
"getStatementTable",
"(",
")",
".",
"getStatements",
"(",
")",
".",
"size",
"(",
")",
";",
"bldr",
".",
"setLength",
"(",
"0",
")",
";",
"bldr",
".",
"append",
"(",
"stmtct",
")",
";",
"bldr",
".",
"append",
"(",
"\" statements, \"",
")",
";",
"bldr",
".",
"append",
"(",
"termct",
")",
";",
"bldr",
".",
"append",
"(",
"\" terms, \"",
")",
";",
"bldr",
".",
"append",
"(",
"paramct",
")",
";",
"bldr",
".",
"append",
"(",
"\" parameters\"",
")",
";",
"stageOutput",
"(",
"bldr",
".",
"toString",
"(",
")",
")",
";",
"bldr",
".",
"setLength",
"(",
"0",
")",
";",
"markTime",
"(",
"bldr",
",",
"t1",
",",
"t2",
")",
";",
"markEndStage",
"(",
"bldr",
")",
";",
"stageOutput",
"(",
"bldr",
".",
"toString",
"(",
")",
")",
";",
"return",
"pn",
";",
"}"
] |
Runs stage five equivalencing of the proto-network.
@param pn Proto-network, post-scaffolding
@return Equivalenced proto-network
|
[
"Runs",
"stage",
"five",
"equivalencing",
"of",
"the",
"proto",
"-",
"network",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java#L1167-L1214
|
146,233
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java
|
PhaseThreeApplication.stage5Parameter
|
private int stage5Parameter(final ProtoNetwork network,
Set<EquivalenceDataIndex> equivalences, final StringBuilder bldr) {
bldr.append("Equivalencing parameters");
stageOutput(bldr.toString());
ProtoNetwork ret = network;
int ct = 0;
try {
ct = p2.stage3EquivalenceParameters(ret, equivalences);
stageOutput("(" + ct + " equivalences)");
} catch (IOException ioex) {
final String err = ioex.getMessage();
fatal(err);
}
return ct;
}
|
java
|
private int stage5Parameter(final ProtoNetwork network,
Set<EquivalenceDataIndex> equivalences, final StringBuilder bldr) {
bldr.append("Equivalencing parameters");
stageOutput(bldr.toString());
ProtoNetwork ret = network;
int ct = 0;
try {
ct = p2.stage3EquivalenceParameters(ret, equivalences);
stageOutput("(" + ct + " equivalences)");
} catch (IOException ioex) {
final String err = ioex.getMessage();
fatal(err);
}
return ct;
}
|
[
"private",
"int",
"stage5Parameter",
"(",
"final",
"ProtoNetwork",
"network",
",",
"Set",
"<",
"EquivalenceDataIndex",
">",
"equivalences",
",",
"final",
"StringBuilder",
"bldr",
")",
"{",
"bldr",
".",
"append",
"(",
"\"Equivalencing parameters\"",
")",
";",
"stageOutput",
"(",
"bldr",
".",
"toString",
"(",
")",
")",
";",
"ProtoNetwork",
"ret",
"=",
"network",
";",
"int",
"ct",
"=",
"0",
";",
"try",
"{",
"ct",
"=",
"p2",
".",
"stage3EquivalenceParameters",
"(",
"ret",
",",
"equivalences",
")",
";",
"stageOutput",
"(",
"\"(\"",
"+",
"ct",
"+",
"\" equivalences)\"",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioex",
")",
"{",
"final",
"String",
"err",
"=",
"ioex",
".",
"getMessage",
"(",
")",
";",
"fatal",
"(",
"err",
")",
";",
"}",
"return",
"ct",
";",
"}"
] |
Stage five parameter equivalencing.
@param network the {@link ProtoNetwork network} to equivalence
@param equivalences the {@link Set set} of {@link EquivalenceDataIndex}
@param bldr the {@link StringBuilder}
@return the {@code int} count of parameter equivalences
|
[
"Stage",
"five",
"parameter",
"equivalencing",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java#L1224-L1239
|
146,234
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java
|
PhaseThreeApplication.stage5Term
|
private void stage5Term(final ProtoNetwork network, int pct) {
if (pct > 0) {
stageOutput("Equivalencing terms");
int tct = p2.stage3EquivalenceTerms(network);
stageOutput("(" + tct + " equivalences)");
} else {
stageOutput("Skipping term equivalencing");
}
}
|
java
|
private void stage5Term(final ProtoNetwork network, int pct) {
if (pct > 0) {
stageOutput("Equivalencing terms");
int tct = p2.stage3EquivalenceTerms(network);
stageOutput("(" + tct + " equivalences)");
} else {
stageOutput("Skipping term equivalencing");
}
}
|
[
"private",
"void",
"stage5Term",
"(",
"final",
"ProtoNetwork",
"network",
",",
"int",
"pct",
")",
"{",
"if",
"(",
"pct",
">",
"0",
")",
"{",
"stageOutput",
"(",
"\"Equivalencing terms\"",
")",
";",
"int",
"tct",
"=",
"p2",
".",
"stage3EquivalenceTerms",
"(",
"network",
")",
";",
"stageOutput",
"(",
"\"(\"",
"+",
"tct",
"+",
"\" equivalences)\"",
")",
";",
"}",
"else",
"{",
"stageOutput",
"(",
"\"Skipping term equivalencing\"",
")",
";",
"}",
"}"
] |
Stage five term equivalencing.
@param network the {@link ProtoNetwork network} to equivalence
@param pct the parameter equivalencing count to control output
|
[
"Stage",
"five",
"term",
"equivalencing",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java#L1247-L1255
|
146,235
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java
|
PhaseThreeApplication.stage5Statement
|
private void stage5Statement(final ProtoNetwork network, int pct) {
if (pct > 0) {
stageOutput("Equivalencing statements");
int sct = p2.stage3EquivalenceStatements(network);
stageOutput("(" + sct + " equivalences)");
} else {
stageOutput("Skipping statement equivalencing");
}
}
|
java
|
private void stage5Statement(final ProtoNetwork network, int pct) {
if (pct > 0) {
stageOutput("Equivalencing statements");
int sct = p2.stage3EquivalenceStatements(network);
stageOutput("(" + sct + " equivalences)");
} else {
stageOutput("Skipping statement equivalencing");
}
}
|
[
"private",
"void",
"stage5Statement",
"(",
"final",
"ProtoNetwork",
"network",
",",
"int",
"pct",
")",
"{",
"if",
"(",
"pct",
">",
"0",
")",
"{",
"stageOutput",
"(",
"\"Equivalencing statements\"",
")",
";",
"int",
"sct",
"=",
"p2",
".",
"stage3EquivalenceStatements",
"(",
"network",
")",
";",
"stageOutput",
"(",
"\"(\"",
"+",
"sct",
"+",
"\" equivalences)\"",
")",
";",
"}",
"else",
"{",
"stageOutput",
"(",
"\"Skipping statement equivalencing\"",
")",
";",
"}",
"}"
] |
Stage five statement equivalencing.
@param network the {@link ProtoNetwork network} to equivalence
@param pct the parameter equivalencing count to control output
|
[
"Stage",
"five",
"statement",
"equivalencing",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java#L1263-L1271
|
146,236
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java
|
PhaseThreeApplication.stage6
|
private void stage6(ProtoNetwork pn) {
beginStage(PHASE3_STAGE6_HDR, "6", NUM_PHASES);
stageOutput("Saving augmented network");
final String rootpath = artifactPath.getAbsolutePath();
long t1 = currentTimeMillis();
try {
p3.write(rootpath, pn);
if (withDebug()) {
try {
TextProtoNetworkExternalizer textExternalizer =
new TextProtoNetworkExternalizer();
textExternalizer.writeProtoNetwork(pn,
rootpath);
} catch (ProtoNetworkError e) {
error("Could not write out equivalenced proto network.");
}
}
} catch (ProtoNetworkError e) {
stageError(e.getUserFacingMessage());
bail(NO_PROTO_NETWORKS_SAVED);
}
long t2 = currentTimeMillis();
final StringBuilder bldr = new StringBuilder();
markTime(bldr, t1, t2);
markEndStage(bldr);
stageOutput(bldr.toString());
}
|
java
|
private void stage6(ProtoNetwork pn) {
beginStage(PHASE3_STAGE6_HDR, "6", NUM_PHASES);
stageOutput("Saving augmented network");
final String rootpath = artifactPath.getAbsolutePath();
long t1 = currentTimeMillis();
try {
p3.write(rootpath, pn);
if (withDebug()) {
try {
TextProtoNetworkExternalizer textExternalizer =
new TextProtoNetworkExternalizer();
textExternalizer.writeProtoNetwork(pn,
rootpath);
} catch (ProtoNetworkError e) {
error("Could not write out equivalenced proto network.");
}
}
} catch (ProtoNetworkError e) {
stageError(e.getUserFacingMessage());
bail(NO_PROTO_NETWORKS_SAVED);
}
long t2 = currentTimeMillis();
final StringBuilder bldr = new StringBuilder();
markTime(bldr, t1, t2);
markEndStage(bldr);
stageOutput(bldr.toString());
}
|
[
"private",
"void",
"stage6",
"(",
"ProtoNetwork",
"pn",
")",
"{",
"beginStage",
"(",
"PHASE3_STAGE6_HDR",
",",
"\"6\"",
",",
"NUM_PHASES",
")",
";",
"stageOutput",
"(",
"\"Saving augmented network\"",
")",
";",
"final",
"String",
"rootpath",
"=",
"artifactPath",
".",
"getAbsolutePath",
"(",
")",
";",
"long",
"t1",
"=",
"currentTimeMillis",
"(",
")",
";",
"try",
"{",
"p3",
".",
"write",
"(",
"rootpath",
",",
"pn",
")",
";",
"if",
"(",
"withDebug",
"(",
")",
")",
"{",
"try",
"{",
"TextProtoNetworkExternalizer",
"textExternalizer",
"=",
"new",
"TextProtoNetworkExternalizer",
"(",
")",
";",
"textExternalizer",
".",
"writeProtoNetwork",
"(",
"pn",
",",
"rootpath",
")",
";",
"}",
"catch",
"(",
"ProtoNetworkError",
"e",
")",
"{",
"error",
"(",
"\"Could not write out equivalenced proto network.\"",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"ProtoNetworkError",
"e",
")",
"{",
"stageError",
"(",
"e",
".",
"getUserFacingMessage",
"(",
")",
")",
";",
"bail",
"(",
"NO_PROTO_NETWORKS_SAVED",
")",
";",
"}",
"long",
"t2",
"=",
"currentTimeMillis",
"(",
")",
";",
"final",
"StringBuilder",
"bldr",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"markTime",
"(",
"bldr",
",",
"t1",
",",
"t2",
")",
";",
"markEndStage",
"(",
"bldr",
")",
";",
"stageOutput",
"(",
"bldr",
".",
"toString",
"(",
")",
")",
";",
"}"
] |
Runs stage six network saving.
@param pn Proto-network
|
[
"Runs",
"stage",
"six",
"network",
"saving",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseThreeApplication.java#L1278-L1307
|
146,237
|
geomajas/geomajas-project-client-gwt2
|
plugin/corewidget/example-jar/src/main/java/org/geomajas/gwt2/plugin/corewidget/example/client/sample/feature/tooltip/ToolTip.java
|
ToolTip.addContentAndShow
|
public void addContentAndShow(List<Label> content, int left, int top, boolean showCloseButton) {
// Add a closeButton when showCloseButton is true.
if (showCloseButton) {
Label closeButtonLabel = new Label(" X ");
closeButtonLabel.addStyleName(ToolTipResource.INSTANCE.css().toolTipCloseButton());
contentPanel.add(closeButtonLabel);
closeButtonLabel.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
hide();
}
});
}
// Add the content to the panel.
for (Label l : content) {
l.addStyleName(ToolTipResource.INSTANCE.css().toolTipLine());
contentPanel.add(l);
}
// Finally set position of the tooltip and show it.
toolTip.setPopupPosition(left, top);
toolTip.show();
}
|
java
|
public void addContentAndShow(List<Label> content, int left, int top, boolean showCloseButton) {
// Add a closeButton when showCloseButton is true.
if (showCloseButton) {
Label closeButtonLabel = new Label(" X ");
closeButtonLabel.addStyleName(ToolTipResource.INSTANCE.css().toolTipCloseButton());
contentPanel.add(closeButtonLabel);
closeButtonLabel.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
hide();
}
});
}
// Add the content to the panel.
for (Label l : content) {
l.addStyleName(ToolTipResource.INSTANCE.css().toolTipLine());
contentPanel.add(l);
}
// Finally set position of the tooltip and show it.
toolTip.setPopupPosition(left, top);
toolTip.show();
}
|
[
"public",
"void",
"addContentAndShow",
"(",
"List",
"<",
"Label",
">",
"content",
",",
"int",
"left",
",",
"int",
"top",
",",
"boolean",
"showCloseButton",
")",
"{",
"// Add a closeButton when showCloseButton is true.",
"if",
"(",
"showCloseButton",
")",
"{",
"Label",
"closeButtonLabel",
"=",
"new",
"Label",
"(",
"\" X \"",
")",
";",
"closeButtonLabel",
".",
"addStyleName",
"(",
"ToolTipResource",
".",
"INSTANCE",
".",
"css",
"(",
")",
".",
"toolTipCloseButton",
"(",
")",
")",
";",
"contentPanel",
".",
"add",
"(",
"closeButtonLabel",
")",
";",
"closeButtonLabel",
".",
"addClickHandler",
"(",
"new",
"ClickHandler",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onClick",
"(",
"ClickEvent",
"event",
")",
"{",
"hide",
"(",
")",
";",
"}",
"}",
")",
";",
"}",
"// Add the content to the panel.",
"for",
"(",
"Label",
"l",
":",
"content",
")",
"{",
"l",
".",
"addStyleName",
"(",
"ToolTipResource",
".",
"INSTANCE",
".",
"css",
"(",
")",
".",
"toolTipLine",
"(",
")",
")",
";",
"contentPanel",
".",
"add",
"(",
"l",
")",
";",
"}",
"// Finally set position of the tooltip and show it.",
"toolTip",
".",
"setPopupPosition",
"(",
"left",
",",
"top",
")",
";",
"toolTip",
".",
"show",
"(",
")",
";",
"}"
] |
Add content to the tooltip and show it with the given parameters.
@param content a list of Labels
@param left the left position of the tooltip
@param top the top position of the tooltip
|
[
"Add",
"content",
"to",
"the",
"tooltip",
"and",
"show",
"it",
"with",
"the",
"given",
"parameters",
"."
] |
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/feature/tooltip/ToolTip.java#L78-L104
|
146,238
|
geomajas/geomajas-project-client-gwt2
|
plugin/corewidget/corewidget/src/main/java/org/geomajas/gwt2/plugin/corewidget/client/feature/featureinfo/FeatureInfoWidget.java
|
FeatureInfoWidget.setFeature
|
@Override
public void setFeature(Feature feature) {
for (HasFeature action : actions) {
action.setFeature(feature);
}
presenter.setFeature(feature);
}
|
java
|
@Override
public void setFeature(Feature feature) {
for (HasFeature action : actions) {
action.setFeature(feature);
}
presenter.setFeature(feature);
}
|
[
"@",
"Override",
"public",
"void",
"setFeature",
"(",
"Feature",
"feature",
")",
"{",
"for",
"(",
"HasFeature",
"action",
":",
"actions",
")",
"{",
"action",
".",
"setFeature",
"(",
"feature",
")",
";",
"}",
"presenter",
".",
"setFeature",
"(",
"feature",
")",
";",
"}"
] |
Set the feature to display.
@param feature The feature.
|
[
"Set",
"the",
"feature",
"to",
"display",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/corewidget/corewidget/src/main/java/org/geomajas/gwt2/plugin/corewidget/client/feature/featureinfo/FeatureInfoWidget.java#L66-L72
|
146,239
|
geomajas/geomajas-project-client-gwt2
|
plugin/corewidget/corewidget/src/main/java/org/geomajas/gwt2/plugin/corewidget/client/feature/featureinfo/FeatureInfoWidget.java
|
FeatureInfoWidget.addHasFeature
|
public void addHasFeature(HasFeature action) {
actions.add(action);
action.setFeature(presenter.getFeature());
}
|
java
|
public void addHasFeature(HasFeature action) {
actions.add(action);
action.setFeature(presenter.getFeature());
}
|
[
"public",
"void",
"addHasFeature",
"(",
"HasFeature",
"action",
")",
"{",
"actions",
".",
"add",
"(",
"action",
")",
";",
"action",
".",
"setFeature",
"(",
"presenter",
".",
"getFeature",
"(",
")",
")",
";",
"}"
] |
Add an object for this feature to the widget. When the displayed feature
changes, the feature associated with the object is automatically updated.
@param action The action to add.
|
[
"Add",
"an",
"object",
"for",
"this",
"feature",
"to",
"the",
"widget",
".",
"When",
"the",
"displayed",
"feature",
"changes",
"the",
"feature",
"associated",
"with",
"the",
"object",
"is",
"automatically",
"updated",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/corewidget/corewidget/src/main/java/org/geomajas/gwt2/plugin/corewidget/client/feature/featureinfo/FeatureInfoWidget.java#L80-L83
|
146,240
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/lang/StringUtils.java
|
StringUtils.byteToHex
|
public static String byteToHex(byte[] data) {
if (data == null) {
return null;
}
final StringBuilder builder = new StringBuilder();
for (final byte b : data) {
builder.append(String.format("%02X", b));
}
return builder.toString();
}
|
java
|
public static String byteToHex(byte[] data) {
if (data == null) {
return null;
}
final StringBuilder builder = new StringBuilder();
for (final byte b : data) {
builder.append(String.format("%02X", b));
}
return builder.toString();
}
|
[
"public",
"static",
"String",
"byteToHex",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"if",
"(",
"data",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"final",
"byte",
"b",
":",
"data",
")",
"{",
"builder",
".",
"append",
"(",
"String",
".",
"format",
"(",
"\"%02X\"",
",",
"b",
")",
")",
";",
"}",
"return",
"builder",
".",
"toString",
"(",
")",
";",
"}"
] |
Convert byte data to hex code string.
@param data to convert.
@return the hex code of the byte array.
|
[
"Convert",
"byte",
"data",
"to",
"hex",
"code",
"string",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/lang/StringUtils.java#L39-L48
|
146,241
|
OpenBEL/openbel-framework
|
org.openbel.framework.core/src/main/java/org/openbel/framework/core/protonetwork/BinaryProtoNetworkExternalizer.java
|
BinaryProtoNetworkExternalizer.readProtoNetwork
|
@Override
public ProtoNetwork readProtoNetwork(
ProtoNetworkDescriptor protoNetworkDescriptor)
throws ProtoNetworkError {
if (!BinaryProtoNetworkDescriptor.class
.isAssignableFrom(protoNetworkDescriptor.getClass())) {
String err = "protoNetworkDescriptor cannot be of type ";
err = err.concat(protoNetworkDescriptor.getClass().getName());
err = err.concat(", need type ");
err = err.concat(BinaryProtoNetworkDescriptor.class.getName());
throw new InvalidArgument(err);
}
BinaryProtoNetworkDescriptor binaryProtoNetworkDescriptor =
(BinaryProtoNetworkDescriptor) protoNetworkDescriptor;
File pn = binaryProtoNetworkDescriptor.getProtoNetwork();
ObjectInputStream ois = null;
try {
ois = new ObjectInputStream(new FileInputStream(pn));
ProtoNetwork network = new ProtoNetwork();
network.readExternal(ois);
return network;
} catch (FileNotFoundException e) {
final String msg = "Cannot find binary proto-network for path";
throw new ProtoNetworkError(pn.getAbsolutePath(), msg, e);
} catch (IOException e) {
final String msg = "Cannot read binary proto-network for path";
throw new ProtoNetworkError(pn.getAbsolutePath(), msg, e);
} catch (ClassNotFoundException e) {
final String msg = "Cannot read proto-network for path";
throw new ProtoNetworkError(pn.getAbsolutePath(), msg, e);
} finally {
// clean up IO resources
IOUtils.closeQuietly(ois);
}
}
|
java
|
@Override
public ProtoNetwork readProtoNetwork(
ProtoNetworkDescriptor protoNetworkDescriptor)
throws ProtoNetworkError {
if (!BinaryProtoNetworkDescriptor.class
.isAssignableFrom(protoNetworkDescriptor.getClass())) {
String err = "protoNetworkDescriptor cannot be of type ";
err = err.concat(protoNetworkDescriptor.getClass().getName());
err = err.concat(", need type ");
err = err.concat(BinaryProtoNetworkDescriptor.class.getName());
throw new InvalidArgument(err);
}
BinaryProtoNetworkDescriptor binaryProtoNetworkDescriptor =
(BinaryProtoNetworkDescriptor) protoNetworkDescriptor;
File pn = binaryProtoNetworkDescriptor.getProtoNetwork();
ObjectInputStream ois = null;
try {
ois = new ObjectInputStream(new FileInputStream(pn));
ProtoNetwork network = new ProtoNetwork();
network.readExternal(ois);
return network;
} catch (FileNotFoundException e) {
final String msg = "Cannot find binary proto-network for path";
throw new ProtoNetworkError(pn.getAbsolutePath(), msg, e);
} catch (IOException e) {
final String msg = "Cannot read binary proto-network for path";
throw new ProtoNetworkError(pn.getAbsolutePath(), msg, e);
} catch (ClassNotFoundException e) {
final String msg = "Cannot read proto-network for path";
throw new ProtoNetworkError(pn.getAbsolutePath(), msg, e);
} finally {
// clean up IO resources
IOUtils.closeQuietly(ois);
}
}
|
[
"@",
"Override",
"public",
"ProtoNetwork",
"readProtoNetwork",
"(",
"ProtoNetworkDescriptor",
"protoNetworkDescriptor",
")",
"throws",
"ProtoNetworkError",
"{",
"if",
"(",
"!",
"BinaryProtoNetworkDescriptor",
".",
"class",
".",
"isAssignableFrom",
"(",
"protoNetworkDescriptor",
".",
"getClass",
"(",
")",
")",
")",
"{",
"String",
"err",
"=",
"\"protoNetworkDescriptor cannot be of type \"",
";",
"err",
"=",
"err",
".",
"concat",
"(",
"protoNetworkDescriptor",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"err",
"=",
"err",
".",
"concat",
"(",
"\", need type \"",
")",
";",
"err",
"=",
"err",
".",
"concat",
"(",
"BinaryProtoNetworkDescriptor",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"throw",
"new",
"InvalidArgument",
"(",
"err",
")",
";",
"}",
"BinaryProtoNetworkDescriptor",
"binaryProtoNetworkDescriptor",
"=",
"(",
"BinaryProtoNetworkDescriptor",
")",
"protoNetworkDescriptor",
";",
"File",
"pn",
"=",
"binaryProtoNetworkDescriptor",
".",
"getProtoNetwork",
"(",
")",
";",
"ObjectInputStream",
"ois",
"=",
"null",
";",
"try",
"{",
"ois",
"=",
"new",
"ObjectInputStream",
"(",
"new",
"FileInputStream",
"(",
"pn",
")",
")",
";",
"ProtoNetwork",
"network",
"=",
"new",
"ProtoNetwork",
"(",
")",
";",
"network",
".",
"readExternal",
"(",
"ois",
")",
";",
"return",
"network",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"final",
"String",
"msg",
"=",
"\"Cannot find binary proto-network for path\"",
";",
"throw",
"new",
"ProtoNetworkError",
"(",
"pn",
".",
"getAbsolutePath",
"(",
")",
",",
"msg",
",",
"e",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"final",
"String",
"msg",
"=",
"\"Cannot read binary proto-network for path\"",
";",
"throw",
"new",
"ProtoNetworkError",
"(",
"pn",
".",
"getAbsolutePath",
"(",
")",
",",
"msg",
",",
"e",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"final",
"String",
"msg",
"=",
"\"Cannot read proto-network for path\"",
";",
"throw",
"new",
"ProtoNetworkError",
"(",
"pn",
".",
"getAbsolutePath",
"(",
")",
",",
"msg",
",",
"e",
")",
";",
"}",
"finally",
"{",
"// clean up IO resources",
"IOUtils",
".",
"closeQuietly",
"(",
"ois",
")",
";",
"}",
"}"
] |
Reads a proto network from a descriptor representing a binary file.
@param protoNetworkDescriptor {@link ProtoNetworkDescriptor}, the proto
network descriptor
@return {@link ProtoNetwork}, the read proto network, which cannot be
null
@throws InvalidArgument Thrown if the {@code protoNetworkDescriptor} was
not of type {@link BinaryProtoNetworkDescriptor}
@throws ProtoNetworkError, if there was an error reading from the
{@link ProtoNetworkDescriptor}
|
[
"Reads",
"a",
"proto",
"network",
"from",
"a",
"descriptor",
"representing",
"a",
"binary",
"file",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.core/src/main/java/org/openbel/framework/core/protonetwork/BinaryProtoNetworkExternalizer.java#L76-L112
|
146,242
|
OpenBEL/openbel-framework
|
org.openbel.framework.core/src/main/java/org/openbel/framework/core/protonetwork/BinaryProtoNetworkExternalizer.java
|
BinaryProtoNetworkExternalizer.writeProtoNetwork
|
@Override
public ProtoNetworkDescriptor writeProtoNetwork(ProtoNetwork protoNetwork,
String protoNetworkRootPath) throws ProtoNetworkError {
final String filename = PROTO_NETWORK_FILENAME;
final File file = new File(asPath(protoNetworkRootPath, filename));
ObjectOutputStream oos = null;
try {
oos = new ObjectOutputStream(new FileOutputStream(file));
protoNetwork.writeExternal(oos);
return new BinaryProtoNetworkDescriptor(file);
} catch (IOException e) {
final String name = file.getAbsolutePath();
final String msg =
"Cannot create temporary binary file for proto-network";
throw new ProtoNetworkError(name, msg, e);
} finally {
// clean up IO resources
IOUtils.closeQuietly(oos);
}
}
|
java
|
@Override
public ProtoNetworkDescriptor writeProtoNetwork(ProtoNetwork protoNetwork,
String protoNetworkRootPath) throws ProtoNetworkError {
final String filename = PROTO_NETWORK_FILENAME;
final File file = new File(asPath(protoNetworkRootPath, filename));
ObjectOutputStream oos = null;
try {
oos = new ObjectOutputStream(new FileOutputStream(file));
protoNetwork.writeExternal(oos);
return new BinaryProtoNetworkDescriptor(file);
} catch (IOException e) {
final String name = file.getAbsolutePath();
final String msg =
"Cannot create temporary binary file for proto-network";
throw new ProtoNetworkError(name, msg, e);
} finally {
// clean up IO resources
IOUtils.closeQuietly(oos);
}
}
|
[
"@",
"Override",
"public",
"ProtoNetworkDescriptor",
"writeProtoNetwork",
"(",
"ProtoNetwork",
"protoNetwork",
",",
"String",
"protoNetworkRootPath",
")",
"throws",
"ProtoNetworkError",
"{",
"final",
"String",
"filename",
"=",
"PROTO_NETWORK_FILENAME",
";",
"final",
"File",
"file",
"=",
"new",
"File",
"(",
"asPath",
"(",
"protoNetworkRootPath",
",",
"filename",
")",
")",
";",
"ObjectOutputStream",
"oos",
"=",
"null",
";",
"try",
"{",
"oos",
"=",
"new",
"ObjectOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"file",
")",
")",
";",
"protoNetwork",
".",
"writeExternal",
"(",
"oos",
")",
";",
"return",
"new",
"BinaryProtoNetworkDescriptor",
"(",
"file",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"final",
"String",
"name",
"=",
"file",
".",
"getAbsolutePath",
"(",
")",
";",
"final",
"String",
"msg",
"=",
"\"Cannot create temporary binary file for proto-network\"",
";",
"throw",
"new",
"ProtoNetworkError",
"(",
"name",
",",
"msg",
",",
"e",
")",
";",
"}",
"finally",
"{",
"// clean up IO resources",
"IOUtils",
".",
"closeQuietly",
"(",
"oos",
")",
";",
"}",
"}"
] |
Writes a binary-based proto network and produces a descriptor including
the binary file.
@param protoNetwork {@link ProtoNetwork}, the proto network, which cannot
be null
@param protoNetworkRootPath {@link String}, the root path where proto
network files should be created
@return {@link ProtoNetworkDescriptor}, the proto network descriptor
@throws ProtoNetworkError, if there was an error writing the
{@link ProtoNetwork}
|
[
"Writes",
"a",
"binary",
"-",
"based",
"proto",
"network",
"and",
"produces",
"a",
"descriptor",
"including",
"the",
"binary",
"file",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.core/src/main/java/org/openbel/framework/core/protonetwork/BinaryProtoNetworkExternalizer.java#L126-L146
|
146,243
|
astrapi69/jaulp-wicket
|
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/ajax/editable/tabs/AjaxCloseableTabbedPanel.java
|
AjaxCloseableTabbedPanel.setSelectedTab
|
public AjaxCloseableTabbedPanel<T> setSelectedTab(final int index)
{
if ((index < 0) || (index >= tabs.size()))
{
throw new IndexOutOfBoundsException();
}
setDefaultModelObject(index);
// force the tab's component to be aquired again if already the current tab
currentTab = -1;
setCurrentTab(index);
return this;
}
|
java
|
public AjaxCloseableTabbedPanel<T> setSelectedTab(final int index)
{
if ((index < 0) || (index >= tabs.size()))
{
throw new IndexOutOfBoundsException();
}
setDefaultModelObject(index);
// force the tab's component to be aquired again if already the current tab
currentTab = -1;
setCurrentTab(index);
return this;
}
|
[
"public",
"AjaxCloseableTabbedPanel",
"<",
"T",
">",
"setSelectedTab",
"(",
"final",
"int",
"index",
")",
"{",
"if",
"(",
"(",
"index",
"<",
"0",
")",
"||",
"(",
"index",
">=",
"tabs",
".",
"size",
"(",
")",
")",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
")",
";",
"}",
"setDefaultModelObject",
"(",
"index",
")",
";",
"// force the tab's component to be aquired again if already the current tab",
"currentTab",
"=",
"-",
"1",
";",
"setCurrentTab",
"(",
"index",
")",
";",
"return",
"this",
";",
"}"
] |
sets the selected tab
@param index
index of the tab to select
@return this for chaining
@throws IndexOutOfBoundsException
if index is not in the range of available tabs
|
[
"sets",
"the",
"selected",
"tab"
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/ajax/editable/tabs/AjaxCloseableTabbedPanel.java#L770-L784
|
146,244
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/models/CDownloadRequest.java
|
CDownloadRequest.getHttpHeaders
|
public Headers getHttpHeaders()
{
Headers headers = new Headers();
if ( byteRange != null ) {
StringBuilder rangeBuilder = new StringBuilder( "bytes=" );
long start;
if ( byteRange.offset >= 0 ) {
rangeBuilder.append( byteRange.offset );
start = byteRange.offset;
} else {
start = 1;
}
rangeBuilder.append( "-" );
if ( byteRange.length > 0 ) {
rangeBuilder.append( start + byteRange.length - 1 );
}
Header rangeHeader = new BasicHeader( "Range", rangeBuilder.toString() );
headers.addHeader( rangeHeader );
}
return headers;
}
|
java
|
public Headers getHttpHeaders()
{
Headers headers = new Headers();
if ( byteRange != null ) {
StringBuilder rangeBuilder = new StringBuilder( "bytes=" );
long start;
if ( byteRange.offset >= 0 ) {
rangeBuilder.append( byteRange.offset );
start = byteRange.offset;
} else {
start = 1;
}
rangeBuilder.append( "-" );
if ( byteRange.length > 0 ) {
rangeBuilder.append( start + byteRange.length - 1 );
}
Header rangeHeader = new BasicHeader( "Range", rangeBuilder.toString() );
headers.addHeader( rangeHeader );
}
return headers;
}
|
[
"public",
"Headers",
"getHttpHeaders",
"(",
")",
"{",
"Headers",
"headers",
"=",
"new",
"Headers",
"(",
")",
";",
"if",
"(",
"byteRange",
"!=",
"null",
")",
"{",
"StringBuilder",
"rangeBuilder",
"=",
"new",
"StringBuilder",
"(",
"\"bytes=\"",
")",
";",
"long",
"start",
";",
"if",
"(",
"byteRange",
".",
"offset",
">=",
"0",
")",
"{",
"rangeBuilder",
".",
"append",
"(",
"byteRange",
".",
"offset",
")",
";",
"start",
"=",
"byteRange",
".",
"offset",
";",
"}",
"else",
"{",
"start",
"=",
"1",
";",
"}",
"rangeBuilder",
".",
"append",
"(",
"\"-\"",
")",
";",
"if",
"(",
"byteRange",
".",
"length",
">",
"0",
")",
"{",
"rangeBuilder",
".",
"append",
"(",
"start",
"+",
"byteRange",
".",
"length",
"-",
"1",
")",
";",
"}",
"Header",
"rangeHeader",
"=",
"new",
"BasicHeader",
"(",
"\"Range\"",
",",
"rangeBuilder",
".",
"toString",
"(",
")",
")",
";",
"headers",
".",
"addHeader",
"(",
"rangeHeader",
")",
";",
"}",
"return",
"headers",
";",
"}"
] |
Get the HTTP headers to be used for download request.
Default implementation only handles Range header.
@return The headers
|
[
"Get",
"the",
"HTTP",
"headers",
"to",
"be",
"used",
"for",
"download",
"request",
"."
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/models/CDownloadRequest.java#L62-L85
|
146,245
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/models/CDownloadRequest.java
|
CDownloadRequest.getByteSink
|
public ByteSink getByteSink()
{
ByteSink bs = byteSink;
if ( progressListener != null ) {
bs = new ProgressByteSink( bs, progressListener );
}
return bs;
}
|
java
|
public ByteSink getByteSink()
{
ByteSink bs = byteSink;
if ( progressListener != null ) {
bs = new ProgressByteSink( bs, progressListener );
}
return bs;
}
|
[
"public",
"ByteSink",
"getByteSink",
"(",
")",
"{",
"ByteSink",
"bs",
"=",
"byteSink",
";",
"if",
"(",
"progressListener",
"!=",
"null",
")",
"{",
"bs",
"=",
"new",
"ProgressByteSink",
"(",
"bs",
",",
"progressListener",
")",
";",
"}",
"return",
"bs",
";",
"}"
] |
If no progress listener has been set, return the byte sink defined in constructor, otherwise decorate it.
@return the byte sink to be used for download operations.
|
[
"If",
"no",
"progress",
"listener",
"has",
"been",
"set",
"return",
"the",
"byte",
"sink",
"defined",
"in",
"constructor",
"otherwise",
"decorate",
"it",
"."
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/models/CDownloadRequest.java#L132-L139
|
146,246
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/view/InputMethodUtils.java
|
InputMethodUtils.hide
|
public static void hide(Context context, View v) {
InputMethodManager manager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
manager.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
|
java
|
public static void hide(Context context, View v) {
InputMethodManager manager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
manager.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
|
[
"public",
"static",
"void",
"hide",
"(",
"Context",
"context",
",",
"View",
"v",
")",
"{",
"InputMethodManager",
"manager",
"=",
"(",
"InputMethodManager",
")",
"context",
".",
"getSystemService",
"(",
"Context",
".",
"INPUT_METHOD_SERVICE",
")",
";",
"manager",
".",
"hideSoftInputFromWindow",
"(",
"v",
".",
"getWindowToken",
"(",
")",
",",
"0",
")",
";",
"}"
] |
Hide the software input window.
@param context the context.
@param v the view that holds the window token.
|
[
"Hide",
"the",
"software",
"input",
"window",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/view/InputMethodUtils.java#L36-L39
|
146,247
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/credentials/OAuth2Credentials.java
|
OAuth2Credentials.hasExpired
|
public boolean hasExpired()
{
if ( expiresAt == null ) {
LOGGER.debug( "hasExpired - token is not expirable" );
return false;
}
long now = System.currentTimeMillis();
if ( LOGGER.isDebugEnabled() ) {
LOGGER.debug( "hasExpired? - now: {} expiredAt: {} ", new Date( now ), expiresAt );
}
return now > expiresAt.getTime();
}
|
java
|
public boolean hasExpired()
{
if ( expiresAt == null ) {
LOGGER.debug( "hasExpired - token is not expirable" );
return false;
}
long now = System.currentTimeMillis();
if ( LOGGER.isDebugEnabled() ) {
LOGGER.debug( "hasExpired? - now: {} expiredAt: {} ", new Date( now ), expiresAt );
}
return now > expiresAt.getTime();
}
|
[
"public",
"boolean",
"hasExpired",
"(",
")",
"{",
"if",
"(",
"expiresAt",
"==",
"null",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"hasExpired - token is not expirable\"",
")",
";",
"return",
"false",
";",
"}",
"long",
"now",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"if",
"(",
"LOGGER",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"hasExpired? - now: {} expiredAt: {} \"",
",",
"new",
"Date",
"(",
"now",
")",
",",
"expiresAt",
")",
";",
"}",
"return",
"now",
">",
"expiresAt",
".",
"getTime",
"(",
")",
";",
"}"
] |
Indicates if the access token has expired
@return true if expired, false otherwise
|
[
"Indicates",
"if",
"the",
"access",
"token",
"has",
"expired"
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/credentials/OAuth2Credentials.java#L68-L80
|
146,248
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/credentials/OAuth2Credentials.java
|
OAuth2Credentials.update
|
public void update( JSONObject json )
{
accessToken = json.getString( ACCESS_TOKEN );
tokenType = json.getString( TOKEN_TYPE );
expiresAt = calculateExpiresAt( json );
if ( json.has( OAuth2.REFRESH_TOKEN ) ) {
refreshToken = json.getString( OAuth2.REFRESH_TOKEN );
}
}
|
java
|
public void update( JSONObject json )
{
accessToken = json.getString( ACCESS_TOKEN );
tokenType = json.getString( TOKEN_TYPE );
expiresAt = calculateExpiresAt( json );
if ( json.has( OAuth2.REFRESH_TOKEN ) ) {
refreshToken = json.getString( OAuth2.REFRESH_TOKEN );
}
}
|
[
"public",
"void",
"update",
"(",
"JSONObject",
"json",
")",
"{",
"accessToken",
"=",
"json",
".",
"getString",
"(",
"ACCESS_TOKEN",
")",
";",
"tokenType",
"=",
"json",
".",
"getString",
"(",
"TOKEN_TYPE",
")",
";",
"expiresAt",
"=",
"calculateExpiresAt",
"(",
"json",
")",
";",
"if",
"(",
"json",
".",
"has",
"(",
"OAuth2",
".",
"REFRESH_TOKEN",
")",
")",
"{",
"refreshToken",
"=",
"json",
".",
"getString",
"(",
"OAuth2",
".",
"REFRESH_TOKEN",
")",
";",
"}",
"}"
] |
Update the credentials from a JSON request response.
@param json The JSON object containing the values to update
|
[
"Update",
"the",
"credentials",
"from",
"a",
"JSON",
"request",
"response",
"."
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/credentials/OAuth2Credentials.java#L117-L125
|
146,249
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/credentials/OAuth2Credentials.java
|
OAuth2Credentials.calculateExpiresAt
|
private static Date calculateExpiresAt( JSONObject jsonObj )
{
long expiresAt_s = jsonObj.optLong( OAuth2Credentials.EXPIRES_AT, -1 );
// If nothing specified in json, check if expires_in is present:
// this happens when token is received from oauth server
if ( expiresAt_s < 0 && jsonObj.has( OAuth2Credentials.EXPIRES_IN ) ) {
long expiresIn_s = jsonObj.getLong( OAuth2Credentials.EXPIRES_IN );
// We take a margin to be safe: it appears that some providers do NOT take any margin
// so token will not be early refreshed
if ( expiresIn_s > 6 * 60 ) { // should be always true
expiresIn_s -= 5 * 60; // 5 minutes to be safe
}
expiresAt_s = System.currentTimeMillis() / 1000 + expiresIn_s;
}
if ( expiresAt_s < 0 ) {
return null;
}
return new Date( expiresAt_s * 1000 );
}
|
java
|
private static Date calculateExpiresAt( JSONObject jsonObj )
{
long expiresAt_s = jsonObj.optLong( OAuth2Credentials.EXPIRES_AT, -1 );
// If nothing specified in json, check if expires_in is present:
// this happens when token is received from oauth server
if ( expiresAt_s < 0 && jsonObj.has( OAuth2Credentials.EXPIRES_IN ) ) {
long expiresIn_s = jsonObj.getLong( OAuth2Credentials.EXPIRES_IN );
// We take a margin to be safe: it appears that some providers do NOT take any margin
// so token will not be early refreshed
if ( expiresIn_s > 6 * 60 ) { // should be always true
expiresIn_s -= 5 * 60; // 5 minutes to be safe
}
expiresAt_s = System.currentTimeMillis() / 1000 + expiresIn_s;
}
if ( expiresAt_s < 0 ) {
return null;
}
return new Date( expiresAt_s * 1000 );
}
|
[
"private",
"static",
"Date",
"calculateExpiresAt",
"(",
"JSONObject",
"jsonObj",
")",
"{",
"long",
"expiresAt_s",
"=",
"jsonObj",
".",
"optLong",
"(",
"OAuth2Credentials",
".",
"EXPIRES_AT",
",",
"-",
"1",
")",
";",
"// If nothing specified in json, check if expires_in is present:",
"// this happens when token is received from oauth server",
"if",
"(",
"expiresAt_s",
"<",
"0",
"&&",
"jsonObj",
".",
"has",
"(",
"OAuth2Credentials",
".",
"EXPIRES_IN",
")",
")",
"{",
"long",
"expiresIn_s",
"=",
"jsonObj",
".",
"getLong",
"(",
"OAuth2Credentials",
".",
"EXPIRES_IN",
")",
";",
"// We take a margin to be safe: it appears that some providers do NOT take any margin",
"// so token will not be early refreshed",
"if",
"(",
"expiresIn_s",
">",
"6",
"*",
"60",
")",
"{",
"// should be always true",
"expiresIn_s",
"-=",
"5",
"*",
"60",
";",
"// 5 minutes to be safe",
"}",
"expiresAt_s",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"/",
"1000",
"+",
"expiresIn_s",
";",
"}",
"if",
"(",
"expiresAt_s",
"<",
"0",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"Date",
"(",
"expiresAt_s",
"*",
"1000",
")",
";",
"}"
] |
Calculate expiration timestamp, if not defined.
Several cases: absolute expiration time exists in json, or only relative, or no expiration.
@param jsonObj
@return expiration date, or null if none.
|
[
"Calculate",
"expiration",
"timestamp",
"if",
"not",
"defined",
"."
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/credentials/OAuth2Credentials.java#L135-L154
|
146,250
|
ihaolin/session
|
session-redis/src/main/java/me/hao0/session/redis/RedisExecutor.java
|
RedisExecutor.execute
|
public <V> V execute(RedisCallback<V> cb) {
Jedis jedis = jedisPool.getResource();
boolean success = true;
try {
return cb.execute(jedis);
} catch (JedisException e) {
success = false;
if (jedis != null) {
jedisPool.returnBrokenResource(jedis);
}
throw e;
} finally {
if (success) {
jedisPool.returnResource(jedis);
}
}
}
|
java
|
public <V> V execute(RedisCallback<V> cb) {
Jedis jedis = jedisPool.getResource();
boolean success = true;
try {
return cb.execute(jedis);
} catch (JedisException e) {
success = false;
if (jedis != null) {
jedisPool.returnBrokenResource(jedis);
}
throw e;
} finally {
if (success) {
jedisPool.returnResource(jedis);
}
}
}
|
[
"public",
"<",
"V",
">",
"V",
"execute",
"(",
"RedisCallback",
"<",
"V",
">",
"cb",
")",
"{",
"Jedis",
"jedis",
"=",
"jedisPool",
".",
"getResource",
"(",
")",
";",
"boolean",
"success",
"=",
"true",
";",
"try",
"{",
"return",
"cb",
".",
"execute",
"(",
"jedis",
")",
";",
"}",
"catch",
"(",
"JedisException",
"e",
")",
"{",
"success",
"=",
"false",
";",
"if",
"(",
"jedis",
"!=",
"null",
")",
"{",
"jedisPool",
".",
"returnBrokenResource",
"(",
"jedis",
")",
";",
"}",
"throw",
"e",
";",
"}",
"finally",
"{",
"if",
"(",
"success",
")",
"{",
"jedisPool",
".",
"returnResource",
"(",
"jedis",
")",
";",
"}",
"}",
"}"
] |
execute a redis operation
@param cb callback
@param <V> return type
@return result
|
[
"execute",
"a",
"redis",
"operation"
] |
322c3a9f47b305a39345135fa8163dd7e065b4f8
|
https://github.com/ihaolin/session/blob/322c3a9f47b305a39345135fa8163dd7e065b4f8/session-redis/src/main/java/me/hao0/session/redis/RedisExecutor.java#L47-L63
|
146,251
|
OpenBEL/openbel-framework
|
org.openbel.framework.common/src/main/java/org/openbel/framework/common/record/Column.java
|
Column.encode
|
public byte[] encode(T t) {
if (t == null) {
if (!nullable) {
throw new InvalidArgument("cannot encode a null type");
}
return getNullValue();
}
return encodeType(t);
}
|
java
|
public byte[] encode(T t) {
if (t == null) {
if (!nullable) {
throw new InvalidArgument("cannot encode a null type");
}
return getNullValue();
}
return encodeType(t);
}
|
[
"public",
"byte",
"[",
"]",
"encode",
"(",
"T",
"t",
")",
"{",
"if",
"(",
"t",
"==",
"null",
")",
"{",
"if",
"(",
"!",
"nullable",
")",
"{",
"throw",
"new",
"InvalidArgument",
"(",
"\"cannot encode a null type\"",
")",
";",
"}",
"return",
"getNullValue",
"(",
")",
";",
"}",
"return",
"encodeType",
"(",
"t",
")",
";",
"}"
] |
Encodes the column's type.
@param t {@code <T>}
@return {@code byte[]}
|
[
"Encodes",
"the",
"column",
"s",
"type",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/record/Column.java#L151-L159
|
146,252
|
OpenBEL/openbel-framework
|
org.openbel.framework.common/src/main/java/org/openbel/framework/common/record/Column.java
|
Column.setSize
|
void setSize(int size) {
if (this.size != 0) {
final String fmt = "column size is known: %d";
final String msg = format(fmt, this.size);
throw new IllegalStateException(msg);
}
this.size = size;
this.hash = hash();
}
|
java
|
void setSize(int size) {
if (this.size != 0) {
final String fmt = "column size is known: %d";
final String msg = format(fmt, this.size);
throw new IllegalStateException(msg);
}
this.size = size;
this.hash = hash();
}
|
[
"void",
"setSize",
"(",
"int",
"size",
")",
"{",
"if",
"(",
"this",
".",
"size",
"!=",
"0",
")",
"{",
"final",
"String",
"fmt",
"=",
"\"column size is known: %d\"",
";",
"final",
"String",
"msg",
"=",
"format",
"(",
"fmt",
",",
"this",
".",
"size",
")",
";",
"throw",
"new",
"IllegalStateException",
"(",
"msg",
")",
";",
"}",
"this",
".",
"size",
"=",
"size",
";",
"this",
".",
"hash",
"=",
"hash",
"(",
")",
";",
"}"
] |
Sets the column's size and recalculates its hash.
@param size Number of bytes defining this {@link Column column}
|
[
"Sets",
"the",
"column",
"s",
"size",
"and",
"recalculates",
"its",
"hash",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/record/Column.java#L196-L204
|
146,253
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/sequence/SequenceLabelerEventStream.java
|
SequenceLabelerEventStream.additionalContext
|
public static String[][] additionalContext(final String[] tokens,
final Map<String, String> prevMap) {
final String[][] ac = new String[tokens.length][1];
for (int ti = 0; ti < tokens.length; ti++) {
final String pt = prevMap.get(tokens[ti]);
ac[ti][0] = "pd=" + pt;
}
return ac;
}
|
java
|
public static String[][] additionalContext(final String[] tokens,
final Map<String, String> prevMap) {
final String[][] ac = new String[tokens.length][1];
for (int ti = 0; ti < tokens.length; ti++) {
final String pt = prevMap.get(tokens[ti]);
ac[ti][0] = "pd=" + pt;
}
return ac;
}
|
[
"public",
"static",
"String",
"[",
"]",
"[",
"]",
"additionalContext",
"(",
"final",
"String",
"[",
"]",
"tokens",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"prevMap",
")",
"{",
"final",
"String",
"[",
"]",
"[",
"]",
"ac",
"=",
"new",
"String",
"[",
"tokens",
".",
"length",
"]",
"[",
"1",
"]",
";",
"for",
"(",
"int",
"ti",
"=",
"0",
";",
"ti",
"<",
"tokens",
".",
"length",
";",
"ti",
"++",
")",
"{",
"final",
"String",
"pt",
"=",
"prevMap",
".",
"get",
"(",
"tokens",
"[",
"ti",
"]",
")",
";",
"ac",
"[",
"ti",
"]",
"[",
"0",
"]",
"=",
"\"pd=\"",
"+",
"pt",
";",
"}",
"return",
"ac",
";",
"}"
] |
Generated previous decision features for each token based on contents of
the specified map.
@param tokens
The token for which the context is generated.
@param prevMap
A mapping of tokens to their previous decisions.
@return An additional context array with features for each token.
|
[
"Generated",
"previous",
"decision",
"features",
"for",
"each",
"token",
"based",
"on",
"contents",
"of",
"the",
"specified",
"map",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/sequence/SequenceLabelerEventStream.java#L112-L121
|
146,254
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java
|
BitmapUtils.getSize
|
public static Point getSize(String path) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(path, options);
int width = options.outWidth;
int height = options.outHeight;
return new Point(width, height);
}
|
java
|
public static Point getSize(String path) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(path, options);
int width = options.outWidth;
int height = options.outHeight;
return new Point(width, height);
}
|
[
"public",
"static",
"Point",
"getSize",
"(",
"String",
"path",
")",
"{",
"BitmapFactory",
".",
"Options",
"options",
"=",
"new",
"BitmapFactory",
".",
"Options",
"(",
")",
";",
"options",
".",
"inJustDecodeBounds",
"=",
"true",
";",
"BitmapFactory",
".",
"decodeFile",
"(",
"path",
",",
"options",
")",
";",
"int",
"width",
"=",
"options",
".",
"outWidth",
";",
"int",
"height",
"=",
"options",
".",
"outHeight",
";",
"return",
"new",
"Point",
"(",
"width",
",",
"height",
")",
";",
"}"
] |
Get width and height of the bitmap specified with the file path.
@param path the bitmap file path.
@return the size.
|
[
"Get",
"width",
"and",
"height",
"of",
"the",
"bitmap",
"specified",
"with",
"the",
"file",
"path",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java#L103-L110
|
146,255
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java
|
BitmapUtils.getSize
|
public static Point getSize(byte[] byteArray, int offset, int length) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeByteArray(byteArray, offset, length, options);
int width = options.outWidth;
int height = options.outHeight;
return new Point(width, height);
}
|
java
|
public static Point getSize(byte[] byteArray, int offset, int length) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeByteArray(byteArray, offset, length, options);
int width = options.outWidth;
int height = options.outHeight;
return new Point(width, height);
}
|
[
"public",
"static",
"Point",
"getSize",
"(",
"byte",
"[",
"]",
"byteArray",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"BitmapFactory",
".",
"Options",
"options",
"=",
"new",
"BitmapFactory",
".",
"Options",
"(",
")",
";",
"options",
".",
"inJustDecodeBounds",
"=",
"true",
";",
"BitmapFactory",
".",
"decodeByteArray",
"(",
"byteArray",
",",
"offset",
",",
"length",
",",
"options",
")",
";",
"int",
"width",
"=",
"options",
".",
"outWidth",
";",
"int",
"height",
"=",
"options",
".",
"outHeight",
";",
"return",
"new",
"Point",
"(",
"width",
",",
"height",
")",
";",
"}"
] |
Get width and height of the bitmap specified with the byte array.
@param byteArray the bitmap itself.
@param offset offset index.
@param length array length.
@return the size.
|
[
"Get",
"width",
"and",
"height",
"of",
"the",
"bitmap",
"specified",
"with",
"the",
"byte",
"array",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java#L128-L135
|
146,256
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java
|
BitmapUtils.getSize
|
public static Point getSize(Resources res, int resId) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeResource(res, resId, options);
int width = options.outWidth;
int height = options.outHeight;
return new Point(width, height);
}
|
java
|
public static Point getSize(Resources res, int resId) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeResource(res, resId, options);
int width = options.outWidth;
int height = options.outHeight;
return new Point(width, height);
}
|
[
"public",
"static",
"Point",
"getSize",
"(",
"Resources",
"res",
",",
"int",
"resId",
")",
"{",
"BitmapFactory",
".",
"Options",
"options",
"=",
"new",
"BitmapFactory",
".",
"Options",
"(",
")",
";",
"options",
".",
"inJustDecodeBounds",
"=",
"true",
";",
"BitmapFactory",
".",
"decodeResource",
"(",
"res",
",",
"resId",
",",
"options",
")",
";",
"int",
"width",
"=",
"options",
".",
"outWidth",
";",
"int",
"height",
"=",
"options",
".",
"outHeight",
";",
"return",
"new",
"Point",
"(",
"width",
",",
"height",
")",
";",
"}"
] |
Get width and height of the bitmap specified with the resource id.
@param res resource accessor.
@param resId the resource id of the drawable.
@return the drawable bitmap size.
|
[
"Get",
"width",
"and",
"height",
"of",
"the",
"bitmap",
"specified",
"with",
"the",
"resource",
"id",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java#L153-L160
|
146,257
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java
|
BitmapUtils.toByteArray
|
public static byte[] toByteArray(Bitmap bitmap, Bitmap.CompressFormat format, int quality) {
ByteArrayOutputStream out = null;
try {
out = new ByteArrayOutputStream();
bitmap.compress(format, quality, out);
return out.toByteArray();
} finally {
CloseableUtils.close(out);
}
}
|
java
|
public static byte[] toByteArray(Bitmap bitmap, Bitmap.CompressFormat format, int quality) {
ByteArrayOutputStream out = null;
try {
out = new ByteArrayOutputStream();
bitmap.compress(format, quality, out);
return out.toByteArray();
} finally {
CloseableUtils.close(out);
}
}
|
[
"public",
"static",
"byte",
"[",
"]",
"toByteArray",
"(",
"Bitmap",
"bitmap",
",",
"Bitmap",
".",
"CompressFormat",
"format",
",",
"int",
"quality",
")",
"{",
"ByteArrayOutputStream",
"out",
"=",
"null",
";",
"try",
"{",
"out",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"bitmap",
".",
"compress",
"(",
"format",
",",
"quality",
",",
"out",
")",
";",
"return",
"out",
".",
"toByteArray",
"(",
")",
";",
"}",
"finally",
"{",
"CloseableUtils",
".",
"close",
"(",
"out",
")",
";",
"}",
"}"
] |
Compress the bitmap to the byte array as the specified format and quality.
@param bitmap to compress.
@param format the format.
@param quality the quality of the compressed bitmap.
@return the compressed bitmap byte array.
|
[
"Compress",
"the",
"bitmap",
"to",
"the",
"byte",
"array",
"as",
"the",
"specified",
"format",
"and",
"quality",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java#L169-L178
|
146,258
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java
|
BitmapUtils.shrink
|
public static Bitmap shrink(Bitmap bitmap, float scale) {
if (scale >= 1.0f) {
return bitmap.copy(bitmap.getConfig(), false);
}
Matrix matrix = new Matrix();
matrix.postScale(scale, scale);
return Bitmap.createBitmap(bitmap, 0, 0, (int) (scale * bitmap.getWidth()), (int) (scale * bitmap.getHeight()), matrix, true);
}
|
java
|
public static Bitmap shrink(Bitmap bitmap, float scale) {
if (scale >= 1.0f) {
return bitmap.copy(bitmap.getConfig(), false);
}
Matrix matrix = new Matrix();
matrix.postScale(scale, scale);
return Bitmap.createBitmap(bitmap, 0, 0, (int) (scale * bitmap.getWidth()), (int) (scale * bitmap.getHeight()), matrix, true);
}
|
[
"public",
"static",
"Bitmap",
"shrink",
"(",
"Bitmap",
"bitmap",
",",
"float",
"scale",
")",
"{",
"if",
"(",
"scale",
">=",
"1.0f",
")",
"{",
"return",
"bitmap",
".",
"copy",
"(",
"bitmap",
".",
"getConfig",
"(",
")",
",",
"false",
")",
";",
"}",
"Matrix",
"matrix",
"=",
"new",
"Matrix",
"(",
")",
";",
"matrix",
".",
"postScale",
"(",
"scale",
",",
"scale",
")",
";",
"return",
"Bitmap",
".",
"createBitmap",
"(",
"bitmap",
",",
"0",
",",
"0",
",",
"(",
"int",
")",
"(",
"scale",
"*",
"bitmap",
".",
"getWidth",
"(",
")",
")",
",",
"(",
"int",
")",
"(",
"scale",
"*",
"bitmap",
".",
"getHeight",
"(",
")",
")",
",",
"matrix",
",",
"true",
")",
";",
"}"
] |
Shrink the bitmap to the specified scale.
@param bitmap to shrink.
@param scale the shrink scale, must be < 1.0.
@return the shrunk bitmap.
|
[
"Shrink",
"the",
"bitmap",
"to",
"the",
"specified",
"scale",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java#L186-L195
|
146,259
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java
|
BitmapUtils.storeOnExternalStorage
|
@TargetApi(Build.VERSION_CODES.FROYO)
public static File storeOnExternalStorage(Context context, Bitmap bitmap, String type, String path, String filename, Bitmap.CompressFormat format, int quality) {
if (!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
// we cannot save a bitmap on the external storage on media not mounted.
return null;
}
File dir = new File(context.getExternalFilesDir(type), path);
FileUtils.makeDirsIfNeeded(dir);
File file = new File(dir, filename);
if (!storeAsFile(bitmap, file, format, quality)) {
return null;
}
return file;
}
|
java
|
@TargetApi(Build.VERSION_CODES.FROYO)
public static File storeOnExternalStorage(Context context, Bitmap bitmap, String type, String path, String filename, Bitmap.CompressFormat format, int quality) {
if (!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
// we cannot save a bitmap on the external storage on media not mounted.
return null;
}
File dir = new File(context.getExternalFilesDir(type), path);
FileUtils.makeDirsIfNeeded(dir);
File file = new File(dir, filename);
if (!storeAsFile(bitmap, file, format, quality)) {
return null;
}
return file;
}
|
[
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"FROYO",
")",
"public",
"static",
"File",
"storeOnExternalStorage",
"(",
"Context",
"context",
",",
"Bitmap",
"bitmap",
",",
"String",
"type",
",",
"String",
"path",
",",
"String",
"filename",
",",
"Bitmap",
".",
"CompressFormat",
"format",
",",
"int",
"quality",
")",
"{",
"if",
"(",
"!",
"Environment",
".",
"MEDIA_MOUNTED",
".",
"equals",
"(",
"Environment",
".",
"getExternalStorageState",
"(",
")",
")",
")",
"{",
"// we cannot save a bitmap on the external storage on media not mounted.",
"return",
"null",
";",
"}",
"File",
"dir",
"=",
"new",
"File",
"(",
"context",
".",
"getExternalFilesDir",
"(",
"type",
")",
",",
"path",
")",
";",
"FileUtils",
".",
"makeDirsIfNeeded",
"(",
"dir",
")",
";",
"File",
"file",
"=",
"new",
"File",
"(",
"dir",
",",
"filename",
")",
";",
"if",
"(",
"!",
"storeAsFile",
"(",
"bitmap",
",",
"file",
",",
"format",
",",
"quality",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"file",
";",
"}"
] |
Store the bitmap on the external storage path.
@param context the context.
@param bitmap to store.
@param type type of the bitmap.
@param path file path.
@param filename file name.
@param format bitmap format.
@param quality the quality of the compressed bitmap.
@return the compressed bitmap file.
|
[
"Store",
"the",
"bitmap",
"on",
"the",
"external",
"storage",
"path",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java#L225-L238
|
146,260
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java
|
BitmapUtils.storeOnCacheDir
|
public static File storeOnCacheDir(Context context, Bitmap bitmap, String path, String filename, Bitmap.CompressFormat format, int quality) {
File dir = new File(context.getCacheDir(), path);
FileUtils.makeDirsIfNeeded(dir);
File file = new File(dir, filename);
if (!storeAsFile(bitmap, file, format, quality)) {
return null;
}
return file;
}
|
java
|
public static File storeOnCacheDir(Context context, Bitmap bitmap, String path, String filename, Bitmap.CompressFormat format, int quality) {
File dir = new File(context.getCacheDir(), path);
FileUtils.makeDirsIfNeeded(dir);
File file = new File(dir, filename);
if (!storeAsFile(bitmap, file, format, quality)) {
return null;
}
return file;
}
|
[
"public",
"static",
"File",
"storeOnCacheDir",
"(",
"Context",
"context",
",",
"Bitmap",
"bitmap",
",",
"String",
"path",
",",
"String",
"filename",
",",
"Bitmap",
".",
"CompressFormat",
"format",
",",
"int",
"quality",
")",
"{",
"File",
"dir",
"=",
"new",
"File",
"(",
"context",
".",
"getCacheDir",
"(",
")",
",",
"path",
")",
";",
"FileUtils",
".",
"makeDirsIfNeeded",
"(",
"dir",
")",
";",
"File",
"file",
"=",
"new",
"File",
"(",
"dir",
",",
"filename",
")",
";",
"if",
"(",
"!",
"storeAsFile",
"(",
"bitmap",
",",
"file",
",",
"format",
",",
"quality",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"file",
";",
"}"
] |
Store the bitmap on the cache directory path.
@param context the context.
@param bitmap to store.
@param path file path.
@param filename file name.
@param format bitmap format.
@param quality the quality of the compressed bitmap.
@return the compressed bitmap file.
|
[
"Store",
"the",
"bitmap",
"on",
"the",
"cache",
"directory",
"path",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java#L250-L258
|
146,261
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java
|
BitmapUtils.storeOnApplicationPrivateDir
|
public static boolean storeOnApplicationPrivateDir(Context context, Bitmap bitmap, String filename, Bitmap.CompressFormat format, int quality) {
OutputStream out = null;
try {
out = new BufferedOutputStream(context.openFileOutput(filename, Context.MODE_PRIVATE));
return bitmap.compress(format, quality, out);
} catch (FileNotFoundException e) {
Log.e(TAG, "no such file for saving bitmap: ", e);
return false;
} finally {
CloseableUtils.close(out);
}
}
|
java
|
public static boolean storeOnApplicationPrivateDir(Context context, Bitmap bitmap, String filename, Bitmap.CompressFormat format, int quality) {
OutputStream out = null;
try {
out = new BufferedOutputStream(context.openFileOutput(filename, Context.MODE_PRIVATE));
return bitmap.compress(format, quality, out);
} catch (FileNotFoundException e) {
Log.e(TAG, "no such file for saving bitmap: ", e);
return false;
} finally {
CloseableUtils.close(out);
}
}
|
[
"public",
"static",
"boolean",
"storeOnApplicationPrivateDir",
"(",
"Context",
"context",
",",
"Bitmap",
"bitmap",
",",
"String",
"filename",
",",
"Bitmap",
".",
"CompressFormat",
"format",
",",
"int",
"quality",
")",
"{",
"OutputStream",
"out",
"=",
"null",
";",
"try",
"{",
"out",
"=",
"new",
"BufferedOutputStream",
"(",
"context",
".",
"openFileOutput",
"(",
"filename",
",",
"Context",
".",
"MODE_PRIVATE",
")",
")",
";",
"return",
"bitmap",
".",
"compress",
"(",
"format",
",",
"quality",
",",
"out",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"Log",
".",
"e",
"(",
"TAG",
",",
"\"no such file for saving bitmap: \"",
",",
"e",
")",
";",
"return",
"false",
";",
"}",
"finally",
"{",
"CloseableUtils",
".",
"close",
"(",
"out",
")",
";",
"}",
"}"
] |
Store the bitmap on the application private directory path.
@param context the context.
@param bitmap to store.
@param filename file name.
@param format bitmap format.
@param quality the quality of the compressed bitmap.
@return the compressed bitmap file.
|
[
"Store",
"the",
"bitmap",
"on",
"the",
"application",
"private",
"directory",
"path",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java#L269-L280
|
146,262
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java
|
BitmapUtils.storeAsFile
|
public static boolean storeAsFile(Bitmap bitmap, File file, Bitmap.CompressFormat format, int quality) {
OutputStream out = null;
try {
out = new BufferedOutputStream(new FileOutputStream(file));
return bitmap.compress(format, quality, out);
} catch (FileNotFoundException e) {
Log.e(TAG, "no such file for saving bitmap: ", e);
return false;
} finally {
CloseableUtils.close(out);
}
}
|
java
|
public static boolean storeAsFile(Bitmap bitmap, File file, Bitmap.CompressFormat format, int quality) {
OutputStream out = null;
try {
out = new BufferedOutputStream(new FileOutputStream(file));
return bitmap.compress(format, quality, out);
} catch (FileNotFoundException e) {
Log.e(TAG, "no such file for saving bitmap: ", e);
return false;
} finally {
CloseableUtils.close(out);
}
}
|
[
"public",
"static",
"boolean",
"storeAsFile",
"(",
"Bitmap",
"bitmap",
",",
"File",
"file",
",",
"Bitmap",
".",
"CompressFormat",
"format",
",",
"int",
"quality",
")",
"{",
"OutputStream",
"out",
"=",
"null",
";",
"try",
"{",
"out",
"=",
"new",
"BufferedOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"file",
")",
")",
";",
"return",
"bitmap",
".",
"compress",
"(",
"format",
",",
"quality",
",",
"out",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"Log",
".",
"e",
"(",
"TAG",
",",
"\"no such file for saving bitmap: \"",
",",
"e",
")",
";",
"return",
"false",
";",
"}",
"finally",
"{",
"CloseableUtils",
".",
"close",
"(",
"out",
")",
";",
"}",
"}"
] |
Store the bitmap as a file.
@param bitmap to store.
@param format bitmap format.
@param quality the quality of the compressed bitmap.
@return the compressed bitmap file.
|
[
"Store",
"the",
"bitmap",
"as",
"a",
"file",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java#L289-L300
|
146,263
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/providers/cloudme/CMBlob.java
|
CMBlob.toCBlob
|
public CBlob toCBlob()
{
CBlob cBlob = new CBlob( getPath(), length, contentType );
cBlob.setModificationDate( updated );
return cBlob;
}
|
java
|
public CBlob toCBlob()
{
CBlob cBlob = new CBlob( getPath(), length, contentType );
cBlob.setModificationDate( updated );
return cBlob;
}
|
[
"public",
"CBlob",
"toCBlob",
"(",
")",
"{",
"CBlob",
"cBlob",
"=",
"new",
"CBlob",
"(",
"getPath",
"(",
")",
",",
"length",
",",
"contentType",
")",
";",
"cBlob",
".",
"setModificationDate",
"(",
"updated",
")",
";",
"return",
"cBlob",
";",
"}"
] |
Converts a CloudMe Blob to a generic CBlob
@return CBlob
|
[
"Converts",
"a",
"CloudMe",
"Blob",
"to",
"a",
"generic",
"CBlob"
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/providers/cloudme/CMBlob.java#L57-L63
|
146,264
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/parse/AbstractContextGenerator.java
|
AbstractContextGenerator.punct
|
protected String punct(final Parse punct, final int i) {
final StringBuilder feat = new StringBuilder(5);
feat.append(i).append("=");
feat.append(punct.getCoveredText());
return feat.toString();
}
|
java
|
protected String punct(final Parse punct, final int i) {
final StringBuilder feat = new StringBuilder(5);
feat.append(i).append("=");
feat.append(punct.getCoveredText());
return feat.toString();
}
|
[
"protected",
"String",
"punct",
"(",
"final",
"Parse",
"punct",
",",
"final",
"int",
"i",
")",
"{",
"final",
"StringBuilder",
"feat",
"=",
"new",
"StringBuilder",
"(",
"5",
")",
";",
"feat",
".",
"append",
"(",
"i",
")",
".",
"append",
"(",
"\"=\"",
")",
";",
"feat",
".",
"append",
"(",
"punct",
".",
"getCoveredText",
"(",
")",
")",
";",
"return",
"feat",
".",
"toString",
"(",
")",
";",
"}"
] |
Creates punctuation feature for the specified punctuation at the specified
index based on the punctuation mark.
@param punct
The punctuation which is in context.
@param i
The index of the punctuation with relative to the parse.
@return Punctuation feature for the specified parse and the specified
punctuation at the specfied index.
|
[
"Creates",
"punctuation",
"feature",
"for",
"the",
"specified",
"punctuation",
"at",
"the",
"specified",
"index",
"based",
"on",
"the",
"punctuation",
"mark",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/parse/AbstractContextGenerator.java#L48-L53
|
146,265
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/parse/AbstractContextGenerator.java
|
AbstractContextGenerator.punctbo
|
protected String punctbo(final Parse punct, final int i) {
final StringBuilder feat = new StringBuilder(5);
feat.append(i).append("=");
feat.append(punct.getType());
return feat.toString();
}
|
java
|
protected String punctbo(final Parse punct, final int i) {
final StringBuilder feat = new StringBuilder(5);
feat.append(i).append("=");
feat.append(punct.getType());
return feat.toString();
}
|
[
"protected",
"String",
"punctbo",
"(",
"final",
"Parse",
"punct",
",",
"final",
"int",
"i",
")",
"{",
"final",
"StringBuilder",
"feat",
"=",
"new",
"StringBuilder",
"(",
"5",
")",
";",
"feat",
".",
"append",
"(",
"i",
")",
".",
"append",
"(",
"\"=\"",
")",
";",
"feat",
".",
"append",
"(",
"punct",
".",
"getType",
"(",
")",
")",
";",
"return",
"feat",
".",
"toString",
"(",
")",
";",
"}"
] |
Creates punctuation feature for the specified punctuation at the specfied
index based on the punctuation's tag.
@param punct
The punctuation which is in context.
@param i
The index of the punctuation relative to the parse.
@return Punctuation feature for the specified parse and the specified
punctuation at the specfied index.
|
[
"Creates",
"punctuation",
"feature",
"for",
"the",
"specified",
"punctuation",
"at",
"the",
"specfied",
"index",
"based",
"on",
"the",
"punctuation",
"s",
"tag",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/parse/AbstractContextGenerator.java#L66-L71
|
146,266
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/parse/AbstractContextGenerator.java
|
AbstractContextGenerator.checkcons
|
protected void checkcons(final Parse child, final String i, final String type,
final List<String> features) {
final StringBuilder feat = new StringBuilder(20);
feat.append("c").append(i).append("=").append(child.getType()).append("|")
.append(child.getHead().getCoveredText()).append("|").append(type);
features.add(feat.toString());
feat.setLength(0);
feat.append("c").append(i).append("*=").append(child.getType()).append("|")
.append(type);
features.add(feat.toString());
}
|
java
|
protected void checkcons(final Parse child, final String i, final String type,
final List<String> features) {
final StringBuilder feat = new StringBuilder(20);
feat.append("c").append(i).append("=").append(child.getType()).append("|")
.append(child.getHead().getCoveredText()).append("|").append(type);
features.add(feat.toString());
feat.setLength(0);
feat.append("c").append(i).append("*=").append(child.getType()).append("|")
.append(type);
features.add(feat.toString());
}
|
[
"protected",
"void",
"checkcons",
"(",
"final",
"Parse",
"child",
",",
"final",
"String",
"i",
",",
"final",
"String",
"type",
",",
"final",
"List",
"<",
"String",
">",
"features",
")",
"{",
"final",
"StringBuilder",
"feat",
"=",
"new",
"StringBuilder",
"(",
"20",
")",
";",
"feat",
".",
"append",
"(",
"\"c\"",
")",
".",
"append",
"(",
"i",
")",
".",
"append",
"(",
"\"=\"",
")",
".",
"append",
"(",
"child",
".",
"getType",
"(",
")",
")",
".",
"append",
"(",
"\"|\"",
")",
".",
"append",
"(",
"child",
".",
"getHead",
"(",
")",
".",
"getCoveredText",
"(",
")",
")",
".",
"append",
"(",
"\"|\"",
")",
".",
"append",
"(",
"type",
")",
";",
"features",
".",
"add",
"(",
"feat",
".",
"toString",
"(",
")",
")",
";",
"feat",
".",
"setLength",
"(",
"0",
")",
";",
"feat",
".",
"append",
"(",
"\"c\"",
")",
".",
"append",
"(",
"i",
")",
".",
"append",
"(",
"\"*=\"",
")",
".",
"append",
"(",
"child",
".",
"getType",
"(",
")",
")",
".",
"append",
"(",
"\"|\"",
")",
".",
"append",
"(",
"type",
")",
";",
"features",
".",
"add",
"(",
"feat",
".",
"toString",
"(",
")",
")",
";",
"}"
] |
Produces features to determine whether the specified child node is part of
a complete constituent of the specified type and adds those features to the
specfied list.
@param child
The parse node to consider.
@param i
A string indicating the position of the child node.
@param type
The type of constituent being built.
@param features
List to add features to.
|
[
"Produces",
"features",
"to",
"determine",
"whether",
"the",
"specified",
"child",
"node",
"is",
"part",
"of",
"a",
"complete",
"constituent",
"of",
"the",
"specified",
"type",
"and",
"adds",
"those",
"features",
"to",
"the",
"specfied",
"list",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/parse/AbstractContextGenerator.java#L514-L524
|
146,267
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/parse/AbstractContextGenerator.java
|
AbstractContextGenerator.getFrontierNodes
|
protected void getFrontierNodes(final List<Parse> rf, final Parse[] nodes) {
int leftIndex = 0;
int prevHeadIndex = -1;
for (int fi = 0; fi < rf.size(); fi++) {
final Parse fn = rf.get(fi);
final int headIndex = fn.getHeadIndex();
if (headIndex != prevHeadIndex) {
nodes[leftIndex] = fn;
leftIndex++;
prevHeadIndex = headIndex;
if (leftIndex == nodes.length) {
break;
}
}
}
for (int ni = leftIndex; ni < nodes.length; ni++) {
nodes[ni] = null;
}
}
|
java
|
protected void getFrontierNodes(final List<Parse> rf, final Parse[] nodes) {
int leftIndex = 0;
int prevHeadIndex = -1;
for (int fi = 0; fi < rf.size(); fi++) {
final Parse fn = rf.get(fi);
final int headIndex = fn.getHeadIndex();
if (headIndex != prevHeadIndex) {
nodes[leftIndex] = fn;
leftIndex++;
prevHeadIndex = headIndex;
if (leftIndex == nodes.length) {
break;
}
}
}
for (int ni = leftIndex; ni < nodes.length; ni++) {
nodes[ni] = null;
}
}
|
[
"protected",
"void",
"getFrontierNodes",
"(",
"final",
"List",
"<",
"Parse",
">",
"rf",
",",
"final",
"Parse",
"[",
"]",
"nodes",
")",
"{",
"int",
"leftIndex",
"=",
"0",
";",
"int",
"prevHeadIndex",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"fi",
"=",
"0",
";",
"fi",
"<",
"rf",
".",
"size",
"(",
")",
";",
"fi",
"++",
")",
"{",
"final",
"Parse",
"fn",
"=",
"rf",
".",
"get",
"(",
"fi",
")",
";",
"final",
"int",
"headIndex",
"=",
"fn",
".",
"getHeadIndex",
"(",
")",
";",
"if",
"(",
"headIndex",
"!=",
"prevHeadIndex",
")",
"{",
"nodes",
"[",
"leftIndex",
"]",
"=",
"fn",
";",
"leftIndex",
"++",
";",
"prevHeadIndex",
"=",
"headIndex",
";",
"if",
"(",
"leftIndex",
"==",
"nodes",
".",
"length",
")",
"{",
"break",
";",
"}",
"}",
"}",
"for",
"(",
"int",
"ni",
"=",
"leftIndex",
";",
"ni",
"<",
"nodes",
".",
"length",
";",
"ni",
"++",
")",
"{",
"nodes",
"[",
"ni",
"]",
"=",
"null",
";",
"}",
"}"
] |
Populates specified nodes array with left-most right frontier node with a
unique head. If the right frontier doesn't contain enough nodes, then nulls
are placed in the array elements.
@param rf
The current right frontier.
@param nodes
The array to be populated.
|
[
"Populates",
"specified",
"nodes",
"array",
"with",
"left",
"-",
"most",
"right",
"frontier",
"node",
"with",
"a",
"unique",
"head",
".",
"If",
"the",
"right",
"frontier",
"doesn",
"t",
"contain",
"enough",
"nodes",
"then",
"nulls",
"are",
"placed",
"in",
"the",
"array",
"elements",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/parse/AbstractContextGenerator.java#L559-L578
|
146,268
|
OpenBEL/openbel-framework
|
org.openbel.framework.common/src/main/java/org/openbel/framework/common/protonetwork/model/TermParameterMapTable.java
|
TermParameterMapTable.getParameterIndexes
|
public List<Integer> getParameterIndexes(final int tid) {
List<Integer> ret = termParameterIndex.get(tid);
if (ret == null) {
ret = emptyList();
}
return unmodifiableList(ret);
}
|
java
|
public List<Integer> getParameterIndexes(final int tid) {
List<Integer> ret = termParameterIndex.get(tid);
if (ret == null) {
ret = emptyList();
}
return unmodifiableList(ret);
}
|
[
"public",
"List",
"<",
"Integer",
">",
"getParameterIndexes",
"(",
"final",
"int",
"tid",
")",
"{",
"List",
"<",
"Integer",
">",
"ret",
"=",
"termParameterIndex",
".",
"get",
"(",
"tid",
")",
";",
"if",
"(",
"ret",
"==",
"null",
")",
"{",
"ret",
"=",
"emptyList",
"(",
")",
";",
"}",
"return",
"unmodifiableList",
"(",
"ret",
")",
";",
"}"
] |
Returns the parameter indices for the provided term index.
@param tid Term index
@return The list of parameter indices, which may be empty
|
[
"Returns",
"the",
"parameter",
"indices",
"for",
"the",
"provided",
"term",
"index",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/protonetwork/model/TermParameterMapTable.java#L118-L124
|
146,269
|
OpenBEL/openbel-framework
|
org.openbel.framework.common/src/main/java/org/openbel/framework/common/protonetwork/model/TermParameterMapTable.java
|
TermParameterMapTable.getNumberOfTermParameterMappings
|
public int getNumberOfTermParameterMappings() {
int i = 0;
for (final List<Integer> value : termParameterIndex.values())
i += value.size();
return i;
}
|
java
|
public int getNumberOfTermParameterMappings() {
int i = 0;
for (final List<Integer> value : termParameterIndex.values())
i += value.size();
return i;
}
|
[
"public",
"int",
"getNumberOfTermParameterMappings",
"(",
")",
"{",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"final",
"List",
"<",
"Integer",
">",
"value",
":",
"termParameterIndex",
".",
"values",
"(",
")",
")",
"i",
"+=",
"value",
".",
"size",
"(",
")",
";",
"return",
"i",
";",
"}"
] |
Returns the number of term-parameter mappings
@return int
|
[
"Returns",
"the",
"number",
"of",
"term",
"-",
"parameter",
"mappings"
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/protonetwork/model/TermParameterMapTable.java#L140-L145
|
146,270
|
Danny02/JOpenCTM
|
src/main/java/darwin/jopenctm/io/CtmInputStream.java
|
CtmInputStream.readLittleInt
|
public int readLittleInt() throws IOException {
int ch1 = read();
int ch2 = read();
int ch3 = read();
int ch4 = read();
if ((ch1 | ch2 | ch3 | ch4) < 0) {
throw new EOFException();
}
return (ch1 + (ch2 << 8) + (ch3 << 16) + (ch4 << 24));
}
|
java
|
public int readLittleInt() throws IOException {
int ch1 = read();
int ch2 = read();
int ch3 = read();
int ch4 = read();
if ((ch1 | ch2 | ch3 | ch4) < 0) {
throw new EOFException();
}
return (ch1 + (ch2 << 8) + (ch3 << 16) + (ch4 << 24));
}
|
[
"public",
"int",
"readLittleInt",
"(",
")",
"throws",
"IOException",
"{",
"int",
"ch1",
"=",
"read",
"(",
")",
";",
"int",
"ch2",
"=",
"read",
"(",
")",
";",
"int",
"ch3",
"=",
"read",
"(",
")",
";",
"int",
"ch4",
"=",
"read",
"(",
")",
";",
"if",
"(",
"(",
"ch1",
"|",
"ch2",
"|",
"ch3",
"|",
"ch4",
")",
"<",
"0",
")",
"{",
"throw",
"new",
"EOFException",
"(",
")",
";",
"}",
"return",
"(",
"ch1",
"+",
"(",
"ch2",
"<<",
"8",
")",
"+",
"(",
"ch3",
"<<",
"16",
")",
"+",
"(",
"ch4",
"<<",
"24",
")",
")",
";",
"}"
] |
reads a single integer value, in little endian order
@return read integer value
@throws IOException see {@link InputStream#read()}
|
[
"reads",
"a",
"single",
"integer",
"value",
"in",
"little",
"endian",
"order"
] |
c55a2a2d166a55979190f1bb08214fc84c93008f
|
https://github.com/Danny02/JOpenCTM/blob/c55a2a2d166a55979190f1bb08214fc84c93008f/src/main/java/darwin/jopenctm/io/CtmInputStream.java#L55-L64
|
146,271
|
geomajas/geomajas-project-client-gwt2
|
plugin/corewidget/corewidget/src/main/java/org/geomajas/gwt2/plugin/corewidget/client/map/mapcontrolpanel/MapControlPanelPresenterImpl.java
|
MapControlPanelPresenterImpl.addLayer
|
protected boolean addLayer(Layer layer) {
int index = getLayerIndex(layer);
if (index < 0) {
view.add(new LayerControlPanel(mapPresenter, layer, disableToggleOutOfRange));
return true;
}
return false;
}
|
java
|
protected boolean addLayer(Layer layer) {
int index = getLayerIndex(layer);
if (index < 0) {
view.add(new LayerControlPanel(mapPresenter, layer, disableToggleOutOfRange));
return true;
}
return false;
}
|
[
"protected",
"boolean",
"addLayer",
"(",
"Layer",
"layer",
")",
"{",
"int",
"index",
"=",
"getLayerIndex",
"(",
"layer",
")",
";",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"view",
".",
"add",
"(",
"new",
"LayerControlPanel",
"(",
"mapPresenter",
",",
"layer",
",",
"disableToggleOutOfRange",
")",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Add a layer to the legend drop down panel.
@param layer
The layer who's legend to add to the drop down panel.
@return success or not.
|
[
"Add",
"a",
"layer",
"to",
"the",
"legend",
"drop",
"down",
"panel",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/corewidget/corewidget/src/main/java/org/geomajas/gwt2/plugin/corewidget/client/map/mapcontrolpanel/MapControlPanelPresenterImpl.java#L65-L73
|
146,272
|
geomajas/geomajas-project-client-gwt2
|
plugin/corewidget/corewidget/src/main/java/org/geomajas/gwt2/plugin/corewidget/client/map/mapcontrolpanel/MapControlPanelPresenterImpl.java
|
MapControlPanelPresenterImpl.removeLayer
|
protected boolean removeLayer(Layer layer) {
int index = getLayerIndex(layer);
if (index >= 0) {
//contentPanel.remove(index);
view.removeWidget(index);
return true;
}
return false;
}
|
java
|
protected boolean removeLayer(Layer layer) {
int index = getLayerIndex(layer);
if (index >= 0) {
//contentPanel.remove(index);
view.removeWidget(index);
return true;
}
return false;
}
|
[
"protected",
"boolean",
"removeLayer",
"(",
"Layer",
"layer",
")",
"{",
"int",
"index",
"=",
"getLayerIndex",
"(",
"layer",
")",
";",
"if",
"(",
"index",
">=",
"0",
")",
"{",
"//contentPanel.remove(index);",
"view",
".",
"removeWidget",
"(",
"index",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Remove a layer from the drop down content panel again.
@param layer
The layer to remove.
@return success or not.
|
[
"Remove",
"a",
"layer",
"from",
"the",
"drop",
"down",
"content",
"panel",
"again",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/corewidget/corewidget/src/main/java/org/geomajas/gwt2/plugin/corewidget/client/map/mapcontrolpanel/MapControlPanelPresenterImpl.java#L82-L91
|
146,273
|
astrapi69/jaulp-wicket
|
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/deregistration/DeregistrationPanel.java
|
DeregistrationPanel.newMotivation
|
protected LabeledTextAreaPanel<String, DeregistrationModelBean> newMotivation(final String id,
final IModel<DeregistrationModelBean> model)
{
final IModel<String> labelModel = ResourceModelFactory.newResourceModel(
ResourceBundleKey.builder().key("sem.main.feedback.deregistration.user.label")
.defaultValue("Please confirm the deregistration")
.parameters(ListExtensions.toObjectArray(getDomainName())).build(),
this);
final IModel<String> placeholderModel = ResourceModelFactory.newResourceModel(
"global.enter.your.deregistration.motivation.label", this,
"Enter here your deregistration motivation.");
final LabeledTextAreaPanel<String, DeregistrationModelBean> description = new LabeledTextAreaPanel<String, DeregistrationModelBean>(
id, model, labelModel)
{
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
/**
* {@inheritDoc}
*/
@Override
protected TextArea<String> newTextArea(final String id,
final IModel<DeregistrationModelBean> model)
{
final TextArea<String> textArea = super.newTextArea(id, model);
if (placeholderModel != null)
{
textArea.add(new AttributeAppender("placeholder", placeholderModel));
}
return textArea;
}
};
return description;
}
|
java
|
protected LabeledTextAreaPanel<String, DeregistrationModelBean> newMotivation(final String id,
final IModel<DeregistrationModelBean> model)
{
final IModel<String> labelModel = ResourceModelFactory.newResourceModel(
ResourceBundleKey.builder().key("sem.main.feedback.deregistration.user.label")
.defaultValue("Please confirm the deregistration")
.parameters(ListExtensions.toObjectArray(getDomainName())).build(),
this);
final IModel<String> placeholderModel = ResourceModelFactory.newResourceModel(
"global.enter.your.deregistration.motivation.label", this,
"Enter here your deregistration motivation.");
final LabeledTextAreaPanel<String, DeregistrationModelBean> description = new LabeledTextAreaPanel<String, DeregistrationModelBean>(
id, model, labelModel)
{
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
/**
* {@inheritDoc}
*/
@Override
protected TextArea<String> newTextArea(final String id,
final IModel<DeregistrationModelBean> model)
{
final TextArea<String> textArea = super.newTextArea(id, model);
if (placeholderModel != null)
{
textArea.add(new AttributeAppender("placeholder", placeholderModel));
}
return textArea;
}
};
return description;
}
|
[
"protected",
"LabeledTextAreaPanel",
"<",
"String",
",",
"DeregistrationModelBean",
">",
"newMotivation",
"(",
"final",
"String",
"id",
",",
"final",
"IModel",
"<",
"DeregistrationModelBean",
">",
"model",
")",
"{",
"final",
"IModel",
"<",
"String",
">",
"labelModel",
"=",
"ResourceModelFactory",
".",
"newResourceModel",
"(",
"ResourceBundleKey",
".",
"builder",
"(",
")",
".",
"key",
"(",
"\"sem.main.feedback.deregistration.user.label\"",
")",
".",
"defaultValue",
"(",
"\"Please confirm the deregistration\"",
")",
".",
"parameters",
"(",
"ListExtensions",
".",
"toObjectArray",
"(",
"getDomainName",
"(",
")",
")",
")",
".",
"build",
"(",
")",
",",
"this",
")",
";",
"final",
"IModel",
"<",
"String",
">",
"placeholderModel",
"=",
"ResourceModelFactory",
".",
"newResourceModel",
"(",
"\"global.enter.your.deregistration.motivation.label\"",
",",
"this",
",",
"\"Enter here your deregistration motivation.\"",
")",
";",
"final",
"LabeledTextAreaPanel",
"<",
"String",
",",
"DeregistrationModelBean",
">",
"description",
"=",
"new",
"LabeledTextAreaPanel",
"<",
"String",
",",
"DeregistrationModelBean",
">",
"(",
"id",
",",
"model",
",",
"labelModel",
")",
"{",
"/** The Constant serialVersionUID. */",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"1L",
";",
"/**\n\t\t\t * {@inheritDoc}\n\t\t\t */",
"@",
"Override",
"protected",
"TextArea",
"<",
"String",
">",
"newTextArea",
"(",
"final",
"String",
"id",
",",
"final",
"IModel",
"<",
"DeregistrationModelBean",
">",
"model",
")",
"{",
"final",
"TextArea",
"<",
"String",
">",
"textArea",
"=",
"super",
".",
"newTextArea",
"(",
"id",
",",
"model",
")",
";",
"if",
"(",
"placeholderModel",
"!=",
"null",
")",
"{",
"textArea",
".",
"add",
"(",
"new",
"AttributeAppender",
"(",
"\"placeholder\"",
",",
"placeholderModel",
")",
")",
";",
"}",
"return",
"textArea",
";",
"}",
"}",
";",
"return",
"description",
";",
"}"
] |
Factory method for creating the LabeledTextAreaPanel. 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",
"LabeledTextAreaPanel",
".",
"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/deregistration/DeregistrationPanel.java#L202-L235
|
146,274
|
OpenBEL/openbel-framework
|
org.openbel.framework.common/src/main/java/org/openbel/framework/common/cfg/SystemConfiguration.java
|
SystemConfiguration.createSystemConfiguration
|
public static synchronized SystemConfiguration createSystemConfiguration()
throws IOException {
if (self == null) {
if (getenv(BELFRAMEWORK_HOME_ENV_VAR) == null) {
String err = MISSING_SYSCFG;
err = err.concat(": environment variable not set ");
err = err.concat(BELFRAMEWORK_HOME_ENV_VAR);
throw new IOException(err);
}
self = new SystemConfiguration();
}
return self;
}
|
java
|
public static synchronized SystemConfiguration createSystemConfiguration()
throws IOException {
if (self == null) {
if (getenv(BELFRAMEWORK_HOME_ENV_VAR) == null) {
String err = MISSING_SYSCFG;
err = err.concat(": environment variable not set ");
err = err.concat(BELFRAMEWORK_HOME_ENV_VAR);
throw new IOException(err);
}
self = new SystemConfiguration();
}
return self;
}
|
[
"public",
"static",
"synchronized",
"SystemConfiguration",
"createSystemConfiguration",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"self",
"==",
"null",
")",
"{",
"if",
"(",
"getenv",
"(",
"BELFRAMEWORK_HOME_ENV_VAR",
")",
"==",
"null",
")",
"{",
"String",
"err",
"=",
"MISSING_SYSCFG",
";",
"err",
"=",
"err",
".",
"concat",
"(",
"\": environment variable not set \"",
")",
";",
"err",
"=",
"err",
".",
"concat",
"(",
"BELFRAMEWORK_HOME_ENV_VAR",
")",
";",
"throw",
"new",
"IOException",
"(",
"err",
")",
";",
"}",
"self",
"=",
"new",
"SystemConfiguration",
"(",
")",
";",
"}",
"return",
"self",
";",
"}"
] |
Creates the system configuration as defined by the environment.
@return {@link SystemConfiguration}
@throws IOException Thrown if an I/O error occurs
|
[
"Creates",
"the",
"system",
"configuration",
"as",
"defined",
"by",
"the",
"environment",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/cfg/SystemConfiguration.java#L215-L227
|
146,275
|
OpenBEL/openbel-framework
|
org.openbel.framework.common/src/main/java/org/openbel/framework/common/cfg/SystemConfiguration.java
|
SystemConfiguration.main
|
public static void main(String... args) {
final String cfgpath = "../docs/configuration/belframework.cfg";
final File cfgfile = new File(cfgpath);
try {
SystemConfiguration syscfg = createSystemConfiguration(cfgfile);
out.println(syscfg.defaultConfiguration());
} catch (IOException e) {
e.printStackTrace();
}
}
|
java
|
public static void main(String... args) {
final String cfgpath = "../docs/configuration/belframework.cfg";
final File cfgfile = new File(cfgpath);
try {
SystemConfiguration syscfg = createSystemConfiguration(cfgfile);
out.println(syscfg.defaultConfiguration());
} catch (IOException e) {
e.printStackTrace();
}
}
|
[
"public",
"static",
"void",
"main",
"(",
"String",
"...",
"args",
")",
"{",
"final",
"String",
"cfgpath",
"=",
"\"../docs/configuration/belframework.cfg\"",
";",
"final",
"File",
"cfgfile",
"=",
"new",
"File",
"(",
"cfgpath",
")",
";",
"try",
"{",
"SystemConfiguration",
"syscfg",
"=",
"createSystemConfiguration",
"(",
"cfgfile",
")",
";",
"out",
".",
"println",
"(",
"syscfg",
".",
"defaultConfiguration",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] |
Prints the default system configuration.
@param args Ignored command-line arguments
|
[
"Prints",
"the",
"default",
"system",
"configuration",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/cfg/SystemConfiguration.java#L581-L590
|
146,276
|
geomajas/geomajas-project-client-gwt2
|
server-extension/src/main/java/org/geomajas/gwt2/client/controller/FeatureSelectionController.java
|
FeatureSelectionController.searchAtLocation
|
private void searchAtLocation(Coordinate location, boolean isShift) {
Geometry point = new Geometry(Geometry.POINT, 0, -1);
point.setCoordinates(new Coordinate[] { location });
GeomajasServerExtension
.getInstance()
.getServerFeatureService()
.search(mapPresenter, point, pixelsToUnits(pixelTolerance), QueryType.INTERSECTS, searchLayerType, -1,
new SelectionCallback(isShift, false));
}
|
java
|
private void searchAtLocation(Coordinate location, boolean isShift) {
Geometry point = new Geometry(Geometry.POINT, 0, -1);
point.setCoordinates(new Coordinate[] { location });
GeomajasServerExtension
.getInstance()
.getServerFeatureService()
.search(mapPresenter, point, pixelsToUnits(pixelTolerance), QueryType.INTERSECTS, searchLayerType, -1,
new SelectionCallback(isShift, false));
}
|
[
"private",
"void",
"searchAtLocation",
"(",
"Coordinate",
"location",
",",
"boolean",
"isShift",
")",
"{",
"Geometry",
"point",
"=",
"new",
"Geometry",
"(",
"Geometry",
".",
"POINT",
",",
"0",
",",
"-",
"1",
")",
";",
"point",
".",
"setCoordinates",
"(",
"new",
"Coordinate",
"[",
"]",
"{",
"location",
"}",
")",
";",
"GeomajasServerExtension",
".",
"getInstance",
"(",
")",
".",
"getServerFeatureService",
"(",
")",
".",
"search",
"(",
"mapPresenter",
",",
"point",
",",
"pixelsToUnits",
"(",
"pixelTolerance",
")",
",",
"QueryType",
".",
"INTERSECTS",
",",
"searchLayerType",
",",
"-",
"1",
",",
"new",
"SelectionCallback",
"(",
"isShift",
",",
"false",
")",
")",
";",
"}"
] |
Search for features at a certain location.
@param location
The location to check.
@param isShift
Is the shift button pressed down?
|
[
"Search",
"for",
"features",
"at",
"a",
"certain",
"location",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/server-extension/src/main/java/org/geomajas/gwt2/client/controller/FeatureSelectionController.java#L275-L284
|
146,277
|
geomajas/geomajas-project-client-gwt2
|
server-extension/src/main/java/org/geomajas/gwt2/client/controller/FeatureSelectionController.java
|
FeatureSelectionController.pixelsToUnits
|
private double pixelsToUnits(int pixels) {
Coordinate c1 = mapPresenter.getViewPort().getTransformationService()
.transform(new Coordinate(0, 0), RenderSpace.SCREEN, RenderSpace.WORLD);
Coordinate c2 = mapPresenter.getViewPort().getTransformationService()
.transform(new Coordinate(pixels, 0), RenderSpace.SCREEN, RenderSpace.WORLD);
return MathService.distance(c1, c2);
}
|
java
|
private double pixelsToUnits(int pixels) {
Coordinate c1 = mapPresenter.getViewPort().getTransformationService()
.transform(new Coordinate(0, 0), RenderSpace.SCREEN, RenderSpace.WORLD);
Coordinate c2 = mapPresenter.getViewPort().getTransformationService()
.transform(new Coordinate(pixels, 0), RenderSpace.SCREEN, RenderSpace.WORLD);
return MathService.distance(c1, c2);
}
|
[
"private",
"double",
"pixelsToUnits",
"(",
"int",
"pixels",
")",
"{",
"Coordinate",
"c1",
"=",
"mapPresenter",
".",
"getViewPort",
"(",
")",
".",
"getTransformationService",
"(",
")",
".",
"transform",
"(",
"new",
"Coordinate",
"(",
"0",
",",
"0",
")",
",",
"RenderSpace",
".",
"SCREEN",
",",
"RenderSpace",
".",
"WORLD",
")",
";",
"Coordinate",
"c2",
"=",
"mapPresenter",
".",
"getViewPort",
"(",
")",
".",
"getTransformationService",
"(",
")",
".",
"transform",
"(",
"new",
"Coordinate",
"(",
"pixels",
",",
"0",
")",
",",
"RenderSpace",
".",
"SCREEN",
",",
"RenderSpace",
".",
"WORLD",
")",
";",
"return",
"MathService",
".",
"distance",
"(",
"c1",
",",
"c2",
")",
";",
"}"
] |
Transform a pixel-length into a real-life distance expressed in map CRS. This depends on the current map scale.
@param pixels
The number of pixels to calculate the distance for.
@return The distance the given number of pixels entails.
|
[
"Transform",
"a",
"pixel",
"-",
"length",
"into",
"a",
"real",
"-",
"life",
"distance",
"expressed",
"in",
"map",
"CRS",
".",
"This",
"depends",
"on",
"the",
"current",
"map",
"scale",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/server-extension/src/main/java/org/geomajas/gwt2/client/controller/FeatureSelectionController.java#L293-L299
|
146,278
|
ihaolin/session
|
session-api/src/main/java/me/hao0/session/util/PropertiesReader.java
|
PropertiesReader.read
|
public static final Properties read(String classpath) throws IOException{
final URL url = Resources.getResource(classpath);
final ByteSource byteSource = Resources.asByteSource(url);
final Properties properties = new Properties();
InputStream inputStream = null;
try {
inputStream = byteSource.openBufferedStream();
properties.load(inputStream);
} catch (final IOException ioException) {
ioException.printStackTrace();
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (final IOException ioException) {
throw ioException;
}
}
}
return properties;
}
|
java
|
public static final Properties read(String classpath) throws IOException{
final URL url = Resources.getResource(classpath);
final ByteSource byteSource = Resources.asByteSource(url);
final Properties properties = new Properties();
InputStream inputStream = null;
try {
inputStream = byteSource.openBufferedStream();
properties.load(inputStream);
} catch (final IOException ioException) {
ioException.printStackTrace();
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (final IOException ioException) {
throw ioException;
}
}
}
return properties;
}
|
[
"public",
"static",
"final",
"Properties",
"read",
"(",
"String",
"classpath",
")",
"throws",
"IOException",
"{",
"final",
"URL",
"url",
"=",
"Resources",
".",
"getResource",
"(",
"classpath",
")",
";",
"final",
"ByteSource",
"byteSource",
"=",
"Resources",
".",
"asByteSource",
"(",
"url",
")",
";",
"final",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"InputStream",
"inputStream",
"=",
"null",
";",
"try",
"{",
"inputStream",
"=",
"byteSource",
".",
"openBufferedStream",
"(",
")",
";",
"properties",
".",
"load",
"(",
"inputStream",
")",
";",
"}",
"catch",
"(",
"final",
"IOException",
"ioException",
")",
"{",
"ioException",
".",
"printStackTrace",
"(",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"inputStream",
"!=",
"null",
")",
"{",
"try",
"{",
"inputStream",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"IOException",
"ioException",
")",
"{",
"throw",
"ioException",
";",
"}",
"}",
"}",
"return",
"properties",
";",
"}"
] |
read properties from classpath
@param classpath properties file classpath
@return Properties object
@throws java.io.IOException
|
[
"read",
"properties",
"from",
"classpath"
] |
322c3a9f47b305a39345135fa8163dd7e065b4f8
|
https://github.com/ihaolin/session/blob/322c3a9f47b305a39345135fa8163dd7e065b4f8/session-api/src/main/java/me/hao0/session/util/PropertiesReader.java#L21-L41
|
146,279
|
geomajas/geomajas-project-client-gwt2
|
impl/src/main/java/org/geomajas/gwt2/client/controller/ZoomToRectangleController.java
|
ZoomToRectangleController.execute
|
public void execute(Bbox worldBounds) {
View endView = mapPresenter.getViewPort().asView(worldBounds, ZoomOption.LEVEL_CLOSEST);
mapPresenter.getViewPort().registerAnimation(NavigationAnimationFactory.createZoomIn(mapPresenter, endView));
}
|
java
|
public void execute(Bbox worldBounds) {
View endView = mapPresenter.getViewPort().asView(worldBounds, ZoomOption.LEVEL_CLOSEST);
mapPresenter.getViewPort().registerAnimation(NavigationAnimationFactory.createZoomIn(mapPresenter, endView));
}
|
[
"public",
"void",
"execute",
"(",
"Bbox",
"worldBounds",
")",
"{",
"View",
"endView",
"=",
"mapPresenter",
".",
"getViewPort",
"(",
")",
".",
"asView",
"(",
"worldBounds",
",",
"ZoomOption",
".",
"LEVEL_CLOSEST",
")",
";",
"mapPresenter",
".",
"getViewPort",
"(",
")",
".",
"registerAnimation",
"(",
"NavigationAnimationFactory",
".",
"createZoomIn",
"(",
"mapPresenter",
",",
"endView",
")",
")",
";",
"}"
] |
Effectively zoom to the bounds that the user drew on the map.
@param worldBounds
The result of the user's dragging on the map, expressed in world space.
|
[
"Effectively",
"zoom",
"to",
"the",
"bounds",
"that",
"the",
"user",
"drew",
"on",
"the",
"map",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/impl/src/main/java/org/geomajas/gwt2/client/controller/ZoomToRectangleController.java#L32-L35
|
146,280
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/features/XMLFeatureDescriptor.java
|
XMLFeatureDescriptor.setWindow
|
public static void setWindow(final TrainingParameters params) {
if (leftWindow == -1 || rightWindow == -1) {
leftWindow = getWindowRange(params).get(0);
rightWindow = getWindowRange(params).get(1);
}
}
|
java
|
public static void setWindow(final TrainingParameters params) {
if (leftWindow == -1 || rightWindow == -1) {
leftWindow = getWindowRange(params).get(0);
rightWindow = getWindowRange(params).get(1);
}
}
|
[
"public",
"static",
"void",
"setWindow",
"(",
"final",
"TrainingParameters",
"params",
")",
"{",
"if",
"(",
"leftWindow",
"==",
"-",
"1",
"||",
"rightWindow",
"==",
"-",
"1",
")",
"{",
"leftWindow",
"=",
"getWindowRange",
"(",
"params",
")",
".",
"get",
"(",
"0",
")",
";",
"rightWindow",
"=",
"getWindowRange",
"(",
"params",
")",
".",
"get",
"(",
"1",
")",
";",
"}",
"}"
] |
Set the window length from the training parameters file.
@param params
the properties file
|
[
"Set",
"the",
"window",
"length",
"from",
"the",
"training",
"parameters",
"file",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/features/XMLFeatureDescriptor.java#L545-L550
|
146,281
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/features/XMLFeatureDescriptor.java
|
XMLFeatureDescriptor.getWindowRange
|
private static List<Integer> getWindowRange(final TrainingParameters params) {
final List<Integer> windowRange = new ArrayList<Integer>();
final String windowParam = Flags.getWindow(params);
final String[] windowArray = windowParam.split("[ :-]");
if (windowArray.length == 2) {
windowRange.add(Integer.parseInt(windowArray[0]));
windowRange.add(Integer.parseInt(windowArray[1]));
}
return windowRange;
}
|
java
|
private static List<Integer> getWindowRange(final TrainingParameters params) {
final List<Integer> windowRange = new ArrayList<Integer>();
final String windowParam = Flags.getWindow(params);
final String[] windowArray = windowParam.split("[ :-]");
if (windowArray.length == 2) {
windowRange.add(Integer.parseInt(windowArray[0]));
windowRange.add(Integer.parseInt(windowArray[1]));
}
return windowRange;
}
|
[
"private",
"static",
"List",
"<",
"Integer",
">",
"getWindowRange",
"(",
"final",
"TrainingParameters",
"params",
")",
"{",
"final",
"List",
"<",
"Integer",
">",
"windowRange",
"=",
"new",
"ArrayList",
"<",
"Integer",
">",
"(",
")",
";",
"final",
"String",
"windowParam",
"=",
"Flags",
".",
"getWindow",
"(",
"params",
")",
";",
"final",
"String",
"[",
"]",
"windowArray",
"=",
"windowParam",
".",
"split",
"(",
"\"[ :-]\"",
")",
";",
"if",
"(",
"windowArray",
".",
"length",
"==",
"2",
")",
"{",
"windowRange",
".",
"add",
"(",
"Integer",
".",
"parseInt",
"(",
"windowArray",
"[",
"0",
"]",
")",
")",
";",
"windowRange",
".",
"add",
"(",
"Integer",
".",
"parseInt",
"(",
"windowArray",
"[",
"1",
"]",
")",
")",
";",
"}",
"return",
"windowRange",
";",
"}"
] |
Get the window range feature.
@param params
the training parameters
@return the list containing the left and right window values
|
[
"Get",
"the",
"window",
"range",
"feature",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/features/XMLFeatureDescriptor.java#L559-L568
|
146,282
|
maxschuster/Vaadin-SignatureField
|
vaadin-signaturefield/src/main/java/eu/maxschuster/vaadin/signaturefield/SignatureField.java
|
SignatureField.initExtension
|
private SignatureFieldExtension initExtension() {
SignatureFieldExtension ext = new SignatureFieldExtension(this);
ext.addSignatureChangeListener(new SignatureFieldExtension.SignatureChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void signatureChange(SignatureFieldExtension.SignatureChangeEvent event) {
changingVariables = true;
try {
setValue(event.getSignature(), true);
} finally {
changingVariables = false;
}
}
});
return ext;
}
|
java
|
private SignatureFieldExtension initExtension() {
SignatureFieldExtension ext = new SignatureFieldExtension(this);
ext.addSignatureChangeListener(new SignatureFieldExtension.SignatureChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void signatureChange(SignatureFieldExtension.SignatureChangeEvent event) {
changingVariables = true;
try {
setValue(event.getSignature(), true);
} finally {
changingVariables = false;
}
}
});
return ext;
}
|
[
"private",
"SignatureFieldExtension",
"initExtension",
"(",
")",
"{",
"SignatureFieldExtension",
"ext",
"=",
"new",
"SignatureFieldExtension",
"(",
"this",
")",
";",
"ext",
".",
"addSignatureChangeListener",
"(",
"new",
"SignatureFieldExtension",
".",
"SignatureChangeListener",
"(",
")",
"{",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"1L",
";",
"@",
"Override",
"public",
"void",
"signatureChange",
"(",
"SignatureFieldExtension",
".",
"SignatureChangeEvent",
"event",
")",
"{",
"changingVariables",
"=",
"true",
";",
"try",
"{",
"setValue",
"(",
"event",
".",
"getSignature",
"(",
")",
",",
"true",
")",
";",
"}",
"finally",
"{",
"changingVariables",
"=",
"false",
";",
"}",
"}",
"}",
")",
";",
"return",
"ext",
";",
"}"
] |
Creates the javascript extension used to communicate with the
client-side.
@return The extension of this field
|
[
"Creates",
"the",
"javascript",
"extension",
"used",
"to",
"communicate",
"with",
"the",
"client",
"-",
"side",
"."
] |
b6f6b7042ea9c46060af54bd92d21770abfcccee
|
https://github.com/maxschuster/Vaadin-SignatureField/blob/b6f6b7042ea9c46060af54bd92d21770abfcccee/vaadin-signaturefield/src/main/java/eu/maxschuster/vaadin/signaturefield/SignatureField.java#L143-L160
|
146,283
|
maxschuster/Vaadin-SignatureField
|
vaadin-signaturefield/src/main/java/eu/maxschuster/vaadin/signaturefield/SignatureField.java
|
SignatureField.setInternalValue
|
protected void setInternalValue(String newValue, boolean repaintIsNotNeeded) {
super.setInternalValue(newValue);
extension.setSignature(newValue, changingVariables || repaintIsNotNeeded);
}
|
java
|
protected void setInternalValue(String newValue, boolean repaintIsNotNeeded) {
super.setInternalValue(newValue);
extension.setSignature(newValue, changingVariables || repaintIsNotNeeded);
}
|
[
"protected",
"void",
"setInternalValue",
"(",
"String",
"newValue",
",",
"boolean",
"repaintIsNotNeeded",
")",
"{",
"super",
".",
"setInternalValue",
"(",
"newValue",
")",
";",
"extension",
".",
"setSignature",
"(",
"newValue",
",",
"changingVariables",
"||",
"repaintIsNotNeeded",
")",
";",
"}"
] |
Sets the internal field value. May sends the value to the client-side.
@param newValue
the new value to be set.
@param repaintIsNotNeeded
the new value should not be send to the client-side
|
[
"Sets",
"the",
"internal",
"field",
"value",
".",
"May",
"sends",
"the",
"value",
"to",
"the",
"client",
"-",
"side",
"."
] |
b6f6b7042ea9c46060af54bd92d21770abfcccee
|
https://github.com/maxschuster/Vaadin-SignatureField/blob/b6f6b7042ea9c46060af54bd92d21770abfcccee/vaadin-signaturefield/src/main/java/eu/maxschuster/vaadin/signaturefield/SignatureField.java#L205-L208
|
146,284
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/providers/googledrive/RemotePath.java
|
RemotePath.getDeepestFolderId
|
public String getDeepestFolderId()
{
if ( filesChain.isEmpty() ) {
return "root";
}
JSONObject last = filesChain.getLast();
if ( GoogleDrive.MIME_TYPE_DIRECTORY.equals( last.getString( "mimeType" ) ) ) {
return last.getString( "id" );
}
// If last is a blob, we return the parent id :
if ( filesChain.size() == 1 ) {
return "root";
}
return filesChain.get( filesChain.size() - 2 ).getString( "id" );
}
|
java
|
public String getDeepestFolderId()
{
if ( filesChain.isEmpty() ) {
return "root";
}
JSONObject last = filesChain.getLast();
if ( GoogleDrive.MIME_TYPE_DIRECTORY.equals( last.getString( "mimeType" ) ) ) {
return last.getString( "id" );
}
// If last is a blob, we return the parent id :
if ( filesChain.size() == 1 ) {
return "root";
}
return filesChain.get( filesChain.size() - 2 ).getString( "id" );
}
|
[
"public",
"String",
"getDeepestFolderId",
"(",
")",
"{",
"if",
"(",
"filesChain",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"\"root\"",
";",
"}",
"JSONObject",
"last",
"=",
"filesChain",
".",
"getLast",
"(",
")",
";",
"if",
"(",
"GoogleDrive",
".",
"MIME_TYPE_DIRECTORY",
".",
"equals",
"(",
"last",
".",
"getString",
"(",
"\"mimeType\"",
")",
")",
")",
"{",
"return",
"last",
".",
"getString",
"(",
"\"id\"",
")",
";",
"}",
"// If last is a blob, we return the parent id :",
"if",
"(",
"filesChain",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"return",
"\"root\"",
";",
"}",
"return",
"filesChain",
".",
"get",
"(",
"filesChain",
".",
"size",
"(",
")",
"-",
"2",
")",
".",
"getString",
"(",
"\"id\"",
")",
";",
"}"
] |
If this remote path does not exist, this is the last existing id, or 'root'.
@return id of deepest folder in filesChain, or "root" if filesChain is empty
@throws IllegalStateException if last segment is a blob
|
[
"If",
"this",
"remote",
"path",
"does",
"not",
"exist",
"this",
"is",
"the",
"last",
"existing",
"id",
"or",
"root",
"."
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/providers/googledrive/RemotePath.java#L73-L87
|
146,285
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/oauth/OAuth2SessionManager.java
|
OAuth2SessionManager.fetchUserCredentials
|
UserCredentials fetchUserCredentials( String code )
{
HttpPost post = new HttpPost( accessTokenUrl );
List<NameValuePair> parameters = new ArrayList<NameValuePair>();
parameters.add( new BasicNameValuePair( OAuth2.CLIENT_ID, appInfo.getAppId() ) );
parameters.add( new BasicNameValuePair( OAuth2.CLIENT_SECRET, appInfo.getAppSecret() ) );
parameters.add( new BasicNameValuePair( OAuth2.CODE, code ) );
parameters.add( new BasicNameValuePair( OAuth2.GRANT_TYPE, OAuth2.AUTHORIZATION_CODE ) );
if ( appInfo.getRedirectUrl() != null ) {
parameters.add( new BasicNameValuePair( OAuth2.REDIRECT_URI, appInfo.getRedirectUrl() ) );
}
try {
post.setEntity( new UrlEncodedFormEntity( parameters, PcsUtils.UTF8.name() ) );
} catch ( UnsupportedEncodingException ex ) {
throw new CStorageException( "Can't encode parameters", ex );
}
HttpResponse response;
try {
response = httpClient.execute( post );
} catch ( IOException e ) {
throw new CStorageException( "HTTP request while fetching token has failed", e );
}
// FIXME check status code here
final String json;
try {
json = EntityUtils.toString( response.getEntity(), PcsUtils.UTF8.name() );
} catch ( IOException e ) {
throw new CStorageException( "Can't retrieve json string in HTTP response entity", e );
}
LOGGER.debug( "fetchUserCredentials - json: {}", json );
Credentials credentials = Credentials.createFromJson( json );
userCredentials = new UserCredentials( appInfo,
null, // userId is unknown yet
credentials );
return userCredentials;
}
|
java
|
UserCredentials fetchUserCredentials( String code )
{
HttpPost post = new HttpPost( accessTokenUrl );
List<NameValuePair> parameters = new ArrayList<NameValuePair>();
parameters.add( new BasicNameValuePair( OAuth2.CLIENT_ID, appInfo.getAppId() ) );
parameters.add( new BasicNameValuePair( OAuth2.CLIENT_SECRET, appInfo.getAppSecret() ) );
parameters.add( new BasicNameValuePair( OAuth2.CODE, code ) );
parameters.add( new BasicNameValuePair( OAuth2.GRANT_TYPE, OAuth2.AUTHORIZATION_CODE ) );
if ( appInfo.getRedirectUrl() != null ) {
parameters.add( new BasicNameValuePair( OAuth2.REDIRECT_URI, appInfo.getRedirectUrl() ) );
}
try {
post.setEntity( new UrlEncodedFormEntity( parameters, PcsUtils.UTF8.name() ) );
} catch ( UnsupportedEncodingException ex ) {
throw new CStorageException( "Can't encode parameters", ex );
}
HttpResponse response;
try {
response = httpClient.execute( post );
} catch ( IOException e ) {
throw new CStorageException( "HTTP request while fetching token has failed", e );
}
// FIXME check status code here
final String json;
try {
json = EntityUtils.toString( response.getEntity(), PcsUtils.UTF8.name() );
} catch ( IOException e ) {
throw new CStorageException( "Can't retrieve json string in HTTP response entity", e );
}
LOGGER.debug( "fetchUserCredentials - json: {}", json );
Credentials credentials = Credentials.createFromJson( json );
userCredentials = new UserCredentials( appInfo,
null, // userId is unknown yet
credentials );
return userCredentials;
}
|
[
"UserCredentials",
"fetchUserCredentials",
"(",
"String",
"code",
")",
"{",
"HttpPost",
"post",
"=",
"new",
"HttpPost",
"(",
"accessTokenUrl",
")",
";",
"List",
"<",
"NameValuePair",
">",
"parameters",
"=",
"new",
"ArrayList",
"<",
"NameValuePair",
">",
"(",
")",
";",
"parameters",
".",
"add",
"(",
"new",
"BasicNameValuePair",
"(",
"OAuth2",
".",
"CLIENT_ID",
",",
"appInfo",
".",
"getAppId",
"(",
")",
")",
")",
";",
"parameters",
".",
"add",
"(",
"new",
"BasicNameValuePair",
"(",
"OAuth2",
".",
"CLIENT_SECRET",
",",
"appInfo",
".",
"getAppSecret",
"(",
")",
")",
")",
";",
"parameters",
".",
"add",
"(",
"new",
"BasicNameValuePair",
"(",
"OAuth2",
".",
"CODE",
",",
"code",
")",
")",
";",
"parameters",
".",
"add",
"(",
"new",
"BasicNameValuePair",
"(",
"OAuth2",
".",
"GRANT_TYPE",
",",
"OAuth2",
".",
"AUTHORIZATION_CODE",
")",
")",
";",
"if",
"(",
"appInfo",
".",
"getRedirectUrl",
"(",
")",
"!=",
"null",
")",
"{",
"parameters",
".",
"add",
"(",
"new",
"BasicNameValuePair",
"(",
"OAuth2",
".",
"REDIRECT_URI",
",",
"appInfo",
".",
"getRedirectUrl",
"(",
")",
")",
")",
";",
"}",
"try",
"{",
"post",
".",
"setEntity",
"(",
"new",
"UrlEncodedFormEntity",
"(",
"parameters",
",",
"PcsUtils",
".",
"UTF8",
".",
"name",
"(",
")",
")",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"ex",
")",
"{",
"throw",
"new",
"CStorageException",
"(",
"\"Can't encode parameters\"",
",",
"ex",
")",
";",
"}",
"HttpResponse",
"response",
";",
"try",
"{",
"response",
"=",
"httpClient",
".",
"execute",
"(",
"post",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"CStorageException",
"(",
"\"HTTP request while fetching token has failed\"",
",",
"e",
")",
";",
"}",
"// FIXME check status code here",
"final",
"String",
"json",
";",
"try",
"{",
"json",
"=",
"EntityUtils",
".",
"toString",
"(",
"response",
".",
"getEntity",
"(",
")",
",",
"PcsUtils",
".",
"UTF8",
".",
"name",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"CStorageException",
"(",
"\"Can't retrieve json string in HTTP response entity\"",
",",
"e",
")",
";",
"}",
"LOGGER",
".",
"debug",
"(",
"\"fetchUserCredentials - json: {}\"",
",",
"json",
")",
";",
"Credentials",
"credentials",
"=",
"Credentials",
".",
"createFromJson",
"(",
"json",
")",
";",
"userCredentials",
"=",
"new",
"UserCredentials",
"(",
"appInfo",
",",
"null",
",",
"// userId is unknown yet",
"credentials",
")",
";",
"return",
"userCredentials",
";",
"}"
] |
Fetches user credentials
@param code oauth2 OTP code
@return The user credentials (without userId)
|
[
"Fetches",
"user",
"credentials"
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/oauth/OAuth2SessionManager.java#L198-L242
|
146,286
|
Danny02/JOpenCTM
|
src/main/java/darwin/jopenctm/compression/CommonAlgorithms.java
|
CommonAlgorithms.restoreVertices
|
public static float[] restoreVertices(int[] intVertices, int[] gridIndices, Grid grid, float vertexPrecision) {
int ve = CTM_POSITION_ELEMENT_COUNT;
int vc = intVertices.length / ve;
int prevGridIndex = 0x7fffffff;
int prevDeltaX = 0;
float[] vertices = new float[vc * ve];
for (int i = 0; i < vc; ++i) {
// Get grid box origin
int gridIdx = gridIndices[i];
float[] gridOrigin = gridIdxToPoint(grid, gridIdx);
// Restore original point
int deltaX = intVertices[i * ve];
if (gridIdx == prevGridIndex) {
deltaX += prevDeltaX;
}
vertices[i * ve] = vertexPrecision * deltaX + gridOrigin[0];
vertices[i * ve + 1] = vertexPrecision * intVertices[i * ve + 1] + gridOrigin[1];
vertices[i * ve + 2] = vertexPrecision * intVertices[i * ve + 2] + gridOrigin[2];
prevGridIndex = gridIdx;
prevDeltaX = deltaX;
}
return vertices;
}
|
java
|
public static float[] restoreVertices(int[] intVertices, int[] gridIndices, Grid grid, float vertexPrecision) {
int ve = CTM_POSITION_ELEMENT_COUNT;
int vc = intVertices.length / ve;
int prevGridIndex = 0x7fffffff;
int prevDeltaX = 0;
float[] vertices = new float[vc * ve];
for (int i = 0; i < vc; ++i) {
// Get grid box origin
int gridIdx = gridIndices[i];
float[] gridOrigin = gridIdxToPoint(grid, gridIdx);
// Restore original point
int deltaX = intVertices[i * ve];
if (gridIdx == prevGridIndex) {
deltaX += prevDeltaX;
}
vertices[i * ve] = vertexPrecision * deltaX + gridOrigin[0];
vertices[i * ve + 1] = vertexPrecision * intVertices[i * ve + 1] + gridOrigin[1];
vertices[i * ve + 2] = vertexPrecision * intVertices[i * ve + 2] + gridOrigin[2];
prevGridIndex = gridIdx;
prevDeltaX = deltaX;
}
return vertices;
}
|
[
"public",
"static",
"float",
"[",
"]",
"restoreVertices",
"(",
"int",
"[",
"]",
"intVertices",
",",
"int",
"[",
"]",
"gridIndices",
",",
"Grid",
"grid",
",",
"float",
"vertexPrecision",
")",
"{",
"int",
"ve",
"=",
"CTM_POSITION_ELEMENT_COUNT",
";",
"int",
"vc",
"=",
"intVertices",
".",
"length",
"/",
"ve",
";",
"int",
"prevGridIndex",
"=",
"0x7fffffff",
";",
"int",
"prevDeltaX",
"=",
"0",
";",
"float",
"[",
"]",
"vertices",
"=",
"new",
"float",
"[",
"vc",
"*",
"ve",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"vc",
";",
"++",
"i",
")",
"{",
"// Get grid box origin",
"int",
"gridIdx",
"=",
"gridIndices",
"[",
"i",
"]",
";",
"float",
"[",
"]",
"gridOrigin",
"=",
"gridIdxToPoint",
"(",
"grid",
",",
"gridIdx",
")",
";",
"// Restore original point",
"int",
"deltaX",
"=",
"intVertices",
"[",
"i",
"*",
"ve",
"]",
";",
"if",
"(",
"gridIdx",
"==",
"prevGridIndex",
")",
"{",
"deltaX",
"+=",
"prevDeltaX",
";",
"}",
"vertices",
"[",
"i",
"*",
"ve",
"]",
"=",
"vertexPrecision",
"*",
"deltaX",
"+",
"gridOrigin",
"[",
"0",
"]",
";",
"vertices",
"[",
"i",
"*",
"ve",
"+",
"1",
"]",
"=",
"vertexPrecision",
"*",
"intVertices",
"[",
"i",
"*",
"ve",
"+",
"1",
"]",
"+",
"gridOrigin",
"[",
"1",
"]",
";",
"vertices",
"[",
"i",
"*",
"ve",
"+",
"2",
"]",
"=",
"vertexPrecision",
"*",
"intVertices",
"[",
"i",
"*",
"ve",
"+",
"2",
"]",
"+",
"gridOrigin",
"[",
"2",
"]",
";",
"prevGridIndex",
"=",
"gridIdx",
";",
"prevDeltaX",
"=",
"deltaX",
";",
"}",
"return",
"vertices",
";",
"}"
] |
Calculate inverse derivatives of the vertices.
@param intVertices encoded vertices
@param gridIndices index of the used index
@param grid grid definition
@param vertexPrecision used encoding precision
@return the restored vertices
|
[
"Calculate",
"inverse",
"derivatives",
"of",
"the",
"vertices",
"."
] |
c55a2a2d166a55979190f1bb08214fc84c93008f
|
https://github.com/Danny02/JOpenCTM/blob/c55a2a2d166a55979190f1bb08214fc84c93008f/src/main/java/darwin/jopenctm/compression/CommonAlgorithms.java#L43-L68
|
146,287
|
Danny02/JOpenCTM
|
src/main/java/darwin/jopenctm/compression/CommonAlgorithms.java
|
CommonAlgorithms.gridIdxToPoint
|
public static float[] gridIdxToPoint(Grid grid, int idx) {
int[] gridIdx = new int[3];
int ydiv = grid.getDivision().getX();
int zdiv = ydiv * grid.getDivision().getY();
gridIdx[2] = idx / zdiv;
idx -= gridIdx[2] * zdiv;
gridIdx[1] = idx / ydiv;
idx -= gridIdx[1] * ydiv;
gridIdx[0] = idx;
Vec3f size = grid.getSize();
float[] point = {
gridIdx[0] * size.getX() + grid.getMin().getX(),
gridIdx[1] * size.getY() + grid.getMin().getY(),
gridIdx[2] * size.getZ() + grid.getMin().getZ()
};
return point;
}
|
java
|
public static float[] gridIdxToPoint(Grid grid, int idx) {
int[] gridIdx = new int[3];
int ydiv = grid.getDivision().getX();
int zdiv = ydiv * grid.getDivision().getY();
gridIdx[2] = idx / zdiv;
idx -= gridIdx[2] * zdiv;
gridIdx[1] = idx / ydiv;
idx -= gridIdx[1] * ydiv;
gridIdx[0] = idx;
Vec3f size = grid.getSize();
float[] point = {
gridIdx[0] * size.getX() + grid.getMin().getX(),
gridIdx[1] * size.getY() + grid.getMin().getY(),
gridIdx[2] * size.getZ() + grid.getMin().getZ()
};
return point;
}
|
[
"public",
"static",
"float",
"[",
"]",
"gridIdxToPoint",
"(",
"Grid",
"grid",
",",
"int",
"idx",
")",
"{",
"int",
"[",
"]",
"gridIdx",
"=",
"new",
"int",
"[",
"3",
"]",
";",
"int",
"ydiv",
"=",
"grid",
".",
"getDivision",
"(",
")",
".",
"getX",
"(",
")",
";",
"int",
"zdiv",
"=",
"ydiv",
"*",
"grid",
".",
"getDivision",
"(",
")",
".",
"getY",
"(",
")",
";",
"gridIdx",
"[",
"2",
"]",
"=",
"idx",
"/",
"zdiv",
";",
"idx",
"-=",
"gridIdx",
"[",
"2",
"]",
"*",
"zdiv",
";",
"gridIdx",
"[",
"1",
"]",
"=",
"idx",
"/",
"ydiv",
";",
"idx",
"-=",
"gridIdx",
"[",
"1",
"]",
"*",
"ydiv",
";",
"gridIdx",
"[",
"0",
"]",
"=",
"idx",
";",
"Vec3f",
"size",
"=",
"grid",
".",
"getSize",
"(",
")",
";",
"float",
"[",
"]",
"point",
"=",
"{",
"gridIdx",
"[",
"0",
"]",
"*",
"size",
".",
"getX",
"(",
")",
"+",
"grid",
".",
"getMin",
"(",
")",
".",
"getX",
"(",
")",
",",
"gridIdx",
"[",
"1",
"]",
"*",
"size",
".",
"getY",
"(",
")",
"+",
"grid",
".",
"getMin",
"(",
")",
".",
"getY",
"(",
")",
",",
"gridIdx",
"[",
"2",
"]",
"*",
"size",
".",
"getZ",
"(",
")",
"+",
"grid",
".",
"getMin",
"(",
")",
".",
"getZ",
"(",
")",
"}",
";",
"return",
"point",
";",
"}"
] |
Convert a grid index to a point.
@param grid gird box definition
@param idx box id
@return the min x/y/z for the given grid box (an array with size of 3)
|
[
"Convert",
"a",
"grid",
"index",
"to",
"a",
"point",
"."
] |
c55a2a2d166a55979190f1bb08214fc84c93008f
|
https://github.com/Danny02/JOpenCTM/blob/c55a2a2d166a55979190f1bb08214fc84c93008f/src/main/java/darwin/jopenctm/compression/CommonAlgorithms.java#L77-L96
|
146,288
|
geomajas/geomajas-project-client-gwt2
|
plugin/tms/tms/src/main/java/org/geomajas/gwt2/plugin/tms/client/TmsClient.java
|
TmsClient.createLocalMap
|
public MapConfiguration createLocalMap(String crs, CrsType type, Bbox bounds, int minTileSize, int nrOfZoomLevels) {
MapConfiguration mapConfiguration = createTmsMap(crs, type, bounds, minTileSize, nrOfZoomLevels);
mapConfiguration.setHintValue(PROFILE, Profile.LOCAL);
return mapConfiguration;
}
|
java
|
public MapConfiguration createLocalMap(String crs, CrsType type, Bbox bounds, int minTileSize, int nrOfZoomLevels) {
MapConfiguration mapConfiguration = createTmsMap(crs, type, bounds, minTileSize, nrOfZoomLevels);
mapConfiguration.setHintValue(PROFILE, Profile.LOCAL);
return mapConfiguration;
}
|
[
"public",
"MapConfiguration",
"createLocalMap",
"(",
"String",
"crs",
",",
"CrsType",
"type",
",",
"Bbox",
"bounds",
",",
"int",
"minTileSize",
",",
"int",
"nrOfZoomLevels",
")",
"{",
"MapConfiguration",
"mapConfiguration",
"=",
"createTmsMap",
"(",
"crs",
",",
"type",
",",
"bounds",
",",
"minTileSize",
",",
"nrOfZoomLevels",
")",
";",
"mapConfiguration",
".",
"setHintValue",
"(",
"PROFILE",
",",
"Profile",
".",
"LOCAL",
")",
";",
"return",
"mapConfiguration",
";",
"}"
] |
Create a map configuration with a local profile.
@return
|
[
"Create",
"a",
"map",
"configuration",
"with",
"a",
"local",
"profile",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/tms/tms/src/main/java/org/geomajas/gwt2/plugin/tms/client/TmsClient.java#L156-L160
|
146,289
|
geomajas/geomajas-project-client-gwt2
|
plugin/tms/tms/src/main/java/org/geomajas/gwt2/plugin/tms/client/TmsClient.java
|
TmsClient.createLayer
|
public TmsLayer createLayer(String id, TileConfiguration tileConfiguration, TmsLayerConfiguration
layerConfiguration) {
return new TmsLayer(id, tileConfiguration, layerConfiguration);
}
|
java
|
public TmsLayer createLayer(String id, TileConfiguration tileConfiguration, TmsLayerConfiguration
layerConfiguration) {
return new TmsLayer(id, tileConfiguration, layerConfiguration);
}
|
[
"public",
"TmsLayer",
"createLayer",
"(",
"String",
"id",
",",
"TileConfiguration",
"tileConfiguration",
",",
"TmsLayerConfiguration",
"layerConfiguration",
")",
"{",
"return",
"new",
"TmsLayer",
"(",
"id",
",",
"tileConfiguration",
",",
"layerConfiguration",
")",
";",
"}"
] |
Create a new TMS layer instance.
@param id The unique layer ID.
@param tileConfiguration The tile configuration object.
@param layerConfiguration The layer configuration object.
@return A new TMS layer.
|
[
"Create",
"a",
"new",
"TMS",
"layer",
"instance",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/tms/tms/src/main/java/org/geomajas/gwt2/plugin/tms/client/TmsClient.java#L171-L174
|
146,290
|
geomajas/geomajas-project-client-gwt2
|
plugin/tms/tms/src/main/java/org/geomajas/gwt2/plugin/tms/client/TmsClient.java
|
TmsClient.getTileMapService
|
public void getTileMapService(final String baseUrl, final Callback<TileMapServiceInfo, String> callback) {
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, baseUrl);
builder.setHeader("Cache-Control", "no-cache");
builder.setHeader("Pragma", "no-cache");
try {
builder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable e) {
callback.onFailure(e.getMessage());
}
public void onResponseReceived(Request request, Response response) {
if (200 == response.getStatusCode()) {
Document messageDom = XMLParser.parse(response.getText());
callback.onSuccess(new TileMapServiceInfo100(messageDom.getDocumentElement()));
} else {
callback.onFailure(response.getText());
}
}
});
} catch (RequestException e) {
// Couldn't connect to server
callback.onFailure(e.getMessage());
}
}
|
java
|
public void getTileMapService(final String baseUrl, final Callback<TileMapServiceInfo, String> callback) {
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, baseUrl);
builder.setHeader("Cache-Control", "no-cache");
builder.setHeader("Pragma", "no-cache");
try {
builder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable e) {
callback.onFailure(e.getMessage());
}
public void onResponseReceived(Request request, Response response) {
if (200 == response.getStatusCode()) {
Document messageDom = XMLParser.parse(response.getText());
callback.onSuccess(new TileMapServiceInfo100(messageDom.getDocumentElement()));
} else {
callback.onFailure(response.getText());
}
}
});
} catch (RequestException e) {
// Couldn't connect to server
callback.onFailure(e.getMessage());
}
}
|
[
"public",
"void",
"getTileMapService",
"(",
"final",
"String",
"baseUrl",
",",
"final",
"Callback",
"<",
"TileMapServiceInfo",
",",
"String",
">",
"callback",
")",
"{",
"RequestBuilder",
"builder",
"=",
"new",
"RequestBuilder",
"(",
"RequestBuilder",
".",
"GET",
",",
"baseUrl",
")",
";",
"builder",
".",
"setHeader",
"(",
"\"Cache-Control\"",
",",
"\"no-cache\"",
")",
";",
"builder",
".",
"setHeader",
"(",
"\"Pragma\"",
",",
"\"no-cache\"",
")",
";",
"try",
"{",
"builder",
".",
"sendRequest",
"(",
"null",
",",
"new",
"RequestCallback",
"(",
")",
"{",
"public",
"void",
"onError",
"(",
"Request",
"request",
",",
"Throwable",
"e",
")",
"{",
"callback",
".",
"onFailure",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"public",
"void",
"onResponseReceived",
"(",
"Request",
"request",
",",
"Response",
"response",
")",
"{",
"if",
"(",
"200",
"==",
"response",
".",
"getStatusCode",
"(",
")",
")",
"{",
"Document",
"messageDom",
"=",
"XMLParser",
".",
"parse",
"(",
"response",
".",
"getText",
"(",
")",
")",
";",
"callback",
".",
"onSuccess",
"(",
"new",
"TileMapServiceInfo100",
"(",
"messageDom",
".",
"getDocumentElement",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"callback",
".",
"onFailure",
"(",
"response",
".",
"getText",
"(",
")",
")",
";",
"}",
"}",
"}",
")",
";",
"}",
"catch",
"(",
"RequestException",
"e",
")",
"{",
"// Couldn't connect to server",
"callback",
".",
"onFailure",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] |
Fetch the capabilities of a TileMapService and parse it. This is the base URL that contains a list of TileMaps.
@param baseUrl The URL that points to the TileMapService.
@param callback The callback tat contains the parsed capabilities as a {@link org.geomajas.gwt2.plugin.tms.client
.configuration.TileMapServiceInfo} object.
|
[
"Fetch",
"the",
"capabilities",
"of",
"a",
"TileMapService",
"and",
"parse",
"it",
".",
"This",
"is",
"the",
"base",
"URL",
"that",
"contains",
"a",
"list",
"of",
"TileMaps",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/tms/tms/src/main/java/org/geomajas/gwt2/plugin/tms/client/TmsClient.java#L218-L242
|
146,291
|
geomajas/geomajas-project-client-gwt2
|
plugin/tms/tms/src/main/java/org/geomajas/gwt2/plugin/tms/client/TmsClient.java
|
TmsClient.createTmsMap
|
protected MapConfiguration createTmsMap(String crs, CrsType type, Bbox bounds, int minTileSize,
int nrOfZoomLevels) {
MapConfigurationImpl mapConfiguration;
mapConfiguration = new MapConfigurationImpl();
mapConfiguration.setCrs(crs, type);
double minSize = bounds.getWidth() >= bounds.getHeight() ? bounds.getHeight() : bounds.getWidth();
List<Double> resolutions = new ArrayList<Double>();
for (int i = 0; i < nrOfZoomLevels; i++) {
resolutions.add(minSize / (minTileSize * Math.pow(2, i)));
}
mapConfiguration.setResolutions(resolutions);
mapConfiguration.setMaxBounds(Bbox.ALL);
mapConfiguration.setHintValue(MapConfiguration.INITIAL_BOUNDS, bounds);
return mapConfiguration;
}
|
java
|
protected MapConfiguration createTmsMap(String crs, CrsType type, Bbox bounds, int minTileSize,
int nrOfZoomLevels) {
MapConfigurationImpl mapConfiguration;
mapConfiguration = new MapConfigurationImpl();
mapConfiguration.setCrs(crs, type);
double minSize = bounds.getWidth() >= bounds.getHeight() ? bounds.getHeight() : bounds.getWidth();
List<Double> resolutions = new ArrayList<Double>();
for (int i = 0; i < nrOfZoomLevels; i++) {
resolutions.add(minSize / (minTileSize * Math.pow(2, i)));
}
mapConfiguration.setResolutions(resolutions);
mapConfiguration.setMaxBounds(Bbox.ALL);
mapConfiguration.setHintValue(MapConfiguration.INITIAL_BOUNDS, bounds);
return mapConfiguration;
}
|
[
"protected",
"MapConfiguration",
"createTmsMap",
"(",
"String",
"crs",
",",
"CrsType",
"type",
",",
"Bbox",
"bounds",
",",
"int",
"minTileSize",
",",
"int",
"nrOfZoomLevels",
")",
"{",
"MapConfigurationImpl",
"mapConfiguration",
";",
"mapConfiguration",
"=",
"new",
"MapConfigurationImpl",
"(",
")",
";",
"mapConfiguration",
".",
"setCrs",
"(",
"crs",
",",
"type",
")",
";",
"double",
"minSize",
"=",
"bounds",
".",
"getWidth",
"(",
")",
">=",
"bounds",
".",
"getHeight",
"(",
")",
"?",
"bounds",
".",
"getHeight",
"(",
")",
":",
"bounds",
".",
"getWidth",
"(",
")",
";",
"List",
"<",
"Double",
">",
"resolutions",
"=",
"new",
"ArrayList",
"<",
"Double",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nrOfZoomLevels",
";",
"i",
"++",
")",
"{",
"resolutions",
".",
"add",
"(",
"minSize",
"/",
"(",
"minTileSize",
"*",
"Math",
".",
"pow",
"(",
"2",
",",
"i",
")",
")",
")",
";",
"}",
"mapConfiguration",
".",
"setResolutions",
"(",
"resolutions",
")",
";",
"mapConfiguration",
".",
"setMaxBounds",
"(",
"Bbox",
".",
"ALL",
")",
";",
"mapConfiguration",
".",
"setHintValue",
"(",
"MapConfiguration",
".",
"INITIAL_BOUNDS",
",",
"bounds",
")",
";",
"return",
"mapConfiguration",
";",
"}"
] |
Create a map with a local profile and specified crs, bounds and number of zoom levels. The resolution at level 0
is based on mapping the bounds to a rectangular tile width minimum width and height of minTileSize pixels.
@param crs
@param type
@param bounds
@param minTileSize
@param nrOfZoomLevels
@return
|
[
"Create",
"a",
"map",
"with",
"a",
"local",
"profile",
"and",
"specified",
"crs",
"bounds",
"and",
"number",
"of",
"zoom",
"levels",
".",
"The",
"resolution",
"at",
"level",
"0",
"is",
"based",
"on",
"mapping",
"the",
"bounds",
"to",
"a",
"rectangular",
"tile",
"width",
"minimum",
"width",
"and",
"height",
"of",
"minTileSize",
"pixels",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/tms/tms/src/main/java/org/geomajas/gwt2/plugin/tms/client/TmsClient.java#L314-L328
|
146,292
|
geomajas/geomajas-project-client-gwt2
|
server-extension/src/main/java/org/geomajas/gwt2/client/map/layer/RasterServerLayerImpl.java
|
RasterServerLayerImpl.setOpacity
|
public void setOpacity(double opacity) {
getLayerInfo().setStyle(Double.toString(opacity));
renderer.setOpacity(opacity);
}
|
java
|
public void setOpacity(double opacity) {
getLayerInfo().setStyle(Double.toString(opacity));
renderer.setOpacity(opacity);
}
|
[
"public",
"void",
"setOpacity",
"(",
"double",
"opacity",
")",
"{",
"getLayerInfo",
"(",
")",
".",
"setStyle",
"(",
"Double",
".",
"toString",
"(",
"opacity",
")",
")",
";",
"renderer",
".",
"setOpacity",
"(",
"opacity",
")",
";",
"}"
] |
Apply a new opacity on the entire raster layer. Changing the opacity on a layer does NOT fire a layer style
changed event.
@param opacity The new opacity value. Must be a value between 0 and 1, where 0 means invisible and 1 is totally
visible.
|
[
"Apply",
"a",
"new",
"opacity",
"on",
"the",
"entire",
"raster",
"layer",
".",
"Changing",
"the",
"opacity",
"on",
"a",
"layer",
"does",
"NOT",
"fire",
"a",
"layer",
"style",
"changed",
"event",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/server-extension/src/main/java/org/geomajas/gwt2/client/map/layer/RasterServerLayerImpl.java#L65-L68
|
146,293
|
ops4j/org.ops4j.pax.exam1
|
pax-exam-container-default/src/main/java/org/ops4j/pax/exam/container/def/options/ScannerUtils.java
|
ScannerUtils.getOptions
|
static String getOptions( final ProvisionOption provision )
{
final StringBuilder options = new StringBuilder();
if( provision.shouldUpdate() )
{
options.append( SEPARATOR_OPTION ).append( OPTION_UPDATE );
}
if( !provision.shouldStart() )
{
options.append( SEPARATOR_OPTION ).append( OPTION_NO_START );
}
if( provision.getStartLevel() != null )
{
options.append( SEPARATOR_OPTION ).append( provision.getStartLevel() );
}
return options.toString();
}
|
java
|
static String getOptions( final ProvisionOption provision )
{
final StringBuilder options = new StringBuilder();
if( provision.shouldUpdate() )
{
options.append( SEPARATOR_OPTION ).append( OPTION_UPDATE );
}
if( !provision.shouldStart() )
{
options.append( SEPARATOR_OPTION ).append( OPTION_NO_START );
}
if( provision.getStartLevel() != null )
{
options.append( SEPARATOR_OPTION ).append( provision.getStartLevel() );
}
return options.toString();
}
|
[
"static",
"String",
"getOptions",
"(",
"final",
"ProvisionOption",
"provision",
")",
"{",
"final",
"StringBuilder",
"options",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"provision",
".",
"shouldUpdate",
"(",
")",
")",
"{",
"options",
".",
"append",
"(",
"SEPARATOR_OPTION",
")",
".",
"append",
"(",
"OPTION_UPDATE",
")",
";",
"}",
"if",
"(",
"!",
"provision",
".",
"shouldStart",
"(",
")",
")",
"{",
"options",
".",
"append",
"(",
"SEPARATOR_OPTION",
")",
".",
"append",
"(",
"OPTION_NO_START",
")",
";",
"}",
"if",
"(",
"provision",
".",
"getStartLevel",
"(",
")",
"!=",
"null",
")",
"{",
"options",
".",
"append",
"(",
"SEPARATOR_OPTION",
")",
".",
"append",
"(",
"provision",
".",
"getStartLevel",
"(",
")",
")",
";",
"}",
"return",
"options",
".",
"toString",
"(",
")",
";",
"}"
] |
Returns common scanner options. Ment to be used by subclasses when building the url.
@param provision provision options to be used (cannot be null)
@return common scanner options (cannot be null)
|
[
"Returns",
"common",
"scanner",
"options",
".",
"Ment",
"to",
"be",
"used",
"by",
"subclasses",
"when",
"building",
"the",
"url",
"."
] |
7c8742208117ff91bd24bcd3a185d2d019f7000f
|
https://github.com/ops4j/org.ops4j.pax.exam1/blob/7c8742208117ff91bd24bcd3a185d2d019f7000f/pax-exam-container-default/src/main/java/org/ops4j/pax/exam/container/def/options/ScannerUtils.java#L47-L63
|
146,294
|
OpenBEL/openbel-framework
|
org.openbel.framework.common/src/main/java/org/openbel/framework/common/BELUtilities.java
|
BELUtilities.asPath
|
public static String asPath(final String... strings) {
if (strings == null) return null;
final StringBuilder bldr = new StringBuilder();
for (final String string : strings) {
if (bldr.length() != 0) bldr.append(separator);
bldr.append(string);
}
return bldr.toString();
}
|
java
|
public static String asPath(final String... strings) {
if (strings == null) return null;
final StringBuilder bldr = new StringBuilder();
for (final String string : strings) {
if (bldr.length() != 0) bldr.append(separator);
bldr.append(string);
}
return bldr.toString();
}
|
[
"public",
"static",
"String",
"asPath",
"(",
"final",
"String",
"...",
"strings",
")",
"{",
"if",
"(",
"strings",
"==",
"null",
")",
"return",
"null",
";",
"final",
"StringBuilder",
"bldr",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"final",
"String",
"string",
":",
"strings",
")",
"{",
"if",
"(",
"bldr",
".",
"length",
"(",
")",
"!=",
"0",
")",
"bldr",
".",
"append",
"(",
"separator",
")",
";",
"bldr",
".",
"append",
"(",
"string",
")",
";",
"}",
"return",
"bldr",
".",
"toString",
"(",
")",
";",
"}"
] |
Inserts the platform-specific filesystem path separator between the
provided strings.
@param strings
@return String in the following form:
{@code strings[0]<path_separator>strings[1]<path_separator>...<strings[n]>}
, or <b>null</b> if {@code strings} is null
|
[
"Inserts",
"the",
"platform",
"-",
"specific",
"filesystem",
"path",
"separator",
"between",
"the",
"provided",
"strings",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/BELUtilities.java#L136-L144
|
146,295
|
OpenBEL/openbel-framework
|
org.openbel.framework.common/src/main/java/org/openbel/framework/common/BELUtilities.java
|
BELUtilities.createDirectories
|
public static void createDirectories(final String directory) {
if (directory == null) return;
final File f = new File(directory);
if (!f.isDirectory()) {
if (!f.mkdirs()) throw new RuntimeException("couldn't create "
+ directory);
}
}
|
java
|
public static void createDirectories(final String directory) {
if (directory == null) return;
final File f = new File(directory);
if (!f.isDirectory()) {
if (!f.mkdirs()) throw new RuntimeException("couldn't create "
+ directory);
}
}
|
[
"public",
"static",
"void",
"createDirectories",
"(",
"final",
"String",
"directory",
")",
"{",
"if",
"(",
"directory",
"==",
"null",
")",
"return",
";",
"final",
"File",
"f",
"=",
"new",
"File",
"(",
"directory",
")",
";",
"if",
"(",
"!",
"f",
".",
"isDirectory",
"(",
")",
")",
"{",
"if",
"(",
"!",
"f",
".",
"mkdirs",
"(",
")",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"couldn't create \"",
"+",
"directory",
")",
";",
"}",
"}"
] |
Create the provided directory, and all necessary subdirectories, if they
do not already exist.
@param directory Path to create
@throws RuntimeException Thrown if directory creation failed
|
[
"Create",
"the",
"provided",
"directory",
"and",
"all",
"necessary",
"subdirectories",
"if",
"they",
"do",
"not",
"already",
"exist",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/BELUtilities.java#L402-L409
|
146,296
|
OpenBEL/openbel-framework
|
org.openbel.framework.common/src/main/java/org/openbel/framework/common/BELUtilities.java
|
BELUtilities.createDirectory
|
public static void createDirectory(final String directory) {
if (directory == null) return;
final File f = new File(directory);
if (!f.isDirectory()) {
if (!f.mkdir()) throw new RuntimeException("couldn't create "
+ directory);
}
}
|
java
|
public static void createDirectory(final String directory) {
if (directory == null) return;
final File f = new File(directory);
if (!f.isDirectory()) {
if (!f.mkdir()) throw new RuntimeException("couldn't create "
+ directory);
}
}
|
[
"public",
"static",
"void",
"createDirectory",
"(",
"final",
"String",
"directory",
")",
"{",
"if",
"(",
"directory",
"==",
"null",
")",
"return",
";",
"final",
"File",
"f",
"=",
"new",
"File",
"(",
"directory",
")",
";",
"if",
"(",
"!",
"f",
".",
"isDirectory",
"(",
")",
")",
"{",
"if",
"(",
"!",
"f",
".",
"mkdir",
"(",
")",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"couldn't create \"",
"+",
"directory",
")",
";",
"}",
"}"
] |
Create the provided directory, if it does not already exist.
@param directory Path to create
@throws RuntimeException Thrown if directory creation failed
|
[
"Create",
"the",
"provided",
"directory",
"if",
"it",
"does",
"not",
"already",
"exist",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/BELUtilities.java#L417-L424
|
146,297
|
OpenBEL/openbel-framework
|
org.openbel.framework.common/src/main/java/org/openbel/framework/common/BELUtilities.java
|
BELUtilities.getPID
|
public static int getPID() {
if (pid == -1) {
RuntimeMXBean mx = ManagementFactory.getRuntimeMXBean();
String name = mx.getName();
String token = name.split("@")[0];
pid = parseInt(token);
}
return pid;
}
|
java
|
public static int getPID() {
if (pid == -1) {
RuntimeMXBean mx = ManagementFactory.getRuntimeMXBean();
String name = mx.getName();
String token = name.split("@")[0];
pid = parseInt(token);
}
return pid;
}
|
[
"public",
"static",
"int",
"getPID",
"(",
")",
"{",
"if",
"(",
"pid",
"==",
"-",
"1",
")",
"{",
"RuntimeMXBean",
"mx",
"=",
"ManagementFactory",
".",
"getRuntimeMXBean",
"(",
")",
";",
"String",
"name",
"=",
"mx",
".",
"getName",
"(",
")",
";",
"String",
"token",
"=",
"name",
".",
"split",
"(",
"\"@\"",
")",
"[",
"0",
"]",
";",
"pid",
"=",
"parseInt",
"(",
"token",
")",
";",
"}",
"return",
"pid",
";",
"}"
] |
Returns the virtual machine's process identifier.
@return {@code int}
|
[
"Returns",
"the",
"virtual",
"machine",
"s",
"process",
"identifier",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/BELUtilities.java#L608-L616
|
146,298
|
geomajas/geomajas-project-client-gwt2
|
common-gwt/command/src/main/java/org/geomajas/gwt/client/util/StyleUtil.java
|
StyleUtil.createStyle
|
public static UserStyleInfo createStyle(RuleInfo rule) {
UserStyleInfo userStyleInfo = new UserStyleInfo();
FeatureTypeStyleInfo fts = new FeatureTypeStyleInfo();
fts.getRuleList().add(rule);
userStyleInfo.getFeatureTypeStyleList().add(fts);
return userStyleInfo;
}
|
java
|
public static UserStyleInfo createStyle(RuleInfo rule) {
UserStyleInfo userStyleInfo = new UserStyleInfo();
FeatureTypeStyleInfo fts = new FeatureTypeStyleInfo();
fts.getRuleList().add(rule);
userStyleInfo.getFeatureTypeStyleList().add(fts);
return userStyleInfo;
}
|
[
"public",
"static",
"UserStyleInfo",
"createStyle",
"(",
"RuleInfo",
"rule",
")",
"{",
"UserStyleInfo",
"userStyleInfo",
"=",
"new",
"UserStyleInfo",
"(",
")",
";",
"FeatureTypeStyleInfo",
"fts",
"=",
"new",
"FeatureTypeStyleInfo",
"(",
")",
";",
"fts",
".",
"getRuleList",
"(",
")",
".",
"add",
"(",
"rule",
")",
";",
"userStyleInfo",
".",
"getFeatureTypeStyleList",
"(",
")",
".",
"add",
"(",
"fts",
")",
";",
"return",
"userStyleInfo",
";",
"}"
] |
Create a style with a single rule.
@param rule rule
@return the style
|
[
"Create",
"a",
"style",
"with",
"a",
"single",
"rule",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/command/src/main/java/org/geomajas/gwt/client/util/StyleUtil.java#L60-L66
|
146,299
|
geomajas/geomajas-project-client-gwt2
|
common-gwt/command/src/main/java/org/geomajas/gwt/client/util/StyleUtil.java
|
StyleUtil.createRule
|
public static RuleInfo createRule(LayerType type, FeatureStyleInfo featureStyle) {
SymbolizerTypeInfo symbolizer = createSymbolizer(type, featureStyle);
RuleInfo rule = createRule(featureStyle.getName(), featureStyle.getName(), symbolizer);
return rule;
}
|
java
|
public static RuleInfo createRule(LayerType type, FeatureStyleInfo featureStyle) {
SymbolizerTypeInfo symbolizer = createSymbolizer(type, featureStyle);
RuleInfo rule = createRule(featureStyle.getName(), featureStyle.getName(), symbolizer);
return rule;
}
|
[
"public",
"static",
"RuleInfo",
"createRule",
"(",
"LayerType",
"type",
",",
"FeatureStyleInfo",
"featureStyle",
")",
"{",
"SymbolizerTypeInfo",
"symbolizer",
"=",
"createSymbolizer",
"(",
"type",
",",
"featureStyle",
")",
";",
"RuleInfo",
"rule",
"=",
"createRule",
"(",
"featureStyle",
".",
"getName",
"(",
")",
",",
"featureStyle",
".",
"getName",
"(",
")",
",",
"symbolizer",
")",
";",
"return",
"rule",
";",
"}"
] |
Create a non-filtered rule from a feature style.
@param type the layer type
@param featureStyle the style
@return the rule
|
[
"Create",
"a",
"non",
"-",
"filtered",
"rule",
"from",
"a",
"feature",
"style",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/command/src/main/java/org/geomajas/gwt/client/util/StyleUtil.java#L75-L79
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.