id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
148,500
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/V1InstanceCreator.java
V1InstanceCreator.expression
public Expression expression(Member author, String content, Expression inReplyTo) { Expression expression = new Expression(instance); expression.setAuthor(author); expression.setContent(content); expression.setInReplyTo(inReplyTo); expression.save(); return expression; }
java
public Expression expression(Member author, String content, Expression inReplyTo) { Expression expression = new Expression(instance); expression.setAuthor(author); expression.setContent(content); expression.setInReplyTo(inReplyTo); expression.save(); return expression; }
[ "public", "Expression", "expression", "(", "Member", "author", ",", "String", "content", ",", "Expression", "inReplyTo", ")", "{", "Expression", "expression", "=", "new", "Expression", "(", "instance", ")", ";", "expression", ".", "setAuthor", "(", "author", ")", ";", "expression", ".", "setContent", "(", "content", ")", ";", "expression", ".", "setInReplyTo", "(", "inReplyTo", ")", ";", "expression", ".", "save", "(", ")", ";", "return", "expression", ";", "}" ]
Adds new Expression in Reply To an existing Expression. @param author Author of Expression. @param content Content of Expression. @param inReplyTo Expression being replied to. @return Newly created Conversation
[ "Adds", "new", "Expression", "in", "Reply", "To", "an", "existing", "Expression", "." ]
59d35b67c849299631bca45ee94143237eb2ae1a
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1InstanceCreator.java#L1351-L1358
148,501
xdcrafts/flower
flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/flows/AbstractFlowFactoryBean.java
AbstractFlowFactoryBean.toAction
protected Action toAction(Object item) { if (item instanceof Action) { return (Action) item; } else if (item instanceof String) { final String definition = (String) item; return new DefaultAction( definition + "@" + RANDOM.nextInt(), resolveDataFunction((String) item), getMiddleware(definition) ); } else { String name; List<Middleware> middleware; try { name = (String) ClassApi .findMethod(item.getClass(), "getName") .invoke(item); middleware = getMiddleware(name); } catch (Throwable t) { name = item.getClass().getName(); middleware = Collections.emptyList(); } return new DefaultAction( name + "@" + RANDOM.nextInt(), getDataFunctionExtractor().apply(item, DEFAULT_FUNCTION), middleware ); } }
java
protected Action toAction(Object item) { if (item instanceof Action) { return (Action) item; } else if (item instanceof String) { final String definition = (String) item; return new DefaultAction( definition + "@" + RANDOM.nextInt(), resolveDataFunction((String) item), getMiddleware(definition) ); } else { String name; List<Middleware> middleware; try { name = (String) ClassApi .findMethod(item.getClass(), "getName") .invoke(item); middleware = getMiddleware(name); } catch (Throwable t) { name = item.getClass().getName(); middleware = Collections.emptyList(); } return new DefaultAction( name + "@" + RANDOM.nextInt(), getDataFunctionExtractor().apply(item, DEFAULT_FUNCTION), middleware ); } }
[ "protected", "Action", "toAction", "(", "Object", "item", ")", "{", "if", "(", "item", "instanceof", "Action", ")", "{", "return", "(", "Action", ")", "item", ";", "}", "else", "if", "(", "item", "instanceof", "String", ")", "{", "final", "String", "definition", "=", "(", "String", ")", "item", ";", "return", "new", "DefaultAction", "(", "definition", "+", "\"@\"", "+", "RANDOM", ".", "nextInt", "(", ")", ",", "resolveDataFunction", "(", "(", "String", ")", "item", ")", ",", "getMiddleware", "(", "definition", ")", ")", ";", "}", "else", "{", "String", "name", ";", "List", "<", "Middleware", ">", "middleware", ";", "try", "{", "name", "=", "(", "String", ")", "ClassApi", ".", "findMethod", "(", "item", ".", "getClass", "(", ")", ",", "\"getName\"", ")", ".", "invoke", "(", "item", ")", ";", "middleware", "=", "getMiddleware", "(", "name", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "name", "=", "item", ".", "getClass", "(", ")", ".", "getName", "(", ")", ";", "middleware", "=", "Collections", ".", "emptyList", "(", ")", ";", "}", "return", "new", "DefaultAction", "(", "name", "+", "\"@\"", "+", "RANDOM", ".", "nextInt", "(", ")", ",", "getDataFunctionExtractor", "(", ")", ".", "apply", "(", "item", ",", "DEFAULT_FUNCTION", ")", ",", "middleware", ")", ";", "}", "}" ]
Convert supplied object to of action if possible.
[ "Convert", "supplied", "object", "to", "of", "action", "if", "possible", "." ]
96a8e49102fea434bd383a3c7852f0ee9545f999
https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-spring/src/main/java/com/github/xdcrafts/flower/spring/impl/flows/AbstractFlowFactoryBean.java#L40-L68
148,502
luuuis/jcalendar
src/main/java/com/toedter/components/JSpinField.java
JSpinField.stateChanged
public void stateChanged(ChangeEvent e) { SpinnerNumberModel model = (SpinnerNumberModel) spinner.getModel(); int value = model.getNumber().intValue(); setValue(value); }
java
public void stateChanged(ChangeEvent e) { SpinnerNumberModel model = (SpinnerNumberModel) spinner.getModel(); int value = model.getNumber().intValue(); setValue(value); }
[ "public", "void", "stateChanged", "(", "ChangeEvent", "e", ")", "{", "SpinnerNumberModel", "model", "=", "(", "SpinnerNumberModel", ")", "spinner", ".", "getModel", "(", ")", ";", "int", "value", "=", "model", ".", "getNumber", "(", ")", ".", "intValue", "(", ")", ";", "setValue", "(", "value", ")", ";", "}" ]
Is invoked when the spinner model changes @param e the ChangeEvent
[ "Is", "invoked", "when", "the", "spinner", "model", "changes" ]
442e5bc319d92dee93400e6180ca74a5b6bd7775
https://github.com/luuuis/jcalendar/blob/442e5bc319d92dee93400e6180ca74a5b6bd7775/src/main/java/com/toedter/components/JSpinField.java#L133-L137
148,503
luuuis/jcalendar
src/main/java/com/toedter/components/JSpinField.java
JSpinField.setValue
protected void setValue(int newValue, boolean updateTextField, boolean firePropertyChange) { int oldValue = value; if (newValue < min) { value = min; } else if (newValue > max) { value = max; } else { value = newValue; } if (updateTextField) { textField.setText(Integer.toString(value)); textField.setForeground(Color.black); } if (firePropertyChange) { firePropertyChange("value", oldValue, value); } }
java
protected void setValue(int newValue, boolean updateTextField, boolean firePropertyChange) { int oldValue = value; if (newValue < min) { value = min; } else if (newValue > max) { value = max; } else { value = newValue; } if (updateTextField) { textField.setText(Integer.toString(value)); textField.setForeground(Color.black); } if (firePropertyChange) { firePropertyChange("value", oldValue, value); } }
[ "protected", "void", "setValue", "(", "int", "newValue", ",", "boolean", "updateTextField", ",", "boolean", "firePropertyChange", ")", "{", "int", "oldValue", "=", "value", ";", "if", "(", "newValue", "<", "min", ")", "{", "value", "=", "min", ";", "}", "else", "if", "(", "newValue", ">", "max", ")", "{", "value", "=", "max", ";", "}", "else", "{", "value", "=", "newValue", ";", "}", "if", "(", "updateTextField", ")", "{", "textField", ".", "setText", "(", "Integer", ".", "toString", "(", "value", ")", ")", ";", "textField", ".", "setForeground", "(", "Color", ".", "black", ")", ";", "}", "if", "(", "firePropertyChange", ")", "{", "firePropertyChange", "(", "\"value\"", ",", "oldValue", ",", "value", ")", ";", "}", "}" ]
Sets the value attribute of the JSpinField object. @param newValue The new value @param updateTextField true if text field should be updated
[ "Sets", "the", "value", "attribute", "of", "the", "JSpinField", "object", "." ]
442e5bc319d92dee93400e6180ca74a5b6bd7775
https://github.com/luuuis/jcalendar/blob/442e5bc319d92dee93400e6180ca74a5b6bd7775/src/main/java/com/toedter/components/JSpinField.java#L147-L165
148,504
luuuis/jcalendar
src/main/java/com/toedter/components/JSpinField.java
JSpinField.setValue
public void setValue(int newValue) { setValue(newValue, true, true); spinner.setValue(new Integer(value)); }
java
public void setValue(int newValue) { setValue(newValue, true, true); spinner.setValue(new Integer(value)); }
[ "public", "void", "setValue", "(", "int", "newValue", ")", "{", "setValue", "(", "newValue", ",", "true", ",", "true", ")", ";", "spinner", ".", "setValue", "(", "new", "Integer", "(", "value", ")", ")", ";", "}" ]
Sets the value. This is a bound property. @param newValue the new value @see #getValue
[ "Sets", "the", "value", ".", "This", "is", "a", "bound", "property", "." ]
442e5bc319d92dee93400e6180ca74a5b6bd7775
https://github.com/luuuis/jcalendar/blob/442e5bc319d92dee93400e6180ca74a5b6bd7775/src/main/java/com/toedter/components/JSpinField.java#L175-L178
148,505
luuuis/jcalendar
src/main/java/com/toedter/components/JSpinField.java
JSpinField.caretUpdate
public void caretUpdate(CaretEvent e) { try { int testValue = Integer.valueOf(textField.getText()).intValue(); if ((testValue >= min) && (testValue <= max)) { textField.setForeground(darkGreen); setValue(testValue, false, true); } else { textField.setForeground(Color.red); } } catch (Exception ex) { if (ex instanceof NumberFormatException) { textField.setForeground(Color.red); } // Ignore all other exceptions, e.g. illegal state exception } textField.repaint(); }
java
public void caretUpdate(CaretEvent e) { try { int testValue = Integer.valueOf(textField.getText()).intValue(); if ((testValue >= min) && (testValue <= max)) { textField.setForeground(darkGreen); setValue(testValue, false, true); } else { textField.setForeground(Color.red); } } catch (Exception ex) { if (ex instanceof NumberFormatException) { textField.setForeground(Color.red); } // Ignore all other exceptions, e.g. illegal state exception } textField.repaint(); }
[ "public", "void", "caretUpdate", "(", "CaretEvent", "e", ")", "{", "try", "{", "int", "testValue", "=", "Integer", ".", "valueOf", "(", "textField", ".", "getText", "(", ")", ")", ".", "intValue", "(", ")", ";", "if", "(", "(", "testValue", ">=", "min", ")", "&&", "(", "testValue", "<=", "max", ")", ")", "{", "textField", ".", "setForeground", "(", "darkGreen", ")", ";", "setValue", "(", "testValue", ",", "false", ",", "true", ")", ";", "}", "else", "{", "textField", ".", "setForeground", "(", "Color", ".", "red", ")", ";", "}", "}", "catch", "(", "Exception", "ex", ")", "{", "if", "(", "ex", "instanceof", "NumberFormatException", ")", "{", "textField", ".", "setForeground", "(", "Color", ".", "red", ")", ";", "}", "// Ignore all other exceptions, e.g. illegal state exception", "}", "textField", ".", "repaint", "(", ")", ";", "}" ]
After any user input, the value of the textfield is proofed. Depending on being an integer, the value is colored green or red. @param e the caret event
[ "After", "any", "user", "input", "the", "value", "of", "the", "textfield", "is", "proofed", ".", "Depending", "on", "being", "an", "integer", "the", "value", "is", "colored", "green", "or", "red", "." ]
442e5bc319d92dee93400e6180ca74a5b6bd7775
https://github.com/luuuis/jcalendar/blob/442e5bc319d92dee93400e6180ca74a5b6bd7775/src/main/java/com/toedter/components/JSpinField.java#L272-L291
148,506
luuuis/jcalendar
src/main/java/com/toedter/components/JSpinField.java
JSpinField.actionPerformed
public void actionPerformed(ActionEvent e) { if (textField.getForeground().equals(darkGreen)) { setValue(Integer.valueOf(textField.getText()).intValue()); } }
java
public void actionPerformed(ActionEvent e) { if (textField.getForeground().equals(darkGreen)) { setValue(Integer.valueOf(textField.getText()).intValue()); } }
[ "public", "void", "actionPerformed", "(", "ActionEvent", "e", ")", "{", "if", "(", "textField", ".", "getForeground", "(", ")", ".", "equals", "(", "darkGreen", ")", ")", "{", "setValue", "(", "Integer", ".", "valueOf", "(", "textField", ".", "getText", "(", ")", ")", ".", "intValue", "(", ")", ")", ";", "}", "}" ]
After any user input, the value of the textfield is proofed. Depending on being an integer, the value is colored green or red. If the textfield is green, the enter key is accepted and the new value is set. @param e Description of the Parameter
[ "After", "any", "user", "input", "the", "value", "of", "the", "textfield", "is", "proofed", ".", "Depending", "on", "being", "an", "integer", "the", "value", "is", "colored", "green", "or", "red", ".", "If", "the", "textfield", "is", "green", "the", "enter", "key", "is", "accepted", "and", "the", "new", "value", "is", "set", "." ]
442e5bc319d92dee93400e6180ca74a5b6bd7775
https://github.com/luuuis/jcalendar/blob/442e5bc319d92dee93400e6180ca74a5b6bd7775/src/main/java/com/toedter/components/JSpinField.java#L301-L305
148,507
luuuis/jcalendar
src/main/java/com/toedter/components/JSpinField.java
JSpinField.setEnabled
public void setEnabled(boolean enabled) { super.setEnabled(enabled); spinner.setEnabled(enabled); textField.setEnabled(enabled); /* * Fixes the background bug * 4991597 and sets the background explicitely to a * TextField.inactiveBackground. */ if (!enabled) { textField.setBackground(UIManager.getColor("TextField.inactiveBackground")); } }
java
public void setEnabled(boolean enabled) { super.setEnabled(enabled); spinner.setEnabled(enabled); textField.setEnabled(enabled); /* * Fixes the background bug * 4991597 and sets the background explicitely to a * TextField.inactiveBackground. */ if (!enabled) { textField.setBackground(UIManager.getColor("TextField.inactiveBackground")); } }
[ "public", "void", "setEnabled", "(", "boolean", "enabled", ")", "{", "super", ".", "setEnabled", "(", "enabled", ")", ";", "spinner", ".", "setEnabled", "(", "enabled", ")", ";", "textField", ".", "setEnabled", "(", "enabled", ")", ";", "/*\n\t\t * Fixes the background bug\n\t\t * 4991597 and sets the background explicitely to a\n\t\t * TextField.inactiveBackground.\n\t\t */", "if", "(", "!", "enabled", ")", "{", "textField", ".", "setBackground", "(", "UIManager", ".", "getColor", "(", "\"TextField.inactiveBackground\"", ")", ")", ";", "}", "}" ]
Enable or disable the JSpinField. @param enabled The new enabled value
[ "Enable", "or", "disable", "the", "JSpinField", "." ]
442e5bc319d92dee93400e6180ca74a5b6bd7775
https://github.com/luuuis/jcalendar/blob/442e5bc319d92dee93400e6180ca74a5b6bd7775/src/main/java/com/toedter/components/JSpinField.java#L313-L325
148,508
luuuis/jcalendar
src/main/java/com/toedter/components/JSpinField.java
JSpinField.main
public static void main(String[] s) { JFrame frame = new JFrame("JSpinField"); frame.getContentPane().add(new JSpinField()); frame.pack(); frame.setVisible(true); }
java
public static void main(String[] s) { JFrame frame = new JFrame("JSpinField"); frame.getContentPane().add(new JSpinField()); frame.pack(); frame.setVisible(true); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "s", ")", "{", "JFrame", "frame", "=", "new", "JFrame", "(", "\"JSpinField\"", ")", ";", "frame", ".", "getContentPane", "(", ")", ".", "add", "(", "new", "JSpinField", "(", ")", ")", ";", "frame", ".", "pack", "(", ")", ";", "frame", ".", "setVisible", "(", "true", ")", ";", "}" ]
Creates a JFrame with a JSpinField inside and can be used for testing. @param s The command line arguments
[ "Creates", "a", "JFrame", "with", "a", "JSpinField", "inside", "and", "can", "be", "used", "for", "testing", "." ]
442e5bc319d92dee93400e6180ca74a5b6bd7775
https://github.com/luuuis/jcalendar/blob/442e5bc319d92dee93400e6180ca74a5b6bd7775/src/main/java/com/toedter/components/JSpinField.java#L344-L349
148,509
groundupworks/wings
wings-dropbox/src/main/java/com/groundupworks/wings/dropbox/DropboxEndpoint.java
DropboxEndpoint.showLinkError
private void showLinkError() { Toast.makeText(mContext, mContext.getString(R.string.wings_dropbox__error_link), Toast.LENGTH_SHORT).show(); }
java
private void showLinkError() { Toast.makeText(mContext, mContext.getString(R.string.wings_dropbox__error_link), Toast.LENGTH_SHORT).show(); }
[ "private", "void", "showLinkError", "(", ")", "{", "Toast", ".", "makeText", "(", "mContext", ",", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_dropbox__error_link", ")", ",", "Toast", ".", "LENGTH_SHORT", ")", ".", "show", "(", ")", ";", "}" ]
Displays the link error message.
[ "Displays", "the", "link", "error", "message", "." ]
03d2827c30ef55f2db4e23f7500e016c7771fa39
https://github.com/groundupworks/wings/blob/03d2827c30ef55f2db4e23f7500e016c7771fa39/wings-dropbox/src/main/java/com/groundupworks/wings/dropbox/DropboxEndpoint.java#L178-L180
148,510
groundupworks/wings
wings-dropbox/src/main/java/com/groundupworks/wings/dropbox/DropboxEndpoint.java
DropboxEndpoint.createPhotoFolder
private boolean createPhotoFolder(DropboxAPI<AndroidAuthSession> dropboxApi) { boolean folderCreated = false; if (dropboxApi != null) { try { dropboxApi.createFolder(mContext.getString(R.string.wings_dropbox__photo_folder)); folderCreated = true; } catch (DropboxException e) { // Consider the folder created if the folder already exists. if (e instanceof DropboxServerException) { folderCreated = DropboxServerException._403_FORBIDDEN == ((DropboxServerException) e).error; } } } return folderCreated; }
java
private boolean createPhotoFolder(DropboxAPI<AndroidAuthSession> dropboxApi) { boolean folderCreated = false; if (dropboxApi != null) { try { dropboxApi.createFolder(mContext.getString(R.string.wings_dropbox__photo_folder)); folderCreated = true; } catch (DropboxException e) { // Consider the folder created if the folder already exists. if (e instanceof DropboxServerException) { folderCreated = DropboxServerException._403_FORBIDDEN == ((DropboxServerException) e).error; } } } return folderCreated; }
[ "private", "boolean", "createPhotoFolder", "(", "DropboxAPI", "<", "AndroidAuthSession", ">", "dropboxApi", ")", "{", "boolean", "folderCreated", "=", "false", ";", "if", "(", "dropboxApi", "!=", "null", ")", "{", "try", "{", "dropboxApi", ".", "createFolder", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_dropbox__photo_folder", ")", ")", ";", "folderCreated", "=", "true", ";", "}", "catch", "(", "DropboxException", "e", ")", "{", "// Consider the folder created if the folder already exists.", "if", "(", "e", "instanceof", "DropboxServerException", ")", "{", "folderCreated", "=", "DropboxServerException", ".", "_403_FORBIDDEN", "==", "(", "(", "DropboxServerException", ")", "e", ")", ".", "error", ";", "}", "}", "}", "return", "folderCreated", ";", "}" ]
Creates a directory for photos if one does not already exist. If the folder already exists, this call will do nothing. @param dropboxApi the {@link DropboxAPI}. @return true if the directory is created or it already exists; false otherwise.
[ "Creates", "a", "directory", "for", "photos", "if", "one", "does", "not", "already", "exist", ".", "If", "the", "folder", "already", "exists", "this", "call", "will", "do", "nothing", "." ]
03d2827c30ef55f2db4e23f7500e016c7771fa39
https://github.com/groundupworks/wings/blob/03d2827c30ef55f2db4e23f7500e016c7771fa39/wings-dropbox/src/main/java/com/groundupworks/wings/dropbox/DropboxEndpoint.java#L189-L203
148,511
groundupworks/wings
wings-dropbox/src/main/java/com/groundupworks/wings/dropbox/DropboxEndpoint.java
DropboxEndpoint.requestAccountName
private String requestAccountName(DropboxAPI<AndroidAuthSession> dropboxApi) { String accountName = null; if (dropboxApi != null) { try { accountName = dropboxApi.accountInfo().displayName; } catch (DropboxException e) { // Do nothing. } } return accountName; }
java
private String requestAccountName(DropboxAPI<AndroidAuthSession> dropboxApi) { String accountName = null; if (dropboxApi != null) { try { accountName = dropboxApi.accountInfo().displayName; } catch (DropboxException e) { // Do nothing. } } return accountName; }
[ "private", "String", "requestAccountName", "(", "DropboxAPI", "<", "AndroidAuthSession", ">", "dropboxApi", ")", "{", "String", "accountName", "=", "null", ";", "if", "(", "dropboxApi", "!=", "null", ")", "{", "try", "{", "accountName", "=", "dropboxApi", ".", "accountInfo", "(", ")", ".", "displayName", ";", "}", "catch", "(", "DropboxException", "e", ")", "{", "// Do nothing.", "}", "}", "return", "accountName", ";", "}" ]
Requests the linked account name. @param dropboxApi the {@link DropboxAPI}. @return the account name; or null if not linked.
[ "Requests", "the", "linked", "account", "name", "." ]
03d2827c30ef55f2db4e23f7500e016c7771fa39
https://github.com/groundupworks/wings/blob/03d2827c30ef55f2db4e23f7500e016c7771fa39/wings-dropbox/src/main/java/com/groundupworks/wings/dropbox/DropboxEndpoint.java#L211-L221
148,512
groundupworks/wings
wings-dropbox/src/main/java/com/groundupworks/wings/dropbox/DropboxEndpoint.java
DropboxEndpoint.requestShareUrl
private String requestShareUrl(DropboxAPI<AndroidAuthSession> dropboxApi) { String shareUrl = null; if (dropboxApi != null) { try { shareUrl = dropboxApi.share("/" + mContext.getString(R.string.wings_dropbox__photo_folder)).url; } catch (DropboxException e) { // Do nothing. } } return shareUrl; }
java
private String requestShareUrl(DropboxAPI<AndroidAuthSession> dropboxApi) { String shareUrl = null; if (dropboxApi != null) { try { shareUrl = dropboxApi.share("/" + mContext.getString(R.string.wings_dropbox__photo_folder)).url; } catch (DropboxException e) { // Do nothing. } } return shareUrl; }
[ "private", "String", "requestShareUrl", "(", "DropboxAPI", "<", "AndroidAuthSession", ">", "dropboxApi", ")", "{", "String", "shareUrl", "=", "null", ";", "if", "(", "dropboxApi", "!=", "null", ")", "{", "try", "{", "shareUrl", "=", "dropboxApi", ".", "share", "(", "\"/\"", "+", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_dropbox__photo_folder", ")", ")", ".", "url", ";", "}", "catch", "(", "DropboxException", "e", ")", "{", "// Do nothing.", "}", "}", "return", "shareUrl", ";", "}" ]
Requests the share url of the linked folder. @param dropboxApi the {@link DropboxAPI}. @return the url; or null if not linked.
[ "Requests", "the", "share", "url", "of", "the", "linked", "folder", "." ]
03d2827c30ef55f2db4e23f7500e016c7771fa39
https://github.com/groundupworks/wings/blob/03d2827c30ef55f2db4e23f7500e016c7771fa39/wings-dropbox/src/main/java/com/groundupworks/wings/dropbox/DropboxEndpoint.java#L229-L239
148,513
groundupworks/wings
wings-dropbox/src/main/java/com/groundupworks/wings/dropbox/DropboxEndpoint.java
DropboxEndpoint.storeAccountParams
private void storeAccountParams(String accountName, String shareUrl, String accessToken) { Editor editor = PreferenceManager.getDefaultSharedPreferences(mContext).edit(); editor.putString(mContext.getString(R.string.wings_dropbox__account_name_key), accountName); editor.putString(mContext.getString(R.string.wings_dropbox__share_url_key), shareUrl); editor.putString(mContext.getString(R.string.wings_dropbox__access_token_key), accessToken); // Set preference to linked. editor.putBoolean(mContext.getString(R.string.wings_dropbox__link_key), true); editor.apply(); }
java
private void storeAccountParams(String accountName, String shareUrl, String accessToken) { Editor editor = PreferenceManager.getDefaultSharedPreferences(mContext).edit(); editor.putString(mContext.getString(R.string.wings_dropbox__account_name_key), accountName); editor.putString(mContext.getString(R.string.wings_dropbox__share_url_key), shareUrl); editor.putString(mContext.getString(R.string.wings_dropbox__access_token_key), accessToken); // Set preference to linked. editor.putBoolean(mContext.getString(R.string.wings_dropbox__link_key), true); editor.apply(); }
[ "private", "void", "storeAccountParams", "(", "String", "accountName", ",", "String", "shareUrl", ",", "String", "accessToken", ")", "{", "Editor", "editor", "=", "PreferenceManager", ".", "getDefaultSharedPreferences", "(", "mContext", ")", ".", "edit", "(", ")", ";", "editor", ".", "putString", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_dropbox__account_name_key", ")", ",", "accountName", ")", ";", "editor", ".", "putString", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_dropbox__share_url_key", ")", ",", "shareUrl", ")", ";", "editor", ".", "putString", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_dropbox__access_token_key", ")", ",", "accessToken", ")", ";", "// Set preference to linked.", "editor", ".", "putBoolean", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_dropbox__link_key", ")", ",", "true", ")", ";", "editor", ".", "apply", "(", ")", ";", "}" ]
Stores the account params in persisted storage. @param accountName the user name associated with the account. @param shareUrl the share url associated with the account. @param accessToken the access token.
[ "Stores", "the", "account", "params", "in", "persisted", "storage", "." ]
03d2827c30ef55f2db4e23f7500e016c7771fa39
https://github.com/groundupworks/wings/blob/03d2827c30ef55f2db4e23f7500e016c7771fa39/wings-dropbox/src/main/java/com/groundupworks/wings/dropbox/DropboxEndpoint.java#L248-L257
148,514
groundupworks/wings
wings-dropbox/src/main/java/com/groundupworks/wings/dropbox/DropboxEndpoint.java
DropboxEndpoint.removeAccountParams
private void removeAccountParams() { Editor editor = PreferenceManager.getDefaultSharedPreferences(mContext).edit(); editor.remove(mContext.getString(R.string.wings_dropbox__account_name_key)); editor.remove(mContext.getString(R.string.wings_dropbox__share_url_key)); editor.remove(mContext.getString(R.string.wings_dropbox__access_token_key)); // Set preference to unlinked. editor.putBoolean(mContext.getString(R.string.wings_dropbox__link_key), false); editor.apply(); }
java
private void removeAccountParams() { Editor editor = PreferenceManager.getDefaultSharedPreferences(mContext).edit(); editor.remove(mContext.getString(R.string.wings_dropbox__account_name_key)); editor.remove(mContext.getString(R.string.wings_dropbox__share_url_key)); editor.remove(mContext.getString(R.string.wings_dropbox__access_token_key)); // Set preference to unlinked. editor.putBoolean(mContext.getString(R.string.wings_dropbox__link_key), false); editor.apply(); }
[ "private", "void", "removeAccountParams", "(", ")", "{", "Editor", "editor", "=", "PreferenceManager", ".", "getDefaultSharedPreferences", "(", "mContext", ")", ".", "edit", "(", ")", ";", "editor", ".", "remove", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_dropbox__account_name_key", ")", ")", ";", "editor", ".", "remove", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_dropbox__share_url_key", ")", ")", ";", "editor", ".", "remove", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_dropbox__access_token_key", ")", ")", ";", "// Set preference to unlinked.", "editor", ".", "putBoolean", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_dropbox__link_key", ")", ",", "false", ")", ";", "editor", ".", "apply", "(", ")", ";", "}" ]
Removes the account params from persisted storage.
[ "Removes", "the", "account", "params", "from", "persisted", "storage", "." ]
03d2827c30ef55f2db4e23f7500e016c7771fa39
https://github.com/groundupworks/wings/blob/03d2827c30ef55f2db4e23f7500e016c7771fa39/wings-dropbox/src/main/java/com/groundupworks/wings/dropbox/DropboxEndpoint.java#L262-L271
148,515
groundupworks/wings
wings-dropbox/src/main/java/com/groundupworks/wings/dropbox/DropboxEndpoint.java
DropboxEndpoint.getLinkedAccessToken
private String getLinkedAccessToken() { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mContext); return preferences.getString(mContext.getString(R.string.wings_dropbox__access_token_key), null); }
java
private String getLinkedAccessToken() { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mContext); return preferences.getString(mContext.getString(R.string.wings_dropbox__access_token_key), null); }
[ "private", "String", "getLinkedAccessToken", "(", ")", "{", "SharedPreferences", "preferences", "=", "PreferenceManager", ".", "getDefaultSharedPreferences", "(", "mContext", ")", ";", "return", "preferences", ".", "getString", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_dropbox__access_token_key", ")", ",", "null", ")", ";", "}" ]
Gets the stored access token associated with the linked account. @return the access token; or null if unlinked.
[ "Gets", "the", "stored", "access", "token", "associated", "with", "the", "linked", "account", "." ]
03d2827c30ef55f2db4e23f7500e016c7771fa39
https://github.com/groundupworks/wings/blob/03d2827c30ef55f2db4e23f7500e016c7771fa39/wings-dropbox/src/main/java/com/groundupworks/wings/dropbox/DropboxEndpoint.java#L278-L281
148,516
groundupworks/wings
wings-dropbox/src/main/java/com/groundupworks/wings/dropbox/DropboxEndpoint.java
DropboxEndpoint.getLinkedShareUrl
private String getLinkedShareUrl() { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mContext); return preferences.getString(mContext.getString(R.string.wings_dropbox__share_url_key), null); }
java
private String getLinkedShareUrl() { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mContext); return preferences.getString(mContext.getString(R.string.wings_dropbox__share_url_key), null); }
[ "private", "String", "getLinkedShareUrl", "(", ")", "{", "SharedPreferences", "preferences", "=", "PreferenceManager", ".", "getDefaultSharedPreferences", "(", "mContext", ")", ";", "return", "preferences", ".", "getString", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_dropbox__share_url_key", ")", ",", "null", ")", ";", "}" ]
Gets the share url associated with the linked account. @return the url; or null if unlinked.
[ "Gets", "the", "share", "url", "associated", "with", "the", "linked", "account", "." ]
03d2827c30ef55f2db4e23f7500e016c7771fa39
https://github.com/groundupworks/wings/blob/03d2827c30ef55f2db4e23f7500e016c7771fa39/wings-dropbox/src/main/java/com/groundupworks/wings/dropbox/DropboxEndpoint.java#L288-L291
148,517
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/V1ConnectionValidator.java
V1ConnectionValidator.checkConnection
public void checkConnection() throws ConnectionException { IAPIConnector connector = populateHeaders(new V1APIConnector(getApplicationURL() + MEMBER_CONNECT_PARAM, username, password, ApiClientInternals.getProxyProvider(proxySettings))); try { connector.getData().close(); } catch (Exception ex) { throw new ConnectionException("Application not found at the URL: " + getApplicationURL(), ex); } }
java
public void checkConnection() throws ConnectionException { IAPIConnector connector = populateHeaders(new V1APIConnector(getApplicationURL() + MEMBER_CONNECT_PARAM, username, password, ApiClientInternals.getProxyProvider(proxySettings))); try { connector.getData().close(); } catch (Exception ex) { throw new ConnectionException("Application not found at the URL: " + getApplicationURL(), ex); } }
[ "public", "void", "checkConnection", "(", ")", "throws", "ConnectionException", "{", "IAPIConnector", "connector", "=", "populateHeaders", "(", "new", "V1APIConnector", "(", "getApplicationURL", "(", ")", "+", "MEMBER_CONNECT_PARAM", ",", "username", ",", "password", ",", "ApiClientInternals", ".", "getProxyProvider", "(", "proxySettings", ")", ")", ")", ";", "try", "{", "connector", ".", "getData", "(", ")", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "new", "ConnectionException", "(", "\"Application not found at the URL: \"", "+", "getApplicationURL", "(", ")", ",", "ex", ")", ";", "}", "}" ]
Check server connection and authentication. @throws ConnectionException - if no connection.
[ "Check", "server", "connection", "and", "authentication", "." ]
59d35b67c849299631bca45ee94143237eb2ae1a
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1ConnectionValidator.java#L91-L101
148,518
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/V1ConnectionValidator.java
V1ConnectionValidator.checkVersion
public void checkVersion(String version) throws ConnectionException { MetaModel meta = createMetaModel(); meta.getAssetType("Member"); if ((version != null) && (version.length() > 0) && ((meta.getVersion() == null) || (meta.getVersion() .compareTo(new Version(version)) < 0))) { throw new ConnectionException(MessageFormat.format( "VersionOne Release {0} or above is required (found {1}).", version, meta.getVersion())); } }
java
public void checkVersion(String version) throws ConnectionException { MetaModel meta = createMetaModel(); meta.getAssetType("Member"); if ((version != null) && (version.length() > 0) && ((meta.getVersion() == null) || (meta.getVersion() .compareTo(new Version(version)) < 0))) { throw new ConnectionException(MessageFormat.format( "VersionOne Release {0} or above is required (found {1}).", version, meta.getVersion())); } }
[ "public", "void", "checkVersion", "(", "String", "version", ")", "throws", "ConnectionException", "{", "MetaModel", "meta", "=", "createMetaModel", "(", ")", ";", "meta", ".", "getAssetType", "(", "\"Member\"", ")", ";", "if", "(", "(", "version", "!=", "null", ")", "&&", "(", "version", ".", "length", "(", ")", ">", "0", ")", "&&", "(", "(", "meta", ".", "getVersion", "(", ")", "==", "null", ")", "||", "(", "meta", ".", "getVersion", "(", ")", ".", "compareTo", "(", "new", "Version", "(", "version", ")", ")", "<", "0", ")", ")", ")", "{", "throw", "new", "ConnectionException", "(", "MessageFormat", ".", "format", "(", "\"VersionOne Release {0} or above is required (found {1}).\"", ",", "version", ",", "meta", ".", "getVersion", "(", ")", ")", ")", ";", "}", "}" ]
Checking version of VersionOne. @param version number of version. @throws ConnectionException if version lower than require.
[ "Checking", "version", "of", "VersionOne", "." ]
59d35b67c849299631bca45ee94143237eb2ae1a
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1ConnectionValidator.java#L109-L120
148,519
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/V1ConnectionValidator.java
V1ConnectionValidator.checkAuthentication
public void checkAuthentication() throws ConnectionException { IServices services = new Services(createMetaModel(), populateHeaders(new V1APIConnector(getApplicationURL() + "rest-1.v1/", username, password, ApiClientInternals.getProxyProvider(proxySettings)))); Oid loggedin; try { loggedin = services.getLoggedIn(); } catch (Exception ex) { throw new ConnectionException( "Unable to log in. Incorrect username or password.", ex); } if (loggedin.isNull()) { throw new ConnectionException( "Unable to retrieve logged in member."); } }
java
public void checkAuthentication() throws ConnectionException { IServices services = new Services(createMetaModel(), populateHeaders(new V1APIConnector(getApplicationURL() + "rest-1.v1/", username, password, ApiClientInternals.getProxyProvider(proxySettings)))); Oid loggedin; try { loggedin = services.getLoggedIn(); } catch (Exception ex) { throw new ConnectionException( "Unable to log in. Incorrect username or password.", ex); } if (loggedin.isNull()) { throw new ConnectionException( "Unable to retrieve logged in member."); } }
[ "public", "void", "checkAuthentication", "(", ")", "throws", "ConnectionException", "{", "IServices", "services", "=", "new", "Services", "(", "createMetaModel", "(", ")", ",", "populateHeaders", "(", "new", "V1APIConnector", "(", "getApplicationURL", "(", ")", "+", "\"rest-1.v1/\"", ",", "username", ",", "password", ",", "ApiClientInternals", ".", "getProxyProvider", "(", "proxySettings", ")", ")", ")", ")", ";", "Oid", "loggedin", ";", "try", "{", "loggedin", "=", "services", ".", "getLoggedIn", "(", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "new", "ConnectionException", "(", "\"Unable to log in. Incorrect username or password.\"", ",", "ex", ")", ";", "}", "if", "(", "loggedin", ".", "isNull", "(", ")", ")", "{", "throw", "new", "ConnectionException", "(", "\"Unable to retrieve logged in member.\"", ")", ";", "}", "}" ]
Checking authentication. @throws ConnectionException if user name or password is not correct or unable to retrieve logged in member.
[ "Checking", "authentication", "." ]
59d35b67c849299631bca45ee94143237eb2ae1a
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1ConnectionValidator.java#L133-L150
148,520
iipc/openwayback-access-control
access-control/src/main/java/org/archive/accesscontrol/model/Rule.java
Rule.copyFrom
public void copyFrom(Rule rule) { setPolicy(rule.getPolicy()); setCaptureStart(rule.getCaptureStart()); setCaptureEnd(rule.getCaptureEnd()); setPrivateComment(rule.getPrivateComment()); setPublicComment(rule.getPublicComment()); setRetrievalStart(rule.getRetrievalStart()); setRetrievalEnd(rule.getRetrievalEnd()); setSecondsSinceCapture(rule.getSecondsSinceCapture()); setSurt(rule.getSurt()); setWho(rule.getWho()); setEnabled(rule.getEnabled()); setExactMatch(rule.isExactMatch()); }
java
public void copyFrom(Rule rule) { setPolicy(rule.getPolicy()); setCaptureStart(rule.getCaptureStart()); setCaptureEnd(rule.getCaptureEnd()); setPrivateComment(rule.getPrivateComment()); setPublicComment(rule.getPublicComment()); setRetrievalStart(rule.getRetrievalStart()); setRetrievalEnd(rule.getRetrievalEnd()); setSecondsSinceCapture(rule.getSecondsSinceCapture()); setSurt(rule.getSurt()); setWho(rule.getWho()); setEnabled(rule.getEnabled()); setExactMatch(rule.isExactMatch()); }
[ "public", "void", "copyFrom", "(", "Rule", "rule", ")", "{", "setPolicy", "(", "rule", ".", "getPolicy", "(", ")", ")", ";", "setCaptureStart", "(", "rule", ".", "getCaptureStart", "(", ")", ")", ";", "setCaptureEnd", "(", "rule", ".", "getCaptureEnd", "(", ")", ")", ";", "setPrivateComment", "(", "rule", ".", "getPrivateComment", "(", ")", ")", ";", "setPublicComment", "(", "rule", ".", "getPublicComment", "(", ")", ")", ";", "setRetrievalStart", "(", "rule", ".", "getRetrievalStart", "(", ")", ")", ";", "setRetrievalEnd", "(", "rule", ".", "getRetrievalEnd", "(", ")", ")", ";", "setSecondsSinceCapture", "(", "rule", ".", "getSecondsSinceCapture", "(", ")", ")", ";", "setSurt", "(", "rule", ".", "getSurt", "(", ")", ")", ";", "setWho", "(", "rule", ".", "getWho", "(", ")", ")", ";", "setEnabled", "(", "rule", ".", "getEnabled", "(", ")", ")", ";", "setExactMatch", "(", "rule", ".", "isExactMatch", "(", ")", ")", ";", "}" ]
Populate the rule data fields by copying them from a given rule.
[ "Populate", "the", "rule", "data", "fields", "by", "copying", "them", "from", "a", "given", "rule", "." ]
4a0f70f200fd8d7b6e313624b7628656d834bf31
https://github.com/iipc/openwayback-access-control/blob/4a0f70f200fd8d7b6e313624b7628656d834bf31/access-control/src/main/java/org/archive/accesscontrol/model/Rule.java#L81-L94
148,521
iipc/openwayback-access-control
access-control/src/main/java/org/archive/accesscontrol/model/Rule.java
Rule.matches
public boolean matches(String surt, Date captureDate, Date retrievalDate, String who2) { return (who == null || who.length() == 0 || who.equals(who2)) && matches(surt, captureDate, retrievalDate); }
java
public boolean matches(String surt, Date captureDate, Date retrievalDate, String who2) { return (who == null || who.length() == 0 || who.equals(who2)) && matches(surt, captureDate, retrievalDate); }
[ "public", "boolean", "matches", "(", "String", "surt", ",", "Date", "captureDate", ",", "Date", "retrievalDate", ",", "String", "who2", ")", "{", "return", "(", "who", "==", "null", "||", "who", ".", "length", "(", ")", "==", "0", "||", "who", ".", "equals", "(", "who2", ")", ")", "&&", "matches", "(", "surt", ",", "captureDate", ",", "retrievalDate", ")", ";", "}" ]
Return true if the given request matches against this rule. @param surt SURT of requested document @param captureDate Capture date of document @param retrievalDate @param who2 Group name of requesting user @return
[ "Return", "true", "if", "the", "given", "request", "matches", "against", "this", "rule", "." ]
4a0f70f200fd8d7b6e313624b7628656d834bf31
https://github.com/iipc/openwayback-access-control/blob/4a0f70f200fd8d7b6e313624b7628656d834bf31/access-control/src/main/java/org/archive/accesscontrol/model/Rule.java#L379-L382
148,522
groundupworks/wings
wings-facebook/src/main/java/com/groundupworks/wings/facebook/FacebookEndpoint.java
FacebookEndpoint.startOpenSessionRequest
private void startOpenSessionRequest(final Activity activity, final Fragment fragment) { // State transition. mLinkRequestState = STATE_OPEN_SESSION_REQUEST; // Construct status callback. Session.StatusCallback statusCallback = new Session.StatusCallback() { @Override public void call(Session session, SessionState state, Exception exception) { if (mLinkRequestState == STATE_OPEN_SESSION_REQUEST && state.isOpened()) { // Request publish permissions. if (!startPublishPermissionsRequest(activity, fragment)) { handleLinkError(); } } } }; // Construct new session. Session session = new Session(activity); Session.setActiveSession(session); // Construct read permissions to request for. List<String> readPermissions = new LinkedList<String>(); readPermissions.add(PERMISSION_PUBLIC_PROFILE); readPermissions.add(PERMISSION_USER_PHOTOS); // Construct open request. OpenRequest openRequest; if (fragment == null) { openRequest = new OpenRequest(activity); } else { openRequest = new OpenRequest(fragment); } // Allow SSO login only because the web login does not allow PERMISSION_USER_PHOTOS to be bundled with the // first openForRead() call. openRequest.setLoginBehavior(SessionLoginBehavior.SSO_ONLY); openRequest.setPermissions(readPermissions); openRequest.setDefaultAudience(SessionDefaultAudience.EVERYONE); openRequest.setCallback(statusCallback); // Execute open request. session.openForRead(openRequest); }
java
private void startOpenSessionRequest(final Activity activity, final Fragment fragment) { // State transition. mLinkRequestState = STATE_OPEN_SESSION_REQUEST; // Construct status callback. Session.StatusCallback statusCallback = new Session.StatusCallback() { @Override public void call(Session session, SessionState state, Exception exception) { if (mLinkRequestState == STATE_OPEN_SESSION_REQUEST && state.isOpened()) { // Request publish permissions. if (!startPublishPermissionsRequest(activity, fragment)) { handleLinkError(); } } } }; // Construct new session. Session session = new Session(activity); Session.setActiveSession(session); // Construct read permissions to request for. List<String> readPermissions = new LinkedList<String>(); readPermissions.add(PERMISSION_PUBLIC_PROFILE); readPermissions.add(PERMISSION_USER_PHOTOS); // Construct open request. OpenRequest openRequest; if (fragment == null) { openRequest = new OpenRequest(activity); } else { openRequest = new OpenRequest(fragment); } // Allow SSO login only because the web login does not allow PERMISSION_USER_PHOTOS to be bundled with the // first openForRead() call. openRequest.setLoginBehavior(SessionLoginBehavior.SSO_ONLY); openRequest.setPermissions(readPermissions); openRequest.setDefaultAudience(SessionDefaultAudience.EVERYONE); openRequest.setCallback(statusCallback); // Execute open request. session.openForRead(openRequest); }
[ "private", "void", "startOpenSessionRequest", "(", "final", "Activity", "activity", ",", "final", "Fragment", "fragment", ")", "{", "// State transition.", "mLinkRequestState", "=", "STATE_OPEN_SESSION_REQUEST", ";", "// Construct status callback.", "Session", ".", "StatusCallback", "statusCallback", "=", "new", "Session", ".", "StatusCallback", "(", ")", "{", "@", "Override", "public", "void", "call", "(", "Session", "session", ",", "SessionState", "state", ",", "Exception", "exception", ")", "{", "if", "(", "mLinkRequestState", "==", "STATE_OPEN_SESSION_REQUEST", "&&", "state", ".", "isOpened", "(", ")", ")", "{", "// Request publish permissions.", "if", "(", "!", "startPublishPermissionsRequest", "(", "activity", ",", "fragment", ")", ")", "{", "handleLinkError", "(", ")", ";", "}", "}", "}", "}", ";", "// Construct new session.", "Session", "session", "=", "new", "Session", "(", "activity", ")", ";", "Session", ".", "setActiveSession", "(", "session", ")", ";", "// Construct read permissions to request for.", "List", "<", "String", ">", "readPermissions", "=", "new", "LinkedList", "<", "String", ">", "(", ")", ";", "readPermissions", ".", "add", "(", "PERMISSION_PUBLIC_PROFILE", ")", ";", "readPermissions", ".", "add", "(", "PERMISSION_USER_PHOTOS", ")", ";", "// Construct open request.", "OpenRequest", "openRequest", ";", "if", "(", "fragment", "==", "null", ")", "{", "openRequest", "=", "new", "OpenRequest", "(", "activity", ")", ";", "}", "else", "{", "openRequest", "=", "new", "OpenRequest", "(", "fragment", ")", ";", "}", "// Allow SSO login only because the web login does not allow PERMISSION_USER_PHOTOS to be bundled with the", "// first openForRead() call.", "openRequest", ".", "setLoginBehavior", "(", "SessionLoginBehavior", ".", "SSO_ONLY", ")", ";", "openRequest", ".", "setPermissions", "(", "readPermissions", ")", ";", "openRequest", ".", "setDefaultAudience", "(", "SessionDefaultAudience", ".", "EVERYONE", ")", ";", "openRequest", ".", "setCallback", "(", "statusCallback", ")", ";", "// Execute open request.", "session", ".", "openForRead", "(", "openRequest", ")", ";", "}" ]
Opens a new session with read permissions. @param activity the {@link Activity}. @param fragment the {@link Fragment}. May be null.
[ "Opens", "a", "new", "session", "with", "read", "permissions", "." ]
03d2827c30ef55f2db4e23f7500e016c7771fa39
https://github.com/groundupworks/wings/blob/03d2827c30ef55f2db4e23f7500e016c7771fa39/wings-facebook/src/main/java/com/groundupworks/wings/facebook/FacebookEndpoint.java#L309-L352
148,523
groundupworks/wings
wings-facebook/src/main/java/com/groundupworks/wings/facebook/FacebookEndpoint.java
FacebookEndpoint.isFacebookAppInstalled
private boolean isFacebookAppInstalled() { boolean isInstalled = false; try { // An exception will be thrown if the package is not found. mContext.getPackageManager().getApplicationInfo(FACEBOOK_APP_PACKAGE, 0); isInstalled = true; } catch (PackageManager.NameNotFoundException e) { // Do nothing. } return isInstalled; }
java
private boolean isFacebookAppInstalled() { boolean isInstalled = false; try { // An exception will be thrown if the package is not found. mContext.getPackageManager().getApplicationInfo(FACEBOOK_APP_PACKAGE, 0); isInstalled = true; } catch (PackageManager.NameNotFoundException e) { // Do nothing. } return isInstalled; }
[ "private", "boolean", "isFacebookAppInstalled", "(", ")", "{", "boolean", "isInstalled", "=", "false", ";", "try", "{", "// An exception will be thrown if the package is not found.", "mContext", ".", "getPackageManager", "(", ")", ".", "getApplicationInfo", "(", "FACEBOOK_APP_PACKAGE", ",", "0", ")", ";", "isInstalled", "=", "true", ";", "}", "catch", "(", "PackageManager", ".", "NameNotFoundException", "e", ")", "{", "// Do nothing.", "}", "return", "isInstalled", ";", "}" ]
Checks if the Facebook native app is installed on the device. @return true if installed; false otherwise.
[ "Checks", "if", "the", "Facebook", "native", "app", "is", "installed", "on", "the", "device", "." ]
03d2827c30ef55f2db4e23f7500e016c7771fa39
https://github.com/groundupworks/wings/blob/03d2827c30ef55f2db4e23f7500e016c7771fa39/wings-facebook/src/main/java/com/groundupworks/wings/facebook/FacebookEndpoint.java#L496-L506
148,524
groundupworks/wings
wings-facebook/src/main/java/com/groundupworks/wings/facebook/FacebookEndpoint.java
FacebookEndpoint.link
private boolean link(FacebookSettings settings) { boolean isSuccessful = false; // Validate account params and store. if (settings != null) { storeSettings(settings); // Emit link state change event. notifyLinkStateChanged(new LinkEvent(true)); isSuccessful = true; } return isSuccessful; }
java
private boolean link(FacebookSettings settings) { boolean isSuccessful = false; // Validate account params and store. if (settings != null) { storeSettings(settings); // Emit link state change event. notifyLinkStateChanged(new LinkEvent(true)); isSuccessful = true; } return isSuccessful; }
[ "private", "boolean", "link", "(", "FacebookSettings", "settings", ")", "{", "boolean", "isSuccessful", "=", "false", ";", "// Validate account params and store.", "if", "(", "settings", "!=", "null", ")", "{", "storeSettings", "(", "settings", ")", ";", "// Emit link state change event.", "notifyLinkStateChanged", "(", "new", "LinkEvent", "(", "true", ")", ")", ";", "isSuccessful", "=", "true", ";", "}", "return", "isSuccessful", ";", "}" ]
Links an account. @param settings the {@link com.groundupworks.wings.facebook.FacebookSettings}. @return true if successful; false otherwise.
[ "Links", "an", "account", "." ]
03d2827c30ef55f2db4e23f7500e016c7771fa39
https://github.com/groundupworks/wings/blob/03d2827c30ef55f2db4e23f7500e016c7771fa39/wings-facebook/src/main/java/com/groundupworks/wings/facebook/FacebookEndpoint.java#L514-L527
148,525
groundupworks/wings
wings-facebook/src/main/java/com/groundupworks/wings/facebook/FacebookEndpoint.java
FacebookEndpoint.showFacebookAppError
private void showFacebookAppError() { Toast.makeText(mContext, mContext.getString(R.string.wings_facebook__error_facebook_app), Toast.LENGTH_SHORT).show(); }
java
private void showFacebookAppError() { Toast.makeText(mContext, mContext.getString(R.string.wings_facebook__error_facebook_app), Toast.LENGTH_SHORT).show(); }
[ "private", "void", "showFacebookAppError", "(", ")", "{", "Toast", ".", "makeText", "(", "mContext", ",", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_facebook__error_facebook_app", ")", ",", "Toast", ".", "LENGTH_SHORT", ")", ".", "show", "(", ")", ";", "}" ]
Displays the Facebook app error message.
[ "Displays", "the", "Facebook", "app", "error", "message", "." ]
03d2827c30ef55f2db4e23f7500e016c7771fa39
https://github.com/groundupworks/wings/blob/03d2827c30ef55f2db4e23f7500e016c7771fa39/wings-facebook/src/main/java/com/groundupworks/wings/facebook/FacebookEndpoint.java#L557-L559
148,526
groundupworks/wings
wings-facebook/src/main/java/com/groundupworks/wings/facebook/FacebookEndpoint.java
FacebookEndpoint.storeSettings
private void storeSettings(FacebookSettings settings) { int destinationId = settings.getDestinationId(); String accountName = settings.getAccountName(); String albumName = settings.getAlbumName(); String albumGraphPath = settings.getAlbumGraphPath(); String pageAccessToken = settings.optPageAccessToken(); String photoPrivacy = settings.optPhotoPrivacy(); Editor editor = PreferenceManager.getDefaultSharedPreferences(mContext).edit(); editor.putInt(mContext.getString(R.string.wings_facebook__destination_id_key), destinationId); editor.putString(mContext.getString(R.string.wings_facebook__account_name_key), accountName); editor.putString(mContext.getString(R.string.wings_facebook__album_name_key), albumName); editor.putString(mContext.getString(R.string.wings_facebook__album_graph_path_key), albumGraphPath); if (!TextUtils.isEmpty(pageAccessToken)) { editor.putString(mContext.getString(R.string.wings_facebook__page_access_token_key), pageAccessToken); } if (!TextUtils.isEmpty(photoPrivacy)) { editor.putString(mContext.getString(R.string.wings_facebook__photo_privacy_key), photoPrivacy); } // Set preference to linked. editor.putBoolean(mContext.getString(R.string.wings_facebook__link_key), true); editor.apply(); }
java
private void storeSettings(FacebookSettings settings) { int destinationId = settings.getDestinationId(); String accountName = settings.getAccountName(); String albumName = settings.getAlbumName(); String albumGraphPath = settings.getAlbumGraphPath(); String pageAccessToken = settings.optPageAccessToken(); String photoPrivacy = settings.optPhotoPrivacy(); Editor editor = PreferenceManager.getDefaultSharedPreferences(mContext).edit(); editor.putInt(mContext.getString(R.string.wings_facebook__destination_id_key), destinationId); editor.putString(mContext.getString(R.string.wings_facebook__account_name_key), accountName); editor.putString(mContext.getString(R.string.wings_facebook__album_name_key), albumName); editor.putString(mContext.getString(R.string.wings_facebook__album_graph_path_key), albumGraphPath); if (!TextUtils.isEmpty(pageAccessToken)) { editor.putString(mContext.getString(R.string.wings_facebook__page_access_token_key), pageAccessToken); } if (!TextUtils.isEmpty(photoPrivacy)) { editor.putString(mContext.getString(R.string.wings_facebook__photo_privacy_key), photoPrivacy); } // Set preference to linked. editor.putBoolean(mContext.getString(R.string.wings_facebook__link_key), true); editor.apply(); }
[ "private", "void", "storeSettings", "(", "FacebookSettings", "settings", ")", "{", "int", "destinationId", "=", "settings", ".", "getDestinationId", "(", ")", ";", "String", "accountName", "=", "settings", ".", "getAccountName", "(", ")", ";", "String", "albumName", "=", "settings", ".", "getAlbumName", "(", ")", ";", "String", "albumGraphPath", "=", "settings", ".", "getAlbumGraphPath", "(", ")", ";", "String", "pageAccessToken", "=", "settings", ".", "optPageAccessToken", "(", ")", ";", "String", "photoPrivacy", "=", "settings", ".", "optPhotoPrivacy", "(", ")", ";", "Editor", "editor", "=", "PreferenceManager", ".", "getDefaultSharedPreferences", "(", "mContext", ")", ".", "edit", "(", ")", ";", "editor", ".", "putInt", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_facebook__destination_id_key", ")", ",", "destinationId", ")", ";", "editor", ".", "putString", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_facebook__account_name_key", ")", ",", "accountName", ")", ";", "editor", ".", "putString", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_facebook__album_name_key", ")", ",", "albumName", ")", ";", "editor", ".", "putString", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_facebook__album_graph_path_key", ")", ",", "albumGraphPath", ")", ";", "if", "(", "!", "TextUtils", ".", "isEmpty", "(", "pageAccessToken", ")", ")", "{", "editor", ".", "putString", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_facebook__page_access_token_key", ")", ",", "pageAccessToken", ")", ";", "}", "if", "(", "!", "TextUtils", ".", "isEmpty", "(", "photoPrivacy", ")", ")", "{", "editor", ".", "putString", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_facebook__photo_privacy_key", ")", ",", "photoPrivacy", ")", ";", "}", "// Set preference to linked.", "editor", ".", "putBoolean", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_facebook__link_key", ")", ",", "true", ")", ";", "editor", ".", "apply", "(", ")", ";", "}" ]
Stores the link settings in persisted storage. @param settings the {@link com.groundupworks.wings.facebook.FacebookSettings}.
[ "Stores", "the", "link", "settings", "in", "persisted", "storage", "." ]
03d2827c30ef55f2db4e23f7500e016c7771fa39
https://github.com/groundupworks/wings/blob/03d2827c30ef55f2db4e23f7500e016c7771fa39/wings-facebook/src/main/java/com/groundupworks/wings/facebook/FacebookEndpoint.java#L566-L589
148,527
groundupworks/wings
wings-facebook/src/main/java/com/groundupworks/wings/facebook/FacebookEndpoint.java
FacebookEndpoint.fetchSettings
private FacebookSettings fetchSettings() { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mContext); if (!preferences.getBoolean(mContext.getString(R.string.wings_facebook__link_key), false)) { return null; } int destinationId = preferences.getInt(mContext.getString(R.string.wings_facebook__destination_id_key), DestinationId.UNLINKED); String accountName = preferences.getString(mContext.getString(R.string.wings_facebook__account_name_key), null); String albumName = preferences.getString(mContext.getString(R.string.wings_facebook__album_name_key), null); String albumGraphPath = preferences.getString(mContext.getString(R.string.wings_facebook__album_graph_path_key), null); String pageAccessToken = preferences.getString(mContext.getString(R.string.wings_facebook__page_access_token_key), null); String photoPrivacy = preferences.getString(mContext.getString(R.string.wings_facebook__photo_privacy_key), null); return FacebookSettings.newInstance(destinationId, accountName, albumName, albumGraphPath, pageAccessToken, photoPrivacy); }
java
private FacebookSettings fetchSettings() { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mContext); if (!preferences.getBoolean(mContext.getString(R.string.wings_facebook__link_key), false)) { return null; } int destinationId = preferences.getInt(mContext.getString(R.string.wings_facebook__destination_id_key), DestinationId.UNLINKED); String accountName = preferences.getString(mContext.getString(R.string.wings_facebook__account_name_key), null); String albumName = preferences.getString(mContext.getString(R.string.wings_facebook__album_name_key), null); String albumGraphPath = preferences.getString(mContext.getString(R.string.wings_facebook__album_graph_path_key), null); String pageAccessToken = preferences.getString(mContext.getString(R.string.wings_facebook__page_access_token_key), null); String photoPrivacy = preferences.getString(mContext.getString(R.string.wings_facebook__photo_privacy_key), null); return FacebookSettings.newInstance(destinationId, accountName, albumName, albumGraphPath, pageAccessToken, photoPrivacy); }
[ "private", "FacebookSettings", "fetchSettings", "(", ")", "{", "SharedPreferences", "preferences", "=", "PreferenceManager", ".", "getDefaultSharedPreferences", "(", "mContext", ")", ";", "if", "(", "!", "preferences", ".", "getBoolean", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_facebook__link_key", ")", ",", "false", ")", ")", "{", "return", "null", ";", "}", "int", "destinationId", "=", "preferences", ".", "getInt", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_facebook__destination_id_key", ")", ",", "DestinationId", ".", "UNLINKED", ")", ";", "String", "accountName", "=", "preferences", ".", "getString", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_facebook__account_name_key", ")", ",", "null", ")", ";", "String", "albumName", "=", "preferences", ".", "getString", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_facebook__album_name_key", ")", ",", "null", ")", ";", "String", "albumGraphPath", "=", "preferences", ".", "getString", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_facebook__album_graph_path_key", ")", ",", "null", ")", ";", "String", "pageAccessToken", "=", "preferences", ".", "getString", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_facebook__page_access_token_key", ")", ",", "null", ")", ";", "String", "photoPrivacy", "=", "preferences", ".", "getString", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_facebook__photo_privacy_key", ")", ",", "null", ")", ";", "return", "FacebookSettings", ".", "newInstance", "(", "destinationId", ",", "accountName", ",", "albumName", ",", "albumGraphPath", ",", "pageAccessToken", ",", "photoPrivacy", ")", ";", "}" ]
Fetches the link settings from persisted storage. @return the {@link com.groundupworks.wings.facebook.FacebookSettings}; or null if unlinked.
[ "Fetches", "the", "link", "settings", "from", "persisted", "storage", "." ]
03d2827c30ef55f2db4e23f7500e016c7771fa39
https://github.com/groundupworks/wings/blob/03d2827c30ef55f2db4e23f7500e016c7771fa39/wings-facebook/src/main/java/com/groundupworks/wings/facebook/FacebookEndpoint.java#L596-L610
148,528
groundupworks/wings
wings-facebook/src/main/java/com/groundupworks/wings/facebook/FacebookEndpoint.java
FacebookEndpoint.removeSettings
private void removeSettings() { Editor editor = PreferenceManager.getDefaultSharedPreferences(mContext).edit(); editor.remove(mContext.getString(R.string.wings_facebook__destination_id_key)); editor.remove(mContext.getString(R.string.wings_facebook__account_name_key)); editor.remove(mContext.getString(R.string.wings_facebook__album_name_key)); editor.remove(mContext.getString(R.string.wings_facebook__album_graph_path_key)); editor.remove(mContext.getString(R.string.wings_facebook__page_access_token_key)); editor.remove(mContext.getString(R.string.wings_facebook__photo_privacy_key)); // Set preference to unlinked. editor.putBoolean(mContext.getString(R.string.wings_facebook__link_key), false); editor.apply(); }
java
private void removeSettings() { Editor editor = PreferenceManager.getDefaultSharedPreferences(mContext).edit(); editor.remove(mContext.getString(R.string.wings_facebook__destination_id_key)); editor.remove(mContext.getString(R.string.wings_facebook__account_name_key)); editor.remove(mContext.getString(R.string.wings_facebook__album_name_key)); editor.remove(mContext.getString(R.string.wings_facebook__album_graph_path_key)); editor.remove(mContext.getString(R.string.wings_facebook__page_access_token_key)); editor.remove(mContext.getString(R.string.wings_facebook__photo_privacy_key)); // Set preference to unlinked. editor.putBoolean(mContext.getString(R.string.wings_facebook__link_key), false); editor.apply(); }
[ "private", "void", "removeSettings", "(", ")", "{", "Editor", "editor", "=", "PreferenceManager", ".", "getDefaultSharedPreferences", "(", "mContext", ")", ".", "edit", "(", ")", ";", "editor", ".", "remove", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_facebook__destination_id_key", ")", ")", ";", "editor", ".", "remove", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_facebook__account_name_key", ")", ")", ";", "editor", ".", "remove", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_facebook__album_name_key", ")", ")", ";", "editor", ".", "remove", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_facebook__album_graph_path_key", ")", ")", ";", "editor", ".", "remove", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_facebook__page_access_token_key", ")", ")", ";", "editor", ".", "remove", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_facebook__photo_privacy_key", ")", ")", ";", "// Set preference to unlinked.", "editor", ".", "putBoolean", "(", "mContext", ".", "getString", "(", "R", ".", "string", ".", "wings_facebook__link_key", ")", ",", "false", ")", ";", "editor", ".", "apply", "(", ")", ";", "}" ]
Removes the link settings from persisted storage.
[ "Removes", "the", "link", "settings", "from", "persisted", "storage", "." ]
03d2827c30ef55f2db4e23f7500e016c7771fa39
https://github.com/groundupworks/wings/blob/03d2827c30ef55f2db4e23f7500e016c7771fa39/wings-facebook/src/main/java/com/groundupworks/wings/facebook/FacebookEndpoint.java#L615-L627
148,529
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/Epic.java
Epic.getChildEpics
public Collection<Epic> getChildEpics(EpicFilter filter) { filter = (filter != null) ? filter : new EpicFilter(); filter.parent.clear(); filter.parent.add(this); return getInstance().get().epics(filter); }
java
public Collection<Epic> getChildEpics(EpicFilter filter) { filter = (filter != null) ? filter : new EpicFilter(); filter.parent.clear(); filter.parent.add(this); return getInstance().get().epics(filter); }
[ "public", "Collection", "<", "Epic", ">", "getChildEpics", "(", "EpicFilter", "filter", ")", "{", "filter", "=", "(", "filter", "!=", "null", ")", "?", "filter", ":", "new", "EpicFilter", "(", ")", ";", "filter", ".", "parent", ".", "clear", "(", ")", ";", "filter", ".", "parent", ".", "add", "(", "this", ")", ";", "return", "getInstance", "(", ")", ".", "get", "(", ")", ".", "epics", "(", "filter", ")", ";", "}" ]
Epics that are immediate children of this Epic. @param filter Limit the epic returned (If null, then all items returned). @return A collection epics that belong to this epic filtered by the passed in filter.
[ "Epics", "that", "are", "immediate", "children", "of", "this", "Epic", "." ]
59d35b67c849299631bca45ee94143237eb2ae1a
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Epic.java#L143-L148
148,530
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/Epic.java
Epic.getChildStories
public Collection<Story> getChildStories(StoryFilter filter) { filter = (filter != null) ? filter : new StoryFilter(); filter.epic.clear(); filter.epic.add(this); return getInstance().get().story(filter); }
java
public Collection<Story> getChildStories(StoryFilter filter) { filter = (filter != null) ? filter : new StoryFilter(); filter.epic.clear(); filter.epic.add(this); return getInstance().get().story(filter); }
[ "public", "Collection", "<", "Story", ">", "getChildStories", "(", "StoryFilter", "filter", ")", "{", "filter", "=", "(", "filter", "!=", "null", ")", "?", "filter", ":", "new", "StoryFilter", "(", ")", ";", "filter", ".", "epic", ".", "clear", "(", ")", ";", "filter", ".", "epic", ".", "add", "(", "this", ")", ";", "return", "getInstance", "(", ")", ".", "get", "(", ")", ".", "story", "(", "filter", ")", ";", "}" ]
Stories that are immediate children of this Epic. @param filter Limit the story returned (If null, then all items returned). @return A collection stories that belong to this epic filtered by the passed in filter.
[ "Stories", "that", "are", "immediate", "children", "of", "this", "Epic", "." ]
59d35b67c849299631bca45ee94143237eb2ae1a
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Epic.java#L158-L163
148,531
agmip/ace-core
src/main/java/org/agmip/ace/AceDataset.java
AceDataset.getExperiment
public AceExperiment getExperiment(String exname) { if (this.eidMap.containsKey(exname)) { return this.experimentMap.get(eidMap.get(exname)); } else { return null; } }
java
public AceExperiment getExperiment(String exname) { if (this.eidMap.containsKey(exname)) { return this.experimentMap.get(eidMap.get(exname)); } else { return null; } }
[ "public", "AceExperiment", "getExperiment", "(", "String", "exname", ")", "{", "if", "(", "this", ".", "eidMap", ".", "containsKey", "(", "exname", ")", ")", "{", "return", "this", ".", "experimentMap", ".", "get", "(", "eidMap", ".", "get", "(", "exname", ")", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Return a Experiment by given experiment name. @param exname the experiment name @return {@link AceExperiment}
[ "Return", "a", "Experiment", "by", "given", "experiment", "name", "." ]
51957e79b4567d0083c52d0720f4a268c3a02f44
https://github.com/agmip/ace-core/blob/51957e79b4567d0083c52d0720f4a268c3a02f44/src/main/java/org/agmip/ace/AceDataset.java#L245-L251
148,532
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/EntityCollection.java
EntityCollection.add
@Override public boolean add(D item) throws UnsupportedOperationException { readOnlyGuardCondition(); instance.addRelation(entity, writeAttributeName, item); entity.save(); return true; }
java
@Override public boolean add(D item) throws UnsupportedOperationException { readOnlyGuardCondition(); instance.addRelation(entity, writeAttributeName, item); entity.save(); return true; }
[ "@", "Override", "public", "boolean", "add", "(", "D", "item", ")", "throws", "UnsupportedOperationException", "{", "readOnlyGuardCondition", "(", ")", ";", "instance", ".", "addRelation", "(", "entity", ",", "writeAttributeName", ",", "item", ")", ";", "entity", ".", "save", "(", ")", ";", "return", "true", ";", "}" ]
Add item to collection. @param item item for addition (must be Entity or subclass). @return if item add then will return true in the other case false. @throws UnsupportedOperationException if object is read only.
[ "Add", "item", "to", "collection", "." ]
59d35b67c849299631bca45ee94143237eb2ae1a
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/EntityCollection.java#L29-L35
148,533
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/EntityCollection.java
EntityCollection.clear
@Override public void clear() { readOnlyGuardCondition(); for (D item : this) { instance.removeRelation(entity, writeAttributeName, item); } entity.save(); }
java
@Override public void clear() { readOnlyGuardCondition(); for (D item : this) { instance.removeRelation(entity, writeAttributeName, item); } entity.save(); }
[ "@", "Override", "public", "void", "clear", "(", ")", "{", "readOnlyGuardCondition", "(", ")", ";", "for", "(", "D", "item", ":", "this", ")", "{", "instance", ".", "removeRelation", "(", "entity", ",", "writeAttributeName", ",", "item", ")", ";", "}", "entity", ".", "save", "(", ")", ";", "}" ]
Removes all of the elements from this collection. @throws UnsupportedOperationException if object is read only. @see java.util.Collection#clear().
[ "Removes", "all", "of", "the", "elements", "from", "this", "collection", "." ]
59d35b67c849299631bca45ee94143237eb2ae1a
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/EntityCollection.java#L43-L51
148,534
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/RegressionPlan.java
RegressionPlan.createRegressionSuite
public RegressionSuite createRegressionSuite(String name, Map<String, Object> attributes) { return getInstance().create().regressionSuite(name, this, attributes); }
java
public RegressionSuite createRegressionSuite(String name, Map<String, Object> attributes) { return getInstance().create().regressionSuite(name, this, attributes); }
[ "public", "RegressionSuite", "createRegressionSuite", "(", "String", "name", ",", "Map", "<", "String", ",", "Object", ">", "attributes", ")", "{", "return", "getInstance", "(", ")", ".", "create", "(", ")", ".", "regressionSuite", "(", "name", ",", "this", ",", "attributes", ")", ";", "}" ]
Create a new Regression Suite with title assigned with this Regression Plan. @param name Title of the suite. @param attributes Additional attributes for initialization Regression Suite. @return Regression Suite.
[ "Create", "a", "new", "Regression", "Suite", "with", "title", "assigned", "with", "this", "Regression", "Plan", "." ]
59d35b67c849299631bca45ee94143237eb2ae1a
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/RegressionPlan.java#L79-L81
148,535
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/RegressionPlan.java
RegressionPlan.getRegressionSuites
public Collection<RegressionSuite> getRegressionSuites(RegressionSuiteFilter filter) { filter = (filter != null) ? filter : new RegressionSuiteFilter(); filter.regressionPlan.clear(); filter.regressionPlan.add(this); return getInstance().get().regressionSuites(filter); }
java
public Collection<RegressionSuite> getRegressionSuites(RegressionSuiteFilter filter) { filter = (filter != null) ? filter : new RegressionSuiteFilter(); filter.regressionPlan.clear(); filter.regressionPlan.add(this); return getInstance().get().regressionSuites(filter); }
[ "public", "Collection", "<", "RegressionSuite", ">", "getRegressionSuites", "(", "RegressionSuiteFilter", "filter", ")", "{", "filter", "=", "(", "filter", "!=", "null", ")", "?", "filter", ":", "new", "RegressionSuiteFilter", "(", ")", ";", "filter", ".", "regressionPlan", ".", "clear", "(", ")", ";", "filter", ".", "regressionPlan", ".", "add", "(", "this", ")", ";", "return", "getInstance", "(", ")", ".", "get", "(", ")", ".", "regressionSuites", "(", "filter", ")", ";", "}" ]
Projects associated with this TestSuite. @param filter Criteria to filter on. If null, all RegressionSuites in the project are returned. @return An Collection of RegressionSuites.
[ "Projects", "associated", "with", "this", "TestSuite", "." ]
59d35b67c849299631bca45ee94143237eb2ae1a
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/RegressionPlan.java#L89-L96
148,536
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/Attachment.java
Attachment.writeTo
public void writeTo(OutputStream output) throws ApplicationUnavailableException { InputStream input = getInstance().getReader(this); try { V1Util.copyStream(input, output); } catch (IOException e) { throw new ApplicationUnavailableException(e); } finally { if (input != null) { try { input.close(); } catch (IOException e) { // do nothing } } } }
java
public void writeTo(OutputStream output) throws ApplicationUnavailableException { InputStream input = getInstance().getReader(this); try { V1Util.copyStream(input, output); } catch (IOException e) { throw new ApplicationUnavailableException(e); } finally { if (input != null) { try { input.close(); } catch (IOException e) { // do nothing } } } }
[ "public", "void", "writeTo", "(", "OutputStream", "output", ")", "throws", "ApplicationUnavailableException", "{", "InputStream", "input", "=", "getInstance", "(", ")", ".", "getReader", "(", "this", ")", ";", "try", "{", "V1Util", ".", "copyStream", "(", "input", ",", "output", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "ApplicationUnavailableException", "(", "e", ")", ";", "}", "finally", "{", "if", "(", "input", "!=", "null", ")", "{", "try", "{", "input", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "// do nothing", "}", "}", "}", "}" ]
Write this attachment's content to the output stream. @param output Stream to write the content to. @throws ApplicationUnavailableException if coping fails.
[ "Write", "this", "attachment", "s", "content", "to", "the", "output", "stream", "." ]
59d35b67c849299631bca45ee94143237eb2ae1a
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Attachment.java#L125-L142
148,537
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/Attachment.java
Attachment.readFrom
public void readFrom(InputStream input) throws ApplicationUnavailableException, AttachmentLengthExceededException { OutputStream output = null; try { output = getInstance().getWriter(this, getContentType()); V1Util.copyStream(input, output); getInstance().commitWriteStream(this); } catch (IOException e) { throw new ApplicationUnavailableException(e); } finally { if (output != null) { try { output.close(); } catch (IOException e) { // do nothing } } } }
java
public void readFrom(InputStream input) throws ApplicationUnavailableException, AttachmentLengthExceededException { OutputStream output = null; try { output = getInstance().getWriter(this, getContentType()); V1Util.copyStream(input, output); getInstance().commitWriteStream(this); } catch (IOException e) { throw new ApplicationUnavailableException(e); } finally { if (output != null) { try { output.close(); } catch (IOException e) { // do nothing } } } }
[ "public", "void", "readFrom", "(", "InputStream", "input", ")", "throws", "ApplicationUnavailableException", ",", "AttachmentLengthExceededException", "{", "OutputStream", "output", "=", "null", ";", "try", "{", "output", "=", "getInstance", "(", ")", ".", "getWriter", "(", "this", ",", "getContentType", "(", ")", ")", ";", "V1Util", ".", "copyStream", "(", "input", ",", "output", ")", ";", "getInstance", "(", ")", ".", "commitWriteStream", "(", "this", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "ApplicationUnavailableException", "(", "e", ")", ";", "}", "finally", "{", "if", "(", "output", "!=", "null", ")", "{", "try", "{", "output", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "// do nothing", "}", "}", "}", "}" ]
Read the attachment's content from the input stream. Set the ContentType and Filename properties before calling this method. @param input Stream to read the content from. @throws ApplicationUnavailableException if appears any problem with connection to service. @throws AttachmentLengthExceededException if attachment is too long.
[ "Read", "the", "attachment", "s", "content", "from", "the", "input", "stream", ".", "Set", "the", "ContentType", "and", "Filename", "properties", "before", "calling", "this", "method", "." ]
59d35b67c849299631bca45ee94143237eb2ae1a
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Attachment.java#L153-L173
148,538
agmip/ace-core
src/main/java/org/agmip/ace/AceExperiment.java
AceExperiment.generateId
public String generateId() throws IOException { HashCode currentHash = this.getRawComponentHash(); currentHash = AceFunctions.generateHCId(currentHash.asBytes(), this.ic.getRawComponentHash().asBytes()); for(AceRecord r: this.ic.getSoilLayers()) { currentHash = AceFunctions.generateHCId(currentHash.asBytes(), r.getRawComponentHash().asBytes()); } for(AceEvent e: this.events.asList()) { currentHash = AceFunctions.generateHCId(currentHash.asBytes(), e.getRawComponentHash().asBytes()); } currentHash = AceFunctions.generateHCId(currentHash.asBytes(), this.observed.getRawComponentHash().asBytes()); for(AceRecord r: this.observed.getTimeseries()) { currentHash = AceFunctions.generateHCId(currentHash.asBytes(), r.getRawComponentHash().asBytes()); } return currentHash.toString(); }
java
public String generateId() throws IOException { HashCode currentHash = this.getRawComponentHash(); currentHash = AceFunctions.generateHCId(currentHash.asBytes(), this.ic.getRawComponentHash().asBytes()); for(AceRecord r: this.ic.getSoilLayers()) { currentHash = AceFunctions.generateHCId(currentHash.asBytes(), r.getRawComponentHash().asBytes()); } for(AceEvent e: this.events.asList()) { currentHash = AceFunctions.generateHCId(currentHash.asBytes(), e.getRawComponentHash().asBytes()); } currentHash = AceFunctions.generateHCId(currentHash.asBytes(), this.observed.getRawComponentHash().asBytes()); for(AceRecord r: this.observed.getTimeseries()) { currentHash = AceFunctions.generateHCId(currentHash.asBytes(), r.getRawComponentHash().asBytes()); } return currentHash.toString(); }
[ "public", "String", "generateId", "(", ")", "throws", "IOException", "{", "HashCode", "currentHash", "=", "this", ".", "getRawComponentHash", "(", ")", ";", "currentHash", "=", "AceFunctions", ".", "generateHCId", "(", "currentHash", ".", "asBytes", "(", ")", ",", "this", ".", "ic", ".", "getRawComponentHash", "(", ")", ".", "asBytes", "(", ")", ")", ";", "for", "(", "AceRecord", "r", ":", "this", ".", "ic", ".", "getSoilLayers", "(", ")", ")", "{", "currentHash", "=", "AceFunctions", ".", "generateHCId", "(", "currentHash", ".", "asBytes", "(", ")", ",", "r", ".", "getRawComponentHash", "(", ")", ".", "asBytes", "(", ")", ")", ";", "}", "for", "(", "AceEvent", "e", ":", "this", ".", "events", ".", "asList", "(", ")", ")", "{", "currentHash", "=", "AceFunctions", ".", "generateHCId", "(", "currentHash", ".", "asBytes", "(", ")", ",", "e", ".", "getRawComponentHash", "(", ")", ".", "asBytes", "(", ")", ")", ";", "}", "currentHash", "=", "AceFunctions", ".", "generateHCId", "(", "currentHash", ".", "asBytes", "(", ")", ",", "this", ".", "observed", ".", "getRawComponentHash", "(", ")", ".", "asBytes", "(", ")", ")", ";", "for", "(", "AceRecord", "r", ":", "this", ".", "observed", ".", "getTimeseries", "(", ")", ")", "{", "currentHash", "=", "AceFunctions", ".", "generateHCId", "(", "currentHash", ".", "asBytes", "(", ")", ",", "r", ".", "getRawComponentHash", "(", ")", ".", "asBytes", "(", ")", ")", ";", "}", "return", "currentHash", ".", "toString", "(", ")", ";", "}" ]
able to trigger this method?
[ "able", "to", "trigger", "this", "method?" ]
51957e79b4567d0083c52d0720f4a268c3a02f44
https://github.com/agmip/ace-core/blob/51957e79b4567d0083c52d0720f4a268c3a02f44/src/main/java/org/agmip/ace/AceExperiment.java#L55-L69
148,539
luuuis/jcalendar
src/main/java/com/toedter/calendar/demo/DateChooserPanel.java
DateChooserPanel.setDateFormatString
public void setDateFormatString(String dfString) { for (int i = 0; i < 4; i++) { ((JDateChooser) components[i]).setDateFormatString(dfString); } }
java
public void setDateFormatString(String dfString) { for (int i = 0; i < 4; i++) { ((JDateChooser) components[i]).setDateFormatString(dfString); } }
[ "public", "void", "setDateFormatString", "(", "String", "dfString", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "4", ";", "i", "++", ")", "{", "(", "(", "JDateChooser", ")", "components", "[", "i", "]", ")", ".", "setDateFormatString", "(", "dfString", ")", ";", "}", "}" ]
Sets the date format string. E.g "MMMMM d, yyyy" will result in "July 21, 2004" if this is the selected date and locale is English. @param dfString The dateFormatString to set.
[ "Sets", "the", "date", "format", "string", ".", "E", ".", "g", "MMMMM", "d", "yyyy", "will", "result", "in", "July", "21", "2004", "if", "this", "is", "the", "selected", "date", "and", "locale", "is", "English", "." ]
442e5bc319d92dee93400e6180ca74a5b6bd7775
https://github.com/luuuis/jcalendar/blob/442e5bc319d92dee93400e6180ca74a5b6bd7775/src/main/java/com/toedter/calendar/demo/DateChooserPanel.java#L111-L115
148,540
luuuis/jcalendar
src/main/java/com/toedter/calendar/demo/DateChooserPanel.java
DateChooserPanel.setLocale
public void setLocale(Locale locale) { for (int i = 0; i < 5; i++) { components[i].setLocale(locale); } }
java
public void setLocale(Locale locale) { for (int i = 0; i < 5; i++) { components[i].setLocale(locale); } }
[ "public", "void", "setLocale", "(", "Locale", "locale", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "5", ";", "i", "++", ")", "{", "components", "[", "i", "]", ".", "setLocale", "(", "locale", ")", ";", "}", "}" ]
Sets the locale of the first 4 JDateChoosers.
[ "Sets", "the", "locale", "of", "the", "first", "4", "JDateChoosers", "." ]
442e5bc319d92dee93400e6180ca74a5b6bd7775
https://github.com/luuuis/jcalendar/blob/442e5bc319d92dee93400e6180ca74a5b6bd7775/src/main/java/com/toedter/calendar/demo/DateChooserPanel.java#L155-L159
148,541
brunocvcunha/ghostme4j
src/main/java/org/brunocvcunha/ghostme4j/model/Proxy.java
Proxy.updateStatus
public void updateStatus() { String hostaddr = null; try { hostaddr = InetAddress.getByName(ip).getHostAddress(); } catch (UnknownHostException e) { online = false; latency = Long.MAX_VALUE; return; } int total = 0; long totalPing = 0; // test ping 4 times int times = 4; while (total < times) { total++; long start = System.currentTimeMillis(); SocketAddress sockaddr = new InetSocketAddress(hostaddr, port); try (Socket socket = new Socket()) { socket.connect(sockaddr, 1000); } catch (Exception e) { online = false; return; } totalPing += (System.currentTimeMillis() - start); } online = true; latency = totalPing / total; }
java
public void updateStatus() { String hostaddr = null; try { hostaddr = InetAddress.getByName(ip).getHostAddress(); } catch (UnknownHostException e) { online = false; latency = Long.MAX_VALUE; return; } int total = 0; long totalPing = 0; // test ping 4 times int times = 4; while (total < times) { total++; long start = System.currentTimeMillis(); SocketAddress sockaddr = new InetSocketAddress(hostaddr, port); try (Socket socket = new Socket()) { socket.connect(sockaddr, 1000); } catch (Exception e) { online = false; return; } totalPing += (System.currentTimeMillis() - start); } online = true; latency = totalPing / total; }
[ "public", "void", "updateStatus", "(", ")", "{", "String", "hostaddr", "=", "null", ";", "try", "{", "hostaddr", "=", "InetAddress", ".", "getByName", "(", "ip", ")", ".", "getHostAddress", "(", ")", ";", "}", "catch", "(", "UnknownHostException", "e", ")", "{", "online", "=", "false", ";", "latency", "=", "Long", ".", "MAX_VALUE", ";", "return", ";", "}", "int", "total", "=", "0", ";", "long", "totalPing", "=", "0", ";", "// test ping 4 times", "int", "times", "=", "4", ";", "while", "(", "total", "<", "times", ")", "{", "total", "++", ";", "long", "start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "SocketAddress", "sockaddr", "=", "new", "InetSocketAddress", "(", "hostaddr", ",", "port", ")", ";", "try", "(", "Socket", "socket", "=", "new", "Socket", "(", ")", ")", "{", "socket", ".", "connect", "(", "sockaddr", ",", "1000", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "online", "=", "false", ";", "return", ";", "}", "totalPing", "+=", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "start", ")", ";", "}", "online", "=", "true", ";", "latency", "=", "totalPing", "/", "total", ";", "}" ]
Update the proxy status
[ "Update", "the", "proxy", "status" ]
c763a0d5f78ed0860e63d27afa0330b92eb0400c
https://github.com/brunocvcunha/ghostme4j/blob/c763a0d5f78ed0860e63d27afa0330b92eb0400c/src/main/java/org/brunocvcunha/ghostme4j/model/Proxy.java#L167-L201
148,542
brunocvcunha/ghostme4j
src/main/java/org/brunocvcunha/ghostme4j/model/Proxy.java
Proxy.updateAnonymity
public void updateAnonymity() throws IOException { ProxyBinResponse response = GhostMeHelper.getMyInformation(this.getJavaNetProxy()); if (!response.getOrigin().equalsIgnoreCase(this.getIp())) { anonymous = false; return; } if (!response.getHeaders().get("X-Forwarded-For").equalsIgnoreCase(this.getIp())) { anonymous = false; return; } if (!response.getHeaders().get("X-Real-Ip").equalsIgnoreCase(this.getIp())) { anonymous = false; return; } anonymous = true; }
java
public void updateAnonymity() throws IOException { ProxyBinResponse response = GhostMeHelper.getMyInformation(this.getJavaNetProxy()); if (!response.getOrigin().equalsIgnoreCase(this.getIp())) { anonymous = false; return; } if (!response.getHeaders().get("X-Forwarded-For").equalsIgnoreCase(this.getIp())) { anonymous = false; return; } if (!response.getHeaders().get("X-Real-Ip").equalsIgnoreCase(this.getIp())) { anonymous = false; return; } anonymous = true; }
[ "public", "void", "updateAnonymity", "(", ")", "throws", "IOException", "{", "ProxyBinResponse", "response", "=", "GhostMeHelper", ".", "getMyInformation", "(", "this", ".", "getJavaNetProxy", "(", ")", ")", ";", "if", "(", "!", "response", ".", "getOrigin", "(", ")", ".", "equalsIgnoreCase", "(", "this", ".", "getIp", "(", ")", ")", ")", "{", "anonymous", "=", "false", ";", "return", ";", "}", "if", "(", "!", "response", ".", "getHeaders", "(", ")", ".", "get", "(", "\"X-Forwarded-For\"", ")", ".", "equalsIgnoreCase", "(", "this", ".", "getIp", "(", ")", ")", ")", "{", "anonymous", "=", "false", ";", "return", ";", "}", "if", "(", "!", "response", ".", "getHeaders", "(", ")", ".", "get", "(", "\"X-Real-Ip\"", ")", ".", "equalsIgnoreCase", "(", "this", ".", "getIp", "(", ")", ")", ")", "{", "anonymous", "=", "false", ";", "return", ";", "}", "anonymous", "=", "true", ";", "}" ]
Update the anonymous status of the proxy @throws IOException I/O error
[ "Update", "the", "anonymous", "status", "of", "the", "proxy" ]
c763a0d5f78ed0860e63d27afa0330b92eb0400c
https://github.com/brunocvcunha/ghostme4j/blob/c763a0d5f78ed0860e63d27afa0330b92eb0400c/src/main/java/org/brunocvcunha/ghostme4j/model/Proxy.java#L208-L228
148,543
craterdog/java-security-framework
java-secure-messaging-api/src/main/java/craterdog/security/MessageCryptex.java
MessageCryptex.encodeBytes
public final String encodeBytes(byte[] bytes) { logger.entry(); String base64String = Base64Utils.encode(bytes); logger.exit(); return base64String; }
java
public final String encodeBytes(byte[] bytes) { logger.entry(); String base64String = Base64Utils.encode(bytes); logger.exit(); return base64String; }
[ "public", "final", "String", "encodeBytes", "(", "byte", "[", "]", "bytes", ")", "{", "logger", ".", "entry", "(", ")", ";", "String", "base64String", "=", "Base64Utils", ".", "encode", "(", "bytes", ")", ";", "logger", ".", "exit", "(", ")", ";", "return", "base64String", ";", "}" ]
This method encodes a byte array into a base 64 string. @param bytes The byte array to be encoded. @return The base 64 encoded string for those bytes.
[ "This", "method", "encodes", "a", "byte", "array", "into", "a", "base", "64", "string", "." ]
a5634c19812d473b608bc11060f5cbb4b4b0b5da
https://github.com/craterdog/java-security-framework/blob/a5634c19812d473b608bc11060f5cbb4b4b0b5da/java-secure-messaging-api/src/main/java/craterdog/security/MessageCryptex.java#L46-L51
148,544
craterdog/java-security-framework
java-secure-messaging-api/src/main/java/craterdog/security/MessageCryptex.java
MessageCryptex.decodeString
public final byte[] decodeString(String base64String) { logger.entry(); byte[] decodedBytes = Base64Utils.decode(base64String); logger.exit(); return decodedBytes; }
java
public final byte[] decodeString(String base64String) { logger.entry(); byte[] decodedBytes = Base64Utils.decode(base64String); logger.exit(); return decodedBytes; }
[ "public", "final", "byte", "[", "]", "decodeString", "(", "String", "base64String", ")", "{", "logger", ".", "entry", "(", ")", ";", "byte", "[", "]", "decodedBytes", "=", "Base64Utils", ".", "decode", "(", "base64String", ")", ";", "logger", ".", "exit", "(", ")", ";", "return", "decodedBytes", ";", "}" ]
This method decodes a base 64 string into its original bytes. @param base64String The base 64 encoded string. @return The corresponding decoded bytes.
[ "This", "method", "decodes", "a", "base", "64", "string", "into", "its", "original", "bytes", "." ]
a5634c19812d473b608bc11060f5cbb4b4b0b5da
https://github.com/craterdog/java-security-framework/blob/a5634c19812d473b608bc11060f5cbb4b4b0b5da/java-secure-messaging-api/src/main/java/craterdog/security/MessageCryptex.java#L76-L81
148,545
craterdog/java-security-framework
java-secure-messaging-api/src/main/java/craterdog/security/MessageCryptex.java
MessageCryptex.encryptString
public final byte[] encryptString(SecretKey sharedKey, String string) { logger.entry(); try (ByteArrayInputStream input = new ByteArrayInputStream(string.getBytes("UTF-8")); ByteArrayOutputStream output = new ByteArrayOutputStream()) { encryptStream(sharedKey, input, output); output.flush(); byte[] encryptedString = output.toByteArray(); logger.exit(); return encryptedString; } catch (IOException e) { // should never happen! RuntimeException exception = new RuntimeException("An unexpected exception occured while trying to encrypt a string.", e); logger.error(exception.toString()); throw exception; } }
java
public final byte[] encryptString(SecretKey sharedKey, String string) { logger.entry(); try (ByteArrayInputStream input = new ByteArrayInputStream(string.getBytes("UTF-8")); ByteArrayOutputStream output = new ByteArrayOutputStream()) { encryptStream(sharedKey, input, output); output.flush(); byte[] encryptedString = output.toByteArray(); logger.exit(); return encryptedString; } catch (IOException e) { // should never happen! RuntimeException exception = new RuntimeException("An unexpected exception occured while trying to encrypt a string.", e); logger.error(exception.toString()); throw exception; } }
[ "public", "final", "byte", "[", "]", "encryptString", "(", "SecretKey", "sharedKey", ",", "String", "string", ")", "{", "logger", ".", "entry", "(", ")", ";", "try", "(", "ByteArrayInputStream", "input", "=", "new", "ByteArrayInputStream", "(", "string", ".", "getBytes", "(", "\"UTF-8\"", ")", ")", ";", "ByteArrayOutputStream", "output", "=", "new", "ByteArrayOutputStream", "(", ")", ")", "{", "encryptStream", "(", "sharedKey", ",", "input", ",", "output", ")", ";", "output", ".", "flush", "(", ")", ";", "byte", "[", "]", "encryptedString", "=", "output", ".", "toByteArray", "(", ")", ";", "logger", ".", "exit", "(", ")", ";", "return", "encryptedString", ";", "}", "catch", "(", "IOException", "e", ")", "{", "// should never happen!\r", "RuntimeException", "exception", "=", "new", "RuntimeException", "(", "\"An unexpected exception occured while trying to encrypt a string.\"", ",", "e", ")", ";", "logger", ".", "error", "(", "exception", ".", "toString", "(", ")", ")", ";", "throw", "exception", ";", "}", "}" ]
This method encrypts a string using a shared key. @param sharedKey The shared key used for the encryption. @param string The string to be encrypted. @return The encrypted string.
[ "This", "method", "encrypts", "a", "string", "using", "a", "shared", "key", "." ]
a5634c19812d473b608bc11060f5cbb4b4b0b5da
https://github.com/craterdog/java-security-framework/blob/a5634c19812d473b608bc11060f5cbb4b4b0b5da/java-secure-messaging-api/src/main/java/craterdog/security/MessageCryptex.java#L145-L160
148,546
craterdog/java-security-framework
java-secure-messaging-api/src/main/java/craterdog/security/MessageCryptex.java
MessageCryptex.decryptString
public final String decryptString(SecretKey sharedKey, byte[] encryptedString) { logger.entry(); try (ByteArrayInputStream input = new ByteArrayInputStream(encryptedString); ByteArrayOutputStream output = new ByteArrayOutputStream()) { decryptStream(sharedKey, input, output); output.flush(); String string = output.toString("UTF-8"); logger.exit(); return string; } catch (IOException e) { // should never happen! RuntimeException exception = new RuntimeException("An unexpected exception occured while trying to decrypt a string.", e); logger.error(exception.toString()); throw exception; } }
java
public final String decryptString(SecretKey sharedKey, byte[] encryptedString) { logger.entry(); try (ByteArrayInputStream input = new ByteArrayInputStream(encryptedString); ByteArrayOutputStream output = new ByteArrayOutputStream()) { decryptStream(sharedKey, input, output); output.flush(); String string = output.toString("UTF-8"); logger.exit(); return string; } catch (IOException e) { // should never happen! RuntimeException exception = new RuntimeException("An unexpected exception occured while trying to decrypt a string.", e); logger.error(exception.toString()); throw exception; } }
[ "public", "final", "String", "decryptString", "(", "SecretKey", "sharedKey", ",", "byte", "[", "]", "encryptedString", ")", "{", "logger", ".", "entry", "(", ")", ";", "try", "(", "ByteArrayInputStream", "input", "=", "new", "ByteArrayInputStream", "(", "encryptedString", ")", ";", "ByteArrayOutputStream", "output", "=", "new", "ByteArrayOutputStream", "(", ")", ")", "{", "decryptStream", "(", "sharedKey", ",", "input", ",", "output", ")", ";", "output", ".", "flush", "(", ")", ";", "String", "string", "=", "output", ".", "toString", "(", "\"UTF-8\"", ")", ";", "logger", ".", "exit", "(", ")", ";", "return", "string", ";", "}", "catch", "(", "IOException", "e", ")", "{", "// should never happen!\r", "RuntimeException", "exception", "=", "new", "RuntimeException", "(", "\"An unexpected exception occured while trying to decrypt a string.\"", ",", "e", ")", ";", "logger", ".", "error", "(", "exception", ".", "toString", "(", ")", ")", ";", "throw", "exception", ";", "}", "}" ]
This method decrypts a string using a shared key. @param sharedKey The shared key used for the encryption. @param encryptedString The encrypted string. @return The decrypted string.
[ "This", "method", "decrypts", "a", "string", "using", "a", "shared", "key", "." ]
a5634c19812d473b608bc11060f5cbb4b4b0b5da
https://github.com/craterdog/java-security-framework/blob/a5634c19812d473b608bc11060f5cbb4b4b0b5da/java-secure-messaging-api/src/main/java/craterdog/security/MessageCryptex.java#L170-L185
148,547
craterdog/java-security-framework
java-secure-messaging-api/src/main/java/craterdog/security/MessageCryptex.java
MessageCryptex.encryptStream
public final void encryptStream(SecretKey sharedKey, InputStream input, OutputStream output) throws IOException { logger.entry(); CipherOutputStream cipherOutput = null; byte[] buffer = new byte[2048]; try { logger.debug("Creating a special output stream to do the work..."); cipherOutput = encryptionOutputStream(sharedKey, output); logger.debug("Reading from the input and writing to the encrypting output stream..."); // Can't use IOUtils.copy(input, cipherOutput) here because need to purge buffer later... int bytesRead; while ((bytesRead = input.read(buffer)) != -1) { cipherOutput.write(buffer, 0, bytesRead); } cipherOutput.flush(); } finally { logger.debug("Purging any plaintext hanging around in memory..."); Arrays.fill(buffer, (byte) 0); if (cipherOutput != null) cipherOutput.close(); } logger.exit(); }
java
public final void encryptStream(SecretKey sharedKey, InputStream input, OutputStream output) throws IOException { logger.entry(); CipherOutputStream cipherOutput = null; byte[] buffer = new byte[2048]; try { logger.debug("Creating a special output stream to do the work..."); cipherOutput = encryptionOutputStream(sharedKey, output); logger.debug("Reading from the input and writing to the encrypting output stream..."); // Can't use IOUtils.copy(input, cipherOutput) here because need to purge buffer later... int bytesRead; while ((bytesRead = input.read(buffer)) != -1) { cipherOutput.write(buffer, 0, bytesRead); } cipherOutput.flush(); } finally { logger.debug("Purging any plaintext hanging around in memory..."); Arrays.fill(buffer, (byte) 0); if (cipherOutput != null) cipherOutput.close(); } logger.exit(); }
[ "public", "final", "void", "encryptStream", "(", "SecretKey", "sharedKey", ",", "InputStream", "input", ",", "OutputStream", "output", ")", "throws", "IOException", "{", "logger", ".", "entry", "(", ")", ";", "CipherOutputStream", "cipherOutput", "=", "null", ";", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "2048", "]", ";", "try", "{", "logger", ".", "debug", "(", "\"Creating a special output stream to do the work...\"", ")", ";", "cipherOutput", "=", "encryptionOutputStream", "(", "sharedKey", ",", "output", ")", ";", "logger", ".", "debug", "(", "\"Reading from the input and writing to the encrypting output stream...\"", ")", ";", "// Can't use IOUtils.copy(input, cipherOutput) here because need to purge buffer later...\r", "int", "bytesRead", ";", "while", "(", "(", "bytesRead", "=", "input", ".", "read", "(", "buffer", ")", ")", "!=", "-", "1", ")", "{", "cipherOutput", ".", "write", "(", "buffer", ",", "0", ",", "bytesRead", ")", ";", "}", "cipherOutput", ".", "flush", "(", ")", ";", "}", "finally", "{", "logger", ".", "debug", "(", "\"Purging any plaintext hanging around in memory...\"", ")", ";", "Arrays", ".", "fill", "(", "buffer", ",", "(", "byte", ")", "0", ")", ";", "if", "(", "cipherOutput", "!=", "null", ")", "cipherOutput", ".", "close", "(", ")", ";", "}", "logger", ".", "exit", "(", ")", ";", "}" ]
This method encrypts a byte stream using a shared key. @param sharedKey The shared key used for the encryption. @param input The byte stream to be encrypted. @param output The encrypted output stream. @throws java.io.IOException Unable to encrypt the stream.
[ "This", "method", "encrypts", "a", "byte", "stream", "using", "a", "shared", "key", "." ]
a5634c19812d473b608bc11060f5cbb4b4b0b5da
https://github.com/craterdog/java-security-framework/blob/a5634c19812d473b608bc11060f5cbb4b4b0b5da/java-secure-messaging-api/src/main/java/craterdog/security/MessageCryptex.java#L196-L218
148,548
craterdog/java-security-framework
java-secure-messaging-api/src/main/java/craterdog/security/MessageCryptex.java
MessageCryptex.decryptStream
public final void decryptStream(SecretKey sharedKey, InputStream input, OutputStream output) throws IOException { logger.entry(); CipherInputStream cipherInput = null; try { logger.debug("Creating a special input stream to do the work..."); cipherInput = decryptionInputStream(sharedKey, input); logger.debug("Reading bytes, decrypting them, and writing them out..."); IOUtils.copy(cipherInput, output); output.flush(); } finally { if (cipherInput != null) cipherInput.close(); } logger.exit(); }
java
public final void decryptStream(SecretKey sharedKey, InputStream input, OutputStream output) throws IOException { logger.entry(); CipherInputStream cipherInput = null; try { logger.debug("Creating a special input stream to do the work..."); cipherInput = decryptionInputStream(sharedKey, input); logger.debug("Reading bytes, decrypting them, and writing them out..."); IOUtils.copy(cipherInput, output); output.flush(); } finally { if (cipherInput != null) cipherInput.close(); } logger.exit(); }
[ "public", "final", "void", "decryptStream", "(", "SecretKey", "sharedKey", ",", "InputStream", "input", ",", "OutputStream", "output", ")", "throws", "IOException", "{", "logger", ".", "entry", "(", ")", ";", "CipherInputStream", "cipherInput", "=", "null", ";", "try", "{", "logger", ".", "debug", "(", "\"Creating a special input stream to do the work...\"", ")", ";", "cipherInput", "=", "decryptionInputStream", "(", "sharedKey", ",", "input", ")", ";", "logger", ".", "debug", "(", "\"Reading bytes, decrypting them, and writing them out...\"", ")", ";", "IOUtils", ".", "copy", "(", "cipherInput", ",", "output", ")", ";", "output", ".", "flush", "(", ")", ";", "}", "finally", "{", "if", "(", "cipherInput", "!=", "null", ")", "cipherInput", ".", "close", "(", ")", ";", "}", "logger", ".", "exit", "(", ")", ";", "}" ]
This method decrypts a byte stream from an encrypted byte stream. @param sharedKey The shared key used for the encryption. @param input The encrypted byte stream. @param output The decrypted byte stream. @throws java.io.IOException Unable to decrypt the stream.
[ "This", "method", "decrypts", "a", "byte", "stream", "from", "an", "encrypted", "byte", "stream", "." ]
a5634c19812d473b608bc11060f5cbb4b4b0b5da
https://github.com/craterdog/java-security-framework/blob/a5634c19812d473b608bc11060f5cbb4b4b0b5da/java-secure-messaging-api/src/main/java/craterdog/security/MessageCryptex.java#L229-L243
148,549
soarcn/COCOQuery
query/src/main/java/com/cocosw/query/CocoTask.java
CocoTask.cancel
public void cancel() { if (task != null && !task.isCancelled() && task.getStatus() != AsyncTask.Status.FINISHED) { task.cancel(true); } }
java
public void cancel() { if (task != null && !task.isCancelled() && task.getStatus() != AsyncTask.Status.FINISHED) { task.cancel(true); } }
[ "public", "void", "cancel", "(", ")", "{", "if", "(", "task", "!=", "null", "&&", "!", "task", ".", "isCancelled", "(", ")", "&&", "task", ".", "getStatus", "(", ")", "!=", "AsyncTask", ".", "Status", ".", "FINISHED", ")", "{", "task", ".", "cancel", "(", "true", ")", ";", "}", "}" ]
Cancel the task
[ "Cancel", "the", "task" ]
712eac37ab65ef3dbdf55dbfae28750edfc36608
https://github.com/soarcn/COCOQuery/blob/712eac37ab65ef3dbdf55dbfae28750edfc36608/query/src/main/java/com/cocosw/query/CocoTask.java#L271-L276
148,550
soarcn/COCOQuery
query/src/main/java/com/cocosw/query/CocoTask.java
CocoTask.updateDialogMsg
public void updateDialogMsg(final int resId) { if (dialog != null) { this.dialog.setMessage(dialog.getContext().getText(resId)); } }
java
public void updateDialogMsg(final int resId) { if (dialog != null) { this.dialog.setMessage(dialog.getContext().getText(resId)); } }
[ "public", "void", "updateDialogMsg", "(", "final", "int", "resId", ")", "{", "if", "(", "dialog", "!=", "null", ")", "{", "this", ".", "dialog", ".", "setMessage", "(", "dialog", ".", "getContext", "(", ")", ".", "getText", "(", "resId", ")", ")", ";", "}", "}" ]
Change the message in progress dialog @param resId
[ "Change", "the", "message", "in", "progress", "dialog" ]
712eac37ab65ef3dbdf55dbfae28750edfc36608
https://github.com/soarcn/COCOQuery/blob/712eac37ab65ef3dbdf55dbfae28750edfc36608/query/src/main/java/com/cocosw/query/CocoTask.java#L288-L292
148,551
diirt/util
src/main/java/org/epics/util/text/CsvParser.java
CsvParser.convertToListDouble
private ListDouble convertToListDouble(List<String> tokens) { double[] values = new double[tokens.size()]; for (int i = 0; i < values.length; i++) { if (tokens.get(i).isEmpty()) { values[i] = Double.NaN; } else { values[i] = Double.parseDouble(tokens.get(i)); } } return new ArrayDouble(values); }
java
private ListDouble convertToListDouble(List<String> tokens) { double[] values = new double[tokens.size()]; for (int i = 0; i < values.length; i++) { if (tokens.get(i).isEmpty()) { values[i] = Double.NaN; } else { values[i] = Double.parseDouble(tokens.get(i)); } } return new ArrayDouble(values); }
[ "private", "ListDouble", "convertToListDouble", "(", "List", "<", "String", ">", "tokens", ")", "{", "double", "[", "]", "values", "=", "new", "double", "[", "tokens", ".", "size", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "values", ".", "length", ";", "i", "++", ")", "{", "if", "(", "tokens", ".", "get", "(", "i", ")", ".", "isEmpty", "(", ")", ")", "{", "values", "[", "i", "]", "=", "Double", ".", "NaN", ";", "}", "else", "{", "values", "[", "i", "]", "=", "Double", ".", "parseDouble", "(", "tokens", ".", "get", "(", "i", ")", ")", ";", "}", "}", "return", "new", "ArrayDouble", "(", "values", ")", ";", "}" ]
Given a list of tokens, convert them to a list of numbers. @param tokens the tokens to be converted @return the number list
[ "Given", "a", "list", "of", "tokens", "convert", "them", "to", "a", "list", "of", "numbers", "." ]
24aca0a173a635aaf0b78d213a3fee8d4f91c077
https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/text/CsvParser.java#L278-L288
148,552
diirt/util
src/main/java/org/epics/util/text/CsvParser.java
CsvParser.csvLines
static List<String> csvLines(Reader reader) { // This needs to handle quoted text that spans multiple lines, // so we divide the full text into chunks that correspond to // a single csv line try { BufferedReader br = new BufferedReader(reader); List<String> lines = new ArrayList<>(); // The current line read from the Reader String line; // The full csv line that may span multiple lines String longLine = null; while ((line = br.readLine()) != null) { // If we have a line from the previous iteration, // we concatenate it if (longLine == null) { longLine = line; } else { longLine = longLine.concat("\n").concat(line); } // Count the number of quotes: if it's even, the csv line // must end here. If not, it will continue to the next if (isEvenQuotes(longLine)) { lines.add(longLine); longLine = null; } } // If there is text leftover, the line was not closed propertly. // XXX: we need to figure out how to handle errors like this if (longLine != null) { lines.add(longLine); } return lines; } catch(IOException ex) { throw new RuntimeException("Couldn't process data", ex); } }
java
static List<String> csvLines(Reader reader) { // This needs to handle quoted text that spans multiple lines, // so we divide the full text into chunks that correspond to // a single csv line try { BufferedReader br = new BufferedReader(reader); List<String> lines = new ArrayList<>(); // The current line read from the Reader String line; // The full csv line that may span multiple lines String longLine = null; while ((line = br.readLine()) != null) { // If we have a line from the previous iteration, // we concatenate it if (longLine == null) { longLine = line; } else { longLine = longLine.concat("\n").concat(line); } // Count the number of quotes: if it's even, the csv line // must end here. If not, it will continue to the next if (isEvenQuotes(longLine)) { lines.add(longLine); longLine = null; } } // If there is text leftover, the line was not closed propertly. // XXX: we need to figure out how to handle errors like this if (longLine != null) { lines.add(longLine); } return lines; } catch(IOException ex) { throw new RuntimeException("Couldn't process data", ex); } }
[ "static", "List", "<", "String", ">", "csvLines", "(", "Reader", "reader", ")", "{", "// This needs to handle quoted text that spans multiple lines,\r", "// so we divide the full text into chunks that correspond to\r", "// a single csv line\r", "try", "{", "BufferedReader", "br", "=", "new", "BufferedReader", "(", "reader", ")", ";", "List", "<", "String", ">", "lines", "=", "new", "ArrayList", "<>", "(", ")", ";", "// The current line read from the Reader\r", "String", "line", ";", "// The full csv line that may span multiple lines\r", "String", "longLine", "=", "null", ";", "while", "(", "(", "line", "=", "br", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "// If we have a line from the previous iteration,\r", "// we concatenate it\r", "if", "(", "longLine", "==", "null", ")", "{", "longLine", "=", "line", ";", "}", "else", "{", "longLine", "=", "longLine", ".", "concat", "(", "\"\\n\"", ")", ".", "concat", "(", "line", ")", ";", "}", "// Count the number of quotes: if it's even, the csv line\r", "// must end here. If not, it will continue to the next\r", "if", "(", "isEvenQuotes", "(", "longLine", ")", ")", "{", "lines", ".", "add", "(", "longLine", ")", ";", "longLine", "=", "null", ";", "}", "}", "// If there is text leftover, the line was not closed propertly.\r", "// XXX: we need to figure out how to handle errors like this\r", "if", "(", "longLine", "!=", "null", ")", "{", "lines", ".", "add", "(", "longLine", ")", ";", "}", "return", "lines", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "RuntimeException", "(", "\"Couldn't process data\"", ",", "ex", ")", ";", "}", "}" ]
Divides the whole text into lines. @param reader the source of text @return the lines
[ "Divides", "the", "whole", "text", "into", "lines", "." ]
24aca0a173a635aaf0b78d213a3fee8d4f91c077
https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/text/CsvParser.java#L296-L331
148,553
diirt/util
src/main/java/org/epics/util/text/CsvParser.java
CsvParser.isEvenQuotes
static boolean isEvenQuotes(String string) { // In principle, we could use the regex given by: // Pattern pEvenQuotes = Pattern.compile("([^\"]*\\\"[^\"]*\\\")*[^\"]*"); // We assume just counting the instances of double quotes is more efficient // but we haven't really tested that assumption. boolean even = true; for (int i = 0; i < string.length(); i++) { if (string.charAt(i) == '\"') { even = !even; } } return even; }
java
static boolean isEvenQuotes(String string) { // In principle, we could use the regex given by: // Pattern pEvenQuotes = Pattern.compile("([^\"]*\\\"[^\"]*\\\")*[^\"]*"); // We assume just counting the instances of double quotes is more efficient // but we haven't really tested that assumption. boolean even = true; for (int i = 0; i < string.length(); i++) { if (string.charAt(i) == '\"') { even = !even; } } return even; }
[ "static", "boolean", "isEvenQuotes", "(", "String", "string", ")", "{", "// In principle, we could use the regex given by:\r", "// Pattern pEvenQuotes = Pattern.compile(\"([^\\\"]*\\\\\\\"[^\\\"]*\\\\\\\")*[^\\\"]*\");\r", "// We assume just counting the instances of double quotes is more efficient\r", "// but we haven't really tested that assumption.\r", "boolean", "even", "=", "true", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "string", ".", "length", "(", ")", ";", "i", "++", ")", "{", "if", "(", "string", ".", "charAt", "(", "i", ")", "==", "'", "'", ")", "{", "even", "=", "!", "even", ";", "}", "}", "return", "even", ";", "}" ]
Determines whether the string contains an even number of double quote characters. @param string the given string @return true if contains even number of '"'
[ "Determines", "whether", "the", "string", "contains", "an", "even", "number", "of", "double", "quote", "characters", "." ]
24aca0a173a635aaf0b78d213a3fee8d4f91c077
https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/text/CsvParser.java#L340-L353
148,554
diirt/util
src/main/java/org/epics/util/text/CsvParser.java
CsvParser.parseTitles
private List<String> parseTitles(State state, String line) { // Match using the parser List<String> titles = new ArrayList<>(); state.mLineTokens.reset(line); while (state.mLineTokens.find()) { String value; if (state.mLineTokens.start(2) >= 0) { value = state.mLineTokens.group(2); } else { // If quoted, always use string value = state.mQuote.reset(state.mLineTokens.group(1)).replaceAll("\""); } titles.add(value); } return titles; }
java
private List<String> parseTitles(State state, String line) { // Match using the parser List<String> titles = new ArrayList<>(); state.mLineTokens.reset(line); while (state.mLineTokens.find()) { String value; if (state.mLineTokens.start(2) >= 0) { value = state.mLineTokens.group(2); } else { // If quoted, always use string value = state.mQuote.reset(state.mLineTokens.group(1)).replaceAll("\""); } titles.add(value); } return titles; }
[ "private", "List", "<", "String", ">", "parseTitles", "(", "State", "state", ",", "String", "line", ")", "{", "// Match using the parser\r", "List", "<", "String", ">", "titles", "=", "new", "ArrayList", "<>", "(", ")", ";", "state", ".", "mLineTokens", ".", "reset", "(", "line", ")", ";", "while", "(", "state", ".", "mLineTokens", ".", "find", "(", ")", ")", "{", "String", "value", ";", "if", "(", "state", ".", "mLineTokens", ".", "start", "(", "2", ")", ">=", "0", ")", "{", "value", "=", "state", ".", "mLineTokens", ".", "group", "(", "2", ")", ";", "}", "else", "{", "// If quoted, always use string\r", "value", "=", "state", ".", "mQuote", ".", "reset", "(", "state", ".", "mLineTokens", ".", "group", "(", "1", ")", ")", ".", "replaceAll", "(", "\"\\\"\"", ")", ";", "}", "titles", ".", "add", "(", "value", ")", ";", "}", "return", "titles", ";", "}" ]
Parses the first line to get the column names. @param line the text line @return the column names
[ "Parses", "the", "first", "line", "to", "get", "the", "column", "names", "." ]
24aca0a173a635aaf0b78d213a3fee8d4f91c077
https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/text/CsvParser.java#L361-L376
148,555
diirt/util
src/main/java/org/epics/util/text/CsvParser.java
CsvParser.parseLine
private void parseLine(State state, String line) { // XXX The regex does not work if the first token is blank, and I // don't understand why. Workaround: if it's blank, add a space, // and remember I added a space. boolean firstEmpty = false; if (line.startsWith(state.currentSeparator)) { line = " " + line; firstEmpty = true; } // Match using the parser state.mLineTokens.reset(line); int nColumn = 0; while (state.mLineTokens.find()) { // Does this line have more columns than expected? if (nColumn == state.nColumns) { state.columnMismatch = true; return; } String token; if (state.mLineTokens.start(2) >= 0) { // The token was unquoted. Check if it could be a number. token = state.mLineTokens.group(2); if (firstEmpty) { token = ""; firstEmpty = false; } if (!isTokenNumberParsable(state, token)) { state.columnNumberParsable.set(nColumn, false); } } else { // If quoted, always use string token = state.mQuote.reset(state.mLineTokens.group(1)).replaceAll("\""); state.columnNumberParsable.set(nColumn, false); } state.columnTokens.get(nColumn).add(token); nColumn++; } // Does this line have fewer columns than expected? if (nColumn != state.nColumns) { state.columnMismatch = true; } }
java
private void parseLine(State state, String line) { // XXX The regex does not work if the first token is blank, and I // don't understand why. Workaround: if it's blank, add a space, // and remember I added a space. boolean firstEmpty = false; if (line.startsWith(state.currentSeparator)) { line = " " + line; firstEmpty = true; } // Match using the parser state.mLineTokens.reset(line); int nColumn = 0; while (state.mLineTokens.find()) { // Does this line have more columns than expected? if (nColumn == state.nColumns) { state.columnMismatch = true; return; } String token; if (state.mLineTokens.start(2) >= 0) { // The token was unquoted. Check if it could be a number. token = state.mLineTokens.group(2); if (firstEmpty) { token = ""; firstEmpty = false; } if (!isTokenNumberParsable(state, token)) { state.columnNumberParsable.set(nColumn, false); } } else { // If quoted, always use string token = state.mQuote.reset(state.mLineTokens.group(1)).replaceAll("\""); state.columnNumberParsable.set(nColumn, false); } state.columnTokens.get(nColumn).add(token); nColumn++; } // Does this line have fewer columns than expected? if (nColumn != state.nColumns) { state.columnMismatch = true; } }
[ "private", "void", "parseLine", "(", "State", "state", ",", "String", "line", ")", "{", "// XXX The regex does not work if the first token is blank, and I\r", "// don't understand why. Workaround: if it's blank, add a space,\r", "// and remember I added a space.\r", "boolean", "firstEmpty", "=", "false", ";", "if", "(", "line", ".", "startsWith", "(", "state", ".", "currentSeparator", ")", ")", "{", "line", "=", "\" \"", "+", "line", ";", "firstEmpty", "=", "true", ";", "}", "// Match using the parser\r", "state", ".", "mLineTokens", ".", "reset", "(", "line", ")", ";", "int", "nColumn", "=", "0", ";", "while", "(", "state", ".", "mLineTokens", ".", "find", "(", ")", ")", "{", "// Does this line have more columns than expected?\r", "if", "(", "nColumn", "==", "state", ".", "nColumns", ")", "{", "state", ".", "columnMismatch", "=", "true", ";", "return", ";", "}", "String", "token", ";", "if", "(", "state", ".", "mLineTokens", ".", "start", "(", "2", ")", ">=", "0", ")", "{", "// The token was unquoted. Check if it could be a number.\r", "token", "=", "state", ".", "mLineTokens", ".", "group", "(", "2", ")", ";", "if", "(", "firstEmpty", ")", "{", "token", "=", "\"\"", ";", "firstEmpty", "=", "false", ";", "}", "if", "(", "!", "isTokenNumberParsable", "(", "state", ",", "token", ")", ")", "{", "state", ".", "columnNumberParsable", ".", "set", "(", "nColumn", ",", "false", ")", ";", "}", "}", "else", "{", "// If quoted, always use string\r", "token", "=", "state", ".", "mQuote", ".", "reset", "(", "state", ".", "mLineTokens", ".", "group", "(", "1", ")", ")", ".", "replaceAll", "(", "\"\\\"\"", ")", ";", "state", ".", "columnNumberParsable", ".", "set", "(", "nColumn", ",", "false", ")", ";", "}", "state", ".", "columnTokens", ".", "get", "(", "nColumn", ")", ".", "add", "(", "token", ")", ";", "nColumn", "++", ";", "}", "// Does this line have fewer columns than expected?\r", "if", "(", "nColumn", "!=", "state", ".", "nColumns", ")", "{", "state", ".", "columnMismatch", "=", "true", ";", "}", "}" ]
Parses a line, saving the tokens, and determines the type match. @param line a new line
[ "Parses", "a", "line", "saving", "the", "tokens", "and", "determines", "the", "type", "match", "." ]
24aca0a173a635aaf0b78d213a3fee8d4f91c077
https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/text/CsvParser.java#L383-L426
148,556
diirt/util
src/main/java/org/epics/util/text/CsvParser.java
CsvParser.isTokenNumberParsable
private boolean isTokenNumberParsable(State state, String token) { if (token.isEmpty()) { return true; } return state.mDouble.reset(token).matches(); }
java
private boolean isTokenNumberParsable(State state, String token) { if (token.isEmpty()) { return true; } return state.mDouble.reset(token).matches(); }
[ "private", "boolean", "isTokenNumberParsable", "(", "State", "state", ",", "String", "token", ")", "{", "if", "(", "token", ".", "isEmpty", "(", ")", ")", "{", "return", "true", ";", "}", "return", "state", ".", "mDouble", ".", "reset", "(", "token", ")", ".", "matches", "(", ")", ";", "}" ]
Check whether the token can be parsed to a number. @param state the state of the parser @param token the token @return true if token matches a double
[ "Check", "whether", "the", "token", "can", "be", "parsed", "to", "a", "number", "." ]
24aca0a173a635aaf0b78d213a3fee8d4f91c077
https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/text/CsvParser.java#L435-L440
148,557
diirt/util
src/main/java/org/epics/util/text/CsvParser.java
CsvParser.isFirstLineData
private boolean isFirstLineData(State state, List<String> headerTokens) { // Check whether the type of the header match the type of the following data boolean headerCompatible = true; // Check whether if all types where strings boolean allStrings = true; for (int i = 0; i < state.nColumns; i++) { if (state.columnNumberParsable.get(i)) { allStrings = false; if (!isTokenNumberParsable(state, headerTokens.get(i))) { headerCompatible = false; } } } // If all columns are strings, it's impossible to tell whether we have // a header or not: assume we have a header. // If the column types matches (e.g. the header for a number column is also // a number) then we'll assume the header is actually data. return !allStrings && headerCompatible; }
java
private boolean isFirstLineData(State state, List<String> headerTokens) { // Check whether the type of the header match the type of the following data boolean headerCompatible = true; // Check whether if all types where strings boolean allStrings = true; for (int i = 0; i < state.nColumns; i++) { if (state.columnNumberParsable.get(i)) { allStrings = false; if (!isTokenNumberParsable(state, headerTokens.get(i))) { headerCompatible = false; } } } // If all columns are strings, it's impossible to tell whether we have // a header or not: assume we have a header. // If the column types matches (e.g. the header for a number column is also // a number) then we'll assume the header is actually data. return !allStrings && headerCompatible; }
[ "private", "boolean", "isFirstLineData", "(", "State", "state", ",", "List", "<", "String", ">", "headerTokens", ")", "{", "// Check whether the type of the header match the type of the following data\r", "boolean", "headerCompatible", "=", "true", ";", "// Check whether if all types where strings\r", "boolean", "allStrings", "=", "true", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "state", ".", "nColumns", ";", "i", "++", ")", "{", "if", "(", "state", ".", "columnNumberParsable", ".", "get", "(", "i", ")", ")", "{", "allStrings", "=", "false", ";", "if", "(", "!", "isTokenNumberParsable", "(", "state", ",", "headerTokens", ".", "get", "(", "i", ")", ")", ")", "{", "headerCompatible", "=", "false", ";", "}", "}", "}", "// If all columns are strings, it's impossible to tell whether we have\r", "// a header or not: assume we have a header.\r", "// If the column types matches (e.g. the header for a number column is also\r", "// a number) then we'll assume the header is actually data.\r", "return", "!", "allStrings", "&&", "headerCompatible", ";", "}" ]
Checks whether the header can be safely interpreted as data. This is used for the auto header detection. @param state the state of the parser @param headerTokens the header @return true if header should be handled as data
[ "Checks", "whether", "the", "header", "can", "be", "safely", "interpreted", "as", "data", ".", "This", "is", "used", "for", "the", "auto", "header", "detection", "." ]
24aca0a173a635aaf0b78d213a3fee8d4f91c077
https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/text/CsvParser.java#L450-L468
148,558
diirt/util
src/main/java/org/epics/util/text/CsvParser.java
CsvParser.joinList
private List<String> joinList(final String head, final List<String> tail) { return new AbstractList<String>() { @Override public String get(int index) { if (index == 0) { return head; } else { return tail.get(index - 1); } } @Override public int size() { return tail.size()+1; } }; }
java
private List<String> joinList(final String head, final List<String> tail) { return new AbstractList<String>() { @Override public String get(int index) { if (index == 0) { return head; } else { return tail.get(index - 1); } } @Override public int size() { return tail.size()+1; } }; }
[ "private", "List", "<", "String", ">", "joinList", "(", "final", "String", "head", ",", "final", "List", "<", "String", ">", "tail", ")", "{", "return", "new", "AbstractList", "<", "String", ">", "(", ")", "{", "@", "Override", "public", "String", "get", "(", "int", "index", ")", "{", "if", "(", "index", "==", "0", ")", "{", "return", "head", ";", "}", "else", "{", "return", "tail", ".", "get", "(", "index", "-", "1", ")", ";", "}", "}", "@", "Override", "public", "int", "size", "(", ")", "{", "return", "tail", ".", "size", "(", ")", "+", "1", ";", "}", "}", ";", "}" ]
Takes an elements and a list and returns a new list with both. @param head the first element @param tail the rest of the elements @return a list with all elements
[ "Takes", "an", "elements", "and", "a", "list", "and", "returns", "a", "new", "list", "with", "both", "." ]
24aca0a173a635aaf0b78d213a3fee8d4f91c077
https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/text/CsvParser.java#L477-L494
148,559
iipc/openwayback-access-control
access-control/src/main/java/org/archive/accesscontrol/model/RuleSet.java
RuleSet.getMatchingRule
public Rule getMatchingRule(String surt, Date captureDate, Date retrievalDate, String who) { NewSurtTokenizer tok = new NewSurtTokenizer(surt); // Best general rule (when accessGroup is blank) Rule ruleGeneral = null; for (String key: tok.getSearchList()) { Iterable<Rule> rules = rulemap.get(key); if (rules != null) { for (Rule rule : rules) { if (rule.matches(surt, captureDate, retrievalDate, who)) { // Return this if accessGroup (who) matches exactly if ((who != null) && who.equals(rule.getWho())) { return rule; // otherwise, store the first/best one } else if (ruleGeneral == null) { ruleGeneral = rule; } } } } } return ruleGeneral; }
java
public Rule getMatchingRule(String surt, Date captureDate, Date retrievalDate, String who) { NewSurtTokenizer tok = new NewSurtTokenizer(surt); // Best general rule (when accessGroup is blank) Rule ruleGeneral = null; for (String key: tok.getSearchList()) { Iterable<Rule> rules = rulemap.get(key); if (rules != null) { for (Rule rule : rules) { if (rule.matches(surt, captureDate, retrievalDate, who)) { // Return this if accessGroup (who) matches exactly if ((who != null) && who.equals(rule.getWho())) { return rule; // otherwise, store the first/best one } else if (ruleGeneral == null) { ruleGeneral = rule; } } } } } return ruleGeneral; }
[ "public", "Rule", "getMatchingRule", "(", "String", "surt", ",", "Date", "captureDate", ",", "Date", "retrievalDate", ",", "String", "who", ")", "{", "NewSurtTokenizer", "tok", "=", "new", "NewSurtTokenizer", "(", "surt", ")", ";", "// Best general rule (when accessGroup is blank)", "Rule", "ruleGeneral", "=", "null", ";", "for", "(", "String", "key", ":", "tok", ".", "getSearchList", "(", ")", ")", "{", "Iterable", "<", "Rule", ">", "rules", "=", "rulemap", ".", "get", "(", "key", ")", ";", "if", "(", "rules", "!=", "null", ")", "{", "for", "(", "Rule", "rule", ":", "rules", ")", "{", "if", "(", "rule", ".", "matches", "(", "surt", ",", "captureDate", ",", "retrievalDate", ",", "who", ")", ")", "{", "// Return this if accessGroup (who) matches exactly", "if", "(", "(", "who", "!=", "null", ")", "&&", "who", ".", "equals", "(", "rule", ".", "getWho", "(", ")", ")", ")", "{", "return", "rule", ";", "// otherwise, store the first/best one", "}", "else", "if", "(", "ruleGeneral", "==", "null", ")", "{", "ruleGeneral", "=", "rule", ";", "}", "}", "}", "}", "}", "return", "ruleGeneral", ";", "}" ]
Return the most specific matching rule for the given request. @param surt @param captureDate @param retrievalDate @param who group @return
[ "Return", "the", "most", "specific", "matching", "rule", "for", "the", "given", "request", "." ]
4a0f70f200fd8d7b6e313624b7628656d834bf31
https://github.com/iipc/openwayback-access-control/blob/4a0f70f200fd8d7b6e313624b7628656d834bf31/access-control/src/main/java/org/archive/accesscontrol/model/RuleSet.java#L66-L92
148,560
jledit/jledit
core/src/main/java/org/jledit/StringEditor.java
StringEditor.move
@Override public synchronized void move(int line, int column) { if (lines() < line) { this.column = 1; } else { String targetLine = lines.get(line - 1); if (targetLine.length() < column) { this.column = targetLine.length() + 1; } else { this.column = column; } } this.line = line; }
java
@Override public synchronized void move(int line, int column) { if (lines() < line) { this.column = 1; } else { String targetLine = lines.get(line - 1); if (targetLine.length() < column) { this.column = targetLine.length() + 1; } else { this.column = column; } } this.line = line; }
[ "@", "Override", "public", "synchronized", "void", "move", "(", "int", "line", ",", "int", "column", ")", "{", "if", "(", "lines", "(", ")", "<", "line", ")", "{", "this", ".", "column", "=", "1", ";", "}", "else", "{", "String", "targetLine", "=", "lines", ".", "get", "(", "line", "-", "1", ")", ";", "if", "(", "targetLine", ".", "length", "(", ")", "<", "column", ")", "{", "this", ".", "column", "=", "targetLine", ".", "length", "(", ")", "+", "1", ";", "}", "else", "{", "this", ".", "column", "=", "column", ";", "}", "}", "this", ".", "line", "=", "line", ";", "}" ]
Moves the index to the specified line and column. If the requested line is greater that the actual lines number and exception is thrown. If the requested column is greater than the line width, the index is moved to the end of the line. @param line @param column @throws IndexOutOfBoundsException When the requested line exceeds the number of lines in the content.
[ "Moves", "the", "index", "to", "the", "specified", "line", "and", "column", ".", "If", "the", "requested", "line", "is", "greater", "that", "the", "actual", "lines", "number", "and", "exception", "is", "thrown", ".", "If", "the", "requested", "column", "is", "greater", "than", "the", "line", "width", "the", "index", "is", "moved", "to", "the", "end", "of", "the", "line", "." ]
ced2c4b44330664adb65f8be4c8fff780ccaa6fd
https://github.com/jledit/jledit/blob/ced2c4b44330664adb65f8be4c8fff780ccaa6fd/core/src/main/java/org/jledit/StringEditor.java#L64-L77
148,561
jledit/jledit
core/src/main/java/org/jledit/StringEditor.java
StringEditor.moveToEndOfFile
@Override public void moveToEndOfFile() { int targetLine = lines.size() + 1; move(targetLine, getContent(targetLine).length()); }
java
@Override public void moveToEndOfFile() { int targetLine = lines.size() + 1; move(targetLine, getContent(targetLine).length()); }
[ "@", "Override", "public", "void", "moveToEndOfFile", "(", ")", "{", "int", "targetLine", "=", "lines", ".", "size", "(", ")", "+", "1", ";", "move", "(", "targetLine", ",", "getContent", "(", "targetLine", ")", ".", "length", "(", ")", ")", ";", "}" ]
Moves cursor to the end of the line.
[ "Moves", "cursor", "to", "the", "end", "of", "the", "line", "." ]
ced2c4b44330664adb65f8be4c8fff780ccaa6fd
https://github.com/jledit/jledit/blob/ced2c4b44330664adb65f8be4c8fff780ccaa6fd/core/src/main/java/org/jledit/StringEditor.java#L106-L110
148,562
JM-Lab/utils-elasticsearch
src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchIndex.java
JMElasticsearchIndex.upsertDataWithObjectMapper
public UpdateResponse upsertDataWithObjectMapper(Object sourceObject, String index, String type, String id) { return upsertData( JMElasticsearchUtil.buildSourceByJsonMapper(sourceObject), index, type, id); }
java
public UpdateResponse upsertDataWithObjectMapper(Object sourceObject, String index, String type, String id) { return upsertData( JMElasticsearchUtil.buildSourceByJsonMapper(sourceObject), index, type, id); }
[ "public", "UpdateResponse", "upsertDataWithObjectMapper", "(", "Object", "sourceObject", ",", "String", "index", ",", "String", "type", ",", "String", "id", ")", "{", "return", "upsertData", "(", "JMElasticsearchUtil", ".", "buildSourceByJsonMapper", "(", "sourceObject", ")", ",", "index", ",", "type", ",", "id", ")", ";", "}" ]
Upsert data with object mapper update response. @param sourceObject the source object @param index the index @param type the type @param id the id @return the update response
[ "Upsert", "data", "with", "object", "mapper", "update", "response", "." ]
6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638
https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchIndex.java#L175-L180
148,563
JM-Lab/utils-elasticsearch
src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchIndex.java
JMElasticsearchIndex.upsertDataASyncWithObjectMapper
public ActionFuture<UpdateResponse> upsertDataASyncWithObjectMapper(Object sourceObject, String index, String type, String id) { return upsertDataAsync( JMElasticsearchUtil.buildSourceByJsonMapper(sourceObject), index, type, id); }
java
public ActionFuture<UpdateResponse> upsertDataASyncWithObjectMapper(Object sourceObject, String index, String type, String id) { return upsertDataAsync( JMElasticsearchUtil.buildSourceByJsonMapper(sourceObject), index, type, id); }
[ "public", "ActionFuture", "<", "UpdateResponse", ">", "upsertDataASyncWithObjectMapper", "(", "Object", "sourceObject", ",", "String", "index", ",", "String", "type", ",", "String", "id", ")", "{", "return", "upsertDataAsync", "(", "JMElasticsearchUtil", ".", "buildSourceByJsonMapper", "(", "sourceObject", ")", ",", "index", ",", "type", ",", "id", ")", ";", "}" ]
Upsert data a sync with object mapper action future. @param sourceObject the source object @param index the index @param type the type @param id the id @return the action future
[ "Upsert", "data", "a", "sync", "with", "object", "mapper", "action", "future", "." ]
6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638
https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchIndex.java#L191-L197
148,564
JM-Lab/utils-elasticsearch
src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchIndex.java
JMElasticsearchIndex.sendDataWithObjectMapper
public IndexResponse sendDataWithObjectMapper(Object sourceObject, String index, String type, String id) { return sendData( JMElasticsearchUtil.buildSourceByJsonMapper(sourceObject), index, type, id); }
java
public IndexResponse sendDataWithObjectMapper(Object sourceObject, String index, String type, String id) { return sendData( JMElasticsearchUtil.buildSourceByJsonMapper(sourceObject), index, type, id); }
[ "public", "IndexResponse", "sendDataWithObjectMapper", "(", "Object", "sourceObject", ",", "String", "index", ",", "String", "type", ",", "String", "id", ")", "{", "return", "sendData", "(", "JMElasticsearchUtil", ".", "buildSourceByJsonMapper", "(", "sourceObject", ")", ",", "index", ",", "type", ",", "id", ")", ";", "}" ]
Send data with object mapper index response. @param sourceObject the source object @param index the index @param type the type @param id the id @return the index response
[ "Send", "data", "with", "object", "mapper", "index", "response", "." ]
6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638
https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchIndex.java#L261-L266
148,565
JM-Lab/utils-elasticsearch
src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchIndex.java
JMElasticsearchIndex.sendDataWithObjectMapper
public String sendDataWithObjectMapper(Object sourceObject, String index, String type) { return sendDataWithObjectMapper(sourceObject, index, type, null) .getId(); }
java
public String sendDataWithObjectMapper(Object sourceObject, String index, String type) { return sendDataWithObjectMapper(sourceObject, index, type, null) .getId(); }
[ "public", "String", "sendDataWithObjectMapper", "(", "Object", "sourceObject", ",", "String", "index", ",", "String", "type", ")", "{", "return", "sendDataWithObjectMapper", "(", "sourceObject", ",", "index", ",", "type", ",", "null", ")", ".", "getId", "(", ")", ";", "}" ]
Send data with object mapper string. @param sourceObject the source object @param index the index @param type the type @return the string
[ "Send", "data", "with", "object", "mapper", "string", "." ]
6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638
https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchIndex.java#L276-L280
148,566
JM-Lab/utils-elasticsearch
src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchIndex.java
JMElasticsearchIndex.sendDataAsyncWithObjectMapper
public ActionFuture<IndexResponse> sendDataAsyncWithObjectMapper( Object sourceObject, String index, String type, String id) { return indexQueryAsync(buildIndexRequest( JMElasticsearchUtil.buildSourceByJsonMapper(sourceObject), index, type, id)); }
java
public ActionFuture<IndexResponse> sendDataAsyncWithObjectMapper( Object sourceObject, String index, String type, String id) { return indexQueryAsync(buildIndexRequest( JMElasticsearchUtil.buildSourceByJsonMapper(sourceObject), index, type, id)); }
[ "public", "ActionFuture", "<", "IndexResponse", ">", "sendDataAsyncWithObjectMapper", "(", "Object", "sourceObject", ",", "String", "index", ",", "String", "type", ",", "String", "id", ")", "{", "return", "indexQueryAsync", "(", "buildIndexRequest", "(", "JMElasticsearchUtil", ".", "buildSourceByJsonMapper", "(", "sourceObject", ")", ",", "index", ",", "type", ",", "id", ")", ")", ";", "}" ]
Send data async with object mapper action future. @param sourceObject the source object @param index the index @param type the type @param id the id @return the action future
[ "Send", "data", "async", "with", "object", "mapper", "action", "future", "." ]
6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638
https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchIndex.java#L346-L351
148,567
jledit/jledit
core/src/main/java/org/jledit/jline/NonBlockingInputStream.java
NonBlockingInputStream.read
private synchronized int read(long timeout, boolean isPeek) throws IOException { /* * If the thread hit an IOException, we report it. */ if (exception != null) { assert ch == -2; IOException toBeThrown = exception; if (!isPeek) exception = null; throw toBeThrown; } /* * If there was a pending character from the thread, then * we send it. If the timeout is 0L or the thread was shut down * then do a local read. */ if (ch >= -1) { assert exception == null; } else if ((timeout == 0L || isShutdown) && !threadIsReading) { ch = in.read(); } else { /* * If the thread isn't reading already, then ask it to do so. */ if (!threadIsReading) { threadIsReading = true; notify(); } boolean isInfinite = (timeout <= 0L); /* * So the thread is currently doing the reading for us. So * now we play the waiting game. */ while (isInfinite || timeout > 0L) { long start = System.currentTimeMillis (); try { wait(timeout); } catch (InterruptedException e) { /* IGNORED */ } if (exception != null) { assert ch == -2; IOException toBeThrown = exception; if (!isPeek) exception = null; throw toBeThrown; } if (ch >= -1) { assert exception == null; break; } if (!isInfinite) { timeout -= System.currentTimeMillis() - start; } } } /* * ch is the character that was just read. Either we set it because * a local read was performed or the read thread set it (or failed to * change it). We will return it's value, but if this was a peek * operation, then we leave it in place. */ int ret = ch; if (!isPeek) { ch = -2; } return ret; }
java
private synchronized int read(long timeout, boolean isPeek) throws IOException { /* * If the thread hit an IOException, we report it. */ if (exception != null) { assert ch == -2; IOException toBeThrown = exception; if (!isPeek) exception = null; throw toBeThrown; } /* * If there was a pending character from the thread, then * we send it. If the timeout is 0L or the thread was shut down * then do a local read. */ if (ch >= -1) { assert exception == null; } else if ((timeout == 0L || isShutdown) && !threadIsReading) { ch = in.read(); } else { /* * If the thread isn't reading already, then ask it to do so. */ if (!threadIsReading) { threadIsReading = true; notify(); } boolean isInfinite = (timeout <= 0L); /* * So the thread is currently doing the reading for us. So * now we play the waiting game. */ while (isInfinite || timeout > 0L) { long start = System.currentTimeMillis (); try { wait(timeout); } catch (InterruptedException e) { /* IGNORED */ } if (exception != null) { assert ch == -2; IOException toBeThrown = exception; if (!isPeek) exception = null; throw toBeThrown; } if (ch >= -1) { assert exception == null; break; } if (!isInfinite) { timeout -= System.currentTimeMillis() - start; } } } /* * ch is the character that was just read. Either we set it because * a local read was performed or the read thread set it (or failed to * change it). We will return it's value, but if this was a peek * operation, then we leave it in place. */ int ret = ch; if (!isPeek) { ch = -2; } return ret; }
[ "private", "synchronized", "int", "read", "(", "long", "timeout", ",", "boolean", "isPeek", ")", "throws", "IOException", "{", "/*\n * If the thread hit an IOException, we report it.\n */", "if", "(", "exception", "!=", "null", ")", "{", "assert", "ch", "==", "-", "2", ";", "IOException", "toBeThrown", "=", "exception", ";", "if", "(", "!", "isPeek", ")", "exception", "=", "null", ";", "throw", "toBeThrown", ";", "}", "/*\n * If there was a pending character from the thread, then\n * we send it. If the timeout is 0L or the thread was shut down\n * then do a local read.\n */", "if", "(", "ch", ">=", "-", "1", ")", "{", "assert", "exception", "==", "null", ";", "}", "else", "if", "(", "(", "timeout", "==", "0L", "||", "isShutdown", ")", "&&", "!", "threadIsReading", ")", "{", "ch", "=", "in", ".", "read", "(", ")", ";", "}", "else", "{", "/*\n * If the thread isn't reading already, then ask it to do so.\n */", "if", "(", "!", "threadIsReading", ")", "{", "threadIsReading", "=", "true", ";", "notify", "(", ")", ";", "}", "boolean", "isInfinite", "=", "(", "timeout", "<=", "0L", ")", ";", "/*\n * So the thread is currently doing the reading for us. So\n * now we play the waiting game.\n */", "while", "(", "isInfinite", "||", "timeout", ">", "0L", ")", "{", "long", "start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "try", "{", "wait", "(", "timeout", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "/* IGNORED */", "}", "if", "(", "exception", "!=", "null", ")", "{", "assert", "ch", "==", "-", "2", ";", "IOException", "toBeThrown", "=", "exception", ";", "if", "(", "!", "isPeek", ")", "exception", "=", "null", ";", "throw", "toBeThrown", ";", "}", "if", "(", "ch", ">=", "-", "1", ")", "{", "assert", "exception", "==", "null", ";", "break", ";", "}", "if", "(", "!", "isInfinite", ")", "{", "timeout", "-=", "System", ".", "currentTimeMillis", "(", ")", "-", "start", ";", "}", "}", "}", "/*\n * ch is the character that was just read. Either we set it because\n * a local read was performed or the read thread set it (or failed to\n * change it). We will return it's value, but if this was a peek\n * operation, then we leave it in place.\n */", "int", "ret", "=", "ch", ";", "if", "(", "!", "isPeek", ")", "{", "ch", "=", "-", "2", ";", "}", "return", "ret", ";", "}" ]
Attempts to read a character from the input stream for a specific period of time. @param timeout The amount of time to wait for the character @return The character read, -1 if EOF is reached, or -2 if the read timed out. @throws IOException
[ "Attempts", "to", "read", "a", "character", "from", "the", "input", "stream", "for", "a", "specific", "period", "of", "time", "." ]
ced2c4b44330664adb65f8be4c8fff780ccaa6fd
https://github.com/jledit/jledit/blob/ced2c4b44330664adb65f8be4c8fff780ccaa6fd/core/src/main/java/org/jledit/jline/NonBlockingInputStream.java#L142-L221
148,568
JM-Lab/utils-elasticsearch
src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchUtil.java
JMElasticsearchUtil.logRequestQuery
public static <R extends ActionRequestBuilder> R logRequestQuery( String method, R requestBuilder, Object... params) { if (params == null) JMLog.debug(log, method, requestBuilder); else JMLog.debug(log, method, Arrays.asList(params), requestBuilder); return requestBuilder; }
java
public static <R extends ActionRequestBuilder> R logRequestQuery( String method, R requestBuilder, Object... params) { if (params == null) JMLog.debug(log, method, requestBuilder); else JMLog.debug(log, method, Arrays.asList(params), requestBuilder); return requestBuilder; }
[ "public", "static", "<", "R", "extends", "ActionRequestBuilder", ">", "R", "logRequestQuery", "(", "String", "method", ",", "R", "requestBuilder", ",", "Object", "...", "params", ")", "{", "if", "(", "params", "==", "null", ")", "JMLog", ".", "debug", "(", "log", ",", "method", ",", "requestBuilder", ")", ";", "else", "JMLog", ".", "debug", "(", "log", ",", "method", ",", "Arrays", ".", "asList", "(", "params", ")", ",", "requestBuilder", ")", ";", "return", "requestBuilder", ";", "}" ]
Log request query r. @param <R> the type parameter @param method the method @param requestBuilder the request builder @param params the params @return the r
[ "Log", "request", "query", "r", "." ]
6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638
https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchUtil.java#L77-L85
148,569
devnewton/jnuit
tablelayout/src/main/java/com/esotericsoftware/tablelayout/BaseTableLayout.java
BaseTableLayout.add
public Cell<C, T> add(C widget) { Cell<C, T> cell = toolkit.obtainCell(this); cell.widget = widget; if (cells.size() > 0) { // Set cell column and row. Cell<C, T> lastCell = cells.get(cells.size() - 1); if (!lastCell.endRow) { cell.column = lastCell.column + lastCell.colspan; cell.row = lastCell.row; } else { cell.column = 0; cell.row = lastCell.row + 1; } // Set the index of the cell above. if (cell.row > 0) { outer: for (int i = cells.size() - 1; i >= 0; i--) { Cell<C, T> other = cells.get(i); for (int column = other.column, nn = column + other.colspan; column < nn; column++) { if (column == cell.column) { cell.cellAboveIndex = i; break outer; } } } } } else { cell.column = 0; cell.row = 0; } cells.add(cell); cell.set(cellDefaults); if (cell.column < columnDefaults.size()) { Cell<C, T> columnCell = columnDefaults.get(cell.column); if (columnCell != null) cell.merge(columnCell); } cell.merge(rowDefaults); if (widget != null) toolkit.addChild(table, widget); return cell; }
java
public Cell<C, T> add(C widget) { Cell<C, T> cell = toolkit.obtainCell(this); cell.widget = widget; if (cells.size() > 0) { // Set cell column and row. Cell<C, T> lastCell = cells.get(cells.size() - 1); if (!lastCell.endRow) { cell.column = lastCell.column + lastCell.colspan; cell.row = lastCell.row; } else { cell.column = 0; cell.row = lastCell.row + 1; } // Set the index of the cell above. if (cell.row > 0) { outer: for (int i = cells.size() - 1; i >= 0; i--) { Cell<C, T> other = cells.get(i); for (int column = other.column, nn = column + other.colspan; column < nn; column++) { if (column == cell.column) { cell.cellAboveIndex = i; break outer; } } } } } else { cell.column = 0; cell.row = 0; } cells.add(cell); cell.set(cellDefaults); if (cell.column < columnDefaults.size()) { Cell<C, T> columnCell = columnDefaults.get(cell.column); if (columnCell != null) cell.merge(columnCell); } cell.merge(rowDefaults); if (widget != null) toolkit.addChild(table, widget); return cell; }
[ "public", "Cell", "<", "C", ",", "T", ">", "add", "(", "C", "widget", ")", "{", "Cell", "<", "C", ",", "T", ">", "cell", "=", "toolkit", ".", "obtainCell", "(", "this", ")", ";", "cell", ".", "widget", "=", "widget", ";", "if", "(", "cells", ".", "size", "(", ")", ">", "0", ")", "{", "// Set cell column and row.\r", "Cell", "<", "C", ",", "T", ">", "lastCell", "=", "cells", ".", "get", "(", "cells", ".", "size", "(", ")", "-", "1", ")", ";", "if", "(", "!", "lastCell", ".", "endRow", ")", "{", "cell", ".", "column", "=", "lastCell", ".", "column", "+", "lastCell", ".", "colspan", ";", "cell", ".", "row", "=", "lastCell", ".", "row", ";", "}", "else", "{", "cell", ".", "column", "=", "0", ";", "cell", ".", "row", "=", "lastCell", ".", "row", "+", "1", ";", "}", "// Set the index of the cell above.\r", "if", "(", "cell", ".", "row", ">", "0", ")", "{", "outer", ":", "for", "(", "int", "i", "=", "cells", ".", "size", "(", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "Cell", "<", "C", ",", "T", ">", "other", "=", "cells", ".", "get", "(", "i", ")", ";", "for", "(", "int", "column", "=", "other", ".", "column", ",", "nn", "=", "column", "+", "other", ".", "colspan", ";", "column", "<", "nn", ";", "column", "++", ")", "{", "if", "(", "column", "==", "cell", ".", "column", ")", "{", "cell", ".", "cellAboveIndex", "=", "i", ";", "break", "outer", ";", "}", "}", "}", "}", "}", "else", "{", "cell", ".", "column", "=", "0", ";", "cell", ".", "row", "=", "0", ";", "}", "cells", ".", "add", "(", "cell", ")", ";", "cell", ".", "set", "(", "cellDefaults", ")", ";", "if", "(", "cell", ".", "column", "<", "columnDefaults", ".", "size", "(", ")", ")", "{", "Cell", "<", "C", ",", "T", ">", "columnCell", "=", "columnDefaults", ".", "get", "(", "cell", ".", "column", ")", ";", "if", "(", "columnCell", "!=", "null", ")", "cell", ".", "merge", "(", "columnCell", ")", ";", "}", "cell", ".", "merge", "(", "rowDefaults", ")", ";", "if", "(", "widget", "!=", "null", ")", "toolkit", ".", "addChild", "(", "table", ",", "widget", ")", ";", "return", "cell", ";", "}" ]
Adds a new cell to the table with the specified widget.
[ "Adds", "a", "new", "cell", "to", "the", "table", "with", "the", "specified", "widget", "." ]
191f19b55a17451d0f277c151c7e9b4427a12415
https://github.com/devnewton/jnuit/blob/191f19b55a17451d0f277c151c7e9b4427a12415/tablelayout/src/main/java/com/esotericsoftware/tablelayout/BaseTableLayout.java#L89-L133
148,570
devnewton/jnuit
tablelayout/src/main/java/com/esotericsoftware/tablelayout/BaseTableLayout.java
BaseTableLayout.row
public Cell<C, T> row() { if (cells.size() > 0) endRow(); if (rowDefaults != null) toolkit.freeCell(rowDefaults); rowDefaults = toolkit.obtainCell(this); rowDefaults.clear(); return rowDefaults; }
java
public Cell<C, T> row() { if (cells.size() > 0) endRow(); if (rowDefaults != null) toolkit.freeCell(rowDefaults); rowDefaults = toolkit.obtainCell(this); rowDefaults.clear(); return rowDefaults; }
[ "public", "Cell", "<", "C", ",", "T", ">", "row", "(", ")", "{", "if", "(", "cells", ".", "size", "(", ")", ">", "0", ")", "endRow", "(", ")", ";", "if", "(", "rowDefaults", "!=", "null", ")", "toolkit", ".", "freeCell", "(", "rowDefaults", ")", ";", "rowDefaults", "=", "toolkit", ".", "obtainCell", "(", "this", ")", ";", "rowDefaults", ".", "clear", "(", ")", ";", "return", "rowDefaults", ";", "}" ]
Indicates that subsequent cells should be added to a new row and returns the cell values that will be used as the defaults for all cells in the new row.
[ "Indicates", "that", "subsequent", "cells", "should", "be", "added", "to", "a", "new", "row", "and", "returns", "the", "cell", "values", "that", "will", "be", "used", "as", "the", "defaults", "for", "all", "cells", "in", "the", "new", "row", "." ]
191f19b55a17451d0f277c151c7e9b4427a12415
https://github.com/devnewton/jnuit/blob/191f19b55a17451d0f277c151c7e9b4427a12415/tablelayout/src/main/java/com/esotericsoftware/tablelayout/BaseTableLayout.java#L140-L148
148,571
devnewton/jnuit
tablelayout/src/main/java/com/esotericsoftware/tablelayout/BaseTableLayout.java
BaseTableLayout.columnDefaults
public Cell<C, T> columnDefaults(int column) { Cell<C, T> cell = columnDefaults.size() > column ? columnDefaults.get(column) : null; if (cell == null) { cell = toolkit.obtainCell(this); cell.clear(); if (column >= columnDefaults.size()) { for (int i = columnDefaults.size(); i < column; i++) columnDefaults.add(null); columnDefaults.add(cell); } else columnDefaults.set(column, cell); } return cell; }
java
public Cell<C, T> columnDefaults(int column) { Cell<C, T> cell = columnDefaults.size() > column ? columnDefaults.get(column) : null; if (cell == null) { cell = toolkit.obtainCell(this); cell.clear(); if (column >= columnDefaults.size()) { for (int i = columnDefaults.size(); i < column; i++) columnDefaults.add(null); columnDefaults.add(cell); } else columnDefaults.set(column, cell); } return cell; }
[ "public", "Cell", "<", "C", ",", "T", ">", "columnDefaults", "(", "int", "column", ")", "{", "Cell", "<", "C", ",", "T", ">", "cell", "=", "columnDefaults", ".", "size", "(", ")", ">", "column", "?", "columnDefaults", ".", "get", "(", "column", ")", ":", "null", ";", "if", "(", "cell", "==", "null", ")", "{", "cell", "=", "toolkit", ".", "obtainCell", "(", "this", ")", ";", "cell", ".", "clear", "(", ")", ";", "if", "(", "column", ">=", "columnDefaults", ".", "size", "(", ")", ")", "{", "for", "(", "int", "i", "=", "columnDefaults", ".", "size", "(", ")", ";", "i", "<", "column", ";", "i", "++", ")", "columnDefaults", ".", "(", "null", ")", ";", "columnDefaults", ".", "add", "(", "cell", ")", ";", "}", "else", "columnDefaults", ".", "set", "(", "column", ",", "cell", ")", ";", "}", "return", "cell", ";", "}" ]
Gets the cell values that will be used as the defaults for all cells in the specified column. Columns are indexed starting at 0.
[ "Gets", "the", "cell", "values", "that", "will", "be", "used", "as", "the", "defaults", "for", "all", "cells", "in", "the", "specified", "column", ".", "Columns", "are", "indexed", "starting", "at", "0", "." ]
191f19b55a17451d0f277c151c7e9b4427a12415
https://github.com/devnewton/jnuit/blob/191f19b55a17451d0f277c151c7e9b4427a12415/tablelayout/src/main/java/com/esotericsoftware/tablelayout/BaseTableLayout.java#L168-L181
148,572
devnewton/jnuit
tablelayout/src/main/java/com/esotericsoftware/tablelayout/BaseTableLayout.java
BaseTableLayout.clear
public void clear() { for (int i = cells.size() - 1; i >= 0; i--) { Cell<C, T> cell = cells.get(i); if (cell.widget != null) toolkit.removeChild(table, cell.widget); toolkit.freeCell(cell); } cells.clear(); rows = 0; columns = 0; if (rowDefaults != null) toolkit.freeCell(rowDefaults); rowDefaults = null; invalidate(); }
java
public void clear() { for (int i = cells.size() - 1; i >= 0; i--) { Cell<C, T> cell = cells.get(i); if (cell.widget != null) toolkit.removeChild(table, cell.widget); toolkit.freeCell(cell); } cells.clear(); rows = 0; columns = 0; if (rowDefaults != null) toolkit.freeCell(rowDefaults); rowDefaults = null; invalidate(); }
[ "public", "void", "clear", "(", ")", "{", "for", "(", "int", "i", "=", "cells", ".", "size", "(", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "Cell", "<", "C", ",", "T", ">", "cell", "=", "cells", ".", "get", "(", "i", ")", ";", "if", "(", "cell", ".", "widget", "!=", "null", ")", "toolkit", ".", "removeChild", "(", "table", ",", "cell", ".", "widget", ")", ";", "toolkit", ".", "freeCell", "(", "cell", ")", ";", "}", "cells", ".", "clear", "(", ")", ";", "rows", "=", "0", ";", "columns", "=", "0", ";", "if", "(", "rowDefaults", "!=", "null", ")", "toolkit", ".", "freeCell", "(", "rowDefaults", ")", ";", "rowDefaults", "=", "null", ";", "invalidate", "(", ")", ";", "}" ]
Removes all widgets and cells from the table.
[ "Removes", "all", "widgets", "and", "cells", "from", "the", "table", "." ]
191f19b55a17451d0f277c151c7e9b4427a12415
https://github.com/devnewton/jnuit/blob/191f19b55a17451d0f277c151c7e9b4427a12415/tablelayout/src/main/java/com/esotericsoftware/tablelayout/BaseTableLayout.java#L208-L222
148,573
devnewton/jnuit
tablelayout/src/main/java/com/esotericsoftware/tablelayout/BaseTableLayout.java
BaseTableLayout.getCell
public Cell<C, T> getCell(C widget) { for (int i = 0, n = cells.size(); i < n; i++) { Cell<C, T> c = cells.get(i); if (c.widget == widget) return c; } return null; }
java
public Cell<C, T> getCell(C widget) { for (int i = 0, n = cells.size(); i < n; i++) { Cell<C, T> c = cells.get(i); if (c.widget == widget) return c; } return null; }
[ "public", "Cell", "<", "C", ",", "T", ">", "getCell", "(", "C", "widget", ")", "{", "for", "(", "int", "i", "=", "0", ",", "n", "=", "cells", ".", "size", "(", ")", ";", "i", "<", "n", ";", "i", "++", ")", "{", "Cell", "<", "C", ",", "T", ">", "c", "=", "cells", ".", "get", "(", "i", ")", ";", "if", "(", "c", ".", "widget", "==", "widget", ")", "return", "c", ";", "}", "return", "null", ";", "}" ]
Returns the cell for the specified widget in this table, or null.
[ "Returns", "the", "cell", "for", "the", "specified", "widget", "in", "this", "table", "or", "null", "." ]
191f19b55a17451d0f277c151c7e9b4427a12415
https://github.com/devnewton/jnuit/blob/191f19b55a17451d0f277c151c7e9b4427a12415/tablelayout/src/main/java/com/esotericsoftware/tablelayout/BaseTableLayout.java#L225-L232
148,574
devnewton/jnuit
tablelayout/src/main/java/com/esotericsoftware/tablelayout/BaseTableLayout.java
BaseTableLayout.debug
public BaseTableLayout<C, T> debug(Debug debug) { this.debug = debug; if (debug == Debug.none) toolkit.clearDebugRectangles(this); else invalidate(); return this; }
java
public BaseTableLayout<C, T> debug(Debug debug) { this.debug = debug; if (debug == Debug.none) toolkit.clearDebugRectangles(this); else invalidate(); return this; }
[ "public", "BaseTableLayout", "<", "C", ",", "T", ">", "debug", "(", "Debug", "debug", ")", "{", "this", ".", "debug", "=", "debug", ";", "if", "(", "debug", "==", "Debug", ".", "none", ")", "toolkit", ".", "clearDebugRectangles", "(", "this", ")", ";", "else", "invalidate", "(", ")", ";", "return", "this", ";", "}" ]
Turns on debug lines.
[ "Turns", "on", "debug", "lines", "." ]
191f19b55a17451d0f277c151c7e9b4427a12415
https://github.com/devnewton/jnuit/blob/191f19b55a17451d0f277c151c7e9b4427a12415/tablelayout/src/main/java/com/esotericsoftware/tablelayout/BaseTableLayout.java#L470-L477
148,575
devnewton/jnuit
tablelayout/src/main/java/com/esotericsoftware/tablelayout/BaseTableLayout.java
BaseTableLayout.getRow
public int getRow(float y) { int row = 0; y += h(padTop); int i = 0, n = cells.size(); if (n == 0) return -1; if (n == 1) return 0; if (cells.get(0).widgetY < cells.get(1).widgetY) { // Using y-down coordinate system. while (i < n) { Cell<C, T> c = cells.get(i++); if (c.getIgnore()) continue; if (c.widgetY + c.computedPadTop > y) break; if (c.endRow) row++; } return row - 1; } // Using y-up coordinate system. while (i < n) { Cell<C, T> c = cells.get(i++); if (c.getIgnore()) continue; if (c.widgetY + c.computedPadTop < y) break; if (c.endRow) row++; } return row; }
java
public int getRow(float y) { int row = 0; y += h(padTop); int i = 0, n = cells.size(); if (n == 0) return -1; if (n == 1) return 0; if (cells.get(0).widgetY < cells.get(1).widgetY) { // Using y-down coordinate system. while (i < n) { Cell<C, T> c = cells.get(i++); if (c.getIgnore()) continue; if (c.widgetY + c.computedPadTop > y) break; if (c.endRow) row++; } return row - 1; } // Using y-up coordinate system. while (i < n) { Cell<C, T> c = cells.get(i++); if (c.getIgnore()) continue; if (c.widgetY + c.computedPadTop < y) break; if (c.endRow) row++; } return row; }
[ "public", "int", "getRow", "(", "float", "y", ")", "{", "int", "row", "=", "0", ";", "y", "+=", "h", "(", "padTop", ")", ";", "int", "i", "=", "0", ",", "n", "=", "cells", ".", "size", "(", ")", ";", "if", "(", "n", "==", "0", ")", "return", "-", "1", ";", "if", "(", "n", "==", "1", ")", "return", "0", ";", "if", "(", "cells", ".", "get", "(", "0", ")", ".", "widgetY", "<", "cells", ".", "get", "(", "1", ")", ".", "widgetY", ")", "{", "// Using y-down coordinate system.\r", "while", "(", "i", "<", "n", ")", "{", "Cell", "<", "C", ",", "T", ">", "c", "=", "cells", ".", "get", "(", "i", "++", ")", ";", "if", "(", "c", ".", "getIgnore", "(", ")", ")", "continue", ";", "if", "(", "c", ".", "widgetY", "+", "c", ".", "computedPadTop", ">", "y", ")", "break", ";", "if", "(", "c", ".", "endRow", ")", "row", "++", ";", "}", "return", "row", "-", "1", ";", "}", "// Using y-up coordinate system.\r", "while", "(", "i", "<", "n", ")", "{", "Cell", "<", "C", ",", "T", ">", "c", "=", "cells", ".", "get", "(", "i", "++", ")", ";", "if", "(", "c", ".", "getIgnore", "(", ")", ")", "continue", ";", "if", "(", "c", ".", "widgetY", "+", "c", ".", "computedPadTop", "<", "y", ")", "break", ";", "if", "(", "c", ".", "endRow", ")", "row", "++", ";", "}", "return", "row", ";", "}" ]
Returns the row index for the y coordinate, or -1 if there are no cells.
[ "Returns", "the", "row", "index", "for", "the", "y", "coordinate", "or", "-", "1", "if", "there", "are", "no", "cells", "." ]
191f19b55a17451d0f277c151c7e9b4427a12415
https://github.com/devnewton/jnuit/blob/191f19b55a17451d0f277c151c7e9b4427a12415/tablelayout/src/main/java/com/esotericsoftware/tablelayout/BaseTableLayout.java#L520-L552
148,576
encircled/Joiner
joiner-core/src/main/java/cz/encircled/joiner/query/Q.java
Q.from
public static <T> JoinerQuery<T, T> from(EntityPath<T> from) { return new JoinerQueryBase<>(from, from); }
java
public static <T> JoinerQuery<T, T> from(EntityPath<T> from) { return new JoinerQueryBase<>(from, from); }
[ "public", "static", "<", "T", ">", "JoinerQuery", "<", "T", ",", "T", ">", "from", "(", "EntityPath", "<", "T", ">", "from", ")", "{", "return", "new", "JoinerQueryBase", "<>", "(", "from", ",", "from", ")", ";", "}" ]
Build "from" clause of query @param from alias of source entity @param <T> type of source entity @return joiner query
[ "Build", "from", "clause", "of", "query" ]
7b9117db05d8b89feeeb9ef7ce944256330d405c
https://github.com/encircled/Joiner/blob/7b9117db05d8b89feeeb9ef7ce944256330d405c/joiner-core/src/main/java/cz/encircled/joiner/query/Q.java#L42-L44
148,577
encircled/Joiner
joiner-core/src/main/java/cz/encircled/joiner/query/Q.java
Q.count
public static <T> JoinerQuery<T, Long> count(EntityPath<T> from) { JoinerQueryBase<T, Long> request = new JoinerQueryBase<>(from, true); request.distinct(false); return request; }
java
public static <T> JoinerQuery<T, Long> count(EntityPath<T> from) { JoinerQueryBase<T, Long> request = new JoinerQueryBase<>(from, true); request.distinct(false); return request; }
[ "public", "static", "<", "T", ">", "JoinerQuery", "<", "T", ",", "Long", ">", "count", "(", "EntityPath", "<", "T", ">", "from", ")", "{", "JoinerQueryBase", "<", "T", ",", "Long", ">", "request", "=", "new", "JoinerQueryBase", "<>", "(", "from", ",", "true", ")", ";", "request", ".", "distinct", "(", "false", ")", ";", "return", "request", ";", "}" ]
Build count query @param from alias of source entity @param <T> type of source entity @return count joiner query
[ "Build", "count", "query" ]
7b9117db05d8b89feeeb9ef7ce944256330d405c
https://github.com/encircled/Joiner/blob/7b9117db05d8b89feeeb9ef7ce944256330d405c/joiner-core/src/main/java/cz/encircled/joiner/query/Q.java#L53-L57
148,578
socialsensor/socialsensor-framework-common
src/main/java/eu/socialsensor/framework/common/repositories/StatusRepresentation.java
StatusRepresentation.init
public StatusRepresentation init(StatusRepresentation s) { _source = s._source; _status = s._status; _jsonString = s._jsonString; _jsonObj = s._jsonObj; _id = s._id; return this; }
java
public StatusRepresentation init(StatusRepresentation s) { _source = s._source; _status = s._status; _jsonString = s._jsonString; _jsonObj = s._jsonObj; _id = s._id; return this; }
[ "public", "StatusRepresentation", "init", "(", "StatusRepresentation", "s", ")", "{", "_source", "=", "s", ".", "_source", ";", "_status", "=", "s", ".", "_status", ";", "_jsonString", "=", "s", ".", "_jsonString", ";", "_jsonObj", "=", "s", ".", "_jsonObj", ";", "_id", "=", "s", ".", "_id", ";", "return", "this", ";", "}" ]
Initializes the object to contain the given status @param s an object to copy.
[ "Initializes", "the", "object", "to", "contain", "the", "given", "status" ]
b69e7c47f3e0a9062c373aaec7cb2ba1e19c6ce0
https://github.com/socialsensor/socialsensor-framework-common/blob/b69e7c47f3e0a9062c373aaec7cb2ba1e19c6ce0/src/main/java/eu/socialsensor/framework/common/repositories/StatusRepresentation.java#L58-L65
148,579
socialsensor/socialsensor-framework-common
src/main/java/eu/socialsensor/framework/common/repositories/StatusRepresentation.java
StatusRepresentation.init
public StatusRepresentation init(String source, String jsonString) { if (jsonString == null || jsonString.contains("{")) return init(source, null, jsonString, null); // if the input doesn't look like a JSON string, it might be a simple // status ID init(source, null, null, null); _id = Long.valueOf(jsonString.trim()); return this; }
java
public StatusRepresentation init(String source, String jsonString) { if (jsonString == null || jsonString.contains("{")) return init(source, null, jsonString, null); // if the input doesn't look like a JSON string, it might be a simple // status ID init(source, null, null, null); _id = Long.valueOf(jsonString.trim()); return this; }
[ "public", "StatusRepresentation", "init", "(", "String", "source", ",", "String", "jsonString", ")", "{", "if", "(", "jsonString", "==", "null", "||", "jsonString", ".", "contains", "(", "\"{\"", ")", ")", "return", "init", "(", "source", ",", "null", ",", "jsonString", ",", "null", ")", ";", "// if the input doesn't look like a JSON string, it might be a simple\r", "// status ID\r", "init", "(", "source", ",", "null", ",", "null", ",", "null", ")", ";", "_id", "=", "Long", ".", "valueOf", "(", "jsonString", ".", "trim", "(", ")", ")", ";", "return", "this", ";", "}" ]
Initializes the object to contain the given status. @param source a string describing where the tweet came from @param jsonString a string representing the Twitter status in JSON format @return this object
[ "Initializes", "the", "object", "to", "contain", "the", "given", "status", "." ]
b69e7c47f3e0a9062c373aaec7cb2ba1e19c6ce0
https://github.com/socialsensor/socialsensor-framework-common/blob/b69e7c47f3e0a9062c373aaec7cb2ba1e19c6ce0/src/main/java/eu/socialsensor/framework/common/repositories/StatusRepresentation.java#L89-L97
148,580
socialsensor/socialsensor-framework-common
src/main/java/eu/socialsensor/framework/common/repositories/StatusRepresentation.java
StatusRepresentation.init
public StatusRepresentation init(String source, /*Status*/ Object status, String jsonString, JsonObject jsonObj) { _source = source; _status = status; _jsonString = jsonString; _jsonObj = jsonObj; _id = null; return this; }
java
public StatusRepresentation init(String source, /*Status*/ Object status, String jsonString, JsonObject jsonObj) { _source = source; _status = status; _jsonString = jsonString; _jsonObj = jsonObj; _id = null; return this; }
[ "public", "StatusRepresentation", "init", "(", "String", "source", ",", "/*Status*/", "Object", "status", ",", "String", "jsonString", ",", "JsonObject", "jsonObj", ")", "{", "_source", "=", "source", ";", "_status", "=", "status", ";", "_jsonString", "=", "jsonString", ";", "_jsonObj", "=", "jsonObj", ";", "_id", "=", "null", ";", "return", "this", ";", "}" ]
Initializes the object to contain the given status, from multiple representations of the object. @param source a string describing where the tweet came from @param status the Twitter4J status representation of the tweet @param jsonString a string representing the Twitter status in JSON format @param jsonObj a JSON object representing the tweet @return this object
[ "Initializes", "the", "object", "to", "contain", "the", "given", "status", "from", "multiple", "representations", "of", "the", "object", "." ]
b69e7c47f3e0a9062c373aaec7cb2ba1e19c6ce0
https://github.com/socialsensor/socialsensor-framework-common/blob/b69e7c47f3e0a9062c373aaec7cb2ba1e19c6ce0/src/main/java/eu/socialsensor/framework/common/repositories/StatusRepresentation.java#L113-L121
148,581
socialsensor/socialsensor-framework-common
src/main/java/eu/socialsensor/framework/common/repositories/StatusRepresentation.java
StatusRepresentation.isRelatedTo
public boolean isRelatedTo(InfluentialContributorSet infs, boolean sender, boolean userMentions, boolean retweetOrigin) { if (sender) { // check for the presence of the id in the path: // { "user": { "id": USER_ID JsonElement js = getJsonObject().get("user"); if (js != null) { js = js.getAsJsonObject().get("id"); if (js != null) { // long userId = js.getAsLong(); String userId = js.getAsString(); if (infs.contains(userId)) return true; } } } // check for the presence of the id in the path: // { "retweeted_status": { "user": { "id" : USER_ID if (retweetOrigin) { JsonElement js = getJsonObject().get("retweeted_status"); if (js != null) { js = js.getAsJsonObject().get("user"); if (js != null) { js = js.getAsJsonObject().get("id"); if (js != null) { // long userId = js.getAsLong(); String userId = js.getAsString(); if (infs.contains(userId)) return true; } } } } // check for the presence of the id in the path: // { "entities": { "user_mentions": [ { "id": USER_ID if (userMentions) { JsonElement js = getJsonObject().get("entities"); if (js != null) { js = js.getAsJsonObject().get("user_mentions"); if (js != null) { JsonArray jsa = js.getAsJsonArray(); for (int j = 0; j < jsa.size(); j++) { js = jsa.get(j).getAsJsonObject().get("id"); if (js != null) { // long userId = js.getAsLong(); String userId = js.getAsString(); if (infs.contains(userId)) return true; } } } } } // otherwise the tweet isn't relevant return false; }
java
public boolean isRelatedTo(InfluentialContributorSet infs, boolean sender, boolean userMentions, boolean retweetOrigin) { if (sender) { // check for the presence of the id in the path: // { "user": { "id": USER_ID JsonElement js = getJsonObject().get("user"); if (js != null) { js = js.getAsJsonObject().get("id"); if (js != null) { // long userId = js.getAsLong(); String userId = js.getAsString(); if (infs.contains(userId)) return true; } } } // check for the presence of the id in the path: // { "retweeted_status": { "user": { "id" : USER_ID if (retweetOrigin) { JsonElement js = getJsonObject().get("retweeted_status"); if (js != null) { js = js.getAsJsonObject().get("user"); if (js != null) { js = js.getAsJsonObject().get("id"); if (js != null) { // long userId = js.getAsLong(); String userId = js.getAsString(); if (infs.contains(userId)) return true; } } } } // check for the presence of the id in the path: // { "entities": { "user_mentions": [ { "id": USER_ID if (userMentions) { JsonElement js = getJsonObject().get("entities"); if (js != null) { js = js.getAsJsonObject().get("user_mentions"); if (js != null) { JsonArray jsa = js.getAsJsonArray(); for (int j = 0; j < jsa.size(); j++) { js = jsa.get(j).getAsJsonObject().get("id"); if (js != null) { // long userId = js.getAsLong(); String userId = js.getAsString(); if (infs.contains(userId)) return true; } } } } } // otherwise the tweet isn't relevant return false; }
[ "public", "boolean", "isRelatedTo", "(", "InfluentialContributorSet", "infs", ",", "boolean", "sender", ",", "boolean", "userMentions", ",", "boolean", "retweetOrigin", ")", "{", "if", "(", "sender", ")", "{", "// check for the presence of the id in the path:\r", "// { \"user\": { \"id\": USER_ID\r", "JsonElement", "js", "=", "getJsonObject", "(", ")", ".", "get", "(", "\"user\"", ")", ";", "if", "(", "js", "!=", "null", ")", "{", "js", "=", "js", ".", "getAsJsonObject", "(", ")", ".", "get", "(", "\"id\"", ")", ";", "if", "(", "js", "!=", "null", ")", "{", "// long userId = js.getAsLong();\r", "String", "userId", "=", "js", ".", "getAsString", "(", ")", ";", "if", "(", "infs", ".", "contains", "(", "userId", ")", ")", "return", "true", ";", "}", "}", "}", "// check for the presence of the id in the path:\r", "// { \"retweeted_status\": { \"user\": { \"id\" : USER_ID\r", "if", "(", "retweetOrigin", ")", "{", "JsonElement", "js", "=", "getJsonObject", "(", ")", ".", "get", "(", "\"retweeted_status\"", ")", ";", "if", "(", "js", "!=", "null", ")", "{", "js", "=", "js", ".", "getAsJsonObject", "(", ")", ".", "get", "(", "\"user\"", ")", ";", "if", "(", "js", "!=", "null", ")", "{", "js", "=", "js", ".", "getAsJsonObject", "(", ")", ".", "get", "(", "\"id\"", ")", ";", "if", "(", "js", "!=", "null", ")", "{", "// long userId = js.getAsLong();\r", "String", "userId", "=", "js", ".", "getAsString", "(", ")", ";", "if", "(", "infs", ".", "contains", "(", "userId", ")", ")", "return", "true", ";", "}", "}", "}", "}", "// check for the presence of the id in the path:\r", "// { \"entities\": { \"user_mentions\": [ { \"id\": USER_ID\r", "if", "(", "userMentions", ")", "{", "JsonElement", "js", "=", "getJsonObject", "(", ")", ".", "get", "(", "\"entities\"", ")", ";", "if", "(", "js", "!=", "null", ")", "{", "js", "=", "js", ".", "getAsJsonObject", "(", ")", ".", "get", "(", "\"user_mentions\"", ")", ";", "if", "(", "js", "!=", "null", ")", "{", "JsonArray", "jsa", "=", "js", ".", "getAsJsonArray", "(", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "jsa", ".", "size", "(", ")", ";", "j", "++", ")", "{", "js", "=", "jsa", ".", "get", "(", "j", ")", ".", "getAsJsonObject", "(", ")", ".", "get", "(", "\"id\"", ")", ";", "if", "(", "js", "!=", "null", ")", "{", "// long userId = js.getAsLong();\r", "String", "userId", "=", "js", ".", "getAsString", "(", ")", ";", "if", "(", "infs", ".", "contains", "(", "userId", ")", ")", "return", "true", ";", "}", "}", "}", "}", "}", "// otherwise the tweet isn't relevant\r", "return", "false", ";", "}" ]
Determines whether the Twitter status is related to one of the users in the set of given ids. @param infs a set of influential contributors @param sender if the person who created the status is in the ids set, return true @param userMentions if the status contains a user mention that is contained in the ids set, return true @param retweetOrigin if the status is a retweet that was originated by a user in the ids set, return true @returns true if one of the ids in the input parameter matches an id found in the tweet
[ "Determines", "whether", "the", "Twitter", "status", "is", "related", "to", "one", "of", "the", "users", "in", "the", "set", "of", "given", "ids", "." ]
b69e7c47f3e0a9062c373aaec7cb2ba1e19c6ce0
https://github.com/socialsensor/socialsensor-framework-common/blob/b69e7c47f3e0a9062c373aaec7cb2ba1e19c6ce0/src/main/java/eu/socialsensor/framework/common/repositories/StatusRepresentation.java#L207-L265
148,582
craterdog/java-security-framework
java-certificate-management-api/src/main/java/craterdog/security/CertificateManager.java
CertificateManager.saveKeyStore
public final void saveKeyStore(OutputStream output, KeyStore keyStore, char[] password) throws IOException { logger.entry(); try { keyStore.store(output, password); } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException e) { RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to save a keystore.", e); logger.error(exception.toString()); throw exception; } logger.exit(); }
java
public final void saveKeyStore(OutputStream output, KeyStore keyStore, char[] password) throws IOException { logger.entry(); try { keyStore.store(output, password); } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException e) { RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to save a keystore.", e); logger.error(exception.toString()); throw exception; } logger.exit(); }
[ "public", "final", "void", "saveKeyStore", "(", "OutputStream", "output", ",", "KeyStore", "keyStore", ",", "char", "[", "]", "password", ")", "throws", "IOException", "{", "logger", ".", "entry", "(", ")", ";", "try", "{", "keyStore", ".", "store", "(", "output", ",", "password", ")", ";", "}", "catch", "(", "KeyStoreException", "|", "NoSuchAlgorithmException", "|", "CertificateException", "e", ")", "{", "RuntimeException", "exception", "=", "new", "RuntimeException", "(", "\"An unexpected exception occurred while attempting to save a keystore.\"", ",", "e", ")", ";", "logger", ".", "error", "(", "exception", ".", "toString", "(", ")", ")", ";", "throw", "exception", ";", "}", "logger", ".", "exit", "(", ")", ";", "}" ]
This method saves a PKCS12 format key store out to an output stream. @param output The output stream to be written to. @param keyStore The PKCS12 format key store. @param password The password that should be used to encrypt the file. @throws java.io.IOException Unable to save the key store to the specified output stream.
[ "This", "method", "saves", "a", "PKCS12", "format", "key", "store", "out", "to", "an", "output", "stream", "." ]
a5634c19812d473b608bc11060f5cbb4b4b0b5da
https://github.com/craterdog/java-security-framework/blob/a5634c19812d473b608bc11060f5cbb4b4b0b5da/java-certificate-management-api/src/main/java/craterdog/security/CertificateManager.java#L44-L54
148,583
craterdog/java-security-framework
java-certificate-management-api/src/main/java/craterdog/security/CertificateManager.java
CertificateManager.retrieveKeyStore
public final KeyStore retrieveKeyStore(InputStream input, char[] password) throws IOException { logger.entry(); try { KeyStore keyStore = KeyStore.getInstance(KEY_STORE_FORMAT); keyStore.load(input, password); logger.exit(); return keyStore; } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException e) { RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to retrieve a keystore.", e); logger.error(exception.toString()); throw exception; } }
java
public final KeyStore retrieveKeyStore(InputStream input, char[] password) throws IOException { logger.entry(); try { KeyStore keyStore = KeyStore.getInstance(KEY_STORE_FORMAT); keyStore.load(input, password); logger.exit(); return keyStore; } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException e) { RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to retrieve a keystore.", e); logger.error(exception.toString()); throw exception; } }
[ "public", "final", "KeyStore", "retrieveKeyStore", "(", "InputStream", "input", ",", "char", "[", "]", "password", ")", "throws", "IOException", "{", "logger", ".", "entry", "(", ")", ";", "try", "{", "KeyStore", "keyStore", "=", "KeyStore", ".", "getInstance", "(", "KEY_STORE_FORMAT", ")", ";", "keyStore", ".", "load", "(", "input", ",", "password", ")", ";", "logger", ".", "exit", "(", ")", ";", "return", "keyStore", ";", "}", "catch", "(", "KeyStoreException", "|", "NoSuchAlgorithmException", "|", "CertificateException", "e", ")", "{", "RuntimeException", "exception", "=", "new", "RuntimeException", "(", "\"An unexpected exception occurred while attempting to retrieve a keystore.\"", ",", "e", ")", ";", "logger", ".", "error", "(", "exception", ".", "toString", "(", ")", ")", ";", "throw", "exception", ";", "}", "}" ]
This method retrieves a PKCS12 format key store from an input stream. @param input The input stream from which to read the key store. @param password The password that was used to encrypt the file. @return The PKCS12 format key store. @throws java.io.IOException Unable to retrieve the key store from the specified input stream.
[ "This", "method", "retrieves", "a", "PKCS12", "format", "key", "store", "from", "an", "input", "stream", "." ]
a5634c19812d473b608bc11060f5cbb4b4b0b5da
https://github.com/craterdog/java-security-framework/blob/a5634c19812d473b608bc11060f5cbb4b4b0b5da/java-certificate-management-api/src/main/java/craterdog/security/CertificateManager.java#L65-L77
148,584
craterdog/java-security-framework
java-certificate-management-api/src/main/java/craterdog/security/CertificateManager.java
CertificateManager.retrieveCertificate
public final X509Certificate retrieveCertificate(KeyStore keyStore, String certificateName) { try { logger.entry(); X509Certificate certificate = (X509Certificate) keyStore.getCertificate(certificateName); logger.exit(); return certificate; } catch (KeyStoreException e) { RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to retrieve a certificate.", e); logger.error(exception.toString()); throw exception; } }
java
public final X509Certificate retrieveCertificate(KeyStore keyStore, String certificateName) { try { logger.entry(); X509Certificate certificate = (X509Certificate) keyStore.getCertificate(certificateName); logger.exit(); return certificate; } catch (KeyStoreException e) { RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to retrieve a certificate.", e); logger.error(exception.toString()); throw exception; } }
[ "public", "final", "X509Certificate", "retrieveCertificate", "(", "KeyStore", "keyStore", ",", "String", "certificateName", ")", "{", "try", "{", "logger", ".", "entry", "(", ")", ";", "X509Certificate", "certificate", "=", "(", "X509Certificate", ")", "keyStore", ".", "getCertificate", "(", "certificateName", ")", ";", "logger", ".", "exit", "(", ")", ";", "return", "certificate", ";", "}", "catch", "(", "KeyStoreException", "e", ")", "{", "RuntimeException", "exception", "=", "new", "RuntimeException", "(", "\"An unexpected exception occurred while attempting to retrieve a certificate.\"", ",", "e", ")", ";", "logger", ".", "error", "(", "exception", ".", "toString", "(", ")", ")", ";", "throw", "exception", ";", "}", "}" ]
This method retrieves a public certificate from a key store. @param keyStore The key store containing the certificate. @param certificateName The name (alias) of the certificate. @return The X509 format public certificate.
[ "This", "method", "retrieves", "a", "public", "certificate", "from", "a", "key", "store", "." ]
a5634c19812d473b608bc11060f5cbb4b4b0b5da
https://github.com/craterdog/java-security-framework/blob/a5634c19812d473b608bc11060f5cbb4b4b0b5da/java-certificate-management-api/src/main/java/craterdog/security/CertificateManager.java#L87-L98
148,585
craterdog/java-security-framework
java-certificate-management-api/src/main/java/craterdog/security/CertificateManager.java
CertificateManager.retrievePrivateKey
public final PrivateKey retrievePrivateKey(KeyStore keyStore, String keyName, char[] password) { try { logger.entry(); PrivateKey privateKey = (PrivateKey) keyStore.getKey(keyName, password); logger.exit(); return privateKey; } catch (KeyStoreException | NoSuchAlgorithmException | UnrecoverableKeyException e) { RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to retrieve a private key.", e); logger.error(exception.toString()); throw exception; } }
java
public final PrivateKey retrievePrivateKey(KeyStore keyStore, String keyName, char[] password) { try { logger.entry(); PrivateKey privateKey = (PrivateKey) keyStore.getKey(keyName, password); logger.exit(); return privateKey; } catch (KeyStoreException | NoSuchAlgorithmException | UnrecoverableKeyException e) { RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to retrieve a private key.", e); logger.error(exception.toString()); throw exception; } }
[ "public", "final", "PrivateKey", "retrievePrivateKey", "(", "KeyStore", "keyStore", ",", "String", "keyName", ",", "char", "[", "]", "password", ")", "{", "try", "{", "logger", ".", "entry", "(", ")", ";", "PrivateKey", "privateKey", "=", "(", "PrivateKey", ")", "keyStore", ".", "getKey", "(", "keyName", ",", "password", ")", ";", "logger", ".", "exit", "(", ")", ";", "return", "privateKey", ";", "}", "catch", "(", "KeyStoreException", "|", "NoSuchAlgorithmException", "|", "UnrecoverableKeyException", "e", ")", "{", "RuntimeException", "exception", "=", "new", "RuntimeException", "(", "\"An unexpected exception occurred while attempting to retrieve a private key.\"", ",", "e", ")", ";", "logger", ".", "error", "(", "exception", ".", "toString", "(", ")", ")", ";", "throw", "exception", ";", "}", "}" ]
This method retrieves a private key from a key store. @param keyStore The key store containing the private key. @param keyName The name (alias) of the private key. @param password The password used to encrypt the private key. @return The decrypted private key.
[ "This", "method", "retrieves", "a", "private", "key", "from", "a", "key", "store", "." ]
a5634c19812d473b608bc11060f5cbb4b4b0b5da
https://github.com/craterdog/java-security-framework/blob/a5634c19812d473b608bc11060f5cbb4b4b0b5da/java-certificate-management-api/src/main/java/craterdog/security/CertificateManager.java#L109-L120
148,586
craterdog/java-security-framework
java-certificate-management-api/src/main/java/craterdog/security/CertificateManager.java
CertificateManager.createPkcs12KeyStore
public final KeyStore createPkcs12KeyStore(String keyName, char[] password, PrivateKey privateKey, X509Certificate certificate) { logger.entry(); List<X509Certificate> certificates = new ArrayList<>(); certificates.add(certificate); KeyStore keyStore = createPkcs12KeyStore(keyName, password, privateKey, certificates); logger.exit(); return keyStore; }
java
public final KeyStore createPkcs12KeyStore(String keyName, char[] password, PrivateKey privateKey, X509Certificate certificate) { logger.entry(); List<X509Certificate> certificates = new ArrayList<>(); certificates.add(certificate); KeyStore keyStore = createPkcs12KeyStore(keyName, password, privateKey, certificates); logger.exit(); return keyStore; }
[ "public", "final", "KeyStore", "createPkcs12KeyStore", "(", "String", "keyName", ",", "char", "[", "]", "password", ",", "PrivateKey", "privateKey", ",", "X509Certificate", "certificate", ")", "{", "logger", ".", "entry", "(", ")", ";", "List", "<", "X509Certificate", ">", "certificates", "=", "new", "ArrayList", "<>", "(", ")", ";", "certificates", ".", "add", "(", "certificate", ")", ";", "KeyStore", "keyStore", "=", "createPkcs12KeyStore", "(", "keyName", ",", "password", ",", "privateKey", ",", "certificates", ")", ";", "logger", ".", "exit", "(", ")", ";", "return", "keyStore", ";", "}" ]
This method creates a new PKCS12 format key store containing a named private key and public certificate. @param keyName The name of the private key and public certificate. @param password The password used to encrypt the private key. @param privateKey The private key. @param certificate The X509 format public certificate. @return The new PKCS12 format key store.
[ "This", "method", "creates", "a", "new", "PKCS12", "format", "key", "store", "containing", "a", "named", "private", "key", "and", "public", "certificate", "." ]
a5634c19812d473b608bc11060f5cbb4b4b0b5da
https://github.com/craterdog/java-security-framework/blob/a5634c19812d473b608bc11060f5cbb4b4b0b5da/java-certificate-management-api/src/main/java/craterdog/security/CertificateManager.java#L161-L168
148,587
craterdog/java-security-framework
java-certificate-management-api/src/main/java/craterdog/security/CertificateManager.java
CertificateManager.createPkcs12KeyStore
public final KeyStore createPkcs12KeyStore(String keyName, char[] password, PrivateKey privateKey, List<X509Certificate> certificates) { try { logger.entry(); X509Certificate[] chain = new X509Certificate[certificates.size()]; chain = certificates.toArray(chain); KeyStore keyStore = KeyStore.getInstance(KEY_STORE_FORMAT); keyStore.load(null, null); keyStore.setKeyEntry(keyName, privateKey, password, chain); logger.exit(); return keyStore; } catch (IOException | KeyStoreException | NoSuchAlgorithmException | CertificateException e) { RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to create a new keystore.", e); logger.error(exception.toString()); throw exception; } }
java
public final KeyStore createPkcs12KeyStore(String keyName, char[] password, PrivateKey privateKey, List<X509Certificate> certificates) { try { logger.entry(); X509Certificate[] chain = new X509Certificate[certificates.size()]; chain = certificates.toArray(chain); KeyStore keyStore = KeyStore.getInstance(KEY_STORE_FORMAT); keyStore.load(null, null); keyStore.setKeyEntry(keyName, privateKey, password, chain); logger.exit(); return keyStore; } catch (IOException | KeyStoreException | NoSuchAlgorithmException | CertificateException e) { RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to create a new keystore.", e); logger.error(exception.toString()); throw exception; } }
[ "public", "final", "KeyStore", "createPkcs12KeyStore", "(", "String", "keyName", ",", "char", "[", "]", "password", ",", "PrivateKey", "privateKey", ",", "List", "<", "X509Certificate", ">", "certificates", ")", "{", "try", "{", "logger", ".", "entry", "(", ")", ";", "X509Certificate", "[", "]", "chain", "=", "new", "X509Certificate", "[", "certificates", ".", "size", "(", ")", "]", ";", "chain", "=", "certificates", ".", "toArray", "(", "chain", ")", ";", "KeyStore", "keyStore", "=", "KeyStore", ".", "getInstance", "(", "KEY_STORE_FORMAT", ")", ";", "keyStore", ".", "load", "(", "null", ",", "null", ")", ";", "keyStore", ".", "setKeyEntry", "(", "keyName", ",", "privateKey", ",", "password", ",", "chain", ")", ";", "logger", ".", "exit", "(", ")", ";", "return", "keyStore", ";", "}", "catch", "(", "IOException", "|", "KeyStoreException", "|", "NoSuchAlgorithmException", "|", "CertificateException", "e", ")", "{", "RuntimeException", "exception", "=", "new", "RuntimeException", "(", "\"An unexpected exception occurred while attempting to create a new keystore.\"", ",", "e", ")", ";", "logger", ".", "error", "(", "exception", ".", "toString", "(", ")", ")", ";", "throw", "exception", ";", "}", "}" ]
This method creates a new PKCS12 format key store containing a named private key and public certificate chain. @param keyName The name of the private key and public certificate. @param password The password used to encrypt the private key. @param privateKey The private key. @param certificates The chain of X509 format public certificates. @return The new PKCS12 format key store.
[ "This", "method", "creates", "a", "new", "PKCS12", "format", "key", "store", "containing", "a", "named", "private", "key", "and", "public", "certificate", "chain", "." ]
a5634c19812d473b608bc11060f5cbb4b4b0b5da
https://github.com/craterdog/java-security-framework/blob/a5634c19812d473b608bc11060f5cbb4b4b0b5da/java-certificate-management-api/src/main/java/craterdog/security/CertificateManager.java#L180-L195
148,588
craterdog/java-security-framework
java-certificate-management-api/src/main/java/craterdog/security/CertificateManager.java
CertificateManager.encodeKeyStore
public final String encodeKeyStore(KeyStore keyStore, char[] password) { logger.entry(); try (ByteArrayOutputStream out = new ByteArrayOutputStream()) { keyStore.store(out, password); out.flush(); byte[] bytes = out.toByteArray(); String encodedKeyStore = Base64Utils.encode(bytes); logger.exit(); return encodedKeyStore; } catch (IOException | KeyStoreException | NoSuchAlgorithmException | CertificateException e) { RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to encode a keystore.", e); logger.error(exception.toString()); throw exception; } }
java
public final String encodeKeyStore(KeyStore keyStore, char[] password) { logger.entry(); try (ByteArrayOutputStream out = new ByteArrayOutputStream()) { keyStore.store(out, password); out.flush(); byte[] bytes = out.toByteArray(); String encodedKeyStore = Base64Utils.encode(bytes); logger.exit(); return encodedKeyStore; } catch (IOException | KeyStoreException | NoSuchAlgorithmException | CertificateException e) { RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to encode a keystore.", e); logger.error(exception.toString()); throw exception; } }
[ "public", "final", "String", "encodeKeyStore", "(", "KeyStore", "keyStore", ",", "char", "[", "]", "password", ")", "{", "logger", ".", "entry", "(", ")", ";", "try", "(", "ByteArrayOutputStream", "out", "=", "new", "ByteArrayOutputStream", "(", ")", ")", "{", "keyStore", ".", "store", "(", "out", ",", "password", ")", ";", "out", ".", "flush", "(", ")", ";", "byte", "[", "]", "bytes", "=", "out", ".", "toByteArray", "(", ")", ";", "String", "encodedKeyStore", "=", "Base64Utils", ".", "encode", "(", "bytes", ")", ";", "logger", ".", "exit", "(", ")", ";", "return", "encodedKeyStore", ";", "}", "catch", "(", "IOException", "|", "KeyStoreException", "|", "NoSuchAlgorithmException", "|", "CertificateException", "e", ")", "{", "RuntimeException", "exception", "=", "new", "RuntimeException", "(", "\"An unexpected exception occurred while attempting to encode a keystore.\"", ",", "e", ")", ";", "logger", ".", "error", "(", "exception", ".", "toString", "(", ")", ")", ";", "throw", "exception", ";", "}", "}" ]
This method encodes a PKCS12 format key store into a base 64 string format. @param keyStore The PKCS12 format key store to be encoded. @param password The password to be used to encrypt the byte stream. @return The base 64 encoded string.
[ "This", "method", "encodes", "a", "PKCS12", "format", "key", "store", "into", "a", "base", "64", "string", "format", "." ]
a5634c19812d473b608bc11060f5cbb4b4b0b5da
https://github.com/craterdog/java-security-framework/blob/a5634c19812d473b608bc11060f5cbb4b4b0b5da/java-certificate-management-api/src/main/java/craterdog/security/CertificateManager.java#L223-L237
148,589
craterdog/java-security-framework
java-certificate-management-api/src/main/java/craterdog/security/CertificateManager.java
CertificateManager.decodeKeyStore
public final KeyStore decodeKeyStore(String base64String, char[] password) { logger.entry(); byte[] bytes = Base64Utils.decode(base64String); try (ByteArrayInputStream in = new ByteArrayInputStream(bytes)) { KeyStore keyStore = KeyStore.getInstance(KEY_STORE_FORMAT); keyStore.load(in, password); logger.exit(); return keyStore; } catch (IOException | KeyStoreException | NoSuchAlgorithmException | CertificateException e) { RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to decode a keystore.", e); logger.error(exception.toString()); throw exception; } }
java
public final KeyStore decodeKeyStore(String base64String, char[] password) { logger.entry(); byte[] bytes = Base64Utils.decode(base64String); try (ByteArrayInputStream in = new ByteArrayInputStream(bytes)) { KeyStore keyStore = KeyStore.getInstance(KEY_STORE_FORMAT); keyStore.load(in, password); logger.exit(); return keyStore; } catch (IOException | KeyStoreException | NoSuchAlgorithmException | CertificateException e) { RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to decode a keystore.", e); logger.error(exception.toString()); throw exception; } }
[ "public", "final", "KeyStore", "decodeKeyStore", "(", "String", "base64String", ",", "char", "[", "]", "password", ")", "{", "logger", ".", "entry", "(", ")", ";", "byte", "[", "]", "bytes", "=", "Base64Utils", ".", "decode", "(", "base64String", ")", ";", "try", "(", "ByteArrayInputStream", "in", "=", "new", "ByteArrayInputStream", "(", "bytes", ")", ")", "{", "KeyStore", "keyStore", "=", "KeyStore", ".", "getInstance", "(", "KEY_STORE_FORMAT", ")", ";", "keyStore", ".", "load", "(", "in", ",", "password", ")", ";", "logger", ".", "exit", "(", ")", ";", "return", "keyStore", ";", "}", "catch", "(", "IOException", "|", "KeyStoreException", "|", "NoSuchAlgorithmException", "|", "CertificateException", "e", ")", "{", "RuntimeException", "exception", "=", "new", "RuntimeException", "(", "\"An unexpected exception occurred while attempting to decode a keystore.\"", ",", "e", ")", ";", "logger", ".", "error", "(", "exception", ".", "toString", "(", ")", ")", ";", "throw", "exception", ";", "}", "}" ]
This method decodes a PKCS12 format key store from its encrypted byte stream. @param base64String The base 64 encoded, password encrypted PKCS12 byte stream. @param password The password that was used to encrypt the byte stream. @return The PKCS12 format key store.
[ "This", "method", "decodes", "a", "PKCS12", "format", "key", "store", "from", "its", "encrypted", "byte", "stream", "." ]
a5634c19812d473b608bc11060f5cbb4b4b0b5da
https://github.com/craterdog/java-security-framework/blob/a5634c19812d473b608bc11060f5cbb4b4b0b5da/java-certificate-management-api/src/main/java/craterdog/security/CertificateManager.java#L247-L260
148,590
devnewton/jnuit
pngdecoder/src/main/java/de/matthiasmann/twl/utils/PNGDecoder.java
PNGDecoder.decodeFlipped
public void decodeFlipped(ByteBuffer buffer, int stride, Format fmt) throws IOException { if(stride <= 0) { throw new IllegalArgumentException("stride"); } int pos = buffer.position(); int posDelta = (height-1) * stride; buffer.position(pos + posDelta); decode(buffer, -stride, fmt); buffer.position(buffer.position() + posDelta); }
java
public void decodeFlipped(ByteBuffer buffer, int stride, Format fmt) throws IOException { if(stride <= 0) { throw new IllegalArgumentException("stride"); } int pos = buffer.position(); int posDelta = (height-1) * stride; buffer.position(pos + posDelta); decode(buffer, -stride, fmt); buffer.position(buffer.position() + posDelta); }
[ "public", "void", "decodeFlipped", "(", "ByteBuffer", "buffer", ",", "int", "stride", ",", "Format", "fmt", ")", "throws", "IOException", "{", "if", "(", "stride", "<=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"stride\"", ")", ";", "}", "int", "pos", "=", "buffer", ".", "position", "(", ")", ";", "int", "posDelta", "=", "(", "height", "-", "1", ")", "*", "stride", ";", "buffer", ".", "position", "(", "pos", "+", "posDelta", ")", ";", "decode", "(", "buffer", ",", "-", "stride", ",", "fmt", ")", ";", "buffer", ".", "position", "(", "buffer", ".", "position", "(", ")", "+", "posDelta", ")", ";", "}" ]
Decodes the image into the specified buffer. The last line is placed at the current position. After decode the buffer position is at the end of the first line. @param buffer the buffer @param stride the stride in bytes from start of a line to start of the next line, must be positive. @param fmt the target format into which the image should be decoded. @throws IOException if a read or data error occurred @throws IllegalArgumentException if the start position of a line falls outside the buffer @throws UnsupportedOperationException if the image can't be decoded into the desired format
[ "Decodes", "the", "image", "into", "the", "specified", "buffer", ".", "The", "last", "line", "is", "placed", "at", "the", "current", "position", ".", "After", "decode", "the", "buffer", "position", "is", "at", "the", "end", "of", "the", "first", "line", "." ]
191f19b55a17451d0f277c151c7e9b4427a12415
https://github.com/devnewton/jnuit/blob/191f19b55a17451d0f277c151c7e9b4427a12415/pngdecoder/src/main/java/de/matthiasmann/twl/utils/PNGDecoder.java#L352-L361
148,591
JM-Lab/utils-elasticsearch
src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchBulk.java
JMElasticsearchBulk.setBulkProcessor
public void setBulkProcessor(Listener bulkProcessorListener, int bulkActions, long bulkSizeKB, int flushIntervalSeconds) { this.bulkProcessor = buildBulkProcessor(bulkProcessorListener, bulkActions, bulkSizeKB, flushIntervalSeconds); }
java
public void setBulkProcessor(Listener bulkProcessorListener, int bulkActions, long bulkSizeKB, int flushIntervalSeconds) { this.bulkProcessor = buildBulkProcessor(bulkProcessorListener, bulkActions, bulkSizeKB, flushIntervalSeconds); }
[ "public", "void", "setBulkProcessor", "(", "Listener", "bulkProcessorListener", ",", "int", "bulkActions", ",", "long", "bulkSizeKB", ",", "int", "flushIntervalSeconds", ")", "{", "this", ".", "bulkProcessor", "=", "buildBulkProcessor", "(", "bulkProcessorListener", ",", "bulkActions", ",", "bulkSizeKB", ",", "flushIntervalSeconds", ")", ";", "}" ]
Sets bulk processor. @param bulkProcessorListener the bulk processor listener @param bulkActions the bulk actions @param bulkSizeKB the bulk size kb @param flushIntervalSeconds the flush interval seconds
[ "Sets", "bulk", "processor", "." ]
6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638
https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchBulk.java#L120-L124
148,592
JM-Lab/utils-elasticsearch
src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchBulk.java
JMElasticsearchBulk.getBulkProcessorBuilder
public Builder getBulkProcessorBuilder(Listener bulkProcessorListener, Integer bulkActions, ByteSizeValue byteSizeValue, TimeValue flushInterval, Integer concurrentRequests, BackoffPolicy backoffPolicy) { Builder builder = BulkProcessor.builder(jmESClient, bulkProcessorListener); ifNotNull(bulkActions, builder::setBulkActions); ifNotNull(byteSizeValue, builder::setBulkSize); ifNotNull(flushInterval, builder::setFlushInterval); ifNotNull(concurrentRequests, builder::setConcurrentRequests); ifNotNull(backoffPolicy, builder::setBackoffPolicy); return builder; }
java
public Builder getBulkProcessorBuilder(Listener bulkProcessorListener, Integer bulkActions, ByteSizeValue byteSizeValue, TimeValue flushInterval, Integer concurrentRequests, BackoffPolicy backoffPolicy) { Builder builder = BulkProcessor.builder(jmESClient, bulkProcessorListener); ifNotNull(bulkActions, builder::setBulkActions); ifNotNull(byteSizeValue, builder::setBulkSize); ifNotNull(flushInterval, builder::setFlushInterval); ifNotNull(concurrentRequests, builder::setConcurrentRequests); ifNotNull(backoffPolicy, builder::setBackoffPolicy); return builder; }
[ "public", "Builder", "getBulkProcessorBuilder", "(", "Listener", "bulkProcessorListener", ",", "Integer", "bulkActions", ",", "ByteSizeValue", "byteSizeValue", ",", "TimeValue", "flushInterval", ",", "Integer", "concurrentRequests", ",", "BackoffPolicy", "backoffPolicy", ")", "{", "Builder", "builder", "=", "BulkProcessor", ".", "builder", "(", "jmESClient", ",", "bulkProcessorListener", ")", ";", "ifNotNull", "(", "bulkActions", ",", "builder", "::", "setBulkActions", ")", ";", "ifNotNull", "(", "byteSizeValue", ",", "builder", "::", "setBulkSize", ")", ";", "ifNotNull", "(", "flushInterval", ",", "builder", "::", "setFlushInterval", ")", ";", "ifNotNull", "(", "concurrentRequests", ",", "builder", "::", "setConcurrentRequests", ")", ";", "ifNotNull", "(", "backoffPolicy", ",", "builder", "::", "setBackoffPolicy", ")", ";", "return", "builder", ";", "}" ]
Gets bulk processor builder. @param bulkProcessorListener the bulk processor listener @param bulkActions the bulk actions @param byteSizeValue the byte size value @param flushInterval the flush interval @param concurrentRequests the concurrent requests @param backoffPolicy the backoff policy @return the bulk processor builder
[ "Gets", "bulk", "processor", "builder", "." ]
6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638
https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchBulk.java#L137-L149
148,593
JM-Lab/utils-elasticsearch
src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchBulk.java
JMElasticsearchBulk.closeBulkProcessor
public void closeBulkProcessor() { Optional.ofNullable(bulkProcessor).filter(peek(BulkProcessor::flush)) .ifPresent(BulkProcessor::close); }
java
public void closeBulkProcessor() { Optional.ofNullable(bulkProcessor).filter(peek(BulkProcessor::flush)) .ifPresent(BulkProcessor::close); }
[ "public", "void", "closeBulkProcessor", "(", ")", "{", "Optional", ".", "ofNullable", "(", "bulkProcessor", ")", ".", "filter", "(", "peek", "(", "BulkProcessor", "::", "flush", ")", ")", ".", "ifPresent", "(", "BulkProcessor", "::", "close", ")", ";", "}" ]
Close bulk processor.
[ "Close", "bulk", "processor", "." ]
6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638
https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchBulk.java#L298-L301
148,594
JM-Lab/utils-elasticsearch
src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchBulk.java
JMElasticsearchBulk.sendBulkDataAsync
public void sendBulkDataAsync(List<? extends Map<String, ?>> bulkSourceList, String index, String type) { executeBulkRequestAsync( buildBulkIndexRequestBuilder(bulkSourceList .stream().map(source -> jmESClient .prepareIndex(index, type).setSource(source)) .collect(toList()))); }
java
public void sendBulkDataAsync(List<? extends Map<String, ?>> bulkSourceList, String index, String type) { executeBulkRequestAsync( buildBulkIndexRequestBuilder(bulkSourceList .stream().map(source -> jmESClient .prepareIndex(index, type).setSource(source)) .collect(toList()))); }
[ "public", "void", "sendBulkDataAsync", "(", "List", "<", "?", "extends", "Map", "<", "String", ",", "?", ">", ">", "bulkSourceList", ",", "String", "index", ",", "String", "type", ")", "{", "executeBulkRequestAsync", "(", "buildBulkIndexRequestBuilder", "(", "bulkSourceList", ".", "stream", "(", ")", ".", "map", "(", "source", "->", "jmESClient", ".", "prepareIndex", "(", "index", ",", "type", ")", ".", "setSource", "(", "source", ")", ")", ".", "collect", "(", "toList", "(", ")", ")", ")", ")", ";", "}" ]
Send bulk data async. @param bulkSourceList the bulk source list @param index the index @param type the type
[ "Send", "bulk", "data", "async", "." ]
6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638
https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchBulk.java#L310-L317
148,595
JM-Lab/utils-elasticsearch
src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchBulk.java
JMElasticsearchBulk.sendBulkDataWithObjectMapperAsync
public void sendBulkDataWithObjectMapperAsync(List<Object> objectBulkData, String index, String type) { executeBulkRequestAsync(buildBulkIndexRequestBuilder(objectBulkData .stream() .map(sourceObject -> jmESClient.prepareIndex(index, type) .setSource(JMElasticsearchUtil .buildSourceByJsonMapper(sourceObject))) .collect(toList()))); }
java
public void sendBulkDataWithObjectMapperAsync(List<Object> objectBulkData, String index, String type) { executeBulkRequestAsync(buildBulkIndexRequestBuilder(objectBulkData .stream() .map(sourceObject -> jmESClient.prepareIndex(index, type) .setSource(JMElasticsearchUtil .buildSourceByJsonMapper(sourceObject))) .collect(toList()))); }
[ "public", "void", "sendBulkDataWithObjectMapperAsync", "(", "List", "<", "Object", ">", "objectBulkData", ",", "String", "index", ",", "String", "type", ")", "{", "executeBulkRequestAsync", "(", "buildBulkIndexRequestBuilder", "(", "objectBulkData", ".", "stream", "(", ")", ".", "map", "(", "sourceObject", "->", "jmESClient", ".", "prepareIndex", "(", "index", ",", "type", ")", ".", "setSource", "(", "JMElasticsearchUtil", ".", "buildSourceByJsonMapper", "(", "sourceObject", ")", ")", ")", ".", "collect", "(", "toList", "(", ")", ")", ")", ")", ";", "}" ]
Send bulk data with object mapper async. @param objectBulkData the object bulk data @param index the index @param type the type
[ "Send", "bulk", "data", "with", "object", "mapper", "async", "." ]
6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638
https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchBulk.java#L345-L353
148,596
JM-Lab/utils-elasticsearch
src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchBulk.java
JMElasticsearchBulk.buildBulkIndexRequestBuilder
public BulkRequestBuilder buildBulkIndexRequestBuilder( List<IndexRequestBuilder> indexRequestBuilderList) { BulkRequestBuilder bulkRequestBuilder = jmESClient.prepareBulk(); for (IndexRequestBuilder indexRequestBuilder : indexRequestBuilderList) bulkRequestBuilder.add(indexRequestBuilder); return bulkRequestBuilder; }
java
public BulkRequestBuilder buildBulkIndexRequestBuilder( List<IndexRequestBuilder> indexRequestBuilderList) { BulkRequestBuilder bulkRequestBuilder = jmESClient.prepareBulk(); for (IndexRequestBuilder indexRequestBuilder : indexRequestBuilderList) bulkRequestBuilder.add(indexRequestBuilder); return bulkRequestBuilder; }
[ "public", "BulkRequestBuilder", "buildBulkIndexRequestBuilder", "(", "List", "<", "IndexRequestBuilder", ">", "indexRequestBuilderList", ")", "{", "BulkRequestBuilder", "bulkRequestBuilder", "=", "jmESClient", ".", "prepareBulk", "(", ")", ";", "for", "(", "IndexRequestBuilder", "indexRequestBuilder", ":", "indexRequestBuilderList", ")", "bulkRequestBuilder", ".", "(", "indexRequestBuilder", ")", ";", "return", "bulkRequestBuilder", ";", "}" ]
Build bulk index request builder bulk request builder. @param indexRequestBuilderList the index request builder list @return the bulk request builder
[ "Build", "bulk", "index", "request", "builder", "bulk", "request", "builder", "." ]
6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638
https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchBulk.java#L382-L388
148,597
JM-Lab/utils-elasticsearch
src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchBulk.java
JMElasticsearchBulk.buildDeleteBulkRequestBuilder
public BulkRequestBuilder buildDeleteBulkRequestBuilder( List<DeleteRequestBuilder> deleteRequestBuilderList) { BulkRequestBuilder bulkRequestBuilder = jmESClient.prepareBulk(); for (DeleteRequestBuilder deleteRequestBuilder : deleteRequestBuilderList) bulkRequestBuilder.add(deleteRequestBuilder); return bulkRequestBuilder; }
java
public BulkRequestBuilder buildDeleteBulkRequestBuilder( List<DeleteRequestBuilder> deleteRequestBuilderList) { BulkRequestBuilder bulkRequestBuilder = jmESClient.prepareBulk(); for (DeleteRequestBuilder deleteRequestBuilder : deleteRequestBuilderList) bulkRequestBuilder.add(deleteRequestBuilder); return bulkRequestBuilder; }
[ "public", "BulkRequestBuilder", "buildDeleteBulkRequestBuilder", "(", "List", "<", "DeleteRequestBuilder", ">", "deleteRequestBuilderList", ")", "{", "BulkRequestBuilder", "bulkRequestBuilder", "=", "jmESClient", ".", "prepareBulk", "(", ")", ";", "for", "(", "DeleteRequestBuilder", "deleteRequestBuilder", ":", "deleteRequestBuilderList", ")", "bulkRequestBuilder", ".", "(", "deleteRequestBuilder", ")", ";", "return", "bulkRequestBuilder", ";", "}" ]
Build delete bulk request builder bulk request builder. @param deleteRequestBuilderList the delete request builder list @return the bulk request builder
[ "Build", "delete", "bulk", "request", "builder", "bulk", "request", "builder", "." ]
6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638
https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchBulk.java#L396-L402
148,598
JM-Lab/utils-elasticsearch
src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchBulk.java
JMElasticsearchBulk.buildUpdateBulkRequestBuilder
public BulkRequestBuilder buildUpdateBulkRequestBuilder( List<UpdateRequestBuilder> updateRequestBuilderList) { BulkRequestBuilder bulkRequestBuilder = jmESClient.prepareBulk(); for (UpdateRequestBuilder updateRequestBuilder : updateRequestBuilderList) bulkRequestBuilder.add(updateRequestBuilder); return bulkRequestBuilder; }
java
public BulkRequestBuilder buildUpdateBulkRequestBuilder( List<UpdateRequestBuilder> updateRequestBuilderList) { BulkRequestBuilder bulkRequestBuilder = jmESClient.prepareBulk(); for (UpdateRequestBuilder updateRequestBuilder : updateRequestBuilderList) bulkRequestBuilder.add(updateRequestBuilder); return bulkRequestBuilder; }
[ "public", "BulkRequestBuilder", "buildUpdateBulkRequestBuilder", "(", "List", "<", "UpdateRequestBuilder", ">", "updateRequestBuilderList", ")", "{", "BulkRequestBuilder", "bulkRequestBuilder", "=", "jmESClient", ".", "prepareBulk", "(", ")", ";", "for", "(", "UpdateRequestBuilder", "updateRequestBuilder", ":", "updateRequestBuilderList", ")", "bulkRequestBuilder", ".", "(", "updateRequestBuilder", ")", ";", "return", "bulkRequestBuilder", ";", "}" ]
Build update bulk request builder bulk request builder. @param updateRequestBuilderList the update request builder list @return the bulk request builder
[ "Build", "update", "bulk", "request", "builder", "bulk", "request", "builder", "." ]
6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638
https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchBulk.java#L410-L416
148,599
JM-Lab/utils-elasticsearch
src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchBulk.java
JMElasticsearchBulk.executeBulkRequestAsync
public void executeBulkRequestAsync(BulkRequestBuilder bulkRequestBuilder, ActionListener<BulkResponse> bulkResponseActionListener) { JMLog.info(log, "executeBulkRequestAsync", bulkRequestBuilder, bulkResponseActionListener); bulkRequestBuilder.execute(bulkResponseActionListener); }
java
public void executeBulkRequestAsync(BulkRequestBuilder bulkRequestBuilder, ActionListener<BulkResponse> bulkResponseActionListener) { JMLog.info(log, "executeBulkRequestAsync", bulkRequestBuilder, bulkResponseActionListener); bulkRequestBuilder.execute(bulkResponseActionListener); }
[ "public", "void", "executeBulkRequestAsync", "(", "BulkRequestBuilder", "bulkRequestBuilder", ",", "ActionListener", "<", "BulkResponse", ">", "bulkResponseActionListener", ")", "{", "JMLog", ".", "info", "(", "log", ",", "\"executeBulkRequestAsync\"", ",", "bulkRequestBuilder", ",", "bulkResponseActionListener", ")", ";", "bulkRequestBuilder", ".", "execute", "(", "bulkResponseActionListener", ")", ";", "}" ]
Execute bulk request async. @param bulkRequestBuilder the bulk request builder @param bulkResponseActionListener the bulk response action listener
[ "Execute", "bulk", "request", "async", "." ]
6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638
https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchBulk.java#L433-L438