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
259
@Bean public SpringProcessEngineConfiguration activitiProcessEngineConfiguration(AsyncExecutor activitiAsyncExecutor){ SpringProcessEngineConfiguration configuration=new SpringProcessEngineConfiguration(); configuration.setDataSource(herdDataSource); configuration.setTransactionManager(herdTransactionManager); ...
[ "@", "Bean", "public", "SpringProcessEngineConfiguration", "activitiProcessEngineConfiguration", "(", "AsyncExecutor", "activitiAsyncExecutor", ")", "{", "SpringProcessEngineConfiguration", "configuration", "=", "new", "SpringProcessEngineConfiguration", "(", ")", ";", "configura...
gets the activiti process engine configuration .
train
false
260
protected <T>void runTasksConcurrent(final List<AbstractTask<T>> tasks) throws InterruptedException { assert resourceManager.overflowTasksConcurrent >= 0; try { final List<Future<T>> futures=resourceManager.getConcurrencyManager().invokeAll(tasks,resourceManager.overflowTimeout,TimeUnit.MILLISECONDS); final...
[ "protected", "<", "T", ">", "void", "runTasksConcurrent", "(", "final", "List", "<", "AbstractTask", "<", "T", ">", ">", "tasks", ")", "throws", "InterruptedException", "{", "assert", "resourceManager", ".", "overflowTasksConcurrent", ">=", "0", ";", "try", "{...
runs the overflow tasks in parallel , cancelling any tasks which have not completed if we run out of time . a dedicated thread pool is allocated for this purpose . depending on the configuration , it will be either a cached thread pool ( full parallelism ) or a fixed thread pool ( limited parallelism ) .
train
false
261
public void initComponents(){ setTitle(Bundle.getMessage("WindowTitle")); Container contentPane=getContentPane(); contentPane.setLayout(new BoxLayout(contentPane,BoxLayout.Y_AXIS)); contentPane.add(initAddressPanel()); contentPane.add(initNotesPanel()); contentPane.add(initButtonPanel()); pack(); }
[ "public", "void", "initComponents", "(", ")", "{", "setTitle", "(", "Bundle", ".", "getMessage", "(", "\"WindowTitle\"", ")", ")", ";", "Container", "contentPane", "=", "getContentPane", "(", ")", ";", "contentPane", ".", "setLayout", "(", "new", "BoxLayout", ...
initialize the config window
train
false
262
public void makeImmutable(){ if (isMutable) { isMutable=false; } }
[ "public", "void", "makeImmutable", "(", ")", "{", "if", "(", "isMutable", ")", "{", "isMutable", "=", "false", ";", "}", "}" ]
makes this object immutable .
train
false
265
private final int tradeBonus(Position pos){ final int wM=pos.wMtrl; final int bM=pos.bMtrl; final int wPawn=pos.wMtrlPawns; final int bPawn=pos.bMtrlPawns; final int deltaScore=wM - bM; int pBonus=0; pBonus+=interpolate((deltaScore > 0) ? wPawn : bPawn,0,-30 * deltaScore / 100,6 * pV,0); pBonus+=interpo...
[ "private", "final", "int", "tradeBonus", "(", "Position", "pos", ")", "{", "final", "int", "wM", "=", "pos", ".", "wMtrl", ";", "final", "int", "bM", "=", "pos", ".", "bMtrl", ";", "final", "int", "wPawn", "=", "pos", ".", "wMtrlPawns", ";", "final",...
implement the " when ahead trade pieces , when behind trade pawns " rule .
train
false
266
private List<Vcenter> filterVcentersByTenant(List<Vcenter> vcenters,URI tenantId){ List<Vcenter> tenantVcenterList=new ArrayList<Vcenter>(); Iterator<Vcenter> vcenterIt=vcenters.iterator(); while (vcenterIt.hasNext()) { Vcenter vcenter=vcenterIt.next(); if (vcenter == null) { continue; } Set...
[ "private", "List", "<", "Vcenter", ">", "filterVcentersByTenant", "(", "List", "<", "Vcenter", ">", "vcenters", ",", "URI", "tenantId", ")", "{", "List", "<", "Vcenter", ">", "tenantVcenterList", "=", "new", "ArrayList", "<", "Vcenter", ">", "(", ")", ";",...
filters the vcenters by the tenant . if the provided tenant is null or the tenant does not share the vcenter than the vcenters are filtered with the user ' s tenant .
train
false
268
public boolean contains(EventPoint ep){ return events.contains(ep); }
[ "public", "boolean", "contains", "(", "EventPoint", "ep", ")", "{", "return", "events", ".", "contains", "(", "ep", ")", ";", "}" ]
determine whether event point already exists within the queue .
train
false
269
public FacebookException(String format,Object... args){ this(String.format(format,args)); }
[ "public", "FacebookException", "(", "String", "format", ",", "Object", "...", "args", ")", "{", "this", "(", "String", ".", "format", "(", "format", ",", "args", ")", ")", ";", "}" ]
constructs a new facebookexception .
train
true
270
private List<String> convertByteArrayListToStringValueList(List<byte[]> dictionaryByteArrayList){ List<String> valueList=new ArrayList<>(dictionaryByteArrayList.size()); for ( byte[] value : dictionaryByteArrayList) { valueList.add(new String(value,Charset.forName(CarbonCommonConstants.DEFAULT_CHARSET))); } ...
[ "private", "List", "<", "String", ">", "convertByteArrayListToStringValueList", "(", "List", "<", "byte", "[", "]", ">", "dictionaryByteArrayList", ")", "{", "List", "<", "String", ">", "valueList", "=", "new", "ArrayList", "<", ">", "(", "dictionaryByteArrayLis...
this method will convert list of byte array to list of string
train
false
272
private boolean isNanpaNumberWithNationalPrefix(){ return (currentMetadata.getCountryCode() == 1) && (nationalNumber.charAt(0) == '1') && (nationalNumber.charAt(1) != '0')&& (nationalNumber.charAt(1) != '1'); }
[ "private", "boolean", "isNanpaNumberWithNationalPrefix", "(", ")", "{", "return", "(", "currentMetadata", ".", "getCountryCode", "(", ")", "==", "1", ")", "&&", "(", "nationalNumber", ".", "charAt", "(", "0", ")", "==", "'1'", ")", "&&", "(", "nationalNumber...
returns true if the current country is a nanpa country and the national number begins with the national prefix .
train
false
274
protected void processClientPom() throws IOException { File pom=new File(projectRoot,CLIENT_POM); String pomContent=readFileContent(pom); String depString=GEN_START + String.format("<dependency>%n<groupId>%s</groupId>%n<artifactId>%s</artifactId>%n</dependency>%n",mavenGroupId,mavenArtifactId) + GEN_END; if (!p...
[ "protected", "void", "processClientPom", "(", ")", "throws", "IOException", "{", "File", "pom", "=", "new", "File", "(", "projectRoot", ",", "CLIENT_POM", ")", ";", "String", "pomContent", "=", "readFileContent", "(", "pom", ")", ";", "String", "depString", ...
insert dependency at the end of " dependencies " section .
train
false
275
private void push(final int type){ if (outputStack == null) { outputStack=new int[10]; } int n=outputStack.length; if (outputStackTop >= n) { int[] t=new int[Math.max(outputStackTop + 1,2 * n)]; System.arraycopy(outputStack,0,t,0,n); outputStack=t; } outputStack[outputStackTop++]=type; int...
[ "private", "void", "push", "(", "final", "int", "type", ")", "{", "if", "(", "outputStack", "==", "null", ")", "{", "outputStack", "=", "new", "int", "[", "10", "]", ";", "}", "int", "n", "=", "outputStack", ".", "length", ";", "if", "(", "outputSt...
pushes a new type onto the output frame stack .
train
true
276
public void put(URI uri,byte[] bimg,BufferedImage img){ synchronized (bytemap) { while (bytesize > 1000 * 1000 * 50) { URI olduri=bytemapAccessQueue.removeFirst(); byte[] oldbimg=bytemap.remove(olduri); bytesize-=oldbimg.length; log("removed 1 img from byte cache"); } bytemap.put(uri...
[ "public", "void", "put", "(", "URI", "uri", ",", "byte", "[", "]", "bimg", ",", "BufferedImage", "img", ")", "{", "synchronized", "(", "bytemap", ")", "{", "while", "(", "bytesize", ">", "1000", "*", "1000", "*", "50", ")", "{", "URI", "olduri", "=...
put a tile image into the cache . this puts both a buffered image and array of bytes that make up the compressed image .
train
true
278
public static AttribKey forAttribute(Namespaces inScope,ElKey el,String qname){ Namespaces ns; String localName; int colon=qname.indexOf(':'); if (colon < 0) { ns=el.ns; localName=qname; } else { ns=inScope.forAttrName(el.ns,qname); if (ns == null) { return null; } ns=inScope.fo...
[ "public", "static", "AttribKey", "forAttribute", "(", "Namespaces", "inScope", ",", "ElKey", "el", ",", "String", "qname", ")", "{", "Namespaces", "ns", ";", "String", "localName", ";", "int", "colon", "=", "qname", ".", "indexOf", "(", "':'", ")", ";", ...
looks up an attribute key by qualified name .
train
false
279
public void removeMapEventsListener(MapEventsListener listener){ if (mapEventsListeners != null) { mapEventsListeners.remove(listener); } }
[ "public", "void", "removeMapEventsListener", "(", "MapEventsListener", "listener", ")", "{", "if", "(", "mapEventsListeners", "!=", "null", ")", "{", "mapEventsListeners", ".", "remove", "(", "listener", ")", ";", "}", "}" ]
removes map event listener from the map .
train
false
280
@RequestMapping(value={"/{cg}/{k}","{cg}/{k}/"},method=RequestMethod.GET) @ResponseBody public RestWrapper listUsingKey(@PathVariable("cg") String configGroup,@PathVariable("k") String key,Principal principal){ RestWrapper restWrapper=null; GetGeneralConfig getGeneralConfig=new GetGeneralConfig(); GeneralConfig g...
[ "@", "RequestMapping", "(", "value", "=", "{", "\"/{cg}/{k}\"", ",", "\"{cg}/{k}/\"", "}", ",", "method", "=", "RequestMethod", ".", "GET", ")", "@", "ResponseBody", "public", "RestWrapper", "listUsingKey", "(", "@", "PathVariable", "(", "\"cg\"", ")", "String...
this method calls proc getgenconfigproperty and fetches a record from generalconfig table corresponding to config group and key passed .
train
false
281
private ColorStateList applyTextAppearance(Paint p,int resId){ TextView tv=new TextView(mContext); if (SUtils.isApi_23_OrHigher()) { tv.setTextAppearance(resId); } else { tv.setTextAppearance(mContext,resId); } p.setTypeface(tv.getTypeface()); p.setTextSize(tv.getTextSize()); final ColorStateList...
[ "private", "ColorStateList", "applyTextAppearance", "(", "Paint", "p", ",", "int", "resId", ")", "{", "TextView", "tv", "=", "new", "TextView", "(", "mContext", ")", ";", "if", "(", "SUtils", ".", "isApi_23_OrHigher", "(", ")", ")", "{", "tv", ".", "setT...
applies the specified text appearance resource to a paint , returning the text color if one is set in the text appearance .
train
false
282
public void removeDiscoveryListener(DiscoveryListener l){ synchronized (registrars) { if (terminated) { throw new IllegalStateException("discovery terminated"); } listeners.remove(l); } }
[ "public", "void", "removeDiscoveryListener", "(", "DiscoveryListener", "l", ")", "{", "synchronized", "(", "registrars", ")", "{", "if", "(", "terminated", ")", "{", "throw", "new", "IllegalStateException", "(", "\"discovery terminated\"", ")", ";", "}", "listener...
indicate that a listener is no longer interested in receiving discoveryevent notifications .
train
false
283
public static void copyFile(File in,File out) throws IOException { FileInputStream fis=new FileInputStream(in); FileOutputStream fos=new FileOutputStream(out); try { copyStream(fis,fos); } finally { fis.close(); fos.close(); } }
[ "public", "static", "void", "copyFile", "(", "File", "in", ",", "File", "out", ")", "throws", "IOException", "{", "FileInputStream", "fis", "=", "new", "FileInputStream", "(", "in", ")", ";", "FileOutputStream", "fos", "=", "new", "FileOutputStream", "(", "o...
copy a file from one place to another
train
false
284
private boolean airAppTerminated(ProcessListener pl){ if (pl != null) { if (pl.isAIRApp()) { if (pl.isProcessDead()) { return true; } } } return false; }
[ "private", "boolean", "airAppTerminated", "(", "ProcessListener", "pl", ")", "{", "if", "(", "pl", "!=", "null", ")", "{", "if", "(", "pl", ".", "isAIRApp", "(", ")", ")", "{", "if", "(", "pl", ".", "isProcessDead", "(", ")", ")", "{", "return", "t...
returns true if the passed - in process listener is for an air application that has terminated . this is used by accept ( ) in order to detect that it should give up listening on the socket . the reason we can ' t do this for flash player - based apps is that unlike air apps , the process that we launched sometimes act...
train
false
285
private int xToScreenCoords(int mapCoord){ return (int)(mapCoord * map.getScale() - map.getScrollX()); }
[ "private", "int", "xToScreenCoords", "(", "int", "mapCoord", ")", "{", "return", "(", "int", ")", "(", "mapCoord", "*", "map", ".", "getScale", "(", ")", "-", "map", ".", "getScrollX", "(", ")", ")", ";", "}" ]
transforms coordinate in map coordinate system to screen coordinate system
train
false
286
public Alias filter(Map<String,Object> filter){ if (filter == null || filter.isEmpty()) { this.filter=null; return this; } try { XContentBuilder builder=XContentFactory.contentBuilder(XContentType.JSON); builder.map(filter); this.filter=builder.string(); return this; } catch ( IOExcept...
[ "public", "Alias", "filter", "(", "Map", "<", "String", ",", "Object", ">", "filter", ")", "{", "if", "(", "filter", "==", "null", "||", "filter", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "filter", "=", "null", ";", "return", "this", ";", ...
associates a filter to the alias
train
false
287
public void connectToBeanContext(BeanContext in_bc) throws PropertyVetoException { if (in_bc != null) { in_bc.addBeanContextMembershipListener(this); beanContextChildSupport.setBeanContext(in_bc); } }
[ "public", "void", "connectToBeanContext", "(", "BeanContext", "in_bc", ")", "throws", "PropertyVetoException", "{", "if", "(", "in_bc", "!=", "null", ")", "{", "in_bc", ".", "addBeanContextMembershipListener", "(", "this", ")", ";", "beanContextChildSupport", ".", ...
layer method to just connect to the beancontext , without grabbing the iterator as in setbeancontext ( ) . good for protected sub - layers where you want to optimize the calling of the findandinit ( ) method over them .
train
false
288
public static CertificateID createCertId(BigInteger subjectSerialNumber,X509Certificate issuer) throws Exception { return new CertificateID(createDigestCalculator(SHA1_ID),new X509CertificateHolder(issuer.getEncoded()),subjectSerialNumber); }
[ "public", "static", "CertificateID", "createCertId", "(", "BigInteger", "subjectSerialNumber", ",", "X509Certificate", "issuer", ")", "throws", "Exception", "{", "return", "new", "CertificateID", "(", "createDigestCalculator", "(", "SHA1_ID", ")", ",", "new", "X509Cer...
creates a new certificate id instance ( using sha - 1 digest calculator ) for the specified subject certificate serial number and issuer certificate .
train
false
289
public static final String convertToText(final String input,final boolean isXMLExtraction){ final StringBuffer output_data; if (isXMLExtraction) { final byte[] rawData=StringUtils.toBytes(input); final int length=rawData.length; int ptr=0; boolean inToken=false; for (int i=0; i < length; i++) { ...
[ "public", "static", "final", "String", "convertToText", "(", "final", "String", "input", ",", "final", "boolean", "isXMLExtraction", ")", "{", "final", "StringBuffer", "output_data", ";", "if", "(", "isXMLExtraction", ")", "{", "final", "byte", "[", "]", "rawD...
strip out xml tags and put in a tab ( do not use on chinese text )
train
false
290
private int parseKey(final byte[] b,final int off) throws ParseException { final int bytesToParseLen=b.length - off; if (bytesToParseLen >= encryptedKeyLen_) { encryptedKey_=Arrays.copyOfRange(b,off,off + encryptedKeyLen_); return encryptedKeyLen_; } else { throw new ParseException("Not enough bytes ...
[ "private", "int", "parseKey", "(", "final", "byte", "[", "]", "b", ",", "final", "int", "off", ")", "throws", "ParseException", "{", "final", "int", "bytesToParseLen", "=", "b", ".", "length", "-", "off", ";", "if", "(", "bytesToParseLen", ">=", "encrypt...
parse the key in the provided bytes . it looks for bytes of size defined by the key length in the provided bytes starting at the specified off . < p > if successful , it returns the size of the parsed bytes which is the key length . on failure , it throws a parse exception .
train
false
291
private void calculateIntersectPoints(){ intersectPoints.clear(); if (center.x - menuBounds.left < expandedRadius) { int dy=(int)Math.sqrt(Math.pow(expandedRadius,2) - Math.pow(center.x - menuBounds.left,2)); if (center.y - dy > menuBounds.top) { intersectPoints.add(new Point(menuBounds.left,center.y ...
[ "private", "void", "calculateIntersectPoints", "(", ")", "{", "intersectPoints", ".", "clear", "(", ")", ";", "if", "(", "center", ".", "x", "-", "menuBounds", ".", "left", "<", "expandedRadius", ")", "{", "int", "dy", "=", "(", "int", ")", "Math", "."...
find all intersect points , and calculate menu items display area ;
train
true
292
public static ReplyProcessor21 send(Set recipients,DM dm,int prId,int bucketId,BucketProfile bp,boolean requireAck){ if (recipients.isEmpty()) { return null; } ReplyProcessor21 rp=null; int procId=0; if (requireAck) { rp=new ReplyProcessor21(dm,recipients); procId=rp.getProcessorId(); } Bucket...
[ "public", "static", "ReplyProcessor21", "send", "(", "Set", "recipients", ",", "DM", "dm", ",", "int", "prId", ",", "int", "bucketId", ",", "BucketProfile", "bp", ",", "boolean", "requireAck", ")", "{", "if", "(", "recipients", ".", "isEmpty", "(", ")", ...
send a profile update to a set of members .
train
false
293
static boolean isCallerSensitive(MemberName mem){ if (!mem.isInvocable()) return false; return mem.isCallerSensitive() || canBeCalledVirtual(mem); }
[ "static", "boolean", "isCallerSensitive", "(", "MemberName", "mem", ")", "{", "if", "(", "!", "mem", ".", "isInvocable", "(", ")", ")", "return", "false", ";", "return", "mem", ".", "isCallerSensitive", "(", ")", "||", "canBeCalledVirtual", "(", "mem", ")"...
is this method a caller - sensitive method ? i . e . , does it call reflection . getcallerclass or a similer method to ask about the identity of its caller ?
train
false
294
public void stopSearch(){ mMatchedNode.clear(); mQueryText.setLength(0); mSearchOverlay.hide(); mActive=false; }
[ "public", "void", "stopSearch", "(", ")", "{", "mMatchedNode", ".", "clear", "(", ")", ";", "mQueryText", ".", "setLength", "(", "0", ")", ";", "mSearchOverlay", ".", "hide", "(", ")", ";", "mActive", "=", "false", ";", "}" ]
stop the current search . hides the search overlay and clears the search query .
train
false
296
public static String makeXmlSafe(String text){ if (StringUtil.isNullOrEmpty(text)) return ""; text=text.replace(ESC_AMPERSAND,"&"); text=text.replace("\"",ESC_QUOTE); text=text.replace("&",ESC_AMPERSAND); text=text.replace("'",ESC_APOSTROPHE); text=text.replace("<",ESC_LESS_THAN); text=text.replace(">",...
[ "public", "static", "String", "makeXmlSafe", "(", "String", "text", ")", "{", "if", "(", "StringUtil", ".", "isNullOrEmpty", "(", "text", ")", ")", "return", "\"\"", ";", "text", "=", "text", ".", "replace", "(", "ESC_AMPERSAND", ",", "\"&\"", ")", ";", ...
takes in a string , and replaces all xml special characters with the approprate escape strings .
train
false
298
final public MutableString toUpperCase(){ int n=length(); final char[] a=array; while (n-- != 0) a[n]=Character.toUpperCase(a[n]); changed(); return this; }
[ "final", "public", "MutableString", "toUpperCase", "(", ")", "{", "int", "n", "=", "length", "(", ")", ";", "final", "char", "[", "]", "a", "=", "array", ";", "while", "(", "n", "--", "!=", "0", ")", "a", "[", "n", "]", "=", "Character", ".", "...
converts all of the characters in this mutable string to upper case using the rules of the default locale .
train
false
299
@Override public void handleMousePressed(ChartCanvas canvas,MouseEvent e){ this.mousePressedPoint=new Point2D.Double(e.getX(),e.getY()); }
[ "@", "Override", "public", "void", "handleMousePressed", "(", "ChartCanvas", "canvas", ",", "MouseEvent", "e", ")", "{", "this", ".", "mousePressedPoint", "=", "new", "Point2D", ".", "Double", "(", "e", ".", "getX", "(", ")", ",", "e", ".", "getY", "(", ...
handles a mouse pressed event by recording the location of the mouse pointer ( so that later we can check that the click isn ' t part of a drag ) .
train
false
300
public static Path createTempFile(String prefix,String suffix) throws IOException { Path tempDirPath=Paths.get(SystemProperties.getTempFilesPath()); return createTempFile(tempDirPath,prefix,suffix); }
[ "public", "static", "Path", "createTempFile", "(", "String", "prefix", ",", "String", "suffix", ")", "throws", "IOException", "{", "Path", "tempDirPath", "=", "Paths", ".", "get", "(", "SystemProperties", ".", "getTempFilesPath", "(", ")", ")", ";", "return", ...
creates a temporary file on disk ( location specified by systemproperties . gettempfilespath ( ) ) and returns its path .
train
false
302
public static short[] initializeSubStateArray(List<Tree<String>> trainTrees,List<Tree<String>> validationTrees,Numberer tagNumberer,short nSubStates){ short[] nSub=new short[2]; nSub[0]=1; nSub[1]=nSubStates; StateSetTreeList trainStateSetTrees=new StateSetTreeList(trainTrees,nSub,true,tagNumberer); @Suppress...
[ "public", "static", "short", "[", "]", "initializeSubStateArray", "(", "List", "<", "Tree", "<", "String", ">", ">", "trainTrees", ",", "List", "<", "Tree", "<", "String", ">", ">", "validationTrees", ",", "Numberer", "tagNumberer", ",", "short", "nSubStates...
convert a single tree [ string ] to tree [ stateset ]
train
false
304
public PluginDescriptionFile(final String pluginName,final String pluginVersion,final String mainClass){ name=pluginName.replace(' ','_'); version=pluginVersion; main=mainClass; }
[ "public", "PluginDescriptionFile", "(", "final", "String", "pluginName", ",", "final", "String", "pluginVersion", ",", "final", "String", "mainClass", ")", "{", "name", "=", "pluginName", ".", "replace", "(", "' '", ",", "'_'", ")", ";", "version", "=", "plu...
creates a new plugindescriptionfile with the given detailed
train
false
305
public void fill(Graphics2D g,Shape s){ Rectangle bounds=s.getBounds(); int width=bounds.width; int height=bounds.height; BufferedImage bimage=Effect.createBufferedImage(width,height,true); Graphics2D gbi=bimage.createGraphics(); gbi.setColor(Color.BLACK); gbi.fill(s); g.drawImage(applyEffect(bimage,nul...
[ "public", "void", "fill", "(", "Graphics2D", "g", ",", "Shape", "s", ")", "{", "Rectangle", "bounds", "=", "s", ".", "getBounds", "(", ")", ";", "int", "width", "=", "bounds", ".", "width", ";", "int", "height", "=", "bounds", ".", "height", ";", "...
paint the effect based around a solid shape in the graphics supplied .
train
true
306
public void silentClear(){ mSelectedWidgets.clear(); mModifiedWidgets.clear(); }
[ "public", "void", "silentClear", "(", ")", "{", "mSelectedWidgets", ".", "clear", "(", ")", ";", "mModifiedWidgets", ".", "clear", "(", ")", ";", "}" ]
clear the selection without warning listeners
train
false
307
public static boolean isArray(Element arrayE){ String name=arrayE.getTagName(); if (name.equals("Array") || name.equals("NUM-ARRAY") || name.equals("INT-ARRAY")|| name.equals("REAL-ARRAY")|| name.equals("STRING-ARRAY")|| isSparseArray(arrayE)) { return true; } return false; }
[ "public", "static", "boolean", "isArray", "(", "Element", "arrayE", ")", "{", "String", "name", "=", "arrayE", ".", "getTagName", "(", ")", ";", "if", "(", "name", ".", "equals", "(", "\"Array\"", ")", "||", "name", ".", "equals", "(", "\"NUM-ARRAY\"", ...
utility method to check if an xml element is an array .
train
false
308
public void addNotificationListener(ObjectName name,NotificationListener listener,NotificationFilter filter,Object handback) throws InstanceNotFoundException { mbsInterceptor.addNotificationListener(cloneObjectName(name),listener,filter,handback); }
[ "public", "void", "addNotificationListener", "(", "ObjectName", "name", ",", "NotificationListener", "listener", ",", "NotificationFilter", "filter", ",", "Object", "handback", ")", "throws", "InstanceNotFoundException", "{", "mbsInterceptor", ".", "addNotificationListener"...
adds a listener to a registered mbean .
train
false
309
static long readVarLong(InputStream in) throws IOException { long x=in.read(); if (x < 0) { throw new EOFException(); } x=(byte)x; if (x >= 0) { return x; } x&=0x7f; for (int s=7; s < 64; s+=7) { long b=in.read(); if (b < 0) { throw new EOFException(); } b=(byte)b; x|=(...
[ "static", "long", "readVarLong", "(", "InputStream", "in", ")", "throws", "IOException", "{", "long", "x", "=", "in", ".", "read", "(", ")", ";", "if", "(", "x", "<", "0", ")", "{", "throw", "new", "EOFException", "(", ")", ";", "}", "x", "=", "(...
read a variable size long value .
train
false
311
public static Builder createBuilder(AbstractManagedObjectDefinition<?,?> d,String propertyName){ return new Builder(d,propertyName); }
[ "public", "static", "Builder", "createBuilder", "(", "AbstractManagedObjectDefinition", "<", "?", ",", "?", ">", "d", ",", "String", "propertyName", ")", "{", "return", "new", "Builder", "(", "d", ",", "propertyName", ")", ";", "}" ]
create a aci property definition builder .
train
false
312
public void filter(File inputFile,PrintWriter o) throws IOException { BufferedWriter bw=new BufferedWriter(o); StringBuffer sb=(StringBuffer)fileMap.get(inputFile.toString()); if (sb == null) { sb=loadFile(inputFile); } filter(sb,bw); bw.flush(); }
[ "public", "void", "filter", "(", "File", "inputFile", ",", "PrintWriter", "o", ")", "throws", "IOException", "{", "BufferedWriter", "bw", "=", "new", "BufferedWriter", "(", "o", ")", ";", "StringBuffer", "sb", "=", "(", "StringBuffer", ")", "fileMap", ".", ...
filters data from file .
train
false
314
public void stop(){ logger.info("Cassandra shutting down..."); if (thriftServer != null) thriftServer.stop(); if (nativeServer != null) nativeServer.stop(); if (FBUtilities.isWindows()) System.exit(0); if (jmxServer != null) { try { jmxServer.stop(); } catch ( IOException e) { lo...
[ "public", "void", "stop", "(", ")", "{", "logger", ".", "info", "(", "\"Cassandra shutting down...\"", ")", ";", "if", "(", "thriftServer", "!=", "null", ")", "thriftServer", ".", "stop", "(", ")", ";", "if", "(", "nativeServer", "!=", "null", ")", "nati...
stop the daemon , ideally in an idempotent manner . hook for jsvc / procrun
train
true
315
private void compileMethod(HotSpotResolvedJavaMethod method,int counter){ try { long start=System.currentTimeMillis(); long allocatedAtStart=MemUseTrackerImpl.getCurrentThreadAllocatedBytes(); int entryBCI=JVMCICompiler.INVOCATION_ENTRY_BCI; HotSpotCompilationRequest request=new HotSpotCompilationRequ...
[ "private", "void", "compileMethod", "(", "HotSpotResolvedJavaMethod", "method", ",", "int", "counter", ")", "{", "try", "{", "long", "start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "long", "allocatedAtStart", "=", "MemUseTrackerImpl", ".", "getC...
compiles a method and gathers some statistics .
train
false
318
public EsriShapeExport(EsriGraphicList list,DbfTableModel dbf,String pathToFile){ setGraphicList(list); setMasterDBF(dbf); filePath=pathToFile; DEBUG=logger.isLoggable(Level.FINE); }
[ "public", "EsriShapeExport", "(", "EsriGraphicList", "list", ",", "DbfTableModel", "dbf", ",", "String", "pathToFile", ")", "{", "setGraphicList", "(", "list", ")", ";", "setMasterDBF", "(", "dbf", ")", ";", "filePath", "=", "pathToFile", ";", "DEBUG", "=", ...
create an esrishapeexport object .
train
false
319
void saveOffsetInExternalStore(String topic,int partition,long offset){ try { FileWriter writer=new FileWriter(storageName(topic,partition),false); BufferedWriter bufferedWriter=new BufferedWriter(writer); bufferedWriter.write(offset + ""); bufferedWriter.flush(); bufferedWriter.close(); } catc...
[ "void", "saveOffsetInExternalStore", "(", "String", "topic", ",", "int", "partition", ",", "long", "offset", ")", "{", "try", "{", "FileWriter", "writer", "=", "new", "FileWriter", "(", "storageName", "(", "topic", ",", "partition", ")", ",", "false", ")", ...
overwrite the offset for the topic in an external storage .
train
false
320
private CentroidClusterModel assinePoints(CentroidClusterModel model){ double[] values=new double[attributes.size()]; int i=0; for ( Example example : exampleSet) { double[] exampleValues=getAsDoubleArray(example,attributes,values); double nearestDistance=measure.calculateDistance(model.getCentroidCoordi...
[ "private", "CentroidClusterModel", "assinePoints", "(", "CentroidClusterModel", "model", ")", "{", "double", "[", "]", "values", "=", "new", "double", "[", "attributes", ".", "size", "(", ")", "]", ";", "int", "i", "=", "0", ";", "for", "(", "Example", "...
assign the points to cluster
train
false
322
public void importPKCS8(BurpCertificate certificate,String filename){ setStatus("Importing private key..."); FileInputStream fis; File file=new File(filename); PrivateKey privateKey; try { fis=new FileInputStream(file); DataInputStream dis=new DataInputStream(fis); byte[] keyBytes=new byte[(int)fi...
[ "public", "void", "importPKCS8", "(", "BurpCertificate", "certificate", ",", "String", "filename", ")", "{", "setStatus", "(", "\"Importing private key...\"", ")", ";", "FileInputStream", "fis", ";", "File", "file", "=", "new", "File", "(", "filename", ")", ";",...
import a private key in pkcs8 format in der format .
train
false
323
public Collection<Object> undo(){ HashSet<Object> modifiedObjects=null; boolean done=false; while ((indexOfNextAdd > 0) && !done) { List<mxUndoableEdit> edits=history.get(--indexOfNextAdd); for (int i=edits.size() - 1; i >= 0; i--) { mxUndoableEdit edit=edits.get(i); edit.undo(); modifie...
[ "public", "Collection", "<", "Object", ">", "undo", "(", ")", "{", "HashSet", "<", "Object", ">", "modifiedObjects", "=", "null", ";", "boolean", "done", "=", "false", ";", "while", "(", "(", "indexOfNextAdd", ">", "0", ")", "&&", "!", "done", ")", "...
undoes the last change .
train
false
325
public static <T>TreeNode<T> copy(TreeDef<T> treeDef,T root){ return copy(treeDef,root,Function.identity()); }
[ "public", "static", "<", "T", ">", "TreeNode", "<", "T", ">", "copy", "(", "TreeDef", "<", "T", ">", "treeDef", ",", "T", "root", ")", "{", "return", "copy", "(", "treeDef", ",", "root", ",", "Function", ".", "identity", "(", ")", ")", ";", "}" ]
creates a hierarchy of treenodes that copies the structure and content of the given tree .
train
true
326
protected void drawWithOffset(float zone,int pointsRight,int pointsLeft,float fixedPoints,Canvas canvas,Paint paint){ int position=getPositionForZone(zone); int firstPosition=(int)(position - pointsLeft - fixedPoints); int lastPosition=(int)(position + pointsRight + fixedPoints); if (lastPosition > pointsNumber...
[ "protected", "void", "drawWithOffset", "(", "float", "zone", ",", "int", "pointsRight", ",", "int", "pointsLeft", ",", "float", "fixedPoints", ",", "Canvas", "canvas", ",", "Paint", "paint", ")", "{", "int", "position", "=", "getPositionForZone", "(", "zone", ...
paint a line with a offset for right and left
train
false
327
static String calculateNthPercentile(List<String> values,int n){ String[] valuesArr=new String[values.size()]; valuesArr=values.toArray(valuesArr); Arrays.sort(valuesArr); int ordinalRank=(int)Math.ceil(n * values.size() / 100.0); return valuesArr[ordinalRank - 1]; }
[ "static", "String", "calculateNthPercentile", "(", "List", "<", "String", ">", "values", ",", "int", "n", ")", "{", "String", "[", "]", "valuesArr", "=", "new", "String", "[", "values", ".", "size", "(", ")", "]", ";", "valuesArr", "=", "values", ".", ...
calculates nth percentile of a set of values using the nearest neighbor method .
train
false
328
private void boundsChanged(){ if (runLaterPending) return; runLaterPending=true; Platform.runLater(null); }
[ "private", "void", "boundsChanged", "(", ")", "{", "if", "(", "runLaterPending", ")", "return", ";", "runLaterPending", "=", "true", ";", "Platform", ".", "runLater", "(", "null", ")", ";", "}" ]
remembers the window bounds when the window is not iconified , maximized or in fullscreen .
train
false
329
public void clear(){ synchronized (lock) { File[] files=cachePath.listFiles(); if (files == null) { return; } for ( File file : files) { removeFile(file); } pendingTasks.clear(); } }
[ "public", "void", "clear", "(", ")", "{", "synchronized", "(", "lock", ")", "{", "File", "[", "]", "files", "=", "cachePath", ".", "listFiles", "(", ")", ";", "if", "(", "files", "==", "null", ")", "{", "return", ";", "}", "for", "(", "File", "fi...
gets rid of all pending commands .
train
false
330
@Nullable protected abstract URL resolveTestData(String name);
[ "@", "Nullable", "protected", "abstract", "URL", "resolveTestData", "(", "String", "name", ")", ";" ]
resolves a test data name relative to the root of all test data , returning a url to represent it .
train
false
331
public static boolean isFullAccessibleField(JField field,JClassType clazz){ return field.isPublic() || hasGetAndSetMethods(field,clazz); }
[ "public", "static", "boolean", "isFullAccessibleField", "(", "JField", "field", ",", "JClassType", "clazz", ")", "{", "return", "field", ".", "isPublic", "(", ")", "||", "hasGetAndSetMethods", "(", "field", ",", "clazz", ")", ";", "}" ]
verify if the given field is fully accessible .
train
false
332
public byte[] convert(byte[] inBuffer,int size){ byte[] result=null; if (inBuffer != null) { DrmConvertedStatus convertedStatus=null; try { if (size != inBuffer.length) { byte[] buf=new byte[size]; System.arraycopy(inBuffer,0,buf,0,size); convertedStatus=mDrmClient.convertData(...
[ "public", "byte", "[", "]", "convert", "(", "byte", "[", "]", "inBuffer", ",", "int", "size", ")", "{", "byte", "[", "]", "result", "=", "null", ";", "if", "(", "inBuffer", "!=", "null", ")", "{", "DrmConvertedStatus", "convertedStatus", "=", "null", ...
convert a buffer of data to protected format .
train
false
334
@Deprecated private static void makeJSForInlineSubmit(Appendable writer,Map<String,Object> context,ModelForm modelForm,String hiddenFormName) throws IOException { List<ModelFormField> rowSubmitFields=modelForm.getMultiSubmitFields(); if (rowSubmitFields != null) { writer.append("<script type=\"text/javascript\"...
[ "@", "Deprecated", "private", "static", "void", "makeJSForInlineSubmit", "(", "Appendable", "writer", ",", "Map", "<", "String", ",", "Object", ">", "context", ",", "ModelForm", "modelForm", ",", "String", "hiddenFormName", ")", "throws", "IOException", "{", "Li...
scipio : creates js script to populate the target hidden form with the corresponding fields of the row that triggered the submission ( only when use - submit - row is false )
train
false
337
public final void trackedAction(Core controller) throws InterruptedException { long time=System.currentTimeMillis(); statistics.useNow(); action(controller); time=System.currentTimeMillis() - time; statistics.updateAverageExecutionTime(time); }
[ "public", "final", "void", "trackedAction", "(", "Core", "controller", ")", "throws", "InterruptedException", "{", "long", "time", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "statistics", ".", "useNow", "(", ")", ";", "action", "(", "controller", ...
perform the action and track the statistics related to this action .
train
false
339
public Executor env(Map<String,String> env){ this.env=env; return this; }
[ "public", "Executor", "env", "(", "Map", "<", "String", ",", "String", ">", "env", ")", "{", "this", ".", "env", "=", "env", ";", "return", "this", ";", "}" ]
sets the environment variables for the child process .
train
false
341
public static KeyPair createECKeyPair(String name) throws IOException { try { ECGenParameterSpec ecSpec=new ECGenParameterSpec(name); KeyPairGenerator keyGen=KeyPairGenerator.getInstance("EC"); keyGen.initialize(ecSpec,new SecureRandom()); return keyGen.generateKeyPair(); } catch ( NoSuchAlgorithm...
[ "public", "static", "KeyPair", "createECKeyPair", "(", "String", "name", ")", "throws", "IOException", "{", "try", "{", "ECGenParameterSpec", "ecSpec", "=", "new", "ECGenParameterSpec", "(", "name", ")", ";", "KeyPairGenerator", "keyGen", "=", "KeyPairGenerator", ...
creates a random ecc key pair with the given curve name .
train
false
343
public static Document loadDocument(InputStream stream) throws Exception { DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance(); DocumentBuilder builder=factory.newDocumentBuilder(); return builder.parse(stream); }
[ "public", "static", "Document", "loadDocument", "(", "InputStream", "stream", ")", "throws", "Exception", "{", "DocumentBuilderFactory", "factory", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ")", ";", "DocumentBuilder", "builder", "=", "factory", ".", "...
loads a xml document from a stream and returns the corresponding dom document .
train
false
344
private int handleSingleNalUnitPacket(Buffer input,Buffer output){ byte[] bufferData=(byte[])input.getData(); int bufferDataLength=bufferData.length; byte[] data=new byte[bufferDataLength]; System.arraycopy(bufferData,0,data,0,bufferDataLength); output.setData(data); output.setLength(data.length); output....
[ "private", "int", "handleSingleNalUnitPacket", "(", "Buffer", "input", ",", "Buffer", "output", ")", "{", "byte", "[", "]", "bufferData", "=", "(", "byte", "[", "]", ")", "input", ".", "getData", "(", ")", ";", "int", "bufferDataLength", "=", "bufferData",...
handle single nal unit packet
train
false
345
public static <T>List<T> asList(T... values){ if (values == null) { return new ArrayList<T>(0); } else { return new ArrayList<T>(Arrays.asList(values)); } }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "asList", "(", "T", "...", "values", ")", "{", "if", "(", "values", "==", "null", ")", "{", "return", "new", "ArrayList", "<", "T", ">", "(", "0", ")", ";", "}", "else", "{", "return", ...
collects the passed in objects into a list .
train
false
347
public final Object copy(){ DynamicIntArray copy=new DynamicIntArray(m_Objects.length); copy.m_Size=m_Size; copy.m_CapacityIncrement=m_CapacityIncrement; copy.m_CapacityMultiplier=m_CapacityMultiplier; System.arraycopy(m_Objects,0,copy.m_Objects,0,m_Size); return copy; }
[ "public", "final", "Object", "copy", "(", ")", "{", "DynamicIntArray", "copy", "=", "new", "DynamicIntArray", "(", "m_Objects", ".", "length", ")", ";", "copy", ".", "m_Size", "=", "m_Size", ";", "copy", ".", "m_CapacityIncrement", "=", "m_CapacityIncrement", ...
produces a copy of this vector .
train
false
348
public static int deleteOldSMS(){ long olderthan=System.currentTimeMillis() - OLD_SMS_THRESHOLD; return database.delete(DatabaseOpenHelper.SMS_TABLE_NAME,"date < " + olderthan,null); }
[ "public", "static", "int", "deleteOldSMS", "(", ")", "{", "long", "olderthan", "=", "System", ".", "currentTimeMillis", "(", ")", "-", "OLD_SMS_THRESHOLD", ";", "return", "database", ".", "delete", "(", "DatabaseOpenHelper", ".", "SMS_TABLE_NAME", ",", "\"date <...
deletes sms from the database that are older then 5 days
train
false
351
private static String encodeMetricFilters(String metricString,Map<String,String> mapper){ String finalString=metricString; int counter=0; int startIndex=0; int endIndex=0; for (int i=0; i < metricString.length(); i++) { char currentChar=metricString.charAt(i); startIndex=(currentChar == '(' && counter...
[ "private", "static", "String", "encodeMetricFilters", "(", "String", "metricString", ",", "Map", "<", "String", ",", "String", ">", "mapper", ")", "{", "String", "finalString", "=", "metricString", ";", "int", "counter", "=", "0", ";", "int", "startIndex", "...
returns modified metrics string . aggregated metric filter details are stripped and stored in mapper . metric filter is replaced by hashkey which can be used to retrieve the filter from the mapper
train
false
353
private void stopCheckingStatus(){ executor.shutdownNow(); executor=Executors.newSingleThreadExecutor(); future=null; }
[ "private", "void", "stopCheckingStatus", "(", ")", "{", "executor", ".", "shutdownNow", "(", ")", ";", "executor", "=", "Executors", ".", "newSingleThreadExecutor", "(", ")", ";", "future", "=", "null", ";", "}" ]
re - sets the executor and indicates the system is no longer checking the status of the transactions
train
false
354
public void updateNotification(int notificationId){ try { notificationDAO.open(); notificationDAO.updateNotification(notificationId,Notification.Status.DISMISSED); } finally { notificationDAO.close(); } }
[ "public", "void", "updateNotification", "(", "int", "notificationId", ")", "{", "try", "{", "notificationDAO", ".", "open", "(", ")", ";", "notificationDAO", ".", "updateNotification", "(", "notificationId", ",", "Notification", ".", "Status", ".", "DISMISSED", ...
this method is used to update the notification which is stored in the embedded db .
train
false
355
public static Element addChildElementNSValue(Element element,String childElementName,String childElementValue,Document document,String nameSpaceUrl){ Element newElement=document.createElementNS(nameSpaceUrl,childElementName); newElement.appendChild(document.createTextNode(childElementValue)); element.appendChild(...
[ "public", "static", "Element", "addChildElementNSValue", "(", "Element", "element", ",", "String", "childElementName", ",", "String", "childElementValue", ",", "Document", "document", ",", "String", "nameSpaceUrl", ")", "{", "Element", "newElement", "=", "document", ...
creates a child element with the given namespace supportive name and appends it to the element child node list . also creates a text node with the given value and appends it to the new elements child node list .
train
false
358
public void loadDataset(URL url,IRI context,ParserConfig config) throws RepositoryException { try { Long since=lastModified.get(url); URLConnection urlCon=url.openConnection(); if (since != null) { urlCon.setIfModifiedSince(since); } if (since == null || since < urlCon.getLastModified()) { ...
[ "public", "void", "loadDataset", "(", "URL", "url", ",", "IRI", "context", ",", "ParserConfig", "config", ")", "throws", "RepositoryException", "{", "try", "{", "Long", "since", "=", "lastModified", ".", "get", "(", "url", ")", ";", "URLConnection", "urlCon"...
inspects if the dataset at the supplied url location has been modified since the last load into this repository and if so loads it into the supplied context .
train
false
359
protected int read(InputStream inputStream,byte[] buffer,char[] divider) throws IOException { int index=0; int dividerIndex=0; do { byte readByte=(byte)(0x000000FF & inputStream.read()); if (readByte == -1) { return index; } if (readByte == divider[dividerIndex]) { dividerIndex++; ...
[ "protected", "int", "read", "(", "InputStream", "inputStream", ",", "byte", "[", "]", "buffer", ",", "char", "[", "]", "divider", ")", "throws", "IOException", "{", "int", "index", "=", "0", ";", "int", "dividerIndex", "=", "0", ";", "do", "{", "byte",...
reads bytes from a given file reader until either a specified character sequence is read , the buffer is completely filled or the end of file is reached .
train
false
360
public void testNodeDocumentFragmentNormalize1() throws Throwable { Document doc; DocumentFragment docFragment; String nodeValue; Text txtNode; Node retval; doc=(Document)load("hc_staff",builder); docFragment=doc.createDocumentFragment(); txtNode=doc.createTextNode("foo"); retval=docFragment.appendChi...
[ "public", "void", "testNodeDocumentFragmentNormalize1", "(", ")", "throws", "Throwable", "{", "Document", "doc", ";", "DocumentFragment", "docFragment", ";", "String", "nodeValue", ";", "Text", "txtNode", ";", "Node", "retval", ";", "doc", "=", "(", "Document", ...
runs the test case .
train
false
361
private void collectTimes(Tree tree,NodeRef node,Set<NodeRef> excludeNodesBelow,Intervals intervals){ intervals.addCoalescentEvent(tree.getNodeHeight(node)); for (int i=0; i < tree.getChildCount(node); i++) { NodeRef child=tree.getChild(node,i); boolean include=true; if (excludeNodesBelow != null && exc...
[ "private", "void", "collectTimes", "(", "Tree", "tree", ",", "NodeRef", "node", ",", "Set", "<", "NodeRef", ">", "excludeNodesBelow", ",", "Intervals", "intervals", ")", "{", "intervals", ".", "addCoalescentEvent", "(", "tree", ".", "getNodeHeight", "(", "node...
extract coalescent times and tip information into arraylist times from tree .
train
false
363
public void makeImmutable(){ mutable=false; if (authnContextClassRef != null) { authnContextClassRef=Collections.unmodifiableList(authnContextClassRef); } if (authnContextDeclRef != null) { authnContextDeclRef=Collections.unmodifiableList(authnContextDeclRef); } return; }
[ "public", "void", "makeImmutable", "(", ")", "{", "mutable", "=", "false", ";", "if", "(", "authnContextClassRef", "!=", "null", ")", "{", "authnContextClassRef", "=", "Collections", ".", "unmodifiableList", "(", "authnContextClassRef", ")", ";", "}", "if", "(...
makes the obejct immutable
train
false
364
protected abstract int readSkipData(int level,IndexInput skipStream) throws IOException ;
[ "protected", "abstract", "int", "readSkipData", "(", "int", "level", ",", "IndexInput", "skipStream", ")", "throws", "IOException", ";" ]
subclasses must implement the actual skip data encoding in this method .
train
false
366
protected TamsMessage pollMessage(){ if (disablePoll) { return null; } if (!pollQueue.isEmpty()) { PollMessage pm=pollQueue.peek(); if (pm != null) { tm=pm.getMessage(); return pm.getMessage(); } } return null; }
[ "protected", "TamsMessage", "pollMessage", "(", ")", "{", "if", "(", "disablePoll", ")", "{", "return", "null", ";", "}", "if", "(", "!", "pollQueue", ".", "isEmpty", "(", ")", ")", "{", "PollMessage", "pm", "=", "pollQueue", ".", "peek", "(", ")", "...
check tams mc for status updates
train
false
367
public Path bin(){ return root.resolve("bin"); }
[ "public", "Path", "bin", "(", ")", "{", "return", "root", ".", "resolve", "(", "\"bin\"", ")", ";", "}" ]
gets the bin directory .
train
false
368
public static void safeCopy(final Reader reader,final Writer writer) throws IOException { try { IOUtils.copy(reader,writer); } finally { IOUtils.closeQuietly(reader); IOUtils.closeQuietly(writer); } }
[ "public", "static", "void", "safeCopy", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "try", "{", "IOUtils", ".", "copy", "(", "reader", ",", "writer", ")", ";", "}", "finally", "{", "IOUtils", "."...
copy and close the reader and writer streams .
train
true
369
public static <T extends Bean>T load(Bson query,T t){ String collection=getCollection(t.getClass()); if (collection != null) { try { return load(query,null,t); } catch ( Exception e) { if (log.isErrorEnabled()) log.error(e.getMessage(),e); } } return null; }
[ "public", "static", "<", "T", "extends", "Bean", ">", "T", "load", "(", "Bson", "query", ",", "T", "t", ")", "{", "String", "collection", "=", "getCollection", "(", "t", ".", "getClass", "(", ")", ")", ";", "if", "(", "collection", "!=", "null", ")...
load the data full into the t .
train
false
370
private PrintElement createImageElement(MPrintFormatItem item){ Object obj=m_data.getNode(new Integer(item.getAD_Column_ID())); if (obj == null) return null; else if (obj instanceof PrintDataElement) ; else { log.log(Level.SEVERE,"Element not PrintDataElement " + obj.getClass()); return null; } ...
[ "private", "PrintElement", "createImageElement", "(", "MPrintFormatItem", "item", ")", "{", "Object", "obj", "=", "m_data", ".", "getNode", "(", "new", "Integer", "(", "item", ".", "getAD_Column_ID", "(", ")", ")", ")", ";", "if", "(", "obj", "==", "null",...
create image element from item
train
false
371
public void resetCharges(){ pendingCharges.removeAllElements(); }
[ "public", "void", "resetCharges", "(", ")", "{", "pendingCharges", ".", "removeAllElements", "(", ")", ";", "}" ]
resets the pending charges list .
train
false
372
static RepaintManager currentManager(AppContext appContext){ RepaintManager rm=(RepaintManager)appContext.get(repaintManagerKey); if (rm == null) { rm=new RepaintManager(BUFFER_STRATEGY_TYPE); appContext.put(repaintManagerKey,rm); } return rm; }
[ "static", "RepaintManager", "currentManager", "(", "AppContext", "appContext", ")", "{", "RepaintManager", "rm", "=", "(", "RepaintManager", ")", "appContext", ".", "get", "(", "repaintManagerKey", ")", ";", "if", "(", "rm", "==", "null", ")", "{", "rm", "="...
returns the repaintmanager for the specified appcontext . if a repaintmanager has not been created for the specified appcontext this will return null .
train
false
373
public static void paintCheckedBackground(Component c,Graphics g,int x,int y,int width,int height){ if (backgroundImage == null) { backgroundImage=new BufferedImage(64,64,BufferedImage.TYPE_INT_ARGB); Graphics bg=backgroundImage.createGraphics(); for (int by=0; by < 64; by+=8) { for (int bx=0; bx < ...
[ "public", "static", "void", "paintCheckedBackground", "(", "Component", "c", ",", "Graphics", "g", ",", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ")", "{", "if", "(", "backgroundImage", "==", "null", ")", "{", "backgroundIma...
paint a check pattern , used for a background to indicate image transparency .
train
true
374
public int decrement(){ lock.lock(); int newValue=--value; lock.unlock(); return newValue; }
[ "public", "int", "decrement", "(", ")", "{", "lock", ".", "lock", "(", ")", ";", "int", "newValue", "=", "--", "value", ";", "lock", ".", "unlock", "(", ")", ";", "return", "newValue", ";", "}" ]
decrements the counter by 1 .
train
false
375
private void addPoint(Point p){ Coordinate coord=p.getCoordinate(); insertPoint(argIndex,coord,Location.INTERIOR); }
[ "private", "void", "addPoint", "(", "Point", "p", ")", "{", "Coordinate", "coord", "=", "p", ".", "getCoordinate", "(", ")", ";", "insertPoint", "(", "argIndex", ",", "coord", ",", "Location", ".", "INTERIOR", ")", ";", "}" ]
add a point to the graph .
train
false
378
private static void skipArray(ByteBuffer buf){ int length=buf.getShort() & 0xFFFF; for (int i=0; i < length; i++) skipMemberValue(buf); }
[ "private", "static", "void", "skipArray", "(", "ByteBuffer", "buf", ")", "{", "int", "length", "=", "buf", ".", "getShort", "(", ")", "&", "0xFFFF", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "skipMemberVal...
skips the array value at the current position in the specified byte buffer . the cursor of the byte buffer must point to an array value struct .
train
false
379
public static byte[] hash(byte[] input){ if (input != null) { final MessageDigest digest; try { digest=MessageDigest.getInstance("SHA-256"); byte[] hashedBytes=input; digest.update(hashedBytes,0,hashedBytes.length); return hashedBytes; } catch ( NoSuchAlgorithmException e) { ...
[ "public", "static", "byte", "[", "]", "hash", "(", "byte", "[", "]", "input", ")", "{", "if", "(", "input", "!=", "null", ")", "{", "final", "MessageDigest", "digest", ";", "try", "{", "digest", "=", "MessageDigest", ".", "getInstance", "(", "\"SHA-256...
created sha256 of input
train
false
380
private void reopen(){ Timeline animation=new Timeline(new KeyFrame(Duration.seconds(0.1),new KeyValue(inputs.prefHeightProperty(),inputs.getMaxHeight()))); animation.play(); }
[ "private", "void", "reopen", "(", ")", "{", "Timeline", "animation", "=", "new", "Timeline", "(", "new", "KeyFrame", "(", "Duration", ".", "seconds", "(", "0.1", ")", ",", "new", "KeyValue", "(", "inputs", ".", "prefHeightProperty", "(", ")", ",", "input...
makes an animation to make the input vbox slide open over . 1 seconds
train
false
384
public XmlDom(InputStream is) throws SAXException { DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance(); DocumentBuilder builder; try { builder=factory.newDocumentBuilder(); Document doc=builder.parse(is); this.root=(Element)doc.getDocumentElement(); } catch ( ParserConfigurationEx...
[ "public", "XmlDom", "(", "InputStream", "is", ")", "throws", "SAXException", "{", "DocumentBuilderFactory", "factory", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ")", ";", "DocumentBuilder", "builder", ";", "try", "{", "builder", "=", "factory", ".", ...
instantiates a new xml dom .
train
false
385
public void removeKeyListener(GlobalKeyListener listener){ listeners.remove(listener); }
[ "public", "void", "removeKeyListener", "(", "GlobalKeyListener", "listener", ")", "{", "listeners", ".", "remove", "(", "listener", ")", ";", "}" ]
removes a global key listener
train
false
386
public Set search3(String tokenID,String startDN,String filter,int numOfEntries,int timeLimit,boolean sortResults,boolean ascendingOrder,Set excludes) throws SMSException, SSOException, RemoteException { initialize(); if (debug.messageEnabled()) { debug.message("SMSJAXRPCObjectImpl::search dn: " + startDN + " f...
[ "public", "Set", "search3", "(", "String", "tokenID", ",", "String", "startDN", ",", "String", "filter", ",", "int", "numOfEntries", ",", "int", "timeLimit", ",", "boolean", "sortResults", ",", "boolean", "ascendingOrder", ",", "Set", "excludes", ")", "throws"...
searches the data store for objects that match the filter with an exclude set
train
false
387
private Resource generatePreviewResource(Resource resource,Eml eml,BigDecimal nextVersion){ Resource copy=new Resource(); copy.setShortname(resource.getShortname()); copy.setTitle(resource.getTitle()); copy.setLastPublished(resource.getLastPublished()); copy.setStatus(resource.getStatus()); copy.setOrganisa...
[ "private", "Resource", "generatePreviewResource", "(", "Resource", "resource", ",", "Eml", "eml", ",", "BigDecimal", "nextVersion", ")", "{", "Resource", "copy", "=", "new", "Resource", "(", ")", ";", "copy", ".", "setShortname", "(", "resource", ".", "getShor...
generate a copy of the resource , previewing what the next publication of the resource will look like . this involves copying over certain fields not in eml , and then setting the version equal to next published version , and setting a new pubdate .
train
false
389
void closeStream(Closeable closeable){ try { if (closeable != null) { closeable.close(); } } catch ( IOException ex) { utils.logIssue("Could not close exception storage file.",ex); } }
[ "void", "closeStream", "(", "Closeable", "closeable", ")", "{", "try", "{", "if", "(", "closeable", "!=", "null", ")", "{", "closeable", ".", "close", "(", ")", ";", "}", "}", "catch", "(", "IOException", "ex", ")", "{", "utils", ".", "logIssue", "("...
attempt to close given fileinputstream . checks for null . exceptions are logged .
train
false
391
public void testFromDate() throws Exception { TimeZone.setDefault(TimeZone.getTimeZone("PST")); final Calendar date=Calendar.getInstance(); date.setTime(new Date(123456789012345L)); Assert.assertEquals("5882-03-11T00:30:12.345Z",CalendarSerializer.serialize(date)); final Calendar dateNoMillis=Calendar.getInst...
[ "public", "void", "testFromDate", "(", ")", "throws", "Exception", "{", "TimeZone", ".", "setDefault", "(", "TimeZone", ".", "getTimeZone", "(", "\"PST\"", ")", ")", ";", "final", "Calendar", "date", "=", "Calendar", ".", "getInstance", "(", ")", ";", "dat...
make sure that dates with and without millis can be converted properly into strings
train
false
393
@Override public boolean eIsSet(int featureID){ switch (featureID) { case EipPackage.METADATA__KEY: return KEY_EDEFAULT == null ? key != null : !KEY_EDEFAULT.equals(key); case EipPackage.METADATA__VALUES: return values != null && !values.isEmpty(); } return super.eIsSet(featureID); }
[ "@", "Override", "public", "boolean", "eIsSet", "(", "int", "featureID", ")", "{", "switch", "(", "featureID", ")", "{", "case", "EipPackage", ".", "METADATA__KEY", ":", "return", "KEY_EDEFAULT", "==", "null", "?", "key", "!=", "null", ":", "!", "KEY_EDEFA...
< ! - - begin - user - doc - - > < ! - - end - user - doc - - >
train
false
395
@Override public boolean isModified(){ if (_isDigestModified) { if (log.isLoggable(Level.FINE)) log.fine(_source.getNativePath() + " digest is modified."); return true; } long sourceLastModified=_source.getLastModified(); long sourceLength=_source.length(); if (!_requireSource && sourceLastModifie...
[ "@", "Override", "public", "boolean", "isModified", "(", ")", "{", "if", "(", "_isDigestModified", ")", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "_source", ".", "getNativePath", "(", ")", ...
if the source modified date changes at all , treat it as a modification . this protects against the case where multiple computers have misaligned dates and a ' < ' comparison may fail .
train
true
396
public byte[] toByteArray(){ int totalLen=_pastLen + _currBlockPtr; if (totalLen == 0) { return NO_BYTES; } byte[] result=new byte[totalLen]; int offset=0; for ( byte[] block : _pastBlocks) { int len=block.length; System.arraycopy(block,0,result,offset,len); offset+=len; } System.arrayc...
[ "public", "byte", "[", "]", "toByteArray", "(", ")", "{", "int", "totalLen", "=", "_pastLen", "+", "_currBlockPtr", ";", "if", "(", "totalLen", "==", "0", ")", "{", "return", "NO_BYTES", ";", "}", "byte", "[", "]", "result", "=", "new", "byte", "[", ...
method called when results are finalized and we can get the full aggregated result buffer to return to the caller
train
false
397
public CommandEditor(ActionCommand cmd,EditableResources res,String uiName,List<com.codename1.ui.Command> commands,Properties projectGeneratorSettings,boolean java5){ this.java5=java5; this.projectGeneratorSettings=projectGeneratorSettings; this.uiName=uiName; initComponents(); goToSource.setEnabled(projectGe...
[ "public", "CommandEditor", "(", "ActionCommand", "cmd", ",", "EditableResources", "res", ",", "String", "uiName", ",", "List", "<", "com", ".", "codename1", ".", "ui", ".", "Command", ">", "commands", ",", "Properties", "projectGeneratorSettings", ",", "boolean"...
creates new form commandeditor
train
false