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); configuration.setDatabaseSchemaUpdate(getActivitiDbSchemaUpdateParamBeanName()); configuration.setAsyncExecutorActivate(true); configuration.setAsyncExecutorEnabled(true); configuration.setAsyncExecutor(activitiAsyncExecutor); configuration.setBeans(new HashMap<>()); configuration.setDelegateInterceptor(herdDelegateInterceptor); configuration.setCommandInvoker(herdCommandInvoker); initScriptingEngines(configuration); configuration.setMailServerDefaultFrom(configurationHelper.getProperty(ConfigurationValue.ACTIVITI_DEFAULT_MAIL_FROM)); List<ProcessEngineConfigurator> herdConfigurators=new ArrayList<>(); herdConfigurators.add(herdProcessEngineConfigurator); configuration.setConfigurators(herdConfigurators); return configuration; }
[ "@", "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 Iterator<AbstractTask<T>> titr=tasks.iterator(); for ( Future<? extends Object> f : futures) { final AbstractTask<T> task=titr.next(); getFutureForTask(f,task,0L,TimeUnit.NANOSECONDS); } } finally { } }
[ "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+=interpolate((deltaScore > 0) ? bM : wM,0,30 * deltaScore / 100,qV + 2 * rV + 2 * bV + 2 * nV,0); return pBonus; }
[ "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<URI> tenantUris=_permissionsHelper.getUsageURIsFromAcls(vcenter.getAcls()); if (CollectionUtils.isEmpty(tenantUris)) { continue; } if (!NullColumnValueGetter.isNullURI(tenantId) && !tenantUris.contains(tenantId)) { continue; } Iterator<URI> tenantUriIt=tenantUris.iterator(); while (tenantUriIt.hasNext()) { if (verifyAuthorizedInTenantOrg(tenantUriIt.next())) { tenantVcenterList.add(vcenter); } } } return tenantVcenterList; }
[ "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))); } return valueList; }
[ "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 (!pomContent.contains(DEP_END_TAG)) { throw new IOException(String.format("File '%s' doesn't contain '%s'. Can't process file.",CLIENT_POM,DEP_END_TAG)); } pomContent=pomContent.replace(DEP_END_TAG,depString + DEP_END_TAG); writeFileContent(pomContent,pom); }
[ "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 top=owner.inputStackTop + outputStackTop; if (top > owner.outputStackMax) { owner.outputStackMax=top; } }
[ "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,bimg); bytesize+=bimg.length; bytemapAccessQueue.addLast(uri); } addToImageCache(uri,img); }
[ "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.forUri(ns.uri); localName=qname.substring(colon + 1); } return new AttribKey(el,ns,localName); }
[ "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 generalConfig=getGeneralConfig.byConigGroupAndKey(configGroup,key); if (generalConfig.getRequired() == 2) { restWrapper=new RestWrapper("Object with specified config_group and key not found",RestWrapper.ERROR); } else { restWrapper=new RestWrapper(generalConfig,RestWrapper.OK); LOGGER.info("Record with config group: " + configGroup + " and key:"+ key+ "selected from General Config by User:"+ principal.getName()); } return restWrapper; }
[ "@", "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 textColor=tv.getTextColors(); if (textColor != null) { final int enabledColor=textColor.getColorForState(ENABLED_STATE_SET,0); p.setColor(enabledColor); } return textColor; }
[ "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 acts as just sort of a " launcher " process that terminates quickly , and the actual flash player is in some other process . for example , on mac , we often invoke the " open " program to open a web browser ; and on windows , if you launch firefox . exe but it detects that there is already a running instance of firefox . exe , the new instance will just pass a message to the old instance , and then the new instance will terminate .
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 ( IOException e) { throw new ElasticsearchGenerationException("Failed to generate [" + filter + "]",e); } }
[ "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++) { if (rawData[i] == '<') { inToken=true; if (rawData[i + 1] == 'S' && rawData[i + 2] == 'p' && rawData[i + 3] == 'a' && rawData[i + 4] == 'c' && rawData[i + 5] == 'e') { rawData[ptr]='\t'; ptr++; } } else if (rawData[i] == '>') { inToken=false; } else if (!inToken) { rawData[ptr]=rawData[i]; ptr++; } } final byte[] cleanedString=new byte[ptr]; System.arraycopy(rawData,0,cleanedString,0,ptr); output_data=new StringBuffer(new String(cleanedString)); } else { output_data=new StringBuffer(input); } return output_data.toString(); }
[ "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 to parse key"); } }
[ "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 - dy)); } if (center.y + dy < menuBounds.bottom) { intersectPoints.add(new Point(menuBounds.left,center.y + dy)); } } if (center.y - menuBounds.top < expandedRadius) { int dx=(int)Math.sqrt(Math.pow(expandedRadius,2) - Math.pow(center.y - menuBounds.top,2)); if (center.x + dx < menuBounds.right) { intersectPoints.add(new Point(center.x + dx,menuBounds.top)); } if (center.x - dx > menuBounds.left) { intersectPoints.add(new Point(center.x - dx,menuBounds.top)); } } if (menuBounds.right - center.x < expandedRadius) { int dy=(int)Math.sqrt(Math.pow(expandedRadius,2) - Math.pow(menuBounds.right - center.x,2)); if (center.y - dy > menuBounds.top) { intersectPoints.add(new Point(menuBounds.right,center.y - dy)); } if (center.y + dy < menuBounds.bottom) { intersectPoints.add(new Point(menuBounds.right,center.y + dy)); } } if (menuBounds.bottom - center.y < expandedRadius) { int dx=(int)Math.sqrt(Math.pow(expandedRadius,2) - Math.pow(menuBounds.bottom - center.y,2)); if (center.x + dx < menuBounds.right) { intersectPoints.add(new Point(center.x + dx,menuBounds.bottom)); } if (center.x - dx > menuBounds.left) { intersectPoints.add(new Point(center.x - dx,menuBounds.bottom)); } } int size=intersectPoints.size(); if (size == 0) { fromAngle=0; toAngle=360; return; } int indexA=size - 1; double maxAngle=arcAngle(center,intersectPoints.get(0),intersectPoints.get(indexA),menuBounds,expandedRadius); for (int i=0; i < size - 1; i++) { Point a=intersectPoints.get(i); Point b=intersectPoints.get(i + 1); double angle=arcAngle(center,a,b,menuBounds,expandedRadius); Point midnormalPoint=findMidnormalPoint(center,a,b,menuBounds,expandedRadius); int pointerIndex=i; int endIndex=indexA + 1; if (!isClockwise(center,a,midnormalPoint)) { int tmpIndex=pointerIndex; pointerIndex=endIndex; endIndex=tmpIndex; } if (pointerIndex == intersectPoints.size() - 1) { pointerIndex=0; } else { pointerIndex++; } if (pointerIndex == endIndex && angle > maxAngle) { indexA=i; maxAngle=angle; } } Point a=intersectPoints.get(indexA); Point b=intersectPoints.get(indexA + 1 >= size ? 0 : indexA + 1); Point midnormalPoint=findMidnormalPoint(center,a,b,menuBounds,expandedRadius); Point x=new Point(menuBounds.right,center.y); if (!isClockwise(center,a,midnormalPoint)) { Point tmp=a; a=b; b=tmp; } fromAngle=pointAngleOnCircle(center,a,x); toAngle=pointAngleOnCircle(center,b,x); toAngle=toAngle <= fromAngle ? 360 + toAngle : toAngle; }
[ "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(); } BucketProfileUpdateMessage m=new BucketProfileUpdateMessage(recipients,prId,procId,bucketId,bp); dm.putOutgoing(m); return rp; }
[ "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(">",ESC_GREATER_THAN); text=text.replace("\u0000"," "); return text; }
[ "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); @SuppressWarnings("unused") StateSetTreeList validationStateSetTrees=new StateSetTreeList(validationTrees,nSub,true,tagNumberer); StateSetTreeList.initializeTagNumberer(trainTrees,tagNumberer); StateSetTreeList.initializeTagNumberer(validationTrees,tagNumberer); short numStates=(short)tagNumberer.total(); short[] nSubStateArray=new short[numStates]; Arrays.fill(nSubStateArray,nSubStates); nSubStateArray[0]=1; return nSubStateArray; }
[ "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,null,width,height),0,0,null); }
[ "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|=(b & 0x7f) << s; if (b >= 0) { break; } } return 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) { logger.error("Error shutting down local JMX server: ",e); } } }
[ "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 HotSpotCompilationRequest(method,entryBCI,0L); boolean useProfilingInfo=false; boolean installAsDefault=false; CompilationTask task=new CompilationTask(jvmciRuntime,compiler,request,useProfilingInfo,installAsDefault); task.runCompilation(); HotSpotInstalledCode installedCode=task.getInstalledCode(); if (installedCode != null) { installedCode.invalidate(); } memoryUsed.getAndAdd(MemUseTrackerImpl.getCurrentThreadAllocatedBytes() - allocatedAtStart); compileTime.getAndAdd(System.currentTimeMillis() - start); compiledMethodsCounter.incrementAndGet(); } catch ( Throwable t) { println("CompileTheWorld (%d) : Error compiling method: %s",counter,method.format("%H.%n(%p):%r")); printStackTrace(t); } }
[ "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(); } catch ( Exception e) { e.printStackTrace(); throw new RuntimeException(e); } }
[ "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.getCentroidCoordinates(0),exampleValues); int nearestIndex=0; int id=0; for ( Centroid cr : model.getCentroids()) { double distance=measure.calculateDistance(cr.getCentroid(),exampleValues); if (distance < nearestDistance) { nearestDistance=distance; nearestIndex=id; } id++; } centroidAssignments[i]=nearestIndex; i++; } model.setClusterAssignments(centroidAssignments,exampleSet); return model; }
[ "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)file.length()]; dis.readFully(keyBytes); dis.close(); PKCS8EncodedKeySpec keySpec=new PKCS8EncodedKeySpec(keyBytes); KeyFactory keyFactory=KeyFactory.getInstance("RSA"); privateKey=keyFactory.generatePrivate(keySpec); certificate.setPrivateKey(privateKey); setCertificateTree(); setStatus("Private Key imported."); } catch ( IOException|NoSuchAlgorithmException|InvalidKeySpecException e) { setStatus("Error importing private Key. (" + e.getMessage() + ")"); e.printStackTrace(); } catch ( Exception e) { setStatus("Error (" + e.getMessage() + ")"); } }
[ "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(); modifiedObjects=edit.getAffectedObjects(); if (edit.isSignificant()) { fireEvent(new mxEventObject(mxEvent.UNDO,"edit",edit)); done=true; } } } return modifiedObjects; }
[ "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 - 1 && lastPosition != pointsNumber) { int offset=lastPosition - pointsNumber - 1; float[] pointsF=getArrayFloat(points.subList(0,offset)); lastPosition=pointsNumber - 1; canvas.drawPoints(pointsF,paint); } if (firstPosition < 0) { int offset=Math.abs(firstPosition); float[] pointsF=getArrayFloat(points.subList((pointsNumber - 1) - offset,pointsNumber - 1)); canvas.drawPoints(pointsF,paint); firstPosition=0; } float[] pointsF=getArrayFloat(points.subList(firstPosition,lastPosition)); canvas.drawPoints(pointsF,paint); }
[ "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(mConvertSessionId,buf); } else { convertedStatus=mDrmClient.convertData(mConvertSessionId,inBuffer); } if (convertedStatus != null && convertedStatus.statusCode == DrmConvertedStatus.STATUS_OK && convertedStatus.convertedData != null) { result=convertedStatus.convertedData; } } catch ( IllegalArgumentException e) { Log.w(TAG,"Buffer with data to convert is illegal. Convertsession: " + mConvertSessionId,e); } catch ( IllegalStateException e) { Log.w(TAG,"Could not convert data. Convertsession: " + mConvertSessionId,e); } } else { throw new IllegalArgumentException("Parameter inBuffer is null"); } return result; }
[ "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\">\r\n"); writer.append("jQuery(document).ready(function() {\r\n"); writer.append("\tvar submitForm = $(\"form[name=" + hiddenFormName + "]\");\r\n"); writer.append("\tif (submitForm) {\r\n"); for ( ModelFormField rowSubmitField : rowSubmitFields) { writer.append("\t\tvar id = $(\"[id^=" + rowSubmitField.getCurrentContainerId(context) + "]\");\r\n"); writer.append("\t\t$(id).click(function(e) {\r\n"); writer.append("\t\te.preventDefault();\r\n"); makeHiddenFieldsForHiddenForm(writer); writer.append("\t\t\tsubmitForm.submit();\r\n"); writer.append("\t\t});\r\n"); } writer.append("\t} else {\r\n"); writer.append("\t\treturn false;\r\n"); writer.append("\t}\r\n"); writer.append("});\r\n"); writer.append("</script>\r\n"); } }
[ "@", "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 ( NoSuchAlgorithmException|InvalidAlgorithmParameterException ex) { throw new IOException(ex); } }
[ "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.setOffset(0); output.setTimeStamp(input.getTimeStamp()); output.setSequenceNumber(input.getSequenceNumber()); output.setVideoOrientation(input.getVideoOrientation()); output.setFormat(input.getFormat()); output.setFlags(input.getFlags()); return BUFFER_PROCESSED_OK; }
[ "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 == 0) ? i : startIndex; counter=(currentChar == '(') ? counter + 1 : counter; if (currentChar == ')') { endIndex=i; counter=counter - 1; } if (counter == 0 && startIndex != 0) { String filterString=metricString.substring(startIndex,endIndex + 1); finalString=finalString.replace(filterString,"-" + startIndex); mapper.put("-" + startIndex,filterString); startIndex=0; } } return finalString; }
[ "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(newElement); return element; }
[ "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()) { load(url,urlCon,context,config); } } catch ( RDFParseException e) { throw new RepositoryException(e); } catch ( IOException e) { throw new RepositoryException(e); } }
[ "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++; } if (dividerIndex == divider.length) { index-=dividerIndex - 1; for (int i=index; i < index + dividerIndex; i++) { if (i >= buffer.length) { break; } buffer[i]=0; } return index; } buffer[index]=readByte; index++; } while (index < buffer.length); return index; }
[ "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.appendChild(txtNode); txtNode=doc.createTextNode("bar"); retval=docFragment.appendChild(txtNode); docFragment.normalize(); txtNode=(Text)docFragment.getFirstChild(); nodeValue=txtNode.getNodeValue(); assertEquals("normalizedNodeValue","foobar",nodeValue); retval=txtNode.getNextSibling(); assertNull("singleChild",retval); }
[ "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 && excludeNodesBelow.contains(child)) { include=false; } if (!include || tree.isExternal(child)) { intervals.addSampleEvent(tree.getNodeHeight(child)); } else { collectTimes(tree,child,excludeNodesBelow,intervals); } } }
[ "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; } PrintDataElement data=(PrintDataElement)obj; if (data.isNull() && item.isSuppressNull()) return null; String url=data.getValueDisplay(m_format.getLanguage()); if ((url == null || url.length() == 0)) { if (item.isSuppressNull()) return null; else return null; } ImageElement element=null; if (data.getDisplayType() == DisplayType.Image) { element=ImageElement.get(data,url); } else { element=ImageElement.get(url); } return element; }
[ "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 < 64; bx+=8) { bg.setColor(((bx ^ by) & 8) != 0 ? Color.lightGray : Color.white); bg.fillRect(bx,by,8,8); } } bg.dispose(); } if (backgroundImage != null) { Shape saveClip=g.getClip(); Rectangle r=g.getClipBounds(); if (r == null) r=new Rectangle(c.getSize()); r=r.intersection(new Rectangle(x,y,width,height)); g.setClip(r); int w=backgroundImage.getWidth(); int h=backgroundImage.getHeight(); if (w != -1 && h != -1) { int x1=(r.x / w) * w; int y1=(r.y / h) * h; int x2=((r.x + r.width + w - 1) / w) * w; int y2=((r.y + r.height + h - 1) / h) * h; for (y=y1; y < y2; y+=h) for (x=x1; x < x2; x+=w) g.drawImage(backgroundImage,x,y,c); } g.setClip(saveClip); } }
[ "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) { Log.e(TAG,"problem hashing \"" + input + "\" "+ e.getMessage(),e); } } else { Log.w(TAG,"hash called with null input byte[]"); } return null; }
[ "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 ( ParserConfigurationException e) { } catch ( IOException e) { throw new SAXException(e); } }
[ "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 + " filter: "+ filter+ " excludes: "+ excludes); } Iterator i=SMSEntry.search(getToken(tokenID),startDN,filter,numOfEntries,timeLimit,sortResults,ascendingOrder,excludes); Set<String> result=new HashSet<String>(); while (i.hasNext()) { SMSDataEntry e=(SMSDataEntry)i.next(); try { result.add(e.toJSONString()); } catch ( JSONException ex) { debug.error("SMSJAXRPCObjectImpl::problem performing search dn: " + startDN + " filter: "+ filter+ " excludes: "+ excludes,ex); } } return result; }
[ "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.setOrganisation(resource.getOrganisation()); copy.setKey(resource.getKey()); copy.setEmlVersion(nextVersion); if (resource.isCitationAutoGenerated()) { Citation citation=new Citation(); URI homepage=cfg.getResourceVersionUri(resource.getShortname(),nextVersion); citation.setCitation(resource.generateResourceCitation(nextVersion,homepage)); eml.setCitation(citation); } Date releaseDate=new Date(); copy.setLastPublished(releaseDate); eml.setPubDate(releaseDate); copy.setEml(eml); List<VersionHistory> histories=Lists.newArrayList(); histories.addAll(resource.getVersionHistory()); copy.setVersionHistory(histories); VersionHistory history=new VersionHistory(nextVersion,releaseDate,PublicationStatus.PUBLIC); User modifiedBy=getCurrentUser(); if (modifiedBy != null) { history.setModifiedBy(modifiedBy); } if (resource.getDoi() != null && (resource.getIdentifierStatus() == IdentifierStatus.PUBLIC_PENDING_PUBLICATION || resource.getIdentifierStatus() == IdentifierStatus.PUBLIC)) { copy.setDoi(resource.getDoi()); copy.setIdentifierStatus(IdentifierStatus.PUBLIC); history.setDoi(resource.getDoi()); history.setStatus(IdentifierStatus.PUBLIC); } copy.addVersionHistory(history); return copy; }
[ "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.getInstance(); dateNoMillis.setTime(new Date(123456789012000L)); Assert.assertEquals("5882-03-11T00:30:12.000Z",CalendarSerializer.serialize(dateNoMillis)); }
[ "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 && sourceLastModified == 0) { return false; } else if (sourceLength != _length) { if (log.isLoggable(Level.FINE)) { log.fine(_source.getNativePath() + " length is modified (" + _length+ " -> "+ sourceLength+ ")"); } return true; } else if (sourceLastModified != _lastModified) { if (log.isLoggable(Level.FINE)) log.fine(_source.getNativePath() + " time is modified."); return true; } else return false; }
[ "@", "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.arraycopy(_currBlock,0,result,offset,_currBlockPtr); offset+=_currBlockPtr; if (offset != totalLen) { throw new RuntimeException("Internal error: total len assumed to be " + totalLen + ", copied "+ offset+ " bytes"); } if (!_pastBlocks.isEmpty()) { reset(); } return result; }
[ "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(projectGeneratorSettings != null); com.codename1.ui.Command[] existing=new com.codename1.ui.Command[commands.size() + 1]; existing[0]=null; for (int iter=1; iter < existing.length; iter++) { existing[iter]=commands.get(iter - 1); } Vector postActions=new Vector(); postActions.addElement("None"); Vector actions=new Vector(); actions.addElement("None"); actions.addElement("Minimize"); actions.addElement("Exit"); actions.addElement("Execute"); actions.addElement("Back"); backCommand.setSelected(cmd.isBackCommand()); String[] uiEntries=new String[res.getUIResourceNames().length]; System.arraycopy(res.getUIResourceNames(),0,uiEntries,0,uiEntries.length); Arrays.sort(uiEntries); for ( String uis : uiEntries) { if (!uiName.equals(uis)) { actions.addElement(uis); postActions.addElement(uis); } } action.setModel(new DefaultComboBoxModel(actions)); postAction.setModel(new DefaultComboBoxModel(postActions)); String a=cmd.getAction(); if (a != null) { if (a.startsWith("@")) { a=a.substring(1); asynchronous.setSelected(true); } else { if (a.startsWith("!")) { a=a.substring(1); String[] arr=a.split(";"); action.setSelectedItem(arr[0]); postAction.setSelectedItem(arr[1]); } else { if (a.startsWith("$")) { a=a.substring(1); } } } } action.setSelectedItem(a); name.setText(cmd.getCommandName()); id.setModel(new SpinnerNumberModel(cmd.getId(),-10000,Integer.MAX_VALUE,1)); ResourceEditorView.initImagesComboBox(icon,res,false,true); icon.setSelectedItem(cmd.getIcon()); ResourceEditorView.initImagesComboBox(rollover,res,false,true); rollover.setSelectedItem(cmd.getRolloverIcon()); ResourceEditorView.initImagesComboBox(pressed,res,false,true); pressed.setSelectedItem(cmd.getPressedIcon()); ResourceEditorView.initImagesComboBox(disabled,res,false,true); disabled.setSelectedItem(cmd.getDisabledIcon()); }
[ "public", "CommandEditor", "(", "ActionCommand", "cmd", ",", "EditableResources", "res", ",", "String", "uiName", ",", "List", "<", "com", ".", "codename1", ".", "ui", ".", "Command", ">", "commands", ",", "Properties", "projectGeneratorSettings", ",", "boolean"...
creates new form commandeditor
train
false