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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
kiswanij/jk-util | src/main/java/com/jk/util/factory/JKFactory.java | JKFactory.dumpBeansNames | public static void dumpBeansNames() {
DefaultListableBeanFactory f = (DefaultListableBeanFactory) context.getBeanFactory();
String[] beanDefinitionNames = f.getBeanDefinitionNames();
for (String name : beanDefinitionNames) {
JK.print(name, " for class :", f.getBean(name).getClass().getName());
}
} | java | public static void dumpBeansNames() {
DefaultListableBeanFactory f = (DefaultListableBeanFactory) context.getBeanFactory();
String[] beanDefinitionNames = f.getBeanDefinitionNames();
for (String name : beanDefinitionNames) {
JK.print(name, " for class :", f.getBean(name).getClass().getName());
}
} | [
"public",
"static",
"void",
"dumpBeansNames",
"(",
")",
"{",
"DefaultListableBeanFactory",
"f",
"=",
"(",
"DefaultListableBeanFactory",
")",
"context",
".",
"getBeanFactory",
"(",
")",
";",
"String",
"[",
"]",
"beanDefinitionNames",
"=",
"f",
".",
"getBeanDefiniti... | Dump beans names. | [
"Dump",
"beans",
"names",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/factory/JKFactory.java#L93-L99 | train |
kiswanij/jk-util | src/main/java/com/jk/util/templates/TemplateUtil.java | TemplateUtil.getConfig | protected static Configuration getConfig(String path) {
if (cfg == null) {
cfg = new Configuration();
cfg.setClassForTemplateLoading(TemplateUtil.class, path == null ? "/templates" : path);
cfg.setLocale(Locale.US);
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
}
re... | java | protected static Configuration getConfig(String path) {
if (cfg == null) {
cfg = new Configuration();
cfg.setClassForTemplateLoading(TemplateUtil.class, path == null ? "/templates" : path);
cfg.setLocale(Locale.US);
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
}
re... | [
"protected",
"static",
"Configuration",
"getConfig",
"(",
"String",
"path",
")",
"{",
"if",
"(",
"cfg",
"==",
"null",
")",
"{",
"cfg",
"=",
"new",
"Configuration",
"(",
")",
";",
"cfg",
".",
"setClassForTemplateLoading",
"(",
"TemplateUtil",
".",
"class",
... | Gets the config.
@param path
@return the config | [
"Gets",
"the",
"config",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/templates/TemplateUtil.java#L45-L53 | train |
kiswanij/jk-util | src/main/java/com/jk/util/reflection/server/ReflectionServer.java | ReflectionServer.handleClient | protected void handleClient(final Socket client) throws IOException {
final ClientHandler handler = new ClientHandler(client);
this.executorService.execute(handler);
} | java | protected void handleClient(final Socket client) throws IOException {
final ClientHandler handler = new ClientHandler(client);
this.executorService.execute(handler);
} | [
"protected",
"void",
"handleClient",
"(",
"final",
"Socket",
"client",
")",
"throws",
"IOException",
"{",
"final",
"ClientHandler",
"handler",
"=",
"new",
"ClientHandler",
"(",
"client",
")",
";",
"this",
".",
"executorService",
".",
"execute",
"(",
"handler",
... | Handle client request , this method will be called when new client connection
received by the start method.
@param client the client
@throws IOException Signals that an I/O exception has occurred. | [
"Handle",
"client",
"request",
"this",
"method",
"will",
"be",
"called",
"when",
"new",
"client",
"connection",
"received",
"by",
"the",
"start",
"method",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/reflection/server/ReflectionServer.java#L89-L92 | train |
kiswanij/jk-util | src/main/java/com/jk/util/reflection/server/ReflectionServer.java | ReflectionServer.stop | public synchronized void stop() throws IOException {
this.stopped = true;
if (this.server != null && this.waitingClient) {
this.server.close();
this.server = null;
}
} | java | public synchronized void stop() throws IOException {
this.stopped = true;
if (this.server != null && this.waitingClient) {
this.server.close();
this.server = null;
}
} | [
"public",
"synchronized",
"void",
"stop",
"(",
")",
"throws",
"IOException",
"{",
"this",
".",
"stopped",
"=",
"true",
";",
"if",
"(",
"this",
".",
"server",
"!=",
"null",
"&&",
"this",
".",
"waitingClient",
")",
"{",
"this",
".",
"server",
".",
"close... | Stop the server instance by setting the stopped flag to true , the close the
server instance if open.
@throws IOException Signals that an I/O exception has occurred. | [
"Stop",
"the",
"server",
"instance",
"by",
"setting",
"the",
"stopped",
"flag",
"to",
"true",
"the",
"close",
"the",
"server",
"instance",
"if",
"open",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/reflection/server/ReflectionServer.java#L143-L149 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/wsadapter/MonomerStoreConfiguration.java | MonomerStoreConfiguration.resetConfigToDefault | private void resetConfigToDefault() {
isUseWebservice = true;
isUpdateAutomatic = true;
isUseExternalMonomers = false;
isUseExternalNucleotides = false;
setUseExternalAttachments(false);
webserviceMonomersURL = "http://localhost:8080/HELM2MonomerService/rest";
webserviceMonomersPath =... | java | private void resetConfigToDefault() {
isUseWebservice = true;
isUpdateAutomatic = true;
isUseExternalMonomers = false;
isUseExternalNucleotides = false;
setUseExternalAttachments(false);
webserviceMonomersURL = "http://localhost:8080/HELM2MonomerService/rest";
webserviceMonomersPath =... | [
"private",
"void",
"resetConfigToDefault",
"(",
")",
"{",
"isUseWebservice",
"=",
"true",
";",
"isUpdateAutomatic",
"=",
"true",
";",
"isUseExternalMonomers",
"=",
"false",
";",
"isUseExternalNucleotides",
"=",
"false",
";",
"setUseExternalAttachments",
"(",
"false",
... | Resets the configuration to default values. | [
"Resets",
"the",
"configuration",
"to",
"default",
"values",
"."
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/wsadapter/MonomerStoreConfiguration.java#L129-L143 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/wsadapter/MonomerStoreConfiguration.java | MonomerStoreConfiguration.refresh | public void refresh() {
File configFile = new File(CONFIG_FILE_PATH);
if (!configFile.exists()) {
BufferedWriter writer = null;
BufferedReader reader = null;
try {
configFile.createNewFile();
InputStream in = Chemistry.class.getResourceAsStream("/org/helm/notation2/res... | java | public void refresh() {
File configFile = new File(CONFIG_FILE_PATH);
if (!configFile.exists()) {
BufferedWriter writer = null;
BufferedReader reader = null;
try {
configFile.createNewFile();
InputStream in = Chemistry.class.getResourceAsStream("/org/helm/notation2/res... | [
"public",
"void",
"refresh",
"(",
")",
"{",
"File",
"configFile",
"=",
"new",
"File",
"(",
"CONFIG_FILE_PATH",
")",
";",
"if",
"(",
"!",
"configFile",
".",
"exists",
"(",
")",
")",
"{",
"BufferedWriter",
"writer",
"=",
"null",
";",
"BufferedReader",
"rea... | Refreshes the configuration using the local properties file. | [
"Refreshes",
"the",
"configuration",
"using",
"the",
"local",
"properties",
"file",
"."
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/wsadapter/MonomerStoreConfiguration.java#L310-L374 | train |
kiswanij/jk-util | src/main/java/com/jk/util/mime/MimeUtil.java | MimeUtil.addEntry | private static void addEntry(final ArrayList<String> aStringArray) {
try {
final MagicMimeEntry magicEntry = new MagicMimeEntry(aStringArray);
mMagicMimeEntries.add(magicEntry);
} catch (final InvalidMagicMimeEntryException e) {
}
} | java | private static void addEntry(final ArrayList<String> aStringArray) {
try {
final MagicMimeEntry magicEntry = new MagicMimeEntry(aStringArray);
mMagicMimeEntries.add(magicEntry);
} catch (final InvalidMagicMimeEntryException e) {
}
} | [
"private",
"static",
"void",
"addEntry",
"(",
"final",
"ArrayList",
"<",
"String",
">",
"aStringArray",
")",
"{",
"try",
"{",
"final",
"MagicMimeEntry",
"magicEntry",
"=",
"new",
"MagicMimeEntry",
"(",
"aStringArray",
")",
";",
"mMagicMimeEntries",
".",
"add",
... | Adds the entry.
@param aStringArray the a string array | [
"Adds",
"the",
"entry",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/mime/MimeUtil.java#L55-L61 | train |
kiswanij/jk-util | src/main/java/com/jk/util/mime/MimeUtil.java | MimeUtil.getMagicMimeType | private static String getMagicMimeType(final byte[] bytes) throws IOException {
final int len = mMagicMimeEntries.size();
for (int i = 0; i < len; i++) {
final MagicMimeEntry me = mMagicMimeEntries.get(i);
final String mtype = me.getMatch(bytes);
if (mtype != null) {
return mtype;
}
}
return nul... | java | private static String getMagicMimeType(final byte[] bytes) throws IOException {
final int len = mMagicMimeEntries.size();
for (int i = 0; i < len; i++) {
final MagicMimeEntry me = mMagicMimeEntries.get(i);
final String mtype = me.getMatch(bytes);
if (mtype != null) {
return mtype;
}
}
return nul... | [
"private",
"static",
"String",
"getMagicMimeType",
"(",
"final",
"byte",
"[",
"]",
"bytes",
")",
"throws",
"IOException",
"{",
"final",
"int",
"len",
"=",
"mMagicMimeEntries",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",... | Gets the magic mime type.
@param bytes the bytes
@return the magic mime type
@throws IOException Signals that an I/O exception has occurred. | [
"Gets",
"the",
"magic",
"mime",
"type",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/mime/MimeUtil.java#L70-L80 | train |
kiswanij/jk-util | src/main/java/com/jk/util/mime/MimeUtil.java | MimeUtil.getMimeType | public static String getMimeType(final byte[] data) {
String mimeType = null;
try {
mimeType = MimeUtil.getMagicMimeType(data);
} catch (final Exception e) {
} finally {
if (mimeType == null) {
mimeType = UNKNOWN_MIME_TYPE;
}
}
return mimeType;
} | java | public static String getMimeType(final byte[] data) {
String mimeType = null;
try {
mimeType = MimeUtil.getMagicMimeType(data);
} catch (final Exception e) {
} finally {
if (mimeType == null) {
mimeType = UNKNOWN_MIME_TYPE;
}
}
return mimeType;
} | [
"public",
"static",
"String",
"getMimeType",
"(",
"final",
"byte",
"[",
"]",
"data",
")",
"{",
"String",
"mimeType",
"=",
"null",
";",
"try",
"{",
"mimeType",
"=",
"MimeUtil",
".",
"getMagicMimeType",
"(",
"data",
")",
";",
"}",
"catch",
"(",
"final",
... | Gets the mime type.
@param data the data
@return the mime type | [
"Gets",
"the",
"mime",
"type",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/mime/MimeUtil.java#L88-L99 | train |
kiswanij/jk-util | src/main/java/com/jk/util/mime/MimeUtil.java | MimeUtil.parse | private static void parse(final Reader r) throws IOException {
final BufferedReader br = new BufferedReader(r);
String line;
final ArrayList<String> sequence = new ArrayList<String>();
line = br.readLine();
while (true) {
if (line == null) {
break;
}
line = line.trim();
if (line.length() == 0... | java | private static void parse(final Reader r) throws IOException {
final BufferedReader br = new BufferedReader(r);
String line;
final ArrayList<String> sequence = new ArrayList<String>();
line = br.readLine();
while (true) {
if (line == null) {
break;
}
line = line.trim();
if (line.length() == 0... | [
"private",
"static",
"void",
"parse",
"(",
"final",
"Reader",
"r",
")",
"throws",
"IOException",
"{",
"final",
"BufferedReader",
"br",
"=",
"new",
"BufferedReader",
"(",
"r",
")",
";",
"String",
"line",
";",
"final",
"ArrayList",
"<",
"String",
">",
"seque... | Parse the magic.mime file | [
"Parse",
"the",
"magic",
".",
"mime",
"file"
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/mime/MimeUtil.java#L134-L175 | train |
kiswanij/jk-util | src/main/java/com/jk/util/context/JKContextFactory.java | JKContextFactory.getCurrentContext | public static JKContext getCurrentContext() {
JKContext context = (JKContext) JKThreadLocal.getValue(JKContextConstants.JK_CONTEXT);
if (context == null) {
context = getInstance().createDesktopContext();
JKThreadLocal.setValue(JKContextConstants.JK_CONTEXT, context);
}
return context;
} | java | public static JKContext getCurrentContext() {
JKContext context = (JKContext) JKThreadLocal.getValue(JKContextConstants.JK_CONTEXT);
if (context == null) {
context = getInstance().createDesktopContext();
JKThreadLocal.setValue(JKContextConstants.JK_CONTEXT, context);
}
return context;
} | [
"public",
"static",
"JKContext",
"getCurrentContext",
"(",
")",
"{",
"JKContext",
"context",
"=",
"(",
"JKContext",
")",
"JKThreadLocal",
".",
"getValue",
"(",
"JKContextConstants",
".",
"JK_CONTEXT",
")",
";",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"... | Gets the current context.
@return the current context | [
"Gets",
"the",
"current",
"context",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/context/JKContextFactory.java#L97-L104 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/Images.java | Images.generateImageHELMMolecule | public static byte[] generateImageHELMMolecule(HELM2Notation helm2notation) throws BuilderMoleculeException, CTKException, IOException, ChemistryException {
LOG.info("Image generation process of HELM molecule starts");
/* get SMILES representation for the whole molecule */
String smiles = SMILES.getSMILE... | java | public static byte[] generateImageHELMMolecule(HELM2Notation helm2notation) throws BuilderMoleculeException, CTKException, IOException, ChemistryException {
LOG.info("Image generation process of HELM molecule starts");
/* get SMILES representation for the whole molecule */
String smiles = SMILES.getSMILE... | [
"public",
"static",
"byte",
"[",
"]",
"generateImageHELMMolecule",
"(",
"HELM2Notation",
"helm2notation",
")",
"throws",
"BuilderMoleculeException",
",",
"CTKException",
",",
"IOException",
",",
"ChemistryException",
"{",
"LOG",
".",
"info",
"(",
"\"Image generation pro... | method to generate an image of the HELM molecule
@param helm2notation input HELMNotation
@return the generated image in byte[]
@throws BuilderMoleculeException if the HELM molecule can't be built
@throws CTKException general ChemToolKit exception passed to HELMToolKit
@throws IOException IO Error
@throws ChemistryExce... | [
"method",
"to",
"generate",
"an",
"image",
"of",
"the",
"HELM",
"molecule"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/Images.java#L105-L115 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/AminoAcidParser.java | AminoAcidParser.getAminoAcidList | public static List<String> getAminoAcidList(String peptideSequence)
throws MonomerException, NotationException, MonomerLoadingException, ChemistryException {
if (null == peptideSequence) {
throw new NotationException("Peptide Sequence must be specified");
}
String cleanSeq = cleanup(pep... | java | public static List<String> getAminoAcidList(String peptideSequence)
throws MonomerException, NotationException, MonomerLoadingException, ChemistryException {
if (null == peptideSequence) {
throw new NotationException("Peptide Sequence must be specified");
}
String cleanSeq = cleanup(pep... | [
"public",
"static",
"List",
"<",
"String",
">",
"getAminoAcidList",
"(",
"String",
"peptideSequence",
")",
"throws",
"MonomerException",
",",
"NotationException",
",",
"MonomerLoadingException",
",",
"ChemistryException",
"{",
"if",
"(",
"null",
"==",
"peptideSequence... | This method converts peptide sequence into a List of amino acid
@param peptideSequence given peptide sequence
@return list of amino acid
@throws org.helm.notation2.exception.MonomerException if peptide contains unknown monomers
@throws org.helm.notation2.exception.NotationException if peptide sequence is null
@throws ... | [
"This",
"method",
"converts",
"peptide",
"sequence",
"into",
"a",
"List",
"of",
"amino",
"acid"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/AminoAcidParser.java#L62-L97 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/AminoAcidParser.java | AminoAcidParser.getAminoAcidList | public static List<String> getAminoAcidList(String peptideSequence,
String delimiter) throws MonomerException, NotationException,
MonomerLoadingException, ChemistryException {
if (null == peptideSequence) {
throw new NotationException("Peptide Sequence must be specified");
}
i... | java | public static List<String> getAminoAcidList(String peptideSequence,
String delimiter) throws MonomerException, NotationException,
MonomerLoadingException, ChemistryException {
if (null == peptideSequence) {
throw new NotationException("Peptide Sequence must be specified");
}
i... | [
"public",
"static",
"List",
"<",
"String",
">",
"getAminoAcidList",
"(",
"String",
"peptideSequence",
",",
"String",
"delimiter",
")",
"throws",
"MonomerException",
",",
"NotationException",
",",
"MonomerLoadingException",
",",
"ChemistryException",
"{",
"if",
"(",
... | This method converts peptide sequence into a List of amino acid with
optional delimiter
@param peptideSequence input sequence
@param delimiter optional delimeter in the input sequence
@return list of amino acid
@throws MonomerException if monomer is not valid
@throws NotationException if notation is not valid
@throws ... | [
"This",
"method",
"converts",
"peptide",
"sequence",
"into",
"a",
"List",
"of",
"amino",
"acid",
"with",
"optional",
"delimiter"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/AminoAcidParser.java#L111-L140 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/AminoAcidParser.java | AminoAcidParser.cleanup | public static String cleanup(String sequence) {
String result = sequence.replaceAll("\\s", ""); // remove all white
// space
if (result.equals(result.toLowerCase())) {
result = result.toUpperCase();
}
return result;
} | java | public static String cleanup(String sequence) {
String result = sequence.replaceAll("\\s", ""); // remove all white
// space
if (result.equals(result.toLowerCase())) {
result = result.toUpperCase();
}
return result;
} | [
"public",
"static",
"String",
"cleanup",
"(",
"String",
"sequence",
")",
"{",
"String",
"result",
"=",
"sequence",
".",
"replaceAll",
"(",
"\"\\\\s\"",
",",
"\"\"",
")",
";",
"// remove all white\r",
"// space\r",
"if",
"(",
"result",
".",
"equals",
"(",
"re... | remove white space, and convert all lower case to upper case
@param sequence given sequence
@return cleaned sequence without withspace and all characters are in uppercase | [
"remove",
"white",
"space",
"and",
"convert",
"all",
"lower",
"case",
"to",
"upper",
"case"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/AminoAcidParser.java#L148-L155 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKHttpUtil.java | JKHttpUtil.downloadFile | public static void downloadFile(final String fileUrl, final String localFile) throws IOException {
final URL url = new URL(fileUrl);
final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
final byte[] data = JKIOUtil.readStream(connection.getInputStream());
JKIOUtil.writeBytesToFile(data... | java | public static void downloadFile(final String fileUrl, final String localFile) throws IOException {
final URL url = new URL(fileUrl);
final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
final byte[] data = JKIOUtil.readStream(connection.getInputStream());
JKIOUtil.writeBytesToFile(data... | [
"public",
"static",
"void",
"downloadFile",
"(",
"final",
"String",
"fileUrl",
",",
"final",
"String",
"localFile",
")",
"throws",
"IOException",
"{",
"final",
"URL",
"url",
"=",
"new",
"URL",
"(",
"fileUrl",
")",
";",
"final",
"HttpURLConnection",
"connection... | Download file.
@param fileUrl the file url
@param localFile the local file
@throws IOException Signals that an I/O exception has occurred. | [
"Download",
"file",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKHttpUtil.java#L68-L73 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKHttpUtil.java | JKHttpUtil.downloadFileToTemp | public static File downloadFileToTemp(final String fileUrl, final String ext) throws IOException {
final File file = File.createTempFile("jk-", ext);
JKHttpUtil.downloadFile(fileUrl, file.getAbsolutePath());
return file;
} | java | public static File downloadFileToTemp(final String fileUrl, final String ext) throws IOException {
final File file = File.createTempFile("jk-", ext);
JKHttpUtil.downloadFile(fileUrl, file.getAbsolutePath());
return file;
} | [
"public",
"static",
"File",
"downloadFileToTemp",
"(",
"final",
"String",
"fileUrl",
",",
"final",
"String",
"ext",
")",
"throws",
"IOException",
"{",
"final",
"File",
"file",
"=",
"File",
".",
"createTempFile",
"(",
"\"jk-\"",
",",
"ext",
")",
";",
"JKHttpU... | Download file to temp.
@param fileUrl the file url
@param ext the ext
@return the file
@throws IOException Signals that an I/O exception has occurred. | [
"Download",
"file",
"to",
"temp",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKHttpUtil.java#L83-L87 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKHttpUtil.java | JKHttpUtil.requestUrl | public static String requestUrl(final String url, final String method, final Properties header, final String body) {
try {
final URL siteUrl = new URL(url);
final HttpURLConnection connection = (HttpURLConnection) siteUrl.openConnection();
connection.setRequestMethod(method);
final Enumeration<?> keys = h... | java | public static String requestUrl(final String url, final String method, final Properties header, final String body) {
try {
final URL siteUrl = new URL(url);
final HttpURLConnection connection = (HttpURLConnection) siteUrl.openConnection();
connection.setRequestMethod(method);
final Enumeration<?> keys = h... | [
"public",
"static",
"String",
"requestUrl",
"(",
"final",
"String",
"url",
",",
"final",
"String",
"method",
",",
"final",
"Properties",
"header",
",",
"final",
"String",
"body",
")",
"{",
"try",
"{",
"final",
"URL",
"siteUrl",
"=",
"new",
"URL",
"(",
"u... | Send http request.
@param url the url
@param method the method
@param header the header
@param body the body
@return the string | [
"Send",
"http",
"request",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKHttpUtil.java#L98-L124 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKHttpUtil.java | JKHttpUtil.getUrlContents | public static String getUrlContents(String urlString) {
HttpURLConnection con = null;
try {
URL url = new URL(urlString);
con = (HttpURLConnection) url.openConnection();
con.connect();
InputStream inputStream = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(in... | java | public static String getUrlContents(String urlString) {
HttpURLConnection con = null;
try {
URL url = new URL(urlString);
con = (HttpURLConnection) url.openConnection();
con.connect();
InputStream inputStream = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(in... | [
"public",
"static",
"String",
"getUrlContents",
"(",
"String",
"urlString",
")",
"{",
"HttpURLConnection",
"con",
"=",
"null",
";",
"try",
"{",
"URL",
"url",
"=",
"new",
"URL",
"(",
"urlString",
")",
";",
"con",
"=",
"(",
"HttpURLConnection",
")",
"url",
... | Gets the url contents.
@param urlString the url string
@return the url contents | [
"Gets",
"the",
"url",
"contents",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKHttpUtil.java#L149-L174 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKHttpUtil.java | JKHttpUtil.getValueFromUrl | public static String getValueFromUrl(String url, String preText, int length) {
String urlContents = getUrlContents(url);
int indexOf = urlContents.indexOf(preText);
if (indexOf != -1) {
indexOf += preText.length();
String substring = urlContents.substring(indexOf, indexOf + length);
return substring;
}... | java | public static String getValueFromUrl(String url, String preText, int length) {
String urlContents = getUrlContents(url);
int indexOf = urlContents.indexOf(preText);
if (indexOf != -1) {
indexOf += preText.length();
String substring = urlContents.substring(indexOf, indexOf + length);
return substring;
}... | [
"public",
"static",
"String",
"getValueFromUrl",
"(",
"String",
"url",
",",
"String",
"preText",
",",
"int",
"length",
")",
"{",
"String",
"urlContents",
"=",
"getUrlContents",
"(",
"url",
")",
";",
"int",
"indexOf",
"=",
"urlContents",
".",
"indexOf",
"(",
... | Gets the value from url based on pre-text value from the response.
@param url the url
@param preText the pre text
@param length the length
@return the value from url | [
"Gets",
"the",
"value",
"from",
"url",
"based",
"on",
"pre",
"-",
"text",
"value",
"from",
"the",
"response",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKHttpUtil.java#L184-L193 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKHttpUtil.java | JKHttpUtil.getUrlInputStream | public static InputStream getUrlInputStream(String urlString) {
URL url;
try {
url = new URL(urlString);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.connect();
return con.getInputStream();
} catch (Exception e) {
throw new JKException(e);
}
} | java | public static InputStream getUrlInputStream(String urlString) {
URL url;
try {
url = new URL(urlString);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.connect();
return con.getInputStream();
} catch (Exception e) {
throw new JKException(e);
}
} | [
"public",
"static",
"InputStream",
"getUrlInputStream",
"(",
"String",
"urlString",
")",
"{",
"URL",
"url",
";",
"try",
"{",
"url",
"=",
"new",
"URL",
"(",
"urlString",
")",
";",
"HttpURLConnection",
"con",
"=",
"(",
"HttpURLConnection",
")",
"url",
".",
"... | Gets the url input stream.
@param urlString the url string
@return the url input stream | [
"Gets",
"the",
"url",
"input",
"stream",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKHttpUtil.java#L201-L211 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKHttpUtil.java | JKHttpUtil.readUrlAsObject | public static <T> T readUrlAsObject(String url, Class<T> type) {
String contents = getUrlContents(url);
ObjectMapper mapper = new ObjectMapper();
mapper.enableDefaultTyping();
try {
return mapper.readValue(contents, type);
} catch (IOException e) {
JK.throww(e);
return null;
}
} | java | public static <T> T readUrlAsObject(String url, Class<T> type) {
String contents = getUrlContents(url);
ObjectMapper mapper = new ObjectMapper();
mapper.enableDefaultTyping();
try {
return mapper.readValue(contents, type);
} catch (IOException e) {
JK.throww(e);
return null;
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"readUrlAsObject",
"(",
"String",
"url",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"String",
"contents",
"=",
"getUrlContents",
"(",
"url",
")",
";",
"ObjectMapper",
"mapper",
"=",
"new",
"ObjectMapper",
"(",
... | Read the given url contents, and try to create an object from the given type.
@param <T> the generic type
@param url the url
@param type the type
@return the t | [
"Read",
"the",
"given",
"url",
"contents",
"and",
"try",
"to",
"create",
"an",
"object",
"from",
"the",
"given",
"type",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKHttpUtil.java#L221-L232 | train |
kiswanij/jk-util | src/main/java/com/jk/util/security/JKSecurityUtil.java | JKSecurityUtil.createPassword | public static Password createPassword(char[] password) {
byte[] salt = JKSecurityUtil.salt();
byte[] hash = JKSecurityUtil.hash(password, salt);
Password pass = new Password();
pass.setHash(encodeInToBase64(hash));
pass.setSalt(encodeInToBase64(salt));
return pass;
} | java | public static Password createPassword(char[] password) {
byte[] salt = JKSecurityUtil.salt();
byte[] hash = JKSecurityUtil.hash(password, salt);
Password pass = new Password();
pass.setHash(encodeInToBase64(hash));
pass.setSalt(encodeInToBase64(salt));
return pass;
} | [
"public",
"static",
"Password",
"createPassword",
"(",
"char",
"[",
"]",
"password",
")",
"{",
"byte",
"[",
"]",
"salt",
"=",
"JKSecurityUtil",
".",
"salt",
"(",
")",
";",
"byte",
"[",
"]",
"hash",
"=",
"JKSecurityUtil",
".",
"hash",
"(",
"password",
"... | Encrypt password.
@param text the text
@return the string | [
"Encrypt",
"password",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/security/JKSecurityUtil.java#L247-L255 | train |
kiswanij/jk-util | src/main/java/com/jk/util/datatypes/JKType.java | JKType.getJavaType | public Class<?> getJavaType() {
if(javaType==null) {
javaType=JKTypeMapping.getType(getCode()).getClass();
if(javaType==null) {
JK.error("JKType cannot by null, and code not avaiable %s",code);
}
}
return javaType;
} | java | public Class<?> getJavaType() {
if(javaType==null) {
javaType=JKTypeMapping.getType(getCode()).getClass();
if(javaType==null) {
JK.error("JKType cannot by null, and code not avaiable %s",code);
}
}
return javaType;
} | [
"public",
"Class",
"<",
"?",
">",
"getJavaType",
"(",
")",
"{",
"if",
"(",
"javaType",
"==",
"null",
")",
"{",
"javaType",
"=",
"JKTypeMapping",
".",
"getType",
"(",
"getCode",
"(",
")",
")",
".",
"getClass",
"(",
")",
";",
"if",
"(",
"javaType",
"... | Gets the java type.
@return the java type | [
"Gets",
"the",
"java",
"type",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/datatypes/JKType.java#L119-L127 | train |
kiswanij/jk-util | src/main/java/com/jk/util/datatypes/JKType.java | JKType.getName | public String getName() {
if (name == null) {
name = JKMessage.get(getJavaType().getSimpleName());
}
return name;
} | java | public String getName() {
if (name == null) {
name = JKMessage.get(getJavaType().getSimpleName());
}
return name;
} | [
"public",
"String",
"getName",
"(",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"name",
"=",
"JKMessage",
".",
"get",
"(",
"getJavaType",
"(",
")",
".",
"getSimpleName",
"(",
")",
")",
";",
"}",
"return",
"name",
";",
"}"
] | Gets the name.
@return the name | [
"Gets",
"the",
"name",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/datatypes/JKType.java#L143-L148 | train |
kiswanij/jk-util | src/main/java/com/jk/util/time/JKTimeObject.java | JKTimeObject.toTimeObject | public JKTimeObject toTimeObject(Date date, Date time) {
JKTimeObject fsTimeObject = new JKTimeObject();
Calendar timeInstance = Calendar.getInstance();
timeInstance.setTimeInMillis(time.getTime());
fsTimeObject.setHour(timeInstance.get(Calendar.HOUR_OF_DAY));
fsTimeObject.setMunite(timeInstance.get(Calendar.... | java | public JKTimeObject toTimeObject(Date date, Date time) {
JKTimeObject fsTimeObject = new JKTimeObject();
Calendar timeInstance = Calendar.getInstance();
timeInstance.setTimeInMillis(time.getTime());
fsTimeObject.setHour(timeInstance.get(Calendar.HOUR_OF_DAY));
fsTimeObject.setMunite(timeInstance.get(Calendar.... | [
"public",
"JKTimeObject",
"toTimeObject",
"(",
"Date",
"date",
",",
"Date",
"time",
")",
"{",
"JKTimeObject",
"fsTimeObject",
"=",
"new",
"JKTimeObject",
"(",
")",
";",
"Calendar",
"timeInstance",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"timeInstan... | To time object.
@param date the date
@param time the time
@return the JK time object | [
"To",
"time",
"object",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/time/JKTimeObject.java#L95-L108 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/BuilderMolecule.java | BuilderMolecule.buildMoleculefromSinglePolymer | public static RgroupStructure buildMoleculefromSinglePolymer(final PolymerNotation polymernotation) throws BuilderMoleculeException, HELM2HandledException, ChemistryException {
LOG.info("Build molecule for single Polymer " + polymernotation.getPolymerID().getId());
/* Case 1: BLOB -> throw exception */
i... | java | public static RgroupStructure buildMoleculefromSinglePolymer(final PolymerNotation polymernotation) throws BuilderMoleculeException, HELM2HandledException, ChemistryException {
LOG.info("Build molecule for single Polymer " + polymernotation.getPolymerID().getId());
/* Case 1: BLOB -> throw exception */
i... | [
"public",
"static",
"RgroupStructure",
"buildMoleculefromSinglePolymer",
"(",
"final",
"PolymerNotation",
"polymernotation",
")",
"throws",
"BuilderMoleculeException",
",",
"HELM2HandledException",
",",
"ChemistryException",
"{",
"LOG",
".",
"info",
"(",
"\"Build molecule for... | method to build a molecule for a single polymer
@param polymernotation a single polymer
@return molecule for the given single polymer
@throws BuilderMoleculeException if the polymer type is BLOB or unknown
@throws HELM2HandledException if the polymer contains HELM2 features
@throws ChemistryException if the Chemistry ... | [
"method",
"to",
"build",
"a",
"molecule",
"for",
"a",
"single",
"polymer"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/BuilderMolecule.java#L83-L101 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/BuilderMolecule.java | BuilderMolecule.buildMoleculefromCHEM | private static RgroupStructure buildMoleculefromCHEM(final String id, final List<Monomer> validMonomers) throws BuilderMoleculeException, ChemistryException {
LOG.info("Build molecule for chemical component");
/* a chemical molecule should only contain one monomer */
if (validMonomers.size() == 1) {
... | java | private static RgroupStructure buildMoleculefromCHEM(final String id, final List<Monomer> validMonomers) throws BuilderMoleculeException, ChemistryException {
LOG.info("Build molecule for chemical component");
/* a chemical molecule should only contain one monomer */
if (validMonomers.size() == 1) {
... | [
"private",
"static",
"RgroupStructure",
"buildMoleculefromCHEM",
"(",
"final",
"String",
"id",
",",
"final",
"List",
"<",
"Monomer",
">",
"validMonomers",
")",
"throws",
"BuilderMoleculeException",
",",
"ChemistryException",
"{",
"LOG",
".",
"info",
"(",
"\"Build mo... | method to build a molecule from a chemical component
@param validMonomers all valid monomers of the chemical component
@return Built Molecule
@throws BuilderMoleculeException if the polymer contains more than one
monomer or if the molecule can't be built
@throws ChemistryException if the Chemistry Engine can not be in... | [
"method",
"to",
"build",
"a",
"molecule",
"from",
"a",
"chemical",
"component"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/BuilderMolecule.java#L261-L297 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/BuilderMolecule.java | BuilderMolecule.generateAttachmentList | private static AttachmentList generateAttachmentList(final List<Attachment> listAttachments) {
AttachmentList list = new AttachmentList();
for (Attachment attachment : listAttachments) {
list.add(new org.helm.chemtoolkit.Attachment(attachment.getAlternateId(), attachment.getLabel(), attachment.getCap... | java | private static AttachmentList generateAttachmentList(final List<Attachment> listAttachments) {
AttachmentList list = new AttachmentList();
for (Attachment attachment : listAttachments) {
list.add(new org.helm.chemtoolkit.Attachment(attachment.getAlternateId(), attachment.getLabel(), attachment.getCap... | [
"private",
"static",
"AttachmentList",
"generateAttachmentList",
"(",
"final",
"List",
"<",
"Attachment",
">",
"listAttachments",
")",
"{",
"AttachmentList",
"list",
"=",
"new",
"AttachmentList",
"(",
")",
";",
"for",
"(",
"Attachment",
"attachment",
":",
"listAtt... | method to generate the AttachmentList given a list of attachments
@param listAttachments input list of Attachments
@return AttachmentList generated AttachmentList | [
"method",
"to",
"generate",
"the",
"AttachmentList",
"given",
"a",
"list",
"of",
"attachments"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/BuilderMolecule.java#L414-L421 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/BuilderMolecule.java | BuilderMolecule.mergeRgroups | public static AbstractMolecule mergeRgroups(AbstractMolecule molecule) throws BuilderMoleculeException, ChemistryException {
try {
boolean flag = true;
// while (flag) {
// if (molecule.getAttachments().size() > 0) {
for (int i = molecule.getAttachments().size() - 1; i > -1; i--) {
... | java | public static AbstractMolecule mergeRgroups(AbstractMolecule molecule) throws BuilderMoleculeException, ChemistryException {
try {
boolean flag = true;
// while (flag) {
// if (molecule.getAttachments().size() > 0) {
for (int i = molecule.getAttachments().size() - 1; i > -1; i--) {
... | [
"public",
"static",
"AbstractMolecule",
"mergeRgroups",
"(",
"AbstractMolecule",
"molecule",
")",
"throws",
"BuilderMoleculeException",
",",
"ChemistryException",
"{",
"try",
"{",
"boolean",
"flag",
"=",
"true",
";",
"// while (flag) {\r",
"// if (molecule.getAttachments().... | method to merge all unused rgroups into a molecule
@param molecule input molecule
@return molecule with all merged unused rgroups
@throws BuilderMoleculeException if the molecule can't be built
@throws ChemistryException if the Chemistry Engine ca not be initialized | [
"method",
"to",
"merge",
"all",
"unused",
"rgroups",
"into",
"a",
"molecule"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/BuilderMolecule.java#L431-L446 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/BuilderMolecule.java | BuilderMolecule.getMoleculeForMonomer | public static AbstractMolecule getMoleculeForMonomer(final Monomer monomer) throws BuilderMoleculeException, ChemistryException {
String input = getInput(monomer);
if (input != null) {
List<Attachment> listAttachments = monomer.getAttachmentList();
AttachmentList list = new AttachmentList();
... | java | public static AbstractMolecule getMoleculeForMonomer(final Monomer monomer) throws BuilderMoleculeException, ChemistryException {
String input = getInput(monomer);
if (input != null) {
List<Attachment> listAttachments = monomer.getAttachmentList();
AttachmentList list = new AttachmentList();
... | [
"public",
"static",
"AbstractMolecule",
"getMoleculeForMonomer",
"(",
"final",
"Monomer",
"monomer",
")",
"throws",
"BuilderMoleculeException",
",",
"ChemistryException",
"{",
"String",
"input",
"=",
"getInput",
"(",
"monomer",
")",
";",
"if",
"(",
"input",
"!=",
... | method to build a molecule for a given monomer
@param monomer input monomer
@return generated molecule for the given monomer
@throws BuilderMoleculeException if the monomer can't be built
@throws ChemistryException if the Chemistry Engine can not be initialized | [
"method",
"to",
"build",
"a",
"molecule",
"for",
"a",
"given",
"monomer"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/BuilderMolecule.java#L456-L472 | train |
kiswanij/jk-util | src/main/java/com/jk/util/mime/MagicMimeEntry.java | MagicMimeEntry.addEntry | void addEntry(final String aLine) {
final String trimmed = aLine.replaceAll("^>*", "");
String[] tokens = trimmed.split("\t");
// Now strip the empty entries
final Vector<String> v = new Vector<String>();
for (int i = 0; i < tokens.length; i++) {
if (!"".equals(tokens[i])) {
v.add(tokens[i]);
}
}... | java | void addEntry(final String aLine) {
final String trimmed = aLine.replaceAll("^>*", "");
String[] tokens = trimmed.split("\t");
// Now strip the empty entries
final Vector<String> v = new Vector<String>();
for (int i = 0; i < tokens.length; i++) {
if (!"".equals(tokens[i])) {
v.add(tokens[i]);
}
}... | [
"void",
"addEntry",
"(",
"final",
"String",
"aLine",
")",
"{",
"final",
"String",
"trimmed",
"=",
"aLine",
".",
"replaceAll",
"(",
"\"^>*\"",
",",
"\"\"",
")",
";",
"String",
"[",
"]",
"tokens",
"=",
"trimmed",
".",
"split",
"(",
"\"\\t\"",
")",
";",
... | as much of the file as possible. Currently about 70 entries are incorrect | [
"as",
"much",
"of",
"the",
"file",
"as",
"possible",
".",
"Currently",
"about",
"70",
"entries",
"are",
"incorrect"
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/mime/MagicMimeEntry.java#L253-L297 | train |
kiswanij/jk-util | src/main/java/com/jk/util/mime/MagicMimeEntry.java | MagicMimeEntry.getMatch | public String getMatch(final byte[] content) throws IOException {
final ByteBuffer buf = readBuffer(content);
if (buf == null) {
return null;
}
buf.position(0);
final boolean matches = match(buf);
if (matches) {
final int subLen = this.subEntries.size();
final String myMimeType = getMimeType();
... | java | public String getMatch(final byte[] content) throws IOException {
final ByteBuffer buf = readBuffer(content);
if (buf == null) {
return null;
}
buf.position(0);
final boolean matches = match(buf);
if (matches) {
final int subLen = this.subEntries.size();
final String myMimeType = getMimeType();
... | [
"public",
"String",
"getMatch",
"(",
"final",
"byte",
"[",
"]",
"content",
")",
"throws",
"IOException",
"{",
"final",
"ByteBuffer",
"buf",
"=",
"readBuffer",
"(",
"content",
")",
";",
"if",
"(",
"buf",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}... | Gets the match.
@param content the content
@return the match
@throws IOException Signals that an I/O exception has occurred. | [
"Gets",
"the",
"match",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/mime/MagicMimeEntry.java#L324-L352 | train |
kiswanij/jk-util | src/main/java/com/jk/util/mime/MagicMimeEntry.java | MagicMimeEntry.howManyGreaterThans | private int howManyGreaterThans(final String aLine) {
if (aLine == null) {
return -1;
}
int i = 0;
final int len = aLine.length();
while (i < len) {
if (aLine.charAt(i) == '>') {
i++;
} else {
break;
}
}
return i;
} | java | private int howManyGreaterThans(final String aLine) {
if (aLine == null) {
return -1;
}
int i = 0;
final int len = aLine.length();
while (i < len) {
if (aLine.charAt(i) == '>') {
i++;
} else {
break;
}
}
return i;
} | [
"private",
"int",
"howManyGreaterThans",
"(",
"final",
"String",
"aLine",
")",
"{",
"if",
"(",
"aLine",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"int",
"i",
"=",
"0",
";",
"final",
"int",
"len",
"=",
"aLine",
".",
"length",
"(",
")",
... | How many greater thans.
@param aLine the a line
@return the int | [
"How",
"many",
"greater",
"thans",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/mime/MagicMimeEntry.java#L404-L418 | train |
kiswanij/jk-util | src/main/java/com/jk/util/mime/MagicMimeEntry.java | MagicMimeEntry.matchByte | private boolean matchByte(final ByteBuffer bbuf) throws IOException {
final byte b = bbuf.get(0);
return b == getContent().charAt(0);
} | java | private boolean matchByte(final ByteBuffer bbuf) throws IOException {
final byte b = bbuf.get(0);
return b == getContent().charAt(0);
} | [
"private",
"boolean",
"matchByte",
"(",
"final",
"ByteBuffer",
"bbuf",
")",
"throws",
"IOException",
"{",
"final",
"byte",
"b",
"=",
"bbuf",
".",
"get",
"(",
"0",
")",
";",
"return",
"b",
"==",
"getContent",
"(",
")",
".",
"charAt",
"(",
"0",
")",
";... | Match byte.
@param bbuf the bbuf
@return true, if successful
@throws IOException Signals that an I/O exception has occurred. | [
"Match",
"byte",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/mime/MagicMimeEntry.java#L541-L544 | train |
kiswanij/jk-util | src/main/java/com/jk/util/mime/MagicMimeEntry.java | MagicMimeEntry.matchLong | private boolean matchLong(final ByteBuffer bbuf, final ByteOrder bo, final boolean needMask, final long lMask) throws IOException {
bbuf.order(bo);
long got;
final String testContent = getContent();
if (testContent.startsWith("0x")) {
got = Long.parseLong(testContent.substring(2), 16);
} else if (testConte... | java | private boolean matchLong(final ByteBuffer bbuf, final ByteOrder bo, final boolean needMask, final long lMask) throws IOException {
bbuf.order(bo);
long got;
final String testContent = getContent();
if (testContent.startsWith("0x")) {
got = Long.parseLong(testContent.substring(2), 16);
} else if (testConte... | [
"private",
"boolean",
"matchLong",
"(",
"final",
"ByteBuffer",
"bbuf",
",",
"final",
"ByteOrder",
"bo",
",",
"final",
"boolean",
"needMask",
",",
"final",
"long",
"lMask",
")",
"throws",
"IOException",
"{",
"bbuf",
".",
"order",
"(",
"bo",
")",
";",
"long"... | Match long.
@param bbuf the bbuf
@param bo the bo
@param needMask the need mask
@param lMask the l mask
@return true, if successful
@throws IOException Signals that an I/O exception has occurred. | [
"Match",
"long",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/mime/MagicMimeEntry.java#L556-L579 | train |
kiswanij/jk-util | src/main/java/com/jk/util/mime/MagicMimeEntry.java | MagicMimeEntry.matchShort | private boolean matchShort(final ByteBuffer bbuf, final ByteOrder bo, final boolean needMask, final short sMask) throws IOException {
bbuf.order(bo);
short got;
final String testContent = getContent();
if (testContent.startsWith("0x")) {
got = (short) Integer.parseInt(testContent.substring(2), 16);
} else ... | java | private boolean matchShort(final ByteBuffer bbuf, final ByteOrder bo, final boolean needMask, final short sMask) throws IOException {
bbuf.order(bo);
short got;
final String testContent = getContent();
if (testContent.startsWith("0x")) {
got = (short) Integer.parseInt(testContent.substring(2), 16);
} else ... | [
"private",
"boolean",
"matchShort",
"(",
"final",
"ByteBuffer",
"bbuf",
",",
"final",
"ByteOrder",
"bo",
",",
"final",
"boolean",
"needMask",
",",
"final",
"short",
"sMask",
")",
"throws",
"IOException",
"{",
"bbuf",
".",
"order",
"(",
"bo",
")",
";",
"sho... | Match short.
@param bbuf the bbuf
@param bo the bo
@param needMask the need mask
@param sMask the s mask
@return true, if successful
@throws IOException Signals that an I/O exception has occurred. | [
"Match",
"short",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/mime/MagicMimeEntry.java#L595-L618 | train |
kiswanij/jk-util | src/main/java/com/jk/util/mime/MagicMimeEntry.java | MagicMimeEntry.matchString | private boolean matchString(final ByteBuffer bbuf) throws IOException {
if (this.isBetween) {
final String buffer = new String(bbuf.array());
if (buffer.contains(getContent())) {
return true;
}
return false;
}
final int read = getContent().length();
for (int j = 0; j < read; j++) {
if ((bbuf.... | java | private boolean matchString(final ByteBuffer bbuf) throws IOException {
if (this.isBetween) {
final String buffer = new String(bbuf.array());
if (buffer.contains(getContent())) {
return true;
}
return false;
}
final int read = getContent().length();
for (int j = 0; j < read; j++) {
if ((bbuf.... | [
"private",
"boolean",
"matchString",
"(",
"final",
"ByteBuffer",
"bbuf",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"isBetween",
")",
"{",
"final",
"String",
"buffer",
"=",
"new",
"String",
"(",
"bbuf",
".",
"array",
"(",
")",
")",
";",
... | Match string.
@param bbuf the bbuf
@return true, if successful
@throws IOException Signals that an I/O exception has occurred. | [
"Match",
"string",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/mime/MagicMimeEntry.java#L627-L642 | train |
kiswanij/jk-util | src/main/java/com/jk/util/mime/MagicMimeEntry.java | MagicMimeEntry.readBuffer | @SuppressWarnings("unused")
private ByteBuffer readBuffer(final RandomAccessFile raf) throws IOException {
final int startPos = getCheckBytesFrom();
if (startPos > raf.length()) {
return null;
}
raf.seek(startPos);
ByteBuffer buf;
switch (getType()) {
case MagicMimeEntry.STRING_TYPE: {
int len = 0;... | java | @SuppressWarnings("unused")
private ByteBuffer readBuffer(final RandomAccessFile raf) throws IOException {
final int startPos = getCheckBytesFrom();
if (startPos > raf.length()) {
return null;
}
raf.seek(startPos);
ByteBuffer buf;
switch (getType()) {
case MagicMimeEntry.STRING_TYPE: {
int len = 0;... | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"private",
"ByteBuffer",
"readBuffer",
"(",
"final",
"RandomAccessFile",
"raf",
")",
"throws",
"IOException",
"{",
"final",
"int",
"startPos",
"=",
"getCheckBytesFrom",
"(",
")",
";",
"if",
"(",
"startPos",
">",
... | Read buffer.
@param raf the raf
@return the byte buffer
@throws IOException Signals that an I/O exception has occurred. | [
"Read",
"buffer",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/mime/MagicMimeEntry.java#L704-L754 | train |
kiswanij/jk-util | src/main/java/com/jk/util/mime/MagicMimeEntry.java | MagicMimeEntry.traverseAndPrint | public void traverseAndPrint(final String tabs) {
logger.info(tabs + toString());
final int len = this.subEntries.size();
for (int i = 0; i < len; i++) {
final MagicMimeEntry me = this.subEntries.get(i);
me.traverseAndPrint(tabs + "\t");
}
} | java | public void traverseAndPrint(final String tabs) {
logger.info(tabs + toString());
final int len = this.subEntries.size();
for (int i = 0; i < len; i++) {
final MagicMimeEntry me = this.subEntries.get(i);
me.traverseAndPrint(tabs + "\t");
}
} | [
"public",
"void",
"traverseAndPrint",
"(",
"final",
"String",
"tabs",
")",
"{",
"logger",
".",
"info",
"(",
"tabs",
"+",
"toString",
"(",
")",
")",
";",
"final",
"int",
"len",
"=",
"this",
".",
"subEntries",
".",
"size",
"(",
")",
";",
"for",
"(",
... | Traverse and print.
@param tabs the tabs | [
"Traverse",
"and",
"print",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/mime/MagicMimeEntry.java#L771-L778 | train |
kiswanij/jk-util | src/main/java/com/jk/util/model/table/JKTableRecord.java | JKTableRecord.addEmptyValue | public void addEmptyValue(final JKTableColumn col) {
final JKTableColumnValue value = new JKTableColumnValue(col);
this.columnsValues.add(value);
} | java | public void addEmptyValue(final JKTableColumn col) {
final JKTableColumnValue value = new JKTableColumnValue(col);
this.columnsValues.add(value);
} | [
"public",
"void",
"addEmptyValue",
"(",
"final",
"JKTableColumn",
"col",
")",
"{",
"final",
"JKTableColumnValue",
"value",
"=",
"new",
"JKTableColumnValue",
"(",
"col",
")",
";",
"this",
".",
"columnsValues",
".",
"add",
"(",
"value",
")",
";",
"}"
] | Adds the empty value.
@param col the col | [
"Adds",
"the",
"empty",
"value",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/model/table/JKTableRecord.java#L61-L64 | train |
kiswanij/jk-util | src/main/java/com/jk/util/model/table/JKTableRecord.java | JKTableRecord.getColumnValueAsDouble | public Double getColumnValueAsDouble(final int col, final double defaultValue) {
Double value = getColumnValueAsDouble(col);
if (value == null) {
value = defaultValue;
}
return value;
} | java | public Double getColumnValueAsDouble(final int col, final double defaultValue) {
Double value = getColumnValueAsDouble(col);
if (value == null) {
value = defaultValue;
}
return value;
} | [
"public",
"Double",
"getColumnValueAsDouble",
"(",
"final",
"int",
"col",
",",
"final",
"double",
"defaultValue",
")",
"{",
"Double",
"value",
"=",
"getColumnValueAsDouble",
"(",
"col",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"value",
"=",
"d... | Gets the column value as double.
@param col the col
@param defaultValue the default value
@return the column value as double | [
"Gets",
"the",
"column",
"value",
"as",
"double",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/model/table/JKTableRecord.java#L184-L190 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/SMILES.java | SMILES.getSMILESForAll | public static String getSMILESForAll(HELM2Notation helm2notation)
throws BuilderMoleculeException, CTKException, ChemistryException {
/* Build Molecues */
LOG.debug("Build single molecule(s)");
List<AbstractMolecule> molecules = BuilderMolecule.buildMoleculefromPolymers(helm2notation.getListOfPolymers(),
... | java | public static String getSMILESForAll(HELM2Notation helm2notation)
throws BuilderMoleculeException, CTKException, ChemistryException {
/* Build Molecues */
LOG.debug("Build single molecule(s)");
List<AbstractMolecule> molecules = BuilderMolecule.buildMoleculefromPolymers(helm2notation.getListOfPolymers(),
... | [
"public",
"static",
"String",
"getSMILESForAll",
"(",
"HELM2Notation",
"helm2notation",
")",
"throws",
"BuilderMoleculeException",
",",
"CTKException",
",",
"ChemistryException",
"{",
"/* Build Molecues */",
"LOG",
".",
"debug",
"(",
"\"Build single molecule(s)\"",
")",
"... | method to generate smiles for the whole HELMNotation
@param helm2notation
input HELMNotation
@return smiles for the whole HELMNotation
@throws BuilderMoleculeException
if the molecule can't be built
@throws CTKException
general ChemToolKit exception passed to HELMToolKit
@throws ChemistryException
if the Chemistry Eng... | [
"method",
"to",
"generate",
"smiles",
"for",
"the",
"whole",
"HELMNotation"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/SMILES.java#L74-L91 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/SMILES.java | SMILES.containsGenericStructurePolymer | public static boolean containsGenericStructurePolymer(List<PolymerNotation> polymers)
throws HELM2HandledException, ChemistryException, IOException, CTKException {
for (PolymerNotation polymer : polymers) {
if (polymer.getPolymerID() instanceof ChemEntity) {
Monomer monomer = MethodsMonomerUtils
... | java | public static boolean containsGenericStructurePolymer(List<PolymerNotation> polymers)
throws HELM2HandledException, ChemistryException, IOException, CTKException {
for (PolymerNotation polymer : polymers) {
if (polymer.getPolymerID() instanceof ChemEntity) {
Monomer monomer = MethodsMonomerUtils
... | [
"public",
"static",
"boolean",
"containsGenericStructurePolymer",
"(",
"List",
"<",
"PolymerNotation",
">",
"polymers",
")",
"throws",
"HELM2HandledException",
",",
"ChemistryException",
",",
"IOException",
",",
"CTKException",
"{",
"for",
"(",
"PolymerNotation",
"polym... | method if the any of the given PolymerNotation contains generic
structures
@param polymers
list of polymernotations
@return true, if it contains generic structure, false otherwise
@throws HELM2HandledException
if it contains HELM2 specific features, so that it can not be
casted to HELM1 Format
@throws ChemistryExcepti... | [
"method",
"if",
"the",
"any",
"of",
"the",
"given",
"PolymerNotation",
"contains",
"generic",
"structures"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/SMILES.java#L144-L163 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/SMILES.java | SMILES.getCanonicalSMILESForPolymer | public static String getCanonicalSMILESForPolymer(PolymerNotation polymer) throws BuilderMoleculeException,
HELM2HandledException, CTKSmilesException, CTKException, NotationException, ChemistryException {
AbstractMolecule molecule = BuilderMolecule.buildMoleculefromSinglePolymer(polymer).getMolecule();
molecu... | java | public static String getCanonicalSMILESForPolymer(PolymerNotation polymer) throws BuilderMoleculeException,
HELM2HandledException, CTKSmilesException, CTKException, NotationException, ChemistryException {
AbstractMolecule molecule = BuilderMolecule.buildMoleculefromSinglePolymer(polymer).getMolecule();
molecu... | [
"public",
"static",
"String",
"getCanonicalSMILESForPolymer",
"(",
"PolymerNotation",
"polymer",
")",
"throws",
"BuilderMoleculeException",
",",
"HELM2HandledException",
",",
"CTKSmilesException",
",",
"CTKException",
",",
"NotationException",
",",
"ChemistryException",
"{",
... | method to generate canonical smiles for one single PolymerNotation
@param polymer
PolymerNotation
@return smiles for the sinlge given PolymerNotation
@throws BuilderMoleculeException
if the molecule can't be built
@throws HELM2HandledException
if it contains HELM2 specific features, so that it can not be
casted to HEL... | [
"method",
"to",
"generate",
"canonical",
"smiles",
"for",
"one",
"single",
"PolymerNotation"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/SMILES.java#L194-L201 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/SMILES.java | SMILES.convertMolToSMILESWithAtomMapping | public static String convertMolToSMILESWithAtomMapping(String molfile, List<Attachment> attachments)
throws CTKException, ChemistryException {
String smiles = Chemistry.getInstance().getManipulator().convertMolIntoSmilesWithAtomMapping(molfile);
for (Attachment attachment : attachments) {
int r = Inte... | java | public static String convertMolToSMILESWithAtomMapping(String molfile, List<Attachment> attachments)
throws CTKException, ChemistryException {
String smiles = Chemistry.getInstance().getManipulator().convertMolIntoSmilesWithAtomMapping(molfile);
for (Attachment attachment : attachments) {
int r = Inte... | [
"public",
"static",
"String",
"convertMolToSMILESWithAtomMapping",
"(",
"String",
"molfile",
",",
"List",
"<",
"Attachment",
">",
"attachments",
")",
"throws",
"CTKException",
",",
"ChemistryException",
"{",
"String",
"smiles",
"=",
"Chemistry",
".",
"getInstance",
... | Converts molfile with the given attachments in smiles with atom mapping
@param molfile
given molfile
@param attachments
given attachments of the molfile
@return smiles with atom mapping
@throws CTKException
if the molfile can not be converted to smiles
@throws ChemistryException
if the Chemistry Engine can not be init... | [
"Converts",
"molfile",
"with",
"the",
"given",
"attachments",
"in",
"smiles",
"with",
"atom",
"mapping"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/SMILES.java#L245-L257 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/SMILES.java | SMILES.isConnected | public static boolean isConnected(String molfile) throws CTKException, ChemistryException {
return Chemistry.getInstance().getManipulator().isConnected(molfile);
} | java | public static boolean isConnected(String molfile) throws CTKException, ChemistryException {
return Chemistry.getInstance().getManipulator().isConnected(molfile);
} | [
"public",
"static",
"boolean",
"isConnected",
"(",
"String",
"molfile",
")",
"throws",
"CTKException",
",",
"ChemistryException",
"{",
"return",
"Chemistry",
".",
"getInstance",
"(",
")",
".",
"getManipulator",
"(",
")",
".",
"isConnected",
"(",
"molfile",
")",
... | returns if structure is connected
@param molfile
@return boolean if structure is connected
@throws CTKException
@throws ChemistryException | [
"returns",
"if",
"structure",
"is",
"connected"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/SMILES.java#L267-L269 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/wsadapter/WSAdapterUtils.java | WSAdapterUtils.putResource | protected static CloseableHttpResponse putResource(String json, String fullURL) throws ClientProtocolException,
IOException, URISyntaxException {
try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
// There is no need to provide user credentials
// HttpClient will attempt to a... | java | protected static CloseableHttpResponse putResource(String json, String fullURL) throws ClientProtocolException,
IOException, URISyntaxException {
try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
// There is no need to provide user credentials
// HttpClient will attempt to a... | [
"protected",
"static",
"CloseableHttpResponse",
"putResource",
"(",
"String",
"json",
",",
"String",
"fullURL",
")",
"throws",
"ClientProtocolException",
",",
"IOException",
",",
"URISyntaxException",
"{",
"try",
"(",
"CloseableHttpClient",
"httpclient",
"=",
"HttpClien... | Calls a PUT routine with given JSON on given resource URL.
@param json the input JSON
@param fullURL the resource URL
@return Response
@throws ClientProtocolException if an error exists in the HTTP protocol
@throws IOException IO Error
@throws URISyntaxException url is not valid | [
"Calls",
"a",
"PUT",
"routine",
"with",
"given",
"JSON",
"on",
"given",
"resource",
"URL",
"."
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/wsadapter/WSAdapterUtils.java#L46-L60 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/wsadapter/WSAdapterUtils.java | WSAdapterUtils.getResource | protected static CloseableHttpResponse getResource(String fullURL) throws IOException,
URISyntaxException {
URI uri = new URIBuilder(fullURL).build();
try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
/* read url */
HttpGet httpget = new HttpGet(uri);
LOG.debug... | java | protected static CloseableHttpResponse getResource(String fullURL) throws IOException,
URISyntaxException {
URI uri = new URIBuilder(fullURL).build();
try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
/* read url */
HttpGet httpget = new HttpGet(uri);
LOG.debug... | [
"protected",
"static",
"CloseableHttpResponse",
"getResource",
"(",
"String",
"fullURL",
")",
"throws",
"IOException",
",",
"URISyntaxException",
"{",
"URI",
"uri",
"=",
"new",
"URIBuilder",
"(",
"fullURL",
")",
".",
"build",
"(",
")",
";",
"try",
"(",
"Closea... | Call a GET routine on given resource URL.
@param fullURL the resource URL
@return Response
@throws IOException IO error
@throws URISyntaxException if url is not valid | [
"Call",
"a",
"GET",
"routine",
"on",
"given",
"resource",
"URL",
"."
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/wsadapter/WSAdapterUtils.java#L70-L82 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/xHelmNotationExporter.java | xHelmNotationExporter.getXHELM | public static String getXHELM(HELM2Notation helm2notation) throws MonomerException, HELM1FormatException,
IOException, JDOMException, NotationException, CTKException, ValidationException, ChemistryException {
set = new HashSet<Monomer>();
Element root = new Element(xHelmNotationExporter.XHELM_ELEMENT);... | java | public static String getXHELM(HELM2Notation helm2notation) throws MonomerException, HELM1FormatException,
IOException, JDOMException, NotationException, CTKException, ValidationException, ChemistryException {
set = new HashSet<Monomer>();
Element root = new Element(xHelmNotationExporter.XHELM_ELEMENT);... | [
"public",
"static",
"String",
"getXHELM",
"(",
"HELM2Notation",
"helm2notation",
")",
"throws",
"MonomerException",
",",
"HELM1FormatException",
",",
"IOException",
",",
"JDOMException",
",",
"NotationException",
",",
"CTKException",
",",
"ValidationException",
",",
"Ch... | method to get xhelm for the helm notation, only if it was possible to
convert the helm in the old format
@param helm2notation, HELM2Notation object
@return xhelm
@throws MonomerException if monomer is not valid
@throws HELM1FormatException if HELM input contains HELM2 features
@throws JDOMException jdome error
@throws... | [
"method",
"to",
"get",
"xhelm",
"for",
"the",
"helm",
"notation",
"only",
"if",
"it",
"was",
"possible",
"to",
"convert",
"the",
"helm",
"in",
"the",
"old",
"format"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/xHelmNotationExporter.java#L135-L175 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/xHelmNotationExporter.java | xHelmNotationExporter.addAdHocMonomer | private static void addAdHocMonomer(MonomerNotation monomerNotation) throws IOException, JDOMException, ChemistryException {
Monomer monomer = MonomerFactory.getInstance().getMonomerStore().getMonomer(monomerNotation.getType(), monomerNotation.getUnit().replace("[", "").replace("]", ""));
if (monomer.isAdHocM... | java | private static void addAdHocMonomer(MonomerNotation monomerNotation) throws IOException, JDOMException, ChemistryException {
Monomer monomer = MonomerFactory.getInstance().getMonomerStore().getMonomer(monomerNotation.getType(), monomerNotation.getUnit().replace("[", "").replace("]", ""));
if (monomer.isAdHocM... | [
"private",
"static",
"void",
"addAdHocMonomer",
"(",
"MonomerNotation",
"monomerNotation",
")",
"throws",
"IOException",
",",
"JDOMException",
",",
"ChemistryException",
"{",
"Monomer",
"monomer",
"=",
"MonomerFactory",
".",
"getInstance",
"(",
")",
".",
"getMonomerSt... | method to add the monomer to the database if it is an adhoc monomer
@param monomerNotation MonomerNotation
@throws JDOMException jdome error
@throws IOException IO error
@throws ChemistryException if chemistry engine can not be initialized
@throws CTKException general ChemToolKit exception passed to HELMToolKit | [
"method",
"to",
"add",
"the",
"monomer",
"to",
"the",
"database",
"if",
"it",
"is",
"an",
"adhoc",
"monomer"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/xHelmNotationExporter.java#L186-L192 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/wsadapter/MonomerWSLoader.java | MonomerWSLoader.deserializeAttachmentList | private List<Attachment> deserializeAttachmentList(JsonParser parser, Map<String, Attachment> attachmentDB)
throws JsonParseException, IOException {
List<Attachment> attachments = new ArrayList<Attachment>();
Attachment currentAttachment = null;
while (!JsonToken.END_ARRAY.equals(parser.nextToken())) {
... | java | private List<Attachment> deserializeAttachmentList(JsonParser parser, Map<String, Attachment> attachmentDB)
throws JsonParseException, IOException {
List<Attachment> attachments = new ArrayList<Attachment>();
Attachment currentAttachment = null;
while (!JsonToken.END_ARRAY.equals(parser.nextToken())) {
... | [
"private",
"List",
"<",
"Attachment",
">",
"deserializeAttachmentList",
"(",
"JsonParser",
"parser",
",",
"Map",
"<",
"String",
",",
"Attachment",
">",
"attachmentDB",
")",
"throws",
"JsonParseException",
",",
"IOException",
"{",
"List",
"<",
"Attachment",
">",
... | Private routine to deserialize a JSON containing attachment data. This is
done manually to give more freedom regarding data returned by the
webservice.
@param parser
the JSONParser containing JSONData.
@param attachmentDB
the attachments stored in the Toolkit
@return List containing attachments
@throws JsonParseExcep... | [
"Private",
"routine",
"to",
"deserialize",
"a",
"JSON",
"containing",
"attachment",
"data",
".",
"This",
"is",
"done",
"manually",
"to",
"give",
"more",
"freedom",
"regarding",
"data",
"returned",
"by",
"the",
"webservice",
"."
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/wsadapter/MonomerWSLoader.java#L307-L363 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/wsadapter/MonomerWSLoader.java | MonomerWSLoader.deserializeEditorCategorizationConfig | private static List<CategorizedMonomer> deserializeEditorCategorizationConfig(JsonParser parser)
throws JsonParseException, IOException {
List<CategorizedMonomer> config = new LinkedList<CategorizedMonomer>();
CategorizedMonomer currentMonomer = null;
parser.nextToken();
while (parser.hasCurrentToken(... | java | private static List<CategorizedMonomer> deserializeEditorCategorizationConfig(JsonParser parser)
throws JsonParseException, IOException {
List<CategorizedMonomer> config = new LinkedList<CategorizedMonomer>();
CategorizedMonomer currentMonomer = null;
parser.nextToken();
while (parser.hasCurrentToken(... | [
"private",
"static",
"List",
"<",
"CategorizedMonomer",
">",
"deserializeEditorCategorizationConfig",
"(",
"JsonParser",
"parser",
")",
"throws",
"JsonParseException",
",",
"IOException",
"{",
"List",
"<",
"CategorizedMonomer",
">",
"config",
"=",
"new",
"LinkedList",
... | Private routine to deserialize JSON containing monomer categorization
data. This is done manually to give more freedom regarding data returned
by the webservice.
@param parser
the JSONParser containing JSONData.
@return List containing the monomer categorization
@throws JsonParseException
@throws IOException | [
"Private",
"routine",
"to",
"deserialize",
"JSON",
"containing",
"monomer",
"categorization",
"data",
".",
"This",
"is",
"done",
"manually",
"to",
"give",
"more",
"freedom",
"regarding",
"data",
"returned",
"by",
"the",
"webservice",
"."
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/wsadapter/MonomerWSLoader.java#L379-L442 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/MonomerParser.java | MonomerParser.getAttachment | public static Attachment getAttachment(Element attachment) {
Namespace ns = attachment.getNamespace();
Attachment att = new Attachment();
att.setAlternateId(attachment.getChildText(ATTACHEMENT_ID_ELEMENT, ns));
att.setLabel(attachment.getChildText(ATTACHEMENT_LABEL_ELEMENT, ns));
att.setCap... | java | public static Attachment getAttachment(Element attachment) {
Namespace ns = attachment.getNamespace();
Attachment att = new Attachment();
att.setAlternateId(attachment.getChildText(ATTACHEMENT_ID_ELEMENT, ns));
att.setLabel(attachment.getChildText(ATTACHEMENT_LABEL_ELEMENT, ns));
att.setCap... | [
"public",
"static",
"Attachment",
"getAttachment",
"(",
"Element",
"attachment",
")",
"{",
"Namespace",
"ns",
"=",
"attachment",
".",
"getNamespace",
"(",
")",
";",
"Attachment",
"att",
"=",
"new",
"Attachment",
"(",
")",
";",
"att",
".",
"setAlternateId",
"... | Convert ATTACHMENT element to Attachment object
@param attachment element
@return Attachment | [
"Convert",
"ATTACHMENT",
"element",
"to",
"Attachment",
"object"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/MonomerParser.java#L111-L122 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/MonomerParser.java | MonomerParser.getAttachementElement | public static Element getAttachementElement(Attachment att) {
Element attachment = new Element(ATTACHEMENT_ELEMENT);
if (null != att.getAlternateId() && att.getAlternateId().length() > 0) {
Element e = new Element(ATTACHEMENT_ID_ELEMENT);
e.setText(att.getAlternateId());
attachment.ge... | java | public static Element getAttachementElement(Attachment att) {
Element attachment = new Element(ATTACHEMENT_ELEMENT);
if (null != att.getAlternateId() && att.getAlternateId().length() > 0) {
Element e = new Element(ATTACHEMENT_ID_ELEMENT);
e.setText(att.getAlternateId());
attachment.ge... | [
"public",
"static",
"Element",
"getAttachementElement",
"(",
"Attachment",
"att",
")",
"{",
"Element",
"attachment",
"=",
"new",
"Element",
"(",
"ATTACHEMENT_ELEMENT",
")",
";",
"if",
"(",
"null",
"!=",
"att",
".",
"getAlternateId",
"(",
")",
"&&",
"att",
".... | This method converts Attachment to ATTACHMENT XML element
@param att -- Attachment
@return Element | [
"This",
"method",
"converts",
"Attachment",
"to",
"ATTACHMENT",
"XML",
"element"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/MonomerParser.java#L130-L160 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/MonomerParser.java | MonomerParser.validateAttachement | public static boolean validateAttachement(Attachment attachment)
throws MonomerException, IOException, ChemistryException {
String alternateId = attachment.getAlternateId();
if (null == alternateId) {
throw new MonomerException("Attachment must have unique ID");
}
String smiles = a... | java | public static boolean validateAttachement(Attachment attachment)
throws MonomerException, IOException, ChemistryException {
String alternateId = attachment.getAlternateId();
if (null == alternateId) {
throw new MonomerException("Attachment must have unique ID");
}
String smiles = a... | [
"public",
"static",
"boolean",
"validateAttachement",
"(",
"Attachment",
"attachment",
")",
"throws",
"MonomerException",
",",
"IOException",
",",
"ChemistryException",
"{",
"String",
"alternateId",
"=",
"attachment",
".",
"getAlternateId",
"(",
")",
";",
"if",
"(",... | This method validates Attachment by the following rules
Attachment must have unique ID
cap group SMILES must be valid
cap group SMILES must contain one R group
R group in SMILES must match R group label
@param attachment given attachment
@return true or false
@throws org.helm.notation2.exception.MonomerException if at... | [
"This",
"method",
"validates",
"Attachment",
"by",
"the",
"following",
"rules",
"Attachment",
"must",
"have",
"unique",
"ID",
"cap",
"group",
"SMILES",
"must",
"be",
"valid",
"cap",
"group",
"SMILES",
"must",
"contain",
"one",
"R",
"group",
"R",
"group",
"in... | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/MonomerParser.java#L175-L203 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/MonomerParser.java | MonomerParser.getMonomer | public static Monomer getMonomer(Element monomer) throws MonomerException {
Monomer m = new Monomer();
Namespace ns = monomer.getNamespace();
m.setAlternateId(monomer.getChildText(MONOMER_ID_ELEMENT, ns));
m.setCanSMILES(monomer.getChildText(MONOMER_SMILES_ELEMENT, ns));
String encodedMolfile =... | java | public static Monomer getMonomer(Element monomer) throws MonomerException {
Monomer m = new Monomer();
Namespace ns = monomer.getNamespace();
m.setAlternateId(monomer.getChildText(MONOMER_ID_ELEMENT, ns));
m.setCanSMILES(monomer.getChildText(MONOMER_SMILES_ELEMENT, ns));
String encodedMolfile =... | [
"public",
"static",
"Monomer",
"getMonomer",
"(",
"Element",
"monomer",
")",
"throws",
"MonomerException",
"{",
"Monomer",
"m",
"=",
"new",
"Monomer",
"(",
")",
";",
"Namespace",
"ns",
"=",
"monomer",
".",
"getNamespace",
"(",
")",
";",
"m",
".",
"setAlter... | Convert monomer element to Monomer object
@param monomer element
@return Monomer
@throws MonomerException if element is not a valid monomer | [
"Convert",
"monomer",
"element",
"to",
"Monomer",
"object"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/MonomerParser.java#L212-L244 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/MonomerParser.java | MonomerParser.getMonomerElement | public static Element getMonomerElement(Monomer monomer)
throws MonomerException {
Element element = new Element(MONOMER_ELEMENT);
if (null != monomer.getAlternateId()) {
Element e = new Element(MONOMER_ID_ELEMENT);
e.setText(monomer.getAlternateId());
element.getChildren().add(e... | java | public static Element getMonomerElement(Monomer monomer)
throws MonomerException {
Element element = new Element(MONOMER_ELEMENT);
if (null != monomer.getAlternateId()) {
Element e = new Element(MONOMER_ID_ELEMENT);
e.setText(monomer.getAlternateId());
element.getChildren().add(e... | [
"public",
"static",
"Element",
"getMonomerElement",
"(",
"Monomer",
"monomer",
")",
"throws",
"MonomerException",
"{",
"Element",
"element",
"=",
"new",
"Element",
"(",
"MONOMER_ELEMENT",
")",
";",
"if",
"(",
"null",
"!=",
"monomer",
".",
"getAlternateId",
"(",
... | This method converts Monomer to MONOMER XML element
@param monomer given monomer
@return Element
@throws MonomerException if monomer is not valid | [
"This",
"method",
"converts",
"Monomer",
"to",
"MONOMER",
"XML",
"element"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/MonomerParser.java#L253-L320 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/MonomerParser.java | MonomerParser.areAttachmentLabelsUnique | private static boolean areAttachmentLabelsUnique(List<String> labels) {
Map<String, String> map = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
for (int i = 0; i < labels.size(); i++) {
map.put(labels.get(i), labels.get(i));
}
if (labels.size() == map.size()) {
return tru... | java | private static boolean areAttachmentLabelsUnique(List<String> labels) {
Map<String, String> map = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
for (int i = 0; i < labels.size(); i++) {
map.put(labels.get(i), labels.get(i));
}
if (labels.size() == map.size()) {
return tru... | [
"private",
"static",
"boolean",
"areAttachmentLabelsUnique",
"(",
"List",
"<",
"String",
">",
"labels",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"map",
"=",
"new",
"TreeMap",
"<",
"String",
",",
"String",
">",
"(",
"String",
".",
"CASE_INSENSITI... | This method checks if strings in a list are unique
@param labels list of attachments labels
@return true or false | [
"This",
"method",
"checks",
"if",
"strings",
"in",
"a",
"list",
"are",
"unique"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/MonomerParser.java#L648-L658 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/Monomer.java | Monomer.getAttachment | public Attachment getAttachment(String label) {
for (Attachment attachment : attachmentList) {
if (attachment.getLabel().equalsIgnoreCase(label)) {
return attachment;
}
}
return null;
} | java | public Attachment getAttachment(String label) {
for (Attachment attachment : attachmentList) {
if (attachment.getLabel().equalsIgnoreCase(label)) {
return attachment;
}
}
return null;
} | [
"public",
"Attachment",
"getAttachment",
"(",
"String",
"label",
")",
"{",
"for",
"(",
"Attachment",
"attachment",
":",
"attachmentList",
")",
"{",
"if",
"(",
"attachment",
".",
"getLabel",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"label",
")",
")",
"{",
"r... | get a specific attachment by passing in a label
@param label : unique for each attach point
@return Attachment or null if there is no such attach point | [
"get",
"a",
"specific",
"attachment",
"by",
"passing",
"in",
"a",
"label"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/Monomer.java#L268-L275 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/Monomer.java | Monomer.getCapMoleculeInfo | public MoleculeProperty getCapMoleculeInfo(String label) throws
CTKException, ChemistryException, IOException {
for (Attachment attachment : attachmentList) {
if (attachment.getLabel().equalsIgnoreCase(label)) {
String capSmi = attachment.getCapGroupSMILES();
org.helm.chemtoolkit.Molec... | java | public MoleculeProperty getCapMoleculeInfo(String label) throws
CTKException, ChemistryException, IOException {
for (Attachment attachment : attachmentList) {
if (attachment.getLabel().equalsIgnoreCase(label)) {
String capSmi = attachment.getCapGroupSMILES();
org.helm.chemtoolkit.Molec... | [
"public",
"MoleculeProperty",
"getCapMoleculeInfo",
"(",
"String",
"label",
")",
"throws",
"CTKException",
",",
"ChemistryException",
",",
"IOException",
"{",
"for",
"(",
"Attachment",
"attachment",
":",
"attachmentList",
")",
"{",
"if",
"(",
"attachment",
".",
"g... | This method returns the MoleculeInfo for the input R group label of this
monomer
@param label - R1, R2...
@return MoleculeInfo for the cap group, R group will contribute nothing
@throws CTKException general ChemToolKit exception passed to HELMToolKit
@throws ChemistryException if chemistry could not be initialized
@th... | [
"This",
"method",
"returns",
"the",
"MoleculeInfo",
"for",
"the",
"input",
"R",
"group",
"label",
"of",
"this",
"monomer"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/Monomer.java#L287-L301 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/Monomer.java | Monomer.addAttachment | public boolean addAttachment(Attachment attachment) {
boolean isExist = false;
for (Attachment a : attachmentList) {
if (a.getLabel().equalsIgnoreCase(attachment.getLabel())) {
isExist = true;
}
}
if (!isExist) {
return attachmentList.add(attachment);
}
return false;
... | java | public boolean addAttachment(Attachment attachment) {
boolean isExist = false;
for (Attachment a : attachmentList) {
if (a.getLabel().equalsIgnoreCase(attachment.getLabel())) {
isExist = true;
}
}
if (!isExist) {
return attachmentList.add(attachment);
}
return false;
... | [
"public",
"boolean",
"addAttachment",
"(",
"Attachment",
"attachment",
")",
"{",
"boolean",
"isExist",
"=",
"false",
";",
"for",
"(",
"Attachment",
"a",
":",
"attachmentList",
")",
"{",
"if",
"(",
"a",
".",
"getLabel",
"(",
")",
".",
"equalsIgnoreCase",
"(... | Try to add a new attachment to this monomer
@param attachment -- new attachment to be add in
@return true for success and false if there is one such attach point exist | [
"Try",
"to",
"add",
"a",
"new",
"attachment",
"to",
"this",
"monomer"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/Monomer.java#L309-L320 | train |
kiswanij/jk-util | src/main/java/com/jk/util/cache/JKCacheFactory.java | JKCacheFactory.getCacheManager | public static JKCacheManager getCacheManager() {
if (JKCacheFactory.defaultCacheManager == null) {
logger.debug("init cacheManager");
defaultCacheManager = new JKDefaultCacheManager();
}
return JKCacheFactory.defaultCacheManager;
} | java | public static JKCacheManager getCacheManager() {
if (JKCacheFactory.defaultCacheManager == null) {
logger.debug("init cacheManager");
defaultCacheManager = new JKDefaultCacheManager();
}
return JKCacheFactory.defaultCacheManager;
} | [
"public",
"static",
"JKCacheManager",
"getCacheManager",
"(",
")",
"{",
"if",
"(",
"JKCacheFactory",
".",
"defaultCacheManager",
"==",
"null",
")",
"{",
"logger",
".",
"debug",
"(",
"\"init cacheManager\"",
")",
";",
"defaultCacheManager",
"=",
"new",
"JKDefaultCa... | Gets the default cache manager.
@return the default cache manager | [
"Gets",
"the",
"default",
"cache",
"manager",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/cache/JKCacheFactory.java#L40-L46 | train |
kiswanij/jk-util | src/main/java/com/jk/util/model/table/JKTableModel.java | JKTableModel.getTableColumn | public JKTableColumn getTableColumn(final int col, final boolean visibleIndex) {
int actualIndex;
if (visibleIndex) {
actualIndex = this.visibilityManager.getActualIndexFromVisibleIndex(col);
} else {
actualIndex = col;
}
return this.tableColumns.get(actualIndex);
} | java | public JKTableColumn getTableColumn(final int col, final boolean visibleIndex) {
int actualIndex;
if (visibleIndex) {
actualIndex = this.visibilityManager.getActualIndexFromVisibleIndex(col);
} else {
actualIndex = col;
}
return this.tableColumns.get(actualIndex);
} | [
"public",
"JKTableColumn",
"getTableColumn",
"(",
"final",
"int",
"col",
",",
"final",
"boolean",
"visibleIndex",
")",
"{",
"int",
"actualIndex",
";",
"if",
"(",
"visibleIndex",
")",
"{",
"actualIndex",
"=",
"this",
".",
"visibilityManager",
".",
"getActualIndex... | return NULL of col is out of bound.
@param col the col
@param visibleIndex the visible index
@return the table column | [
"return",
"NULL",
"of",
"col",
"is",
"out",
"of",
"bound",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/model/table/JKTableModel.java#L574-L582 | train |
kiswanij/jk-util | src/main/java/com/jk/util/model/table/JKTableModel.java | JKTableModel.getValueAtAsInteger | public int getValueAtAsInteger(final int row, final int col) {
final Object valueAt = getValueAt(row, col);
int number = 0;
if (valueAt != null && !valueAt.toString().equals("")) {
number = Integer.parseInt(valueAt.toString().trim());
}
return number;
} | java | public int getValueAtAsInteger(final int row, final int col) {
final Object valueAt = getValueAt(row, col);
int number = 0;
if (valueAt != null && !valueAt.toString().equals("")) {
number = Integer.parseInt(valueAt.toString().trim());
}
return number;
} | [
"public",
"int",
"getValueAtAsInteger",
"(",
"final",
"int",
"row",
",",
"final",
"int",
"col",
")",
"{",
"final",
"Object",
"valueAt",
"=",
"getValueAt",
"(",
"row",
",",
"col",
")",
";",
"int",
"number",
"=",
"0",
";",
"if",
"(",
"valueAt",
"!=",
"... | Gets the value at as integer.
@param row the row
@param col the col
@return the value at as integer | [
"Gets",
"the",
"value",
"at",
"as",
"integer",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/model/table/JKTableModel.java#L637-L645 | train |
kiswanij/jk-util | src/main/java/com/jk/util/model/table/JKTableModel.java | JKTableModel.isEditable | public boolean isEditable(final int row, final int column) {
if (isEditable(column)) {
final int actualIndex = getTableColumn(column).getIndex();
final JKTableRecord record = getRecord(row);
return record.isColumnEnabled(actualIndex);
}
return false;
} | java | public boolean isEditable(final int row, final int column) {
if (isEditable(column)) {
final int actualIndex = getTableColumn(column).getIndex();
final JKTableRecord record = getRecord(row);
return record.isColumnEnabled(actualIndex);
}
return false;
} | [
"public",
"boolean",
"isEditable",
"(",
"final",
"int",
"row",
",",
"final",
"int",
"column",
")",
"{",
"if",
"(",
"isEditable",
"(",
"column",
")",
")",
"{",
"final",
"int",
"actualIndex",
"=",
"getTableColumn",
"(",
"column",
")",
".",
"getIndex",
"(",... | Checks if is editable.
@param row the row
@param column the column
@return true, if is editable | [
"Checks",
"if",
"is",
"editable",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/model/table/JKTableModel.java#L777-L784 | train |
kiswanij/jk-util | src/main/java/com/jk/util/model/table/JKTableModel.java | JKTableModel.setEditable | public void setEditable(final int row, final int col, final boolean enable) {
final int actualIndex = getTableColumn(col).getIndex();
getRecord(row).setColumnEnabled(actualIndex, enable);
} | java | public void setEditable(final int row, final int col, final boolean enable) {
final int actualIndex = getTableColumn(col).getIndex();
getRecord(row).setColumnEnabled(actualIndex, enable);
} | [
"public",
"void",
"setEditable",
"(",
"final",
"int",
"row",
",",
"final",
"int",
"col",
",",
"final",
"boolean",
"enable",
")",
"{",
"final",
"int",
"actualIndex",
"=",
"getTableColumn",
"(",
"col",
")",
".",
"getIndex",
"(",
")",
";",
"getRecord",
"(",... | Sets the editable.
@param row the row
@param col the col
@param enable the enable | [
"Sets",
"the",
"editable",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/model/table/JKTableModel.java#L907-L910 | train |
kiswanij/jk-util | src/main/java/com/jk/util/model/table/JKTableModel.java | JKTableModel.addJKTableColumn | public void addJKTableColumn(String keyLabel) {
JKTableColumn col = new JKTableColumn();
col.setName(keyLabel);
addJKTableColumn(col);
} | java | public void addJKTableColumn(String keyLabel) {
JKTableColumn col = new JKTableColumn();
col.setName(keyLabel);
addJKTableColumn(col);
} | [
"public",
"void",
"addJKTableColumn",
"(",
"String",
"keyLabel",
")",
"{",
"JKTableColumn",
"col",
"=",
"new",
"JKTableColumn",
"(",
")",
";",
"col",
".",
"setName",
"(",
"keyLabel",
")",
";",
"addJKTableColumn",
"(",
"col",
")",
";",
"}"
] | Adds the JK table column.
@param keyLabel the key label | [
"Adds",
"the",
"JK",
"table",
"column",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/model/table/JKTableModel.java#L1013-L1017 | train |
stephanenicolas/afterburner | afterburner-library/src/main/java/com/github/stephanenicolas/afterburner/AfterBurner.java | AfterBurner.insertConstructor | public void insertConstructor(InsertableConstructor insertableConstructor) throws CannotCompileException, AfterBurnerImpossibleException,
NotFoundException {
// create or complete onViewCreated
List<CtConstructor> constructorList = extractExistingConstructors(insertableConstructor);
log.info... | java | public void insertConstructor(InsertableConstructor insertableConstructor) throws CannotCompileException, AfterBurnerImpossibleException,
NotFoundException {
// create or complete onViewCreated
List<CtConstructor> constructorList = extractExistingConstructors(insertableConstructor);
log.info... | [
"public",
"void",
"insertConstructor",
"(",
"InsertableConstructor",
"insertableConstructor",
")",
"throws",
"CannotCompileException",
",",
"AfterBurnerImpossibleException",
",",
"NotFoundException",
"{",
"// create or complete onViewCreated",
"List",
"<",
"CtConstructor",
">",
... | Inserts java instructions into all constructors a given class.
@param insertableConstructor contains all information about insertion.
@throws CannotCompileException if the source contained in insertableMethod can't be compiled.
@throws AfterBurnerImpossibleException if something else goes wrong, wraps other exceptions. | [
"Inserts",
"java",
"instructions",
"into",
"all",
"constructors",
"a",
"given",
"class",
"."
] | b126d70e063895b036b6ac47e39e582439f58d12 | https://github.com/stephanenicolas/afterburner/blob/b126d70e063895b036b6ac47e39e582439f58d12/afterburner-library/src/main/java/com/github/stephanenicolas/afterburner/AfterBurner.java#L94-L109 | train |
italiangrid/voms-api-java | src/main/java/org/italiangrid/voms/util/CachingCertificateValidator.java | CachingCertificateValidator.getCachedResult | protected ValidationResult getCachedResult(String certFingerprint) {
CachedValidationResult cvr = validationResultsCache.get(certFingerprint);
if (cvr == null)
return null;
if (!cachedValidationResultHasExpired(cvr, System.currentTimeMillis())) {
return cvr.getResult();
}
validationR... | java | protected ValidationResult getCachedResult(String certFingerprint) {
CachedValidationResult cvr = validationResultsCache.get(certFingerprint);
if (cvr == null)
return null;
if (!cachedValidationResultHasExpired(cvr, System.currentTimeMillis())) {
return cvr.getResult();
}
validationR... | [
"protected",
"ValidationResult",
"getCachedResult",
"(",
"String",
"certFingerprint",
")",
"{",
"CachedValidationResult",
"cvr",
"=",
"validationResultsCache",
".",
"get",
"(",
"certFingerprint",
")",
";",
"if",
"(",
"cvr",
"==",
"null",
")",
"return",
"null",
";"... | Gets a validation result from the memory cache
@param certFingerprint
the certificate fingerprint for the certificate at the top of the
chain
@return the validation result, if found. <code>null</code> otherwise. | [
"Gets",
"a",
"validation",
"result",
"from",
"the",
"memory",
"cache"
] | b33d6cf98ca9449bed87b1cc307d411514589deb | https://github.com/italiangrid/voms-api-java/blob/b33d6cf98ca9449bed87b1cc307d411514589deb/src/main/java/org/italiangrid/voms/util/CachingCertificateValidator.java#L100-L113 | train |
italiangrid/voms-api-java | src/main/java/org/italiangrid/voms/util/CachingCertificateValidator.java | CachingCertificateValidator.validate | public ValidationResult validate(X509Certificate[] certChain) {
certChainSanityChecks(certChain);
String certFingerprint = null;
try {
certFingerprint = FingerprintHelper
.getFingerprint(certChain[certChain.length - 1]);
} catch (Throwable t) {
String errorMsg = String.format("E... | java | public ValidationResult validate(X509Certificate[] certChain) {
certChainSanityChecks(certChain);
String certFingerprint = null;
try {
certFingerprint = FingerprintHelper
.getFingerprint(certChain[certChain.length - 1]);
} catch (Throwable t) {
String errorMsg = String.format("E... | [
"public",
"ValidationResult",
"validate",
"(",
"X509Certificate",
"[",
"]",
"certChain",
")",
"{",
"certChainSanityChecks",
"(",
"certChain",
")",
";",
"String",
"certFingerprint",
"=",
"null",
";",
"try",
"{",
"certFingerprint",
"=",
"FingerprintHelper",
".",
"ge... | Validates a certificate chain using the wrapped validator, caching the
result for future validation calls.
@param certChain
the certificate chain that will be validated
@return a possibly cached {@link ValidationResult}
@see eu.emi.security.authn.x509.X509CertChainValidator#validate(java.security.cert.X509Certificate[... | [
"Validates",
"a",
"certificate",
"chain",
"using",
"the",
"wrapped",
"validator",
"caching",
"the",
"result",
"for",
"future",
"validation",
"calls",
"."
] | b33d6cf98ca9449bed87b1cc307d411514589deb | https://github.com/italiangrid/voms-api-java/blob/b33d6cf98ca9449bed87b1cc307d411514589deb/src/main/java/org/italiangrid/voms/util/CachingCertificateValidator.java#L140-L171 | train |
hageldave/ImagingKit | ImagingKit_Core/src/main/java/hageldave/imagingkit/core/scientific/ColorPixel.java | ColorPixel.minChannel | public int minChannel() {
int c = 0;
if(getValue(c) > getValue(1)) c=1;
if(getValue(c) > getValue(2)) c=2;
return c;
} | java | public int minChannel() {
int c = 0;
if(getValue(c) > getValue(1)) c=1;
if(getValue(c) > getValue(2)) c=2;
return c;
} | [
"public",
"int",
"minChannel",
"(",
")",
"{",
"int",
"c",
"=",
"0",
";",
"if",
"(",
"getValue",
"(",
"c",
")",
">",
"getValue",
"(",
"1",
")",
")",
"c",
"=",
"1",
";",
"if",
"(",
"getValue",
"(",
"c",
")",
">",
"getValue",
"(",
"2",
")",
")... | Returns the channel index with minimum value.
Alpha is not considered.
@return 0 or 1 or 2. | [
"Returns",
"the",
"channel",
"index",
"with",
"minimum",
"value",
".",
"Alpha",
"is",
"not",
"considered",
"."
] | 3837c7d550a12cf4dc5718b644ced94b97f52668 | https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/scientific/ColorPixel.java#L488-L493 | train |
hageldave/ImagingKit | ImagingKit_Core/src/main/java/hageldave/imagingkit/core/scientific/ColorPixel.java | ColorPixel.maxChannel | public int maxChannel() {
int c = 0;
if(getValue(c) < getValue(1)) c=1;
if(getValue(c) < getValue(2)) c=2;
return c;
} | java | public int maxChannel() {
int c = 0;
if(getValue(c) < getValue(1)) c=1;
if(getValue(c) < getValue(2)) c=2;
return c;
} | [
"public",
"int",
"maxChannel",
"(",
")",
"{",
"int",
"c",
"=",
"0",
";",
"if",
"(",
"getValue",
"(",
"c",
")",
"<",
"getValue",
"(",
"1",
")",
")",
"c",
"=",
"1",
";",
"if",
"(",
"getValue",
"(",
"c",
")",
"<",
"getValue",
"(",
"2",
")",
")... | Returns the channel index with maximum value.
Alpha is not considered.
@return 0 or 1 or 2. | [
"Returns",
"the",
"channel",
"index",
"with",
"maximum",
"value",
".",
"Alpha",
"is",
"not",
"considered",
"."
] | 3837c7d550a12cf4dc5718b644ced94b97f52668 | https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/scientific/ColorPixel.java#L500-L505 | train |
ocelotds/ocelot | ocelot-web/src/main/java/org/ocelotds/topic/JsTopicControlsTools.java | JsTopicControlsTools.getJsTopicControlsFromProxyClass | public JsTopicControls getJsTopicControlsFromProxyClass(Class<?> proxy) {
Class<?> realClass = unProxyClassServices.getRealClass(proxy);
return realClass.getAnnotation(JsTopicControls.class);
} | java | public JsTopicControls getJsTopicControlsFromProxyClass(Class<?> proxy) {
Class<?> realClass = unProxyClassServices.getRealClass(proxy);
return realClass.getAnnotation(JsTopicControls.class);
} | [
"public",
"JsTopicControls",
"getJsTopicControlsFromProxyClass",
"(",
"Class",
"<",
"?",
">",
"proxy",
")",
"{",
"Class",
"<",
"?",
">",
"realClass",
"=",
"unProxyClassServices",
".",
"getRealClass",
"(",
"proxy",
")",
";",
"return",
"realClass",
".",
"getAnnota... | get JsTopicControls from JsTopicAccessController instance
@param proxy
@return | [
"get",
"JsTopicControls",
"from",
"JsTopicAccessController",
"instance"
] | 5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7 | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/JsTopicControlsTools.java#L24-L27 | train |
ocelotds/ocelot | ocelot-web/src/main/java/org/ocelotds/configuration/StacktraceConfigurationManager.java | StacktraceConfigurationManager.readStacktraceConfig | public void readStacktraceConfig(@Observes @Initialized(ApplicationScoped.class) ServletContext sc) {
String stacktrace;
if(ocelotConfigurationsStack.isUnsatisfied()) {
stacktrace = sc.getInitParameter(Constants.Options.STACKTRACE_LENGTH);
if(stacktrace==null) {
stacktrace = DEFAULTSTACKTRACE;
} ... | java | public void readStacktraceConfig(@Observes @Initialized(ApplicationScoped.class) ServletContext sc) {
String stacktrace;
if(ocelotConfigurationsStack.isUnsatisfied()) {
stacktrace = sc.getInitParameter(Constants.Options.STACKTRACE_LENGTH);
if(stacktrace==null) {
stacktrace = DEFAULTSTACKTRACE;
} ... | [
"public",
"void",
"readStacktraceConfig",
"(",
"@",
"Observes",
"@",
"Initialized",
"(",
"ApplicationScoped",
".",
"class",
")",
"ServletContext",
"sc",
")",
"{",
"String",
"stacktrace",
";",
"if",
"(",
"ocelotConfigurationsStack",
".",
"isUnsatisfied",
"(",
")",
... | Read in web.xml the optional STACKTRACE_LENGTH config and set it in StacktraceConfigurationManager
@param sc | [
"Read",
"in",
"web",
".",
"xml",
"the",
"optional",
"STACKTRACE_LENGTH",
"config",
"and",
"set",
"it",
"in",
"StacktraceConfigurationManager"
] | 5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7 | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/configuration/StacktraceConfigurationManager.java#L43-L59 | train |
cortical-io/java-client-sdk | retina-service-java-api-client/src/main/java/io/cortical/services/RetinaApiUtils.java | RetinaApiUtils.generateBasepath | public static String generateBasepath(final String ip, Short port) {
if (isEmpty(ip)) {
throw new IllegalArgumentException(NULL_SERVER_IP_MSG);
}
if (port == null) {
port = 80;
}
StringBuilder basePath = new StringBuilder();
basePath.append("http:/... | java | public static String generateBasepath(final String ip, Short port) {
if (isEmpty(ip)) {
throw new IllegalArgumentException(NULL_SERVER_IP_MSG);
}
if (port == null) {
port = 80;
}
StringBuilder basePath = new StringBuilder();
basePath.append("http:/... | [
"public",
"static",
"String",
"generateBasepath",
"(",
"final",
"String",
"ip",
",",
"Short",
"port",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"ip",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"NULL_SERVER_IP_MSG",
")",
";",
"}",
"if",
"(",... | Generate the base path for the retina.
@param ip : retina server ip.
@param port : retina service port.
@return : the retina's API base path. | [
"Generate",
"the",
"base",
"path",
"for",
"the",
"retina",
"."
] | 7a1ee811cd7c221690dc0a7e643c286c56cab921 | https://github.com/cortical-io/java-client-sdk/blob/7a1ee811cd7c221690dc0a7e643c286c56cab921/retina-service-java-api-client/src/main/java/io/cortical/services/RetinaApiUtils.java#L26-L36 | train |
ocelotds/ocelot | ocelot-web/src/main/java/org/ocelotds/core/services/ArgumentConvertor.java | ArgumentConvertor.convertJsonToJava | @Override
public Object convertJsonToJava(String jsonArg, Type paramType, Annotation[] parameterAnnotations) throws JsonUnmarshallingException, JsonMarshallerException {
if ("null".equals(jsonArg)) {
return null;
}
JsonUnmarshaller juma = getJsonUnmarshallerAnnotation(parameterAnnotations);
if (null !... | java | @Override
public Object convertJsonToJava(String jsonArg, Type paramType, Annotation[] parameterAnnotations) throws JsonUnmarshallingException, JsonMarshallerException {
if ("null".equals(jsonArg)) {
return null;
}
JsonUnmarshaller juma = getJsonUnmarshallerAnnotation(parameterAnnotations);
if (null !... | [
"@",
"Override",
"public",
"Object",
"convertJsonToJava",
"(",
"String",
"jsonArg",
",",
"Type",
"paramType",
",",
"Annotation",
"[",
"]",
"parameterAnnotations",
")",
"throws",
"JsonUnmarshallingException",
",",
"JsonMarshallerException",
"{",
"if",
"(",
"\"null\"",
... | Convert json to Java
@param jsonArg
@param paramType
@param parameterAnnotations
@return
@throws org.ocelotds.marshalling.exceptions.JsonUnmarshallingException
@throws org.ocelotds.marshalling.exceptions.JsonMarshallerException | [
"Convert",
"json",
"to",
"Java"
] | 5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7 | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/core/services/ArgumentConvertor.java#L57-L70 | train |
ocelotds/ocelot | ocelot-web/src/main/java/org/ocelotds/core/services/ArgumentConvertor.java | ArgumentConvertor.getJsonUnmarshallerAnnotation | JsonUnmarshaller getJsonUnmarshallerAnnotation(Annotation[] annotations) {
for (Annotation annotation : annotations) {
if (JsonUnmarshaller.class.isInstance(annotation)) {
return (JsonUnmarshaller) annotation;
}
}
return null;
} | java | JsonUnmarshaller getJsonUnmarshallerAnnotation(Annotation[] annotations) {
for (Annotation annotation : annotations) {
if (JsonUnmarshaller.class.isInstance(annotation)) {
return (JsonUnmarshaller) annotation;
}
}
return null;
} | [
"JsonUnmarshaller",
"getJsonUnmarshallerAnnotation",
"(",
"Annotation",
"[",
"]",
"annotations",
")",
"{",
"for",
"(",
"Annotation",
"annotation",
":",
"annotations",
")",
"{",
"if",
"(",
"JsonUnmarshaller",
".",
"class",
".",
"isInstance",
"(",
"annotation",
")",... | return the JsonUnmarshaller annotation
@param annotations
@return | [
"return",
"the",
"JsonUnmarshaller",
"annotation"
] | 5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7 | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/core/services/ArgumentConvertor.java#L93-L100 | train |
ocelotds/ocelot | ocelot-web/src/main/java/org/ocelotds/core/services/ArgumentConvertor.java | ArgumentConvertor.getMarshallerAnnotation | Class<? extends IJsonMarshaller> getMarshallerAnnotation(Annotation[] annotations) {
JsonUnmarshaller ju = getJsonUnmarshallerAnnotation(annotations);
return (ju != null) ? ju.value() : null;
} | java | Class<? extends IJsonMarshaller> getMarshallerAnnotation(Annotation[] annotations) {
JsonUnmarshaller ju = getJsonUnmarshallerAnnotation(annotations);
return (ju != null) ? ju.value() : null;
} | [
"Class",
"<",
"?",
"extends",
"IJsonMarshaller",
">",
"getMarshallerAnnotation",
"(",
"Annotation",
"[",
"]",
"annotations",
")",
"{",
"JsonUnmarshaller",
"ju",
"=",
"getJsonUnmarshallerAnnotation",
"(",
"annotations",
")",
";",
"return",
"(",
"ju",
"!=",
"null",
... | If argument is annotated with JsonUnmarshaller annotation, get the JsonUnmarshaller class
@param annotations
@param paramType
@return | [
"If",
"argument",
"is",
"annotated",
"with",
"JsonUnmarshaller",
"annotation",
"get",
"the",
"JsonUnmarshaller",
"class"
] | 5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7 | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/core/services/ArgumentConvertor.java#L109-L112 | train |
ocelotds/ocelot | ocelot-web/src/main/java/org/ocelotds/core/services/ArgumentConvertor.java | ArgumentConvertor.convertArgument | Object convertArgument(String arg, Type paramType) throws IllegalArgumentException {
Object result = null;
if (null == arg || "null".equals(arg)) {
return result;
}
logger.debug("Try to convert {} : param = {} : {}", new Object[]{arg, paramType, paramType.getClass()});
try { // GenericArrayType, Para... | java | Object convertArgument(String arg, Type paramType) throws IllegalArgumentException {
Object result = null;
if (null == arg || "null".equals(arg)) {
return result;
}
logger.debug("Try to convert {} : param = {} : {}", new Object[]{arg, paramType, paramType.getClass()});
try { // GenericArrayType, Para... | [
"Object",
"convertArgument",
"(",
"String",
"arg",
",",
"Type",
"paramType",
")",
"throws",
"IllegalArgumentException",
"{",
"Object",
"result",
"=",
"null",
";",
"if",
"(",
"null",
"==",
"arg",
"||",
"\"null\"",
".",
"equals",
"(",
"arg",
")",
")",
"{",
... | try to convert json argument in java type
@param arg
@param paramType
@return
@throws IllegalArgumentException | [
"try",
"to",
"convert",
"json",
"argument",
"in",
"java",
"type"
] | 5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7 | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/core/services/ArgumentConvertor.java#L122-L148 | train |
ocelotds/ocelot | ocelot-web/src/main/java/org/ocelotds/core/services/ArgumentConvertor.java | ArgumentConvertor.checkStringArgument | void checkStringArgument(Class cls, String arg) throws IOException {
if (arg.startsWith(Constants.QUOTE)) { // ca ressemble à une string
if (!cls.equals(String.class)) { // et on veut pas une string
throw new IOException();
}
} else // ca ressemble pas à une string
if (cls.equals(String.class)) {... | java | void checkStringArgument(Class cls, String arg) throws IOException {
if (arg.startsWith(Constants.QUOTE)) { // ca ressemble à une string
if (!cls.equals(String.class)) { // et on veut pas une string
throw new IOException();
}
} else // ca ressemble pas à une string
if (cls.equals(String.class)) {... | [
"void",
"checkStringArgument",
"(",
"Class",
"cls",
",",
"String",
"arg",
")",
"throws",
"IOException",
"{",
"if",
"(",
"arg",
".",
"startsWith",
"(",
"Constants",
".",
"QUOTE",
")",
")",
"{",
"// ca ressemble à une string\r",
"if",
"(",
"!",
"cls",
".",
"... | check if class and argument are string
@param cls
@param arg
@throws IOException | [
"check",
"if",
"class",
"and",
"argument",
"are",
"string"
] | 5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7 | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/core/services/ArgumentConvertor.java#L157-L166 | train |
cortical-io/java-client-sdk | retina-service-java-client-example/src/main/java/io/cortical/example/ExampleMain.java | ExampleMain.compareApiUsage | private void compareApiUsage() throws ApiException, JsonProcessingException {
LOG.info("The Compare API usage.");
Compare compareApiInstance = retinaApisInstance.compareApi();
LOG.info("Compare API: compare");
Metric metric = compareApiInstance.compare(new Term("apple"), new Ter... | java | private void compareApiUsage() throws ApiException, JsonProcessingException {
LOG.info("The Compare API usage.");
Compare compareApiInstance = retinaApisInstance.compareApi();
LOG.info("Compare API: compare");
Metric metric = compareApiInstance.compare(new Term("apple"), new Ter... | [
"private",
"void",
"compareApiUsage",
"(",
")",
"throws",
"ApiException",
",",
"JsonProcessingException",
"{",
"LOG",
".",
"info",
"(",
"\"The Compare API usage.\"",
")",
";",
"Compare",
"compareApiInstance",
"=",
"retinaApisInstance",
".",
"compareApi",
"(",
")",
"... | The Compare API usage.
@throws ApiException
@throws JsonProcessingException | [
"The",
"Compare",
"API",
"usage",
"."
] | 7a1ee811cd7c221690dc0a7e643c286c56cab921 | https://github.com/cortical-io/java-client-sdk/blob/7a1ee811cd7c221690dc0a7e643c286c56cab921/retina-service-java-client-example/src/main/java/io/cortical/example/ExampleMain.java#L95-L130 | train |
cortical-io/java-client-sdk | retina-service-java-client-example/src/main/java/io/cortical/example/ExampleMain.java | ExampleMain.imageApiUsage | private void imageApiUsage() throws ApiException, IOException {
LOG.info("The Image API usage.");
Images api = retinaApisInstance.imageApi();
LOG.info("Image API: getImageForExpression");
try (ByteArrayInputStream inputStream = api.getImage(TEXT_1)) {
//get ... | java | private void imageApiUsage() throws ApiException, IOException {
LOG.info("The Image API usage.");
Images api = retinaApisInstance.imageApi();
LOG.info("Image API: getImageForExpression");
try (ByteArrayInputStream inputStream = api.getImage(TEXT_1)) {
//get ... | [
"private",
"void",
"imageApiUsage",
"(",
")",
"throws",
"ApiException",
",",
"IOException",
"{",
"LOG",
".",
"info",
"(",
"\"The Image API usage.\"",
")",
";",
"Images",
"api",
"=",
"retinaApisInstance",
".",
"imageApi",
"(",
")",
";",
"LOG",
".",
"info",
"(... | The Image API usage.
@throws ApiException
@throws IOException | [
"The",
"Image",
"API",
"usage",
"."
] | 7a1ee811cd7c221690dc0a7e643c286c56cab921 | https://github.com/cortical-io/java-client-sdk/blob/7a1ee811cd7c221690dc0a7e643c286c56cab921/retina-service-java-client-example/src/main/java/io/cortical/example/ExampleMain.java#L253-L279 | train |
cortical-io/java-client-sdk | retina-service-java-client-example/src/main/java/io/cortical/example/ExampleMain.java | ExampleMain.retinasApiUsage | private void retinasApiUsage() throws ApiException {
LOG.info("The Retinas API usage.");
Retinas api = getInfo("api.cortical.io", API_KEY);
LOG.info("Retinas API: getRetinas");
List<Retina> retinas = api.getAllRetinas();
for (Retina retina : retinas) {
... | java | private void retinasApiUsage() throws ApiException {
LOG.info("The Retinas API usage.");
Retinas api = getInfo("api.cortical.io", API_KEY);
LOG.info("Retinas API: getRetinas");
List<Retina> retinas = api.getAllRetinas();
for (Retina retina : retinas) {
... | [
"private",
"void",
"retinasApiUsage",
"(",
")",
"throws",
"ApiException",
"{",
"LOG",
".",
"info",
"(",
"\"The Retinas API usage.\"",
")",
";",
"Retinas",
"api",
"=",
"getInfo",
"(",
"\"api.cortical.io\"",
",",
"API_KEY",
")",
";",
"LOG",
".",
"info",
"(",
"... | The Retinas API usage.
@throws ApiException | [
"The",
"Retinas",
"API",
"usage",
"."
] | 7a1ee811cd7c221690dc0a7e643c286c56cab921 | https://github.com/cortical-io/java-client-sdk/blob/7a1ee811cd7c221690dc0a7e643c286c56cab921/retina-service-java-client-example/src/main/java/io/cortical/example/ExampleMain.java#L286-L301 | train |
cortical-io/java-client-sdk | retina-service-java-client-example/src/main/java/io/cortical/example/ExampleMain.java | ExampleMain.termsApiUsage | private void termsApiUsage() throws JsonProcessingException, ApiException {
/**
*
*/
LOG.info("The Terms API usage.");
Terms api = retinaApisInstance.termsApi();
/**
*
*/
LOG.info("Terms API: getContextsForTerm");
List<Context> contex... | java | private void termsApiUsage() throws JsonProcessingException, ApiException {
/**
*
*/
LOG.info("The Terms API usage.");
Terms api = retinaApisInstance.termsApi();
/**
*
*/
LOG.info("Terms API: getContextsForTerm");
List<Context> contex... | [
"private",
"void",
"termsApiUsage",
"(",
")",
"throws",
"JsonProcessingException",
",",
"ApiException",
"{",
"/**\n * \n */",
"LOG",
".",
"info",
"(",
"\"The Terms API usage.\"",
")",
";",
"Terms",
"api",
"=",
"retinaApisInstance",
".",
"termsApi",
"("... | The Terms API usage.
@throws JsonProcessingException
@throws ApiException | [
"The",
"Terms",
"API",
"usage",
"."
] | 7a1ee811cd7c221690dc0a7e643c286c56cab921 | https://github.com/cortical-io/java-client-sdk/blob/7a1ee811cd7c221690dc0a7e643c286c56cab921/retina-service-java-client-example/src/main/java/io/cortical/example/ExampleMain.java#L309-L356 | train |
cortical-io/java-client-sdk | retina-service-java-client-example/src/main/java/io/cortical/example/ExampleMain.java | ExampleMain.textApiUsage | private void textApiUsage() throws ApiException, JsonProcessingException {
/**
*
*/
String text =
"Toll IPEC has been an industry leader in environmental sustainability through its purchase of compressed natural gas powered trucks";
String text2 =
... | java | private void textApiUsage() throws ApiException, JsonProcessingException {
/**
*
*/
String text =
"Toll IPEC has been an industry leader in environmental sustainability through its purchase of compressed natural gas powered trucks";
String text2 =
... | [
"private",
"void",
"textApiUsage",
"(",
")",
"throws",
"ApiException",
",",
"JsonProcessingException",
"{",
"/**\n * \n */",
"String",
"text",
"=",
"\"Toll IPEC has been an industry leader in environmental sustainability through its purchase of compressed natural gas powe... | The Text API usage.
@throws JsonProcessingException
@throws ApiException | [
"The",
"Text",
"API",
"usage",
"."
] | 7a1ee811cd7c221690dc0a7e643c286c56cab921 | https://github.com/cortical-io/java-client-sdk/blob/7a1ee811cd7c221690dc0a7e643c286c56cab921/retina-service-java-client-example/src/main/java/io/cortical/example/ExampleMain.java#L364-L414 | train |
xqbase/tuna | core/src/main/java/com/xqbase/tuna/ConnectorImpl.java | ConnectorImpl.doEvents | public void doEvents() {
while (!isInterrupted()) {
Iterator<Map.Entry<Timer, Runnable>> it = timerMap.entrySet().iterator();
if (it.hasNext()) {
long timeout = it.next().getKey().uptime - System.currentTimeMillis();
doEvents(timeout > 0 ? timeout : 0);
} else {
doEvents(-1);
}
}
... | java | public void doEvents() {
while (!isInterrupted()) {
Iterator<Map.Entry<Timer, Runnable>> it = timerMap.entrySet().iterator();
if (it.hasNext()) {
long timeout = it.next().getKey().uptime - System.currentTimeMillis();
doEvents(timeout > 0 ? timeout : 0);
} else {
doEvents(-1);
}
}
... | [
"public",
"void",
"doEvents",
"(",
")",
"{",
"while",
"(",
"!",
"isInterrupted",
"(",
")",
")",
"{",
"Iterator",
"<",
"Map",
".",
"Entry",
"<",
"Timer",
",",
"Runnable",
">",
">",
"it",
"=",
"timerMap",
".",
"entrySet",
"(",
")",
".",
"iterator",
"... | Consume events until interrupted | [
"Consume",
"events",
"until",
"interrupted"
] | 60d05a9e03877a3daafe9de83dc4427c6cbb9995 | https://github.com/xqbase/tuna/blob/60d05a9e03877a3daafe9de83dc4427c6cbb9995/core/src/main/java/com/xqbase/tuna/ConnectorImpl.java#L405-L415 | train |
osiam/connector4java | src/main/java/org/osiam/resources/scim/Extension.java | Extension.getField | public <T> T getField(String field, ExtensionFieldType<T> extensionFieldType) {
if (field == null || field.isEmpty()) {
throw new IllegalArgumentException("Invalid field name");
}
if (extensionFieldType == null) {
throw new IllegalArgumentException("Invalid field type");
... | java | public <T> T getField(String field, ExtensionFieldType<T> extensionFieldType) {
if (field == null || field.isEmpty()) {
throw new IllegalArgumentException("Invalid field name");
}
if (extensionFieldType == null) {
throw new IllegalArgumentException("Invalid field type");
... | [
"public",
"<",
"T",
">",
"T",
"getField",
"(",
"String",
"field",
",",
"ExtensionFieldType",
"<",
"T",
">",
"extensionFieldType",
")",
"{",
"if",
"(",
"field",
"==",
"null",
"||",
"field",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArg... | Return the value for the field with a given name and type.
@param field The name of the field to retrieve the value of.
@param extensionFieldType The type of the field.
@return The value for the field with the given name.
@throws NoSuchElementException if this schema does not contain a field of the give... | [
"Return",
"the",
"value",
"for",
"the",
"field",
"with",
"a",
"given",
"name",
"and",
"type",
"."
] | a5e6ae1e706f4889d662a069fe2f3bf8e3848d12 | https://github.com/osiam/connector4java/blob/a5e6ae1e706f4889d662a069fe2f3bf8e3848d12/src/main/java/org/osiam/resources/scim/Extension.java#L88-L101 | train |
jenkinsci/gmaven | gmaven-plugin/src/main/java/org/codehaus/gmaven/plugin/execute/ExecuteMojo.java | ExecuteMojo.getProjectClasspathElements | protected List getProjectClasspathElements() throws DependencyResolutionRequiredException {
Set results = new LinkedHashSet();
Set includes = getClasspathIncludes();
if (includes.contains(CLASSPATH_INCLUDE_ALL) || includes.contains(CLASSPATH_INCLUDE_RUNTIME)) {
for (Iterator i = pr... | java | protected List getProjectClasspathElements() throws DependencyResolutionRequiredException {
Set results = new LinkedHashSet();
Set includes = getClasspathIncludes();
if (includes.contains(CLASSPATH_INCLUDE_ALL) || includes.contains(CLASSPATH_INCLUDE_RUNTIME)) {
for (Iterator i = pr... | [
"protected",
"List",
"getProjectClasspathElements",
"(",
")",
"throws",
"DependencyResolutionRequiredException",
"{",
"Set",
"results",
"=",
"new",
"LinkedHashSet",
"(",
")",
";",
"Set",
"includes",
"=",
"getClasspathIncludes",
"(",
")",
";",
"if",
"(",
"includes",
... | Allow the script to work with every JAR dependency of both the project and plugin, including
optional and provided dependencies. Runtime classpath elements are loaded first, so that
legacy behavior is not modified. Additional elements are added first in the order of
project artifacts, then in the order of plugin artif... | [
"Allow",
"the",
"script",
"to",
"work",
"with",
"every",
"JAR",
"dependency",
"of",
"both",
"the",
"project",
"and",
"plugin",
"including",
"optional",
"and",
"provided",
"dependencies",
".",
"Runtime",
"classpath",
"elements",
"are",
"loaded",
"first",
"so",
... | 80d5f6657e15b3e05ffbb82128ed8bb280836e10 | https://github.com/jenkinsci/gmaven/blob/80d5f6657e15b3e05ffbb82128ed8bb280836e10/gmaven-plugin/src/main/java/org/codehaus/gmaven/plugin/execute/ExecuteMojo.java#L220-L266 | train |
jenkinsci/gmaven | gmaven-runtime/gmaven-runtime-loader/src/main/java/org/codehaus/gmaven/runtime/loader/DefaultProviderLoader.java | DefaultProviderLoader.findProviders | private Map findProviders() {
Map providers = getContainer().getComponentDescriptorMap(Provider.class.getName());
if (providers == null) {
throw new Error("No providers discovered");
}
Set keys = providers.keySet();
Map found = null;
for (Iterator iter = key... | java | private Map findProviders() {
Map providers = getContainer().getComponentDescriptorMap(Provider.class.getName());
if (providers == null) {
throw new Error("No providers discovered");
}
Set keys = providers.keySet();
Map found = null;
for (Iterator iter = key... | [
"private",
"Map",
"findProviders",
"(",
")",
"{",
"Map",
"providers",
"=",
"getContainer",
"(",
")",
".",
"getComponentDescriptorMap",
"(",
"Provider",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"providers",
"==",
"null",
")",
"{",
"thr... | Find any providers which are available in the container. | [
"Find",
"any",
"providers",
"which",
"are",
"available",
"in",
"the",
"container",
"."
] | 80d5f6657e15b3e05ffbb82128ed8bb280836e10 | https://github.com/jenkinsci/gmaven/blob/80d5f6657e15b3e05ffbb82128ed8bb280836e10/gmaven-runtime/gmaven-runtime-loader/src/main/java/org/codehaus/gmaven/runtime/loader/DefaultProviderLoader.java#L90-L122 | train |
ocelotds/ocelot | ocelot-processor/src/main/java/org/ocelotds/frameworks/angularjs/FunctionWriter.java | FunctionWriter.writeDependencies | void writeDependencies(Writer writer, String deco, String... dependencies) throws IOException {
boolean first = true;
for (String dependency : dependencies) {
if (!first) {
writer.append(COMMA).append(SPACEOPTIONAL);
}
writer.append(deco).append(dependency).append(deco);
first = false;
}
} | java | void writeDependencies(Writer writer, String deco, String... dependencies) throws IOException {
boolean first = true;
for (String dependency : dependencies) {
if (!first) {
writer.append(COMMA).append(SPACEOPTIONAL);
}
writer.append(deco).append(dependency).append(deco);
first = false;
}
} | [
"void",
"writeDependencies",
"(",
"Writer",
"writer",
",",
"String",
"deco",
",",
"String",
"...",
"dependencies",
")",
"throws",
"IOException",
"{",
"boolean",
"first",
"=",
"true",
";",
"for",
"(",
"String",
"dependency",
":",
"dependencies",
")",
"{",
"if... | dep1, dep2 or if deco = "'" 'dep1', 'dep2'
@param writer
@param deco
@param dependencies
@throws IOException | [
"dep1",
"dep2",
"or",
"if",
"deco",
"=",
"dep1",
"dep2"
] | 5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7 | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/frameworks/angularjs/FunctionWriter.java#L39-L48 | train |
ocelotds/ocelot | ocelot-processor/src/main/java/org/ocelotds/frameworks/angularjs/FunctionWriter.java | FunctionWriter.writeCloseFunction | public void writeCloseFunction(Writer writer) throws IOException {
writer.append(TAB).append(CLOSEBRACE).append(CR);
} | java | public void writeCloseFunction(Writer writer) throws IOException {
writer.append(TAB).append(CLOSEBRACE).append(CR);
} | [
"public",
"void",
"writeCloseFunction",
"(",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"writer",
".",
"append",
"(",
"TAB",
")",
".",
"append",
"(",
"CLOSEBRACE",
")",
".",
"append",
"(",
"CR",
")",
";",
"}"
] | \t}
@param writer
@throws IOException | [
"\\",
"t",
"}"
] | 5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7 | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/frameworks/angularjs/FunctionWriter.java#L71-L73 | train |
ocelotds/ocelot | ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java | DataServiceVisitorJsBuilder.writeArguments | void writeArguments(Iterator<String> names, Writer writer) throws IOException {
while(names.hasNext()) {
String name = names.next();
writer.append(name); // argname
if(names.hasNext()) {
writer.append(COMMA).append(SPACEOPTIONAL); //,
}
}
} | java | void writeArguments(Iterator<String> names, Writer writer) throws IOException {
while(names.hasNext()) {
String name = names.next();
writer.append(name); // argname
if(names.hasNext()) {
writer.append(COMMA).append(SPACEOPTIONAL); //,
}
}
} | [
"void",
"writeArguments",
"(",
"Iterator",
"<",
"String",
">",
"names",
",",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"while",
"(",
"names",
".",
"hasNext",
"(",
")",
")",
"{",
"String",
"name",
"=",
"names",
".",
"next",
"(",
")",
";",
... | Write argument whit comma if necessary
@param names
@param writer
@throws IOException | [
"Write",
"argument",
"whit",
"comma",
"if",
"necessary"
] | 5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7 | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java#L92-L100 | train |
ocelotds/ocelot | ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java | DataServiceVisitorJsBuilder.writeReturnComment | void writeReturnComment(TypeMirror returnType, Writer writer) throws IOException {
String type = returnType.toString();
if (!"void".equals(type)) {
writer.append(TAB2).append(" * @return ").append(OPENBRACE).append(type).append(CLOSEBRACE).append(CR);
}
} | java | void writeReturnComment(TypeMirror returnType, Writer writer) throws IOException {
String type = returnType.toString();
if (!"void".equals(type)) {
writer.append(TAB2).append(" * @return ").append(OPENBRACE).append(type).append(CLOSEBRACE).append(CR);
}
} | [
"void",
"writeReturnComment",
"(",
"TypeMirror",
"returnType",
",",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"String",
"type",
"=",
"returnType",
".",
"toString",
"(",
")",
";",
"if",
"(",
"!",
"\"void\"",
".",
"equals",
"(",
"type",
")",
")"... | write js documentation for return type
@param returnType
@param writer
@throws IOException | [
"write",
"js",
"documentation",
"for",
"return",
"type"
] | 5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7 | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java#L126-L131 | train |
ocelotds/ocelot | ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java | DataServiceVisitorJsBuilder.writeArgumentsComment | void writeArgumentsComment(Iterator<String> argumentsType, Iterator<String> argumentsName, Writer writer) throws IOException {
while(argumentsType.hasNext()) {
String type = argumentsType.next();
String name = argumentsName.next();
writer.append(TAB2).append(" * @param ").append(OPENBRACE).append(type).a... | java | void writeArgumentsComment(Iterator<String> argumentsType, Iterator<String> argumentsName, Writer writer) throws IOException {
while(argumentsType.hasNext()) {
String type = argumentsType.next();
String name = argumentsName.next();
writer.append(TAB2).append(" * @param ").append(OPENBRACE).append(type).a... | [
"void",
"writeArgumentsComment",
"(",
"Iterator",
"<",
"String",
">",
"argumentsType",
",",
"Iterator",
"<",
"String",
">",
"argumentsName",
",",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"while",
"(",
"argumentsType",
".",
"hasNext",
"(",
")",
")... | write js documentation for arguments
@param argumentsType
@param argumentsName
@param writer
@throws IOException | [
"write",
"js",
"documentation",
"for",
"arguments"
] | 5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7 | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java#L141-L147 | train |
ocelotds/ocelot | ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java | DataServiceVisitorJsBuilder.writeJavadocComment | void writeJavadocComment(String methodComment, Writer writer) throws IOException {
// From javadoc
if (methodComment != null) {
methodComment = methodComment.split("@")[0];
int lastIndexOf = methodComment.lastIndexOf("\n");
if (lastIndexOf >= 0) {
methodComment = methodComment.substring(0, lastIn... | java | void writeJavadocComment(String methodComment, Writer writer) throws IOException {
// From javadoc
if (methodComment != null) {
methodComment = methodComment.split("@")[0];
int lastIndexOf = methodComment.lastIndexOf("\n");
if (lastIndexOf >= 0) {
methodComment = methodComment.substring(0, lastIn... | [
"void",
"writeJavadocComment",
"(",
"String",
"methodComment",
",",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"// From javadoc\r",
"if",
"(",
"methodComment",
"!=",
"null",
")",
"{",
"methodComment",
"=",
"methodComment",
".",
"split",
"(",
"\"@\"",
... | write js documentation from javadoc
@param methodComment
@param writer
@throws IOException | [
"write",
"js",
"documentation",
"from",
"javadoc"
] | 5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7 | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java#L154-L165 | train |
ocelotds/ocelot | ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java | DataServiceVisitorJsBuilder.createMethodBody | void createMethodBody(String classname, ExecutableElement methodElement, List<String> arguments, Writer writer) throws IOException {
String methodName = getMethodName(methodElement);
boolean ws = isWebsocketDataService(methodElement);
String args = stringJoinAndDecorate(arguments, COMMA, new NothingDecorator()... | java | void createMethodBody(String classname, ExecutableElement methodElement, List<String> arguments, Writer writer) throws IOException {
String methodName = getMethodName(methodElement);
boolean ws = isWebsocketDataService(methodElement);
String args = stringJoinAndDecorate(arguments, COMMA, new NothingDecorator()... | [
"void",
"createMethodBody",
"(",
"String",
"classname",
",",
"ExecutableElement",
"methodElement",
",",
"List",
"<",
"String",
">",
"arguments",
",",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"String",
"methodName",
"=",
"getMethodName",
"(",
"methodE... | Create javascript method body
@param classname
@param methodElement
@param arguments
@param writer
@throws IOException | [
"Create",
"javascript",
"method",
"body"
] | 5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7 | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java#L186-L192 | train |
ocelotds/ocelot | ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java | DataServiceVisitorJsBuilder.computeKeys | String computeKeys(ExecutableElement methodElement, List<String> arguments) {
String keys = stringJoinAndDecorate(arguments, COMMA, new NothingDecorator());
if (arguments != null && !arguments.isEmpty()) {
JsCacheResult jcr = methodElement.getAnnotation(JsCacheResult.class);
// if there is a jcr annotatio... | java | String computeKeys(ExecutableElement methodElement, List<String> arguments) {
String keys = stringJoinAndDecorate(arguments, COMMA, new NothingDecorator());
if (arguments != null && !arguments.isEmpty()) {
JsCacheResult jcr = methodElement.getAnnotation(JsCacheResult.class);
// if there is a jcr annotatio... | [
"String",
"computeKeys",
"(",
"ExecutableElement",
"methodElement",
",",
"List",
"<",
"String",
">",
"arguments",
")",
"{",
"String",
"keys",
"=",
"stringJoinAndDecorate",
"(",
"arguments",
",",
"COMMA",
",",
"new",
"NothingDecorator",
"(",
")",
")",
";",
"if"... | Generate key part for variable part of md5
@param methodElement
@param arguments
@return | [
"Generate",
"key",
"part",
"for",
"variable",
"part",
"of",
"md5"
] | 5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7 | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java#L218-L228 | train |
ocelotds/ocelot | ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java | DataServiceVisitorJsBuilder.createReturnOcelotPromiseFactory | void createReturnOcelotPromiseFactory(String classname, String methodName, boolean ws, String args, String keys, Writer writer) throws IOException {
String md5 = keyMaker.getMd5(classname + DOT + methodName);
writer.append(TAB3).append("return promiseFactory.create").append(OPENPARENTHESIS).append("_ds").append(C... | java | void createReturnOcelotPromiseFactory(String classname, String methodName, boolean ws, String args, String keys, Writer writer) throws IOException {
String md5 = keyMaker.getMd5(classname + DOT + methodName);
writer.append(TAB3).append("return promiseFactory.create").append(OPENPARENTHESIS).append("_ds").append(C... | [
"void",
"createReturnOcelotPromiseFactory",
"(",
"String",
"classname",
",",
"String",
"methodName",
",",
"boolean",
"ws",
",",
"String",
"args",
",",
"String",
"keys",
",",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"String",
"md5",
"=",
"keyMaker",... | Return body js line that return the OcelotPromise
@param classname
@param methodName
@param args
@param keys
@param writer
@throws IOException | [
"Return",
"body",
"js",
"line",
"that",
"return",
"the",
"OcelotPromise"
] | 5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7 | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java#L239-L247 | train |
ocelotds/ocelot | ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java | DataServiceVisitorJsBuilder.stringJoinAndDecorate | String stringJoinAndDecorate(final List<String> list, final String sep, StringDecorator decorator) {
if (decorator == null) {
decorator = new NothingDecorator();
}
StringBuilder sb = new StringBuilder();
if (list != null) {
boolean first = true;
for (String argument : list) {
if (!first) {
... | java | String stringJoinAndDecorate(final List<String> list, final String sep, StringDecorator decorator) {
if (decorator == null) {
decorator = new NothingDecorator();
}
StringBuilder sb = new StringBuilder();
if (list != null) {
boolean first = true;
for (String argument : list) {
if (!first) {
... | [
"String",
"stringJoinAndDecorate",
"(",
"final",
"List",
"<",
"String",
">",
"list",
",",
"final",
"String",
"sep",
",",
"StringDecorator",
"decorator",
")",
"{",
"if",
"(",
"decorator",
"==",
"null",
")",
"{",
"decorator",
"=",
"new",
"NothingDecorator",
"(... | Join list and separate by sep, each elements is decorate by 'decorator'
@param list
@param decoration
@return | [
"Join",
"list",
"and",
"separate",
"by",
"sep",
"each",
"elements",
"is",
"decorate",
"by",
"decorator"
] | 5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7 | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java#L256-L272 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.