id_within_dataset
int64
0
69.7k
snippet
stringlengths
10
23k
tokens
listlengths
5
4.23k
nl
stringlengths
15
2.45k
split_within_dataset
stringclasses
1 value
is_duplicated
bool
2 classes
398
public static <M extends Message>String writeJsonStream(ImmutableList<M> messages){ ByteArrayOutputStream resultStream=new ByteArrayOutputStream(); MessageWriter<M> writer=MessageWriter.create(Output.forStream(new PrintStream(resultStream))); writer.writeAll(messages); return resultStream.toString(); }
[ "public", "static", "<", "M", "extends", "Message", ">", "String", "writeJsonStream", "(", "ImmutableList", "<", "M", ">", "messages", ")", "{", "ByteArrayOutputStream", "resultStream", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "MessageWriter", "<", "M...
returns the string representation of the stream of supplied messages . each individual message is represented as valid json , but not that the whole result is , itself , * not * valid json .
train
false
399
public org.smpte_ra.schemas.st2067_2_2016.ContentMaturityRatingType buildContentMaturityRatingType(String agency,String rating,org.smpte_ra.schemas.st2067_2_2016.ContentMaturityRatingType.Audience audience) throws URISyntaxException { org.smpte_ra.schemas.st2067_2_2016.ContentMaturityRatingType contentMaturityRatingT...
[ "public", "org", ".", "smpte_ra", ".", "schemas", ".", "st2067_2_2016", ".", "ContentMaturityRatingType", "buildContentMaturityRatingType", "(", "String", "agency", ",", "String", "rating", ",", "org", ".", "smpte_ra", ".", "schemas", ".", "st2067_2_2016", ".", "C...
a method to construct a contentmaturityratingtype conforming to the 2016 schema
train
false
401
private final double readDatum(final DataInput in,final ColumnType columnType) throws IOException { switch (columnType) { case DOUBLE: return in.readDouble(); case INTEGER: int iValue=in.readInt(); if (iValue == Integer.MIN_VALUE + 1) { boolean isMissing=in.readBoolean(); if (isMissing) { return Double.Na...
[ "private", "final", "double", "readDatum", "(", "final", "DataInput", "in", ",", "final", "ColumnType", "columnType", ")", "throws", "IOException", "{", "switch", "(", "columnType", ")", "{", "case", "DOUBLE", ":", "return", "in", ".", "readDouble", "(", ")"...
reads a single datum in non - sparse representation of the given type and returns it as a double .
train
false
403
public double op(final double x){ final double sn=Math.sin(this.asr * (-x + 1) * 0.5); return Math.exp((sn * hk - hs) / (1.0 - sn * sn)); }
[ "public", "double", "op", "(", "final", "double", "x", ")", "{", "final", "double", "sn", "=", "Math", ".", "sin", "(", "this", ".", "asr", "*", "(", "-", "x", "+", "1", ")", "*", "0.5", ")", ";", "return", "Math", ".", "exp", "(", "(", "sn",...
computes equation 3 , see references
train
false
404
public void listen(StanzaListener stanzaListener,StanzaFilter stanzaFilter){ connection.addAsyncStanzaListener(stanzaListener,stanzaFilter); logger.info("Listening for incoming XMPP Stanzas..."); }
[ "public", "void", "listen", "(", "StanzaListener", "stanzaListener", ",", "StanzaFilter", "stanzaFilter", ")", "{", "connection", ".", "addAsyncStanzaListener", "(", "stanzaListener", ",", "stanzaFilter", ")", ";", "logger", ".", "info", "(", "\"Listening for incoming...
begin listening for incoming messages .
train
false
405
public static void addInputMode(String name,Hashtable values,boolean firstUpcase){ initInputModes(); inputModes.put(name,values); if (firstUpcase) { firstUppercaseInputMode.addElement(name); } }
[ "public", "static", "void", "addInputMode", "(", "String", "name", ",", "Hashtable", "values", ",", "boolean", "firstUpcase", ")", "{", "initInputModes", "(", ")", ";", "inputModes", ".", "put", "(", "name", ",", "values", ")", ";", "if", "(", "firstUpcase...
adds a new inputmode hashtable with the given name and set of values
train
false
407
@Override public void addEnvVarUpdatedListener(EnvVarUpdateInterface listener){ if (!listenerList.contains(listener)) { listenerList.add(listener); } }
[ "@", "Override", "public", "void", "addEnvVarUpdatedListener", "(", "EnvVarUpdateInterface", "listener", ")", "{", "if", "(", "!", "listenerList", ".", "contains", "(", "listener", ")", ")", "{", "listenerList", ".", "add", "(", "listener", ")", ";", "}", "}...
adds the env var updated listener .
train
false
408
private void init(Configuration exp) throws IOException { isInitialized=true; }
[ "private", "void", "init", "(", "Configuration", "exp", ")", "throws", "IOException", "{", "isInitialized", "=", "true", ";", "}" ]
private initializer method that sets up the generic resources .
train
false
409
public List<LocalVariable> visibleVariables() throws AbsentInformationException { validateStackFrame(); createVisibleVariables(); List<LocalVariable> mapAsList=new ArrayList<LocalVariable>(visibleVariables.values()); Collections.sort(mapAsList); return mapAsList; }
[ "public", "List", "<", "LocalVariable", ">", "visibleVariables", "(", ")", "throws", "AbsentInformationException", "{", "validateStackFrame", "(", ")", ";", "createVisibleVariables", "(", ")", ";", "List", "<", "LocalVariable", ">", "mapAsList", "=", "new", "Array...
return the list of visible variable in the frame . need not be synchronized since it cannot be provably stale .
train
false
411
public static void startServices(ServiceHost host,Class... services) throws InstantiationException, IllegalAccessException { checkArgument(services != null,"services cannot be null"); for ( Class service : services) { startService(host,service); } }
[ "public", "static", "void", "startServices", "(", "ServiceHost", "host", ",", "Class", "...", "services", ")", "throws", "InstantiationException", ",", "IllegalAccessException", "{", "checkArgument", "(", "services", "!=", "null", ",", "\"services cannot be null\"", "...
starts the list of services on the host .
train
false
412
private AppliedMigration createAppliedMigration(int version,String description){ return new AppliedMigration(version,version,MigrationVersion.fromVersion(Integer.toString(version)),description,MigrationType.CQL,"x",null,new Date(),"sa",123,true); }
[ "private", "AppliedMigration", "createAppliedMigration", "(", "int", "version", ",", "String", "description", ")", "{", "return", "new", "AppliedMigration", "(", "version", ",", "version", ",", "MigrationVersion", ".", "fromVersion", "(", "Integer", ".", "toString",...
creates a new applied migration with this version .
train
false
413
TemplateEntry nextEntry(){ if (!hasNext()) { throw new NoSuchElementException(); } final TemplateEntry entry=nextEntry; nextEntry=null; return entry; }
[ "TemplateEntry", "nextEntry", "(", ")", "{", "if", "(", "!", "hasNext", "(", ")", ")", "{", "throw", "new", "NoSuchElementException", "(", ")", ";", "}", "final", "TemplateEntry", "entry", "=", "nextEntry", ";", "nextEntry", "=", "null", ";", "return", "...
returns the next generated entry .
train
false
415
public static double correlation(double[] x,double[] y){ if (x.length == y.length) { double mx=MathUtils.mean(x); double my=MathUtils.mean(y); double sx=Math.sqrt(MathUtils.variance(x)); double sy=Math.sqrt(MathUtils.variance(y)); int n=x.length; double nval=0.0; for (int i=0; i < n; i++) ...
[ "public", "static", "double", "correlation", "(", "double", "[", "]", "x", ",", "double", "[", "]", "y", ")", "{", "if", "(", "x", ".", "length", "==", "y", ".", "length", ")", "{", "double", "mx", "=", "MathUtils", ".", "mean", "(", "x", ")", ...
sample correlation coefficient ref : http : / / en . wikipedia . org / wiki / correlation_and_dependence
train
false
416
public static int writeMessageFully(Message msg,OutputStream out,ByteBuffer buf,MessageWriter writer) throws IOException { assert msg != null; assert out != null; assert buf != null; assert buf.hasArray(); if (writer != null) writer.setCurrentWriteClass(msg.getClass()); boolean finished=false; int cnt=0...
[ "public", "static", "int", "writeMessageFully", "(", "Message", "msg", ",", "OutputStream", "out", ",", "ByteBuffer", "buf", ",", "MessageWriter", "writer", ")", "throws", "IOException", "{", "assert", "msg", "!=", "null", ";", "assert", "out", "!=", "null", ...
fully writes communication message to provided stream .
train
false
418
protected final void dragExit(final int x,final int y){ DragSourceEvent event=new DragSourceEvent(getDragSourceContext(),x,y); EventDispatcher dispatcher=new EventDispatcher(DISPATCH_EXIT,event); SunToolkit.invokeLaterOnAppContext(SunToolkit.targetToAppContext(getComponent()),dispatcher); startSecondaryEventLoo...
[ "protected", "final", "void", "dragExit", "(", "final", "int", "x", ",", "final", "int", "y", ")", "{", "DragSourceEvent", "event", "=", "new", "DragSourceEvent", "(", "getDragSourceContext", "(", ")", ",", "x", ",", "y", ")", ";", "EventDispatcher", "disp...
upcall from native code
train
false
419
public static String generateRandomString(int count){ Random random=new Random(); StringBuffer buffer=new StringBuffer(); while (count-- != 0) { char ch=(char)(random.nextInt(96) + 32); buffer.append(ch); } return buffer.toString(); }
[ "public", "static", "String", "generateRandomString", "(", "int", "count", ")", "{", "Random", "random", "=", "new", "Random", "(", ")", ";", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "while", "(", "count", "--", "!=", "0", ")"...
generate a random string . this is used for password encryption .
train
false
420
public void decrement(){ int counterVal=counter.decrementAndGet(); if (counterVal == 0) { if (null != resourceCallback) { resourceCallback.onTransitionToIdle(); } becameIdleAt=SystemClock.uptimeMillis(); } if (debugCounting) { if (counterVal == 0) { Log.i(TAG,"Resource: " + resourceN...
[ "public", "void", "decrement", "(", ")", "{", "int", "counterVal", "=", "counter", ".", "decrementAndGet", "(", ")", ";", "if", "(", "counterVal", "==", "0", ")", "{", "if", "(", "null", "!=", "resourceCallback", ")", "{", "resourceCallback", ".", "onTra...
decrements the count of in - flight transactions to the resource being monitored . if this operation results in the counter falling below 0 - an exception is raised .
train
false
421
public void removeTestingCallback(OneSheeldTestingCallback testingCallback){ if (testingCallback != null && testingCallbacks.contains(testingCallback)) testingCallbacks.remove(testingCallback); }
[ "public", "void", "removeTestingCallback", "(", "OneSheeldTestingCallback", "testingCallback", ")", "{", "if", "(", "testingCallback", "!=", "null", "&&", "testingCallbacks", ".", "contains", "(", "testingCallback", ")", ")", "testingCallbacks", ".", "remove", "(", ...
remove a testing callback .
train
false
422
public boolean shouldDataBeRouted(SimpleRouterContext context,DataMetaData dataMetaData,Node node,boolean initialLoad,boolean initialLoadSelectUsed,TriggerRouter triggerRouter){ IDataRouter router=getDataRouter(dataMetaData.getRouter()); Set<Node> oneNodeSet=new HashSet<Node>(1); oneNodeSet.add(node); Collectio...
[ "public", "boolean", "shouldDataBeRouted", "(", "SimpleRouterContext", "context", ",", "DataMetaData", "dataMetaData", ",", "Node", "node", ",", "boolean", "initialLoad", ",", "boolean", "initialLoadSelectUsed", ",", "TriggerRouter", "triggerRouter", ")", "{", "IDataRou...
for use in data load events
train
false
424
@Override public Object put(Object key,Object value){ Entry tab[]=table; int hash=0; int index=0; if (key != null) { hash=System.identityHashCode(key); index=(hash & 0x7FFFFFFF) % tab.length; for (Entry e=tab[index]; e != null; e=e.next) { if ((e.hash == hash) && key == e.key) { Object...
[ "@", "Override", "public", "Object", "put", "(", "Object", "key", ",", "Object", "value", ")", "{", "Entry", "tab", "[", "]", "=", "table", ";", "int", "hash", "=", "0", ";", "int", "index", "=", "0", ";", "if", "(", "key", "!=", "null", ")", "...
associates the specified value with the specified key in this map . if the map previously contained a mapping for this key , the old value is replaced .
train
false
425
public static String backQuoteChars(String string,char[] find,String[] replace){ int index; StringBuilder newStr; int i; if (string == null) return string; for (i=0; i < find.length; i++) { if (string.indexOf(find[i]) != -1) { newStr=new StringBuilder(); while ((index=string.indexOf(find[i])...
[ "public", "static", "String", "backQuoteChars", "(", "String", "string", ",", "char", "[", "]", "find", ",", "String", "[", "]", "replace", ")", "{", "int", "index", ";", "StringBuilder", "newStr", ";", "int", "i", ";", "if", "(", "string", "==", "null...
converts specified characters into the string equivalents .
train
false
427
public void addLanguage(ExecutionLanguage language){ languages.add(1,language); }
[ "public", "void", "addLanguage", "(", "ExecutionLanguage", "language", ")", "{", "languages", ".", "add", "(", "1", ",", "language", ")", ";", "}" ]
registers a new executionlanguage to the registry .
train
false
428
private static boolean memberEquals(final Class<?> type,final Object o1,final Object o2){ if (o1 == o2) { return true; } if (o1 == null || o2 == null) { return false; } if (type.isArray()) { return arrayMemberEquals(type.getComponentType(),o1,o2); } if (type.isAnnotation()) { return equals...
[ "private", "static", "boolean", "memberEquals", "(", "final", "Class", "<", "?", ">", "type", ",", "final", "Object", "o1", ",", "final", "Object", "o2", ")", "{", "if", "(", "o1", "==", "o2", ")", "{", "return", "true", ";", "}", "if", "(", "o1", ...
helper method for checking whether two objects of the given type are equal . this method is used to compare the parameters of two annotation instances .
train
true
429
public Encoding(String name){ this.name=name; }
[ "public", "Encoding", "(", "String", "name", ")", "{", "this", ".", "name", "=", "name", ";", "}" ]
constructs a new encoding .
train
false
430
private String base64(String value){ StringBuffer cb=new StringBuffer(); int i=0; for (i=0; i + 2 < value.length(); i+=3) { long chunk=(int)value.charAt(i); chunk=(chunk << 8) + (int)value.charAt(i + 1); chunk=(chunk << 8) + (int)value.charAt(i + 2); cb.append(encode(chunk >> 18)); cb.append(e...
[ "private", "String", "base64", "(", "String", "value", ")", "{", "StringBuffer", "cb", "=", "new", "StringBuffer", "(", ")", ";", "int", "i", "=", "0", ";", "for", "(", "i", "=", "0", ";", "i", "+", "2", "<", "value", ".", "length", "(", ")", "...
creates the base64 value .
train
true
431
public String writeLongToString(){ StringBuilder builder=new StringBuilder(); for (int i=0; i < (bitSet.getBits().length); ++i) { builder.append(Long.toString(bitSet.getBits()[i]) + "|"); } return builder.toString(); }
[ "public", "String", "writeLongToString", "(", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "(", "bitSet", ".", "getBits", "(", ")", ".", "length", ")", ";", "++", ...
writes vector to a string of the form 010 etc . ( no delimiters ) . no terminating newline or delimiter .
train
false
432
@Override public void committed(long committedWindowId) throws IOException { LOG.debug("data manager committed {}",committedWindowId); for ( Long currentWindow : savedWindows.keySet()) { if (currentWindow <= largestWindowAddedToTransferQueue) { continue; } if (currentWindow <= committedWindowId) ...
[ "@", "Override", "public", "void", "committed", "(", "long", "committedWindowId", ")", "throws", "IOException", "{", "LOG", ".", "debug", "(", "\"data manager committed {}\"", ",", "committedWindowId", ")", ";", "for", "(", "Long", "currentWindow", ":", "savedWind...
transfers the data which has been committed till windowid to data files .
train
false
433
public void delete(RandomAccessFile raf,RandomAccessFile tempRaf) throws CannotReadException, CannotWriteException, IOException { raf.seek(0); tempRaf.seek(0); deleteTag(raf,tempRaf); }
[ "public", "void", "delete", "(", "RandomAccessFile", "raf", ",", "RandomAccessFile", "tempRaf", ")", "throws", "CannotReadException", ",", "CannotWriteException", ",", "IOException", "{", "raf", ".", "seek", "(", "0", ")", ";", "tempRaf", ".", "seek", "(", "0"...
delete the tag ( if any ) present in the given randomaccessfile , and do not close it at the end .
train
false
435
private byte[] pageToByteArray(P page){ try { if (page == null) { ByteArrayOutputStream baos=new ByteArrayOutputStream(); ObjectOutputStream oos=new ObjectOutputStream(baos); oos.writeInt(EMPTY_PAGE); oos.close(); baos.close(); byte[] array=baos.toByteArray(); byte[] resu...
[ "private", "byte", "[", "]", "pageToByteArray", "(", "P", "page", ")", "{", "try", "{", "if", "(", "page", "==", "null", ")", "{", "ByteArrayOutputStream", "baos", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "ObjectOutputStream", "oos", "=", "new",...
serializes an object into a byte array .
train
true
436
void presentDecorAnimations(int position,float offset){ int animMapSize=mDecorAnimations.size(); for (int i=0; i < animMapSize; i++) { Decor decor=mDecorAnimations.keyAt(i); ArrayList<Animation> animations=mDecorAnimations.get(decor); int animListSize=animations.size(); for (int j=0; j < animListSiz...
[ "void", "presentDecorAnimations", "(", "int", "position", ",", "float", "offset", ")", "{", "int", "animMapSize", "=", "mDecorAnimations", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "animMapSize", ";", "i", "++", ")", ...
run the animations based on the decor animations saved within the presenter and the offset of the scrolling .
train
false
437
public static boolean deltree(File directory){ if (directory == null || !directory.exists()) { return true; } boolean result=true; if (directory.isFile()) { result=directory.delete(); } else { File[] list=directory.listFiles(); for (int i=list.length; i-- > 0; ) { if (!deltree(list[i]))...
[ "public", "static", "boolean", "deltree", "(", "File", "directory", ")", "{", "if", "(", "directory", "==", "null", "||", "!", "directory", ".", "exists", "(", ")", ")", "{", "return", "true", ";", "}", "boolean", "result", "=", "true", ";", "if", "(...
deletes the given file and everything under it .
train
false
439
public void invalidate(long newFileSize){ if (newFileSize < fileSize) { fileSize=newFileSize; counters.clear(); blockSize=calcBlockSize(fileSize); } else if (newFileSize > fileSize) compact(newFileSize); }
[ "public", "void", "invalidate", "(", "long", "newFileSize", ")", "{", "if", "(", "newFileSize", "<", "fileSize", ")", "{", "fileSize", "=", "newFileSize", ";", "counters", ".", "clear", "(", ")", ";", "blockSize", "=", "calcBlockSize", "(", "fileSize", ")"...
check if counters and blocksize should be adjusted according to file size .
train
false
440
public void addCase(SwitchCase switchCase){ assertNotNull(switchCase); if (cases == null) { cases=new ArrayList<SwitchCase>(); } cases.add(switchCase); switchCase.setParent(this); }
[ "public", "void", "addCase", "(", "SwitchCase", "switchCase", ")", "{", "assertNotNull", "(", "switchCase", ")", ";", "if", "(", "cases", "==", "null", ")", "{", "cases", "=", "new", "ArrayList", "<", "SwitchCase", ">", "(", ")", ";", "}", "cases", "."...
adds a switch case statement to the end of the list .
train
true
442
public void test_atomicAppendFullBlock() throws IOException { final String id="test"; final int version=0; Random r=new Random(); final byte[] expected=new byte[BLOCK_SIZE]; r.nextBytes(expected); final long block0=repo.appendBlock(id,version,expected,0,expected.length); assertEquals("block#",0L,block0); ...
[ "public", "void", "test_atomicAppendFullBlock", "(", ")", "throws", "IOException", "{", "final", "String", "id", "=", "\"test\"", ";", "final", "int", "version", "=", "0", ";", "Random", "r", "=", "new", "Random", "(", ")", ";", "final", "byte", "[", "]"...
atomic append of a full block .
train
false
443
public static int hash(byte[] data,int offset,int length,int seed){ return hash(ByteBuffer.wrap(data,offset,length),seed); }
[ "public", "static", "int", "hash", "(", "byte", "[", "]", "data", ",", "int", "offset", ",", "int", "length", ",", "int", "seed", ")", "{", "return", "hash", "(", "ByteBuffer", ".", "wrap", "(", "data", ",", "offset", ",", "length", ")", ",", "seed...
hashes bytes in part of an array .
train
true
444
protected void layoutContainer(){ Rectangle inBounds=p.getBounds(); Insets insets=p.getInsets(); inBounds.x+=insets.left; inBounds.width-=insets.left; inBounds.width-=insets.right; inBounds.y+=insets.top; inBounds.height-=insets.top; inBounds.height-=insets.bottom; backgroundBounds=(Rectangle)inBounds...
[ "protected", "void", "layoutContainer", "(", ")", "{", "Rectangle", "inBounds", "=", "p", ".", "getBounds", "(", ")", ";", "Insets", "insets", "=", "p", ".", "getInsets", "(", ")", ";", "inBounds", ".", "x", "+=", "insets", ".", "left", ";", "inBounds"...
layout the entire container .
train
false
447
private void checkQopSupport(byte[] qopInChallenge,byte[] ciphersInChallenge) throws IOException { String qopOptions; if (qopInChallenge == null) { qopOptions="auth"; } else { qopOptions=new String(qopInChallenge,encoding); } String[] serverQopTokens=new String[3]; byte[] serverQop=parseQop(qopOpti...
[ "private", "void", "checkQopSupport", "(", "byte", "[", "]", "qopInChallenge", ",", "byte", "[", "]", "ciphersInChallenge", ")", "throws", "IOException", "{", "String", "qopOptions", ";", "if", "(", "qopInChallenge", "==", "null", ")", "{", "qopOptions", "=", ...
parses the ' qop ' directive . if ' auth - conf ' is specified by the client and offered as a qop option by the server , then a check is client - side supported ciphers is performed .
train
false
448
public void close(boolean pCloseUnderlying) throws IOException { if (closed) { return; } if (pCloseUnderlying) { closed=true; input.close(); } else { for (; ; ) { int av=available(); if (av == 0) { av=makeAvailable(); if (av == 0) { break; } }...
[ "public", "void", "close", "(", "boolean", "pCloseUnderlying", ")", "throws", "IOException", "{", "if", "(", "closed", ")", "{", "return", ";", "}", "if", "(", "pCloseUnderlying", ")", "{", "closed", "=", "true", ";", "input", ".", "close", "(", ")", "...
closes the input stream .
train
false
449
protected void addNewEvent(Object eventKey,T event){ if (unwrittenEvents == null) { unwrittenEvents=Maps.newHashMap(); } List<T> listEvents=unwrittenEvents.get(eventKey); if (listEvents == null) { unwrittenEvents.put(eventKey,Lists.newArrayList(event)); } else { listEvents.add(event); } }
[ "protected", "void", "addNewEvent", "(", "Object", "eventKey", ",", "T", "event", ")", "{", "if", "(", "unwrittenEvents", "==", "null", ")", "{", "unwrittenEvents", "=", "Maps", ".", "newHashMap", "(", ")", ";", "}", "List", "<", "T", ">", "listEvents", ...
add the given event into the unwritternevents map
train
false
450
public static Locale localeFromString(final String localeAsString){ if (StringUtils.isBlank(localeAsString)) { final List<ApiParameterError> dataValidationErrors=new ArrayList<>(); final ApiParameterError error=ApiParameterError.parameterError("validation.msg.invalid.locale.format","The parameter locale is in...
[ "public", "static", "Locale", "localeFromString", "(", "final", "String", "localeAsString", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "localeAsString", ")", ")", "{", "final", "List", "<", "ApiParameterError", ">", "dataValidationErrors", "=", "ne...
todo : vishwas move all locale related code to a separate utils class
train
false
451
protected Object decodeResponse(InputStream inputStream,String contentType) throws IOException { Object value; if (contentType.startsWith(JSON_MIME_TYPE)) { JSONDecoder decoder=new JSONDecoder(); value=decoder.readValue(inputStream); } else if (contentType.startsWith(TEXT_MIME_TYPE_PREFIX)) { TextD...
[ "protected", "Object", "decodeResponse", "(", "InputStream", "inputStream", ",", "String", "contentType", ")", "throws", "IOException", "{", "Object", "value", ";", "if", "(", "contentType", ".", "startsWith", "(", "JSON_MIME_TYPE", ")", ")", "{", "JSONDecoder", ...
decodes a response value .
train
false
452
protected static Pair<String,String> asrImmediate(final long offset,final ITranslationEnvironment environment,final List<ReilInstruction> instructions,final String registerNodeValue,final String immediateNodeValue){ long baseOffset=offset; final String shifterOperand=environment.getNextVariableString(); final Str...
[ "protected", "static", "Pair", "<", "String", ",", "String", ">", "asrImmediate", "(", "final", "long", "offset", ",", "final", "ITranslationEnvironment", "environment", ",", "final", "List", "<", "ReilInstruction", ">", "instructions", ",", "final", "String", "...
< rm > , asr # < shift_imm > operation : if shift_imm = = 0 then if rm [ 31 ] = = 0 then shifter_operand = 0 shifter_carry_out = rm [ 31 ] else / / rm [ 31 ] = = 1 / shifter_operand = 0xffffffff shifter_carry_out = rm [ 31 ] else / shift_imm > 0 / shifter_operand = rm arithmetic_shift_right < shift_imm > shifter_carry_...
train
false
454
public static void loadModule(final JTree tree,final INaviModule module){ Preconditions.checkNotNull(tree,"IE01195: Tree argument can not be null"); Preconditions.checkNotNull(module,"IE01196: Module argument can not be null"); loadModuleThreaded(SwingUtilities.getWindowAncestor(tree),module,tree); }
[ "public", "static", "void", "loadModule", "(", "final", "JTree", "tree", ",", "final", "INaviModule", "module", ")", "{", "Preconditions", ".", "checkNotNull", "(", "tree", ",", "\"IE01195: Tree argument can not be null\"", ")", ";", "Preconditions", ".", "checkNotN...
loads a module while showing a progress dialog .
train
false
456
public void addFunctionalInstrumentation(SpecialInstrumentationPoint functionalInstrumentation){ if (null == functionalInstrumentations) { functionalInstrumentations=new HashSet<SpecialInstrumentationPoint>(1); } functionalInstrumentations.add(functionalInstrumentation); }
[ "public", "void", "addFunctionalInstrumentation", "(", "SpecialInstrumentationPoint", "functionalInstrumentation", ")", "{", "if", "(", "null", "==", "functionalInstrumentations", ")", "{", "functionalInstrumentations", "=", "new", "HashSet", "<", "SpecialInstrumentationPoint...
adds functional instrumentation point .
train
false
457
public final List<Integer> executeIntListQuery(String sql) throws AdeException { return SpecialSqlQueries.executeIntListQuery(sql,m_connection); }
[ "public", "final", "List", "<", "Integer", ">", "executeIntListQuery", "(", "String", "sql", ")", "throws", "AdeException", "{", "return", "SpecialSqlQueries", ".", "executeIntListQuery", "(", "sql", ",", "m_connection", ")", ";", "}" ]
executes a query that is expected to returned a column of integers .
train
false
458
@ApiOperation(value="Uninstall SymmetricDS on the single engine") @RequestMapping(value="engine/uninstall",method=RequestMethod.POST) @ResponseStatus(HttpStatus.NO_CONTENT) @ResponseBody public final void postUninstall(){ uninstallImpl(getSymmetricEngine()); }
[ "@", "ApiOperation", "(", "value", "=", "\"Uninstall SymmetricDS on the single engine\"", ")", "@", "RequestMapping", "(", "value", "=", "\"engine/uninstall\"", ",", "method", "=", "RequestMethod", ".", "POST", ")", "@", "ResponseStatus", "(", "HttpStatus", ".", "NO...
uninstalls all symmetricds objects from the given node ( database ) for the single engine on the node
train
false
459
public boolean oneOutgoingTransitionLeavesCompositeWithExitActions(State state){ Set<State> sourceParentStates=new HashSet<State>(getParentStates(state)); for ( Transition transition : state.getOutgoingTransitions()) { Set<State> targetParentStates=getParentStates(transition.getTarget()); Set<State> crosse...
[ "public", "boolean", "oneOutgoingTransitionLeavesCompositeWithExitActions", "(", "State", "state", ")", "{", "Set", "<", "State", ">", "sourceParentStates", "=", "new", "HashSet", "<", "State", ">", "(", "getParentStates", "(", "state", ")", ")", ";", "for", "("...
checks if at least one of the outgoing transitions of the specified state leaves a parent composite of this state which has exit actions .
train
false
461
@Override public int read() throws IOException { int x=in.read(); if (x != -1) { check.update(x); } return x; }
[ "@", "Override", "public", "int", "read", "(", ")", "throws", "IOException", "{", "int", "x", "=", "in", ".", "read", "(", ")", ";", "if", "(", "x", "!=", "-", "1", ")", "{", "check", ".", "update", "(", "x", ")", ";", "}", "return", "x", ";"...
reads one byte of data from the underlying input stream and updates the checksum with the byte data .
train
false
462
public static boolean removeTable(Table t){ try { tableList.remove(t); } catch ( Exception e) { return false; } return true; }
[ "public", "static", "boolean", "removeTable", "(", "Table", "t", ")", "{", "try", "{", "tableList", ".", "remove", "(", "t", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
remove the a table .
train
false
464
public Plot add(String label,Population population,int x,int y){ List<Number> xs=new ArrayList<Number>(); List<Number> ys=new ArrayList<Number>(); for ( Solution solution : population) { if (!solution.violatesConstraints()) { xs.add(solution.getObjective(x)); ys.add(solution.getObjective(y)); ...
[ "public", "Plot", "add", "(", "String", "label", ",", "Population", "population", ",", "int", "x", ",", "int", "y", ")", "{", "List", "<", "Number", ">", "xs", "=", "new", "ArrayList", "<", "Number", ">", "(", ")", ";", "List", "<", "Number", ">", ...
displays the solutions in the given population in a 2d scatter plot . the two given objectives will be displayed .
train
false
467
public final boolean removeElement(int s){ for (int i=0; i < m_firstFree; i++) { if (m_map[i] == s) { if ((i + 1) < m_firstFree) System.arraycopy(m_map,i + 1,m_map,i - 1,m_firstFree - i); else m_map[i]=java.lang.Integer.MIN_VALUE; m_firstFree--; return true; } } return false...
[ "public", "final", "boolean", "removeElement", "(", "int", "s", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "m_firstFree", ";", "i", "++", ")", "{", "if", "(", "m_map", "[", "i", "]", "==", "s", ")", "{", "if", "(", "(", "i", ...
removes the first occurrence of the argument from this vector . if the object is found in this vector , each component in the vector with an index greater or equal to the object ' s index is shifted downward to have an index one smaller than the value it had previously .
train
true
468
public VNXeCommandJob restoreLunGroupSnap(String snapId,VNXeSnapRestoreParam restoreParam) throws VNXeException { StringBuilder urlBuilder=new StringBuilder(URL_INSTANCE); urlBuilder.append(snapId); urlBuilder.append(URL_RESTORE); _url=urlBuilder.toString(); return postRequestAsync(restoreParam); }
[ "public", "VNXeCommandJob", "restoreLunGroupSnap", "(", "String", "snapId", ",", "VNXeSnapRestoreParam", "restoreParam", ")", "throws", "VNXeException", "{", "StringBuilder", "urlBuilder", "=", "new", "StringBuilder", "(", "URL_INSTANCE", ")", ";", "urlBuilder", ".", ...
restore lun group snapshot
train
false
470
public HaskellCatalog(){ this(HaskellCatalog.XML_PATH); }
[ "public", "HaskellCatalog", "(", ")", "{", "this", "(", "HaskellCatalog", ".", "XML_PATH", ")", ";", "}" ]
constructs a haskell catalog using the default file location .
train
false
471
public ClassFactory(File dir,ClassLoader parent){ super(parent); this.output=dir; dir.mkdirs(); }
[ "public", "ClassFactory", "(", "File", "dir", ",", "ClassLoader", "parent", ")", "{", "super", "(", "parent", ")", ";", "this", ".", "output", "=", "dir", ";", "dir", ".", "mkdirs", "(", ")", ";", "}" ]
create a given class factory with the given class loader .
train
false
472
static boolean isSameColumn(ConstraintWidget a,ConstraintWidget b){ return Math.max(a.getX(),b.getX()) < Math.min(a.getX() + a.getWidth(),b.getX() + b.getWidth()); }
[ "static", "boolean", "isSameColumn", "(", "ConstraintWidget", "a", ",", "ConstraintWidget", "b", ")", "{", "return", "Math", ".", "max", "(", "a", ".", "getX", "(", ")", ",", "b", ".", "getX", "(", ")", ")", "<", "Math", ".", "min", "(", "a", ".", ...
are the two widgets in the same vertical area
train
false
473
Remover add(T listener);
[ "Remover", "add", "(", "T", "listener", ")", ";" ]
registers a new listener .
train
false
475
@SuppressWarnings("deprecation") protected void stopClassifier(){ if (m_RunThread != null) { m_RunThread.interrupt(); m_RunThread.stop(); } }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "protected", "void", "stopClassifier", "(", ")", "{", "if", "(", "m_RunThread", "!=", "null", ")", "{", "m_RunThread", ".", "interrupt", "(", ")", ";", "m_RunThread", ".", "stop", "(", ")", ";", "}", ...
stops the currently running classifier ( if any ) .
train
false
476
private void sleep(long sleeptime){ try { Thread.sleep(sleeptime); } catch ( InterruptedException e) { } }
[ "private", "void", "sleep", "(", "long", "sleeptime", ")", "{", "try", "{", "Thread", ".", "sleep", "(", "sleeptime", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "}", "}" ]
make the current thread sleep .
train
false
477
protected void buildPanels(){ keyPanels.clear(); inScrollPane.removeAll(); for ( String key : order) { String name=names.get(key); if (name != null) { String value=values.getProperty(key); KeyPanel keyPanel=new KeyPanel(name,value); keyPanel.setAlignmentX(LEFT_ALIGNMENT); keyPanel...
[ "protected", "void", "buildPanels", "(", ")", "{", "keyPanels", ".", "clear", "(", ")", ";", "inScrollPane", ".", "removeAll", "(", ")", ";", "for", "(", "String", "key", ":", "order", ")", "{", "String", "name", "=", "names", ".", "get", "(", "key",...
creates all key panels and special settings that have been registered .
train
false
478
public void loadDataStringFromFile(String sFilename,boolean clearCurrentData,String sEncoding){ try { ByteArrayOutputStream bsOut=new ByteArrayOutputStream(); FileInputStream fiIn=new FileInputStream(sFilename); int iData=0; while ((iData=fiIn.read()) > -1) bsOut.write(iData); String sDataStri...
[ "public", "void", "loadDataStringFromFile", "(", "String", "sFilename", ",", "boolean", "clearCurrentData", ",", "String", "sEncoding", ")", "{", "try", "{", "ByteArrayOutputStream", "bsOut", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "FileInputStream", "fi...
loads the contents of a file as the datastring .
train
false
479
public final char nextChar(CharSequence csq){ return csq.charAt(index++); }
[ "public", "final", "char", "nextChar", "(", "CharSequence", "csq", ")", "{", "return", "csq", ".", "charAt", "(", "index", "++", ")", ";", "}" ]
returns the next character at this cursor position . the cursor position is incremented by one .
train
false
480
private long dragStartedAgo(){ if (dragStarted == 0) { return -1; } return System.currentTimeMillis() - dragStarted; }
[ "private", "long", "dragStartedAgo", "(", ")", "{", "if", "(", "dragStarted", "==", "0", ")", "{", "return", "-", "1", ";", "}", "return", "System", ".", "currentTimeMillis", "(", ")", "-", "dragStarted", ";", "}" ]
returns the time in milliseconds how long ago the current drag started .
train
false
481
protected static double regularizedIncBetaCF(double alpha,double beta,double x){ final double FPMIN=Double.MIN_VALUE / NUM_PRECISION; double qab=alpha + beta; double qap=alpha + 1.0; double qam=alpha - 1.0; double c=1.0; double d=1.0 - qab * x / qap; if (Math.abs(d) < FPMIN) { d=FPMIN; } d=1.0 / d...
[ "protected", "static", "double", "regularizedIncBetaCF", "(", "double", "alpha", ",", "double", "beta", ",", "double", "x", ")", "{", "final", "double", "FPMIN", "=", "Double", ".", "MIN_VALUE", "/", "NUM_PRECISION", ";", "double", "qab", "=", "alpha", "+", ...
returns the regularized incomplete beta function i_x ( a , b ) includes the continued fraction way of computing , based on the book " numerical recipes " .
train
true
482
public DateTimeZoneBuilder addCutover(int year,char mode,int monthOfYear,int dayOfMonth,int dayOfWeek,boolean advanceDayOfWeek,int millisOfDay){ if (iRuleSets.size() > 0) { OfYear ofYear=new OfYear(mode,monthOfYear,dayOfMonth,dayOfWeek,advanceDayOfWeek,millisOfDay); RuleSet lastRuleSet=iRuleSets.get(iRuleSets...
[ "public", "DateTimeZoneBuilder", "addCutover", "(", "int", "year", ",", "char", "mode", ",", "int", "monthOfYear", ",", "int", "dayOfMonth", ",", "int", "dayOfWeek", ",", "boolean", "advanceDayOfWeek", ",", "int", "millisOfDay", ")", "{", "if", "(", "iRuleSets...
adds a cutover for added rules . the standard offset at the cutover defaults to 0 . call setstandardoffset afterwards to change it .
train
true
483
private boolean isNullSetting(boolean makeDest,MappingType mtd,MappingType mts,StringBuilder result){ if (makeDest && (mtd == ALL_FIELDS || mtd == ONLY_VALUED_FIELDS) && mts == ONLY_NULL_FIELDS) { result.append(" " + stringOfSetDestination + "(null);"+ newLine); return true; } return false; }
[ "private", "boolean", "isNullSetting", "(", "boolean", "makeDest", ",", "MappingType", "mtd", ",", "MappingType", "mts", ",", "StringBuilder", "result", ")", "{", "if", "(", "makeDest", "&&", "(", "mtd", "==", "ALL_FIELDS", "||", "mtd", "==", "ONLY_VALUED_FIEL...
if it is a null setting returns the null mapping
train
true
485
private boolean shouldEmitTypedefByName(JSType realType){ return realType.isRecordType() || realType.isTemplatizedType() || realType.isFunctionType(); }
[ "private", "boolean", "shouldEmitTypedefByName", "(", "JSType", "realType", ")", "{", "return", "realType", ".", "isRecordType", "(", ")", "||", "realType", ".", "isTemplatizedType", "(", ")", "||", "realType", ".", "isFunctionType", "(", ")", ";", "}" ]
whether the typedef should be emitted by name or by the type it is defining . because , we do not access the original type signature , the replacement is done for all references of the type ( through the typedef or direct ) . thus it is undesirable to always emit by name . for example :
train
false
486
private synchronized void manageMenu(){ if ((game != null) || (hasBoard && (null == client))) { fileGameNew.setEnabled(false); fileGameOpen.setEnabled(false); fileGameScenario.setEnabled(false); fileGameConnectBot.setEnabled(false); fileGameConnect.setEnabled(false); replacePlayer.setEnabled(f...
[ "private", "synchronized", "void", "manageMenu", "(", ")", "{", "if", "(", "(", "game", "!=", "null", ")", "||", "(", "hasBoard", "&&", "(", "null", "==", "client", ")", ")", ")", "{", "fileGameNew", ".", "setEnabled", "(", "false", ")", ";", "fileGa...
a helper function that will manage the enabled states of the items in this menu , based upon the object ' s current state .
train
false
489
public BigInteger calculateClientEvidenceMessage() throws CryptoException { if ((this.A == null) || (this.B == null) || (this.S == null)) { throw new CryptoException("Impossible to compute M1: " + "some data are missing from the previous operations (A,B,S)"); } this.M1=SRP6Util.calculateM1(digest,N,A,B,S); ...
[ "public", "BigInteger", "calculateClientEvidenceMessage", "(", ")", "throws", "CryptoException", "{", "if", "(", "(", "this", ".", "A", "==", "null", ")", "||", "(", "this", ".", "B", "==", "null", ")", "||", "(", "this", ".", "S", "==", "null", ")", ...
computes the client evidence message m1 using the previously received values . to be called after calculating the secret s .
train
false
491
private static Field findAccessibleField(Class clas,String fieldName) throws UtilEvalError, NoSuchFieldException { Field field; try { field=clas.getField(fieldName); ReflectManager.RMSetAccessible(field); return field; } catch ( NoSuchFieldException e) { } while (clas != null) { try { ...
[ "private", "static", "Field", "findAccessibleField", "(", "Class", "clas", ",", "String", "fieldName", ")", "throws", "UtilEvalError", ",", "NoSuchFieldException", "{", "Field", "field", ";", "try", "{", "field", "=", "clas", ".", "getField", "(", "fieldName", ...
used when accessibility capability is available to locate an occurrence of the field in the most derived class or superclass and set its accessibility flag . note that this method is not needed in the simple non accessible case because we don ' t have to hunt for fields . note that classes may declare overlapping priva...
train
false
492
public void removeArguments(String label){ List<PBArgument> remove=new ArrayList<>(); for ( PBArgument arg : l_arguments) { if (arg.isLabel(label)) remove.add(arg); } l_arguments.removeAll(remove); }
[ "public", "void", "removeArguments", "(", "String", "label", ")", "{", "List", "<", "PBArgument", ">", "remove", "=", "new", "ArrayList", "<", ">", "(", ")", ";", "for", "(", "PBArgument", "arg", ":", "l_arguments", ")", "{", "if", "(", "arg", ".", "...
removes all argument with the specific label .
train
false
493
public POSMikheevFeatureExtractor(String viewName,String json){ this.viewName=viewName; this.counter=POSMikheevCounter.read(json); }
[ "public", "POSMikheevFeatureExtractor", "(", "String", "viewName", ",", "String", "json", ")", "{", "this", ".", "viewName", "=", "viewName", ";", "this", ".", "counter", "=", "POSMikheevCounter", ".", "read", "(", "json", ")", ";", "}" ]
construct the feature extractor given a trained counter in json format .
train
false
494
public static boolean endsWithIgnoreCase(String src,String subS){ String sub=subS.toLowerCase(); int sublen=sub.length(); int j=0; int i=src.length() - sublen; if (i < 0) { return false; } while (j < sublen) { char source=Character.toLowerCase(src.charAt(i)); if (sub.charAt(j) != source) { ...
[ "public", "static", "boolean", "endsWithIgnoreCase", "(", "String", "src", ",", "String", "subS", ")", "{", "String", "sub", "=", "subS", ".", "toLowerCase", "(", ")", ";", "int", "sublen", "=", "sub", ".", "length", "(", ")", ";", "int", "j", "=", "...
tests if this string ends with the specified suffix .
train
true
497
@Nullable protected abstract Object extractParameter(@Nullable String cacheName,String typeName,TypeKind typeKind,String fieldName,Object obj) throws CacheException ;
[ "@", "Nullable", "protected", "abstract", "Object", "extractParameter", "(", "@", "Nullable", "String", "cacheName", ",", "String", "typeName", ",", "TypeKind", "typeKind", ",", "String", "fieldName", ",", "Object", "obj", ")", "throws", "CacheException", ";" ]
get field value from object for use as query parameter .
train
false
499
static OCSPResponse check(List<CertId> certIds,URI responderURI,X509Certificate issuerCert,X509Certificate responderCert,Date date,List<Extension> extensions) throws IOException, CertPathValidatorException { byte[] bytes=null; OCSPRequest request=null; try { request=new OCSPRequest(certIds,extensions); by...
[ "static", "OCSPResponse", "check", "(", "List", "<", "CertId", ">", "certIds", ",", "URI", "responderURI", ",", "X509Certificate", "issuerCert", ",", "X509Certificate", "responderCert", ",", "Date", "date", ",", "List", "<", "Extension", ">", "extensions", ")", ...
checks the revocation status of a list of certificates using ocsp .
train
true
500
@Override public void reset() throws IOException { fInputStream.reset(); }
[ "@", "Override", "public", "void", "reset", "(", ")", "throws", "IOException", "{", "fInputStream", ".", "reset", "(", ")", ";", "}" ]
reset the stream . if the stream has been marked , then attempt to reposition it at the mark . if the stream has not been marked , then attempt to reset it in some way appropriate to the particular stream , for example by repositioning it to its starting point . not all character - input streams support the reset ( ) o...
train
false
502
public LongStreamEx prepend(LongStream other){ return new LongStreamEx(LongStream.concat(other,stream()),context.combine(other)); }
[ "public", "LongStreamEx", "prepend", "(", "LongStream", "other", ")", "{", "return", "new", "LongStreamEx", "(", "LongStream", ".", "concat", "(", "other", ",", "stream", "(", ")", ")", ",", "context", ".", "combine", "(", "other", ")", ")", ";", "}" ]
creates a lazily concatenated stream whose elements are all the elements of the other stream followed by all the elements of this stream . the resulting stream is ordered if both of the input streams are ordered , and parallel if either of the input streams is parallel . when the resulting stream is closed , the close ...
train
true
503
public void disconnect(){ connected=false; synchronized (connLostWait) { connLostWait.notify(); } if (mqtt != null) { try { mqtt.disconnect(); } catch ( Exception ex) { setTitleText("MQTT disconnect error !"); ex.printStackTrace(); System.exit(1); } } if (led.isFlas...
[ "public", "void", "disconnect", "(", ")", "{", "connected", "=", "false", ";", "synchronized", "(", "connLostWait", ")", "{", "connLostWait", ".", "notify", "(", ")", ";", "}", "if", "(", "mqtt", "!=", "null", ")", "{", "try", "{", "mqtt", ".", "disc...
a wrapper for the mqtt disconnect method . as well as disconnecting the protocol this method enables / disables buttons as appropriate when in disconnected state . it also sets the correct colour of the indicator led .
train
false
505
private void checkPermissions(){ SecurityManager sm=System.getSecurityManager(); if (sm != null) { Enumeration<Permission> enum_=permissions.elements(); while (enum_.hasMoreElements()) { sm.checkPermission(enum_.nextElement()); } } }
[ "private", "void", "checkPermissions", "(", ")", "{", "SecurityManager", "sm", "=", "System", ".", "getSecurityManager", "(", ")", ";", "if", "(", "sm", "!=", "null", ")", "{", "Enumeration", "<", "Permission", ">", "enum_", "=", "permissions", ".", "eleme...
check that the current access control context has all of the permissions necessary to load classes from this loader .
train
false
506
public SpanManager delete(int start,int end){ sb.delete(start,end); adjustLists(start,start - end); if (calculateSrcPositions) for (int i=0; i < end - start; i++) ib.remove(start); return this; }
[ "public", "SpanManager", "delete", "(", "int", "start", ",", "int", "end", ")", "{", "sb", ".", "delete", "(", "start", ",", "end", ")", ";", "adjustLists", "(", "start", ",", "start", "-", "end", ")", ";", "if", "(", "calculateSrcPositions", ")", "f...
deletes the content between start ( included ) and end ( excluded ) .
train
true
507
@OnError public void onError(Session session,Throwable t){ callInternal("onError",session,t.getMessage()); logger.error(t.getMessage(),t); }
[ "@", "OnError", "public", "void", "onError", "(", "Session", "session", ",", "Throwable", "t", ")", "{", "callInternal", "(", "\"onError\"", ",", "session", ",", "t", ".", "getMessage", "(", ")", ")", ";", "logger", ".", "error", "(", "t", ".", "getMes...
on error raised handler
train
false
508
public void removeStrategy(final WeightingStrategy strategy){ strategies_.remove(strategy); }
[ "public", "void", "removeStrategy", "(", "final", "WeightingStrategy", "strategy", ")", "{", "strategies_", ".", "remove", "(", "strategy", ")", ";", "}" ]
removes the strategy from the weighting strategies collection .
train
false
509
public static GeneralPath cardinalSpline(GeneralPath p,float pts[],int start,int npoints,float slack,boolean closed,float tx,float ty){ try { int len=2 * npoints; int end=start + len; if (len < 6) { throw new IllegalArgumentException("To create spline requires at least 3 points"); } float dx...
[ "public", "static", "GeneralPath", "cardinalSpline", "(", "GeneralPath", "p", ",", "float", "pts", "[", "]", ",", "int", "start", ",", "int", "npoints", ",", "float", "slack", ",", "boolean", "closed", ",", "float", "tx", ",", "float", "ty", ")", "{", ...
compute a cardinal spline , a series of cubic bezier splines smoothly connecting a set of points . cardinal splines maintain c ( 1 ) continuity , ensuring the connected spline segments form a differentiable curve , ensuring at least a minimum level of smoothness .
train
false
510
public WildcardFileFilter(String[] wildcards,IOCase caseSensitivity){ if (wildcards == null) { throw new IllegalArgumentException("The wildcard array must not be null"); } this.wildcards=new String[wildcards.length]; System.arraycopy(wildcards,0,this.wildcards,0,wildcards.length); this.caseSensitivity=cas...
[ "public", "WildcardFileFilter", "(", "String", "[", "]", "wildcards", ",", "IOCase", "caseSensitivity", ")", "{", "if", "(", "wildcards", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The wildcard array must not be null\"", ")", ";", ...
construct a new wildcard filter for an array of wildcards specifying case - sensitivity . < p > the array is not cloned , so could be changed after constructing the instance . this would be inadvisable however .
train
false
512
public byte[] decode(String s){ byte[] b=new byte[(s.length() / 4) * 3]; int cycle=0; int combined=0; int j=0; int len=s.length(); int dummies=0; for (int i=0; i < len; i++) { int c=s.charAt(i); int value=(c <= 255) ? charToValue[c] : IGNORE; switch (value) { case IGNORE: break; case PAD: ...
[ "public", "byte", "[", "]", "decode", "(", "String", "s", ")", "{", "byte", "[", "]", "b", "=", "new", "byte", "[", "(", "s", ".", "length", "(", ")", "/", "4", ")", "*", "3", "]", ";", "int", "cycle", "=", "0", ";", "int", "combined", "=",...
decode a well - formed complete base64 string back into an array of bytes . it must have an even multiple of 4 data characters ( not counting \ n ) , padded out with = as needed .
train
false
513
protected void initializeConnection(MQTTClientProvider provider) throws Exception { if (!isUseSSL()) { provider.connect("tcp://localhost:" + port); } else { SSLContext ctx=SSLContext.getInstance("TLS"); ctx.init(new KeyManager[0],new TrustManager[]{new DefaultTrustManager()},new SecureRandom()); pr...
[ "protected", "void", "initializeConnection", "(", "MQTTClientProvider", "provider", ")", "throws", "Exception", "{", "if", "(", "!", "isUseSSL", "(", ")", ")", "{", "provider", ".", "connect", "(", "\"tcp://localhost:\"", "+", "port", ")", ";", "}", "else", ...
initialize an mqttclientprovider instance . by default this method uses the port that ' s assigned to be the tcp based port using the base version of addmqttconnector . a subclass can either change the value of port or override this method to assign the correct port .
train
false
515
public int versionPointNumber(){ return Integer.valueOf(properties.getProperty("version.point")); }
[ "public", "int", "versionPointNumber", "(", ")", "{", "return", "Integer", ".", "valueOf", "(", "properties", ".", "getProperty", "(", "\"version.point\"", ")", ")", ";", "}" ]
returns the point version number for the directory server .
train
false
516
private String[] splitSeparator(String sep,String s){ Vector v=new Vector(); int tokenStart=0; int tokenEnd=0; while ((tokenEnd=s.indexOf(sep,tokenStart)) != -1) { v.addElement(s.substring(tokenStart,tokenEnd)); tokenStart=tokenEnd + 1; } v.addElement(s.substring(tokenStart)); String[] retVal=new ...
[ "private", "String", "[", "]", "splitSeparator", "(", "String", "sep", ",", "String", "s", ")", "{", "Vector", "v", "=", "new", "Vector", "(", ")", ";", "int", "tokenStart", "=", "0", ";", "int", "tokenEnd", "=", "0", ";", "while", "(", "(", "token...
split a string based on the presence of a specified separator . returns an array of arbitrary length . the end of each element in the array is indicated by the separator of the end of the string . if there is a separator immediately before the end of the string , the final element will be empty . none of the strings wi...
train
false
517
static boolean advanceToFirstFont(AttributedCharacterIterator aci){ for (char ch=aci.first(); ch != CharacterIterator.DONE; ch=aci.setIndex(aci.getRunLimit())) { if (aci.getAttribute(TextAttribute.CHAR_REPLACEMENT) == null) { return true; } } return false; }
[ "static", "boolean", "advanceToFirstFont", "(", "AttributedCharacterIterator", "aci", ")", "{", "for", "(", "char", "ch", "=", "aci", ".", "first", "(", ")", ";", "ch", "!=", "CharacterIterator", ".", "DONE", ";", "ch", "=", "aci", ".", "setIndex", "(", ...
when this returns , the aci ' s current position will be at the start of the first run which does not contain a graphicattribute . if no such run exists the aci ' s position will be at the end , and this method will return false .
train
false
518
private static int count(String pattern,String[] possibleValues){ int count=0; for ( String r : possibleValues) { if (pattern.contains(r)) { count++; } } return count; }
[ "private", "static", "int", "count", "(", "String", "pattern", ",", "String", "[", "]", "possibleValues", ")", "{", "int", "count", "=", "0", ";", "for", "(", "String", "r", ":", "possibleValues", ")", "{", "if", "(", "pattern", ".", "contains", "(", ...
count the amount of renamer tokens per group
train
false
520
public static Module load(int id){ return modules.get(id); }
[ "public", "static", "Module", "load", "(", "int", "id", ")", "{", "return", "modules", ".", "get", "(", "id", ")", ";", "}" ]
load the module by id
train
false
521
public Future<Void> updateTableEntityAsync(TableEntity tableEntity,boolean commit){ updateTableEntity(tableEntity,commit); return new AsyncResult<Void>(null); }
[ "public", "Future", "<", "Void", ">", "updateTableEntityAsync", "(", "TableEntity", "tableEntity", ",", "boolean", "commit", ")", "{", "updateTableEntity", "(", "tableEntity", ",", "commit", ")", ";", "return", "new", "AsyncResult", "<", "Void", ">", "(", "nul...
updates the solr document for the given table entity asynchronly
train
false
522
boolean hasNextSFeature(){ return (sFeatureIdx < sFeatures.size()); }
[ "boolean", "hasNextSFeature", "(", ")", "{", "return", "(", "sFeatureIdx", "<", "sFeatures", ".", "size", "(", ")", ")", ";", "}" ]
checks for next s feature .
train
false
524
private boolean processSingleEvent(){ if (eventBuffer.remaining() < 20) { return false; } try { eventBuffer.getInt(); final int bufferLength=eventBuffer.getInt(); final int padding=(4 - bufferLength) & 3; if (eventBuffer.remaining() < bufferLength + padding + 12) return false; final by...
[ "private", "boolean", "processSingleEvent", "(", ")", "{", "if", "(", "eventBuffer", ".", "remaining", "(", ")", "<", "20", ")", "{", "return", "false", ";", "}", "try", "{", "eventBuffer", ".", "getInt", "(", ")", ";", "final", "int", "bufferLength", ...
processes the event buffer for a single event .
train
false
525
@Override public String toString(){ return name; }
[ "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "name", ";", "}" ]
the string representation of this object .
train
false
526
public static <T>GitNoteWriter<T> createNoteWriter(String reviewCommitHash,final Repository db,PersonIdent author,String ref){ return new GitNoteWriter<T>(reviewCommitHash,db,ref,author); }
[ "public", "static", "<", "T", ">", "GitNoteWriter", "<", "T", ">", "createNoteWriter", "(", "String", "reviewCommitHash", ",", "final", "Repository", "db", ",", "PersonIdent", "author", ",", "String", "ref", ")", "{", "return", "new", "GitNoteWriter", "<", "...
creates a writer to write comments to a given review .
train
false
527
private Element toElement(ScheduleTask task){ Element el=doc.createElement("task"); setAttributes(el,task); return el; }
[ "private", "Element", "toElement", "(", "ScheduleTask", "task", ")", "{", "Element", "el", "=", "doc", ".", "createElement", "(", "\"task\"", ")", ";", "setAttributes", "(", "el", ",", "task", ")", ";", "return", "el", ";", "}" ]
translate a schedule task object to a xml element
train
true
528
public static int intHash(String ipString){ int val=0; String[] strs=ipString.split("[^\\p{XDigit}]"); int len=strs.length; if (len >= 4) { val=intVal(strs[0]); val<<=8; val|=intVal(strs[1]); val<<=8; val|=intVal(strs[2]); val<<=8; val|=intVal(strs[3]); } return val; }
[ "public", "static", "int", "intHash", "(", "String", "ipString", ")", "{", "int", "val", "=", "0", ";", "String", "[", "]", "strs", "=", "ipString", ".", "split", "(", "\"[^\\\\p{XDigit}]\"", ")", ";", "int", "len", "=", "strs", ".", "length", ";", "...
this should be suitable for ipv6 as well but we will have to accommodate for the extra bytes later . expects four integers 0 - 255 separated by some non - numeric character .
train
false
529
public FluentJdbcBuilder connectionProvider(ConnectionProvider connectionProvider){ checkNotNull(connectionProvider,"connectionProvider"); this.connectionProvider=Optional.of(connectionProvider); return this; }
[ "public", "FluentJdbcBuilder", "connectionProvider", "(", "ConnectionProvider", "connectionProvider", ")", "{", "checkNotNull", "(", "connectionProvider", ",", "\"connectionProvider\"", ")", ";", "this", ".", "connectionProvider", "=", "Optional", ".", "of", "(", "conne...
sets the connectionprovider for fluentjdbc . queries created by fluentjdbc . query ( ) will use connections returned by this provider
train
false
530
public static void register(String modelName,IWindModel model,int awesomeness){ models.put(modelName,model); if (modelName.equalsIgnoreCase(userModelChoice)) { awesomeness=Integer.MAX_VALUE; } if (awesomeness > best) { best=awesomeness; activeModel=model; } }
[ "public", "static", "void", "register", "(", "String", "modelName", ",", "IWindModel", "model", ",", "int", "awesomeness", ")", "{", "models", ".", "put", "(", "modelName", ",", "model", ")", ";", "if", "(", "modelName", ".", "equalsIgnoreCase", "(", "user...
registers a wind model . might change activemodel , but of course this should be done during load time .
train
false
531
public void notifyTransactionTerminated(CompositeTransaction ct){ boolean notifyOfTerminatedEvent=false; synchronized (this) { boolean alreadyTerminated=isTerminated(); Iterator<TransactionContext> it=allContexts.iterator(); while (it.hasNext()) { TransactionContext b=it.next(); b.transactionT...
[ "public", "void", "notifyTransactionTerminated", "(", "CompositeTransaction", "ct", ")", "{", "boolean", "notifyOfTerminatedEvent", "=", "false", ";", "synchronized", "(", "this", ")", "{", "boolean", "alreadyTerminated", "=", "isTerminated", "(", ")", ";", "Iterato...
notifies the session that the transaction was terminated .
train
false