id_within_dataset
int64
0
69.7k
snippet
stringlengths
10
23k
tokens
sequencelengths
5
4.23k
nl
stringlengths
15
2.45k
split_within_dataset
stringclasses
1 value
is_duplicated
bool
2 classes
69,124
public void cancel(){ isCanceled.set(true); }
[ "public", "void", "cancel", "(", ")", "{", "isCanceled", ".", "set", "(", "true", ")", ";", "}" ]
informs this executor to stop processing and returns any results collected thus far . this method is thread - safe .
train
false
69,127
public static Pair<FilterValueSetParam,FilterParamIndexBase> findIndex(ArrayDeque<FilterValueSetParam> parameters,List<FilterParamIndexBase> indizes){ for ( FilterValueSetParam parameter : parameters) { FilterSpecLookupable lookupable=parameter.getLookupable(); FilterOperator operator=parameter.getFilterOperator(); for ( FilterParamIndexBase index : indizes) { if (index instanceof FilterParamIndexLookupableBase) { FilterParamIndexLookupableBase propBasedIndex=(FilterParamIndexLookupableBase)index; if ((lookupable.equals(propBasedIndex.getLookupable())) && (operator.equals(propBasedIndex.getFilterOperator()))) { return new Pair<FilterValueSetParam,FilterParamIndexBase>(parameter,index); } } else if (index instanceof FilterParamIndexBooleanExpr && parameters.size() == 1) { if (operator.equals(FilterOperator.BOOLEAN_EXPRESSION)) { return new Pair<FilterValueSetParam,FilterParamIndexBase>(parameter,index); } } } } return null; }
[ "public", "static", "Pair", "<", "FilterValueSetParam", ",", "FilterParamIndexBase", ">", "findIndex", "(", "ArrayDeque", "<", "FilterValueSetParam", ">", "parameters", ",", "List", "<", "FilterParamIndexBase", ">", "indizes", ")", "{", "for", "(", "FilterValueSetParam", "parameter", ":", "parameters", ")", "{", "FilterSpecLookupable", "lookupable", "=", "parameter", ".", "getLookupable", "(", ")", ";", "FilterOperator", "operator", "=", "parameter", ".", "getFilterOperator", "(", ")", ";", "for", "(", "FilterParamIndexBase", "index", ":", "indizes", ")", "{", "if", "(", "index", "instanceof", "FilterParamIndexLookupableBase", ")", "{", "FilterParamIndexLookupableBase", "propBasedIndex", "=", "(", "FilterParamIndexLookupableBase", ")", "index", ";", "if", "(", "(", "lookupable", ".", "equals", "(", "propBasedIndex", ".", "getLookupable", "(", ")", ")", ")", "&&", "(", "operator", ".", "equals", "(", "propBasedIndex", ".", "getFilterOperator", "(", ")", ")", ")", ")", "{", "return", "new", "Pair", "<", "FilterValueSetParam", ",", "FilterParamIndexBase", ">", "(", "parameter", ",", "index", ")", ";", "}", "}", "else", "if", "(", "index", "instanceof", "FilterParamIndexBooleanExpr", "&&", "parameters", ".", "size", "(", ")", "==", "1", ")", "{", "if", "(", "operator", ".", "equals", "(", "FilterOperator", ".", "BOOLEAN_EXPRESSION", ")", ")", "{", "return", "new", "Pair", "<", "FilterValueSetParam", ",", "FilterParamIndexBase", ">", "(", "parameter", ",", "index", ")", ";", "}", "}", "}", "}", "return", "null", ";", "}" ]
find an index that matches one of the filter parameters passed . the parameter type and index type match up if the property name and filter operator are the same for the index and the filter parameter . for instance , for a filter parameter of " count equals 10 " , the index against property " count " with operator type equals will be returned , if present . note : the caller is expected to obtain locks , if necessary , on the collections passed in . note : doesn ' t match non - property based index - thus boolean expressions don ' t get found and are always entered as a new index
train
false
69,128
void addQueryResult(long token,UISearchResult line,SearchResultMediator rp){ if (rp.isStopped()) { return; } if (!rp.matches(token)) throw new IllegalArgumentException("guids don't match"); rp.add(line); int resultPanelIndex; resultPanelIndex=entries.indexOf(rp); if (resultPanelIndex == -1) { return; } tabbedPane.setTitleAt(resultPanelIndex,titleOf(rp)); }
[ "void", "addQueryResult", "(", "long", "token", ",", "UISearchResult", "line", ",", "SearchResultMediator", "rp", ")", "{", "if", "(", "rp", ".", "isStopped", "(", ")", ")", "{", "return", ";", "}", "if", "(", "!", "rp", ".", "matches", "(", "token", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"guids don't match\"", ")", ";", "rp", ".", "add", "(", "line", ")", ";", "int", "resultPanelIndex", ";", "resultPanelIndex", "=", "entries", ".", "indexOf", "(", "rp", ")", ";", "if", "(", "resultPanelIndex", "==", "-", "1", ")", "{", "return", ";", "}", "tabbedPane", ".", "setTitleAt", "(", "resultPanelIndex", ",", "titleOf", "(", "rp", ")", ")", ";", "}" ]
if i rp is no longer the i ' th panel of this , returns silently . otherwise adds line to rp under the given group . updates the count on the tab in this and restarts the spinning lime .
train
false
69,129
@Override public void close() throws IOException { flush(); output.close(); }
[ "@", "Override", "public", "void", "close", "(", ")", "throws", "IOException", "{", "flush", "(", ")", ";", "output", ".", "close", "(", ")", ";", "}" ]
closes this stream . any buffered data is flushed . this implementation closes the target stream .
train
false
69,130
@Nullable public static String dateToStringUTC(@Nullable Date date,@NonNull DateFormat df){ if (date == null) { return null; } else { df.setTimeZone(UTC); return dateToString(date,df); } }
[ "@", "Nullable", "public", "static", "String", "dateToStringUTC", "(", "@", "Nullable", "Date", "date", ",", "@", "NonNull", "DateFormat", "df", ")", "{", "if", "(", "date", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "df", ".", "setTimeZone", "(", "UTC", ")", ";", "return", "dateToString", "(", "date", ",", "df", ")", ";", "}", "}" ]
converts a date object to a string representation in utc
train
false
69,131
public void start(Context context){ mContext=context; SensorManager sm=(SensorManager)context.getSystemService(Context.SENSOR_SERVICE); Sensor s=sm.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); if (s == null) { Log.e(LOG_TAG,"No accelerometer in this device. Cannot use rage shake."); return; } sm.registerListener(this,s,SensorManager.SENSOR_DELAY_NORMAL); }
[ "public", "void", "start", "(", "Context", "context", ")", "{", "mContext", "=", "context", ";", "SensorManager", "sm", "=", "(", "SensorManager", ")", "context", ".", "getSystemService", "(", "Context", ".", "SENSOR_SERVICE", ")", ";", "Sensor", "s", "=", "sm", ".", "getDefaultSensor", "(", "Sensor", ".", "TYPE_ACCELEROMETER", ")", ";", "if", "(", "s", "==", "null", ")", "{", "Log", ".", "e", "(", "LOG_TAG", ",", "\"No accelerometer in this device. Cannot use rage shake.\"", ")", ";", "return", ";", "}", "sm", ".", "registerListener", "(", "this", ",", "s", ",", "SensorManager", ".", "SENSOR_DELAY_NORMAL", ")", ";", "}" ]
start the sensor detector
train
false
69,132
public void accept(Connection conn){ synchronized (queue) { queue.add(conn); queue.notify(); } }
[ "public", "void", "accept", "(", "Connection", "conn", ")", "{", "synchronized", "(", "queue", ")", "{", "queue", ".", "add", "(", "conn", ")", ";", "queue", ".", "notify", "(", ")", ";", "}", "}" ]
add connection to queue of connections to be accepted .
train
false
69,134
public static boolean match(String value,String strPattern){ if (isNotEmpty(strPattern)) { if (isBlank(value)) { return strPattern.equals("*"); } value=value.toLowerCase(); strPattern=strPattern.toLowerCase(); StringBuilder buff=new StringBuilder(); for (int i=0; i < strPattern.length() - 1; i++) { char c=strPattern.charAt(i); if (c == '*') { buff.append(".*?"); } else { buff.append(c); } } char lastChar=strPattern.charAt(strPattern.length() - 1); if (lastChar == '*') { buff.append(".*"); } else { buff.append(lastChar); } return Pattern.matches(buff.toString(),value); } return true; }
[ "public", "static", "boolean", "match", "(", "String", "value", ",", "String", "strPattern", ")", "{", "if", "(", "isNotEmpty", "(", "strPattern", ")", ")", "{", "if", "(", "isBlank", "(", "value", ")", ")", "{", "return", "strPattern", ".", "equals", "(", "\"*\"", ")", ";", "}", "value", "=", "value", ".", "toLowerCase", "(", ")", ";", "strPattern", "=", "strPattern", ".", "toLowerCase", "(", ")", ";", "StringBuilder", "buff", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "strPattern", ".", "length", "(", ")", "-", "1", ";", "i", "++", ")", "{", "char", "c", "=", "strPattern", ".", "charAt", "(", "i", ")", ";", "if", "(", "c", "==", "'*'", ")", "{", "buff", ".", "append", "(", "\".*?\"", ")", ";", "}", "else", "{", "buff", ".", "append", "(", "c", ")", ";", "}", "}", "char", "lastChar", "=", "strPattern", ".", "charAt", "(", "strPattern", ".", "length", "(", ")", "-", "1", ")", ";", "if", "(", "lastChar", "==", "'*'", ")", "{", "buff", ".", "append", "(", "\".*\"", ")", ";", "}", "else", "{", "buff", ".", "append", "(", "lastChar", ")", ";", "}", "return", "Pattern", ".", "matches", "(", "buff", ".", "toString", "(", ")", ",", "value", ")", ";", "}", "return", "true", ";", "}" ]
match the value to the regular expression pattern . the pattern given can contain a file name like search , e . g . ' * service * ' , which will be converted to a valid regular expression , e . g . ' . * ? service . * ' .
train
false
69,135
public boolean addStackChangedListener(StackChangedListener listener){ return listeners.add(listener); }
[ "public", "boolean", "addStackChangedListener", "(", "StackChangedListener", "listener", ")", "{", "return", "listeners", ".", "add", "(", "listener", ")", ";", "}" ]
adds a stackchangedlistener for stack - changed events
train
false
69,136
public void docString(@NotNull final String docString){ final String[] stringsToAdd=StringUtil.splitByLines(removeIndent(docString)); if (myDocStringLines == null) { myDocStringLines=stringsToAdd; } else { myDocStringLines=ArrayUtil.mergeArrays(myDocStringLines,stringsToAdd); } }
[ "public", "void", "docString", "(", "@", "NotNull", "final", "String", "docString", ")", "{", "final", "String", "[", "]", "stringsToAdd", "=", "StringUtil", ".", "splitByLines", "(", "removeIndent", "(", "docString", ")", ")", ";", "if", "(", "myDocStringLines", "==", "null", ")", "{", "myDocStringLines", "=", "stringsToAdd", ";", "}", "else", "{", "myDocStringLines", "=", "ArrayUtil", ".", "mergeArrays", "(", "myDocStringLines", ",", "stringsToAdd", ")", ";", "}", "}" ]
adds docstring to function . provide doc with out of comment blocks .
train
false
69,138
public static String formatCurrentDate(){ SimpleDateFormat sdf=new SimpleDateFormat("MMM dd "); Calendar c=Calendar.getInstance(); return sdf.format(c.getTime()); }
[ "public", "static", "String", "formatCurrentDate", "(", ")", "{", "SimpleDateFormat", "sdf", "=", "new", "SimpleDateFormat", "(", "\"MMM dd \"", ")", ";", "Calendar", "c", "=", "Calendar", ".", "getInstance", "(", ")", ";", "return", "sdf", ".", "format", "(", "c", ".", "getTime", "(", ")", ")", ";", "}" ]
helper method to format the date returned by the openweathermap call .
train
true
69,139
public void goingToExecuteUnsafeCodeOnSameThread() throws SecurityException, IllegalStateException { if (!privilegedThreads.contains(Thread.currentThread())) { throw new SecurityException("Current thread is not privileged"); } if (privilegedThreadToIgnore != null) { throw new IllegalStateException("The thread is already executing unsafe code"); } privilegedThreadToIgnore=Thread.currentThread(); }
[ "public", "void", "goingToExecuteUnsafeCodeOnSameThread", "(", ")", "throws", "SecurityException", ",", "IllegalStateException", "{", "if", "(", "!", "privilegedThreads", ".", "contains", "(", "Thread", ".", "currentThread", "(", ")", ")", ")", "{", "throw", "new", "SecurityException", "(", "\"Current thread is not privileged\"", ")", ";", "}", "if", "(", "privilegedThreadToIgnore", "!=", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"The thread is already executing unsafe code\"", ")", ";", "}", "privilegedThreadToIgnore", "=", "Thread", ".", "currentThread", "(", ")", ";", "}" ]
use this method if you are going to execute sut code from a privileged thread ( ie if you don ' t want to do it on a new thread )
train
false
69,140
private void notifyDataSourceLoaded(){ List<DataSourceUpdatedInterface> copyListenerList=new ArrayList<DataSourceUpdatedInterface>(listenerList); for ( DataSourceUpdatedInterface listener : copyListenerList) { listener.dataSourceLoaded(getGeometryType(),this.connectedToDataSourceFlag); } }
[ "private", "void", "notifyDataSourceLoaded", "(", ")", "{", "List", "<", "DataSourceUpdatedInterface", ">", "copyListenerList", "=", "new", "ArrayList", "<", "DataSourceUpdatedInterface", ">", "(", "listenerList", ")", ";", "for", "(", "DataSourceUpdatedInterface", "listener", ":", "copyListenerList", ")", "{", "listener", ".", "dataSourceLoaded", "(", "getGeometryType", "(", ")", ",", "this", ".", "connectedToDataSourceFlag", ")", ";", "}", "}" ]
notify data source loaded .
train
false
69,141
public static boolean belowThan(int a,int b){ return Integer.compareUnsigned(a,b) < 0; }
[ "public", "static", "boolean", "belowThan", "(", "int", "a", ",", "int", "b", ")", "{", "return", "Integer", ".", "compareUnsigned", "(", "a", ",", "b", ")", "<", "0", ";", "}" ]
unsigned comparison belowthan for two numbers .
train
false
69,142
@Override public boolean isResultRequired(ResultProducer rp,Object[] key) throws Exception { return true; }
[ "@", "Override", "public", "boolean", "isResultRequired", "(", "ResultProducer", "rp", ",", "Object", "[", "]", "key", ")", "throws", "Exception", "{", "return", "true", ";", "}" ]
always says a result is required . if this is the first call , prints out the header for the csv output .
train
false
69,143
public void computeLabelling(GeometryGraph[] geom){ super.computeLabelling(geom); label=new Label(Location.NONE); for (Iterator it=iterator(); it.hasNext(); ) { EdgeEnd ee=(EdgeEnd)it.next(); Edge e=ee.getEdge(); Label eLabel=e.getLabel(); for (int i=0; i < 2; i++) { int eLoc=eLabel.getLocation(i); if (eLoc == Location.INTERIOR || eLoc == Location.BOUNDARY) label.setLocation(i,Location.INTERIOR); } } }
[ "public", "void", "computeLabelling", "(", "GeometryGraph", "[", "]", "geom", ")", "{", "super", ".", "computeLabelling", "(", "geom", ")", ";", "label", "=", "new", "Label", "(", "Location", ".", "NONE", ")", ";", "for", "(", "Iterator", "it", "=", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "EdgeEnd", "ee", "=", "(", "EdgeEnd", ")", "it", ".", "next", "(", ")", ";", "Edge", "e", "=", "ee", ".", "getEdge", "(", ")", ";", "Label", "eLabel", "=", "e", ".", "getLabel", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "2", ";", "i", "++", ")", "{", "int", "eLoc", "=", "eLabel", ".", "getLocation", "(", "i", ")", ";", "if", "(", "eLoc", "==", "Location", ".", "INTERIOR", "||", "eLoc", "==", "Location", ".", "BOUNDARY", ")", "label", ".", "setLocation", "(", "i", ",", "Location", ".", "INTERIOR", ")", ";", "}", "}", "}" ]
compute the labelling for all diredges in this star , as well as the overall labelling
train
false
69,144
abstract boolean apply(boolean copied);
[ "abstract", "boolean", "apply", "(", "boolean", "copied", ")", ";" ]
change the parse tree and store enough information so that rollback can reverse it .
train
false
69,146
private void loadCountriesFiles(String filePath) throws Exception { SAXReader reader=new SAXReader(); Document document=reader.read(new File(filePath,ImportInitvalues.nameOfCountriesFile)); Element root=document.getRootElement(); for (@SuppressWarnings("rawtypes") Iterator it=root.elementIterator("country"); it.hasNext(); ) { Element item=(Element)it.next(); statemanagement.addState(item.attributeValue("name"),item.attributeValue("short"),Integer.parseInt(item.attributeValue("code"))); } log.debug("Countries ADDED"); }
[ "private", "void", "loadCountriesFiles", "(", "String", "filePath", ")", "throws", "Exception", "{", "SAXReader", "reader", "=", "new", "SAXReader", "(", ")", ";", "Document", "document", "=", "reader", ".", "read", "(", "new", "File", "(", "filePath", ",", "ImportInitvalues", ".", "nameOfCountriesFile", ")", ")", ";", "Element", "root", "=", "document", ".", "getRootElement", "(", ")", ";", "for", "(", "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "Iterator", "it", "=", "root", ".", "elementIterator", "(", "\"country\"", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Element", "item", "=", "(", "Element", ")", "it", ".", "next", "(", ")", ";", "statemanagement", ".", "addState", "(", "item", ".", "attributeValue", "(", "\"name\"", ")", ",", "item", ".", "attributeValue", "(", "\"short\"", ")", ",", "Integer", ".", "parseInt", "(", "item", ".", "attributeValue", "(", "\"code\"", ")", ")", ")", ";", "}", "log", ".", "debug", "(", "\"Countries ADDED\"", ")", ";", "}" ]
import all language names from the xml file
train
false
69,147
public String buildId(){ return properties.getProperty("build.id"); }
[ "public", "String", "buildId", "(", ")", "{", "return", "properties", ".", "getProperty", "(", "\"build.id\"", ")", ";", "}" ]
returns the build id for the generated build of the directory server .
train
false
69,148
public TransferHandlerAnnotationPlaintext(final JEditorPane editor){ if (editor == null) { throw new IllegalArgumentException("editor must not be null!"); } this.editor=editor; this.original=editor.getTransferHandler(); }
[ "public", "TransferHandlerAnnotationPlaintext", "(", "final", "JEditorPane", "editor", ")", "{", "if", "(", "editor", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"editor must not be null!\"", ")", ";", "}", "this", ".", "editor", "=", "editor", ";", "this", ".", "original", "=", "editor", ".", "getTransferHandler", "(", ")", ";", "}" ]
creates a new plain text transfer handler for the annotation editor .
train
false
69,149
public static byte[] readInputStream(InputStream in) throws IOException { try { class Part { byte[] partData; int len; } LinkedList<Part> parts=new LinkedList<>(); int len=1; while (len > 0) { byte[] data=new byte[1024]; len=in.read(data); if (len > 0) { Part part=new Part(); part.partData=data; part.len=len; parts.add(part); } } int length=0; for ( Part part : parts) { length+=part.len; } byte[] result=new byte[length]; int pos=0; for ( Part part : parts) { System.arraycopy(part.partData,0,result,pos,part.len); pos+=part.len; } return result; } finally { if (in != null) { try { in.close(); } catch ( IOException e) { } } } }
[ "public", "static", "byte", "[", "]", "readInputStream", "(", "InputStream", "in", ")", "throws", "IOException", "{", "try", "{", "class", "Part", "{", "byte", "[", "]", "partData", ";", "int", "len", ";", "}", "LinkedList", "<", "Part", ">", "parts", "=", "new", "LinkedList", "<", ">", "(", ")", ";", "int", "len", "=", "1", ";", "while", "(", "len", ">", "0", ")", "{", "byte", "[", "]", "data", "=", "new", "byte", "[", "1024", "]", ";", "len", "=", "in", ".", "read", "(", "data", ")", ";", "if", "(", "len", ">", "0", ")", "{", "Part", "part", "=", "new", "Part", "(", ")", ";", "part", ".", "partData", "=", "data", ";", "part", ".", "len", "=", "len", ";", "parts", ".", "add", "(", "part", ")", ";", "}", "}", "int", "length", "=", "0", ";", "for", "(", "Part", "part", ":", "parts", ")", "{", "length", "+=", "part", ".", "len", ";", "}", "byte", "[", "]", "result", "=", "new", "byte", "[", "length", "]", ";", "int", "pos", "=", "0", ";", "for", "(", "Part", "part", ":", "parts", ")", "{", "System", ".", "arraycopy", "(", "part", ".", "partData", ",", "0", ",", "result", ",", "pos", ",", "part", ".", "len", ")", ";", "pos", "+=", "part", ".", "len", ";", "}", "return", "result", ";", "}", "finally", "{", "if", "(", "in", "!=", "null", ")", "{", "try", "{", "in", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "}", "}", "}", "}" ]
this method will return a byte array containing the raw data from the given input stream . the stream will be closed afterwards in any case .
train
false
69,150
boolean isUserALocalAdminOrNotClosed(RequestAndResponse requestAndResponse) throws IOException { if (isUserALocalAdmin(requestAndResponse)) { return true; } if (!isUserSignedIn(requestAndResponse)) { requestAndResponse.print(servletText.errorRequiresSignIn(false)); return false; } else if (isUsersAccountClosed(requestAndResponse)) { requestAndResponse.print(servletText.errorAccountIsClosed()); return false; } return true; }
[ "boolean", "isUserALocalAdminOrNotClosed", "(", "RequestAndResponse", "requestAndResponse", ")", "throws", "IOException", "{", "if", "(", "isUserALocalAdmin", "(", "requestAndResponse", ")", ")", "{", "return", "true", ";", "}", "if", "(", "!", "isUserSignedIn", "(", "requestAndResponse", ")", ")", "{", "requestAndResponse", ".", "print", "(", "servletText", ".", "errorRequiresSignIn", "(", "false", ")", ")", ";", "return", "false", ";", "}", "else", "if", "(", "isUsersAccountClosed", "(", "requestAndResponse", ")", ")", "{", "requestAndResponse", ".", "print", "(", "servletText", ".", "errorAccountIsClosed", "(", ")", ")", ";", "return", "false", ";", "}", "return", "true", ";", "}" ]
returns true if the user is either local admin or a signed in user whose account is not closed .
train
false
69,151
private void optimizeTasksLocked(){ ArrayList<ActivityManager.RecentTaskInfo> recentTask=new ArrayList<>(mAM.getRecentTasks(Integer.MAX_VALUE,ActivityManager.RECENT_WITH_EXCLUDED | ActivityManager.RECENT_IGNORE_UNAVAILABLE)); int N=mHistory.size(); while (N-- > 0) { TaskRecord task=mHistory.valueAt(N); ListIterator<ActivityManager.RecentTaskInfo> iterator=recentTask.listIterator(); boolean taskAlive=false; while (iterator.hasNext()) { ActivityManager.RecentTaskInfo info=iterator.next(); if (info.id == task.taskId) { taskAlive=true; iterator.remove(); break; } } if (!taskAlive) { mHistory.removeAt(N); } } }
[ "private", "void", "optimizeTasksLocked", "(", ")", "{", "ArrayList", "<", "ActivityManager", ".", "RecentTaskInfo", ">", "recentTask", "=", "new", "ArrayList", "<", ">", "(", "mAM", ".", "getRecentTasks", "(", "Integer", ".", "MAX_VALUE", ",", "ActivityManager", ".", "RECENT_WITH_EXCLUDED", "|", "ActivityManager", ".", "RECENT_IGNORE_UNAVAILABLE", ")", ")", ";", "int", "N", "=", "mHistory", ".", "size", "(", ")", ";", "while", "(", "N", "--", ">", "0", ")", "{", "TaskRecord", "task", "=", "mHistory", ".", "valueAt", "(", "N", ")", ";", "ListIterator", "<", "ActivityManager", ".", "RecentTaskInfo", ">", "iterator", "=", "recentTask", ".", "listIterator", "(", ")", ";", "boolean", "taskAlive", "=", "false", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "ActivityManager", ".", "RecentTaskInfo", "info", "=", "iterator", ".", "next", "(", ")", ";", "if", "(", "info", ".", "id", "==", "task", ".", "taskId", ")", "{", "taskAlive", "=", "true", ";", "iterator", ".", "remove", "(", ")", ";", "break", ";", "}", "}", "if", "(", "!", "taskAlive", ")", "{", "mHistory", ".", "removeAt", "(", "N", ")", ";", "}", "}", "}" ]
app started in va may be removed in overview screen , then ams . removetask will be invoked , all data struct about the task in ams are released , while the client ' s process is still alive . so remove related data in va as well . a new taskrecord will be recreated in ` onactivitycreated `
train
false
69,153
public void clear(){ vPreviousDecisions.clear(); }
[ "public", "void", "clear", "(", ")", "{", "vPreviousDecisions", ".", "clear", "(", ")", ";", "}" ]
clear existing decisions cache .
train
false
69,154
public void save(FileOutputStream outputStream,@Nullable String header) throws IOException { myProperties.store(outputStream,header); }
[ "public", "void", "save", "(", "FileOutputStream", "outputStream", ",", "@", "Nullable", "String", "header", ")", "throws", "IOException", "{", "myProperties", ".", "store", "(", "outputStream", ",", "header", ")", ";", "}" ]
unconditionally save the current store to the given stream .
train
false
69,155
void validate() throws WebSocketException { }
[ "void", "validate", "(", ")", "throws", "WebSocketException", "{", "}" ]
validate this instance . this method is expected to be overridden .
train
false
69,156
public OverloadedChecksum(Krb5Context context,Checksum checksum,EncryptionKey key,EncryptionKey subKey) throws GSSException, KrbException, IOException { int pos=0; if (checksum == null) { GSSException ge=new GSSException(GSSException.FAILURE,-1,"No cksum in AP_REQ's authenticator"); ge.initCause(new KrbException(Krb5.KRB_AP_ERR_INAPP_CKSUM)); throw ge; } checksumBytes=checksum.getBytes(); if ((checksumBytes[0] != CHECKSUM_FIRST_BYTES[0]) || (checksumBytes[1] != CHECKSUM_FIRST_BYTES[1]) || (checksumBytes[2] != CHECKSUM_FIRST_BYTES[2])|| (checksumBytes[3] != CHECKSUM_FIRST_BYTES[3])) { throw new GSSException(GSSException.FAILURE,-1,"Incorrect checksum"); } ChannelBinding localBindings=context.getChannelBinding(); if (localBindings != null) { byte[] remoteBindingBytes=new byte[CHECKSUM_BINDINGS_SIZE]; System.arraycopy(checksumBytes,4,remoteBindingBytes,0,CHECKSUM_BINDINGS_SIZE); byte[] noBindings=new byte[CHECKSUM_BINDINGS_SIZE]; if (!Arrays.equals(noBindings,remoteBindingBytes)) { byte[] localBindingsBytes=computeChannelBinding(localBindings); if (!Arrays.equals(localBindingsBytes,remoteBindingBytes)) { throw new GSSException(GSSException.BAD_BINDINGS,-1,"Bytes mismatch!"); } } else { throw new GSSException(GSSException.BAD_BINDINGS,-1,"Token missing ChannelBinding!"); } } flags=readLittleEndian(checksumBytes,20,4); if ((flags & CHECKSUM_DELEG_FLAG) > 0) { int credLen=readLittleEndian(checksumBytes,26,2); byte[] credBytes=new byte[credLen]; System.arraycopy(checksumBytes,28,credBytes,0,credLen); KrbCred cred; try { cred=new KrbCred(credBytes,key); } catch ( KrbException ke) { if (subKey != null) { cred=new KrbCred(credBytes,subKey); } else { throw ke; } } delegCreds=cred.getDelegatedCreds()[0]; } }
[ "public", "OverloadedChecksum", "(", "Krb5Context", "context", ",", "Checksum", "checksum", ",", "EncryptionKey", "key", ",", "EncryptionKey", "subKey", ")", "throws", "GSSException", ",", "KrbException", ",", "IOException", "{", "int", "pos", "=", "0", ";", "if", "(", "checksum", "==", "null", ")", "{", "GSSException", "ge", "=", "new", "GSSException", "(", "GSSException", ".", "FAILURE", ",", "-", "1", ",", "\"No cksum in AP_REQ's authenticator\"", ")", ";", "ge", ".", "initCause", "(", "new", "KrbException", "(", "Krb5", ".", "KRB_AP_ERR_INAPP_CKSUM", ")", ")", ";", "throw", "ge", ";", "}", "checksumBytes", "=", "checksum", ".", "getBytes", "(", ")", ";", "if", "(", "(", "checksumBytes", "[", "0", "]", "!=", "CHECKSUM_FIRST_BYTES", "[", "0", "]", ")", "||", "(", "checksumBytes", "[", "1", "]", "!=", "CHECKSUM_FIRST_BYTES", "[", "1", "]", ")", "||", "(", "checksumBytes", "[", "2", "]", "!=", "CHECKSUM_FIRST_BYTES", "[", "2", "]", ")", "||", "(", "checksumBytes", "[", "3", "]", "!=", "CHECKSUM_FIRST_BYTES", "[", "3", "]", ")", ")", "{", "throw", "new", "GSSException", "(", "GSSException", ".", "FAILURE", ",", "-", "1", ",", "\"Incorrect checksum\"", ")", ";", "}", "ChannelBinding", "localBindings", "=", "context", ".", "getChannelBinding", "(", ")", ";", "if", "(", "localBindings", "!=", "null", ")", "{", "byte", "[", "]", "remoteBindingBytes", "=", "new", "byte", "[", "CHECKSUM_BINDINGS_SIZE", "]", ";", "System", ".", "arraycopy", "(", "checksumBytes", ",", "4", ",", "remoteBindingBytes", ",", "0", ",", "CHECKSUM_BINDINGS_SIZE", ")", ";", "byte", "[", "]", "noBindings", "=", "new", "byte", "[", "CHECKSUM_BINDINGS_SIZE", "]", ";", "if", "(", "!", "Arrays", ".", "equals", "(", "noBindings", ",", "remoteBindingBytes", ")", ")", "{", "byte", "[", "]", "localBindingsBytes", "=", "computeChannelBinding", "(", "localBindings", ")", ";", "if", "(", "!", "Arrays", ".", "equals", "(", "localBindingsBytes", ",", "remoteBindingBytes", ")", ")", "{", "throw", "new", "GSSException", "(", "GSSException", ".", "BAD_BINDINGS", ",", "-", "1", ",", "\"Bytes mismatch!\"", ")", ";", "}", "}", "else", "{", "throw", "new", "GSSException", "(", "GSSException", ".", "BAD_BINDINGS", ",", "-", "1", ",", "\"Token missing ChannelBinding!\"", ")", ";", "}", "}", "flags", "=", "readLittleEndian", "(", "checksumBytes", ",", "20", ",", "4", ")", ";", "if", "(", "(", "flags", "&", "CHECKSUM_DELEG_FLAG", ")", ">", "0", ")", "{", "int", "credLen", "=", "readLittleEndian", "(", "checksumBytes", ",", "26", ",", "2", ")", ";", "byte", "[", "]", "credBytes", "=", "new", "byte", "[", "credLen", "]", ";", "System", ".", "arraycopy", "(", "checksumBytes", ",", "28", ",", "credBytes", ",", "0", ",", "credLen", ")", ";", "KrbCred", "cred", ";", "try", "{", "cred", "=", "new", "KrbCred", "(", "credBytes", ",", "key", ")", ";", "}", "catch", "(", "KrbException", "ke", ")", "{", "if", "(", "subKey", "!=", "null", ")", "{", "cred", "=", "new", "KrbCred", "(", "credBytes", ",", "subKey", ")", ";", "}", "else", "{", "throw", "ke", ";", "}", "}", "delegCreds", "=", "cred", ".", "getDelegatedCreds", "(", ")", "[", "0", "]", ";", "}", "}" ]
called on the acceptor side when reading an initseccontexttoken .
train
false
69,157
public static String[] split(String toSplit,String delimiter){ if (!hasLength(toSplit) || !hasLength(delimiter)) { return null; } int offset=toSplit.indexOf(delimiter); if (offset < 0) { return null; } String beforeDelimiter=toSplit.substring(0,offset); String afterDelimiter=toSplit.substring(offset + delimiter.length()); return new String[]{beforeDelimiter,afterDelimiter}; }
[ "public", "static", "String", "[", "]", "split", "(", "String", "toSplit", ",", "String", "delimiter", ")", "{", "if", "(", "!", "hasLength", "(", "toSplit", ")", "||", "!", "hasLength", "(", "delimiter", ")", ")", "{", "return", "null", ";", "}", "int", "offset", "=", "toSplit", ".", "indexOf", "(", "delimiter", ")", ";", "if", "(", "offset", "<", "0", ")", "{", "return", "null", ";", "}", "String", "beforeDelimiter", "=", "toSplit", ".", "substring", "(", "0", ",", "offset", ")", ";", "String", "afterDelimiter", "=", "toSplit", ".", "substring", "(", "offset", "+", "delimiter", ".", "length", "(", ")", ")", ";", "return", "new", "String", "[", "]", "{", "beforeDelimiter", ",", "afterDelimiter", "}", ";", "}" ]
split a string at the first occurrence of the delimiter . does not include the delimiter in the result .
train
true
69,159
public byte[] read(int length) throws IOException { byte[] data=new byte[length]; if (length > 0) { int read=0; while (read < length) { int count=in.read(data,read,length - read); if (count < 0) { bytesRead+=read; throw new IOException("Unexpected end of input while reading a specified number of bytes"); } read+=count; } bytesRead+=read; } return data; }
[ "public", "byte", "[", "]", "read", "(", "int", "length", ")", "throws", "IOException", "{", "byte", "[", "]", "data", "=", "new", "byte", "[", "length", "]", ";", "if", "(", "length", ">", "0", ")", "{", "int", "read", "=", "0", ";", "while", "(", "read", "<", "length", ")", "{", "int", "count", "=", "in", ".", "read", "(", "data", ",", "read", ",", "length", "-", "read", ")", ";", "if", "(", "count", "<", "0", ")", "{", "bytesRead", "+=", "read", ";", "throw", "new", "IOException", "(", "\"Unexpected end of input while reading a specified number of bytes\"", ")", ";", "}", "read", "+=", "count", ";", "}", "bytesRead", "+=", "read", ";", "}", "return", "data", ";", "}" ]
read bytes from the input stream
train
false
69,162
protected Map<String,RamlMimeType> extractRequestBodyFromMethod(RamlActionType apiAction,Method method,Map<String,String> parameterComments){ if (!(doesActionTypeSupportRequestBody(apiAction)) || method.getParameterCount() == 0) { return Collections.emptyMap(); } String comment=null; List<ApiParameterMetadata> apiParameters=getApiParameters(method,false,true); if (apiParameters.size() == 0) { return Collections.emptyMap(); } Pair<String,RamlMimeType> schemaAndMime=extractRequestBody(method,parameterComments,comment,apiParameters); return Collections.singletonMap(schemaAndMime.getFirst(),schemaAndMime.getSecond()); }
[ "protected", "Map", "<", "String", ",", "RamlMimeType", ">", "extractRequestBodyFromMethod", "(", "RamlActionType", "apiAction", ",", "Method", "method", ",", "Map", "<", "String", ",", "String", ">", "parameterComments", ")", "{", "if", "(", "!", "(", "doesActionTypeSupportRequestBody", "(", "apiAction", ")", ")", "||", "method", ".", "getParameterCount", "(", ")", "==", "0", ")", "{", "return", "Collections", ".", "emptyMap", "(", ")", ";", "}", "String", "comment", "=", "null", ";", "List", "<", "ApiParameterMetadata", ">", "apiParameters", "=", "getApiParameters", "(", "method", ",", "false", ",", "true", ")", ";", "if", "(", "apiParameters", ".", "size", "(", ")", "==", "0", ")", "{", "return", "Collections", ".", "emptyMap", "(", ")", ";", "}", "Pair", "<", "String", ",", "RamlMimeType", ">", "schemaAndMime", "=", "extractRequestBody", "(", "method", ",", "parameterComments", ",", "comment", ",", "apiParameters", ")", ";", "return", "Collections", ".", "singletonMap", "(", "schemaAndMime", ".", "getFirst", "(", ")", ",", "schemaAndMime", ".", "getSecond", "(", ")", ")", ";", "}" ]
extracts the tos and other parameters from a method and will convert into jsonschema for inclusion in the body todo refactor this code structure
train
false
69,163
protected void internalTransform(Body b,String phaseName,Map options){ StmtBody stmtBody=(StmtBody)b; Chain<Unit> units=stmtBody.getUnits(); Iterator<Unit> stmtIt=units.snapshotIterator(); NormalUnitPrinter nup=new NormalUnitPrinter(b); while (stmtIt.hasNext()) { Stmt stmt=(Stmt)stmtIt.next(); if (!stmt.containsInvokeExpr()) { continue; } InvokeExpr expr=(InvokeExpr)stmt.getInvokeExpr(); AssignStmt assignStmt=null; if (stmt instanceof AssignStmt) { assignStmt=(AssignStmt)stmt; } else { continue; } inspectAndReplaceCalls(units,assignStmt,expr); } }
[ "protected", "void", "internalTransform", "(", "Body", "b", ",", "String", "phaseName", ",", "Map", "options", ")", "{", "StmtBody", "stmtBody", "=", "(", "StmtBody", ")", "b", ";", "Chain", "<", "Unit", ">", "units", "=", "stmtBody", ".", "getUnits", "(", ")", ";", "Iterator", "<", "Unit", ">", "stmtIt", "=", "units", ".", "snapshotIterator", "(", ")", ";", "NormalUnitPrinter", "nup", "=", "new", "NormalUnitPrinter", "(", "b", ")", ";", "while", "(", "stmtIt", ".", "hasNext", "(", ")", ")", "{", "Stmt", "stmt", "=", "(", "Stmt", ")", "stmtIt", ".", "next", "(", ")", ";", "if", "(", "!", "stmt", ".", "containsInvokeExpr", "(", ")", ")", "{", "continue", ";", "}", "InvokeExpr", "expr", "=", "(", "InvokeExpr", ")", "stmt", ".", "getInvokeExpr", "(", ")", ";", "AssignStmt", "assignStmt", "=", "null", ";", "if", "(", "stmt", "instanceof", "AssignStmt", ")", "{", "assignStmt", "=", "(", "AssignStmt", ")", "stmt", ";", "}", "else", "{", "continue", ";", "}", "inspectAndReplaceCalls", "(", "units", ",", "assignStmt", ",", "expr", ")", ";", "}", "}" ]
modifies the specified method body to replace all calls to uri . parse ( string ) with new uri ( string ) . this ensures that the allocation of the uri is unique
train
false
69,165
public char skipTo(char to) throws JSONException { char c; try { int startIndex=this.index; int startCharacter=this.character; int startLine=this.line; reader.mark(8192); do { c=next(); if (c == 0) { reader.reset(); this.index=startIndex; this.character=startCharacter; this.line=startLine; return c; } } while (c != to); } catch ( IOException exc) { throw new JSONException(exc); } back(); return c; }
[ "public", "char", "skipTo", "(", "char", "to", ")", "throws", "JSONException", "{", "char", "c", ";", "try", "{", "int", "startIndex", "=", "this", ".", "index", ";", "int", "startCharacter", "=", "this", ".", "character", ";", "int", "startLine", "=", "this", ".", "line", ";", "reader", ".", "mark", "(", "8192", ")", ";", "do", "{", "c", "=", "next", "(", ")", ";", "if", "(", "c", "==", "0", ")", "{", "reader", ".", "reset", "(", ")", ";", "this", ".", "index", "=", "startIndex", ";", "this", ".", "character", "=", "startCharacter", ";", "this", ".", "line", "=", "startLine", ";", "return", "c", ";", "}", "}", "while", "(", "c", "!=", "to", ")", ";", "}", "catch", "(", "IOException", "exc", ")", "{", "throw", "new", "JSONException", "(", "exc", ")", ";", "}", "back", "(", ")", ";", "return", "c", ";", "}" ]
skip characters until the next character is the requested character . if the requested character is not found , unknown characters are skipped .
train
true
69,167
public RestControllerProcessor(Log log,Swagger swagger,String restJavaPackage,String tagPatternTemplate,Class<?> modelErrorClass) throws MojoExecutionException { this.log=log; this.swagger=swagger; this.restJavaPackage=restJavaPackage; this.modelErrorClass=modelErrorClass; tagPattern=Pattern.compile(tagPatternTemplate); findAndProcessRestControllers(); }
[ "public", "RestControllerProcessor", "(", "Log", "log", ",", "Swagger", "swagger", ",", "String", "restJavaPackage", ",", "String", "tagPatternTemplate", ",", "Class", "<", "?", ">", "modelErrorClass", ")", "throws", "MojoExecutionException", "{", "this", ".", "log", "=", "log", ";", "this", ".", "swagger", "=", "swagger", ";", "this", ".", "restJavaPackage", "=", "restJavaPackage", ";", "this", ".", "modelErrorClass", "=", "modelErrorClass", ";", "tagPattern", "=", "Pattern", ".", "compile", "(", "tagPatternTemplate", ")", ";", "findAndProcessRestControllers", "(", ")", ";", "}" ]
instantiates a rest controller process which finds and processes rest controllers .
train
false
69,168
public Builder withSendBufferSize(int sendBufferSize){ properties.setProperty(NettyOptions.SEND_BUFFER_SIZE,String.valueOf(Assert.argNot(sendBufferSize,sendBufferSize <= 0,"buffer size must be positive"))); return this; }
[ "public", "Builder", "withSendBufferSize", "(", "int", "sendBufferSize", ")", "{", "properties", ".", "setProperty", "(", "NettyOptions", ".", "SEND_BUFFER_SIZE", ",", "String", ".", "valueOf", "(", "Assert", ".", "argNot", "(", "sendBufferSize", ",", "sendBufferSize", "<=", "0", ",", "\"buffer size must be positive\"", ")", ")", ")", ";", "return", "this", ";", "}" ]
sets the send buffer size .
train
false
69,169
public IChatMessage sendMessage2(Geoloc geoloc) throws RemoteException { if (geoloc == null) { throw new ServerApiIllegalArgumentException("Geoloc message must not be null!"); } if (!isAllowedToSendMessage()) { throw new ServerApiPermissionDeniedException("Not allowed to send Geoloc message on the connected IMS server!"); } String label=geoloc.getLabel(); if (label != null) { int labelLength=label.length(); int labelMaxLength=mRcsSettings.getMaxGeolocLabelLength(); if (labelLength > labelMaxLength) { throw new ServerApiIllegalArgumentException("geoloc message label length: " + labelLength + " exeeds max length: "+ labelMaxLength+ "!"); } } try { long timestamp=System.currentTimeMillis(); final ChatMessage geolocMsg=ChatUtils.createGeolocMessage(null,geoloc,timestamp,timestamp); ChatMessagePersistedStorageAccessor persistedStorage=new ChatMessagePersistedStorageAccessor(mMessagingLog,geolocMsg.getMessageId(),geolocMsg.getRemoteContact(),geolocMsg.getContent(),geolocMsg.getMimeType(),mChatId,Direction.OUTGOING); addOutgoingGroupChatMessage(geolocMsg,Content.Status.QUEUED,Content.ReasonCode.UNSPECIFIED); if (!mChatService.isGroupChatActive(mChatId)) { mChatService.setGroupChatStateAndReasonCode(mChatId,GroupChat.State.STARTED,GroupChat.ReasonCode.UNSPECIFIED); } mImService.tryToDequeueGroupChatMessagesAndGroupFileTransfers(mChatId); return new ChatMessageImpl(persistedStorage); } catch ( ServerApiBaseException e) { if (!e.shouldNotBeLogged()) { sLogger.error(ExceptionUtil.getFullStackTrace(e)); } throw e; } catch ( Exception e) { sLogger.error(ExceptionUtil.getFullStackTrace(e)); throw new ServerApiGenericException(e); } }
[ "public", "IChatMessage", "sendMessage2", "(", "Geoloc", "geoloc", ")", "throws", "RemoteException", "{", "if", "(", "geoloc", "==", "null", ")", "{", "throw", "new", "ServerApiIllegalArgumentException", "(", "\"Geoloc message must not be null!\"", ")", ";", "}", "if", "(", "!", "isAllowedToSendMessage", "(", ")", ")", "{", "throw", "new", "ServerApiPermissionDeniedException", "(", "\"Not allowed to send Geoloc message on the connected IMS server!\"", ")", ";", "}", "String", "label", "=", "geoloc", ".", "getLabel", "(", ")", ";", "if", "(", "label", "!=", "null", ")", "{", "int", "labelLength", "=", "label", ".", "length", "(", ")", ";", "int", "labelMaxLength", "=", "mRcsSettings", ".", "getMaxGeolocLabelLength", "(", ")", ";", "if", "(", "labelLength", ">", "labelMaxLength", ")", "{", "throw", "new", "ServerApiIllegalArgumentException", "(", "\"geoloc message label length: \"", "+", "labelLength", "+", "\" exeeds max length: \"", "+", "labelMaxLength", "+", "\"!\"", ")", ";", "}", "}", "try", "{", "long", "timestamp", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "final", "ChatMessage", "geolocMsg", "=", "ChatUtils", ".", "createGeolocMessage", "(", "null", ",", "geoloc", ",", "timestamp", ",", "timestamp", ")", ";", "ChatMessagePersistedStorageAccessor", "persistedStorage", "=", "new", "ChatMessagePersistedStorageAccessor", "(", "mMessagingLog", ",", "geolocMsg", ".", "getMessageId", "(", ")", ",", "geolocMsg", ".", "getRemoteContact", "(", ")", ",", "geolocMsg", ".", "getContent", "(", ")", ",", "geolocMsg", ".", "getMimeType", "(", ")", ",", "mChatId", ",", "Direction", ".", "OUTGOING", ")", ";", "addOutgoingGroupChatMessage", "(", "geolocMsg", ",", "Content", ".", "Status", ".", "QUEUED", ",", "Content", ".", "ReasonCode", ".", "UNSPECIFIED", ")", ";", "if", "(", "!", "mChatService", ".", "isGroupChatActive", "(", "mChatId", ")", ")", "{", "mChatService", ".", "setGroupChatStateAndReasonCode", "(", "mChatId", ",", "GroupChat", ".", "State", ".", "STARTED", ",", "GroupChat", ".", "ReasonCode", ".", "UNSPECIFIED", ")", ";", "}", "mImService", ".", "tryToDequeueGroupChatMessagesAndGroupFileTransfers", "(", "mChatId", ")", ";", "return", "new", "ChatMessageImpl", "(", "persistedStorage", ")", ";", "}", "catch", "(", "ServerApiBaseException", "e", ")", "{", "if", "(", "!", "e", ".", "shouldNotBeLogged", "(", ")", ")", "{", "sLogger", ".", "error", "(", "ExceptionUtil", ".", "getFullStackTrace", "(", "e", ")", ")", ";", "}", "throw", "e", ";", "}", "catch", "(", "Exception", "e", ")", "{", "sLogger", ".", "error", "(", "ExceptionUtil", ".", "getFullStackTrace", "(", "e", ")", ")", ";", "throw", "new", "ServerApiGenericException", "(", "e", ")", ";", "}", "}" ]
sends a geoloc message
train
false
69,171
public int loadData(int size){ List<String> list=new ArrayList<>(); for (int i=0; i < size; i++) list.add("" + size); return list.size(); }
[ "public", "int", "loadData", "(", "int", "size", ")", "{", "List", "<", "String", ">", "list", "=", "new", "ArrayList", "<", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "list", ".", "add", "(", "\"\"", "+", "size", ")", ";", "return", "list", ".", "size", "(", ")", ";", "}" ]
public void optional ( ) { string prefix = " file " ; list < string > data ; for ( int i = 0 ; i < 100 ; i + + ) { string nextfile = prefix + i ; data . add ( loadstr ( nextfile ) ) ; } stream . iterate ( 0 , i - > i + 1 ) . limit ( 100 ) . map ( i - > " prefix " + i ) . map ( this : : loadstr ) . collect ( collectors . tolist ( ) ) ; new lazyreact ( ) . of ( 1 , 2 , 3 , 4 ) . map ( this : : load ) . foreach ( this : : save ) ; reactiveseq . of ( 1 , 2 , 3 ) . schedule ( " * * * * * ? " , executors . newscheduledthreadpool ( 1 ) ) . connect ( ) . debounce ( 1 , timeunit . seconds ) . foreach ( system . out : : println ) ; reactiveseq . of ( 1 , 2 , 3 , 4 ) . futureoperations ( executors . newfixedthreadpool ( 1 ) ) . foreach ( this : : expensiveop ) ; subscription s = reactiveseq . of ( 1 , 2 , 3 , 4 ) . foreachxevents ( 2 , system . out : : println , system . err : : println , ( ) - > system . out . println ( " complete " ) ) ; s . request ( 2 ) ; seqsubscriber < integer > sub = seqsubscriber . subscriber ( ) ; flux . just ( 1 , 2 , 3 , 4 ) . map ( i - > i * 2 ) . subscribe ( sub ) ; reactiveseq < integer > connected = sub . stream ( ) ; reactiveseq . of ( 1 , 2 , 3 ) . map ( this : : load ) . recover ( e - > " default value " ) . retry ( this : : unreliablemethod ) ; completablefuture f ; f . then seq . of ( " a " , " b " , " c " , " d " ) . map ( string : : touppercase ) . zipwithindex ( ) . filter ( t - > t . v2 % 2 = = 0 ) . sliding ( 3 ) . duplicate ( ) ; optional < integer > input ; optional < integer > times2 = input . map ( i - > i * 2 ) ; queuefactories . < data > boundedqueue ( 100 ) . build ( ) . futurestream ( ) . map ( this : : process ) . run ( ) ; } public void stream ( ) { stream < integer > input ; stream < integer > times2 = input . map ( i - > i * 2 ) ; } public void future ( ) { completablefuture < integer > input ; completablefuture < integer > times2 = input . thenapply ( i - > i * 2 ) ; } public void datetime ( ) { localdate date = localdate . of ( 2016 , 9 , 18 ) ; boolean later = localdate . now ( ) . isafter ( date ) ; } seq . of ( 1 , 2 , 4 ) . rightouterjoin ( seq . of ( 1 , 2 , 3 ) , ( a , b ) - > a = = b ) ; reactiveseq . of ( 6 , 5 , 2 , 1 ) . map ( e - > e * 100 ) . filter ( e - > e < 551 ) . futureoperations ( executors . newfixedthreadpool ( 1 ) ) . foreach ( e - > { system . out . println ( " element " + e + " on thread " + thread . currentthread ( ) . getid ( ) ) ; } ) ;
train
false
69,172
private void appendColourClass(final StringBuilder result,final String entryType,final Map<String,Integer> entryColourMap,final String entryAccession){ final Integer colourCode=entryColourMap.get(entryAccession); if (entryType != null && colourCode != null) { result.append("class=\""); result.append("c" + colourCode + " "+ entryType); result.append("\" "); } }
[ "private", "void", "appendColourClass", "(", "final", "StringBuilder", "result", ",", "final", "String", "entryType", ",", "final", "Map", "<", "String", ",", "Integer", ">", "entryColourMap", ",", "final", "String", "entryAccession", ")", "{", "final", "Integer", "colourCode", "=", "entryColourMap", ".", "get", "(", "entryAccession", ")", ";", "if", "(", "entryType", "!=", "null", "&&", "colourCode", "!=", "null", ")", "{", "result", ".", "append", "(", "\"class=\\\"\"", ")", ";", "result", ".", "append", "(", "\"c\"", "+", "colourCode", "+", "\" \"", "+", "entryType", ")", ";", "result", ".", "append", "(", "\"\\\" \"", ")", ";", "}", "}" ]
appends the colour class for the different entry types .
train
false
69,173
private void expand(int i){ if (count + i <= buf.length) { return; } byte[] newbuf=mPool.getBuf((count + i) * 2); System.arraycopy(buf,0,newbuf,0,count); mPool.returnBuf(buf); buf=newbuf; }
[ "private", "void", "expand", "(", "int", "i", ")", "{", "if", "(", "count", "+", "i", "<=", "buf", ".", "length", ")", "{", "return", ";", "}", "byte", "[", "]", "newbuf", "=", "mPool", ".", "getBuf", "(", "(", "count", "+", "i", ")", "*", "2", ")", ";", "System", ".", "arraycopy", "(", "buf", ",", "0", ",", "newbuf", ",", "0", ",", "count", ")", ";", "mPool", ".", "returnBuf", "(", "buf", ")", ";", "buf", "=", "newbuf", ";", "}" ]
ensures there is enough space in the buffer for the given number of additional bytes .
train
true
69,175
public Iterator iterator(){ return list.iterator(); }
[ "public", "Iterator", "iterator", "(", ")", "{", "return", "list", ".", "iterator", "(", ")", ";", "}" ]
returns an iterator over the elements in this set .
train
false
69,177
private void appendPositionParams(Appendable sr,Map<String,Object> context,ModelFormField modelFormField) throws IOException { Integer positions=(Integer)context.get("formFieldRender_positions"); Integer position=(Integer)context.get("formFieldRender_position"); Integer positionSpan=(Integer)context.get("formFieldRender_positionSpan"); Integer nextPositionInRow=(Integer)context.get("formFieldRender_nextPositionInRow"); Integer lastPositionInRow=(Integer)context.get("formFieldRender_lastPositionInRow"); sr.append(" positions=" + (positions != null ? positions.toString() : "\"\"")); sr.append(" position=" + (position != null ? position.toString() : "\"\"")); sr.append(" positionSpan=" + (positionSpan != null ? positionSpan.toString() : "\"\"")); sr.append(" nextPositionInRow=" + (nextPositionInRow != null ? nextPositionInRow.toString() : "\"\"")); sr.append(" lastPositionInRow=" + (lastPositionInRow != null ? lastPositionInRow.toString() : "\"\"")); }
[ "private", "void", "appendPositionParams", "(", "Appendable", "sr", ",", "Map", "<", "String", ",", "Object", ">", "context", ",", "ModelFormField", "modelFormField", ")", "throws", "IOException", "{", "Integer", "positions", "=", "(", "Integer", ")", "context", ".", "get", "(", "\"formFieldRender_positions\"", ")", ";", "Integer", "position", "=", "(", "Integer", ")", "context", ".", "get", "(", "\"formFieldRender_position\"", ")", ";", "Integer", "positionSpan", "=", "(", "Integer", ")", "context", ".", "get", "(", "\"formFieldRender_positionSpan\"", ")", ";", "Integer", "nextPositionInRow", "=", "(", "Integer", ")", "context", ".", "get", "(", "\"formFieldRender_nextPositionInRow\"", ")", ";", "Integer", "lastPositionInRow", "=", "(", "Integer", ")", "context", ".", "get", "(", "\"formFieldRender_lastPositionInRow\"", ")", ";", "sr", ".", "append", "(", "\" positions=\"", "+", "(", "positions", "!=", "null", "?", "positions", ".", "toString", "(", ")", ":", "\"\\\"\\\"\"", ")", ")", ";", "sr", ".", "append", "(", "\" position=\"", "+", "(", "position", "!=", "null", "?", "position", ".", "toString", "(", ")", ":", "\"\\\"\\\"\"", ")", ")", ";", "sr", ".", "append", "(", "\" positionSpan=\"", "+", "(", "positionSpan", "!=", "null", "?", "positionSpan", ".", "toString", "(", ")", ":", "\"\\\"\\\"\"", ")", ")", ";", "sr", ".", "append", "(", "\" nextPositionInRow=\"", "+", "(", "nextPositionInRow", "!=", "null", "?", "nextPositionInRow", ".", "toString", "(", ")", ":", "\"\\\"\\\"\"", ")", ")", ";", "sr", ".", "append", "(", "\" lastPositionInRow=\"", "+", "(", "lastPositionInRow", "!=", "null", "?", "lastPositionInRow", ".", "toString", "(", ")", ":", "\"\\\"\\\"\"", ")", ")", ";", "}" ]
scipio : appends position params .
train
false
69,179
public static boolean isTrustedSource(InetAddress source) throws SessionException { if (trustedSources == null) { trustedSources=getTrustedSourceList(); } return trustedSources.contains(source); }
[ "public", "static", "boolean", "isTrustedSource", "(", "InetAddress", "source", ")", "throws", "SessionException", "{", "if", "(", "trustedSources", "==", "null", ")", "{", "trustedSources", "=", "getTrustedSourceList", "(", ")", ";", "}", "return", "trustedSources", ".", "contains", "(", "source", ")", ";", "}" ]
returns the remote ip address of the client is a trusted source
train
false
69,180
public void replace(int i,byte[] buffer,int offset,int length){ System.arraycopy(buffer,offset,_buffer,i,length); }
[ "public", "void", "replace", "(", "int", "i", ",", "byte", "[", "]", "buffer", ",", "int", "offset", ",", "int", "length", ")", "{", "System", ".", "arraycopy", "(", "buffer", ",", "offset", ",", "_buffer", ",", "i", ",", "length", ")", ";", "}" ]
inserts a byte array
train
false
69,182
public static boolean isReferenceType(NodeId referenceTypeId){ if (referenceTypeId.equals(Identifiers.References) || referenceTypeId.equals(Identifiers.NonHierarchicalReferences) || referenceTypeId.equals(Identifiers.HierarchicalReferences)|| referenceTypeId.equals(Identifiers.HasEventSource)|| referenceTypeId.equals(Identifiers.HasNotifier)|| referenceTypeId.equals(Identifiers.Organizes)|| referenceTypeId.equals(Identifiers.HasChild)|| referenceTypeId.equals(Identifiers.HasSubtype)|| referenceTypeId.equals(Identifiers.Aggregates)|| referenceTypeId.equals(Identifiers.HasProperty)|| referenceTypeId.equals(Identifiers.HasComponent)|| referenceTypeId.equals(Identifiers.HasOrderedComponent)|| referenceTypeId.equals(Identifiers.GeneratesEvent)|| referenceTypeId.equals(Identifiers.AlwaysGeneratesEvent)|| referenceTypeId.equals(Identifiers.HasEncoding)|| referenceTypeId.equals(Identifiers.HasModellingRule)|| referenceTypeId.equals(Identifiers.HasDescription)|| referenceTypeId.equals(Identifiers.HasTypeDefinition)) { return true; } return false; }
[ "public", "static", "boolean", "isReferenceType", "(", "NodeId", "referenceTypeId", ")", "{", "if", "(", "referenceTypeId", ".", "equals", "(", "Identifiers", ".", "References", ")", "||", "referenceTypeId", ".", "equals", "(", "Identifiers", ".", "NonHierarchicalReferences", ")", "||", "referenceTypeId", ".", "equals", "(", "Identifiers", ".", "HierarchicalReferences", ")", "||", "referenceTypeId", ".", "equals", "(", "Identifiers", ".", "HasEventSource", ")", "||", "referenceTypeId", ".", "equals", "(", "Identifiers", ".", "HasNotifier", ")", "||", "referenceTypeId", ".", "equals", "(", "Identifiers", ".", "Organizes", ")", "||", "referenceTypeId", ".", "equals", "(", "Identifiers", ".", "HasChild", ")", "||", "referenceTypeId", ".", "equals", "(", "Identifiers", ".", "HasSubtype", ")", "||", "referenceTypeId", ".", "equals", "(", "Identifiers", ".", "Aggregates", ")", "||", "referenceTypeId", ".", "equals", "(", "Identifiers", ".", "HasProperty", ")", "||", "referenceTypeId", ".", "equals", "(", "Identifiers", ".", "HasComponent", ")", "||", "referenceTypeId", ".", "equals", "(", "Identifiers", ".", "HasOrderedComponent", ")", "||", "referenceTypeId", ".", "equals", "(", "Identifiers", ".", "GeneratesEvent", ")", "||", "referenceTypeId", ".", "equals", "(", "Identifiers", ".", "AlwaysGeneratesEvent", ")", "||", "referenceTypeId", ".", "equals", "(", "Identifiers", ".", "HasEncoding", ")", "||", "referenceTypeId", ".", "equals", "(", "Identifiers", ".", "HasModellingRule", ")", "||", "referenceTypeId", ".", "equals", "(", "Identifiers", ".", "HasDescription", ")", "||", "referenceTypeId", ".", "equals", "(", "Identifiers", ".", "HasTypeDefinition", ")", ")", "{", "return", "true", ";", "}", "return", "false", ";", "}" ]
convenience method wrapping different reference types .
train
false
69,184
@SuppressWarnings("SleepWhileInLoop") public boolean waitForCompletion(ApplicationId appId,AppStatusCallback callback,long timeoutMillis) throws YarnException, IOException { long startMillis=System.currentTimeMillis(); while (true) { try { Thread.sleep(1000); } catch ( InterruptedException e) { LOG.debug("Thread sleep in monitoring loop interrupted"); } ApplicationReport report=clientRM.getApplicationReport(appId); if (callback.exitLoop(report) == true) { return true; } YarnApplicationState state=report.getYarnApplicationState(); FinalApplicationStatus dsStatus=report.getFinalApplicationStatus(); if (YarnApplicationState.FINISHED == state) { if (FinalApplicationStatus.SUCCEEDED == dsStatus) { LOG.info("Application has completed successfully. Breaking monitoring loop"); return true; } else { LOG.info("Application finished unsuccessfully." + " YarnState=" + state.toString() + ", DSFinalStatus="+ dsStatus.toString()+ ". Breaking monitoring loop"); return false; } } else if (YarnApplicationState.KILLED == state || YarnApplicationState.FAILED == state) { LOG.info("Application did not finish." + " YarnState=" + state.toString() + ", DSFinalStatus="+ dsStatus.toString()+ ". Breaking monitoring loop"); return false; } if (System.currentTimeMillis() - startMillis > timeoutMillis) { LOG.info("Reached specified timeout. Killing application"); clientRM.killApplication(appId); return false; } } }
[ "@", "SuppressWarnings", "(", "\"SleepWhileInLoop\"", ")", "public", "boolean", "waitForCompletion", "(", "ApplicationId", "appId", ",", "AppStatusCallback", "callback", ",", "long", "timeoutMillis", ")", "throws", "YarnException", ",", "IOException", "{", "long", "startMillis", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "while", "(", "true", ")", "{", "try", "{", "Thread", ".", "sleep", "(", "1000", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "LOG", ".", "debug", "(", "\"Thread sleep in monitoring loop interrupted\"", ")", ";", "}", "ApplicationReport", "report", "=", "clientRM", ".", "getApplicationReport", "(", "appId", ")", ";", "if", "(", "callback", ".", "exitLoop", "(", "report", ")", "==", "true", ")", "{", "return", "true", ";", "}", "YarnApplicationState", "state", "=", "report", ".", "getYarnApplicationState", "(", ")", ";", "FinalApplicationStatus", "dsStatus", "=", "report", ".", "getFinalApplicationStatus", "(", ")", ";", "if", "(", "YarnApplicationState", ".", "FINISHED", "==", "state", ")", "{", "if", "(", "FinalApplicationStatus", ".", "SUCCEEDED", "==", "dsStatus", ")", "{", "LOG", ".", "info", "(", "\"Application has completed successfully. Breaking monitoring loop\"", ")", ";", "return", "true", ";", "}", "else", "{", "LOG", ".", "info", "(", "\"Application finished unsuccessfully.\"", "+", "\" YarnState=\"", "+", "state", ".", "toString", "(", ")", "+", "\", DSFinalStatus=\"", "+", "dsStatus", ".", "toString", "(", ")", "+", "\". Breaking monitoring loop\"", ")", ";", "return", "false", ";", "}", "}", "else", "if", "(", "YarnApplicationState", ".", "KILLED", "==", "state", "||", "YarnApplicationState", ".", "FAILED", "==", "state", ")", "{", "LOG", ".", "info", "(", "\"Application did not finish.\"", "+", "\" YarnState=\"", "+", "state", ".", "toString", "(", ")", "+", "\", DSFinalStatus=\"", "+", "dsStatus", ".", "toString", "(", ")", "+", "\". Breaking monitoring loop\"", ")", ";", "return", "false", ";", "}", "if", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "startMillis", ">", "timeoutMillis", ")", "{", "LOG", ".", "info", "(", "\"Reached specified timeout. Killing application\"", ")", ";", "clientRM", ".", "killApplication", "(", "appId", ")", ";", "return", "false", ";", "}", "}", "}" ]
monitor the submitted application for completion . kill application if time expires .
train
false
69,185
public void removeAllFirmwareUpdateCallbacks(){ firmwareUpdateCallbacks.clear(); }
[ "public", "void", "removeAllFirmwareUpdateCallbacks", "(", ")", "{", "firmwareUpdateCallbacks", ".", "clear", "(", ")", ";", "}" ]
removes all firmware update callbacks .
train
false
69,186
public static boolean sameClass(final Object first,final Object second){ return first.getClass() == second.getClass(); }
[ "public", "static", "boolean", "sameClass", "(", "final", "Object", "first", ",", "final", "Object", "second", ")", "{", "return", "first", ".", "getClass", "(", ")", "==", "second", ".", "getClass", "(", ")", ";", "}" ]
this method checks if two objects are of the same class .
train
false
69,187
public static int findFirstNotOf(String container,String chars,int begin){ for (int i=begin; i < container.length() && i >= 0; ++i) if (!chars.contains("" + container.charAt(i))) return i; return -1; }
[ "public", "static", "int", "findFirstNotOf", "(", "String", "container", ",", "String", "chars", ",", "int", "begin", ")", "{", "for", "(", "int", "i", "=", "begin", ";", "i", "<", "container", ".", "length", "(", ")", "&&", "i", ">=", "0", ";", "++", "i", ")", "if", "(", "!", "chars", ".", "contains", "(", "\"\"", "+", "container", ".", "charAt", "(", "i", ")", ")", ")", "return", "i", ";", "return", "-", "1", ";", "}" ]
find the first occurrence of characters not in the charseq from begin
train
true
69,190
private double calculateMaxMembershipChange(final double[][] matrix){ double maxMembership=0.0; for (int i=0; i < points.size(); i++) { for (int j=0; j < clusters.size(); j++) { double v=FastMath.abs(membershipMatrix[i][j] - matrix[i][j]); maxMembership=FastMath.max(v,maxMembership); } } return maxMembership; }
[ "private", "double", "calculateMaxMembershipChange", "(", "final", "double", "[", "]", "[", "]", "matrix", ")", "{", "double", "maxMembership", "=", "0.0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "points", ".", "size", "(", ")", ";", "i", "++", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "clusters", ".", "size", "(", ")", ";", "j", "++", ")", "{", "double", "v", "=", "FastMath", ".", "abs", "(", "membershipMatrix", "[", "i", "]", "[", "j", "]", "-", "matrix", "[", "i", "]", "[", "j", "]", ")", ";", "maxMembership", "=", "FastMath", ".", "max", "(", "v", ",", "maxMembership", ")", ";", "}", "}", "return", "maxMembership", ";", "}" ]
calculate the maximum element - by - element change of the membership matrix for the current iteration .
train
false
69,191
public Session store(){ long expired=Global.getLong("session.alive",X.AWEEK); if (expired > 0) { expired=System.currentTimeMillis() + expired; } else { expired=-1; } return store(expired); }
[ "public", "Session", "store", "(", ")", "{", "long", "expired", "=", "Global", ".", "getLong", "(", "\"session.alive\"", ",", "X", ".", "AWEEK", ")", ";", "if", "(", "expired", ">", "0", ")", "{", "expired", "=", "System", ".", "currentTimeMillis", "(", ")", "+", "expired", ";", "}", "else", "{", "expired", "=", "-", "1", ";", "}", "return", "store", "(", "expired", ")", ";", "}" ]
store the session with configured expired
train
false
69,192
private void prepareTrackForDisplay(Track track,Map<String,Object> resultMap){ TripStatistics tripStatitics=track.getTripStatistics(); String icon=track.getIcon(); String category=icon != null && !icon.equals("") ? null : track.getCategory(); resultMap.put(IS_RECORDING_FIELD,track.getId() == recordingTrackId); resultMap.put(IS_PAUSED_FIELD,recordingTrackPaused); resultMap.put(ICON_ID_FIELD,TrackIconUtils.getIconDrawable(icon)); resultMap.put(ICON_CONTENT_DESCRIPTION_ID_FIELD,R.string.image_track); resultMap.put(NAME_FIELD,track.getName()); resultMap.put(SHARED_OWNER_FIELD,track.getSharedOwner()); resultMap.put(TOTAL_TIME_FIELD,StringUtils.formatElapsedTime(tripStatitics.getTotalTime())); resultMap.put(TOTAL_DISTANCE_FIELD,StringUtils.formatDistance(this,tripStatitics.getTotalDistance(),metricUnits)); resultMap.put(MARKER_COUNT_FIELD,myTracksProviderUtils.getWaypointCount(track.getId())); resultMap.put(START_TIME_FIELD,tripStatitics.getStartTime()); resultMap.put(CATEGORY_FIELD,category); resultMap.put(DESCRIPTION_FIELD,track.getDescription()); resultMap.put(PHOTO_URL_FIELD,null); resultMap.put(TRACK_ID_FIELD,track.getId()); resultMap.put(MARKER_ID_FIELD,null); }
[ "private", "void", "prepareTrackForDisplay", "(", "Track", "track", ",", "Map", "<", "String", ",", "Object", ">", "resultMap", ")", "{", "TripStatistics", "tripStatitics", "=", "track", ".", "getTripStatistics", "(", ")", ";", "String", "icon", "=", "track", ".", "getIcon", "(", ")", ";", "String", "category", "=", "icon", "!=", "null", "&&", "!", "icon", ".", "equals", "(", "\"\"", ")", "?", "null", ":", "track", ".", "getCategory", "(", ")", ";", "resultMap", ".", "put", "(", "IS_RECORDING_FIELD", ",", "track", ".", "getId", "(", ")", "==", "recordingTrackId", ")", ";", "resultMap", ".", "put", "(", "IS_PAUSED_FIELD", ",", "recordingTrackPaused", ")", ";", "resultMap", ".", "put", "(", "ICON_ID_FIELD", ",", "TrackIconUtils", ".", "getIconDrawable", "(", "icon", ")", ")", ";", "resultMap", ".", "put", "(", "ICON_CONTENT_DESCRIPTION_ID_FIELD", ",", "R", ".", "string", ".", "image_track", ")", ";", "resultMap", ".", "put", "(", "NAME_FIELD", ",", "track", ".", "getName", "(", ")", ")", ";", "resultMap", ".", "put", "(", "SHARED_OWNER_FIELD", ",", "track", ".", "getSharedOwner", "(", ")", ")", ";", "resultMap", ".", "put", "(", "TOTAL_TIME_FIELD", ",", "StringUtils", ".", "formatElapsedTime", "(", "tripStatitics", ".", "getTotalTime", "(", ")", ")", ")", ";", "resultMap", ".", "put", "(", "TOTAL_DISTANCE_FIELD", ",", "StringUtils", ".", "formatDistance", "(", "this", ",", "tripStatitics", ".", "getTotalDistance", "(", ")", ",", "metricUnits", ")", ")", ";", "resultMap", ".", "put", "(", "MARKER_COUNT_FIELD", ",", "myTracksProviderUtils", ".", "getWaypointCount", "(", "track", ".", "getId", "(", ")", ")", ")", ";", "resultMap", ".", "put", "(", "START_TIME_FIELD", ",", "tripStatitics", ".", "getStartTime", "(", ")", ")", ";", "resultMap", ".", "put", "(", "CATEGORY_FIELD", ",", "category", ")", ";", "resultMap", ".", "put", "(", "DESCRIPTION_FIELD", ",", "track", ".", "getDescription", "(", ")", ")", ";", "resultMap", ".", "put", "(", "PHOTO_URL_FIELD", ",", "null", ")", ";", "resultMap", ".", "put", "(", "TRACK_ID_FIELD", ",", "track", ".", "getId", "(", ")", ")", ";", "resultMap", ".", "put", "(", "MARKER_ID_FIELD", ",", "null", ")", ";", "}" ]
prepares a track for display by filling in a result map .
train
false
69,193
public final MessageBuilder header(String name,String value){ JsoArray<Pair> headers=message.getHeaders(); if (headers == null) { headers=JsoArray.create(); } for (int i=0; i < headers.size(); i++) { Pair header=headers.get(i); if (name.equals(header.getName())) { header.setValue(value); return this; } } Pair header=Pair.create(); header.setName(name); header.setValue(value); headers.add(header); message.setHeaders(headers); return this; }
[ "public", "final", "MessageBuilder", "header", "(", "String", "name", ",", "String", "value", ")", "{", "JsoArray", "<", "Pair", ">", "headers", "=", "message", ".", "getHeaders", "(", ")", ";", "if", "(", "headers", "==", "null", ")", "{", "headers", "=", "JsoArray", ".", "create", "(", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "headers", ".", "size", "(", ")", ";", "i", "++", ")", "{", "Pair", "header", "=", "headers", ".", "get", "(", "i", ")", ";", "if", "(", "name", ".", "equals", "(", "header", ".", "getName", "(", ")", ")", ")", "{", "header", ".", "setValue", "(", "value", ")", ";", "return", "this", ";", "}", "}", "Pair", "header", "=", "Pair", ".", "create", "(", ")", ";", "header", ".", "setName", "(", "name", ")", ";", "header", ".", "setValue", "(", "value", ")", ";", "headers", ".", "add", "(", "header", ")", ";", "message", ".", "setHeaders", "(", "headers", ")", ";", "return", "this", ";", "}" ]
sets a request header with the given name and value . if a header with the specified name has already been set then the new value overwrites the current value .
train
false
69,194
public boolean isC66Encoded(){ return encryptedString != null && encryptedString.contains("*"); }
[ "public", "boolean", "isC66Encoded", "(", ")", "{", "return", "encryptedString", "!=", "null", "&&", "encryptedString", ".", "contains", "(", "\"*\"", ")", ";", "}" ]
determines whether the session id is c66 encoded or not .
train
false
69,196
public void updateDirty(){ memory.updateDirty(); reg.updateDirty(); }
[ "public", "void", "updateDirty", "(", ")", "{", "memory", ".", "updateDirty", "(", ")", ";", "reg", ".", "updateDirty", "(", ")", ";", "}" ]
decrement all dirty flags to indicate a processing step
train
false
69,197
protected boolean doDamage(final RPEntity entity){ final int hp=entity.getHP(); if (hp == 0) { return false; } if (entity.isGhost()) { return true; } int damage=(int)(hp * damageRatio); damage=Math.max(damage,minimumDamage); damage=Math.min(damage,hp); if (damage != 0) { entity.onDamaged(this,damage); } return true; }
[ "protected", "boolean", "doDamage", "(", "final", "RPEntity", "entity", ")", "{", "final", "int", "hp", "=", "entity", ".", "getHP", "(", ")", ";", "if", "(", "hp", "==", "0", ")", "{", "return", "false", ";", "}", "if", "(", "entity", ".", "isGhost", "(", ")", ")", "{", "return", "true", ";", "}", "int", "damage", "=", "(", "int", ")", "(", "hp", "*", "damageRatio", ")", ";", "damage", "=", "Math", ".", "max", "(", "damage", ",", "minimumDamage", ")", ";", "damage", "=", "Math", ".", "min", "(", "damage", ",", "hp", ")", ";", "if", "(", "damage", "!=", "0", ")", "{", "entity", ".", "onDamaged", "(", "this", ",", "damage", ")", ";", "}", "return", "true", ";", "}" ]
inflict damage on an entity .
train
false
69,198
public void resetExtremeGravityPSRs(){ extremeGravityRolls.removeAllElements(); }
[ "public", "void", "resetExtremeGravityPSRs", "(", ")", "{", "extremeGravityRolls", ".", "removeAllElements", "(", ")", ";", "}" ]
resets the extreme gravity psr list .
train
false
69,199
public void update(final long item){ if (itemsSeen_ == MAX_ITEMS_SEEN) { throw new SketchesStateException("Sketch has exceeded capacity for total items seen: " + MAX_ITEMS_SEEN); } if (itemsSeen_ < reservoirSize_) { if (itemsSeen_ >= currItemsAlloc_) { growReservoir(); } assert itemsSeen_ < currItemsAlloc_; data_[(int)itemsSeen_]=item; ++itemsSeen_; } else { ++itemsSeen_; if (SamplingUtil.rand.nextDouble() * itemsSeen_ < reservoirSize_) { int newSlot=SamplingUtil.rand.nextInt(reservoirSize_); data_[newSlot]=item; } } }
[ "public", "void", "update", "(", "final", "long", "item", ")", "{", "if", "(", "itemsSeen_", "==", "MAX_ITEMS_SEEN", ")", "{", "throw", "new", "SketchesStateException", "(", "\"Sketch has exceeded capacity for total items seen: \"", "+", "MAX_ITEMS_SEEN", ")", ";", "}", "if", "(", "itemsSeen_", "<", "reservoirSize_", ")", "{", "if", "(", "itemsSeen_", ">=", "currItemsAlloc_", ")", "{", "growReservoir", "(", ")", ";", "}", "assert", "itemsSeen_", "<", "currItemsAlloc_", ";", "data_", "[", "(", "int", ")", "itemsSeen_", "]", "=", "item", ";", "++", "itemsSeen_", ";", "}", "else", "{", "++", "itemsSeen_", ";", "if", "(", "SamplingUtil", ".", "rand", ".", "nextDouble", "(", ")", "*", "itemsSeen_", "<", "reservoirSize_", ")", "{", "int", "newSlot", "=", "SamplingUtil", ".", "rand", ".", "nextInt", "(", "reservoirSize_", ")", ";", "data_", "[", "newSlot", "]", "=", "item", ";", "}", "}", "}" ]
randomly decide whether or not to include an item in the sample set .
train
true
69,200
public JCExpression transformComprehension(Tree.Comprehension comp){ return transformComprehension(comp,null); }
[ "public", "JCExpression", "transformComprehension", "(", "Tree", ".", "Comprehension", "comp", ")", "{", "return", "transformComprehension", "(", "comp", ",", "null", ")", ";", "}" ]
creates an anonymous class that extends iterable and implements the specified comprehension .
train
false
69,202
public static String readURLConnection(URLConnection uc) throws Exception { StringBuffer buffer=new StringBuffer(); BufferedReader reader=null; try { reader=new BufferedReader(new InputStreamReader(uc.getInputStream())); int letter=0; while ((letter=reader.read()) != -1) { buffer.append((char)letter); } reader.close(); } catch ( Exception e) { BaseServlet.log(UPS2Servlet.class,"Could not read from URL: " + e.toString()); throw e; } finally { if (reader != null) { reader.close(); reader=null; } } return buffer.toString(); }
[ "public", "static", "String", "readURLConnection", "(", "URLConnection", "uc", ")", "throws", "Exception", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "BufferedReader", "reader", "=", "null", ";", "try", "{", "reader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "uc", ".", "getInputStream", "(", ")", ")", ")", ";", "int", "letter", "=", "0", ";", "while", "(", "(", "letter", "=", "reader", ".", "read", "(", ")", ")", "!=", "-", "1", ")", "{", "buffer", ".", "append", "(", "(", "char", ")", "letter", ")", ";", "}", "reader", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "BaseServlet", ".", "log", "(", "UPS2Servlet", ".", "class", ",", "\"Could not read from URL: \"", "+", "e", ".", "toString", "(", ")", ")", ";", "throw", "e", ";", "}", "finally", "{", "if", "(", "reader", "!=", "null", ")", "{", "reader", ".", "close", "(", ")", ";", "reader", "=", "null", ";", "}", "}", "return", "buffer", ".", "toString", "(", ")", ";", "}" ]
this method read all of the data from a url connection to a string
train
false
69,203
public R paramsToMultipartEntity(){ try { mHttpEntity=createMultipartEntity(false); } catch ( IOException e) { e.printStackTrace(); } return (R)this; }
[ "public", "R", "paramsToMultipartEntity", "(", ")", "{", "try", "{", "mHttpEntity", "=", "createMultipartEntity", "(", "false", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "(", "R", ")", "this", ";", "}" ]
convert params to multipart entity .
train
false
69,206
public void end(){ if (cleanupCounter.get() == null || cleanupCounter.get() < 0) { log.warn("Cleanup counter is null or invalid"); } else if (cleanupCounter.get() == 0) { log.trace("Cleanup SecurityContext"); AppContext.setSecurityContext(null); cleanupCounter.remove(); } else { log.trace("Do not own authentication, cleanup not required"); cleanupCounter.set(cleanupCounter.get() - 1); log.trace("New cleanup counter value: {}",cleanupCounter.get()); } }
[ "public", "void", "end", "(", ")", "{", "if", "(", "cleanupCounter", ".", "get", "(", ")", "==", "null", "||", "cleanupCounter", ".", "get", "(", ")", "<", "0", ")", "{", "log", ".", "warn", "(", "\"Cleanup counter is null or invalid\"", ")", ";", "}", "else", "if", "(", "cleanupCounter", ".", "get", "(", ")", "==", "0", ")", "{", "log", ".", "trace", "(", "\"Cleanup SecurityContext\"", ")", ";", "AppContext", ".", "setSecurityContext", "(", "null", ")", ";", "cleanupCounter", ".", "remove", "(", ")", ";", "}", "else", "{", "log", ".", "trace", "(", "\"Do not own authentication, cleanup not required\"", ")", ";", "cleanupCounter", ".", "set", "(", "cleanupCounter", ".", "get", "(", ")", "-", "1", ")", ";", "log", ".", "trace", "(", "\"New cleanup counter value: {}\"", ",", "cleanupCounter", ".", "get", "(", ")", ")", ";", "}", "}" ]
end of an authenticated code block . < p / > performs cleanup for securitycontext if there was previous loginonce in this thread . must be called in " finally " section of a try / finally block .
train
false
69,207
@KnownFailure("Not supported : pattern with %") public void test_getColumnsArbitrary() throws SQLException { ResultSet setAllNull=null; ResultSet setMixed=null; ResultSet allArbitrary=null; String[] tablesName={DatabaseCreator.TEST_TABLE1,DatabaseCreator.TEST_TABLE3}; Arrays.sort(tablesName); int setSize=0; try { allArbitrary=meta.getColumns("%","%","%","%"); assertNotNull(allArbitrary); checkColumnsShape(allArbitrary); setSize=crossCheckGetColumnsAndResultSetMetaData(allArbitrary,false); assertEquals(6,setSize); setMixed=meta.getColumns(null,null,"%","%"); assertNotNull(setMixed); checkColumnsShape(setMixed); setSize=crossCheckGetColumnsAndResultSetMetaData(setMixed,false); assertEquals(6,setSize); } catch ( SQLException e) { fail("Unexpected exception: " + e.getMessage()); } conn.close(); try { meta.getColumns(null,null,DatabaseCreator.TEST_TABLE1,"%"); fail("SQLException not thrown"); } catch ( SQLException e) { } }
[ "@", "KnownFailure", "(", "\"Not supported : pattern with %\"", ")", "public", "void", "test_getColumnsArbitrary", "(", ")", "throws", "SQLException", "{", "ResultSet", "setAllNull", "=", "null", ";", "ResultSet", "setMixed", "=", "null", ";", "ResultSet", "allArbitrary", "=", "null", ";", "String", "[", "]", "tablesName", "=", "{", "DatabaseCreator", ".", "TEST_TABLE1", ",", "DatabaseCreator", ".", "TEST_TABLE3", "}", ";", "Arrays", ".", "sort", "(", "tablesName", ")", ";", "int", "setSize", "=", "0", ";", "try", "{", "allArbitrary", "=", "meta", ".", "getColumns", "(", "\"%\"", ",", "\"%\"", ",", "\"%\"", ",", "\"%\"", ")", ";", "assertNotNull", "(", "allArbitrary", ")", ";", "checkColumnsShape", "(", "allArbitrary", ")", ";", "setSize", "=", "crossCheckGetColumnsAndResultSetMetaData", "(", "allArbitrary", ",", "false", ")", ";", "assertEquals", "(", "6", ",", "setSize", ")", ";", "setMixed", "=", "meta", ".", "getColumns", "(", "null", ",", "null", ",", "\"%\"", ",", "\"%\"", ")", ";", "assertNotNull", "(", "setMixed", ")", ";", "checkColumnsShape", "(", "setMixed", ")", ";", "setSize", "=", "crossCheckGetColumnsAndResultSetMetaData", "(", "setMixed", ",", "false", ")", ";", "assertEquals", "(", "6", ",", "setSize", ")", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "fail", "(", "\"Unexpected exception: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "conn", ".", "close", "(", ")", ";", "try", "{", "meta", ".", "getColumns", "(", "null", ",", "null", ",", "DatabaseCreator", ".", "TEST_TABLE1", ",", "\"%\"", ")", ";", "fail", "(", "\"SQLException not thrown\"", ")", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "}", "}" ]
java . sql . databasemetadata # getcolumns ( java . lang . string , java . lang . string , java . lang . string , java . lang . string )
train
false
69,209
public static boolean isValidEmail(Object value){ InternetAddress addr=parseEmail(value); if (addr != null) { String address=addr.getAddress(); if (address.contains("..")) return false; int pos=address.indexOf('@'); if (pos < 1 || pos == address.length() - 1) return false; String local=address.substring(0,pos); String domain=address.substring(pos + 1); if (domain.charAt(0) == '.' || local.charAt(0) == '.' || local.charAt(local.length() - 1) == '.') return false; pos=domain.lastIndexOf('.'); if (pos > 0 && pos < domain.length() - 2) { if (StringUtil.isAllAlpha(domain.substring(pos + 1))) return true; try { addr.validate(); return true; } catch ( AddressException e) { } } } return false; }
[ "public", "static", "boolean", "isValidEmail", "(", "Object", "value", ")", "{", "InternetAddress", "addr", "=", "parseEmail", "(", "value", ")", ";", "if", "(", "addr", "!=", "null", ")", "{", "String", "address", "=", "addr", ".", "getAddress", "(", ")", ";", "if", "(", "address", ".", "contains", "(", "\"..\"", ")", ")", "return", "false", ";", "int", "pos", "=", "address", ".", "indexOf", "(", "'@'", ")", ";", "if", "(", "pos", "<", "1", "||", "pos", "==", "address", ".", "length", "(", ")", "-", "1", ")", "return", "false", ";", "String", "local", "=", "address", ".", "substring", "(", "0", ",", "pos", ")", ";", "String", "domain", "=", "address", ".", "substring", "(", "pos", "+", "1", ")", ";", "if", "(", "domain", ".", "charAt", "(", "0", ")", "==", "'.'", "||", "local", ".", "charAt", "(", "0", ")", "==", "'.'", "||", "local", ".", "charAt", "(", "local", ".", "length", "(", ")", "-", "1", ")", "==", "'.'", ")", "return", "false", ";", "pos", "=", "domain", ".", "lastIndexOf", "(", "'.'", ")", ";", "if", "(", "pos", ">", "0", "&&", "pos", "<", "domain", ".", "length", "(", ")", "-", "2", ")", "{", "if", "(", "StringUtil", ".", "isAllAlpha", "(", "domain", ".", "substring", "(", "pos", "+", "1", ")", ")", ")", "return", "true", ";", "try", "{", "addr", ".", "validate", "(", ")", ";", "return", "true", ";", "}", "catch", "(", "AddressException", "e", ")", "{", "}", "}", "}", "return", "false", ";", "}" ]
returns true if the passed value is a in valid email address format
train
true
69,210
public static boolean isNumericTypeSpecifier(char c,boolean isDecimal){ if (isDecimal) { switch (c) { case 'G': case 'g': case 'D': case 'd': case 'F': case 'f': return true; } } else { switch (c) { case 'G': case 'g': case 'I': case 'i': case 'L': case 'l': return true; } } return false; }
[ "public", "static", "boolean", "isNumericTypeSpecifier", "(", "char", "c", ",", "boolean", "isDecimal", ")", "{", "if", "(", "isDecimal", ")", "{", "switch", "(", "c", ")", "{", "case", "'G'", ":", "case", "'g'", ":", "case", "'D'", ":", "case", "'d'", ":", "case", "'F'", ":", "case", "'f'", ":", "return", "true", ";", "}", "}", "else", "{", "switch", "(", "c", ")", "{", "case", "'G'", ":", "case", "'g'", ":", "case", "'I'", ":", "case", "'i'", ":", "case", "'L'", ":", "case", "'l'", ":", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
returns true if the specified character is a valid type specifier for a numeric value .
train
false
69,211
public void addOnTagSelectListener(TagsSelectListener listener){ if (selectListeners == null) { selectListeners=new ArrayList<>(); } selectListeners.add(listener); }
[ "public", "void", "addOnTagSelectListener", "(", "TagsSelectListener", "listener", ")", "{", "if", "(", "selectListeners", "==", "null", ")", "{", "selectListeners", "=", "new", "ArrayList", "<", ">", "(", ")", ";", "}", "selectListeners", ".", "add", "(", "listener", ")", ";", "}" ]
adding selection items listener
train
false
69,212
public List<C> instantiateClasses(Parameterization config){ config=config.descend(this); List<C> instances=new ArrayList<>(); if (getValue() == null) { config.reportError(new UnusedParameterException("Value of parameter " + getName() + " has not been specified.")); return instances; } for ( Class<? extends C> cls : getValue()) { try { C instance=ClassGenericsUtil.tryInstantiate(restrictionClass,cls,config); instances.add(instance); } catch ( Exception e) { config.reportError(new WrongParameterValueException(this,cls.getName(),e)); } } return instances; }
[ "public", "List", "<", "C", ">", "instantiateClasses", "(", "Parameterization", "config", ")", "{", "config", "=", "config", ".", "descend", "(", "this", ")", ";", "List", "<", "C", ">", "instances", "=", "new", "ArrayList", "<", ">", "(", ")", ";", "if", "(", "getValue", "(", ")", "==", "null", ")", "{", "config", ".", "reportError", "(", "new", "UnusedParameterException", "(", "\"Value of parameter \"", "+", "getName", "(", ")", "+", "\" has not been specified.\"", ")", ")", ";", "return", "instances", ";", "}", "for", "(", "Class", "<", "?", "extends", "C", ">", "cls", ":", "getValue", "(", ")", ")", "{", "try", "{", "C", "instance", "=", "ClassGenericsUtil", ".", "tryInstantiate", "(", "restrictionClass", ",", "cls", ",", "config", ")", ";", "instances", ".", "add", "(", "instance", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "config", ".", "reportError", "(", "new", "WrongParameterValueException", "(", "this", ",", "cls", ".", "getName", "(", ")", ",", "e", ")", ")", ";", "}", "}", "return", "instances", ";", "}" ]
returns a list of new instances for the value ( i . e . , the class name ) of this class list parameter . the instances have the type of the restriction class of this class list parameter . < p / > if the class for the class names is not found , the instantiation is tried using the package of the restriction class as package of the class name .
train
true
69,213
public void mouseReleased(MouseEvent e){ if (!marginChanged) return; TableColumnModel tcm=table.getColumnModel(); for (int i=0; i < tcm.getColumnCount(); i++) { LimeTableColumn ltc=(LimeTableColumn)tcm.getColumn(i); setWidth(ltc,ltc.getWidth()); } marginChanged=false; save(); }
[ "public", "void", "mouseReleased", "(", "MouseEvent", "e", ")", "{", "if", "(", "!", "marginChanged", ")", "return", ";", "TableColumnModel", "tcm", "=", "table", ".", "getColumnModel", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "tcm", ".", "getColumnCount", "(", ")", ";", "i", "++", ")", "{", "LimeTableColumn", "ltc", "=", "(", "LimeTableColumn", ")", "tcm", ".", "getColumn", "(", "i", ")", ";", "setWidth", "(", "ltc", ",", "ltc", ".", "getWidth", "(", ")", ")", ";", "}", "marginChanged", "=", "false", ";", "save", "(", ")", ";", "}" ]
the mouse released from the table header .
train
false
69,214
public void test_fill$IIII(){ int val=Integer.MAX_VALUE; int d[]=new int[1000]; Arrays.fill(d,400,d.length,val); for (int i=0; i < 400; i++) assertTrue("Filled elements not in range",!(d[i] == val)); for (int i=400; i < d.length; i++) assertTrue("Failed to fill int array correctly",d[i] == val); try { Arrays.fill(d,10,0,val); fail("IllegalArgumentException expected"); } catch ( IllegalArgumentException e) { } try { Arrays.fill(d,-10,0,val); fail("ArrayIndexOutOfBoundsException expected"); } catch ( ArrayIndexOutOfBoundsException e) { } try { Arrays.fill(d,10,d.length + 1,val); fail("ArrayIndexOutOfBoundsException expected"); } catch ( ArrayIndexOutOfBoundsException e) { } }
[ "public", "void", "test_fill$IIII", "(", ")", "{", "int", "val", "=", "Integer", ".", "MAX_VALUE", ";", "int", "d", "[", "]", "=", "new", "int", "[", "1000", "]", ";", "Arrays", ".", "fill", "(", "d", ",", "400", ",", "d", ".", "length", ",", "val", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "400", ";", "i", "++", ")", "assertTrue", "(", "\"Filled elements not in range\"", ",", "!", "(", "d", "[", "i", "]", "==", "val", ")", ")", ";", "for", "(", "int", "i", "=", "400", ";", "i", "<", "d", ".", "length", ";", "i", "++", ")", "assertTrue", "(", "\"Failed to fill int array correctly\"", ",", "d", "[", "i", "]", "==", "val", ")", ";", "try", "{", "Arrays", ".", "fill", "(", "d", ",", "10", ",", "0", ",", "val", ")", ";", "fail", "(", "\"IllegalArgumentException expected\"", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "}", "try", "{", "Arrays", ".", "fill", "(", "d", ",", "-", "10", ",", "0", ",", "val", ")", ";", "fail", "(", "\"ArrayIndexOutOfBoundsException expected\"", ")", ";", "}", "catch", "(", "ArrayIndexOutOfBoundsException", "e", ")", "{", "}", "try", "{", "Arrays", ".", "fill", "(", "d", ",", "10", ",", "d", ".", "length", "+", "1", ",", "val", ")", ";", "fail", "(", "\"ArrayIndexOutOfBoundsException expected\"", ")", ";", "}", "catch", "(", "ArrayIndexOutOfBoundsException", "e", ")", "{", "}", "}" ]
java . util . arrays # fill ( int [ ] , int , int , int )
train
false
69,215
@Override public void onReset(){ closeDialog(); }
[ "@", "Override", "public", "void", "onReset", "(", ")", "{", "closeDialog", "(", ")", ";", "}" ]
called when the view navigates .
train
false
69,216
public static void write(double x){ write(Double.doubleToRawLongBits(x)); }
[ "public", "static", "void", "write", "(", "double", "x", ")", "{", "write", "(", "Double", ".", "doubleToRawLongBits", "(", "x", ")", ")", ";", "}" ]
write the 64 - bit double to standard output .
train
false
69,217
public Container removeAllChildren(){ mDisplayList.clear(); return this; }
[ "public", "Container", "removeAllChildren", "(", ")", "{", "mDisplayList", ".", "clear", "(", ")", ";", "return", "this", ";", "}" ]
removes all children from the display list .
train
false
69,219
@Override public void write(int oneByte) throws IOException { Streams.writeSingleByte(this,oneByte); }
[ "@", "Override", "public", "void", "write", "(", "int", "oneByte", ")", "throws", "IOException", "{", "Streams", ".", "writeSingleByte", "(", "this", ",", "oneByte", ")", ";", "}" ]
method acts as described in spec for superclass .
train
false
69,220
@SuppressWarnings("unchecked") public <R>Optional<R> select(Class<R> clazz){ Objects.requireNonNull(clazz); if (!isPresent()) return empty(); return (Optional<R>)Optional.ofNullable(clazz.isInstance(value) ? value : null); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "R", ">", "Optional", "<", "R", ">", "select", "(", "Class", "<", "R", ">", "clazz", ")", "{", "Objects", ".", "requireNonNull", "(", "clazz", ")", ";", "if", "(", "!", "isPresent", "(", ")", ")", "return", "empty", "(", ")", ";", "return", "(", "Optional", "<", "R", ">", ")", "Optional", ".", "ofNullable", "(", "clazz", ".", "isInstance", "(", "value", ")", "?", "value", ":", "null", ")", ";", "}" ]
keeps inner value only if is present and instance of given class .
train
true
69,221
public static void remove(){ DATA.remove(); clearLogListener(); }
[ "public", "static", "void", "remove", "(", ")", "{", "DATA", ".", "remove", "(", ")", ";", "clearLogListener", "(", ")", ";", "}" ]
clears the current processlaunchercontext for the calling thread .
train
false
69,222
public static boolean containsIgnoreCase(String[] array,String value){ for ( String str : array) { if (value == null && str == null) return true; if (value != null && value.equalsIgnoreCase(str)) return true; } return false; }
[ "public", "static", "boolean", "containsIgnoreCase", "(", "String", "[", "]", "array", ",", "String", "value", ")", "{", "for", "(", "String", "str", ":", "array", ")", "{", "if", "(", "value", "==", "null", "&&", "str", "==", "null", ")", "return", "true", ";", "if", "(", "value", "!=", "null", "&&", "value", ".", "equalsIgnoreCase", "(", "str", ")", ")", "return", "true", ";", "}", "return", "false", ";", "}" ]
check if the given array contains the given value ( with case - insensitive comparison ) .
train
true
69,224
private void throwCircularDependenciesException() throws CircularDependenciesException { String msg="Circular dependencies found. Check the circular graph below:\n"; boolean firstNode=true; String tab=" "; for ( String visit : visitedInjectNodes) { if (!firstNode) { msg+=tab + "->"; tab+=tab; } msg+=visit + "\n"; firstNode=false; } msg+=tab.substring(2) + "->" + revisitedNode+ "\n"; throw new CircularDependenciesException(msg); }
[ "private", "void", "throwCircularDependenciesException", "(", ")", "throws", "CircularDependenciesException", "{", "String", "msg", "=", "\"Circular dependencies found. Check the circular graph below:\\n\"", ";", "boolean", "firstNode", "=", "true", ";", "String", "tab", "=", "\" \"", ";", "for", "(", "String", "visit", ":", "visitedInjectNodes", ")", "{", "if", "(", "!", "firstNode", ")", "{", "msg", "+=", "tab", "+", "\"->\"", ";", "tab", "+=", "tab", ";", "}", "msg", "+=", "visit", "+", "\"\\n\"", ";", "firstNode", "=", "false", ";", "}", "msg", "+=", "tab", ".", "substring", "(", "2", ")", "+", "\"->\"", "+", "revisitedNode", "+", "\"\\n\"", ";", "throw", "new", "CircularDependenciesException", "(", "msg", ")", ";", "}" ]
print readable circular graph
train
true
69,227
static float stringSimiliarity(String str1,String str2){ int hit=0; for (int i=0; i < str1.length() - 1; ++i) { for (int j=0; j < str2.length() - 1; ++j) { if ((str1.charAt(i) == str2.charAt(j)) && (str1.charAt(i + 1) == str2.charAt(j + 1))) { ++hit; break; } } } return 2.0f * hit / (str1.length() + str2.length()); }
[ "static", "float", "stringSimiliarity", "(", "String", "str1", ",", "String", "str2", ")", "{", "int", "hit", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "str1", ".", "length", "(", ")", "-", "1", ";", "++", "i", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "str2", ".", "length", "(", ")", "-", "1", ";", "++", "j", ")", "{", "if", "(", "(", "str1", ".", "charAt", "(", "i", ")", "==", "str2", ".", "charAt", "(", "j", ")", ")", "&&", "(", "str1", ".", "charAt", "(", "i", "+", "1", ")", "==", "str2", ".", "charAt", "(", "j", "+", "1", ")", ")", ")", "{", "++", "hit", ";", "break", ";", "}", "}", "}", "return", "2.0f", "*", "hit", "/", "(", "str1", ".", "length", "(", ")", "+", "str2", ".", "length", "(", ")", ")", ";", "}" ]
compute string similarity based on dice ' s coefficient . ported from str_similar ( ) in globals . cpp .
train
false
69,228
public void changedCell(DF_LatticeCell cell){ Iterator<DF_Equation> e=cell.getUses(); while (e.hasNext()) { newEquations.add(e.next()); } }
[ "public", "void", "changedCell", "(", "DF_LatticeCell", "cell", ")", "{", "Iterator", "<", "DF_Equation", ">", "e", "=", "cell", ".", "getUses", "(", ")", ";", "while", "(", "e", ".", "hasNext", "(", ")", ")", "{", "newEquations", ".", "add", "(", "e", ".", "next", "(", ")", ")", ";", "}", "}" ]
call this method when the contents of a lattice cell changes . this routine adds all equations using this cell to the set of new equations .
train
false
69,229
public boolean remove(Object o){ final ReentrantLock lock=this.lock; lock.lock(); try { for ( TenantQueue q : qs.values()) { if (q.remove(o)) return true; } return false; } finally { lock.unlock(); } }
[ "public", "boolean", "remove", "(", "Object", "o", ")", "{", "final", "ReentrantLock", "lock", "=", "this", ".", "lock", ";", "lock", ".", "lock", "(", ")", ";", "try", "{", "for", "(", "TenantQueue", "q", ":", "qs", ".", "values", "(", ")", ")", "{", "if", "(", "q", ".", "remove", "(", "o", ")", ")", "return", "true", ";", "}", "return", "false", ";", "}", "finally", "{", "lock", ".", "unlock", "(", ")", ";", "}", "}" ]
removes a single instance of the specified element from this queue , if it is present , whether or not it has expired .
train
false
69,233
public void guard(final Runnable r){ incThread(); try { r.run(); } finally { decThread(); } }
[ "public", "void", "guard", "(", "final", "Runnable", "r", ")", "{", "incThread", "(", ")", ";", "try", "{", "r", ".", "run", "(", ")", ";", "}", "finally", "{", "decThread", "(", ")", ";", "}", "}" ]
execute a critical region which needs to be interrupted if some condition is violated .
train
false
69,234
public void testSizingWithWidthConstraint(){ RectangleConstraint constraint=new RectangleConstraint(10.0,new Range(10.0,10.0),LengthConstraintType.FIXED,0.0,new Range(0.0,0.0),LengthConstraintType.NONE); BlockContainer container=new BlockContainer(new BorderArrangement()); BufferedImage image=new BufferedImage(200,100,BufferedImage.TYPE_INT_RGB); Graphics2D g2=image.createGraphics(); container.add(new EmptyBlock(5.0,6.0)); Size2D size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(6.0,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(15.0,16.0)); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(16.0,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(12.3,45.6),RectangleEdge.RIGHT); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(45.6,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(7.0,20.0)); container.add(new EmptyBlock(8.0,45.6),RectangleEdge.RIGHT); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(45.6,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(12.3,45.6),RectangleEdge.LEFT); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(45.6,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(10.0,20.0)); container.add(new EmptyBlock(12.3,45.6),RectangleEdge.LEFT); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(45.6,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(10.0,20.0),RectangleEdge.RIGHT); container.add(new EmptyBlock(12.3,45.6),RectangleEdge.LEFT); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(45.6,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(10.0,20.0)); container.add(new EmptyBlock(12.3,45.6),RectangleEdge.LEFT); container.add(new EmptyBlock(5.4,3.2),RectangleEdge.RIGHT); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(45.6,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(12.3,45.6),RectangleEdge.BOTTOM); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(45.6,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(10.0,20.0)); container.add(new EmptyBlock(12.3,45.6),RectangleEdge.BOTTOM); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(65.6,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(10.0,20.0),RectangleEdge.RIGHT); container.add(new EmptyBlock(12.3,45.6),RectangleEdge.BOTTOM); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(65.6,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(21.0,12.3)); container.add(new EmptyBlock(10.0,20.0),RectangleEdge.RIGHT); container.add(new EmptyBlock(12.3,45.6),RectangleEdge.BOTTOM); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(65.6,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(10.0,20.0),RectangleEdge.LEFT); container.add(new EmptyBlock(12.3,45.6),RectangleEdge.BOTTOM); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(65.6,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(21.0,12.3)); container.add(new EmptyBlock(10.0,20.0),RectangleEdge.LEFT); container.add(new EmptyBlock(12.3,45.6),RectangleEdge.BOTTOM); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(65.6,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(21.0,12.3),RectangleEdge.RIGHT); container.add(new EmptyBlock(10.0,20.0),RectangleEdge.LEFT); container.add(new EmptyBlock(12.3,45.6),RectangleEdge.BOTTOM); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(65.6,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(3.0,4.0),RectangleEdge.BOTTOM); container.add(new EmptyBlock(5.0,6.0),RectangleEdge.LEFT); container.add(new EmptyBlock(7.0,8.0),RectangleEdge.RIGHT); container.add(new EmptyBlock(9.0,10.0)); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(14.0,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(12.3,45.6),RectangleEdge.TOP); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(45.6,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(10.0,20.0)); container.add(new EmptyBlock(12.3,45.6),RectangleEdge.TOP); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(65.6,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(10.0,20.0),RectangleEdge.RIGHT); container.add(new EmptyBlock(12.3,45.6),RectangleEdge.TOP); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(65.6,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(21.0,12.3)); container.add(new EmptyBlock(10.0,20.0),RectangleEdge.TOP); container.add(new EmptyBlock(12.3,45.6),RectangleEdge.RIGHT); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(65.6,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(10.0,20.0),RectangleEdge.LEFT); container.add(new EmptyBlock(12.3,45.6),RectangleEdge.TOP); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(65.6,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(21.0,12.3)); container.add(new EmptyBlock(10.0,20.0),RectangleEdge.TOP); container.add(new EmptyBlock(12.3,45.6),RectangleEdge.LEFT); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(65.6,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(21.0,12.3),RectangleEdge.RIGHT); container.add(new EmptyBlock(10.0,20.0),RectangleEdge.TOP); container.add(new EmptyBlock(12.3,45.6),RectangleEdge.LEFT); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(65.6,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(1.0,2.0),RectangleEdge.TOP); container.add(new EmptyBlock(5.0,6.0),RectangleEdge.LEFT); container.add(new EmptyBlock(7.0,8.0),RectangleEdge.RIGHT); container.add(new EmptyBlock(9.0,10.0)); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(12.0,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(10.0,20.0),RectangleEdge.TOP); container.add(new EmptyBlock(12.3,45.6),RectangleEdge.BOTTOM); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(65.6,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(21.0,12.3)); container.add(new EmptyBlock(10.0,20.0),RectangleEdge.TOP); container.add(new EmptyBlock(12.3,45.6),RectangleEdge.BOTTOM); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(77.9,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(21.0,12.3),RectangleEdge.RIGHT); container.add(new EmptyBlock(10.0,20.0),RectangleEdge.TOP); container.add(new EmptyBlock(12.3,45.6),RectangleEdge.BOTTOM); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(77.9,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(1.0,2.0),RectangleEdge.TOP); container.add(new EmptyBlock(3.0,4.0),RectangleEdge.BOTTOM); container.add(new EmptyBlock(7.0,8.0),RectangleEdge.RIGHT); container.add(new EmptyBlock(9.0,10.0)); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(16.0,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(21.0,12.3),RectangleEdge.LEFT); container.add(new EmptyBlock(10.0,20.0),RectangleEdge.TOP); container.add(new EmptyBlock(12.3,45.6),RectangleEdge.BOTTOM); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(77.9,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(1.0,2.0),RectangleEdge.TOP); container.add(new EmptyBlock(3.0,4.0),RectangleEdge.BOTTOM); container.add(new EmptyBlock(5.0,6.0),RectangleEdge.LEFT); container.add(new EmptyBlock(9.0,10.0)); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(16.0,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(1.0,2.0),RectangleEdge.TOP); container.add(new EmptyBlock(3.0,4.0),RectangleEdge.BOTTOM); container.add(new EmptyBlock(5.0,6.0),RectangleEdge.LEFT); container.add(new EmptyBlock(7.0,8.0),RectangleEdge.RIGHT); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(14.0,size.height,EPSILON); container.clear(); container.add(new EmptyBlock(1.0,2.0),RectangleEdge.TOP); container.add(new EmptyBlock(3.0,4.0),RectangleEdge.BOTTOM); container.add(new EmptyBlock(5.0,6.0),RectangleEdge.LEFT); container.add(new EmptyBlock(7.0,8.0),RectangleEdge.RIGHT); container.add(new EmptyBlock(9.0,10.0)); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(16.0,size.height,EPSILON); container.clear(); size=container.arrange(g2,constraint); assertEquals(10.0,size.width,EPSILON); assertEquals(0.0,size.height,EPSILON); }
[ "public", "void", "testSizingWithWidthConstraint", "(", ")", "{", "RectangleConstraint", "constraint", "=", "new", "RectangleConstraint", "(", "10.0", ",", "new", "Range", "(", "10.0", ",", "10.0", ")", ",", "LengthConstraintType", ".", "FIXED", ",", "0.0", ",", "new", "Range", "(", "0.0", ",", "0.0", ")", ",", "LengthConstraintType", ".", "NONE", ")", ";", "BlockContainer", "container", "=", "new", "BlockContainer", "(", "new", "BorderArrangement", "(", ")", ")", ";", "BufferedImage", "image", "=", "new", "BufferedImage", "(", "200", ",", "100", ",", "BufferedImage", ".", "TYPE_INT_RGB", ")", ";", "Graphics2D", "g2", "=", "image", ".", "createGraphics", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "5.0", ",", "6.0", ")", ")", ";", "Size2D", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "6.0", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "15.0", ",", "16.0", ")", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "16.0", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "12.3", ",", "45.6", ")", ",", "RectangleEdge", ".", "RIGHT", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "45.6", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "7.0", ",", "20.0", ")", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "8.0", ",", "45.6", ")", ",", "RectangleEdge", ".", "RIGHT", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "45.6", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "12.3", ",", "45.6", ")", ",", "RectangleEdge", ".", "LEFT", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "45.6", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "10.0", ",", "20.0", ")", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "12.3", ",", "45.6", ")", ",", "RectangleEdge", ".", "LEFT", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "45.6", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "10.0", ",", "20.0", ")", ",", "RectangleEdge", ".", "RIGHT", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "12.3", ",", "45.6", ")", ",", "RectangleEdge", ".", "LEFT", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "45.6", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "10.0", ",", "20.0", ")", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "12.3", ",", "45.6", ")", ",", "RectangleEdge", ".", "LEFT", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "5.4", ",", "3.2", ")", ",", "RectangleEdge", ".", "RIGHT", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "45.6", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "12.3", ",", "45.6", ")", ",", "RectangleEdge", ".", "BOTTOM", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "45.6", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "10.0", ",", "20.0", ")", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "12.3", ",", "45.6", ")", ",", "RectangleEdge", ".", "BOTTOM", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "65.6", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "10.0", ",", "20.0", ")", ",", "RectangleEdge", ".", "RIGHT", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "12.3", ",", "45.6", ")", ",", "RectangleEdge", ".", "BOTTOM", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "65.6", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "21.0", ",", "12.3", ")", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "10.0", ",", "20.0", ")", ",", "RectangleEdge", ".", "RIGHT", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "12.3", ",", "45.6", ")", ",", "RectangleEdge", ".", "BOTTOM", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "65.6", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "10.0", ",", "20.0", ")", ",", "RectangleEdge", ".", "LEFT", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "12.3", ",", "45.6", ")", ",", "RectangleEdge", ".", "BOTTOM", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "65.6", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "21.0", ",", "12.3", ")", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "10.0", ",", "20.0", ")", ",", "RectangleEdge", ".", "LEFT", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "12.3", ",", "45.6", ")", ",", "RectangleEdge", ".", "BOTTOM", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "65.6", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "21.0", ",", "12.3", ")", ",", "RectangleEdge", ".", "RIGHT", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "10.0", ",", "20.0", ")", ",", "RectangleEdge", ".", "LEFT", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "12.3", ",", "45.6", ")", ",", "RectangleEdge", ".", "BOTTOM", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "65.6", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "3.0", ",", "4.0", ")", ",", "RectangleEdge", ".", "BOTTOM", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "5.0", ",", "6.0", ")", ",", "RectangleEdge", ".", "LEFT", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "7.0", ",", "8.0", ")", ",", "RectangleEdge", ".", "RIGHT", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "9.0", ",", "10.0", ")", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "14.0", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "12.3", ",", "45.6", ")", ",", "RectangleEdge", ".", "TOP", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "45.6", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "10.0", ",", "20.0", ")", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "12.3", ",", "45.6", ")", ",", "RectangleEdge", ".", "TOP", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "65.6", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "10.0", ",", "20.0", ")", ",", "RectangleEdge", ".", "RIGHT", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "12.3", ",", "45.6", ")", ",", "RectangleEdge", ".", "TOP", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "65.6", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "21.0", ",", "12.3", ")", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "10.0", ",", "20.0", ")", ",", "RectangleEdge", ".", "TOP", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "12.3", ",", "45.6", ")", ",", "RectangleEdge", ".", "RIGHT", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "65.6", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "10.0", ",", "20.0", ")", ",", "RectangleEdge", ".", "LEFT", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "12.3", ",", "45.6", ")", ",", "RectangleEdge", ".", "TOP", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "65.6", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "21.0", ",", "12.3", ")", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "10.0", ",", "20.0", ")", ",", "RectangleEdge", ".", "TOP", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "12.3", ",", "45.6", ")", ",", "RectangleEdge", ".", "LEFT", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "65.6", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "21.0", ",", "12.3", ")", ",", "RectangleEdge", ".", "RIGHT", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "10.0", ",", "20.0", ")", ",", "RectangleEdge", ".", "TOP", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "12.3", ",", "45.6", ")", ",", "RectangleEdge", ".", "LEFT", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "65.6", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "1.0", ",", "2.0", ")", ",", "RectangleEdge", ".", "TOP", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "5.0", ",", "6.0", ")", ",", "RectangleEdge", ".", "LEFT", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "7.0", ",", "8.0", ")", ",", "RectangleEdge", ".", "RIGHT", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "9.0", ",", "10.0", ")", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "12.0", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "10.0", ",", "20.0", ")", ",", "RectangleEdge", ".", "TOP", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "12.3", ",", "45.6", ")", ",", "RectangleEdge", ".", "BOTTOM", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "65.6", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "21.0", ",", "12.3", ")", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "10.0", ",", "20.0", ")", ",", "RectangleEdge", ".", "TOP", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "12.3", ",", "45.6", ")", ",", "RectangleEdge", ".", "BOTTOM", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "77.9", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "21.0", ",", "12.3", ")", ",", "RectangleEdge", ".", "RIGHT", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "10.0", ",", "20.0", ")", ",", "RectangleEdge", ".", "TOP", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "12.3", ",", "45.6", ")", ",", "RectangleEdge", ".", "BOTTOM", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "77.9", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "1.0", ",", "2.0", ")", ",", "RectangleEdge", ".", "TOP", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "3.0", ",", "4.0", ")", ",", "RectangleEdge", ".", "BOTTOM", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "7.0", ",", "8.0", ")", ",", "RectangleEdge", ".", "RIGHT", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "9.0", ",", "10.0", ")", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "16.0", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "21.0", ",", "12.3", ")", ",", "RectangleEdge", ".", "LEFT", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "10.0", ",", "20.0", ")", ",", "RectangleEdge", ".", "TOP", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "12.3", ",", "45.6", ")", ",", "RectangleEdge", ".", "BOTTOM", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "77.9", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "1.0", ",", "2.0", ")", ",", "RectangleEdge", ".", "TOP", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "3.0", ",", "4.0", ")", ",", "RectangleEdge", ".", "BOTTOM", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "5.0", ",", "6.0", ")", ",", "RectangleEdge", ".", "LEFT", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "9.0", ",", "10.0", ")", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "16.0", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "1.0", ",", "2.0", ")", ",", "RectangleEdge", ".", "TOP", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "3.0", ",", "4.0", ")", ",", "RectangleEdge", ".", "BOTTOM", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "5.0", ",", "6.0", ")", ",", "RectangleEdge", ".", "LEFT", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "7.0", ",", "8.0", ")", ",", "RectangleEdge", ".", "RIGHT", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "14.0", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "1.0", ",", "2.0", ")", ",", "RectangleEdge", ".", "TOP", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "3.0", ",", "4.0", ")", ",", "RectangleEdge", ".", "BOTTOM", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "5.0", ",", "6.0", ")", ",", "RectangleEdge", ".", "LEFT", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "7.0", ",", "8.0", ")", ",", "RectangleEdge", ".", "RIGHT", ")", ";", "container", ".", "add", "(", "new", "EmptyBlock", "(", "9.0", ",", "10.0", ")", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "16.0", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "container", ".", "clear", "(", ")", ";", "size", "=", "container", ".", "arrange", "(", "g2", ",", "constraint", ")", ";", "assertEquals", "(", "10.0", ",", "size", ".", "width", ",", "EPSILON", ")", ";", "assertEquals", "(", "0.0", ",", "size", ".", "height", ",", "EPSILON", ")", ";", "}" ]
run some checks on sizing when there is a fixed width constraint .
train
false
69,235
public static short unsignedByteToShort(byte b){ if ((b & 0x80) == 0x80) return (short)(128 + (b & 0x7f)); else return (short)b; }
[ "public", "static", "short", "unsignedByteToShort", "(", "byte", "b", ")", "{", "if", "(", "(", "b", "&", "0x80", ")", "==", "0x80", ")", "return", "(", "short", ")", "(", "128", "+", "(", "b", "&", "0x7f", ")", ")", ";", "else", "return", "(", "short", ")", "b", ";", "}" ]
converts an unsigned byte to a short . by default , java assumes that a byte is signed .
train
false
69,236
public static boolean addReminder(Activity activity,View view,View.OnClickListener listener,ArrayList<LinearLayout> items,ArrayList<Integer> minuteValues,ArrayList<String> minuteLabels,ArrayList<Integer> methodValues,ArrayList<String> methodLabels,ReminderEntry newReminder,int maxReminders,OnItemSelectedListener onItemSelected){ if (items.size() >= maxReminders) { return false; } LayoutInflater inflater=activity.getLayoutInflater(); LinearLayout parent=(LinearLayout)view.findViewById(R.id.reminder_items_container); LinearLayout reminderItem=(LinearLayout)inflater.inflate(R.layout.edit_reminder_item,null); parent.addView(reminderItem); ImageButton reminderRemoveButton; reminderRemoveButton=(ImageButton)reminderItem.findViewById(R.id.reminder_remove); reminderRemoveButton.setOnClickListener(listener); Spinner spinner=(Spinner)reminderItem.findViewById(R.id.reminder_minutes_value); setReminderSpinnerLabels(activity,spinner,minuteLabels); int index=findMinutesInReminderList(minuteValues,newReminder.getMinutes()); spinner.setSelection(index); if (onItemSelected != null) { spinner.setTag(index); spinner.setOnItemSelectedListener(onItemSelected); } spinner=(Spinner)reminderItem.findViewById(R.id.reminder_method_value); setReminderSpinnerLabels(activity,spinner,methodLabels); index=findMethodInReminderList(methodValues,newReminder.getMethod()); spinner.setSelection(index); if (onItemSelected != null) { spinner.setTag(index); spinner.setOnItemSelectedListener(onItemSelected); } items.add(reminderItem); return true; }
[ "public", "static", "boolean", "addReminder", "(", "Activity", "activity", ",", "View", "view", ",", "View", ".", "OnClickListener", "listener", ",", "ArrayList", "<", "LinearLayout", ">", "items", ",", "ArrayList", "<", "Integer", ">", "minuteValues", ",", "ArrayList", "<", "String", ">", "minuteLabels", ",", "ArrayList", "<", "Integer", ">", "methodValues", ",", "ArrayList", "<", "String", ">", "methodLabels", ",", "ReminderEntry", "newReminder", ",", "int", "maxReminders", ",", "OnItemSelectedListener", "onItemSelected", ")", "{", "if", "(", "items", ".", "size", "(", ")", ">=", "maxReminders", ")", "{", "return", "false", ";", "}", "LayoutInflater", "inflater", "=", "activity", ".", "getLayoutInflater", "(", ")", ";", "LinearLayout", "parent", "=", "(", "LinearLayout", ")", "view", ".", "findViewById", "(", "R", ".", "id", ".", "reminder_items_container", ")", ";", "LinearLayout", "reminderItem", "=", "(", "LinearLayout", ")", "inflater", ".", "inflate", "(", "R", ".", "layout", ".", "edit_reminder_item", ",", "null", ")", ";", "parent", ".", "addView", "(", "reminderItem", ")", ";", "ImageButton", "reminderRemoveButton", ";", "reminderRemoveButton", "=", "(", "ImageButton", ")", "reminderItem", ".", "findViewById", "(", "R", ".", "id", ".", "reminder_remove", ")", ";", "reminderRemoveButton", ".", "setOnClickListener", "(", "listener", ")", ";", "Spinner", "spinner", "=", "(", "Spinner", ")", "reminderItem", ".", "findViewById", "(", "R", ".", "id", ".", "reminder_minutes_value", ")", ";", "setReminderSpinnerLabels", "(", "activity", ",", "spinner", ",", "minuteLabels", ")", ";", "int", "index", "=", "findMinutesInReminderList", "(", "minuteValues", ",", "newReminder", ".", "getMinutes", "(", ")", ")", ";", "spinner", ".", "setSelection", "(", "index", ")", ";", "if", "(", "onItemSelected", "!=", "null", ")", "{", "spinner", ".", "setTag", "(", "index", ")", ";", "spinner", ".", "setOnItemSelectedListener", "(", "onItemSelected", ")", ";", "}", "spinner", "=", "(", "Spinner", ")", "reminderItem", ".", "findViewById", "(", "R", ".", "id", ".", "reminder_method_value", ")", ";", "setReminderSpinnerLabels", "(", "activity", ",", "spinner", ",", "methodLabels", ")", ";", "index", "=", "findMethodInReminderList", "(", "methodValues", ",", "newReminder", ".", "getMethod", "(", ")", ")", ";", "spinner", ".", "setSelection", "(", "index", ")", ";", "if", "(", "onItemSelected", "!=", "null", ")", "{", "spinner", ".", "setTag", "(", "index", ")", ";", "spinner", ".", "setOnItemSelectedListener", "(", "onItemSelected", ")", ";", "}", "items", ".", "add", "(", "reminderItem", ")", ";", "return", "true", ";", "}" ]
adds a reminder to the displayed list of reminders . the values / labels arrays must not change after calling here , or the spinners we created might index into the wrong entry . returns true if successfully added reminder , false if no reminders can be added . onitemselected allows a listener to be set for any changes to the spinners in the reminder . if a listener is set it will store the initial position of the spinner into the spinner ' s tag for comparison with any new position setting .
train
false
69,241
private void renderAxes(Camera camera){ glPushMatrix(); glLoadIdentity(); float rotX=camera.getRotation().x; float rotY=camera.getRotation().y; float rotZ=0; glRotatef(rotX,1.0f,0.0f,0.0f); glRotatef(rotY,0.0f,1.0f,0.0f); glRotatef(rotZ,0.0f,0.0f,1.0f); glLineWidth(2.0f); glBegin(GL_LINES); glColor3f(1.0f,0.0f,0.0f); glVertex3f(0.0f,0.0f,0.0f); glVertex3f(1.0f,0.0f,0.0f); glColor3f(0.0f,1.0f,0.0f); glVertex3f(0.0f,0.0f,0.0f); glVertex3f(0.0f,1.0f,0.0f); glColor3f(1.0f,1.0f,1.0f); glVertex3f(0.0f,0.0f,0.0f); glVertex3f(0.0f,0.0f,1.0f); glEnd(); glPopMatrix(); }
[ "private", "void", "renderAxes", "(", "Camera", "camera", ")", "{", "glPushMatrix", "(", ")", ";", "glLoadIdentity", "(", ")", ";", "float", "rotX", "=", "camera", ".", "getRotation", "(", ")", ".", "x", ";", "float", "rotY", "=", "camera", ".", "getRotation", "(", ")", ".", "y", ";", "float", "rotZ", "=", "0", ";", "glRotatef", "(", "rotX", ",", "1.0f", ",", "0.0f", ",", "0.0f", ")", ";", "glRotatef", "(", "rotY", ",", "0.0f", ",", "1.0f", ",", "0.0f", ")", ";", "glRotatef", "(", "rotZ", ",", "0.0f", ",", "0.0f", ",", "1.0f", ")", ";", "glLineWidth", "(", "2.0f", ")", ";", "glBegin", "(", "GL_LINES", ")", ";", "glColor3f", "(", "1.0f", ",", "0.0f", ",", "0.0f", ")", ";", "glVertex3f", "(", "0.0f", ",", "0.0f", ",", "0.0f", ")", ";", "glVertex3f", "(", "1.0f", ",", "0.0f", ",", "0.0f", ")", ";", "glColor3f", "(", "0.0f", ",", "1.0f", ",", "0.0f", ")", ";", "glVertex3f", "(", "0.0f", ",", "0.0f", ",", "0.0f", ")", ";", "glVertex3f", "(", "0.0f", ",", "1.0f", ",", "0.0f", ")", ";", "glColor3f", "(", "1.0f", ",", "1.0f", ",", "1.0f", ")", ";", "glVertex3f", "(", "0.0f", ",", "0.0f", ",", "0.0f", ")", ";", "glVertex3f", "(", "0.0f", ",", "0.0f", ",", "1.0f", ")", ";", "glEnd", "(", ")", ";", "glPopMatrix", "(", ")", ";", "}" ]
renders the three axis in space ( for debugging purposes only
train
false
69,244
public S addChild(S node){ children.add(node); node.parent=Optional.of(this); return node; }
[ "public", "S", "addChild", "(", "S", "node", ")", "{", "children", ".", "add", "(", "node", ")", ";", "node", ".", "parent", "=", "Optional", ".", "of", "(", "this", ")", ";", "return", "node", ";", "}" ]
adds a childnode to the node
train
false
69,245
HeapArrayOfDoublesQuickSelectSketch(final int nomEntries,final int lgResizeFactor,final float samplingProbability,final int numValues,final long seed){ super(numValues,seed); nomEntries_=ceilingPowerOf2(nomEntries); lgResizeFactor_=lgResizeFactor; samplingProbability_=samplingProbability; theta_=(long)(Long.MAX_VALUE * (double)samplingProbability); final int startingCapacity=1 << startingSubMultiple(Integer.numberOfTrailingZeros(ceilingPowerOf2(nomEntries) * 2),ResizeFactor.getRF(lgResizeFactor),MIN_LG_ARR_LONGS); keys_=new long[startingCapacity]; values_=new double[startingCapacity * numValues]; lgCurrentCapacity_=Integer.numberOfTrailingZeros(startingCapacity); setRebuildThreshold(); }
[ "HeapArrayOfDoublesQuickSelectSketch", "(", "final", "int", "nomEntries", ",", "final", "int", "lgResizeFactor", ",", "final", "float", "samplingProbability", ",", "final", "int", "numValues", ",", "final", "long", "seed", ")", "{", "super", "(", "numValues", ",", "seed", ")", ";", "nomEntries_", "=", "ceilingPowerOf2", "(", "nomEntries", ")", ";", "lgResizeFactor_", "=", "lgResizeFactor", ";", "samplingProbability_", "=", "samplingProbability", ";", "theta_", "=", "(", "long", ")", "(", "Long", ".", "MAX_VALUE", "*", "(", "double", ")", "samplingProbability", ")", ";", "final", "int", "startingCapacity", "=", "1", "<<", "startingSubMultiple", "(", "Integer", ".", "numberOfTrailingZeros", "(", "ceilingPowerOf2", "(", "nomEntries", ")", "*", "2", ")", ",", "ResizeFactor", ".", "getRF", "(", "lgResizeFactor", ")", ",", "MIN_LG_ARR_LONGS", ")", ";", "keys_", "=", "new", "long", "[", "startingCapacity", "]", ";", "values_", "=", "new", "double", "[", "startingCapacity", "*", "numValues", "]", ";", "lgCurrentCapacity_", "=", "Integer", ".", "numberOfTrailingZeros", "(", "startingCapacity", ")", ";", "setRebuildThreshold", "(", ")", ";", "}" ]
this is to create an instance of a quickselectsketch with custom resize factor and sampling probability
train
false
69,246
protected AbstractIoSession(IoService service){ this.service=service; this.handler=service.getHandler(); long currentTime=System.currentTimeMillis(); creationTime=currentTime; lastThroughputCalculationTime=currentTime; lastReadTime=currentTime; lastWriteTime=currentTime; lastIdleTimeForBoth=currentTime; lastIdleTimeForRead=currentTime; lastIdleTimeForWrite=currentTime; closeFuture.addListener(SCHEDULED_COUNTER_RESETTER); sessionId=idGenerator.incrementAndGet(); }
[ "protected", "AbstractIoSession", "(", "IoService", "service", ")", "{", "this", ".", "service", "=", "service", ";", "this", ".", "handler", "=", "service", ".", "getHandler", "(", ")", ";", "long", "currentTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "creationTime", "=", "currentTime", ";", "lastThroughputCalculationTime", "=", "currentTime", ";", "lastReadTime", "=", "currentTime", ";", "lastWriteTime", "=", "currentTime", ";", "lastIdleTimeForBoth", "=", "currentTime", ";", "lastIdleTimeForRead", "=", "currentTime", ";", "lastIdleTimeForWrite", "=", "currentTime", ";", "closeFuture", ".", "addListener", "(", "SCHEDULED_COUNTER_RESETTER", ")", ";", "sessionId", "=", "idGenerator", ".", "incrementAndGet", "(", ")", ";", "}" ]
todo add method documentation
train
false
69,247
public static void createT_Selection(int AD_PInstance_ID,Collection<Integer> selection,String trxName){ StringBuffer insert=new StringBuffer(); insert.append("INSERT INTO T_SELECTION(AD_PINSTANCE_ID, T_SELECTION_ID) "); int counter=0; for ( Integer selectedId : selection) { counter++; if (counter > 1) insert.append(" UNION "); insert.append("SELECT "); insert.append(AD_PInstance_ID); insert.append(", "); insert.append(selectedId); insert.append(" FROM DUAL "); if (counter >= 1000) { DB.executeUpdateEx(insert.toString(),trxName); insert=new StringBuffer(); insert.append("INSERT INTO T_SELECTION(AD_PINSTANCE_ID, T_SELECTION_ID) "); counter=0; } } if (counter > 0) { DB.executeUpdateEx(insert.toString(),trxName); } }
[ "public", "static", "void", "createT_Selection", "(", "int", "AD_PInstance_ID", ",", "Collection", "<", "Integer", ">", "selection", ",", "String", "trxName", ")", "{", "StringBuffer", "insert", "=", "new", "StringBuffer", "(", ")", ";", "insert", ".", "append", "(", "\"INSERT INTO T_SELECTION(AD_PINSTANCE_ID, T_SELECTION_ID) \"", ")", ";", "int", "counter", "=", "0", ";", "for", "(", "Integer", "selectedId", ":", "selection", ")", "{", "counter", "++", ";", "if", "(", "counter", ">", "1", ")", "insert", ".", "append", "(", "\" UNION \"", ")", ";", "insert", ".", "append", "(", "\"SELECT \"", ")", ";", "insert", ".", "append", "(", "AD_PInstance_ID", ")", ";", "insert", ".", "append", "(", "\", \"", ")", ";", "insert", ".", "append", "(", "selectedId", ")", ";", "insert", ".", "append", "(", "\" FROM DUAL \"", ")", ";", "if", "(", "counter", ">=", "1000", ")", "{", "DB", ".", "executeUpdateEx", "(", "insert", ".", "toString", "(", ")", ",", "trxName", ")", ";", "insert", "=", "new", "StringBuffer", "(", ")", ";", "insert", ".", "append", "(", "\"INSERT INTO T_SELECTION(AD_PINSTANCE_ID, T_SELECTION_ID) \"", ")", ";", "counter", "=", "0", ";", "}", "}", "if", "(", "counter", ">", "0", ")", "{", "DB", ".", "executeUpdateEx", "(", "insert", ".", "toString", "(", ")", ",", "trxName", ")", ";", "}", "}" ]
create persistent selection in t_selection table
train
false
69,248
private static void validateAsyncLog() throws IOException { List<String> logFileLines=FileUtils.readLines(new File(AsyncDBTestUtil.getAsyncLogFilePath()),StandardCharsets.UTF_8); int expectedLineCount=3; if (expectedLineCount != logFileLines.size()) { throw new IntegrationTestFailedException("Async-log file should have " + expectedLineCount + "' lines, but has "+ logFileLines.size()+ " lines."); } int lineIndex=0; for ( String logFileLine : logFileLines) { String[] fields=logFileLine.split("" + AsyncLogWriter.FIELD_SEPARATOR); if (fields.length != AsyncDBTestUtil.LOG_FILE_FIELDS) { throw new IntegrationTestFailedException("Log file nr " + lineIndex + " has "+ fields.length+ " fields, but must have "+ AsyncDBTestUtil.LOG_FILE_FIELDS); } lineIndex++; } }
[ "private", "static", "void", "validateAsyncLog", "(", ")", "throws", "IOException", "{", "List", "<", "String", ">", "logFileLines", "=", "FileUtils", ".", "readLines", "(", "new", "File", "(", "AsyncDBTestUtil", ".", "getAsyncLogFilePath", "(", ")", ")", ",", "StandardCharsets", ".", "UTF_8", ")", ";", "int", "expectedLineCount", "=", "3", ";", "if", "(", "expectedLineCount", "!=", "logFileLines", ".", "size", "(", ")", ")", "{", "throw", "new", "IntegrationTestFailedException", "(", "\"Async-log file should have \"", "+", "expectedLineCount", "+", "\"' lines, but has \"", "+", "logFileLines", ".", "size", "(", ")", "+", "\" lines.\"", ")", ";", "}", "int", "lineIndex", "=", "0", ";", "for", "(", "String", "logFileLine", ":", "logFileLines", ")", "{", "String", "[", "]", "fields", "=", "logFileLine", ".", "split", "(", "\"\"", "+", "AsyncLogWriter", ".", "FIELD_SEPARATOR", ")", ";", "if", "(", "fields", ".", "length", "!=", "AsyncDBTestUtil", ".", "LOG_FILE_FIELDS", ")", "{", "throw", "new", "IntegrationTestFailedException", "(", "\"Log file nr \"", "+", "lineIndex", "+", "\" has \"", "+", "fields", ".", "length", "+", "\" fields, but must have \"", "+", "AsyncDBTestUtil", ".", "LOG_FILE_FIELDS", ")", ";", "}", "lineIndex", "++", ";", "}", "}" ]
checks only format correctness , logging more thoroughly tested in respective unit test .
train
false
69,250
public TomcatManager(URL url,String username,String password,String charset){ this.url=url; this.username=username; this.password=password; this.charset=charset; try { md5=MessageDigest.getInstance("md5"); } catch ( NoSuchAlgorithmException e) { throw new CargoException("Cannot get the MD5 digest for generating the Digest authentication headers",e); } }
[ "public", "TomcatManager", "(", "URL", "url", ",", "String", "username", ",", "String", "password", ",", "String", "charset", ")", "{", "this", ".", "url", "=", "url", ";", "this", ".", "username", "=", "username", ";", "this", ".", "password", "=", "password", ";", "this", ".", "charset", "=", "charset", ";", "try", "{", "md5", "=", "MessageDigest", ".", "getInstance", "(", "\"md5\"", ")", ";", "}", "catch", "(", "NoSuchAlgorithmException", "e", ")", "{", "throw", "new", "CargoException", "(", "\"Cannot get the MD5 digest for generating the Digest authentication headers\"", ",", "e", ")", ";", "}", "}" ]
creates a tomcat manager wrapper for the specified url , username , password and url encoding .
train
false
69,251
private int awaitDone(boolean timed,long nanos) throws InterruptedException { final long deadline=timed ? System.nanoTime() + nanos : 0L; WaitNode q=null; boolean queued=false; for (; ; ) { if (Thread.interrupted()) { removeWaiter(q); throw new InterruptedException(); } int s=state; if (s > COMPLETING) { if (q != null) q.thread=null; return s; } else if (s == COMPLETING) Thread.yield(); else if (q == null) q=new WaitNode(); else if (!queued) queued=UNSAFE.compareAndSwapObject(this,waitersOffset,q.next=waiters,q); else if (timed) { nanos=deadline - System.nanoTime(); if (nanos <= 0L) { removeWaiter(q); return state; } LockSupport.parkNanos(this,nanos); } else LockSupport.park(this); } }
[ "private", "int", "awaitDone", "(", "boolean", "timed", ",", "long", "nanos", ")", "throws", "InterruptedException", "{", "final", "long", "deadline", "=", "timed", "?", "System", ".", "nanoTime", "(", ")", "+", "nanos", ":", "0L", ";", "WaitNode", "q", "=", "null", ";", "boolean", "queued", "=", "false", ";", "for", "(", ";", ";", ")", "{", "if", "(", "Thread", ".", "interrupted", "(", ")", ")", "{", "removeWaiter", "(", "q", ")", ";", "throw", "new", "InterruptedException", "(", ")", ";", "}", "int", "s", "=", "state", ";", "if", "(", "s", ">", "COMPLETING", ")", "{", "if", "(", "q", "!=", "null", ")", "q", ".", "thread", "=", "null", ";", "return", "s", ";", "}", "else", "if", "(", "s", "==", "COMPLETING", ")", "Thread", ".", "yield", "(", ")", ";", "else", "if", "(", "q", "==", "null", ")", "q", "=", "new", "WaitNode", "(", ")", ";", "else", "if", "(", "!", "queued", ")", "queued", "=", "UNSAFE", ".", "compareAndSwapObject", "(", "this", ",", "waitersOffset", ",", "q", ".", "next", "=", "waiters", ",", "q", ")", ";", "else", "if", "(", "timed", ")", "{", "nanos", "=", "deadline", "-", "System", ".", "nanoTime", "(", ")", ";", "if", "(", "nanos", "<=", "0L", ")", "{", "removeWaiter", "(", "q", ")", ";", "return", "state", ";", "}", "LockSupport", ".", "parkNanos", "(", "this", ",", "nanos", ")", ";", "}", "else", "LockSupport", ".", "park", "(", "this", ")", ";", "}", "}" ]
awaits completion or aborts on interrupt or timeout .
train
false
69,252
private Set<OsmElement> findAppendableNodes(Way way){ Set<OsmElement> result=new HashSet<OsmElement>(); for ( Node node : way.getNodes()) { if (way.isEndNode(node)) result.add(node); } if (result.size() == 1) result.clear(); return result; }
[ "private", "Set", "<", "OsmElement", ">", "findAppendableNodes", "(", "Way", "way", ")", "{", "Set", "<", "OsmElement", ">", "result", "=", "new", "HashSet", "<", "OsmElement", ">", "(", ")", ";", "for", "(", "Node", "node", ":", "way", ".", "getNodes", "(", ")", ")", "{", "if", "(", "way", ".", "isEndNode", "(", "node", ")", ")", "result", ".", "add", "(", "node", ")", ";", "}", "if", "(", "result", ".", "size", "(", ")", "==", "1", ")", "result", ".", "clear", "(", ")", ";", "return", "result", ";", "}" ]
finds which nodes can be append targets .
train
false
69,253
protected void pushGlobalVars(int contextNode) throws TransformerException { XPathContext xctxt=m_xcontext; VariableStack vs=xctxt.getVarStack(); StylesheetRoot sr=getStylesheet(); Vector vars=sr.getVariablesAndParamsComposed(); int i=vars.size(); vs.link(i); while (--i >= 0) { ElemVariable v=(ElemVariable)vars.elementAt(i); XObject xobj=new XUnresolvedVariable(v,contextNode,this,vs.getStackFrame(),0,true); if (null == vs.elementAt(i)) vs.setGlobalVariable(i,xobj); } }
[ "protected", "void", "pushGlobalVars", "(", "int", "contextNode", ")", "throws", "TransformerException", "{", "XPathContext", "xctxt", "=", "m_xcontext", ";", "VariableStack", "vs", "=", "xctxt", ".", "getVarStack", "(", ")", ";", "StylesheetRoot", "sr", "=", "getStylesheet", "(", ")", ";", "Vector", "vars", "=", "sr", ".", "getVariablesAndParamsComposed", "(", ")", ";", "int", "i", "=", "vars", ".", "size", "(", ")", ";", "vs", ".", "link", "(", "i", ")", ";", "while", "(", "--", "i", ">=", "0", ")", "{", "ElemVariable", "v", "=", "(", "ElemVariable", ")", "vars", ".", "elementAt", "(", "i", ")", ";", "XObject", "xobj", "=", "new", "XUnresolvedVariable", "(", "v", ",", "contextNode", ",", "this", ",", "vs", ".", "getStackFrame", "(", ")", ",", "0", ",", "true", ")", ";", "if", "(", "null", "==", "vs", ".", "elementAt", "(", "i", ")", ")", "vs", ".", "setGlobalVariable", "(", "i", ",", "xobj", ")", ";", "}", "}" ]
internal - - push the global variables from the stylesheet onto the context ' s runtime variable stack . < p > if we encounter a variable that is already defined in the variable stack , we ignore it . this is because the second variable definition will be at a lower import precedence . presumably , global " variables at the same import precedence with the same name will have been caught during the recompose process . < p > however , if we encounter a parameter that is already defined in the variable stack , we need to see if this is a parameter whose value was supplied by a setparameter call . if so , we need to " receive " the one already in the stack , ignoring this one . if it is just an earlier xsl : param or xsl : variable definition , we ignore it using the same reasoning as explained above for the variable .
train
true
69,254
public void requestAfterExplanation(@NonNull String[] permissions){ ArrayList<String> permissionsToRequest=new ArrayList<>(); for ( String permissionName : permissions) { if (isPermissionDeclined(permissionName)) { permissionsToRequest.add(permissionName); } else { permissionCallback.onPermissionPreGranted(permissionName); } } if (permissionsToRequest.isEmpty()) return; permissions=permissionsToRequest.toArray(new String[permissionsToRequest.size()]); ActivityCompat.requestPermissions(context,permissions,REQUEST_PERMISSIONS); }
[ "public", "void", "requestAfterExplanation", "(", "@", "NonNull", "String", "[", "]", "permissions", ")", "{", "ArrayList", "<", "String", ">", "permissionsToRequest", "=", "new", "ArrayList", "<", ">", "(", ")", ";", "for", "(", "String", "permissionName", ":", "permissions", ")", "{", "if", "(", "isPermissionDeclined", "(", "permissionName", ")", ")", "{", "permissionsToRequest", ".", "add", "(", "permissionName", ")", ";", "}", "else", "{", "permissionCallback", ".", "onPermissionPreGranted", "(", "permissionName", ")", ";", "}", "}", "if", "(", "permissionsToRequest", ".", "isEmpty", "(", ")", ")", "return", ";", "permissions", "=", "permissionsToRequest", ".", "toArray", "(", "new", "String", "[", "permissionsToRequest", ".", "size", "(", ")", "]", ")", ";", "ActivityCompat", ".", "requestPermissions", "(", "context", ",", "permissions", ",", "REQUEST_PERMISSIONS", ")", ";", "}" ]
to be called when explanation is presented to the user
train
true
69,255
public static List<String> createWorkingSet(Generator generator,int size){ List<String> workingSet=newArrayListWithCapacity(size); for (int i=0; i < size; i++) { workingSet.add(generator.nextString()); } return workingSet; }
[ "public", "static", "List", "<", "String", ">", "createWorkingSet", "(", "Generator", "generator", ",", "int", "size", ")", "{", "List", "<", "String", ">", "workingSet", "=", "newArrayListWithCapacity", "(", "size", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "workingSet", ".", "add", "(", "generator", ".", "nextString", "(", ")", ")", ";", "}", "return", "workingSet", ";", "}" ]
creates a random working set based on the distribution .
train
false
69,257
public void copyResult(Value toCopy,String calleeSig,int newArgNum,ValueBox newVB){ hotspots.add(newVB); regexMap.put(newVB.getValue(),regexMap.get(toCopy)); nonterminals.put(newVB.getValue(),nonterminals.get(toCopy)); List<ValueBox> vbs=new LinkedList<ValueBox>(); vbs.add(newVB); addSignatureToHotspotMap(calleeSig,new Hotspot(calleeSig,newArgNum,hotspots)); }
[ "public", "void", "copyResult", "(", "Value", "toCopy", ",", "String", "calleeSig", ",", "int", "newArgNum", ",", "ValueBox", "newVB", ")", "{", "hotspots", ".", "add", "(", "newVB", ")", ";", "regexMap", ".", "put", "(", "newVB", ".", "getValue", "(", ")", ",", "regexMap", ".", "get", "(", "toCopy", ")", ")", ";", "nonterminals", ".", "put", "(", "newVB", ".", "getValue", "(", ")", ",", "nonterminals", ".", "get", "(", "toCopy", ")", ")", ";", "List", "<", "ValueBox", ">", "vbs", "=", "new", "LinkedList", "<", "ValueBox", ">", "(", ")", ";", "vbs", ".", "add", "(", "newVB", ")", ";", "addSignatureToHotspotMap", "(", "calleeSig", ",", "new", "Hotspot", "(", "calleeSig", ",", "newArgNum", ",", "hotspots", ")", ")", ";", "}" ]
another pass might need to add to the results for jsastrings . this method will clone an existing result to a new value box + hotspot .
train
false
69,259
private void dumpASCII(Utterance utterance){ if (waveDumpFile != null) { LPCResult lpcResult=(LPCResult)utterance.getObject("target_lpcres"); try { if (waveDumpFile.equals("-")) { lpcResult.dumpASCII(); } else { lpcResult.dumpASCII(waveDumpFile); } } catch ( IOException ioe) { error("Can't dump file to " + waveDumpFile + " "+ ioe); } } }
[ "private", "void", "dumpASCII", "(", "Utterance", "utterance", ")", "{", "if", "(", "waveDumpFile", "!=", "null", ")", "{", "LPCResult", "lpcResult", "=", "(", "LPCResult", ")", "utterance", ".", "getObject", "(", "\"target_lpcres\"", ")", ";", "try", "{", "if", "(", "waveDumpFile", ".", "equals", "(", "\"-\"", ")", ")", "{", "lpcResult", ".", "dumpASCII", "(", ")", ";", "}", "else", "{", "lpcResult", ".", "dumpASCII", "(", "waveDumpFile", ")", ";", "}", "}", "catch", "(", "IOException", "ioe", ")", "{", "error", "(", "\"Can't dump file to \"", "+", "waveDumpFile", "+", "\" \"", "+", "ioe", ")", ";", "}", "}", "}" ]
dumps the wave for the given utterance .
train
false
69,260
private void decodeArmorAndInternals(Mech mech,int loc,String s){ mech.initializeArmor(Integer.parseInt(s.substring(2,4)),loc); mech.initializeInternal(Integer.parseInt(s.substring(12)),loc); }
[ "private", "void", "decodeArmorAndInternals", "(", "Mech", "mech", ",", "int", "loc", ",", "String", "s", ")", "{", "mech", ".", "initializeArmor", "(", "Integer", ".", "parseInt", "(", "s", ".", "substring", "(", "2", ",", "4", ")", ")", ",", "loc", ")", ";", "mech", ".", "initializeInternal", "(", "Integer", ".", "parseInt", "(", "s", ".", "substring", "(", "12", ")", ")", ",", "loc", ")", ";", "}" ]
decodes and sets the mech ' s armor and internal structure values
train
false
69,261
private static void current(ClassLoader loader,InjectorImpl manager){ Objects.requireNonNull(manager); synchronized (loader) { if (loader instanceof DynamicClassLoader) { _localManager.set(manager,loader); } else { _loaderManagerMap.put(loader,new SoftReference<>(manager)); } } }
[ "private", "static", "void", "current", "(", "ClassLoader", "loader", ",", "InjectorImpl", "manager", ")", "{", "Objects", ".", "requireNonNull", "(", "manager", ")", ";", "synchronized", "(", "loader", ")", "{", "if", "(", "loader", "instanceof", "DynamicClassLoader", ")", "{", "_localManager", ".", "set", "(", "manager", ",", "loader", ")", ";", "}", "else", "{", "_loaderManagerMap", ".", "put", "(", "loader", ",", "new", "SoftReference", "<", ">", "(", "manager", ")", ")", ";", "}", "}", "}" ]
creates a new inject manager .
train
true
69,262
public static void saveNonvolatilesAroundSysCall(Instruction call,IR ir){ saveNonvolatilesBeforeSysCall(call,ir); restoreNonvolatilesAfterSysCall(call,ir); call.changeOperatorTo(IA32_CALL); }
[ "public", "static", "void", "saveNonvolatilesAroundSysCall", "(", "Instruction", "call", ",", "IR", "ir", ")", "{", "saveNonvolatilesBeforeSysCall", "(", "call", ",", "ir", ")", ";", "restoreNonvolatilesAfterSysCall", "(", "call", ",", "ir", ")", ";", "call", ".", "changeOperatorTo", "(", "IA32_CALL", ")", ";", "}" ]
save and restore all nonvolatile registers around a syscall . we do this in case the sys call does not respect our register conventions . < p > we save / restore all nonvolatiles and the pr , whether or not this routine uses them . this may be a tad inefficient , but if you ' re making a system call , you probably don ' t care . < p > side effect : changes the operator of the call instruction to ia32_call .
train
false
69,263
@Override public InetAddress addressRemote(){ if (_s != null) return _s.getInetAddress(); else return null; }
[ "@", "Override", "public", "InetAddress", "addressRemote", "(", ")", "{", "if", "(", "_s", "!=", "null", ")", "return", "_s", ".", "getInetAddress", "(", ")", ";", "else", "return", "null", ";", "}" ]
returns the remote client ' s inet address .
train
false