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 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
phax/ph-oton | ph-oton-datatables/src/main/java/com/helger/photon/uictrls/datatables/DataTablesDom.java | DataTablesDom.addCustom | @Nonnull
public DataTablesDom addCustom (@Nonnull @Nonempty final String sStr)
{
ValueEnforcer.notEmpty (sStr, "Str");
_internalAdd (sStr);
return this;
} | java | @Nonnull
public DataTablesDom addCustom (@Nonnull @Nonempty final String sStr)
{
ValueEnforcer.notEmpty (sStr, "Str");
_internalAdd (sStr);
return this;
} | [
"@",
"Nonnull",
"public",
"DataTablesDom",
"addCustom",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sStr",
")",
"{",
"ValueEnforcer",
".",
"notEmpty",
"(",
"sStr",
",",
"\"Str\"",
")",
";",
"_internalAdd",
"(",
"sStr",
")",
";",
"return",
"th... | Add a custom element
@param sStr
Custom element to add. May not be <code>null</code> nor empty.
@return this | [
"Add",
"a",
"custom",
"element"
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-datatables/src/main/java/com/helger/photon/uictrls/datatables/DataTablesDom.java#L297-L303 | train |
phax/ph-oton | ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Validation.java | FineUploader5Validation.setItemLimit | @Nonnull
public FineUploader5Validation setItemLimit (@Nonnegative final int nItemLimit)
{
ValueEnforcer.isGE0 (nItemLimit, "ItemLimit");
m_nValidationItemLimit = nItemLimit;
return this;
} | java | @Nonnull
public FineUploader5Validation setItemLimit (@Nonnegative final int nItemLimit)
{
ValueEnforcer.isGE0 (nItemLimit, "ItemLimit");
m_nValidationItemLimit = nItemLimit;
return this;
} | [
"@",
"Nonnull",
"public",
"FineUploader5Validation",
"setItemLimit",
"(",
"@",
"Nonnegative",
"final",
"int",
"nItemLimit",
")",
"{",
"ValueEnforcer",
".",
"isGE0",
"(",
"nItemLimit",
",",
"\"ItemLimit\"",
")",
";",
"m_nValidationItemLimit",
"=",
"nItemLimit",
";",
... | Maximum number of items that can be potentially uploaded in this session.
Will reject all items that are added or retried after this limit is
reached.
@param nItemLimit
Minimum size limit. 0 == unlimited
@return this for chaining | [
"Maximum",
"number",
"of",
"items",
"that",
"can",
"be",
"potentially",
"uploaded",
"in",
"this",
"session",
".",
"Will",
"reject",
"all",
"items",
"that",
"are",
"added",
"or",
"retried",
"after",
"this",
"limit",
"is",
"reached",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Validation.java#L190-L196 | train |
phax/ph-oton | ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Validation.java | FineUploader5Validation.setMinSizeLimit | @Nonnull
public FineUploader5Validation setMinSizeLimit (@Nonnegative final int nMinSizeLimit)
{
ValueEnforcer.isGE0 (nMinSizeLimit, "MinSizeLimit");
m_nValidationMinSizeLimit = nMinSizeLimit;
return this;
} | java | @Nonnull
public FineUploader5Validation setMinSizeLimit (@Nonnegative final int nMinSizeLimit)
{
ValueEnforcer.isGE0 (nMinSizeLimit, "MinSizeLimit");
m_nValidationMinSizeLimit = nMinSizeLimit;
return this;
} | [
"@",
"Nonnull",
"public",
"FineUploader5Validation",
"setMinSizeLimit",
"(",
"@",
"Nonnegative",
"final",
"int",
"nMinSizeLimit",
")",
"{",
"ValueEnforcer",
".",
"isGE0",
"(",
"nMinSizeLimit",
",",
"\"MinSizeLimit\"",
")",
";",
"m_nValidationMinSizeLimit",
"=",
"nMinS... | The minimum allowable size, in bytes, for an item.
@param nMinSizeLimit
Minimum size limit. 0 == unlimited
@return this for chaining | [
"The",
"minimum",
"allowable",
"size",
"in",
"bytes",
"for",
"an",
"item",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Validation.java#L211-L217 | train |
phax/ph-oton | ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Validation.java | FineUploader5Validation.setSizeLimit | @Nonnull
public FineUploader5Validation setSizeLimit (@Nonnegative final int nSizeLimit)
{
ValueEnforcer.isGE0 (nSizeLimit, "SizeLimit");
m_nValidationSizeLimit = nSizeLimit;
return this;
} | java | @Nonnull
public FineUploader5Validation setSizeLimit (@Nonnegative final int nSizeLimit)
{
ValueEnforcer.isGE0 (nSizeLimit, "SizeLimit");
m_nValidationSizeLimit = nSizeLimit;
return this;
} | [
"@",
"Nonnull",
"public",
"FineUploader5Validation",
"setSizeLimit",
"(",
"@",
"Nonnegative",
"final",
"int",
"nSizeLimit",
")",
"{",
"ValueEnforcer",
".",
"isGE0",
"(",
"nSizeLimit",
",",
"\"SizeLimit\"",
")",
";",
"m_nValidationSizeLimit",
"=",
"nSizeLimit",
";",
... | The maximum allowable size, in bytes, for an item.
@param nSizeLimit
Size limit. 0 == unlimited
@return this for chaining | [
"The",
"maximum",
"allowable",
"size",
"in",
"bytes",
"for",
"an",
"item",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Validation.java#L232-L238 | train |
NICTA/t3as-snomedct-service | snomed-coder-ui-web/src/main/java/org/t3as/snomedct/gwt/client/gwt/AnalyseHandler.java | AnalyseHandler.sendTextToServer | private void sendTextToServer() {
statusLabel.setText("");
conceptList.clear();
// don't do anything if we have no text
final String text = mainTextArea.getText();
if (text.length() < 1) {
statusLabel.setText(messages.pleaseEnterTextLabel());
return;
}
// disable interaction while we wait for the response
glassPanel.setPositionAndShow();
// build up the AnalysisRequest JSON object
// start with any options
final JSONArray options = new JSONArray();
setSemanticTypesOption(types, options);
// defaults
options.set(options.size(), new JSONString("word_sense_disambiguation"));
options.set(options.size(), new JSONString("composite_phrases 8"));
options.set(options.size(), new JSONString("no_derivational_variants"));
options.set(options.size(), new JSONString("strict_model"));
options.set(options.size(), new JSONString("ignore_word_order"));
options.set(options.size(), new JSONString("allow_large_n"));
options.set(options.size(), new JSONString("restrict_to_sources SNOMEDCT_US"));
final JSONObject analysisRequest = new JSONObject();
analysisRequest.put("text", new JSONString(text));
analysisRequest.put("options", options);
// send the input to the server
final RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, webserviceUrl);
builder.setHeader("Content-Type", MediaType.APPLICATION_JSON);
builder.setRequestData(analysisRequest.toString());
// create the async callback
builder.setCallback(new SnomedRequestCallback(conceptList, statusLabel, glassPanel, typeCodeToDescription));
// send the request
try { builder.send(); }
catch (final RequestException e) {
statusLabel.setText(messages.problemPerformingAnalysisLabel());
GWT.log("There was a problem performing the analysis: " + e.getMessage(), e);
glassPanel.hide();
}
} | java | private void sendTextToServer() {
statusLabel.setText("");
conceptList.clear();
// don't do anything if we have no text
final String text = mainTextArea.getText();
if (text.length() < 1) {
statusLabel.setText(messages.pleaseEnterTextLabel());
return;
}
// disable interaction while we wait for the response
glassPanel.setPositionAndShow();
// build up the AnalysisRequest JSON object
// start with any options
final JSONArray options = new JSONArray();
setSemanticTypesOption(types, options);
// defaults
options.set(options.size(), new JSONString("word_sense_disambiguation"));
options.set(options.size(), new JSONString("composite_phrases 8"));
options.set(options.size(), new JSONString("no_derivational_variants"));
options.set(options.size(), new JSONString("strict_model"));
options.set(options.size(), new JSONString("ignore_word_order"));
options.set(options.size(), new JSONString("allow_large_n"));
options.set(options.size(), new JSONString("restrict_to_sources SNOMEDCT_US"));
final JSONObject analysisRequest = new JSONObject();
analysisRequest.put("text", new JSONString(text));
analysisRequest.put("options", options);
// send the input to the server
final RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, webserviceUrl);
builder.setHeader("Content-Type", MediaType.APPLICATION_JSON);
builder.setRequestData(analysisRequest.toString());
// create the async callback
builder.setCallback(new SnomedRequestCallback(conceptList, statusLabel, glassPanel, typeCodeToDescription));
// send the request
try { builder.send(); }
catch (final RequestException e) {
statusLabel.setText(messages.problemPerformingAnalysisLabel());
GWT.log("There was a problem performing the analysis: " + e.getMessage(), e);
glassPanel.hide();
}
} | [
"private",
"void",
"sendTextToServer",
"(",
")",
"{",
"statusLabel",
".",
"setText",
"(",
"\"\"",
")",
";",
"conceptList",
".",
"clear",
"(",
")",
";",
"// don't do anything if we have no text",
"final",
"String",
"text",
"=",
"mainTextArea",
".",
"getText",
"("... | send the text from the mainTextArea to the server and accept an async response | [
"send",
"the",
"text",
"from",
"the",
"mainTextArea",
"to",
"the",
"server",
"and",
"accept",
"an",
"async",
"response"
] | 70a82d5c889f97eef2d17a648970575c152983e9 | https://github.com/NICTA/t3as-snomedct-service/blob/70a82d5c889f97eef2d17a648970575c152983e9/snomed-coder-ui-web/src/main/java/org/t3as/snomedct/gwt/client/gwt/AnalyseHandler.java#L86-L132 | train |
JamesIry/jADT | jADT-core/src/main/java/com/pogofish/jadt/parser/DummyParser.java | DummyParser.parse | @Override
public ParseResult parse(Source source) {
if (!testSrcInfo.equals(source.getSrcInfo())) {
throw new RuntimeException("testSrcInfo and source.getSrcInfo were not equal. testSrcInfo = " + testSrcInfo + ", source.getSrcInfo = " + source.getSrcInfo());
}
try {
BufferedReader reader = source.createReader();
try {
if (!testString.equals(reader.readLine())) {
throw new RuntimeException("testString and reader.readLine() were not equal");
}
final String secondLine = reader.readLine();
if (secondLine != null) {
throw new RuntimeException("got a second line '" + secondLine + "' from the reader");
}
} finally {
reader.close();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
return testResult;
} | java | @Override
public ParseResult parse(Source source) {
if (!testSrcInfo.equals(source.getSrcInfo())) {
throw new RuntimeException("testSrcInfo and source.getSrcInfo were not equal. testSrcInfo = " + testSrcInfo + ", source.getSrcInfo = " + source.getSrcInfo());
}
try {
BufferedReader reader = source.createReader();
try {
if (!testString.equals(reader.readLine())) {
throw new RuntimeException("testString and reader.readLine() were not equal");
}
final String secondLine = reader.readLine();
if (secondLine != null) {
throw new RuntimeException("got a second line '" + secondLine + "' from the reader");
}
} finally {
reader.close();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
return testResult;
} | [
"@",
"Override",
"public",
"ParseResult",
"parse",
"(",
"Source",
"source",
")",
"{",
"if",
"(",
"!",
"testSrcInfo",
".",
"equals",
"(",
"source",
".",
"getSrcInfo",
"(",
")",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"testSrcInfo and source.... | When called this examines the source to make sure the scrcInfo and data are the expected
testSrcInfo and testString. It then produces the testDoc as a result | [
"When",
"called",
"this",
"examines",
"the",
"source",
"to",
"make",
"sure",
"the",
"scrcInfo",
"and",
"data",
"are",
"the",
"expected",
"testSrcInfo",
"and",
"testString",
".",
"It",
"then",
"produces",
"the",
"testDoc",
"as",
"a",
"result"
] | 92ee94b6624cd673851497d78c218837dcf02b8a | https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/parser/DummyParser.java#L51-L73 | train |
phax/ph-oton | ph-oton-security/src/main/java/com/helger/photon/security/password/hash/PasswordHashCreatorManager.java | PasswordHashCreatorManager.registerPasswordHashCreator | public void registerPasswordHashCreator (@Nonnull final IPasswordHashCreator aPasswordHashCreator)
{
ValueEnforcer.notNull (aPasswordHashCreator, "PasswordHashCreator");
final String sAlgorithmName = aPasswordHashCreator.getAlgorithmName ();
if (StringHelper.hasNoText (sAlgorithmName))
throw new IllegalArgumentException ("PasswordHashCreator algorithm '" + aPasswordHashCreator + "' is empty!");
m_aRWLock.writeLocked ( () -> {
if (m_aPasswordHashCreators.containsKey (sAlgorithmName))
throw new IllegalArgumentException ("Another PasswordHashCreator for algorithm '" +
sAlgorithmName +
"' is already registered!");
m_aPasswordHashCreators.put (sAlgorithmName, aPasswordHashCreator);
});
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("Registered password hash creator algorithm '" + sAlgorithmName + "' to " + aPasswordHashCreator);
} | java | public void registerPasswordHashCreator (@Nonnull final IPasswordHashCreator aPasswordHashCreator)
{
ValueEnforcer.notNull (aPasswordHashCreator, "PasswordHashCreator");
final String sAlgorithmName = aPasswordHashCreator.getAlgorithmName ();
if (StringHelper.hasNoText (sAlgorithmName))
throw new IllegalArgumentException ("PasswordHashCreator algorithm '" + aPasswordHashCreator + "' is empty!");
m_aRWLock.writeLocked ( () -> {
if (m_aPasswordHashCreators.containsKey (sAlgorithmName))
throw new IllegalArgumentException ("Another PasswordHashCreator for algorithm '" +
sAlgorithmName +
"' is already registered!");
m_aPasswordHashCreators.put (sAlgorithmName, aPasswordHashCreator);
});
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("Registered password hash creator algorithm '" + sAlgorithmName + "' to " + aPasswordHashCreator);
} | [
"public",
"void",
"registerPasswordHashCreator",
"(",
"@",
"Nonnull",
"final",
"IPasswordHashCreator",
"aPasswordHashCreator",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aPasswordHashCreator",
",",
"\"PasswordHashCreator\"",
")",
";",
"final",
"String",
"sAlgorithmN... | Register a new password hash creator. No other password hash creator with
the same algorithm name may be registered.
@param aPasswordHashCreator
The password hash creator to be registered. May not be
<code>null</code>. | [
"Register",
"a",
"new",
"password",
"hash",
"creator",
".",
"No",
"other",
"password",
"hash",
"creator",
"with",
"the",
"same",
"algorithm",
"name",
"may",
"be",
"registered",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/password/hash/PasswordHashCreatorManager.java#L68-L86 | train |
phax/ph-oton | ph-oton-security/src/main/java/com/helger/photon/security/password/hash/PasswordHashCreatorManager.java | PasswordHashCreatorManager.getPasswordHashCreatorOfAlgorithm | @Nullable
public IPasswordHashCreator getPasswordHashCreatorOfAlgorithm (@Nullable final String sAlgorithmName)
{
return m_aRWLock.readLocked ( () -> m_aPasswordHashCreators.get (sAlgorithmName));
} | java | @Nullable
public IPasswordHashCreator getPasswordHashCreatorOfAlgorithm (@Nullable final String sAlgorithmName)
{
return m_aRWLock.readLocked ( () -> m_aPasswordHashCreators.get (sAlgorithmName));
} | [
"@",
"Nullable",
"public",
"IPasswordHashCreator",
"getPasswordHashCreatorOfAlgorithm",
"(",
"@",
"Nullable",
"final",
"String",
"sAlgorithmName",
")",
"{",
"return",
"m_aRWLock",
".",
"readLocked",
"(",
"(",
")",
"->",
"m_aPasswordHashCreators",
".",
"get",
"(",
"s... | Get the password hash creator of the specified algorithm name.
@param sAlgorithmName
The algorithm name to query. May be <code>null</code>.
@return <code>null</code> if no such hash creator is registered. | [
"Get",
"the",
"password",
"hash",
"creator",
"of",
"the",
"specified",
"algorithm",
"name",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/password/hash/PasswordHashCreatorManager.java#L110-L114 | train |
JamesIry/jADT | jADT-core/src/main/java/com/pogofish/jadt/checker/StandardChecker.java | StandardChecker.check | private List<SemanticError> check(DataType dataType) {
logger.finer("Checking semantic constraints on datatype " + dataType.name);
final List<SemanticError> errors = new ArrayList<SemanticError>();
final Set<String> constructorNames = new HashSet<String>();
for(Constructor constructor : dataType.constructors) {
logger.finest("Checking semantic constraints on constructor " + constructor.name + " in datatype " + dataType.name);
if (dataType.constructors.size() > 1 && dataType.name.equals(constructor.name)) {
logger.info("Constructor with same name as its data type " + dataType.name + ".");
errors.add(_ConstructorDataTypeConflict(dataType.name));
}
if (constructorNames.contains(constructor.name)) {
logger.info("Two constructors with same name " + constructor.name + " in data type " + dataType.name + ".");
errors.add(_DuplicateConstructor(dataType.name, constructor.name));
} else {
constructorNames.add(constructor.name);
}
errors.addAll(check(dataType, constructor));
}
return errors;
} | java | private List<SemanticError> check(DataType dataType) {
logger.finer("Checking semantic constraints on datatype " + dataType.name);
final List<SemanticError> errors = new ArrayList<SemanticError>();
final Set<String> constructorNames = new HashSet<String>();
for(Constructor constructor : dataType.constructors) {
logger.finest("Checking semantic constraints on constructor " + constructor.name + " in datatype " + dataType.name);
if (dataType.constructors.size() > 1 && dataType.name.equals(constructor.name)) {
logger.info("Constructor with same name as its data type " + dataType.name + ".");
errors.add(_ConstructorDataTypeConflict(dataType.name));
}
if (constructorNames.contains(constructor.name)) {
logger.info("Two constructors with same name " + constructor.name + " in data type " + dataType.name + ".");
errors.add(_DuplicateConstructor(dataType.name, constructor.name));
} else {
constructorNames.add(constructor.name);
}
errors.addAll(check(dataType, constructor));
}
return errors;
} | [
"private",
"List",
"<",
"SemanticError",
">",
"check",
"(",
"DataType",
"dataType",
")",
"{",
"logger",
".",
"finer",
"(",
"\"Checking semantic constraints on datatype \"",
"+",
"dataType",
".",
"name",
")",
";",
"final",
"List",
"<",
"SemanticError",
">",
"erro... | Checks a data type for duplicate constructor names or constructors having the same name
as the data type
@param dataType DataType to check
@return Set<SemanticError> with the problems or empty set if there are none | [
"Checks",
"a",
"data",
"type",
"for",
"duplicate",
"constructor",
"names",
"or",
"constructors",
"having",
"the",
"same",
"name",
"as",
"the",
"data",
"type"
] | 92ee94b6624cd673851497d78c218837dcf02b8a | https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/checker/StandardChecker.java#L77-L97 | train |
JamesIry/jADT | jADT-core/src/main/java/com/pogofish/jadt/checker/StandardChecker.java | StandardChecker.check | private List<SemanticError> check(DataType dataType, Constructor constructor) {
logger.finer("Checking semantic constraints on data type " + dataType.name + ", constructor " + constructor.name);
final List<SemanticError> errors = new ArrayList<SemanticError>();
final Set<String> argNames = new HashSet<String>();
for (Arg arg : constructor.args) {
if (argNames.contains(arg.name)) {
errors.add(_DuplicateArgName(dataType.name, constructor.name, arg.name));
} else {
argNames.add(arg.name);
}
errors.addAll(check(dataType, constructor, arg));
}
return errors;
} | java | private List<SemanticError> check(DataType dataType, Constructor constructor) {
logger.finer("Checking semantic constraints on data type " + dataType.name + ", constructor " + constructor.name);
final List<SemanticError> errors = new ArrayList<SemanticError>();
final Set<String> argNames = new HashSet<String>();
for (Arg arg : constructor.args) {
if (argNames.contains(arg.name)) {
errors.add(_DuplicateArgName(dataType.name, constructor.name, arg.name));
} else {
argNames.add(arg.name);
}
errors.addAll(check(dataType, constructor, arg));
}
return errors;
} | [
"private",
"List",
"<",
"SemanticError",
">",
"check",
"(",
"DataType",
"dataType",
",",
"Constructor",
"constructor",
")",
"{",
"logger",
".",
"finer",
"(",
"\"Checking semantic constraints on data type \"",
"+",
"dataType",
".",
"name",
"+",
"\", constructor \"",
... | Check a constructor to make sure it does not duplicate any args and that no arg duplicates any modifiers | [
"Check",
"a",
"constructor",
"to",
"make",
"sure",
"it",
"does",
"not",
"duplicate",
"any",
"args",
"and",
"that",
"no",
"arg",
"duplicates",
"any",
"modifiers"
] | 92ee94b6624cd673851497d78c218837dcf02b8a | https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/checker/StandardChecker.java#L103-L118 | train |
JamesIry/jADT | jADT-core/src/main/java/com/pogofish/jadt/checker/StandardChecker.java | StandardChecker.check | private List<SemanticError> check(DataType dataType, Constructor constructor, Arg arg) {
logger.finest("Checking semantic constraints on data type " + dataType.name + ", constructor " + constructor.name);
final List<SemanticError> errors = new ArrayList<SemanticError>();
final Set<ArgModifier> modifiers = new HashSet<ArgModifier>();
for (ArgModifier modifier : arg.modifiers) {
if (modifiers.contains(modifier)) {
final String modName = ASTPrinter.print(modifier);
errors.add(_DuplicateModifier(dataType.name, constructor.name, arg.name, modName));
} else {
modifiers.add(modifier);
}
}
return errors;
} | java | private List<SemanticError> check(DataType dataType, Constructor constructor, Arg arg) {
logger.finest("Checking semantic constraints on data type " + dataType.name + ", constructor " + constructor.name);
final List<SemanticError> errors = new ArrayList<SemanticError>();
final Set<ArgModifier> modifiers = new HashSet<ArgModifier>();
for (ArgModifier modifier : arg.modifiers) {
if (modifiers.contains(modifier)) {
final String modName = ASTPrinter.print(modifier);
errors.add(_DuplicateModifier(dataType.name, constructor.name, arg.name, modName));
} else {
modifiers.add(modifier);
}
}
return errors;
} | [
"private",
"List",
"<",
"SemanticError",
">",
"check",
"(",
"DataType",
"dataType",
",",
"Constructor",
"constructor",
",",
"Arg",
"arg",
")",
"{",
"logger",
".",
"finest",
"(",
"\"Checking semantic constraints on data type \"",
"+",
"dataType",
".",
"name",
"+",
... | Checkt to make sure an arg doesn't have duplicate modifiers | [
"Checkt",
"to",
"make",
"sure",
"an",
"arg",
"doesn",
"t",
"have",
"duplicate",
"modifiers"
] | 92ee94b6624cd673851497d78c218837dcf02b8a | https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/checker/StandardChecker.java#L123-L137 | train |
phax/ph-oton | ph-oton-exchange/src/main/java/com/helger/photon/exchange/bulkexport/format/ExporterCSV.java | ExporterCSV.createCSVWriter | @SuppressWarnings ("resource")
@Nonnull
@OverrideOnDemand
@WillCloseWhenClosed
protected CSVWriter createCSVWriter (@Nonnull final OutputStream aOS)
{
return new CSVWriter (new OutputStreamWriter (aOS, m_aCharset)).setSeparatorChar (m_cSeparatorChar)
.setQuoteChar (m_cQuoteChar)
.setEscapeChar (m_cEscapeChar)
.setLineEnd (m_sLineEnd)
.setAvoidFinalLineEnd (m_bAvoidFinalLineEnd);
} | java | @SuppressWarnings ("resource")
@Nonnull
@OverrideOnDemand
@WillCloseWhenClosed
protected CSVWriter createCSVWriter (@Nonnull final OutputStream aOS)
{
return new CSVWriter (new OutputStreamWriter (aOS, m_aCharset)).setSeparatorChar (m_cSeparatorChar)
.setQuoteChar (m_cQuoteChar)
.setEscapeChar (m_cEscapeChar)
.setLineEnd (m_sLineEnd)
.setAvoidFinalLineEnd (m_bAvoidFinalLineEnd);
} | [
"@",
"SuppressWarnings",
"(",
"\"resource\"",
")",
"@",
"Nonnull",
"@",
"OverrideOnDemand",
"@",
"WillCloseWhenClosed",
"protected",
"CSVWriter",
"createCSVWriter",
"(",
"@",
"Nonnull",
"final",
"OutputStream",
"aOS",
")",
"{",
"return",
"new",
"CSVWriter",
"(",
"... | Create a new CSV writer.
@param aOS
The output stream to write to. May not be <code>null</code>.
@return The {@link CSVWriter} to used. Never <code>null</code>. | [
"Create",
"a",
"new",
"CSV",
"writer",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-exchange/src/main/java/com/helger/photon/exchange/bulkexport/format/ExporterCSV.java#L239-L250 | train |
gliga/ekstazi | ekstazi-maven-plugin/src/main/java/org/ekstazi/maven/StaticSelectEkstaziMojo.java | StaticSelectEkstaziMojo.addJavaAgent | private void addJavaAgent(Config.AgentMode junitMode) throws MojoExecutionException {
try {
URL agentJarURL = Types.extractJarURL(EkstaziAgent.class);
if (agentJarURL == null) {
throw new MojoExecutionException("Unable to locate Ekstazi agent");
}
Properties properties = project.getProperties();
String oldValue = properties.getProperty(ARG_LINE_PARAM_NAME);
properties.setProperty(ARG_LINE_PARAM_NAME, prepareEkstaziOptions(agentJarURL, junitMode) + " " + (oldValue == null ? "" : oldValue));
} catch (IOException ex) {
throw new MojoExecutionException("Unable to set path to agent", ex);
} catch (URISyntaxException ex) {
throw new MojoExecutionException("Unable to set path to agent", ex);
}
} | java | private void addJavaAgent(Config.AgentMode junitMode) throws MojoExecutionException {
try {
URL agentJarURL = Types.extractJarURL(EkstaziAgent.class);
if (agentJarURL == null) {
throw new MojoExecutionException("Unable to locate Ekstazi agent");
}
Properties properties = project.getProperties();
String oldValue = properties.getProperty(ARG_LINE_PARAM_NAME);
properties.setProperty(ARG_LINE_PARAM_NAME, prepareEkstaziOptions(agentJarURL, junitMode) + " " + (oldValue == null ? "" : oldValue));
} catch (IOException ex) {
throw new MojoExecutionException("Unable to set path to agent", ex);
} catch (URISyntaxException ex) {
throw new MojoExecutionException("Unable to set path to agent", ex);
}
} | [
"private",
"void",
"addJavaAgent",
"(",
"Config",
".",
"AgentMode",
"junitMode",
")",
"throws",
"MojoExecutionException",
"{",
"try",
"{",
"URL",
"agentJarURL",
"=",
"Types",
".",
"extractJarURL",
"(",
"EkstaziAgent",
".",
"class",
")",
";",
"if",
"(",
"agentJ... | Sets property to pass Ekstazi agent to surefire plugin. | [
"Sets",
"property",
"to",
"pass",
"Ekstazi",
"agent",
"to",
"surefire",
"plugin",
"."
] | 5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1 | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/ekstazi-maven-plugin/src/main/java/org/ekstazi/maven/StaticSelectEkstaziMojo.java#L157-L171 | train |
gliga/ekstazi | ekstazi-maven-plugin/src/main/java/org/ekstazi/maven/StaticSelectEkstaziMojo.java | StaticSelectEkstaziMojo.appendExcludesListToExcludesFile | private void appendExcludesListToExcludesFile(Plugin plugin, List<String> nonAffectedClasses) throws MojoExecutionException {
String excludesFileName = extractParamValue(plugin, EXCLUDES_FILE_PARAM_NAME);
File excludesFileFile = new File(excludesFileName);
// First restore file in case it has been modified by this
// plugin before (if 'restore' was not run, or VM crashed).
restoreExcludesFile(plugin);
PrintWriter pw = null;
try {
// Have to restore original file (on shutdown); see
// RestoreMojo.
pw = new PrintWriter(new FileOutputStream(excludesFileFile, true), true);
pw.println(EKSTAZI_LINE_MARKER);
for (String exclude : nonAffectedClasses) {
pw.println(exclude);
}
// If "exclude(s)" is not present, we also have to add default value to exclude inner classes.
if (!isAtLeastOneExcludePresent(plugin)) {
pw.println("**/*$*");
}
} catch (IOException ex) {
throw new MojoExecutionException("Could not access excludesFile", ex);
} finally {
if (pw != null) {
pw.close();
}
}
} | java | private void appendExcludesListToExcludesFile(Plugin plugin, List<String> nonAffectedClasses) throws MojoExecutionException {
String excludesFileName = extractParamValue(plugin, EXCLUDES_FILE_PARAM_NAME);
File excludesFileFile = new File(excludesFileName);
// First restore file in case it has been modified by this
// plugin before (if 'restore' was not run, or VM crashed).
restoreExcludesFile(plugin);
PrintWriter pw = null;
try {
// Have to restore original file (on shutdown); see
// RestoreMojo.
pw = new PrintWriter(new FileOutputStream(excludesFileFile, true), true);
pw.println(EKSTAZI_LINE_MARKER);
for (String exclude : nonAffectedClasses) {
pw.println(exclude);
}
// If "exclude(s)" is not present, we also have to add default value to exclude inner classes.
if (!isAtLeastOneExcludePresent(plugin)) {
pw.println("**/*$*");
}
} catch (IOException ex) {
throw new MojoExecutionException("Could not access excludesFile", ex);
} finally {
if (pw != null) {
pw.close();
}
}
} | [
"private",
"void",
"appendExcludesListToExcludesFile",
"(",
"Plugin",
"plugin",
",",
"List",
"<",
"String",
">",
"nonAffectedClasses",
")",
"throws",
"MojoExecutionException",
"{",
"String",
"excludesFileName",
"=",
"extractParamValue",
"(",
"plugin",
",",
"EXCLUDES_FIL... | Appends list of classes that should be excluded to the given
file. | [
"Appends",
"list",
"of",
"classes",
"that",
"should",
"be",
"excluded",
"to",
"the",
"given",
"file",
"."
] | 5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1 | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/ekstazi-maven-plugin/src/main/java/org/ekstazi/maven/StaticSelectEkstaziMojo.java#L190-L218 | train |
gliga/ekstazi | ekstazi-maven-plugin/src/main/java/org/ekstazi/maven/StaticSelectEkstaziMojo.java | StaticSelectEkstaziMojo.isParallelOn | private boolean isParallelOn(Plugin plugin) throws MojoExecutionException {
String value = extractParamValue(plugin, PARALLEL_PARAM_NAME);
// If value is set and it is not an empty string.
return value != null && !value.equals("");
} | java | private boolean isParallelOn(Plugin plugin) throws MojoExecutionException {
String value = extractParamValue(plugin, PARALLEL_PARAM_NAME);
// If value is set and it is not an empty string.
return value != null && !value.equals("");
} | [
"private",
"boolean",
"isParallelOn",
"(",
"Plugin",
"plugin",
")",
"throws",
"MojoExecutionException",
"{",
"String",
"value",
"=",
"extractParamValue",
"(",
"plugin",
",",
"PARALLEL_PARAM_NAME",
")",
";",
"// If value is set and it is not an empty string.",
"return",
"v... | Returns true if "parallel" parameter is ON, false
otherwise. This parameter is ON if the value is different from
NULL.
https://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html | [
"Returns",
"true",
"if",
"parallel",
"parameter",
"is",
"ON",
"false",
"otherwise",
".",
"This",
"parameter",
"is",
"ON",
"if",
"the",
"value",
"is",
"different",
"from",
"NULL",
"."
] | 5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1 | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/ekstazi-maven-plugin/src/main/java/org/ekstazi/maven/StaticSelectEkstaziMojo.java#L241-L245 | train |
gliga/ekstazi | ekstazi-maven-plugin/src/main/java/org/ekstazi/maven/StaticSelectEkstaziMojo.java | StaticSelectEkstaziMojo.isForkMode | private boolean isForkMode(Plugin plugin) throws MojoExecutionException {
String reuseForksValue = extractParamValue(plugin, REUSE_FORKS_PARAM_NAME);
return reuseForksValue != null && reuseForksValue.equals("false");
} | java | private boolean isForkMode(Plugin plugin) throws MojoExecutionException {
String reuseForksValue = extractParamValue(plugin, REUSE_FORKS_PARAM_NAME);
return reuseForksValue != null && reuseForksValue.equals("false");
} | [
"private",
"boolean",
"isForkMode",
"(",
"Plugin",
"plugin",
")",
"throws",
"MojoExecutionException",
"{",
"String",
"reuseForksValue",
"=",
"extractParamValue",
"(",
"plugin",
",",
"REUSE_FORKS_PARAM_NAME",
")",
";",
"return",
"reuseForksValue",
"!=",
"null",
"&&",
... | Returns true if there each test class is executed in its own process. | [
"Returns",
"true",
"if",
"there",
"each",
"test",
"class",
"is",
"executed",
"in",
"its",
"own",
"process",
"."
] | 5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1 | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/ekstazi-maven-plugin/src/main/java/org/ekstazi/maven/StaticSelectEkstaziMojo.java#L250-L253 | train |
gliga/ekstazi | ekstazi-maven-plugin/src/main/java/org/ekstazi/maven/StaticSelectEkstaziMojo.java | StaticSelectEkstaziMojo.isForkDisabled | private boolean isForkDisabled(Plugin plugin) throws MojoExecutionException {
String forkCountValue = extractParamValue(plugin, FORK_COUNT_PARAM_NAME);
String forkModeValue = extractParamValue(plugin, FORK_MODE_PARAM_NAME);
return (forkCountValue != null && forkCountValue.equals("0")) ||
(forkModeValue != null && forkModeValue.equals("never"));
} | java | private boolean isForkDisabled(Plugin plugin) throws MojoExecutionException {
String forkCountValue = extractParamValue(plugin, FORK_COUNT_PARAM_NAME);
String forkModeValue = extractParamValue(plugin, FORK_MODE_PARAM_NAME);
return (forkCountValue != null && forkCountValue.equals("0")) ||
(forkModeValue != null && forkModeValue.equals("never"));
} | [
"private",
"boolean",
"isForkDisabled",
"(",
"Plugin",
"plugin",
")",
"throws",
"MojoExecutionException",
"{",
"String",
"forkCountValue",
"=",
"extractParamValue",
"(",
"plugin",
",",
"FORK_COUNT_PARAM_NAME",
")",
";",
"String",
"forkModeValue",
"=",
"extractParamValue... | Returns true if fork is disabled, i.e., if we cannot set the
agent. | [
"Returns",
"true",
"if",
"fork",
"is",
"disabled",
"i",
".",
"e",
".",
"if",
"we",
"cannot",
"set",
"the",
"agent",
"."
] | 5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1 | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/ekstazi-maven-plugin/src/main/java/org/ekstazi/maven/StaticSelectEkstaziMojo.java#L259-L264 | train |
gliga/ekstazi | ekstazi-maven-plugin/src/main/java/org/ekstazi/maven/StaticSelectEkstaziMojo.java | StaticSelectEkstaziMojo.checkParameters | private void checkParameters(Plugin plugin) throws MojoExecutionException {
// Fail if 'parallel' parameter is used.
if (isParallelOn(plugin)) {
throw new MojoExecutionException("Ekstazi currently does not support parallel parameter");
}
// Fail if fork is disabled.
if (isForkDisabled(plugin)) {
throw new MojoExecutionException("forkCount has to be at least 1");
}
} | java | private void checkParameters(Plugin plugin) throws MojoExecutionException {
// Fail if 'parallel' parameter is used.
if (isParallelOn(plugin)) {
throw new MojoExecutionException("Ekstazi currently does not support parallel parameter");
}
// Fail if fork is disabled.
if (isForkDisabled(plugin)) {
throw new MojoExecutionException("forkCount has to be at least 1");
}
} | [
"private",
"void",
"checkParameters",
"(",
"Plugin",
"plugin",
")",
"throws",
"MojoExecutionException",
"{",
"// Fail if 'parallel' parameter is used.",
"if",
"(",
"isParallelOn",
"(",
"plugin",
")",
")",
"{",
"throw",
"new",
"MojoExecutionException",
"(",
"\"Ekstazi cu... | Checks that all parameters are set as expected. | [
"Checks",
"that",
"all",
"parameters",
"are",
"set",
"as",
"expected",
"."
] | 5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1 | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/ekstazi-maven-plugin/src/main/java/org/ekstazi/maven/StaticSelectEkstaziMojo.java#L290-L299 | train |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/hc/render/HCRenderer.java | HCRenderer.getPreparedNode | @Nonnull
public static <T extends IHCNode> T getPreparedNode (@Nonnull final T aNode,
@Nonnull final IHCHasChildrenMutable <?, ? super IHCNode> aTargetNode,
@Nonnull final IHCConversionSettingsToNode aConversionSettings)
{
// Run the global customizer
aNode.customizeNode (aConversionSettings.getCustomizer (), aConversionSettings.getHTMLVersion (), aTargetNode);
// finalize the node
aNode.finalizeNodeState (aConversionSettings, aTargetNode);
// Consistency check
aNode.consistencyCheck (aConversionSettings);
// No forced registration here
final boolean bForcedResourceRegistration = false;
aNode.registerExternalResources (aConversionSettings, bForcedResourceRegistration);
return aNode;
} | java | @Nonnull
public static <T extends IHCNode> T getPreparedNode (@Nonnull final T aNode,
@Nonnull final IHCHasChildrenMutable <?, ? super IHCNode> aTargetNode,
@Nonnull final IHCConversionSettingsToNode aConversionSettings)
{
// Run the global customizer
aNode.customizeNode (aConversionSettings.getCustomizer (), aConversionSettings.getHTMLVersion (), aTargetNode);
// finalize the node
aNode.finalizeNodeState (aConversionSettings, aTargetNode);
// Consistency check
aNode.consistencyCheck (aConversionSettings);
// No forced registration here
final boolean bForcedResourceRegistration = false;
aNode.registerExternalResources (aConversionSettings, bForcedResourceRegistration);
return aNode;
} | [
"@",
"Nonnull",
"public",
"static",
"<",
"T",
"extends",
"IHCNode",
">",
"T",
"getPreparedNode",
"(",
"@",
"Nonnull",
"final",
"T",
"aNode",
",",
"@",
"Nonnull",
"final",
"IHCHasChildrenMutable",
"<",
"?",
",",
"?",
"super",
"IHCNode",
">",
"aTargetNode",
... | Prepare and return a single node.
@param aNode
Node to be prepared.
@param aTargetNode
Target node for additional nodes.
@param aConversionSettings
Conversion settings to be used.
@return The passed in node.
@param <T>
Input and return node type | [
"Prepare",
"and",
"return",
"a",
"single",
"node",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/render/HCRenderer.java#L62-L81 | train |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/hc/render/HCRenderer.java | HCRenderer.prepareForConversion | public static void prepareForConversion (@Nonnull final IHCNode aStartNode,
@Nonnull final IHCHasChildrenMutable <?, ? super IHCNode> aGlobalTargetNode,
@Nonnull final IHCConversionSettingsToNode aConversionSettings)
{
ValueEnforcer.notNull (aStartNode, "NodeToBeCustomized");
ValueEnforcer.notNull (aGlobalTargetNode, "TargetNode");
ValueEnforcer.notNull (aConversionSettings, "ConversionSettings");
final IHCCustomizer aCustomizer = aConversionSettings.getCustomizer ();
final EHTMLVersion eHTMLVersion = aConversionSettings.getHTMLVersion ();
// Customize all elements before extracting out-of-band nodes, in case the
// customizer adds some out-of-band nodes as well
// Than finalize and register external resources
final IHCIteratorNonBreakableCallback aCB = (aParentNode, aChildNode) -> {
// If the parent node is suitable, use it, else use the global target
// node
IHCHasChildrenMutable <?, ? super IHCNode> aRealTargetNode;
if (aParentNode instanceof IHCHasChildrenMutable <?, ?>)
{
// Unchecked conversion
aRealTargetNode = GenericReflection.uncheckedCast (aParentNode);
}
else
aRealTargetNode = aGlobalTargetNode;
final int nTargetNodeChildren = aRealTargetNode.getChildCount ();
// Run the global customizer
aChildNode.customizeNode (aCustomizer, eHTMLVersion, aRealTargetNode);
// finalize the node
aChildNode.finalizeNodeState (aConversionSettings, aRealTargetNode);
// Consistency check
aChildNode.consistencyCheck (aConversionSettings);
// No forced registration here
final boolean bForcedResourceRegistration = false;
aChildNode.registerExternalResources (aConversionSettings, bForcedResourceRegistration);
// Something was added?
if (aRealTargetNode.getChildCount () > nTargetNodeChildren)
{
// Recursive call on the target node only.
// It's important to scan the whole tree, as a hierarchy of nodes may
// have been added!
prepareForConversion (aRealTargetNode, aRealTargetNode, aConversionSettings);
}
};
HCHelper.iterateTreeNonBreakable (aStartNode, aCB);
} | java | public static void prepareForConversion (@Nonnull final IHCNode aStartNode,
@Nonnull final IHCHasChildrenMutable <?, ? super IHCNode> aGlobalTargetNode,
@Nonnull final IHCConversionSettingsToNode aConversionSettings)
{
ValueEnforcer.notNull (aStartNode, "NodeToBeCustomized");
ValueEnforcer.notNull (aGlobalTargetNode, "TargetNode");
ValueEnforcer.notNull (aConversionSettings, "ConversionSettings");
final IHCCustomizer aCustomizer = aConversionSettings.getCustomizer ();
final EHTMLVersion eHTMLVersion = aConversionSettings.getHTMLVersion ();
// Customize all elements before extracting out-of-band nodes, in case the
// customizer adds some out-of-band nodes as well
// Than finalize and register external resources
final IHCIteratorNonBreakableCallback aCB = (aParentNode, aChildNode) -> {
// If the parent node is suitable, use it, else use the global target
// node
IHCHasChildrenMutable <?, ? super IHCNode> aRealTargetNode;
if (aParentNode instanceof IHCHasChildrenMutable <?, ?>)
{
// Unchecked conversion
aRealTargetNode = GenericReflection.uncheckedCast (aParentNode);
}
else
aRealTargetNode = aGlobalTargetNode;
final int nTargetNodeChildren = aRealTargetNode.getChildCount ();
// Run the global customizer
aChildNode.customizeNode (aCustomizer, eHTMLVersion, aRealTargetNode);
// finalize the node
aChildNode.finalizeNodeState (aConversionSettings, aRealTargetNode);
// Consistency check
aChildNode.consistencyCheck (aConversionSettings);
// No forced registration here
final boolean bForcedResourceRegistration = false;
aChildNode.registerExternalResources (aConversionSettings, bForcedResourceRegistration);
// Something was added?
if (aRealTargetNode.getChildCount () > nTargetNodeChildren)
{
// Recursive call on the target node only.
// It's important to scan the whole tree, as a hierarchy of nodes may
// have been added!
prepareForConversion (aRealTargetNode, aRealTargetNode, aConversionSettings);
}
};
HCHelper.iterateTreeNonBreakable (aStartNode, aCB);
} | [
"public",
"static",
"void",
"prepareForConversion",
"(",
"@",
"Nonnull",
"final",
"IHCNode",
"aStartNode",
",",
"@",
"Nonnull",
"final",
"IHCHasChildrenMutable",
"<",
"?",
",",
"?",
"super",
"IHCNode",
">",
"aGlobalTargetNode",
",",
"@",
"Nonnull",
"final",
"IHC... | Customize the passed base node and all child nodes recursively.
@param aStartNode
Base node to start customizing (incl.). May not be <code>null</code> .
@param aGlobalTargetNode
The target node where new nodes should be appended to in case the
direct parent node is not suitable. May not be <code>null</code>.
@param aConversionSettings
The conversion settings to use. May not be <code>null</code>. | [
"Customize",
"the",
"passed",
"base",
"node",
"and",
"all",
"child",
"nodes",
"recursively",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/render/HCRenderer.java#L115-L166 | train |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/hc/render/HCRenderer.java | HCRenderer.getAsNode | @Nullable
public static IMicroNode getAsNode (@Nonnull final IHCNode aHCNode)
{
return getAsNode (aHCNode, HCSettings.getConversionSettings ());
} | java | @Nullable
public static IMicroNode getAsNode (@Nonnull final IHCNode aHCNode)
{
return getAsNode (aHCNode, HCSettings.getConversionSettings ());
} | [
"@",
"Nullable",
"public",
"static",
"IMicroNode",
"getAsNode",
"(",
"@",
"Nonnull",
"final",
"IHCNode",
"aHCNode",
")",
"{",
"return",
"getAsNode",
"(",
"aHCNode",
",",
"HCSettings",
".",
"getConversionSettings",
"(",
")",
")",
";",
"}"
] | Convert the passed HC node to a micro node using the default conversion
settings.
@param aHCNode
The node to be converted. May not be <code>null</code>.
@return The fully created HTML node | [
"Convert",
"the",
"passed",
"HC",
"node",
"to",
"a",
"micro",
"node",
"using",
"the",
"default",
"conversion",
"settings",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/render/HCRenderer.java#L176-L180 | train |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/hc/render/HCRenderer.java | HCRenderer.getAsNode | @SuppressWarnings ("unchecked")
@Nullable
public static IMicroNode getAsNode (@Nonnull final IHCNode aSrcNode,
@Nonnull final IHCConversionSettingsToNode aConversionSettings)
{
IHCNode aConvertNode = aSrcNode;
// Special case for HCHtml - must have been done separately because the
// extraction of the OOB nodes must happen before the HTML HEAD is filled
if (!(aSrcNode instanceof HCHtml))
{
// Determine the target node to use
final boolean bSrcNodeCanHaveChildren = aSrcNode instanceof IHCHasChildrenMutable <?, ?>;
IHCHasChildrenMutable <?, IHCNode> aTempNode;
if (bSrcNodeCanHaveChildren)
{
// Passed node can handle it
aTempNode = (IHCHasChildrenMutable <?, IHCNode>) aSrcNode;
}
else
{
aTempNode = new HCNodeList ();
aTempNode.addChild (aSrcNode);
}
// customize, finalize and extract resources
prepareForConversion (aTempNode, aTempNode, aConversionSettings);
// NOTE: no OOB extraction here, because it is unclear what would happen
// to the nodes.
// Select node to convert to MicroDOM - if something was extracted, use
// the temp node
if (!bSrcNodeCanHaveChildren && aTempNode.getChildCount () > 1)
aConvertNode = aTempNode;
}
final IMicroNode aMicroNode = aConvertNode.convertToMicroNode (aConversionSettings);
return aMicroNode;
} | java | @SuppressWarnings ("unchecked")
@Nullable
public static IMicroNode getAsNode (@Nonnull final IHCNode aSrcNode,
@Nonnull final IHCConversionSettingsToNode aConversionSettings)
{
IHCNode aConvertNode = aSrcNode;
// Special case for HCHtml - must have been done separately because the
// extraction of the OOB nodes must happen before the HTML HEAD is filled
if (!(aSrcNode instanceof HCHtml))
{
// Determine the target node to use
final boolean bSrcNodeCanHaveChildren = aSrcNode instanceof IHCHasChildrenMutable <?, ?>;
IHCHasChildrenMutable <?, IHCNode> aTempNode;
if (bSrcNodeCanHaveChildren)
{
// Passed node can handle it
aTempNode = (IHCHasChildrenMutable <?, IHCNode>) aSrcNode;
}
else
{
aTempNode = new HCNodeList ();
aTempNode.addChild (aSrcNode);
}
// customize, finalize and extract resources
prepareForConversion (aTempNode, aTempNode, aConversionSettings);
// NOTE: no OOB extraction here, because it is unclear what would happen
// to the nodes.
// Select node to convert to MicroDOM - if something was extracted, use
// the temp node
if (!bSrcNodeCanHaveChildren && aTempNode.getChildCount () > 1)
aConvertNode = aTempNode;
}
final IMicroNode aMicroNode = aConvertNode.convertToMicroNode (aConversionSettings);
return aMicroNode;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Nullable",
"public",
"static",
"IMicroNode",
"getAsNode",
"(",
"@",
"Nonnull",
"final",
"IHCNode",
"aSrcNode",
",",
"@",
"Nonnull",
"final",
"IHCConversionSettingsToNode",
"aConversionSettings",
")",
"{",
"IH... | Convert the passed HC node to a micro node using the provided conversion
settings.
@param aSrcNode
The node to be converted. May not be <code>null</code>.
@param aConversionSettings
The conversion settings to be used. May not be <code>null</code>.
@return The fully created HTML node | [
"Convert",
"the",
"passed",
"HC",
"node",
"to",
"a",
"micro",
"node",
"using",
"the",
"provided",
"conversion",
"settings",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/render/HCRenderer.java#L192-L231 | train |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/hc/render/HCRenderer.java | HCRenderer.getAsHTMLString | @Nonnull
public static String getAsHTMLString (@Nonnull final IHCNode aHCNode)
{
return getAsHTMLString (aHCNode, HCSettings.getConversionSettings ());
} | java | @Nonnull
public static String getAsHTMLString (@Nonnull final IHCNode aHCNode)
{
return getAsHTMLString (aHCNode, HCSettings.getConversionSettings ());
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"getAsHTMLString",
"(",
"@",
"Nonnull",
"final",
"IHCNode",
"aHCNode",
")",
"{",
"return",
"getAsHTMLString",
"(",
"aHCNode",
",",
"HCSettings",
".",
"getConversionSettings",
"(",
")",
")",
";",
"}"
] | Convert the passed HC node to an HTML string using the default conversion
settings.
@param aHCNode
The node to be converted. May not be <code>null</code>.
@return The node as XML with or without indentation. | [
"Convert",
"the",
"passed",
"HC",
"node",
"to",
"an",
"HTML",
"string",
"using",
"the",
"default",
"conversion",
"settings",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/render/HCRenderer.java#L241-L245 | train |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/hc/render/HCRenderer.java | HCRenderer.getAsHTMLString | @Nonnull
public static String getAsHTMLString (@Nonnull final IHCNode aHCNode,
@Nonnull final IHCConversionSettings aConversionSettings)
{
final IMicroNode aMicroNode = getAsNode (aHCNode, aConversionSettings);
if (aMicroNode == null)
return "";
return MicroWriter.getNodeAsString (aMicroNode, aConversionSettings.getXMLWriterSettings ());
} | java | @Nonnull
public static String getAsHTMLString (@Nonnull final IHCNode aHCNode,
@Nonnull final IHCConversionSettings aConversionSettings)
{
final IMicroNode aMicroNode = getAsNode (aHCNode, aConversionSettings);
if (aMicroNode == null)
return "";
return MicroWriter.getNodeAsString (aMicroNode, aConversionSettings.getXMLWriterSettings ());
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"getAsHTMLString",
"(",
"@",
"Nonnull",
"final",
"IHCNode",
"aHCNode",
",",
"@",
"Nonnull",
"final",
"IHCConversionSettings",
"aConversionSettings",
")",
"{",
"final",
"IMicroNode",
"aMicroNode",
"=",
"getAsNode",
"(",
... | Convert the passed node to it's HTML representation. First this HC-node is
converted to a micro node, which is than
@param aHCNode
The HC node to be converted to an HTML string. May not be
<code>null</code>.
@param aConversionSettings
The conversion settings to be used. May not be <code>null</code>.
@return The node as HTML string. Never <code>null</code>. | [
"Convert",
"the",
"passed",
"node",
"to",
"it",
"s",
"HTML",
"representation",
".",
"First",
"this",
"HC",
"-",
"node",
"is",
"converted",
"to",
"a",
"micro",
"node",
"which",
"is",
"than"
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/render/HCRenderer.java#L258-L267 | train |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/markdown/MarkdownHelper.java | MarkdownHelper.readRawUntil | public static int readRawUntil (final StringBuilder out, final String in, final int start, final char end)
{
int pos = start;
while (pos < in.length ())
{
final char ch = in.charAt (pos);
if (ch == end)
break;
out.append (ch);
pos++;
}
return (pos == in.length ()) ? -1 : pos;
} | java | public static int readRawUntil (final StringBuilder out, final String in, final int start, final char end)
{
int pos = start;
while (pos < in.length ())
{
final char ch = in.charAt (pos);
if (ch == end)
break;
out.append (ch);
pos++;
}
return (pos == in.length ()) ? -1 : pos;
} | [
"public",
"static",
"int",
"readRawUntil",
"(",
"final",
"StringBuilder",
"out",
",",
"final",
"String",
"in",
",",
"final",
"int",
"start",
",",
"final",
"char",
"end",
")",
"{",
"int",
"pos",
"=",
"start",
";",
"while",
"(",
"pos",
"<",
"in",
".",
... | Reads characters until the end character is encountered, ignoring escape
sequences.
@param out
The StringBuilder to write to.
@param in
The Input String.
@param start
Starting position.
@param end
End characters.
@return The new position or -1 if no 'end' char was found. | [
"Reads",
"characters",
"until",
"the",
"end",
"character",
"is",
"encountered",
"ignoring",
"escape",
"sequences",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/markdown/MarkdownHelper.java#L337-L350 | train |
phax/ph-oton | ph-oton-security/src/main/java/com/helger/photon/security/login/LoggedInUserManager.java | LoggedInUserManager.loginUser | @Nonnull
public ELoginResult loginUser (@Nullable final String sLoginName, @Nullable final String sPlainTextPassword)
{
return loginUser (sLoginName, sPlainTextPassword, (Iterable <String>) null);
} | java | @Nonnull
public ELoginResult loginUser (@Nullable final String sLoginName, @Nullable final String sPlainTextPassword)
{
return loginUser (sLoginName, sPlainTextPassword, (Iterable <String>) null);
} | [
"@",
"Nonnull",
"public",
"ELoginResult",
"loginUser",
"(",
"@",
"Nullable",
"final",
"String",
"sLoginName",
",",
"@",
"Nullable",
"final",
"String",
"sPlainTextPassword",
")",
"{",
"return",
"loginUser",
"(",
"sLoginName",
",",
"sPlainTextPassword",
",",
"(",
... | Login the passed user without much ado.
@param sLoginName
Login name of the user to log-in. May be <code>null</code>.
@param sPlainTextPassword
Plain text password to use. May be <code>null</code>.
@return Never <code>null</code> login status. | [
"Login",
"the",
"passed",
"user",
"without",
"much",
"ado",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/login/LoggedInUserManager.java#L316-L320 | train |
phax/ph-oton | ph-oton-security/src/main/java/com/helger/photon/security/login/LoggedInUserManager.java | LoggedInUserManager.logoutUser | @Nonnull
public EChange logoutUser (@Nullable final String sUserID)
{
LoginInfo aInfo;
m_aRWLock.writeLock ().lock ();
try
{
aInfo = m_aLoggedInUsers.remove (sUserID);
if (aInfo == null)
{
AuditHelper.onAuditExecuteSuccess ("logout", sUserID, "user-not-logged-in");
return EChange.UNCHANGED;
}
// Ensure that the SessionUser is empty. This is only relevant if user is
// manually logged out without destructing the underlying session
final InternalSessionUserHolder aSUH = InternalSessionUserHolder._getInstanceIfInstantiatedInScope (aInfo.getSessionScope ());
if (aSUH != null)
aSUH._reset ();
// Set logout time - in case somebody has a strong reference to the
// LoginInfo object
aInfo.setLogoutDTNow ();
}
finally
{
m_aRWLock.writeLock ().unlock ();
}
if (LOGGER.isInfoEnabled ())
LOGGER.info ("Logged out " +
_getUserIDLogText (sUserID) +
" after " +
Duration.between (aInfo.getLoginDT (), aInfo.getLogoutDT ()).toString ());
AuditHelper.onAuditExecuteSuccess ("logout", sUserID);
// Execute callback as the very last action
m_aUserLogoutCallbacks.forEach (aCB -> aCB.onUserLogout (aInfo));
return EChange.CHANGED;
} | java | @Nonnull
public EChange logoutUser (@Nullable final String sUserID)
{
LoginInfo aInfo;
m_aRWLock.writeLock ().lock ();
try
{
aInfo = m_aLoggedInUsers.remove (sUserID);
if (aInfo == null)
{
AuditHelper.onAuditExecuteSuccess ("logout", sUserID, "user-not-logged-in");
return EChange.UNCHANGED;
}
// Ensure that the SessionUser is empty. This is only relevant if user is
// manually logged out without destructing the underlying session
final InternalSessionUserHolder aSUH = InternalSessionUserHolder._getInstanceIfInstantiatedInScope (aInfo.getSessionScope ());
if (aSUH != null)
aSUH._reset ();
// Set logout time - in case somebody has a strong reference to the
// LoginInfo object
aInfo.setLogoutDTNow ();
}
finally
{
m_aRWLock.writeLock ().unlock ();
}
if (LOGGER.isInfoEnabled ())
LOGGER.info ("Logged out " +
_getUserIDLogText (sUserID) +
" after " +
Duration.between (aInfo.getLoginDT (), aInfo.getLogoutDT ()).toString ());
AuditHelper.onAuditExecuteSuccess ("logout", sUserID);
// Execute callback as the very last action
m_aUserLogoutCallbacks.forEach (aCB -> aCB.onUserLogout (aInfo));
return EChange.CHANGED;
} | [
"@",
"Nonnull",
"public",
"EChange",
"logoutUser",
"(",
"@",
"Nullable",
"final",
"String",
"sUserID",
")",
"{",
"LoginInfo",
"aInfo",
";",
"m_aRWLock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"aInfo",
"=",
"m_aLoggedInUsers",
... | Manually log out the specified user
@param sUserID
The user ID to log out
@return {@link EChange} if something changed | [
"Manually",
"log",
"out",
"the",
"specified",
"user"
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/login/LoggedInUserManager.java#L493-L533 | train |
phax/ph-oton | ph-oton-security/src/main/java/com/helger/photon/security/login/LoggedInUserManager.java | LoggedInUserManager.getLoginInfo | @Nullable
public LoginInfo getLoginInfo (@Nullable final String sUserID)
{
return m_aRWLock.readLocked ( () -> m_aLoggedInUsers.get (sUserID));
} | java | @Nullable
public LoginInfo getLoginInfo (@Nullable final String sUserID)
{
return m_aRWLock.readLocked ( () -> m_aLoggedInUsers.get (sUserID));
} | [
"@",
"Nullable",
"public",
"LoginInfo",
"getLoginInfo",
"(",
"@",
"Nullable",
"final",
"String",
"sUserID",
")",
"{",
"return",
"m_aRWLock",
".",
"readLocked",
"(",
"(",
")",
"->",
"m_aLoggedInUsers",
".",
"get",
"(",
"sUserID",
")",
")",
";",
"}"
] | Get the login details of the specified user.
@param sUserID
The user ID to check. May be <code>null</code>.
@return <code>null</code> if the passed user is not logged in. | [
"Get",
"the",
"login",
"details",
"of",
"the",
"specified",
"user",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/login/LoggedInUserManager.java#L577-L581 | train |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/Config.java | Config.loadConfig | public static void loadConfig(String options, boolean force) {
if (sIsInitialized && !force) return;
sIsInitialized = true;
Properties commandProperties = unpackOptions(options);
String userHome = getUserHome();
File userHomeDir = new File(userHome, Names.EKSTAZI_CONFIG_FILE);
Properties homeProperties = getProperties(userHomeDir);
File userDir = new File(System.getProperty("user.dir"), Names.EKSTAZI_CONFIG_FILE);
Properties userProperties = getProperties(userDir);
loadProperties(homeProperties);
loadProperties(userProperties);
loadProperties(commandProperties);
// Init Log before any print of config/debug.
Log.init(DEBUG_MODE_V == DebugMode.SCREEN || DEBUG_MODE_V == DebugMode.EVERYWHERE,
DEBUG_MODE_V == DebugMode.FILE || DEBUG_MODE_V == DebugMode.EVERYWHERE,
createFileNameInCoverageDir("debug.log"));
// Print configuration.
printVerbose(userHomeDir, userDir);
} | java | public static void loadConfig(String options, boolean force) {
if (sIsInitialized && !force) return;
sIsInitialized = true;
Properties commandProperties = unpackOptions(options);
String userHome = getUserHome();
File userHomeDir = new File(userHome, Names.EKSTAZI_CONFIG_FILE);
Properties homeProperties = getProperties(userHomeDir);
File userDir = new File(System.getProperty("user.dir"), Names.EKSTAZI_CONFIG_FILE);
Properties userProperties = getProperties(userDir);
loadProperties(homeProperties);
loadProperties(userProperties);
loadProperties(commandProperties);
// Init Log before any print of config/debug.
Log.init(DEBUG_MODE_V == DebugMode.SCREEN || DEBUG_MODE_V == DebugMode.EVERYWHERE,
DEBUG_MODE_V == DebugMode.FILE || DEBUG_MODE_V == DebugMode.EVERYWHERE,
createFileNameInCoverageDir("debug.log"));
// Print configuration.
printVerbose(userHomeDir, userDir);
} | [
"public",
"static",
"void",
"loadConfig",
"(",
"String",
"options",
",",
"boolean",
"force",
")",
"{",
"if",
"(",
"sIsInitialized",
"&&",
"!",
"force",
")",
"return",
";",
"sIsInitialized",
"=",
"true",
";",
"Properties",
"commandProperties",
"=",
"unpackOptio... | Load configuration from properties. | [
"Load",
"configuration",
"from",
"properties",
"."
] | 5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1 | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/Config.java#L260-L280 | train |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/Config.java | Config.checkNamesOfProperties | protected static boolean checkNamesOfProperties(Properties props) {
Set<String> names = getAllOptionNames(Config.class);
for (Object key : props.keySet()) {
if (!(key instanceof String) || !names.contains(key)) {
return false;
}
}
return true;
} | java | protected static boolean checkNamesOfProperties(Properties props) {
Set<String> names = getAllOptionNames(Config.class);
for (Object key : props.keySet()) {
if (!(key instanceof String) || !names.contains(key)) {
return false;
}
}
return true;
} | [
"protected",
"static",
"boolean",
"checkNamesOfProperties",
"(",
"Properties",
"props",
")",
"{",
"Set",
"<",
"String",
">",
"names",
"=",
"getAllOptionNames",
"(",
"Config",
".",
"class",
")",
";",
"for",
"(",
"Object",
"key",
":",
"props",
".",
"keySet",
... | Checks if properties have correct names. A property has a correct name if
it is one of the configuration options.
@param props
properties to check.
@return true if properties have correct names, false otherwise. | [
"Checks",
"if",
"properties",
"have",
"correct",
"names",
".",
"A",
"property",
"has",
"a",
"correct",
"name",
"if",
"it",
"is",
"one",
"of",
"the",
"configuration",
"options",
"."
] | 5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1 | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/Config.java#L387-L395 | train |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/Config.java | Config.getNumOfNonExperimentalOptions | protected static int getNumOfNonExperimentalOptions(Class<?> clz) {
Field[] options = getAllOptions(clz);
int count = 0;
for (Field option : options) {
count += option.getName().startsWith("X_") ? 0 : 1;
}
return count;
} | java | protected static int getNumOfNonExperimentalOptions(Class<?> clz) {
Field[] options = getAllOptions(clz);
int count = 0;
for (Field option : options) {
count += option.getName().startsWith("X_") ? 0 : 1;
}
return count;
} | [
"protected",
"static",
"int",
"getNumOfNonExperimentalOptions",
"(",
"Class",
"<",
"?",
">",
"clz",
")",
"{",
"Field",
"[",
"]",
"options",
"=",
"getAllOptions",
"(",
"clz",
")",
";",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"Field",
"option",
":",
"... | Returns the number of non experimental options for the given class.
@param clz
class that defines options.
@return number of non experimental options defined in the given class. | [
"Returns",
"the",
"number",
"of",
"non",
"experimental",
"options",
"for",
"the",
"given",
"class",
"."
] | 5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1 | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/Config.java#L405-L412 | train |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/Config.java | Config.main | public static void main(String[] args) {
DEBUG_MODE_V = DebugMode.SCREEN;
Log.initScreen();
printVerbose(null, null);
} | java | public static void main(String[] args) {
DEBUG_MODE_V = DebugMode.SCREEN;
Log.initScreen();
printVerbose(null, null);
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"DEBUG_MODE_V",
"=",
"DebugMode",
".",
"SCREEN",
";",
"Log",
".",
"initScreen",
"(",
")",
";",
"printVerbose",
"(",
"null",
",",
"null",
")",
";",
"}"
] | Prints configuration options.
@param args
Command line arguments (no argument is expected). | [
"Prints",
"configuration",
"options",
"."
] | 5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1 | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/Config.java#L579-L583 | train |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/hc/html/embedded/AbstractHCIFrame.java | AbstractHCIFrame.setWidth | @Nonnull
public final IMPLTYPE setWidth (final int nWidth)
{
if (nWidth >= 0)
m_sWidth = Integer.toString (nWidth);
return thisAsT ();
} | java | @Nonnull
public final IMPLTYPE setWidth (final int nWidth)
{
if (nWidth >= 0)
m_sWidth = Integer.toString (nWidth);
return thisAsT ();
} | [
"@",
"Nonnull",
"public",
"final",
"IMPLTYPE",
"setWidth",
"(",
"final",
"int",
"nWidth",
")",
"{",
"if",
"(",
"nWidth",
">=",
"0",
")",
"m_sWidth",
"=",
"Integer",
".",
"toString",
"(",
"nWidth",
")",
";",
"return",
"thisAsT",
"(",
")",
";",
"}"
] | Set the width in pixel
@param nWidth
the width in pixel
@return this | [
"Set",
"the",
"width",
"in",
"pixel"
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/html/embedded/AbstractHCIFrame.java#L163-L169 | train |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/hc/config/HCConversionSettings.java | HCConversionSettings.setCSSWriterSettings | @Nonnull
public HCConversionSettings setCSSWriterSettings (@Nonnull final ICSSWriterSettings aCSSWriterSettings)
{
ValueEnforcer.notNull (aCSSWriterSettings, "CSSWriterSettings");
m_aCSSWriterSettings = new CSSWriterSettings (aCSSWriterSettings);
return this;
} | java | @Nonnull
public HCConversionSettings setCSSWriterSettings (@Nonnull final ICSSWriterSettings aCSSWriterSettings)
{
ValueEnforcer.notNull (aCSSWriterSettings, "CSSWriterSettings");
m_aCSSWriterSettings = new CSSWriterSettings (aCSSWriterSettings);
return this;
} | [
"@",
"Nonnull",
"public",
"HCConversionSettings",
"setCSSWriterSettings",
"(",
"@",
"Nonnull",
"final",
"ICSSWriterSettings",
"aCSSWriterSettings",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aCSSWriterSettings",
",",
"\"CSSWriterSettings\"",
")",
";",
"m_aCSSWriterS... | Set the CSS writer settings to be used.
@param aCSSWriterSettings
The settings. May not be <code>null</code>.
@return this | [
"Set",
"the",
"CSS",
"writer",
"settings",
"to",
"be",
"used",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/config/HCConversionSettings.java#L252-L259 | train |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/hc/config/HCConversionSettings.java | HCConversionSettings.setJSWriterSettings | @Nonnull
public HCConversionSettings setJSWriterSettings (@Nonnull final IJSWriterSettings aJSWriterSettings)
{
ValueEnforcer.notNull (aJSWriterSettings, "JSWriterSettings");
m_aJSWriterSettings = new JSWriterSettings (aJSWriterSettings);
return this;
} | java | @Nonnull
public HCConversionSettings setJSWriterSettings (@Nonnull final IJSWriterSettings aJSWriterSettings)
{
ValueEnforcer.notNull (aJSWriterSettings, "JSWriterSettings");
m_aJSWriterSettings = new JSWriterSettings (aJSWriterSettings);
return this;
} | [
"@",
"Nonnull",
"public",
"HCConversionSettings",
"setJSWriterSettings",
"(",
"@",
"Nonnull",
"final",
"IJSWriterSettings",
"aJSWriterSettings",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aJSWriterSettings",
",",
"\"JSWriterSettings\"",
")",
";",
"m_aJSWriterSetting... | Set the JS formatter settings to be used.
@param aJSWriterSettings
The settings. May not be <code>null</code>.
@return this | [
"Set",
"the",
"JS",
"formatter",
"settings",
"to",
"be",
"used",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/config/HCConversionSettings.java#L289-L296 | train |
phax/ph-oton | ph-oton-uicore/src/main/java/com/helger/photon/uicore/html/google/ReCaptchaServerSideValidator.java | ReCaptchaServerSideValidator.check | @Nonnull
public static ESuccess check (@Nonnull @Nonempty final String sServerSideKey,
@Nullable final String sReCaptchaResponse)
{
ValueEnforcer.notEmpty (sServerSideKey, "ServerSideKey");
if (StringHelper.hasNoText (sReCaptchaResponse))
return ESuccess.SUCCESS;
final HttpClientFactory aHCFactory = new HttpClientFactory ();
// For proxy etc
aHCFactory.setUseSystemProperties (true);
try (HttpClientManager aMgr = new HttpClientManager (aHCFactory))
{
final HttpPost aPost = new HttpPost (new SimpleURL ("https://www.google.com/recaptcha/api/siteverify").add ("secret",
sServerSideKey)
.add ("response",
sReCaptchaResponse)
.getAsURI ());
final ResponseHandlerJson aRH = new ResponseHandlerJson ();
final IJson aJson = aMgr.execute (aPost, aRH);
if (aJson != null && aJson.isObject ())
{
final boolean bSuccess = aJson.getAsObject ().getAsBoolean ("success", false);
if (GlobalDebug.isDebugMode ())
LOGGER.info ("ReCpatcha Response for '" + sReCaptchaResponse + "': " + aJson.getAsJsonString ());
return ESuccess.valueOf (bSuccess);
}
}
catch (final IOException ex)
{
LOGGER.warn ("Error checking ReCaptcha response", ex);
}
return ESuccess.FAILURE;
} | java | @Nonnull
public static ESuccess check (@Nonnull @Nonempty final String sServerSideKey,
@Nullable final String sReCaptchaResponse)
{
ValueEnforcer.notEmpty (sServerSideKey, "ServerSideKey");
if (StringHelper.hasNoText (sReCaptchaResponse))
return ESuccess.SUCCESS;
final HttpClientFactory aHCFactory = new HttpClientFactory ();
// For proxy etc
aHCFactory.setUseSystemProperties (true);
try (HttpClientManager aMgr = new HttpClientManager (aHCFactory))
{
final HttpPost aPost = new HttpPost (new SimpleURL ("https://www.google.com/recaptcha/api/siteverify").add ("secret",
sServerSideKey)
.add ("response",
sReCaptchaResponse)
.getAsURI ());
final ResponseHandlerJson aRH = new ResponseHandlerJson ();
final IJson aJson = aMgr.execute (aPost, aRH);
if (aJson != null && aJson.isObject ())
{
final boolean bSuccess = aJson.getAsObject ().getAsBoolean ("success", false);
if (GlobalDebug.isDebugMode ())
LOGGER.info ("ReCpatcha Response for '" + sReCaptchaResponse + "': " + aJson.getAsJsonString ());
return ESuccess.valueOf (bSuccess);
}
}
catch (final IOException ex)
{
LOGGER.warn ("Error checking ReCaptcha response", ex);
}
return ESuccess.FAILURE;
} | [
"@",
"Nonnull",
"public",
"static",
"ESuccess",
"check",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sServerSideKey",
",",
"@",
"Nullable",
"final",
"String",
"sReCaptchaResponse",
")",
"{",
"ValueEnforcer",
".",
"notEmpty",
"(",
"sServerSideKey",
... | Check if the response of a RecCaptcha is valid or not.
@param sServerSideKey
Server side ReCaptcha key for verification
@param sReCaptchaResponse
The value of the <code>g-recaptcha-response</code> request
parameter.
@return {@link ESuccess} | [
"Check",
"if",
"the",
"response",
"of",
"a",
"RecCaptcha",
"is",
"valid",
"or",
"not",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uicore/src/main/java/com/helger/photon/uicore/html/google/ReCaptchaServerSideValidator.java#L56-L93 | train |
phax/ph-oton | ph-oton-api/src/main/java/com/helger/photon/api/APIPath.java | APIPath.getInvocationURL | @Nonnull
public SimpleURL getInvocationURL (@Nonnull final String sBasePath)
{
ValueEnforcer.notNull (sBasePath, "BasePath");
return new SimpleURL (sBasePath + m_sPath);
} | java | @Nonnull
public SimpleURL getInvocationURL (@Nonnull final String sBasePath)
{
ValueEnforcer.notNull (sBasePath, "BasePath");
return new SimpleURL (sBasePath + m_sPath);
} | [
"@",
"Nonnull",
"public",
"SimpleURL",
"getInvocationURL",
"(",
"@",
"Nonnull",
"final",
"String",
"sBasePath",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"sBasePath",
",",
"\"BasePath\"",
")",
";",
"return",
"new",
"SimpleURL",
"(",
"sBasePath",
"+",
"m_... | Get the invocation URL of this API path.
@param sBasePath
The HTTP base path of the server (e.g. http://www.example.org/api"),
which is prepended to the relative path of this object. May not be
<code>null</code> but maybe empty (since v8.1.4)
@return The new URL. Never <code>null</code>.
@see #getPath() | [
"Get",
"the",
"invocation",
"URL",
"of",
"this",
"API",
"path",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-api/src/main/java/com/helger/photon/api/APIPath.java#L92-L97 | train |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/hc/html/forms/AbstractHCCheckBox.java | AbstractHCCheckBox.getHiddenFieldName | @Nullable
public final String getHiddenFieldName ()
{
final String sFieldName = getName ();
if (StringHelper.hasNoText (sFieldName))
return null;
return HIDDEN_FIELD_PREFIX + sFieldName;
} | java | @Nullable
public final String getHiddenFieldName ()
{
final String sFieldName = getName ();
if (StringHelper.hasNoText (sFieldName))
return null;
return HIDDEN_FIELD_PREFIX + sFieldName;
} | [
"@",
"Nullable",
"public",
"final",
"String",
"getHiddenFieldName",
"(",
")",
"{",
"final",
"String",
"sFieldName",
"=",
"getName",
"(",
")",
";",
"if",
"(",
"StringHelper",
".",
"hasNoText",
"(",
"sFieldName",
")",
")",
"return",
"null",
";",
"return",
"H... | Get the hidden field name for this checkbox.
@return <code>null</code> if no field name ({@link #getName()}) is present
or a non-<code>null</code> and non-empty string. | [
"Get",
"the",
"hidden",
"field",
"name",
"for",
"this",
"checkbox",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/html/forms/AbstractHCCheckBox.java#L132-L140 | train |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/js/JSEventMap.java | JSEventMap.addHandler | public void addHandler (@Nonnull final EJSEvent eJSEvent, @Nonnull final IHasJSCode aNewHandler)
{
ValueEnforcer.notNull (eJSEvent, "JSEvent");
ValueEnforcer.notNull (aNewHandler, "NewHandler");
CollectingJSCodeProvider aCode = m_aEvents.get (eJSEvent);
if (aCode == null)
{
aCode = new CollectingJSCodeProvider ();
m_aEvents.put (eJSEvent, aCode);
}
aCode.appendFlattened (aNewHandler);
} | java | public void addHandler (@Nonnull final EJSEvent eJSEvent, @Nonnull final IHasJSCode aNewHandler)
{
ValueEnforcer.notNull (eJSEvent, "JSEvent");
ValueEnforcer.notNull (aNewHandler, "NewHandler");
CollectingJSCodeProvider aCode = m_aEvents.get (eJSEvent);
if (aCode == null)
{
aCode = new CollectingJSCodeProvider ();
m_aEvents.put (eJSEvent, aCode);
}
aCode.appendFlattened (aNewHandler);
} | [
"public",
"void",
"addHandler",
"(",
"@",
"Nonnull",
"final",
"EJSEvent",
"eJSEvent",
",",
"@",
"Nonnull",
"final",
"IHasJSCode",
"aNewHandler",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"eJSEvent",
",",
"\"JSEvent\"",
")",
";",
"ValueEnforcer",
".",
"no... | Add an additional handler for the given JS event. If an existing handler is
present, the new handler is appended at the end.
@param eJSEvent
The JS event. May not be <code>null</code>.
@param aNewHandler
The new handler to be added. May not be <code>null</code>. | [
"Add",
"an",
"additional",
"handler",
"for",
"the",
"given",
"JS",
"event",
".",
"If",
"an",
"existing",
"handler",
"is",
"present",
"the",
"new",
"handler",
"is",
"appended",
"at",
"the",
"end",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/js/JSEventMap.java#L53-L65 | train |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/js/JSEventMap.java | JSEventMap.prependHandler | public void prependHandler (@Nonnull final EJSEvent eJSEvent, @Nonnull final IHasJSCode aNewHandler)
{
ValueEnforcer.notNull (eJSEvent, "JSEvent");
ValueEnforcer.notNull (aNewHandler, "NewHandler");
CollectingJSCodeProvider aCode = m_aEvents.get (eJSEvent);
if (aCode == null)
{
aCode = new CollectingJSCodeProvider ();
m_aEvents.put (eJSEvent, aCode);
}
aCode.prepend (aNewHandler);
} | java | public void prependHandler (@Nonnull final EJSEvent eJSEvent, @Nonnull final IHasJSCode aNewHandler)
{
ValueEnforcer.notNull (eJSEvent, "JSEvent");
ValueEnforcer.notNull (aNewHandler, "NewHandler");
CollectingJSCodeProvider aCode = m_aEvents.get (eJSEvent);
if (aCode == null)
{
aCode = new CollectingJSCodeProvider ();
m_aEvents.put (eJSEvent, aCode);
}
aCode.prepend (aNewHandler);
} | [
"public",
"void",
"prependHandler",
"(",
"@",
"Nonnull",
"final",
"EJSEvent",
"eJSEvent",
",",
"@",
"Nonnull",
"final",
"IHasJSCode",
"aNewHandler",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"eJSEvent",
",",
"\"JSEvent\"",
")",
";",
"ValueEnforcer",
".",
... | Add an additional handler for the given JS event. If an existing handler is
present, the new handler is appended at front.
@param eJSEvent
The JS event. May not be <code>null</code>.
@param aNewHandler
The new handler to be added. May not be <code>null</code>. | [
"Add",
"an",
"additional",
"handler",
"for",
"the",
"given",
"JS",
"event",
".",
"If",
"an",
"existing",
"handler",
"is",
"present",
"the",
"new",
"handler",
"is",
"appended",
"at",
"front",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/js/JSEventMap.java#L76-L88 | train |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/js/JSEventMap.java | JSEventMap.setHandler | public void setHandler (@Nonnull final EJSEvent eJSEvent, @Nonnull final IHasJSCode aNewHandler)
{
ValueEnforcer.notNull (eJSEvent, "JSEvent");
ValueEnforcer.notNull (aNewHandler, "NewHandler");
// Set only the new handler and remove any existing handler
m_aEvents.put (eJSEvent, new CollectingJSCodeProvider ().appendFlattened (aNewHandler));
} | java | public void setHandler (@Nonnull final EJSEvent eJSEvent, @Nonnull final IHasJSCode aNewHandler)
{
ValueEnforcer.notNull (eJSEvent, "JSEvent");
ValueEnforcer.notNull (aNewHandler, "NewHandler");
// Set only the new handler and remove any existing handler
m_aEvents.put (eJSEvent, new CollectingJSCodeProvider ().appendFlattened (aNewHandler));
} | [
"public",
"void",
"setHandler",
"(",
"@",
"Nonnull",
"final",
"EJSEvent",
"eJSEvent",
",",
"@",
"Nonnull",
"final",
"IHasJSCode",
"aNewHandler",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"eJSEvent",
",",
"\"JSEvent\"",
")",
";",
"ValueEnforcer",
".",
"no... | Set a handler for the given JS event. If an existing handler is present, it
is automatically overridden.
@param eJSEvent
The JS event. May not be <code>null</code>.
@param aNewHandler
The new handler to be added. May not be <code>null</code>. | [
"Set",
"a",
"handler",
"for",
"the",
"given",
"JS",
"event",
".",
"If",
"an",
"existing",
"handler",
"is",
"present",
"it",
"is",
"automatically",
"overridden",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/js/JSEventMap.java#L99-L106 | train |
JamesIry/jADT | jADT-core/src/main/java/com/pogofish/jadt/source/FileSourceFactory.java | FileSourceFactory.createSources | @Override
public List<FileSource> createSources(String srcName) {
final File dirOrFile = new File(srcName);
final File[] files = dirOrFile.listFiles(FILTER);
if (files != null) {
final List<FileSource> sources = new ArrayList<FileSource>(files.length);
for (File file : files) {
sources.add(new FileSource(file));
}
return sources;
} else {
return Util.list(new FileSource(dirOrFile));
}
} | java | @Override
public List<FileSource> createSources(String srcName) {
final File dirOrFile = new File(srcName);
final File[] files = dirOrFile.listFiles(FILTER);
if (files != null) {
final List<FileSource> sources = new ArrayList<FileSource>(files.length);
for (File file : files) {
sources.add(new FileSource(file));
}
return sources;
} else {
return Util.list(new FileSource(dirOrFile));
}
} | [
"@",
"Override",
"public",
"List",
"<",
"FileSource",
">",
"createSources",
"(",
"String",
"srcName",
")",
"{",
"final",
"File",
"dirOrFile",
"=",
"new",
"File",
"(",
"srcName",
")",
";",
"final",
"File",
"[",
"]",
"files",
"=",
"dirOrFile",
".",
"listFi... | Return sa list of FileSources based on the name. If the name
is a directory then it returns all the files in that directory
ending with .jadt. Otherwise it is assumed that the name
is a file. | [
"Return",
"sa",
"list",
"of",
"FileSources",
"based",
"on",
"the",
"name",
".",
"If",
"the",
"name",
"is",
"a",
"directory",
"then",
"it",
"returns",
"all",
"the",
"files",
"in",
"that",
"directory",
"ending",
"with",
".",
"jadt",
".",
"Otherwise",
"it",... | 92ee94b6624cd673851497d78c218837dcf02b8a | https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/source/FileSourceFactory.java#L44-L58 | train |
phax/ph-oton | ph-oton-security/src/main/java/com/helger/photon/security/token/accesstoken/AccessToken.java | AccessToken.createAccessTokenValidFromNow | @Nonnull
public static AccessToken createAccessTokenValidFromNow (@Nullable final String sTokenString)
{
// Length 66 so that the Base64 encoding does not add the "==" signs
// Length must be dividable by 3
final String sRealTokenString = StringHelper.hasText (sTokenString) ? sTokenString : createNewTokenString (66);
return new AccessToken (sRealTokenString, PDTFactory.getCurrentLocalDateTime (), null, new RevocationStatus ());
} | java | @Nonnull
public static AccessToken createAccessTokenValidFromNow (@Nullable final String sTokenString)
{
// Length 66 so that the Base64 encoding does not add the "==" signs
// Length must be dividable by 3
final String sRealTokenString = StringHelper.hasText (sTokenString) ? sTokenString : createNewTokenString (66);
return new AccessToken (sRealTokenString, PDTFactory.getCurrentLocalDateTime (), null, new RevocationStatus ());
} | [
"@",
"Nonnull",
"public",
"static",
"AccessToken",
"createAccessTokenValidFromNow",
"(",
"@",
"Nullable",
"final",
"String",
"sTokenString",
")",
"{",
"// Length 66 so that the Base64 encoding does not add the \"==\" signs",
"// Length must be dividable by 3",
"final",
"String",
... | Create a new access token that is valid from now on for an infinite amount
of time.
@param sTokenString
The existing token string. May be <code>null</code> in which case a
new token string is created.
@return Never <code>null</code>. | [
"Create",
"a",
"new",
"access",
"token",
"that",
"is",
"valid",
"from",
"now",
"on",
"for",
"an",
"infinite",
"amount",
"of",
"time",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/token/accesstoken/AccessToken.java#L154-L161 | train |
phax/ph-oton | ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/famfam/FamFamFlags.java | FamFamFlags.getFlagFromLocale | @Nullable
public static EFamFamFlagIcon getFlagFromLocale (@Nullable final Locale aFlagLocale)
{
if (aFlagLocale != null)
{
final String sCountry = aFlagLocale.getCountry ();
if (StringHelper.hasText (sCountry))
return EFamFamFlagIcon.getFromIDOrNull (sCountry);
}
return null;
} | java | @Nullable
public static EFamFamFlagIcon getFlagFromLocale (@Nullable final Locale aFlagLocale)
{
if (aFlagLocale != null)
{
final String sCountry = aFlagLocale.getCountry ();
if (StringHelper.hasText (sCountry))
return EFamFamFlagIcon.getFromIDOrNull (sCountry);
}
return null;
} | [
"@",
"Nullable",
"public",
"static",
"EFamFamFlagIcon",
"getFlagFromLocale",
"(",
"@",
"Nullable",
"final",
"Locale",
"aFlagLocale",
")",
"{",
"if",
"(",
"aFlagLocale",
"!=",
"null",
")",
"{",
"final",
"String",
"sCountry",
"=",
"aFlagLocale",
".",
"getCountry",... | Get the flag from the passed locale
@param aFlagLocale
The locale to resolve. May be <code>null</code>.
@return <code>null</code> if the passed locale is <code>null</code>, if the
locale has no country or if the no flag is present for the passed
locale. | [
"Get",
"the",
"flag",
"from",
"the",
"passed",
"locale"
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/famfam/FamFamFlags.java#L50-L60 | train |
gliga/ekstazi | ekstazi-maven-plugin/src/main/java/org/ekstazi/maven/DynamicSelectEkstaziMojo.java | DynamicSelectEkstaziMojo.checkIfEkstaziDirCanBeCreated | private void checkIfEkstaziDirCanBeCreated() throws MojoExecutionException {
File ekstaziDir = Config.createRootDir(parentdir);
// If .ekstazi does not exist and cannot be created, let them
// know. (We also remove directory if successfully created.)
if (!ekstaziDir.exists() && (!ekstaziDir.mkdirs() || !ekstaziDir.delete())) {
throw new MojoExecutionException("Cannot create Ekstazi directory in " + parentdir);
}
} | java | private void checkIfEkstaziDirCanBeCreated() throws MojoExecutionException {
File ekstaziDir = Config.createRootDir(parentdir);
// If .ekstazi does not exist and cannot be created, let them
// know. (We also remove directory if successfully created.)
if (!ekstaziDir.exists() && (!ekstaziDir.mkdirs() || !ekstaziDir.delete())) {
throw new MojoExecutionException("Cannot create Ekstazi directory in " + parentdir);
}
} | [
"private",
"void",
"checkIfEkstaziDirCanBeCreated",
"(",
")",
"throws",
"MojoExecutionException",
"{",
"File",
"ekstaziDir",
"=",
"Config",
".",
"createRootDir",
"(",
"parentdir",
")",
";",
"// If .ekstazi does not exist and cannot be created, let them",
"// know. (We also rem... | Checks if .ekstazi directory can be created. For example, the
problems can happen if there is no sufficient permission. | [
"Checks",
"if",
".",
"ekstazi",
"directory",
"can",
"be",
"created",
".",
"For",
"example",
"the",
"problems",
"can",
"happen",
"if",
"there",
"is",
"no",
"sufficient",
"permission",
"."
] | 5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1 | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/ekstazi-maven-plugin/src/main/java/org/ekstazi/maven/DynamicSelectEkstaziMojo.java#L68-L75 | train |
phax/ph-oton | ph-oton-core/src/main/java/com/helger/photon/core/systemmsg/SystemMessageData.java | SystemMessageData.setSystemMessage | @Nonnull
public EChange setSystemMessage (@Nonnull final ESystemMessageType eMessageType, @Nullable final String sMessage)
{
ValueEnforcer.notNull (eMessageType, "MessageType");
if (m_eMessageType.equals (eMessageType) && EqualsHelper.equals (m_sMessage, sMessage))
return EChange.UNCHANGED;
internalSetMessageType (eMessageType);
internalSetMessage (sMessage);
setLastUpdate (PDTFactory.getCurrentLocalDateTime ());
return EChange.CHANGED;
} | java | @Nonnull
public EChange setSystemMessage (@Nonnull final ESystemMessageType eMessageType, @Nullable final String sMessage)
{
ValueEnforcer.notNull (eMessageType, "MessageType");
if (m_eMessageType.equals (eMessageType) && EqualsHelper.equals (m_sMessage, sMessage))
return EChange.UNCHANGED;
internalSetMessageType (eMessageType);
internalSetMessage (sMessage);
setLastUpdate (PDTFactory.getCurrentLocalDateTime ());
return EChange.CHANGED;
} | [
"@",
"Nonnull",
"public",
"EChange",
"setSystemMessage",
"(",
"@",
"Nonnull",
"final",
"ESystemMessageType",
"eMessageType",
",",
"@",
"Nullable",
"final",
"String",
"sMessage",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"eMessageType",
",",
"\"MessageType\"",
... | Set the system message type and text, and update the last modification
date.
@param eMessageType
Message type. May not be <code>null</code>.
@param sMessage
The message text. May be <code>null</code>.
@return {@link EChange} | [
"Set",
"the",
"system",
"message",
"type",
"and",
"text",
"and",
"update",
"the",
"last",
"modification",
"date",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/systemmsg/SystemMessageData.java#L105-L118 | train |
spotify/crtauth-java | src/main/java/com/spotify/crtauth/CrtAuthServer.java | CrtAuthServer.createChallenge | public String createChallenge(String request)
throws IllegalArgumentException, ProtocolVersionException {
String userName;
userName = CrtAuthCodec.deserializeRequest(request);
Fingerprint fingerprint;
try {
fingerprint = new Fingerprint(getKeyForUser(userName));
} catch (KeyNotFoundException e) {
log.info("No public key found for user {}, creating fake fingerprint", userName);
fingerprint = createFakeFingerprint(userName);
}
byte[] uniqueData = new byte[Challenge.UNIQUE_DATA_LENGTH];
UnsignedInteger timeNow = timeSupplier.getTime();
random.nextBytes(uniqueData);
Challenge challenge = Challenge.newBuilder()
.setFingerprint(fingerprint)
.setUniqueData(uniqueData)
.setValidFromTimestamp(timeNow.minus(CLOCK_FUDGE))
.setValidToTimestamp(timeNow.plus(RESPONSE_TIMEOUT))
.setServerName(serverName)
.setUserName(userName)
.build();
return encode(CrtAuthCodec.serialize(challenge, secret));
} | java | public String createChallenge(String request)
throws IllegalArgumentException, ProtocolVersionException {
String userName;
userName = CrtAuthCodec.deserializeRequest(request);
Fingerprint fingerprint;
try {
fingerprint = new Fingerprint(getKeyForUser(userName));
} catch (KeyNotFoundException e) {
log.info("No public key found for user {}, creating fake fingerprint", userName);
fingerprint = createFakeFingerprint(userName);
}
byte[] uniqueData = new byte[Challenge.UNIQUE_DATA_LENGTH];
UnsignedInteger timeNow = timeSupplier.getTime();
random.nextBytes(uniqueData);
Challenge challenge = Challenge.newBuilder()
.setFingerprint(fingerprint)
.setUniqueData(uniqueData)
.setValidFromTimestamp(timeNow.minus(CLOCK_FUDGE))
.setValidToTimestamp(timeNow.plus(RESPONSE_TIMEOUT))
.setServerName(serverName)
.setUserName(userName)
.build();
return encode(CrtAuthCodec.serialize(challenge, secret));
} | [
"public",
"String",
"createChallenge",
"(",
"String",
"request",
")",
"throws",
"IllegalArgumentException",
",",
"ProtocolVersionException",
"{",
"String",
"userName",
";",
"userName",
"=",
"CrtAuthCodec",
".",
"deserializeRequest",
"(",
"request",
")",
";",
"Fingerpr... | Create a challenge to authenticate a given user. The userName needs to be provided at this
stage to encode a fingerprint of the public key stored in the server encoded in the challenge.
This is required because a client can hold more than one private key and would need this
information to pick the right key to sign the response. If the keyProvider fails to retrieve
the public key, a fake Fingerprint is generated so that the presence of a challenge doesn't
reveal whether a user key is present on the server or not.
@param request The request message which contains an encoded username
@return A challenge message.
@throws IllegalArgumentException if the request format is invalid | [
"Create",
"a",
"challenge",
"to",
"authenticate",
"a",
"given",
"user",
".",
"The",
"userName",
"needs",
"to",
"be",
"provided",
"at",
"this",
"stage",
"to",
"encode",
"a",
"fingerprint",
"of",
"the",
"public",
"key",
"stored",
"in",
"the",
"server",
"enco... | 90f3b40323848740c915b195ad1b547fbeb41700 | https://github.com/spotify/crtauth-java/blob/90f3b40323848740c915b195ad1b547fbeb41700/src/main/java/com/spotify/crtauth/CrtAuthServer.java#L187-L214 | train |
spotify/crtauth-java | src/main/java/com/spotify/crtauth/CrtAuthServer.java | CrtAuthServer.getKeyForUser | private RSAPublicKey getKeyForUser(String userName) throws KeyNotFoundException {
RSAPublicKey key = null;
for (final KeyProvider keyProvider : keyProviders) {
try {
key = keyProvider.getKey(userName);
break;
} catch (KeyNotFoundException e) {
// that's fine, try the next provider
}
}
if (key == null) {
throw new KeyNotFoundException();
}
return key;
} | java | private RSAPublicKey getKeyForUser(String userName) throws KeyNotFoundException {
RSAPublicKey key = null;
for (final KeyProvider keyProvider : keyProviders) {
try {
key = keyProvider.getKey(userName);
break;
} catch (KeyNotFoundException e) {
// that's fine, try the next provider
}
}
if (key == null) {
throw new KeyNotFoundException();
}
return key;
} | [
"private",
"RSAPublicKey",
"getKeyForUser",
"(",
"String",
"userName",
")",
"throws",
"KeyNotFoundException",
"{",
"RSAPublicKey",
"key",
"=",
"null",
";",
"for",
"(",
"final",
"KeyProvider",
"keyProvider",
":",
"keyProviders",
")",
"{",
"try",
"{",
"key",
"=",
... | Get the public key for a user by iterating through all key providers. The first
matching key will be returned.
@param userName the username to get the key for
@return the first RSAPublicKey found for the user
@throws KeyNotFoundException | [
"Get",
"the",
"public",
"key",
"for",
"a",
"user",
"by",
"iterating",
"through",
"all",
"key",
"providers",
".",
"The",
"first",
"matching",
"key",
"will",
"be",
"returned",
"."
] | 90f3b40323848740c915b195ad1b547fbeb41700 | https://github.com/spotify/crtauth-java/blob/90f3b40323848740c915b195ad1b547fbeb41700/src/main/java/com/spotify/crtauth/CrtAuthServer.java#L224-L240 | train |
spotify/crtauth-java | src/main/java/com/spotify/crtauth/CrtAuthServer.java | CrtAuthServer.createFakeFingerprint | private Fingerprint createFakeFingerprint(String userName) {
byte[] usernameHmac = CrtAuthCodec.getAuthenticationCode(
this.secret, userName.getBytes(Charsets.UTF_8));
return new Fingerprint(Arrays.copyOfRange(usernameHmac, 0, 6));
} | java | private Fingerprint createFakeFingerprint(String userName) {
byte[] usernameHmac = CrtAuthCodec.getAuthenticationCode(
this.secret, userName.getBytes(Charsets.UTF_8));
return new Fingerprint(Arrays.copyOfRange(usernameHmac, 0, 6));
} | [
"private",
"Fingerprint",
"createFakeFingerprint",
"(",
"String",
"userName",
")",
"{",
"byte",
"[",
"]",
"usernameHmac",
"=",
"CrtAuthCodec",
".",
"getAuthenticationCode",
"(",
"this",
".",
"secret",
",",
"userName",
".",
"getBytes",
"(",
"Charsets",
".",
"UTF_... | Generate a fake real looking fingerprint for a non-existent user.
@param userName the username to seed the transform with
@return a Fingerprint with bytes that are a function of username and secret | [
"Generate",
"a",
"fake",
"real",
"looking",
"fingerprint",
"for",
"a",
"non",
"-",
"existent",
"user",
"."
] | 90f3b40323848740c915b195ad1b547fbeb41700 | https://github.com/spotify/crtauth-java/blob/90f3b40323848740c915b195ad1b547fbeb41700/src/main/java/com/spotify/crtauth/CrtAuthServer.java#L248-L252 | train |
spotify/crtauth-java | src/main/java/com/spotify/crtauth/CrtAuthServer.java | CrtAuthServer.createToken | public String createToken(String response)
throws IllegalArgumentException, ProtocolVersionException {
final Response decodedResponse;
final Challenge challenge;
decodedResponse = CrtAuthCodec.deserializeResponse(decode(response));
challenge = CrtAuthCodec.deserializeChallengeAuthenticated(
decodedResponse.getPayload(), secret);
if (!challenge.getServerName().equals(serverName)) {
throw new IllegalArgumentException("Got challenge with the wrong server_name encoded.");
}
PublicKey publicKey;
try {
publicKey = getKeyForUser(challenge.getUserName());
} catch (KeyNotFoundException e) {
// If the user requesting authentication doesn't have a public key, we throw an
// InvalidInputException. This normally shouldn't happen, since at this stage a challenge
// should have already been sent, which in turn requires knowledge of the user's public key.
throw new IllegalArgumentException(e);
}
boolean signatureVerified;
try {
Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM);
signature.initVerify(publicKey);
signature.update(decodedResponse.getPayload());
signatureVerified = signature.verify(decodedResponse.getSignature());
} catch (Exception e) {
throw new RuntimeException(e);
}
if (challenge.isExpired(timeSupplier)) {
throw new IllegalArgumentException("The challenge is out of its validity period");
}
if (!signatureVerified) {
throw new IllegalArgumentException("Client did not provide proof that it controls the " +
"secret key.");
}
UnsignedInteger validFrom = timeSupplier.getTime().minus(CLOCK_FUDGE);
UnsignedInteger validTo = timeSupplier.getTime().plus(tokenLifetimeSeconds);
Token token = new Token(validFrom.intValue(), validTo.intValue(), challenge.getUserName());
return encode(CrtAuthCodec.serialize(token, secret));
} | java | public String createToken(String response)
throws IllegalArgumentException, ProtocolVersionException {
final Response decodedResponse;
final Challenge challenge;
decodedResponse = CrtAuthCodec.deserializeResponse(decode(response));
challenge = CrtAuthCodec.deserializeChallengeAuthenticated(
decodedResponse.getPayload(), secret);
if (!challenge.getServerName().equals(serverName)) {
throw new IllegalArgumentException("Got challenge with the wrong server_name encoded.");
}
PublicKey publicKey;
try {
publicKey = getKeyForUser(challenge.getUserName());
} catch (KeyNotFoundException e) {
// If the user requesting authentication doesn't have a public key, we throw an
// InvalidInputException. This normally shouldn't happen, since at this stage a challenge
// should have already been sent, which in turn requires knowledge of the user's public key.
throw new IllegalArgumentException(e);
}
boolean signatureVerified;
try {
Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM);
signature.initVerify(publicKey);
signature.update(decodedResponse.getPayload());
signatureVerified = signature.verify(decodedResponse.getSignature());
} catch (Exception e) {
throw new RuntimeException(e);
}
if (challenge.isExpired(timeSupplier)) {
throw new IllegalArgumentException("The challenge is out of its validity period");
}
if (!signatureVerified) {
throw new IllegalArgumentException("Client did not provide proof that it controls the " +
"secret key.");
}
UnsignedInteger validFrom = timeSupplier.getTime().minus(CLOCK_FUDGE);
UnsignedInteger validTo = timeSupplier.getTime().plus(tokenLifetimeSeconds);
Token token = new Token(validFrom.intValue(), validTo.intValue(), challenge.getUserName());
return encode(CrtAuthCodec.serialize(token, secret));
} | [
"public",
"String",
"createToken",
"(",
"String",
"response",
")",
"throws",
"IllegalArgumentException",
",",
"ProtocolVersionException",
"{",
"final",
"Response",
"decodedResponse",
";",
"final",
"Challenge",
"challenge",
";",
"decodedResponse",
"=",
"CrtAuthCodec",
".... | Given the response to a previous challenge, produce a token used by the client to
authenticate.
@param response The client's response to the initial challenge.
@return A token used to authenticate subsequent requests.
@throws IllegalArgumentException if there is an encoding error in the response message | [
"Given",
"the",
"response",
"to",
"a",
"previous",
"challenge",
"produce",
"a",
"token",
"used",
"by",
"the",
"client",
"to",
"authenticate",
"."
] | 90f3b40323848740c915b195ad1b547fbeb41700 | https://github.com/spotify/crtauth-java/blob/90f3b40323848740c915b195ad1b547fbeb41700/src/main/java/com/spotify/crtauth/CrtAuthServer.java#L262-L302 | train |
spotify/crtauth-java | src/main/java/com/spotify/crtauth/CrtAuthServer.java | CrtAuthServer.validateToken | public String validateToken(String token)
throws IllegalArgumentException, TokenExpiredException, ProtocolVersionException {
final Token deserializedToken =
CrtAuthCodec.deserializeTokenAuthenticated(decode(token), secret);
if (deserializedToken.isExpired(timeSupplier)) {
throw new TokenExpiredException();
}
if (deserializedToken.getValidTo() - deserializedToken.getValidFrom() > MAX_VALIDITY) {
throw new TokenExpiredException("Overly long token lifetime.");
}
return deserializedToken.getUserName();
} | java | public String validateToken(String token)
throws IllegalArgumentException, TokenExpiredException, ProtocolVersionException {
final Token deserializedToken =
CrtAuthCodec.deserializeTokenAuthenticated(decode(token), secret);
if (deserializedToken.isExpired(timeSupplier)) {
throw new TokenExpiredException();
}
if (deserializedToken.getValidTo() - deserializedToken.getValidFrom() > MAX_VALIDITY) {
throw new TokenExpiredException("Overly long token lifetime.");
}
return deserializedToken.getUserName();
} | [
"public",
"String",
"validateToken",
"(",
"String",
"token",
")",
"throws",
"IllegalArgumentException",
",",
"TokenExpiredException",
",",
"ProtocolVersionException",
"{",
"final",
"Token",
"deserializedToken",
"=",
"CrtAuthCodec",
".",
"deserializeTokenAuthenticated",
"(",... | Verify that a given token is valid, i.e. that it has been produced by the current authenticator
and that it hasn't expired.
@param token the token to validate.
@return the username that this token belongs to.
@throws IllegalArgumentException If the token appears to have been tampered with.
@throws TokenExpiredException If the token has expired. | [
"Verify",
"that",
"a",
"given",
"token",
"is",
"valid",
"i",
".",
"e",
".",
"that",
"it",
"has",
"been",
"produced",
"by",
"the",
"current",
"authenticator",
"and",
"that",
"it",
"hasn",
"t",
"expired",
"."
] | 90f3b40323848740c915b195ad1b547fbeb41700 | https://github.com/spotify/crtauth-java/blob/90f3b40323848740c915b195ad1b547fbeb41700/src/main/java/com/spotify/crtauth/CrtAuthServer.java#L313-L324 | train |
Arnauld/gutenberg | src/main/java/gutenberg/pygments/Lexers.java | Lexers.lookupLexer | public Optional<Object> lookupLexer(PyGateway gateway, String alias) {
Object result = lexerCache.get(alias);
if (result == null) {
result = evalLookupLexer(gateway, alias, NULL);
lexerCache.put(alias, result);
}
if (result == NULL) {
return Optional.absent();
} else {
return Optional.of(result);
}
} | java | public Optional<Object> lookupLexer(PyGateway gateway, String alias) {
Object result = lexerCache.get(alias);
if (result == null) {
result = evalLookupLexer(gateway, alias, NULL);
lexerCache.put(alias, result);
}
if (result == NULL) {
return Optional.absent();
} else {
return Optional.of(result);
}
} | [
"public",
"Optional",
"<",
"Object",
">",
"lookupLexer",
"(",
"PyGateway",
"gateway",
",",
"String",
"alias",
")",
"{",
"Object",
"result",
"=",
"lexerCache",
".",
"get",
"(",
"alias",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=... | Lookup a Pygments lexer by an alias.
@param gateway
@param alias language alias for which a lexer is queried | [
"Lookup",
"a",
"Pygments",
"lexer",
"by",
"an",
"alias",
"."
] | 18d761ddba378ee58a3f3dc6316f66742df8d985 | https://github.com/Arnauld/gutenberg/blob/18d761ddba378ee58a3f3dc6316f66742df8d985/src/main/java/gutenberg/pygments/Lexers.java#L38-L51 | train |
phax/ph-oton | ph-oton-connect/src/main/java/com/helger/photon/connect/sftp/ChannelSftpRunner.java | ChannelSftpRunner.execute | @Nonnull
public static ESuccess execute (@Nonnull final IJSchSessionProvider aSessionProvider,
final int nChannelConnectTimeoutMillis,
@Nonnull final IChannelSftpRunnable aRunnable) throws JSchException
{
ValueEnforcer.notNull (aSessionProvider, "SessionProvider");
ValueEnforcer.notNull (aRunnable, "Runnable");
Session aSession = null;
Channel aChannel = null;
ChannelSftp aSFTPChannel = null;
try
{
// get session from pool
aSession = aSessionProvider.createSession ();
if (aSession == null)
throw new IllegalStateException ("Failed to create JSch session from provider");
// Open the SFTP channel
aChannel = aSession.openChannel ("sftp");
// Set connection timeout
aChannel.connect (nChannelConnectTimeoutMillis);
aSFTPChannel = (ChannelSftp) aChannel;
// call callback
aRunnable.execute (aSFTPChannel);
return ESuccess.SUCCESS;
}
catch (final SftpException ex)
{
LOGGER.error ("Error peforming SFTP action: " + aRunnable.getDisplayName (), ex);
return ESuccess.FAILURE;
}
finally
{
// end SFTP session
if (aSFTPChannel != null)
aSFTPChannel.quit ();
// close channel
if (aChannel != null && aChannel.isConnected ())
aChannel.disconnect ();
// destroy session
if (aSession != null)
JSchSessionFactory.destroySession (aSession);
}
} | java | @Nonnull
public static ESuccess execute (@Nonnull final IJSchSessionProvider aSessionProvider,
final int nChannelConnectTimeoutMillis,
@Nonnull final IChannelSftpRunnable aRunnable) throws JSchException
{
ValueEnforcer.notNull (aSessionProvider, "SessionProvider");
ValueEnforcer.notNull (aRunnable, "Runnable");
Session aSession = null;
Channel aChannel = null;
ChannelSftp aSFTPChannel = null;
try
{
// get session from pool
aSession = aSessionProvider.createSession ();
if (aSession == null)
throw new IllegalStateException ("Failed to create JSch session from provider");
// Open the SFTP channel
aChannel = aSession.openChannel ("sftp");
// Set connection timeout
aChannel.connect (nChannelConnectTimeoutMillis);
aSFTPChannel = (ChannelSftp) aChannel;
// call callback
aRunnable.execute (aSFTPChannel);
return ESuccess.SUCCESS;
}
catch (final SftpException ex)
{
LOGGER.error ("Error peforming SFTP action: " + aRunnable.getDisplayName (), ex);
return ESuccess.FAILURE;
}
finally
{
// end SFTP session
if (aSFTPChannel != null)
aSFTPChannel.quit ();
// close channel
if (aChannel != null && aChannel.isConnected ())
aChannel.disconnect ();
// destroy session
if (aSession != null)
JSchSessionFactory.destroySession (aSession);
}
} | [
"@",
"Nonnull",
"public",
"static",
"ESuccess",
"execute",
"(",
"@",
"Nonnull",
"final",
"IJSchSessionProvider",
"aSessionProvider",
",",
"final",
"int",
"nChannelConnectTimeoutMillis",
",",
"@",
"Nonnull",
"final",
"IChannelSftpRunnable",
"aRunnable",
")",
"throws",
... | Upload a file to the server.
@param aSessionProvider
The JSch session provider. May not be <code>null</code>.
@param nChannelConnectTimeoutMillis
The channel connection timeout in milliseconds. 0 means infinite.
@param aRunnable
The callback that performs the actions via SFTP. May not be
<code>null</code>.
@return {@link ESuccess#SUCCESS} if operation succeeded,
{@link ESuccess#FAILURE} otherwise.
@throws JSchException
If some general connection handling stuff goes wrong. | [
"Upload",
"a",
"file",
"to",
"the",
"server",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-connect/src/main/java/com/helger/photon/connect/sftp/ChannelSftpRunner.java#L56-L104 | train |
phax/ph-oton | ph-oton-security/src/main/java/com/helger/photon/security/password/GlobalPasswordSettings.java | GlobalPasswordSettings.setPasswordConstraintList | public static void setPasswordConstraintList (@Nonnull final IPasswordConstraintList aPasswordConstraintList)
{
ValueEnforcer.notNull (aPasswordConstraintList, "PasswordConstraintList");
// Create a copy
final IPasswordConstraintList aRealPasswordConstraints = aPasswordConstraintList.getClone ();
s_aRWLock.writeLocked ( () -> {
s_aPasswordConstraintList = aRealPasswordConstraints;
});
LOGGER.info ("Set global password constraints to " + aRealPasswordConstraints);
} | java | public static void setPasswordConstraintList (@Nonnull final IPasswordConstraintList aPasswordConstraintList)
{
ValueEnforcer.notNull (aPasswordConstraintList, "PasswordConstraintList");
// Create a copy
final IPasswordConstraintList aRealPasswordConstraints = aPasswordConstraintList.getClone ();
s_aRWLock.writeLocked ( () -> {
s_aPasswordConstraintList = aRealPasswordConstraints;
});
LOGGER.info ("Set global password constraints to " + aRealPasswordConstraints);
} | [
"public",
"static",
"void",
"setPasswordConstraintList",
"(",
"@",
"Nonnull",
"final",
"IPasswordConstraintList",
"aPasswordConstraintList",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aPasswordConstraintList",
",",
"\"PasswordConstraintList\"",
")",
";",
"// Create a ... | Set the global password constraint list.
@param aPasswordConstraintList
The list to be set. May not be <code>null</code>. | [
"Set",
"the",
"global",
"password",
"constraint",
"list",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/password/GlobalPasswordSettings.java#L95-L105 | train |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/agent/EkstaziCFT.java | EkstaziCFT.createCoverageClassVisitor | private CoverageClassVisitor createCoverageClassVisitor(String className, ClassWriter cv, boolean isRedefined) {
// We cannot change classfiles if class is being redefined.
return new CoverageClassVisitor(className, cv);
} | java | private CoverageClassVisitor createCoverageClassVisitor(String className, ClassWriter cv, boolean isRedefined) {
// We cannot change classfiles if class is being redefined.
return new CoverageClassVisitor(className, cv);
} | [
"private",
"CoverageClassVisitor",
"createCoverageClassVisitor",
"(",
"String",
"className",
",",
"ClassWriter",
"cv",
",",
"boolean",
"isRedefined",
")",
"{",
"// We cannot change classfiles if class is being redefined.",
"return",
"new",
"CoverageClassVisitor",
"(",
"classNam... | Creates class visitor to instrument for coverage based on configuration
options. | [
"Creates",
"class",
"visitor",
"to",
"instrument",
"for",
"coverage",
"based",
"on",
"configuration",
"options",
"."
] | 5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1 | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/agent/EkstaziCFT.java#L219-L222 | train |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/agent/EkstaziCFT.java | EkstaziCFT.isMonitorAccessibleFromClassLoader | private boolean isMonitorAccessibleFromClassLoader(ClassLoader loader) {
if (loader == null) {
return false;
}
boolean isMonitorAccessible = true;
InputStream monitorInputStream = null;
try {
monitorInputStream = loader.getResourceAsStream(COVERAGE_MONITOR_RESOURCE);
if (monitorInputStream == null) {
isMonitorAccessible = false;
}
} catch (Exception ex1) {
isMonitorAccessible = false;
try {
if (monitorInputStream != null) {
monitorInputStream.close();
}
} catch (IOException ex2) {
// do nothing
}
}
return isMonitorAccessible;
} | java | private boolean isMonitorAccessibleFromClassLoader(ClassLoader loader) {
if (loader == null) {
return false;
}
boolean isMonitorAccessible = true;
InputStream monitorInputStream = null;
try {
monitorInputStream = loader.getResourceAsStream(COVERAGE_MONITOR_RESOURCE);
if (monitorInputStream == null) {
isMonitorAccessible = false;
}
} catch (Exception ex1) {
isMonitorAccessible = false;
try {
if (monitorInputStream != null) {
monitorInputStream.close();
}
} catch (IOException ex2) {
// do nothing
}
}
return isMonitorAccessible;
} | [
"private",
"boolean",
"isMonitorAccessibleFromClassLoader",
"(",
"ClassLoader",
"loader",
")",
"{",
"if",
"(",
"loader",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"boolean",
"isMonitorAccessible",
"=",
"true",
";",
"InputStream",
"monitorInputStream",
"... | LoaderMethodVisitor and LoaderMonitor. | [
"LoaderMethodVisitor",
"and",
"LoaderMonitor",
"."
] | 5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1 | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/agent/EkstaziCFT.java#L228-L250 | train |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/agent/EkstaziCFT.java | EkstaziCFT.saveClassfileBufferForDebugging | @SuppressWarnings("unused")
private void saveClassfileBufferForDebugging(String className, byte[] classfileBuffer) {
try {
if (className.contains("CX")) {
java.io.DataOutputStream tmpout = new java.io.DataOutputStream(new java.io.FileOutputStream("out"));
tmpout.write(classfileBuffer, 0, classfileBuffer.length);
tmpout.close();
}
} catch (Exception ex) {
ex.printStackTrace();
}
} | java | @SuppressWarnings("unused")
private void saveClassfileBufferForDebugging(String className, byte[] classfileBuffer) {
try {
if (className.contains("CX")) {
java.io.DataOutputStream tmpout = new java.io.DataOutputStream(new java.io.FileOutputStream("out"));
tmpout.write(classfileBuffer, 0, classfileBuffer.length);
tmpout.close();
}
} catch (Exception ex) {
ex.printStackTrace();
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"private",
"void",
"saveClassfileBufferForDebugging",
"(",
"String",
"className",
",",
"byte",
"[",
"]",
"classfileBuffer",
")",
"{",
"try",
"{",
"if",
"(",
"className",
".",
"contains",
"(",
"\"CX\"",
")",
")",... | This method is for debugging purposes. So far one of the best way to
debug instrumentation was to actually look at the instrumented code. This
method let us choose which class to print.
@param className
Name of the class being instrumented.
@param classfileBuffer
Byte array with the instrumented class content. | [
"This",
"method",
"is",
"for",
"debugging",
"purposes",
".",
"So",
"far",
"one",
"of",
"the",
"best",
"way",
"to",
"debug",
"instrumentation",
"was",
"to",
"actually",
"look",
"at",
"the",
"instrumented",
"code",
".",
"This",
"method",
"let",
"us",
"choose... | 5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1 | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/agent/EkstaziCFT.java#L264-L275 | train |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/agent/EkstaziCFT.java | EkstaziCFT.instrumentClassFile | private static byte[] instrumentClassFile(byte[] classfileBuffer) {
String className = new ClassReader(classfileBuffer).getClassName().replace("/", ".");
ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
byte[] newClassfileBuffer = new EkstaziCFT().transform(currentClassLoader, className, null, null, classfileBuffer);
return newClassfileBuffer;
} | java | private static byte[] instrumentClassFile(byte[] classfileBuffer) {
String className = new ClassReader(classfileBuffer).getClassName().replace("/", ".");
ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
byte[] newClassfileBuffer = new EkstaziCFT().transform(currentClassLoader, className, null, null, classfileBuffer);
return newClassfileBuffer;
} | [
"private",
"static",
"byte",
"[",
"]",
"instrumentClassFile",
"(",
"byte",
"[",
"]",
"classfileBuffer",
")",
"{",
"String",
"className",
"=",
"new",
"ClassReader",
"(",
"classfileBuffer",
")",
".",
"getClassName",
"(",
")",
".",
"replace",
"(",
"\"/\"",
",",... | Support for static instrumentation. | [
"Support",
"for",
"static",
"instrumentation",
"."
] | 5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1 | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/agent/EkstaziCFT.java#L279-L284 | train |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/js/CollectingJSCodeProvider.java | CollectingJSCodeProvider.addAt | @Nonnull
public CollectingJSCodeProvider addAt (@Nonnegative final int nIndex, @Nullable final IHasJSCode aProvider)
{
if (aProvider != null)
m_aList.add (nIndex, aProvider);
return this;
} | java | @Nonnull
public CollectingJSCodeProvider addAt (@Nonnegative final int nIndex, @Nullable final IHasJSCode aProvider)
{
if (aProvider != null)
m_aList.add (nIndex, aProvider);
return this;
} | [
"@",
"Nonnull",
"public",
"CollectingJSCodeProvider",
"addAt",
"(",
"@",
"Nonnegative",
"final",
"int",
"nIndex",
",",
"@",
"Nullable",
"final",
"IHasJSCode",
"aProvider",
")",
"{",
"if",
"(",
"aProvider",
"!=",
"null",
")",
"m_aList",
".",
"add",
"(",
"nInd... | Add JS code at the specified index.
@param nIndex
The index where the element should be added. Should be ≥ 0.
@param aProvider
The JS code provider to be added. May be <code>null</code>.
@return this for chaining | [
"Add",
"JS",
"code",
"at",
"the",
"specified",
"index",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/js/CollectingJSCodeProvider.java#L95-L101 | train |
phax/ph-oton | ph-oton-jscode/src/main/java/com/helger/html/jscode/JSFunction.java | JSFunction.name | @Nonnull
public JSFunction name (@Nonnull @Nonempty final String sName)
{
if (!JSMarshaller.isJSIdentifier (sName))
throw new IllegalArgumentException ("The name '" + sName + "' is not a legal JS identifier!");
m_sName = sName;
return this;
} | java | @Nonnull
public JSFunction name (@Nonnull @Nonempty final String sName)
{
if (!JSMarshaller.isJSIdentifier (sName))
throw new IllegalArgumentException ("The name '" + sName + "' is not a legal JS identifier!");
m_sName = sName;
return this;
} | [
"@",
"Nonnull",
"public",
"JSFunction",
"name",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sName",
")",
"{",
"if",
"(",
"!",
"JSMarshaller",
".",
"isJSIdentifier",
"(",
"sName",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The... | Changes the name of the function.
@param sName
new function name
@return this | [
"Changes",
"the",
"name",
"of",
"the",
"function",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-jscode/src/main/java/com/helger/html/jscode/JSFunction.java#L87-L94 | train |
phax/ph-oton | ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/typeahead/TypeaheadEditSelection.java | TypeaheadEditSelection.getSelectionForRequiredObject | @Nonnull
public static TypeaheadEditSelection getSelectionForRequiredObject (@Nonnull final IWebPageExecutionContext aWPEC,
@Nullable final String sEditFieldName,
@Nullable final String sHiddenFieldName)
{
ValueEnforcer.notNull (aWPEC, "WPEC");
String sEditValue = aWPEC.params ().getAsString (sEditFieldName);
String sHiddenFieldValue = aWPEC.params ().getAsString (sHiddenFieldName);
if (StringHelper.hasText (sHiddenFieldValue))
{
if (StringHelper.hasNoText (sEditValue))
{
// The content of the edit field was deleted after a valid item was once
// selected
sHiddenFieldValue = null;
}
}
else
{
if (StringHelper.hasText (sEditValue))
{
// No ID but a text -> no object selected but only a string typed
sEditValue = null;
}
}
return new TypeaheadEditSelection (sEditValue, sHiddenFieldValue);
} | java | @Nonnull
public static TypeaheadEditSelection getSelectionForRequiredObject (@Nonnull final IWebPageExecutionContext aWPEC,
@Nullable final String sEditFieldName,
@Nullable final String sHiddenFieldName)
{
ValueEnforcer.notNull (aWPEC, "WPEC");
String sEditValue = aWPEC.params ().getAsString (sEditFieldName);
String sHiddenFieldValue = aWPEC.params ().getAsString (sHiddenFieldName);
if (StringHelper.hasText (sHiddenFieldValue))
{
if (StringHelper.hasNoText (sEditValue))
{
// The content of the edit field was deleted after a valid item was once
// selected
sHiddenFieldValue = null;
}
}
else
{
if (StringHelper.hasText (sEditValue))
{
// No ID but a text -> no object selected but only a string typed
sEditValue = null;
}
}
return new TypeaheadEditSelection (sEditValue, sHiddenFieldValue);
} | [
"@",
"Nonnull",
"public",
"static",
"TypeaheadEditSelection",
"getSelectionForRequiredObject",
"(",
"@",
"Nonnull",
"final",
"IWebPageExecutionContext",
"aWPEC",
",",
"@",
"Nullable",
"final",
"String",
"sEditFieldName",
",",
"@",
"Nullable",
"final",
"String",
"sHidden... | Get the current selection in the case that it is mandatory to select an
available object.
@param aWPEC
The current web page execution context. May not be <code>null</code>
.
@param sEditFieldName
The name of the edit input field.
@param sHiddenFieldName
The name of the hidden field with the ID.
@return Never <code>null</code>. | [
"Get",
"the",
"current",
"selection",
"in",
"the",
"case",
"that",
"it",
"is",
"mandatory",
"to",
"select",
"an",
"available",
"object",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/typeahead/TypeaheadEditSelection.java#L93-L121 | train |
phax/ph-oton | ph-oton-bootstrap4-uictrls/src/main/java/com/helger/photon/bootstrap4/uictrls/ext/BootstrapLoginHTMLProvider.java | BootstrapLoginHTMLProvider.createPageHeader | @Nullable
@OverrideOnDemand
protected IHCNode createPageHeader (@Nonnull final ISimpleWebExecutionContext aSWEC,
@Nullable final IHCNode aPageTitle)
{
return BootstrapPageHeader.createOnDemand (aPageTitle);
} | java | @Nullable
@OverrideOnDemand
protected IHCNode createPageHeader (@Nonnull final ISimpleWebExecutionContext aSWEC,
@Nullable final IHCNode aPageTitle)
{
return BootstrapPageHeader.createOnDemand (aPageTitle);
} | [
"@",
"Nullable",
"@",
"OverrideOnDemand",
"protected",
"IHCNode",
"createPageHeader",
"(",
"@",
"Nonnull",
"final",
"ISimpleWebExecutionContext",
"aSWEC",
",",
"@",
"Nullable",
"final",
"IHCNode",
"aPageTitle",
")",
"{",
"return",
"BootstrapPageHeader",
".",
"createOn... | Create the text above the login form.
@param aSWEC
Web page execution context.
@param aPageTitle
Page title as provided in the constructor. May be <code>null</code>.
@return The created node or <code>null</code>. | [
"Create",
"the",
"text",
"above",
"the",
"login",
"form",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-bootstrap4-uictrls/src/main/java/com/helger/photon/bootstrap4/uictrls/ext/BootstrapLoginHTMLProvider.java#L107-L113 | train |
phax/ph-oton | ph-oton-uicore/src/main/java/com/helger/photon/uicore/html/google/HCGoogleAnalytics.java | HCGoogleAnalytics.createEventTrackingCode | @Nonnull
public static JSInvocation createEventTrackingCode (@Nonnull final String sCategory,
@Nonnull final String sAction,
@Nullable final String sLabel,
@Nullable final Integer aValue)
{
final JSArray aArray = new JSArray ().add ("_trackEvent").add (sCategory).add (sAction);
if (StringHelper.hasText (sLabel))
aArray.add (sLabel);
if (aValue != null)
aArray.add (aValue.intValue ());
return JSExpr.ref ("_gaq").invoke ("push").arg (aArray);
} | java | @Nonnull
public static JSInvocation createEventTrackingCode (@Nonnull final String sCategory,
@Nonnull final String sAction,
@Nullable final String sLabel,
@Nullable final Integer aValue)
{
final JSArray aArray = new JSArray ().add ("_trackEvent").add (sCategory).add (sAction);
if (StringHelper.hasText (sLabel))
aArray.add (sLabel);
if (aValue != null)
aArray.add (aValue.intValue ());
return JSExpr.ref ("_gaq").invoke ("push").arg (aArray);
} | [
"@",
"Nonnull",
"public",
"static",
"JSInvocation",
"createEventTrackingCode",
"(",
"@",
"Nonnull",
"final",
"String",
"sCategory",
",",
"@",
"Nonnull",
"final",
"String",
"sAction",
",",
"@",
"Nullable",
"final",
"String",
"sLabel",
",",
"@",
"Nullable",
"final... | Set this in the "onclick" events of links to track them
@param sCategory
The category. May not be <code>null</code>.
@param sAction
The action. May not be <code>null</code>.
@param sLabel
The label. May be <code>null</code>.
@param aValue
Optional numeric value. May be <code>null</code>.
@return The JS code to be set to "onclick" event | [
"Set",
"this",
"in",
"the",
"onclick",
"events",
"of",
"links",
"to",
"track",
"them"
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uicore/src/main/java/com/helger/photon/uicore/html/google/HCGoogleAnalytics.java#L127-L140 | train |
NICTA/t3as-snomedct-service | snomed-coder-common/src/main/java/org/t3as/metamap/SemanticTypes.java | SemanticTypes.sanitiseSemanticTypes | public static Collection<String> sanitiseSemanticTypes(final Collection<String> semanticTypes) {
if (semanticTypes == null) return ImmutableList.of();
// check that each of the given types are in the map we have, otherwise throw it away
final Set<String> s = new LinkedHashSet<>(semanticTypes);
return s.retainAll(SEMANTIC_TYPES_CODE_TO_DESCRIPTION.keySet()) ? s : semanticTypes;
} | java | public static Collection<String> sanitiseSemanticTypes(final Collection<String> semanticTypes) {
if (semanticTypes == null) return ImmutableList.of();
// check that each of the given types are in the map we have, otherwise throw it away
final Set<String> s = new LinkedHashSet<>(semanticTypes);
return s.retainAll(SEMANTIC_TYPES_CODE_TO_DESCRIPTION.keySet()) ? s : semanticTypes;
} | [
"public",
"static",
"Collection",
"<",
"String",
">",
"sanitiseSemanticTypes",
"(",
"final",
"Collection",
"<",
"String",
">",
"semanticTypes",
")",
"{",
"if",
"(",
"semanticTypes",
"==",
"null",
")",
"return",
"ImmutableList",
".",
"of",
"(",
")",
";",
"// ... | Sanitise semantic types from user input.
@param semanticTypes the semantic types to be sanitised
@return a non-null but possibly empty Collection of semantic types | [
"Sanitise",
"semantic",
"types",
"from",
"user",
"input",
"."
] | 70a82d5c889f97eef2d17a648970575c152983e9 | https://github.com/NICTA/t3as-snomedct-service/blob/70a82d5c889f97eef2d17a648970575c152983e9/snomed-coder-common/src/main/java/org/t3as/metamap/SemanticTypes.java#L93-L99 | train |
JamesIry/jADT | jADT-core/src/main/java/com/pogofish/jadt/printer/ASTPrinter.java | ASTPrinter.printComments | public static String printComments(String indent, List<JavaComment> comments) {
final StringBuilder builder = new StringBuilder();
for (JavaComment comment : comments) {
builder.append(print(indent, comment));
builder.append("\n");
}
return builder.toString();
} | java | public static String printComments(String indent, List<JavaComment> comments) {
final StringBuilder builder = new StringBuilder();
for (JavaComment comment : comments) {
builder.append(print(indent, comment));
builder.append("\n");
}
return builder.toString();
} | [
"public",
"static",
"String",
"printComments",
"(",
"String",
"indent",
",",
"List",
"<",
"JavaComment",
">",
"comments",
")",
"{",
"final",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"JavaComment",
"comment",
":",
"c... | Prints a list of comments pretty much unmolested except to add \n s | [
"Prints",
"a",
"list",
"of",
"comments",
"pretty",
"much",
"unmolested",
"except",
"to",
"add",
"\\",
"n",
"s"
] | 92ee94b6624cd673851497d78c218837dcf02b8a | https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/printer/ASTPrinter.java#L142-L149 | train |
JamesIry/jADT | jADT-core/src/main/java/com/pogofish/jadt/printer/ASTPrinter.java | ASTPrinter.print | public static String print(final String indent, JavaComment comment) {
return comment.match(new JavaComment.MatchBlock<String>() {
@Override
public String _case(JavaDocComment x) {
final StringBuilder builder = new StringBuilder(indent);
builder.append(x.start);
for (JDToken token : x.generalSection) {
builder.append(print(indent, token));
}
for (JDTagSection tagSection : x.tagSections) {
for (JDToken token : tagSection.tokens) {
builder.append(print(indent, token));
}
}
builder.append(x.end);
return builder.toString();
}
@Override
public String _case(JavaBlockComment comment) {
final StringBuilder builder = new StringBuilder(indent);
for (List<BlockToken> line : comment.lines) {
for (BlockToken token : line) {
builder.append(token.match(new BlockToken.MatchBlock<String>() {
@Override
public String _case(BlockWord x) {
return x.word;
}
@Override
public String _case(BlockWhiteSpace x) {
return x.ws;
}
@Override
public String _case(BlockEOL x) {
return x.content + indent;
}
}));
}
}
return builder.toString();
}
@Override
public String _case(JavaEOLComment x) {
return x.comment;
}
});
} | java | public static String print(final String indent, JavaComment comment) {
return comment.match(new JavaComment.MatchBlock<String>() {
@Override
public String _case(JavaDocComment x) {
final StringBuilder builder = new StringBuilder(indent);
builder.append(x.start);
for (JDToken token : x.generalSection) {
builder.append(print(indent, token));
}
for (JDTagSection tagSection : x.tagSections) {
for (JDToken token : tagSection.tokens) {
builder.append(print(indent, token));
}
}
builder.append(x.end);
return builder.toString();
}
@Override
public String _case(JavaBlockComment comment) {
final StringBuilder builder = new StringBuilder(indent);
for (List<BlockToken> line : comment.lines) {
for (BlockToken token : line) {
builder.append(token.match(new BlockToken.MatchBlock<String>() {
@Override
public String _case(BlockWord x) {
return x.word;
}
@Override
public String _case(BlockWhiteSpace x) {
return x.ws;
}
@Override
public String _case(BlockEOL x) {
return x.content + indent;
}
}));
}
}
return builder.toString();
}
@Override
public String _case(JavaEOLComment x) {
return x.comment;
}
});
} | [
"public",
"static",
"String",
"print",
"(",
"final",
"String",
"indent",
",",
"JavaComment",
"comment",
")",
"{",
"return",
"comment",
".",
"match",
"(",
"new",
"JavaComment",
".",
"MatchBlock",
"<",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",... | Prints a single comment pretty much unmolested | [
"Prints",
"a",
"single",
"comment",
"pretty",
"much",
"unmolested"
] | 92ee94b6624cd673851497d78c218837dcf02b8a | https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/printer/ASTPrinter.java#L154-L206 | train |
JamesIry/jADT | jADT-core/src/main/java/com/pogofish/jadt/printer/ASTPrinter.java | ASTPrinter.print | public static String print(Arg arg) {
return printArgModifiers(arg.modifiers) + print(arg.type) + " " + arg.name;
} | java | public static String print(Arg arg) {
return printArgModifiers(arg.modifiers) + print(arg.type) + " " + arg.name;
} | [
"public",
"static",
"String",
"print",
"(",
"Arg",
"arg",
")",
"{",
"return",
"printArgModifiers",
"(",
"arg",
".",
"modifiers",
")",
"+",
"print",
"(",
"arg",
".",
"type",
")",
"+",
"\" \"",
"+",
"arg",
".",
"name",
";",
"}"
] | prints an arg as
type name
@param arg Arg to be printed
@return pretty string | [
"prints",
"an",
"arg",
"as",
"type",
"name"
] | 92ee94b6624cd673851497d78c218837dcf02b8a | https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/printer/ASTPrinter.java#L291-L293 | train |
JamesIry/jADT | jADT-core/src/main/java/com/pogofish/jadt/printer/ASTPrinter.java | ASTPrinter.printArgModifiers | public static String printArgModifiers(List<ArgModifier> modifiers) {
final StringBuilder builder = new StringBuilder();
if (modifiers.contains(ArgModifier._Final())) {
builder.append(print(ArgModifier._Final()));
builder.append(" ");
}
if (modifiers.contains(ArgModifier._Transient())) {
builder.append(print(ArgModifier._Transient()));
builder.append(" ");
}
if (modifiers.contains(ArgModifier._Volatile())) {
builder.append(print(ArgModifier._Volatile()));
builder.append(" ");
}
return builder.toString();
} | java | public static String printArgModifiers(List<ArgModifier> modifiers) {
final StringBuilder builder = new StringBuilder();
if (modifiers.contains(ArgModifier._Final())) {
builder.append(print(ArgModifier._Final()));
builder.append(" ");
}
if (modifiers.contains(ArgModifier._Transient())) {
builder.append(print(ArgModifier._Transient()));
builder.append(" ");
}
if (modifiers.contains(ArgModifier._Volatile())) {
builder.append(print(ArgModifier._Volatile()));
builder.append(" ");
}
return builder.toString();
} | [
"public",
"static",
"String",
"printArgModifiers",
"(",
"List",
"<",
"ArgModifier",
">",
"modifiers",
")",
"{",
"final",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"modifiers",
".",
"contains",
"(",
"ArgModifier",
".",
... | Prints a list of arg modifiers
@param modifiers list of arg modifiers
@return string consisting of those modifiers, with a trailing space | [
"Prints",
"a",
"list",
"of",
"arg",
"modifiers"
] | 92ee94b6624cd673851497d78c218837dcf02b8a | https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/printer/ASTPrinter.java#L300-L315 | train |
JamesIry/jADT | jADT-core/src/main/java/com/pogofish/jadt/printer/ASTPrinter.java | ASTPrinter.print | public static String print(Type type) {
return type.match(new Type.MatchBlock<String>(){
@Override
public String _case(Ref x) {
return print(x.type);
}
@Override
public String _case(Primitive x) {
return print(x.type);
}
});
} | java | public static String print(Type type) {
return type.match(new Type.MatchBlock<String>(){
@Override
public String _case(Ref x) {
return print(x.type);
}
@Override
public String _case(Primitive x) {
return print(x.type);
}
});
} | [
"public",
"static",
"String",
"print",
"(",
"Type",
"type",
")",
"{",
"return",
"type",
".",
"match",
"(",
"new",
"Type",
".",
"MatchBlock",
"<",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"_case",
"(",
"Ref",
"x",
")",
"{",
... | Prints a type as either a ref type or a primitive
@param type Type to be printed
@return pretty string | [
"Prints",
"a",
"type",
"as",
"either",
"a",
"ref",
"type",
"or",
"a",
"primitive"
] | 92ee94b6624cd673851497d78c218837dcf02b8a | https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/printer/ASTPrinter.java#L323-L336 | train |
JamesIry/jADT | jADT-core/src/main/java/com/pogofish/jadt/printer/ASTPrinter.java | ASTPrinter.print | public static String print(RefType type) {
return type.match(new RefType.MatchBlock<String>() {
@Override
public String _case(ClassType x) {
final StringBuilder builder = new StringBuilder(x.baseName);
if (!x.typeArguments.isEmpty()) {
builder.append("<");
boolean first = true;
for (RefType typeArgument : x.typeArguments) {
if (first) {
first = false;
} else {
builder.append(", ");
}
builder.append(print(typeArgument));
}
builder.append(">");
}
return builder.toString();
}
@Override
public String _case(ArrayType x) {
return print(x.heldType) + "[]";
}});
} | java | public static String print(RefType type) {
return type.match(new RefType.MatchBlock<String>() {
@Override
public String _case(ClassType x) {
final StringBuilder builder = new StringBuilder(x.baseName);
if (!x.typeArguments.isEmpty()) {
builder.append("<");
boolean first = true;
for (RefType typeArgument : x.typeArguments) {
if (first) {
first = false;
} else {
builder.append(", ");
}
builder.append(print(typeArgument));
}
builder.append(">");
}
return builder.toString();
}
@Override
public String _case(ArrayType x) {
return print(x.heldType) + "[]";
}});
} | [
"public",
"static",
"String",
"print",
"(",
"RefType",
"type",
")",
"{",
"return",
"type",
".",
"match",
"(",
"new",
"RefType",
".",
"MatchBlock",
"<",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"_case",
"(",
"ClassType",
"x",
"... | Prints a type as either an array or class type.
For a an array, it prints as
type[]
For a class it prints as
className("<" refType(", " refType)*">")?
@param type RefType to be printed
@return pretty string | [
"Prints",
"a",
"type",
"as",
"either",
"an",
"array",
"or",
"class",
"type",
"."
] | 92ee94b6624cd673851497d78c218837dcf02b8a | https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/printer/ASTPrinter.java#L350-L376 | train |
JamesIry/jADT | jADT-core/src/main/java/com/pogofish/jadt/printer/ASTPrinter.java | ASTPrinter.print | public static String print(PrimitiveType type) {
return type.match(new PrimitiveType.MatchBlock<String>() {
@Override
public String _case(BooleanType x) {
return "boolean";
}
@Override
public String _case(ByteType x) {
return "byte";
}
@Override
public String _case(CharType x) {
return "char";
}
@Override
public String _case(DoubleType x) {
return "double";
}
@Override
public String _case(FloatType x) {
return "float";
}
@Override
public String _case(IntType x) {
return "int";
}
@Override
public String _case(LongType x) {
return "long";
}
@Override
public String _case(ShortType x) {
return "short";
}});
} | java | public static String print(PrimitiveType type) {
return type.match(new PrimitiveType.MatchBlock<String>() {
@Override
public String _case(BooleanType x) {
return "boolean";
}
@Override
public String _case(ByteType x) {
return "byte";
}
@Override
public String _case(CharType x) {
return "char";
}
@Override
public String _case(DoubleType x) {
return "double";
}
@Override
public String _case(FloatType x) {
return "float";
}
@Override
public String _case(IntType x) {
return "int";
}
@Override
public String _case(LongType x) {
return "long";
}
@Override
public String _case(ShortType x) {
return "short";
}});
} | [
"public",
"static",
"String",
"print",
"(",
"PrimitiveType",
"type",
")",
"{",
"return",
"type",
".",
"match",
"(",
"new",
"PrimitiveType",
".",
"MatchBlock",
"<",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"_case",
"(",
"BooleanTyp... | Prints a primitive type as "boolean" | "char" | "short" | "int" | "long" | "float" | "double"
@param type PrimitiveType to be printed
@return pretty string | [
"Prints",
"a",
"primitive",
"type",
"as",
"boolean",
"|",
"char",
"|",
"short",
"|",
"int",
"|",
"long",
"|",
"float",
"|",
"double"
] | 92ee94b6624cd673851497d78c218837dcf02b8a | https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/printer/ASTPrinter.java#L383-L425 | train |
JamesIry/jADT | jADT-core/src/main/java/com/pogofish/jadt/printer/ASTPrinter.java | ASTPrinter.print | public static String print(ArgModifier modifier) {
return modifier.match(new ArgModifier.MatchBlock<String>() {
@Override
public String _case(Final x) {
return "final";
}
@Override
public String _case(Volatile x) {
return "volatile";
}
@Override
public String _case(Transient x) {
return "transient";
}
});
} | java | public static String print(ArgModifier modifier) {
return modifier.match(new ArgModifier.MatchBlock<String>() {
@Override
public String _case(Final x) {
return "final";
}
@Override
public String _case(Volatile x) {
return "volatile";
}
@Override
public String _case(Transient x) {
return "transient";
}
});
} | [
"public",
"static",
"String",
"print",
"(",
"ArgModifier",
"modifier",
")",
"{",
"return",
"modifier",
".",
"match",
"(",
"new",
"ArgModifier",
".",
"MatchBlock",
"<",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"_case",
"(",
"Final"... | Print arg modifier | [
"Print",
"arg",
"modifier"
] | 92ee94b6624cd673851497d78c218837dcf02b8a | https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/printer/ASTPrinter.java#L430-L448 | train |
JamesIry/jADT | jADT-core/src/main/java/com/pogofish/jadt/printer/ASTPrinter.java | ASTPrinter.print | private static String print(final String indent, JDToken token) {
return token.match(new JDToken.MatchBlock<String>() {
@Override
public String _case(JDAsterisk x) {
return "*";
}
@Override
public String _case(JDEOL x) {
return x.content + indent;
}
@Override
public String _case(JDTag x) {
return x.name;
}
@Override
public String _case(JDWord x) {
return x.word;
}
@Override
public String _case(JDWhiteSpace x) {
return x.ws;
}
});
} | java | private static String print(final String indent, JDToken token) {
return token.match(new JDToken.MatchBlock<String>() {
@Override
public String _case(JDAsterisk x) {
return "*";
}
@Override
public String _case(JDEOL x) {
return x.content + indent;
}
@Override
public String _case(JDTag x) {
return x.name;
}
@Override
public String _case(JDWord x) {
return x.word;
}
@Override
public String _case(JDWhiteSpace x) {
return x.ws;
}
});
} | [
"private",
"static",
"String",
"print",
"(",
"final",
"String",
"indent",
",",
"JDToken",
"token",
")",
"{",
"return",
"token",
".",
"match",
"(",
"new",
"JDToken",
".",
"MatchBlock",
"<",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"String"... | Print a single JavaDoc token | [
"Print",
"a",
"single",
"JavaDoc",
"token"
] | 92ee94b6624cd673851497d78c218837dcf02b8a | https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/printer/ASTPrinter.java#L453-L481 | train |
JamesIry/jADT | jADT-core/src/main/java/com/pogofish/jadt/printer/ASTPrinter.java | ASTPrinter.print | public static String print(final Literal literal) {
return literal.match(new Literal.MatchBlock<String>() {
@Override
public String _case(StringLiteral x) {
return x.content;
}
@Override
public String _case(FloatingPointLiteral x) {
return x.content;
}
@Override
public String _case(IntegerLiteral x) {
return x.content;
}
@Override
public String _case(CharLiteral x) {
return x.content;
}
@Override
public String _case(BooleanLiteral x) {
return x.content;
}
@Override
public String _case(NullLiteral x) {
return "null";
}
});
} | java | public static String print(final Literal literal) {
return literal.match(new Literal.MatchBlock<String>() {
@Override
public String _case(StringLiteral x) {
return x.content;
}
@Override
public String _case(FloatingPointLiteral x) {
return x.content;
}
@Override
public String _case(IntegerLiteral x) {
return x.content;
}
@Override
public String _case(CharLiteral x) {
return x.content;
}
@Override
public String _case(BooleanLiteral x) {
return x.content;
}
@Override
public String _case(NullLiteral x) {
return "null";
}
});
} | [
"public",
"static",
"String",
"print",
"(",
"final",
"Literal",
"literal",
")",
"{",
"return",
"literal",
".",
"match",
"(",
"new",
"Literal",
".",
"MatchBlock",
"<",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"_case",
"(",
"Strin... | Print a single literal | [
"Print",
"a",
"single",
"literal"
] | 92ee94b6624cd673851497d78c218837dcf02b8a | https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/printer/ASTPrinter.java#L486-L518 | train |
JamesIry/jADT | jADT-core/src/main/java/com/pogofish/jadt/printer/ASTPrinter.java | ASTPrinter.print | public static String print(Expression expression) {
return expression.match(new Expression.MatchBlock<String>() {
@Override
public String _case(LiteralExpression x) {
return print(x.literal);
}
@Override
public String _case(VariableExpression x) {
return x.selector.match(new Optional.MatchBlock<Expression, String>() {
@Override
public String _case(Some<Expression> x) {
return print(x.value) + ".";
}
@Override
public String _case(None<Expression> x) {
return "";
}
}) + x.identifier;
}
@Override
public String _case(NestedExpression x) {
return "( " + print(x.expression) + " )";
}
@Override
public String _case(ClassReference x) {
return print(x.type) + ".class";
}
@Override
public String _case(TernaryExpression x) {
return print(x.cond) + " ? " + print(x.trueExpression) + " : " + print (x.falseExpression);
}
@Override
public String _case(BinaryExpression x) {
return print(x.left) + " " + print(x.op) + " " + print(x.right);
}
});
} | java | public static String print(Expression expression) {
return expression.match(new Expression.MatchBlock<String>() {
@Override
public String _case(LiteralExpression x) {
return print(x.literal);
}
@Override
public String _case(VariableExpression x) {
return x.selector.match(new Optional.MatchBlock<Expression, String>() {
@Override
public String _case(Some<Expression> x) {
return print(x.value) + ".";
}
@Override
public String _case(None<Expression> x) {
return "";
}
}) + x.identifier;
}
@Override
public String _case(NestedExpression x) {
return "( " + print(x.expression) + " )";
}
@Override
public String _case(ClassReference x) {
return print(x.type) + ".class";
}
@Override
public String _case(TernaryExpression x) {
return print(x.cond) + " ? " + print(x.trueExpression) + " : " + print (x.falseExpression);
}
@Override
public String _case(BinaryExpression x) {
return print(x.left) + " " + print(x.op) + " " + print(x.right);
}
});
} | [
"public",
"static",
"String",
"print",
"(",
"Expression",
"expression",
")",
"{",
"return",
"expression",
".",
"match",
"(",
"new",
"Expression",
".",
"MatchBlock",
"<",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"_case",
"(",
"Lite... | Print an expression | [
"Print",
"an",
"expression"
] | 92ee94b6624cd673851497d78c218837dcf02b8a | https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/printer/ASTPrinter.java#L523-L566 | train |
phax/ph-oton | ph-oton-bootstrap4/src/main/java/com/helger/photon/bootstrap4/utils/BootstrapSpacingBuilder.java | BootstrapSpacingBuilder.property | @Nonnull
public BootstrapSpacingBuilder property (@Nonnull final EBootstrapSpacingPropertyType eProperty)
{
ValueEnforcer.notNull (eProperty, "Property");
m_eProperty = eProperty;
return this;
} | java | @Nonnull
public BootstrapSpacingBuilder property (@Nonnull final EBootstrapSpacingPropertyType eProperty)
{
ValueEnforcer.notNull (eProperty, "Property");
m_eProperty = eProperty;
return this;
} | [
"@",
"Nonnull",
"public",
"BootstrapSpacingBuilder",
"property",
"(",
"@",
"Nonnull",
"final",
"EBootstrapSpacingPropertyType",
"eProperty",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"eProperty",
",",
"\"Property\"",
")",
";",
"m_eProperty",
"=",
"eProperty",
... | Set the property type. Default is "margin".
@param eProperty
Property type. May not be <code>null</code>.
@return this for chaining | [
"Set",
"the",
"property",
"type",
".",
"Default",
"is",
"margin",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-bootstrap4/src/main/java/com/helger/photon/bootstrap4/utils/BootstrapSpacingBuilder.java#L50-L56 | train |
phax/ph-oton | ph-oton-bootstrap4/src/main/java/com/helger/photon/bootstrap4/utils/BootstrapSpacingBuilder.java | BootstrapSpacingBuilder.side | @Nonnull
public BootstrapSpacingBuilder side (@Nonnull final EBootstrapSpacingSideType eSide)
{
ValueEnforcer.notNull (eSide, "Side");
m_eSide = eSide;
return this;
} | java | @Nonnull
public BootstrapSpacingBuilder side (@Nonnull final EBootstrapSpacingSideType eSide)
{
ValueEnforcer.notNull (eSide, "Side");
m_eSide = eSide;
return this;
} | [
"@",
"Nonnull",
"public",
"BootstrapSpacingBuilder",
"side",
"(",
"@",
"Nonnull",
"final",
"EBootstrapSpacingSideType",
"eSide",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"eSide",
",",
"\"Side\"",
")",
";",
"m_eSide",
"=",
"eSide",
";",
"return",
"this",
... | Set the edge type. Default is "all".
@param eSide
Edge type. May not be <code>null</code>.
@return this for chaining | [
"Set",
"the",
"edge",
"type",
".",
"Default",
"is",
"all",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-bootstrap4/src/main/java/com/helger/photon/bootstrap4/utils/BootstrapSpacingBuilder.java#L65-L71 | train |
phax/ph-oton | ph-oton-core/src/main/java/com/helger/photon/core/uistate/UIStateRegistry.java | UIStateRegistry.registerState | @Nonnull
@SuppressFBWarnings ("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE")
public EChange registerState (@Nonnull @Nonempty final String sStateID, @Nonnull final IHasUIState aNewState)
{
ValueEnforcer.notEmpty (sStateID, "StateID");
ValueEnforcer.notNull (aNewState, "NewState");
final ObjectType aOT = aNewState.getObjectType ();
if (aOT == null)
throw new IllegalStateException ("Object has no typeID: " + aNewState);
return m_aRWLock.writeLocked ( () -> {
final Map <String, IHasUIState> aMap = m_aMap.computeIfAbsent (aOT, k -> new CommonsHashMap<> ());
if (LOGGER.isDebugEnabled () && aMap.containsKey (sStateID))
LOGGER.debug ("Overwriting " + aOT.getName () + " with ID " + sStateID + " with new object");
aMap.put (sStateID, aNewState);
return EChange.CHANGED;
});
} | java | @Nonnull
@SuppressFBWarnings ("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE")
public EChange registerState (@Nonnull @Nonempty final String sStateID, @Nonnull final IHasUIState aNewState)
{
ValueEnforcer.notEmpty (sStateID, "StateID");
ValueEnforcer.notNull (aNewState, "NewState");
final ObjectType aOT = aNewState.getObjectType ();
if (aOT == null)
throw new IllegalStateException ("Object has no typeID: " + aNewState);
return m_aRWLock.writeLocked ( () -> {
final Map <String, IHasUIState> aMap = m_aMap.computeIfAbsent (aOT, k -> new CommonsHashMap<> ());
if (LOGGER.isDebugEnabled () && aMap.containsKey (sStateID))
LOGGER.debug ("Overwriting " + aOT.getName () + " with ID " + sStateID + " with new object");
aMap.put (sStateID, aNewState);
return EChange.CHANGED;
});
} | [
"@",
"Nonnull",
"@",
"SuppressFBWarnings",
"(",
"\"RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE\"",
")",
"public",
"EChange",
"registerState",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sStateID",
",",
"@",
"Nonnull",
"final",
"IHasUIState",
"aNewState",
")... | Registers a new control for the passed tree ID
@param sStateID
the ID of the state in register. May neither be <code>null</code>
nor empty.
@param aNewState
The state to set. May not be <code>null</code>.
@return {@link EChange#CHANGED} if the control was registered<br>
{@link EChange#UNCHANGED} if an illegal argument was passed or a
control has already been registered for that ID | [
"Registers",
"a",
"new",
"control",
"for",
"the",
"passed",
"tree",
"ID"
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/uistate/UIStateRegistry.java#L156-L176 | train |
phax/ph-oton | ph-oton-core/src/main/java/com/helger/photon/core/uistate/UIStateRegistry.java | UIStateRegistry.registerState | @Nonnull
public EChange registerState (@Nonnull final IHCElement <?> aNewElement)
{
ValueEnforcer.notNull (aNewElement, "NewElement");
if (aNewElement.hasNoID ())
LOGGER.warn ("Registering the state for an object that has no ID - creating a new ID now!");
return registerState (aNewElement.ensureID ().getID (), aNewElement);
} | java | @Nonnull
public EChange registerState (@Nonnull final IHCElement <?> aNewElement)
{
ValueEnforcer.notNull (aNewElement, "NewElement");
if (aNewElement.hasNoID ())
LOGGER.warn ("Registering the state for an object that has no ID - creating a new ID now!");
return registerState (aNewElement.ensureID ().getID (), aNewElement);
} | [
"@",
"Nonnull",
"public",
"EChange",
"registerState",
"(",
"@",
"Nonnull",
"final",
"IHCElement",
"<",
"?",
">",
"aNewElement",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aNewElement",
",",
"\"NewElement\"",
")",
";",
"if",
"(",
"aNewElement",
".",
"ha... | Register a state for the passed HC element, using the internal ID of the
element.
@param aNewElement
The element to be added to the registry. May not be
<code>null</code>.
@return Never <code>null</code>. | [
"Register",
"a",
"state",
"for",
"the",
"passed",
"HC",
"element",
"using",
"the",
"internal",
"ID",
"of",
"the",
"element",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/uistate/UIStateRegistry.java#L187-L195 | train |
phax/ph-oton | ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Chunking.java | FineUploader5Chunking.setPartSize | @Nonnull
public FineUploader5Chunking setPartSize (@Nonnegative final long nPartSize)
{
ValueEnforcer.isGT0 (nPartSize, "PartSize");
m_nChunkingPartSize = nPartSize;
return this;
} | java | @Nonnull
public FineUploader5Chunking setPartSize (@Nonnegative final long nPartSize)
{
ValueEnforcer.isGT0 (nPartSize, "PartSize");
m_nChunkingPartSize = nPartSize;
return this;
} | [
"@",
"Nonnull",
"public",
"FineUploader5Chunking",
"setPartSize",
"(",
"@",
"Nonnegative",
"final",
"long",
"nPartSize",
")",
"{",
"ValueEnforcer",
".",
"isGT0",
"(",
"nPartSize",
",",
"\"PartSize\"",
")",
";",
"m_nChunkingPartSize",
"=",
"nPartSize",
";",
"return... | The maximum size of each chunk, in bytes.
@param nPartSize
New value. Must be > 0.
@return this for chaining | [
"The",
"maximum",
"size",
"of",
"each",
"chunk",
"in",
"bytes",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Chunking.java#L129-L135 | train |
phax/ph-oton | ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Chunking.java | FineUploader5Chunking.setParamNameChunkSize | @Nonnull
public FineUploader5Chunking setParamNameChunkSize (@Nonnull @Nonempty final String sParamNameChunkSize)
{
ValueEnforcer.notEmpty (sParamNameChunkSize, "ParamNameChunkSize");
m_sChunkingParamNamesChunkSize = sParamNameChunkSize;
return this;
} | java | @Nonnull
public FineUploader5Chunking setParamNameChunkSize (@Nonnull @Nonempty final String sParamNameChunkSize)
{
ValueEnforcer.notEmpty (sParamNameChunkSize, "ParamNameChunkSize");
m_sChunkingParamNamesChunkSize = sParamNameChunkSize;
return this;
} | [
"@",
"Nonnull",
"public",
"FineUploader5Chunking",
"setParamNameChunkSize",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sParamNameChunkSize",
")",
"{",
"ValueEnforcer",
".",
"notEmpty",
"(",
"sParamNameChunkSize",
",",
"\"ParamNameChunkSize\"",
")",
";",
... | Name of the parameter passed with a chunked request that specifies the size
in bytes of the associated chunk.
@param sParamNameChunkSize
New value. May neither be <code>null</code> nor empty.
@return this for chaining | [
"Name",
"of",
"the",
"parameter",
"passed",
"with",
"a",
"chunked",
"request",
"that",
"specifies",
"the",
"size",
"in",
"bytes",
"of",
"the",
"associated",
"chunk",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Chunking.java#L152-L158 | train |
phax/ph-oton | ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Chunking.java | FineUploader5Chunking.setParamNamePartByteOffset | @Nonnull
public FineUploader5Chunking setParamNamePartByteOffset (@Nonnull @Nonempty final String sParamNamePartByteOffset)
{
ValueEnforcer.notEmpty (sParamNamePartByteOffset, "ParamNamePartByteOffset");
m_sChunkingParamNamesPartByteOffset = sParamNamePartByteOffset;
return this;
} | java | @Nonnull
public FineUploader5Chunking setParamNamePartByteOffset (@Nonnull @Nonempty final String sParamNamePartByteOffset)
{
ValueEnforcer.notEmpty (sParamNamePartByteOffset, "ParamNamePartByteOffset");
m_sChunkingParamNamesPartByteOffset = sParamNamePartByteOffset;
return this;
} | [
"@",
"Nonnull",
"public",
"FineUploader5Chunking",
"setParamNamePartByteOffset",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sParamNamePartByteOffset",
")",
"{",
"ValueEnforcer",
".",
"notEmpty",
"(",
"sParamNamePartByteOffset",
",",
"\"ParamNamePartByteOffset... | Name of the parameter passed with a chunked request that specifies the
starting byte of the associated chunk.
@param sParamNamePartByteOffset
New value. May neither be <code>null</code> nor empty.
@return this for chaining | [
"Name",
"of",
"the",
"parameter",
"passed",
"with",
"a",
"chunked",
"request",
"that",
"specifies",
"the",
"starting",
"byte",
"of",
"the",
"associated",
"chunk",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Chunking.java#L175-L181 | train |
phax/ph-oton | ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Chunking.java | FineUploader5Chunking.setParamNamePartIndex | @Nonnull
public FineUploader5Chunking setParamNamePartIndex (@Nonnull @Nonempty final String sParamNamePartIndex)
{
ValueEnforcer.notEmpty (sParamNamePartIndex, "ParamNamePartIndex");
m_sChunkingParamNamesPartIndex = sParamNamePartIndex;
return this;
} | java | @Nonnull
public FineUploader5Chunking setParamNamePartIndex (@Nonnull @Nonempty final String sParamNamePartIndex)
{
ValueEnforcer.notEmpty (sParamNamePartIndex, "ParamNamePartIndex");
m_sChunkingParamNamesPartIndex = sParamNamePartIndex;
return this;
} | [
"@",
"Nonnull",
"public",
"FineUploader5Chunking",
"setParamNamePartIndex",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sParamNamePartIndex",
")",
"{",
"ValueEnforcer",
".",
"notEmpty",
"(",
"sParamNamePartIndex",
",",
"\"ParamNamePartIndex\"",
")",
";",
... | Name of the parameter passed with a chunked request that specifies the
index of the associated partition.
@param sParamNamePartIndex
New value. May neither be <code>null</code> nor empty.
@return this for chaining | [
"Name",
"of",
"the",
"parameter",
"passed",
"with",
"a",
"chunked",
"request",
"that",
"specifies",
"the",
"index",
"of",
"the",
"associated",
"partition",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Chunking.java#L198-L204 | train |
phax/ph-oton | ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Chunking.java | FineUploader5Chunking.setParamNameTotalParts | @Nonnull
public FineUploader5Chunking setParamNameTotalParts (@Nonnull @Nonempty final String sParamNameTotalParts)
{
ValueEnforcer.notEmpty (sParamNameTotalParts, "ParamNameTotalParts");
m_sChunkingParamNamesTotalParts = sParamNameTotalParts;
return this;
} | java | @Nonnull
public FineUploader5Chunking setParamNameTotalParts (@Nonnull @Nonempty final String sParamNameTotalParts)
{
ValueEnforcer.notEmpty (sParamNameTotalParts, "ParamNameTotalParts");
m_sChunkingParamNamesTotalParts = sParamNameTotalParts;
return this;
} | [
"@",
"Nonnull",
"public",
"FineUploader5Chunking",
"setParamNameTotalParts",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sParamNameTotalParts",
")",
"{",
"ValueEnforcer",
".",
"notEmpty",
"(",
"sParamNameTotalParts",
",",
"\"ParamNameTotalParts\"",
")",
";... | Name of the parameter passed with a chunked request that specifies the
total number of chunks associated with the File or Blob.
@param sParamNameTotalParts
New value. May neither be <code>null</code> nor empty.
@return this for chaining | [
"Name",
"of",
"the",
"parameter",
"passed",
"with",
"a",
"chunked",
"request",
"that",
"specifies",
"the",
"total",
"number",
"of",
"chunks",
"associated",
"with",
"the",
"File",
"or",
"Blob",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Chunking.java#L221-L227 | train |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/hash/BytecodeCleaner.java | BytecodeCleaner.removeDebugInfo | public static byte[] removeDebugInfo(byte[] bytes) {
if (bytes.length >= 4) {
// Check magic number.
int magic = ((bytes[0] & 0xff) << 24) | ((bytes[1] & 0xff) << 16)
| ((bytes[2] & 0xff) << 8) | (bytes[3] & 0xff);
if (magic != 0xCAFEBABE)
return bytes;
} else {
return bytes;
}
// We set the initial size as it cannot exceed that value (but note that
// this may not be the final size).
ByteArrayOutputStream baos = new ByteArrayOutputStream(bytes.length);
DataOutputStream dos = new DataOutputStream(baos);
try {
ClassReader classReader = new ClassReader(bytes);
CleanClass cleanClass = new CleanClass(dos);
classReader.accept(cleanClass, ClassReader.SKIP_DEBUG);
if (cleanClass.isFiltered()) {
return FILTERED_BYTECODE;
}
} catch (Exception ex) {
return bytes;
}
return baos.toByteArray();
} | java | public static byte[] removeDebugInfo(byte[] bytes) {
if (bytes.length >= 4) {
// Check magic number.
int magic = ((bytes[0] & 0xff) << 24) | ((bytes[1] & 0xff) << 16)
| ((bytes[2] & 0xff) << 8) | (bytes[3] & 0xff);
if (magic != 0xCAFEBABE)
return bytes;
} else {
return bytes;
}
// We set the initial size as it cannot exceed that value (but note that
// this may not be the final size).
ByteArrayOutputStream baos = new ByteArrayOutputStream(bytes.length);
DataOutputStream dos = new DataOutputStream(baos);
try {
ClassReader classReader = new ClassReader(bytes);
CleanClass cleanClass = new CleanClass(dos);
classReader.accept(cleanClass, ClassReader.SKIP_DEBUG);
if (cleanClass.isFiltered()) {
return FILTERED_BYTECODE;
}
} catch (Exception ex) {
return bytes;
}
return baos.toByteArray();
} | [
"public",
"static",
"byte",
"[",
"]",
"removeDebugInfo",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"if",
"(",
"bytes",
".",
"length",
">=",
"4",
")",
"{",
"// Check magic number.",
"int",
"magic",
"=",
"(",
"(",
"bytes",
"[",
"0",
"]",
"&",
"0xff",
... | Removes debug info from the given class file. If the file is not java
class file, the given byte array is returned without any change.
@param bytes
Bytes that are from a classfile.
@return classfile without debug info or the given array if the given
array is not java classfile. | [
"Removes",
"debug",
"info",
"from",
"the",
"given",
"class",
"file",
".",
"If",
"the",
"file",
"is",
"not",
"java",
"class",
"file",
"the",
"given",
"byte",
"array",
"is",
"returned",
"without",
"any",
"change",
"."
] | 5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1 | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/hash/BytecodeCleaner.java#L663-L691 | train |
phax/ph-oton | ph-oton-uicore/src/main/java/com/helger/photon/uicore/html/swf/HCSWFObject.java | HCSWFObject.addFlashVar | @Nonnull
public final HCSWFObject addFlashVar (@Nonnull final String sName, final Object aValue)
{
if (!JSMarshaller.isJSIdentifier (sName))
throw new IllegalArgumentException ("The name '" + sName + "' is not a legal JS identifier!");
if (m_aFlashVars == null)
m_aFlashVars = new CommonsLinkedHashMap <> ();
m_aFlashVars.put (sName, aValue);
return this;
} | java | @Nonnull
public final HCSWFObject addFlashVar (@Nonnull final String sName, final Object aValue)
{
if (!JSMarshaller.isJSIdentifier (sName))
throw new IllegalArgumentException ("The name '" + sName + "' is not a legal JS identifier!");
if (m_aFlashVars == null)
m_aFlashVars = new CommonsLinkedHashMap <> ();
m_aFlashVars.put (sName, aValue);
return this;
} | [
"@",
"Nonnull",
"public",
"final",
"HCSWFObject",
"addFlashVar",
"(",
"@",
"Nonnull",
"final",
"String",
"sName",
",",
"final",
"Object",
"aValue",
")",
"{",
"if",
"(",
"!",
"JSMarshaller",
".",
"isJSIdentifier",
"(",
"sName",
")",
")",
"throw",
"new",
"Il... | Add a parameter to be passed to the Flash object
@param sName
Parameter name
@param aValue
Parameter value
@return this | [
"Add",
"a",
"parameter",
"to",
"be",
"passed",
"to",
"the",
"Flash",
"object"
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uicore/src/main/java/com/helger/photon/uicore/html/swf/HCSWFObject.java#L168-L178 | train |
phax/ph-oton | ph-oton-uicore/src/main/java/com/helger/photon/uicore/html/swf/HCSWFObject.java | HCSWFObject.removeFlashVar | @Nonnull
public final HCSWFObject removeFlashVar (@Nullable final String sName)
{
if (m_aFlashVars != null)
m_aFlashVars.remove (sName);
return this;
} | java | @Nonnull
public final HCSWFObject removeFlashVar (@Nullable final String sName)
{
if (m_aFlashVars != null)
m_aFlashVars.remove (sName);
return this;
} | [
"@",
"Nonnull",
"public",
"final",
"HCSWFObject",
"removeFlashVar",
"(",
"@",
"Nullable",
"final",
"String",
"sName",
")",
"{",
"if",
"(",
"m_aFlashVars",
"!=",
"null",
")",
"m_aFlashVars",
".",
"remove",
"(",
"sName",
")",
";",
"return",
"this",
";",
"}"
... | Remove a flash variable
@param sName
The name of the flash variable to be removed
@return this | [
"Remove",
"a",
"flash",
"variable"
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uicore/src/main/java/com/helger/photon/uicore/html/swf/HCSWFObject.java#L187-L193 | train |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/dynamic/DynamicEkstazi.java | DynamicEkstazi.initAgentAtRuntimeAndReportSuccess | public static Instrumentation initAgentAtRuntimeAndReportSuccess() {
try {
setSystemClassLoaderClassPath();
} catch (Exception e) {
Log.e("Could not set classpath. Tool will be off.", e);
return null;
}
try {
return addClassfileTransformer();
} catch (Exception e) {
Log.e("Could not add transformer. Tool will be off.", e);
return null;
}
} | java | public static Instrumentation initAgentAtRuntimeAndReportSuccess() {
try {
setSystemClassLoaderClassPath();
} catch (Exception e) {
Log.e("Could not set classpath. Tool will be off.", e);
return null;
}
try {
return addClassfileTransformer();
} catch (Exception e) {
Log.e("Could not add transformer. Tool will be off.", e);
return null;
}
} | [
"public",
"static",
"Instrumentation",
"initAgentAtRuntimeAndReportSuccess",
"(",
")",
"{",
"try",
"{",
"setSystemClassLoaderClassPath",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"Log",
".",
"e",
"(",
"\"Could not set classpath. Tool will be off.\"... | Initializes an agent at runtime and adds it to VM. Returns true if the
initialization was successful, false otherwise. | [
"Initializes",
"an",
"agent",
"at",
"runtime",
"and",
"adds",
"it",
"to",
"VM",
".",
"Returns",
"true",
"if",
"the",
"initialization",
"was",
"successful",
"false",
"otherwise",
"."
] | 5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1 | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/dynamic/DynamicEkstazi.java#L42-L55 | train |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/dynamic/DynamicEkstazi.java | DynamicEkstazi.setSystemClassLoaderClassPath | private static void setSystemClassLoaderClassPath() throws Exception {
Log.d("Setting classpath");
// We use agent class as we do not extract this class in newly created
// jar (otherwise we may end up creating one -magic jar from another);
// also it will exist even without JUnit classes).
URL url = EkstaziAgent.class.getResource(EkstaziAgent.class.getSimpleName() + ".class");
String origPath = url.getFile().replace("file:", "").replaceAll(".jar!.*", ".jar");
File junitJar = new File(origPath);
File xtsJar = new File(origPath.replaceAll(".jar", "-magic.jar"));
boolean isCreated = false;
// If extracted (Tool) jar is newer than junit*.jar, there is no reason
// to extract files again, so just return in that case.
if (FileUtil.isSecondNewerThanFirst(junitJar, xtsJar)) {
// We cannot return here, as we have to include jar on the path.
isCreated = true;
} else {
// Extract new jar as junit.jar is newer.
String[] includePrefixes = { Names.EKSTAZI_PACKAGE_BIN };
String[] excludePrefixes = { EkstaziAgent.class.getName() };
isCreated = JarXtractor.extract(junitJar, xtsJar, includePrefixes, excludePrefixes);
}
// Add jar to classpath if it was successfully created, otherwise throw
// an exception.
if (isCreated) {
addURL(xtsJar.toURI().toURL());
} else {
throw new RuntimeException("Could not extract Tool classes in separate jar.");
}
} | java | private static void setSystemClassLoaderClassPath() throws Exception {
Log.d("Setting classpath");
// We use agent class as we do not extract this class in newly created
// jar (otherwise we may end up creating one -magic jar from another);
// also it will exist even without JUnit classes).
URL url = EkstaziAgent.class.getResource(EkstaziAgent.class.getSimpleName() + ".class");
String origPath = url.getFile().replace("file:", "").replaceAll(".jar!.*", ".jar");
File junitJar = new File(origPath);
File xtsJar = new File(origPath.replaceAll(".jar", "-magic.jar"));
boolean isCreated = false;
// If extracted (Tool) jar is newer than junit*.jar, there is no reason
// to extract files again, so just return in that case.
if (FileUtil.isSecondNewerThanFirst(junitJar, xtsJar)) {
// We cannot return here, as we have to include jar on the path.
isCreated = true;
} else {
// Extract new jar as junit.jar is newer.
String[] includePrefixes = { Names.EKSTAZI_PACKAGE_BIN };
String[] excludePrefixes = { EkstaziAgent.class.getName() };
isCreated = JarXtractor.extract(junitJar, xtsJar, includePrefixes, excludePrefixes);
}
// Add jar to classpath if it was successfully created, otherwise throw
// an exception.
if (isCreated) {
addURL(xtsJar.toURI().toURL());
} else {
throw new RuntimeException("Could not extract Tool classes in separate jar.");
}
} | [
"private",
"static",
"void",
"setSystemClassLoaderClassPath",
"(",
")",
"throws",
"Exception",
"{",
"Log",
".",
"d",
"(",
"\"Setting classpath\"",
")",
";",
"// We use agent class as we do not extract this class in newly created",
"// jar (otherwise we may end up creating one -magi... | Set paths from the current class loader to the path of system class
loader. This method should be invoked only once. | [
"Set",
"paths",
"from",
"the",
"current",
"class",
"loader",
"to",
"the",
"path",
"of",
"system",
"class",
"loader",
".",
"This",
"method",
"should",
"be",
"invoked",
"only",
"once",
"."
] | 5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1 | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/dynamic/DynamicEkstazi.java#L137-L167 | train |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/dynamic/DynamicEkstazi.java | DynamicEkstazi.addURL | private static void addURL(URL url) throws Exception {
URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader();
Class<?> sysclass = URLClassLoader.class;
Method method = sysclass.getDeclaredMethod("addURL", new Class[] { URL.class });
method.setAccessible(true);
method.invoke(sysloader, new Object[] { url });
} | java | private static void addURL(URL url) throws Exception {
URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader();
Class<?> sysclass = URLClassLoader.class;
Method method = sysclass.getDeclaredMethod("addURL", new Class[] { URL.class });
method.setAccessible(true);
method.invoke(sysloader, new Object[] { url });
} | [
"private",
"static",
"void",
"addURL",
"(",
"URL",
"url",
")",
"throws",
"Exception",
"{",
"URLClassLoader",
"sysloader",
"=",
"(",
"URLClassLoader",
")",
"ClassLoader",
".",
"getSystemClassLoader",
"(",
")",
";",
"Class",
"<",
"?",
">",
"sysclass",
"=",
"UR... | Adds URL to system ClassLoader. This is not a nice approach as we use
reflection, but it seems the only available in Java. This will be gone if
we decided to go with javaagent and boot classloader.
@param url
URL to include on classpath.
@throws IOException
If URL could not be added. | [
"Adds",
"URL",
"to",
"system",
"ClassLoader",
".",
"This",
"is",
"not",
"a",
"nice",
"approach",
"as",
"we",
"use",
"reflection",
"but",
"it",
"seems",
"the",
"only",
"available",
"in",
"Java",
".",
"This",
"will",
"be",
"gone",
"if",
"we",
"decided",
... | 5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1 | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/dynamic/DynamicEkstazi.java#L179-L185 | train |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/monitor/CoverageMonitor.java | CoverageMonitor.t | public static void t(Class<?> clz) {
// Must be non null and type of interest.
if (clz == null || ClassesCache.check(clz) || Types.isIgnorable(clz)) {
return;
}
// Check and assign id to this class (this must be synchronized).
try {
sLock.lock();
if (!sClasses.add(clz)) {
return;
}
} finally {
sLock.unlock();
}
String className = clz.getName();
String resourceName = className.substring(className.lastIndexOf(".") + 1).concat(".class");
URL url = null;
try {
// Find resource for the class (URL that we will use to extract
// the path).
url = clz.getResource(resourceName);
} catch (SecurityException ex) {
Log.w("Unable to obtain resource because of security reasons.");
}
// If no URL obtained, return.
if (url == null) {
return;
}
recordURL(url.toExternalForm());
} | java | public static void t(Class<?> clz) {
// Must be non null and type of interest.
if (clz == null || ClassesCache.check(clz) || Types.isIgnorable(clz)) {
return;
}
// Check and assign id to this class (this must be synchronized).
try {
sLock.lock();
if (!sClasses.add(clz)) {
return;
}
} finally {
sLock.unlock();
}
String className = clz.getName();
String resourceName = className.substring(className.lastIndexOf(".") + 1).concat(".class");
URL url = null;
try {
// Find resource for the class (URL that we will use to extract
// the path).
url = clz.getResource(resourceName);
} catch (SecurityException ex) {
Log.w("Unable to obtain resource because of security reasons.");
}
// If no URL obtained, return.
if (url == null) {
return;
}
recordURL(url.toExternalForm());
} | [
"public",
"static",
"void",
"t",
"(",
"Class",
"<",
"?",
">",
"clz",
")",
"{",
"// Must be non null and type of interest.",
"if",
"(",
"clz",
"==",
"null",
"||",
"ClassesCache",
".",
"check",
"(",
"clz",
")",
"||",
"Types",
".",
"isIgnorable",
"(",
"clz",
... | Touch method. Instrumented code invokes this method to collect class
coverage.
IMPORTANT: "synchronized" on the following method leads to slow execution
for a large number of invocation (even in sequential code).
{@link Semaphore} is (slightly) faster but it may be too much for the
moment. | [
"Touch",
"method",
".",
"Instrumented",
"code",
"invokes",
"this",
"method",
"to",
"collect",
"class",
"coverage",
"."
] | 5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1 | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/monitor/CoverageMonitor.java#L190-L221 | train |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/monitor/CoverageMonitor.java | CoverageMonitor.t | public static void t(Class<?> clz, int probeId) {
if (clz != null) {
int index = probeId & PROBE_SIZE_MASK;
if (PROBE_ARRAY[index] != clz) {
PROBE_ARRAY[index] = clz;
t(clz);
}
}
} | java | public static void t(Class<?> clz, int probeId) {
if (clz != null) {
int index = probeId & PROBE_SIZE_MASK;
if (PROBE_ARRAY[index] != clz) {
PROBE_ARRAY[index] = clz;
t(clz);
}
}
} | [
"public",
"static",
"void",
"t",
"(",
"Class",
"<",
"?",
">",
"clz",
",",
"int",
"probeId",
")",
"{",
"if",
"(",
"clz",
"!=",
"null",
")",
"{",
"int",
"index",
"=",
"probeId",
"&",
"PROBE_SIZE_MASK",
";",
"if",
"(",
"PROBE_ARRAY",
"[",
"index",
"]"... | Touch method, which also accepts probe id. The id can be used to optimize
execution.
The current optimization is as follows: we check if index at probeId
location is set; if yes, then we do nothing, but if not, we set it and
invoke original touch method. As we use limited size of probe array, we
have to check length as we may have more probes than array allows. | [
"Touch",
"method",
"which",
"also",
"accepts",
"probe",
"id",
".",
"The",
"id",
"can",
"be",
"used",
"to",
"optimize",
"execution",
"."
] | 5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1 | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/monitor/CoverageMonitor.java#L232-L240 | train |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/monitor/CoverageMonitor.java | CoverageMonitor.addFileURL | public static void addFileURL(File f) {
String absolutePath = f.getAbsolutePath();
if (!filterFile(absolutePath)) {
try {
recordURL(f.toURI().toURL().toExternalForm());
} catch (MalformedURLException e) {
// Never expected.
}
}
} | java | public static void addFileURL(File f) {
String absolutePath = f.getAbsolutePath();
if (!filterFile(absolutePath)) {
try {
recordURL(f.toURI().toURL().toExternalForm());
} catch (MalformedURLException e) {
// Never expected.
}
}
} | [
"public",
"static",
"void",
"addFileURL",
"(",
"File",
"f",
")",
"{",
"String",
"absolutePath",
"=",
"f",
".",
"getAbsolutePath",
"(",
")",
";",
"if",
"(",
"!",
"filterFile",
"(",
"absolutePath",
")",
")",
"{",
"try",
"{",
"recordURL",
"(",
"f",
".",
... | Records the given file as a dependency after some filtering.
@param f
File to record as a dependency | [
"Records",
"the",
"given",
"file",
"as",
"a",
"dependency",
"after",
"some",
"filtering",
"."
] | 5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1 | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/monitor/CoverageMonitor.java#L280-L289 | train |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/monitor/CoverageMonitor.java | CoverageMonitor.recordURL | protected static void recordURL(String externalForm) {
if (filterURL(externalForm)) {
return;
}
if (isWellKnownUrl(externalForm)) {
// Ignore JUnit classes if specified in configuration.
if (Config.DEPENDENCIES_INCLUDE_WELLKNOWN_V) {
safeRecordURL(externalForm);
}
} else {
safeRecordURL(externalForm);
}
} | java | protected static void recordURL(String externalForm) {
if (filterURL(externalForm)) {
return;
}
if (isWellKnownUrl(externalForm)) {
// Ignore JUnit classes if specified in configuration.
if (Config.DEPENDENCIES_INCLUDE_WELLKNOWN_V) {
safeRecordURL(externalForm);
}
} else {
safeRecordURL(externalForm);
}
} | [
"protected",
"static",
"void",
"recordURL",
"(",
"String",
"externalForm",
")",
"{",
"if",
"(",
"filterURL",
"(",
"externalForm",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"isWellKnownUrl",
"(",
"externalForm",
")",
")",
"{",
"// Ignore JUnit classes if sp... | Records the given external form of URL as a dependency after checking if
it should be filtered.
@param externalForm | [
"Records",
"the",
"given",
"external",
"form",
"of",
"URL",
"as",
"a",
"dependency",
"after",
"checking",
"if",
"it",
"should",
"be",
"filtered",
"."
] | 5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1 | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/monitor/CoverageMonitor.java#L299-L312 | train |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/monitor/CoverageMonitor.java | CoverageMonitor.safeRecordURL | private static void safeRecordURL(String externalForm) {
try {
sLock.lock();
sURLs.add(externalForm);
} finally {
sLock.unlock();
}
} | java | private static void safeRecordURL(String externalForm) {
try {
sLock.lock();
sURLs.add(externalForm);
} finally {
sLock.unlock();
}
} | [
"private",
"static",
"void",
"safeRecordURL",
"(",
"String",
"externalForm",
")",
"{",
"try",
"{",
"sLock",
".",
"lock",
"(",
")",
";",
"sURLs",
".",
"add",
"(",
"externalForm",
")",
";",
"}",
"finally",
"{",
"sLock",
".",
"unlock",
"(",
")",
";",
"}... | Records the given external form of URL as a dependency.
@param externalForm | [
"Records",
"the",
"given",
"external",
"form",
"of",
"URL",
"as",
"a",
"dependency",
"."
] | 5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1 | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/monitor/CoverageMonitor.java#L319-L326 | train |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/log/Log.java | Log.c | public static final void c(String msg) {
if (msg.replaceAll("\\s+", "").equals("")) {
println(CONF_TEXT);
} else {
println(CONF_TEXT + ": " + msg);
}
} | java | public static final void c(String msg) {
if (msg.replaceAll("\\s+", "").equals("")) {
println(CONF_TEXT);
} else {
println(CONF_TEXT + ": " + msg);
}
} | [
"public",
"static",
"final",
"void",
"c",
"(",
"String",
"msg",
")",
"{",
"if",
"(",
"msg",
".",
"replaceAll",
"(",
"\"\\\\s+\"",
",",
"\"\"",
")",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"println",
"(",
"CONF_TEXT",
")",
";",
"}",
"else",
"{",
... | Printing configuration options. | [
"Printing",
"configuration",
"options",
"."
] | 5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1 | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/log/Log.java#L118-L124 | train |
phax/ph-oton | ph-oton-api/src/main/java/com/helger/photon/api/pathdescriptor/PathDescriptor.java | PathDescriptor.matchesParts | @Nonnull
public PathMatchingResult matchesParts (@Nonnull final List <String> aPathParts)
{
ValueEnforcer.notNull (aPathParts, "PathParts");
final int nPartCount = m_aPathParts.size ();
if (aPathParts.size () != nPartCount)
{
// Size must match
return PathMatchingResult.NO_MATCH;
}
final ICommonsOrderedMap <String, String> aVariableValues = new CommonsLinkedHashMap <> ();
for (int i = 0; i < nPartCount; ++i)
{
final PathDescriptorPart aPart = m_aPathParts.get (i);
final String sPathPart = aPathParts.get (i);
if (!aPart.matches (sPathPart))
{
// Current part does not match - full error
return PathMatchingResult.NO_MATCH;
}
// Matching variable part?
if (aPart.isVariable ())
aVariableValues.put (aPart.getName (), sPathPart);
}
// We've got it!
return PathMatchingResult.createSuccess (aVariableValues);
} | java | @Nonnull
public PathMatchingResult matchesParts (@Nonnull final List <String> aPathParts)
{
ValueEnforcer.notNull (aPathParts, "PathParts");
final int nPartCount = m_aPathParts.size ();
if (aPathParts.size () != nPartCount)
{
// Size must match
return PathMatchingResult.NO_MATCH;
}
final ICommonsOrderedMap <String, String> aVariableValues = new CommonsLinkedHashMap <> ();
for (int i = 0; i < nPartCount; ++i)
{
final PathDescriptorPart aPart = m_aPathParts.get (i);
final String sPathPart = aPathParts.get (i);
if (!aPart.matches (sPathPart))
{
// Current part does not match - full error
return PathMatchingResult.NO_MATCH;
}
// Matching variable part?
if (aPart.isVariable ())
aVariableValues.put (aPart.getName (), sPathPart);
}
// We've got it!
return PathMatchingResult.createSuccess (aVariableValues);
} | [
"@",
"Nonnull",
"public",
"PathMatchingResult",
"matchesParts",
"(",
"@",
"Nonnull",
"final",
"List",
"<",
"String",
">",
"aPathParts",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aPathParts",
",",
"\"PathParts\"",
")",
";",
"final",
"int",
"nPartCount",
... | Check if this path descriptor matches the provided path parts. This requires
that this path descriptor and the provided collection have the same number of
elements and that all static and variable parts match.
@param aPathParts
The parts to
@return A non-<code>null</code> {@link PathMatchingResult} object with all
matching variable names. | [
"Check",
"if",
"this",
"path",
"descriptor",
"matches",
"the",
"provided",
"path",
"parts",
".",
"This",
"requires",
"that",
"this",
"path",
"descriptor",
"and",
"the",
"provided",
"collection",
"have",
"the",
"same",
"number",
"of",
"elements",
"and",
"that",... | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-api/src/main/java/com/helger/photon/api/pathdescriptor/PathDescriptor.java#L71-L100 | train |
phax/ph-oton | ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Retry.java | FineUploader5Retry.setAutoAttemptDelay | @Nonnull
public FineUploader5Retry setAutoAttemptDelay (@Nonnegative final int nAutoAttemptDelay)
{
ValueEnforcer.isGE0 (nAutoAttemptDelay, "AutoAttemptDelay");
m_nRetryAutoAttemptDelay = nAutoAttemptDelay;
return this;
} | java | @Nonnull
public FineUploader5Retry setAutoAttemptDelay (@Nonnegative final int nAutoAttemptDelay)
{
ValueEnforcer.isGE0 (nAutoAttemptDelay, "AutoAttemptDelay");
m_nRetryAutoAttemptDelay = nAutoAttemptDelay;
return this;
} | [
"@",
"Nonnull",
"public",
"FineUploader5Retry",
"setAutoAttemptDelay",
"(",
"@",
"Nonnegative",
"final",
"int",
"nAutoAttemptDelay",
")",
"{",
"ValueEnforcer",
".",
"isGE0",
"(",
"nAutoAttemptDelay",
",",
"\"AutoAttemptDelay\"",
")",
";",
"m_nRetryAutoAttemptDelay",
"="... | The number of seconds to wait between auto retry attempts.
@param nAutoAttemptDelay
Number of seconds. Must be ≥ 0.
@return this | [
"The",
"number",
"of",
"seconds",
"to",
"wait",
"between",
"auto",
"retry",
"attempts",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Retry.java#L59-L65 | train |
phax/ph-oton | ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Retry.java | FineUploader5Retry.setMaxAutoAttempts | @Nonnull
public FineUploader5Retry setMaxAutoAttempts (@Nonnegative final int nMaxAutoAttempts)
{
ValueEnforcer.isGE0 (nMaxAutoAttempts, "MaxAutoAttempts");
m_nRetryMaxAutoAttempts = nMaxAutoAttempts;
return this;
} | java | @Nonnull
public FineUploader5Retry setMaxAutoAttempts (@Nonnegative final int nMaxAutoAttempts)
{
ValueEnforcer.isGE0 (nMaxAutoAttempts, "MaxAutoAttempts");
m_nRetryMaxAutoAttempts = nMaxAutoAttempts;
return this;
} | [
"@",
"Nonnull",
"public",
"FineUploader5Retry",
"setMaxAutoAttempts",
"(",
"@",
"Nonnegative",
"final",
"int",
"nMaxAutoAttempts",
")",
"{",
"ValueEnforcer",
".",
"isGE0",
"(",
"nMaxAutoAttempts",
",",
"\"MaxAutoAttempts\"",
")",
";",
"m_nRetryMaxAutoAttempts",
"=",
"... | The maximum number of times to attempt to retry a failed upload.
@param nMaxAutoAttempts
The number of retry attempts. Must be ≥ 0.
@return this | [
"The",
"maximum",
"number",
"of",
"times",
"to",
"attempt",
"to",
"retry",
"a",
"failed",
"upload",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Retry.java#L99-L105 | train |
phax/ph-oton | ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Retry.java | FineUploader5Retry.setPreventRetryResponseProperty | @Nonnull
public FineUploader5Retry setPreventRetryResponseProperty (@Nonnull @Nonempty final String sPreventRetryResponseProperty)
{
ValueEnforcer.notEmpty (sPreventRetryResponseProperty, "PreventRetryResponseProperty");
m_sRetryPreventRetryResponseProperty = sPreventRetryResponseProperty;
return this;
} | java | @Nonnull
public FineUploader5Retry setPreventRetryResponseProperty (@Nonnull @Nonempty final String sPreventRetryResponseProperty)
{
ValueEnforcer.notEmpty (sPreventRetryResponseProperty, "PreventRetryResponseProperty");
m_sRetryPreventRetryResponseProperty = sPreventRetryResponseProperty;
return this;
} | [
"@",
"Nonnull",
"public",
"FineUploader5Retry",
"setPreventRetryResponseProperty",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sPreventRetryResponseProperty",
")",
"{",
"ValueEnforcer",
".",
"notEmpty",
"(",
"sPreventRetryResponseProperty",
",",
"\"PreventRetr... | This property will be looked for in the server response and, if found and
true, will indicate that no more retries should be attempted for this item.
@param sPreventRetryResponseProperty
property name
@return this | [
"This",
"property",
"will",
"be",
"looked",
"for",
"in",
"the",
"server",
"response",
"and",
"if",
"found",
"and",
"true",
"will",
"indicate",
"that",
"no",
"more",
"retries",
"should",
"be",
"attempted",
"for",
"this",
"item",
"."
] | f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Retry.java#L122-L128 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.