code
stringlengths
10
174k
nl
stringlengths
3
129k
public void deleteTag(int tagId,int ifdId){ mData.removeTag(getTrueTagKey(tagId),ifdId); }
Removes the ExifTag for a tag constant from the given IFD.
public static BoxDataSet serializableInstance(){ return new BoxDataSet(new ShortDataBox(4,4),null); }
Generates a simple exemplar of this class to test serialization.
@Override protected void onStart(){ super.onStart(); LOG.d(TAG,"Started the activity."); if (this.appView == null) { return; } this.appView.handleStart(); }
Called when the activity is becoming visible to the user.
@Override public boolean isCellEditable(int rowIndex,int columnIndex){ return false; }
returns true if the cell at rowindex and columnindexis editable.
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 13:01:12.877 -0500",hash_original_method="194E237603CA4A7D605DF99CBAD71850",hash_generated_method="7822E0FCF7BC1C60BED7C2F8679B7090") @Override public void closeOutbound(){ if (logger != null) { logger.println("closeOutbound() " + isOutboundDone); } if (isOutboundDone) { return; } isOutboundDone=true; if (handshake_started) { alertProtocol.alert(AlertProtocol.WARNING,AlertProtocol.CLOSE_NOTIFY); close_notify_was_sent=true; } else { shutdown(); } engine_was_closed=true; }
Closes outbound operations of this engine
public static byte[] ensureCapacity(byte[] array,int minCapacity){ int oldCapacity=array.length; byte[] newArray; if (minCapacity > oldCapacity) { int newCapacity=(oldCapacity * 3) / 2 + 1; if (newCapacity < minCapacity) { newCapacity=minCapacity; } newArray=new byte[newCapacity]; System.arraycopy(array,0,newArray,0,oldCapacity); } else { newArray=array; } return newArray; }
Ensures that a given array can hold up to <tt>minCapacity</tt> elements. Returns the identical array if it can hold at least the number of elements specified. Otherwise, returns a new array with increased capacity containing the same elements, ensuring that it can hold at least the number of elements specified by the minimum capacity argument.
public boolean isHighlighted(){ return this.highlighted; }
Is the tree highlighted? The tree is highlighted when the mouse is within the bounds of the containing frame.
public AlertInfoHeader createAlertInfoHeader(URI alertInfo){ if (alertInfo == null) throw new NullPointerException("null arg alertInfo"); AlertInfo a=new AlertInfo(); a.setAlertInfo(alertInfo); return a; }
Creates a new AlertInfoHeader based on the newly supplied alertInfo value.
@VisibleForTesting protected void doReplaceDoi(Resource resource,BigDecimal version,BigDecimal replacedVersion){ Preconditions.checkNotNull(resource); DOI doiToRegister=resource.getDoi(); DOI doiToReplace=resource.getAssignedDoi(); if (doiToRegister != null && resource.isPubliclyAvailable() && doiToReplace != null && resource.getEmlVersion() != null && resource.getEmlVersion().compareTo(version) == 0 && replacedVersion != null && resource.findVersionHistory(replacedVersion) != null) { doRegisterDoi(resource,doiToReplace); try { File replacedVersionEmlFile=dataDir.resourceEmlFile(resource.getShortname(),replacedVersion); Resource lastPublishedVersion=ResourceUtils.reconstructVersion(replacedVersion,resource.getShortname(),doiToReplace,resource.getOrganisation(),resource.findVersionHistory(replacedVersion),replacedVersionEmlFile,resource.getKey()); DataCiteMetadata assignedDoiMetadata=DataCiteMetadataBuilder.createDataCiteMetadata(doiToReplace,lastPublishedVersion); DataCiteMetadataBuilder.addIsPreviousVersionOfDOIRelatedIdentifier(assignedDoiMetadata,doiToRegister); URI resourceVersionUri=cfg.getResourceVersionUri(resource.getShortname(),replacedVersion); registrationManager.getDoiService().update(doiToReplace,resourceVersionUri); registrationManager.getDoiService().update(doiToReplace,assignedDoiMetadata); } catch ( InvalidMetadataException e) { String errorMsg="Failed to update " + doiToReplace.toString() + " metadata: "+ e.getMessage(); log.error(errorMsg); throw new PublicationException(PublicationException.TYPE.DOI,errorMsg,e); } catch ( DoiException e) { String errorMsg="Failed to update " + doiToReplace.toString() + ": "+ e.getMessage(); log.error(errorMsg); throw new PublicationException(PublicationException.TYPE.DOI,errorMsg,e); } catch ( IllegalArgumentException e) { String errorMsg="Failed to update " + doiToReplace.toString() + ": "+ e.getMessage(); log.error(errorMsg,e); throw new PublicationException(PublicationException.TYPE.DOI,errorMsg,e); } } else { throw new InvalidConfigException(TYPE.INVALID_DOI_REGISTRATION,"Resource not in required state to replace DOI!"); } }
Replace DOI currently assigned to resource with new DOI that has been reserved for resource. This corresponds to a new major version change.
public static QualifiedName parseQualifiedName(String value){ String[] parts=value.split(":"); UnsignedShort namespaceIndex=UnsignedShort.ZERO; String name=value; if (parts.length > 1) try { namespaceIndex=UnsignedShort.parseUnsignedShort(parts[0]); name=value.substring(parts[0].length() + 1); } catch ( NumberFormatException e) { } catch ( IllegalArgumentException e) { } return new QualifiedName(namespaceIndex,name); }
Parse the QualifiedName from a string. <p> The string is supposed to be in format "[NameSpaceIndex]:[Name]". or just "[Name]"
private static void checkInvokes(SootMethod m,Body b,FileWriter fw) throws Exception { StmtBody stmtBody=(StmtBody)b; Chain units=stmtBody.getUnits(); Iterator stmtIt=units.snapshotIterator(); while (stmtIt.hasNext()) { Stmt stmt=(Stmt)stmtIt.next(); if (!stmt.containsInvokeExpr()) { continue; } InvokeExpr expr=(InvokeExpr)stmt.getInvokeExpr(); InstanceInvokeExpr iie=SootUtils.getInstanceInvokeExpr(stmt); if (iie != null) { Collection<SootMethod> resolved=null; resolved=PTABridge.v().getTargetsInsNoContext(stmt); if (resolved == null || resolved.isEmpty()) { fw.write(String.format("No valid allocations for receiver of %s of type %s in %s (%s).\n\n",iie.getMethodRef(),iie.getBase().getType(),m,SootUtils.getSourceLocation(stmt,m.getDeclaringClass()))); AnalysisReport.v().addEntry("No valid allocations for receiver of method call.",stmt,AnalysisReport.Level.LOW); } } } }
Called by checkAllocations() above to check all invoke statements of a method. Checks virtual invokes on api objects to make sure that the receiver reference has something in its pta set.
public void warn(String trace){ printTrace(trace,WARN_LEVEL); }
Warning trace
public InterruptedException(){ }
Constructs an InterruptedException with no detail message.
private void convertData(){ m_traces=new ArrayList<Trace>(); for ( final TraceList trace : m_module.getContent().getTraceContainer().getTraces()) { m_traces.add(new Trace(trace)); } m_module.getContent().getTraceContainer().addListener(m_traceListener); m_functions=new ArrayList<Function>(); for ( final INaviFunction function : m_module.getContent().getFunctionContainer().getFunctions()) { m_functions.add(new Function(this,function)); } for ( final Function function : m_functions) { m_functionMap.put(function.getNative(),function); } m_views=new ArrayList<View>(); for ( final INaviView view : m_module.getContent().getViewContainer().getViews()) { m_views.add(new View(this,view,m_nodeTagManager,m_viewTagManager)); } createCallgraph(); }
Converts internal module data to API module data.
@Override public String generateURLFragment(String urlText){ return " href=\"" + urlText + "\""; }
Generates a URL string to go in an HTML image map.
public void onDrag(Interaction iact){ }
Notifies listener of a pointer drag (move) event.
protected boolean isAssignBucketsAllowed(final Cache cache){ return (isAssignBuckets() && (cache instanceof GemFireCacheImpl)); }
Determines whether the user indicated that buckets should be assigned on cache server start using the --assign-buckets command-line option (switch) at the command-line as well as whether the option is technically allowed. The option is only allowed if the instance of the Cache is the internal GemFireCacheImpl at present.
protected void addDeployables() throws Exception { for ( Deployable deployable : getConfiguration().getDeployables()) { if (deployable.getType() == DeployableType.WAR) { addHandler(createHandler(deployable)); } else { throw new ContainerException("Only WAR archives are supported for deployment in " + "Jetty. Got [" + deployable.getFile() + "]"); } } addHandler(createHandler("/cargocpc",new File(getConfiguration().getHome(),"cargocpc.war").getPath())); }
Add the cargo deployables and the Cargo Ping Check.
private Set<PersonUser> findPersonUsers(String tenantName,SearchCriteria criteria,int limit) throws Exception { try { ValidateUtil.validateNotEmpty(tenantName,"Tenant name"); ValidateUtil.validateNotNull(criteria,"Search criteria"); TenantInformation tenantInfo=findTenant(tenantName); ServerUtils.validateNotNullTenant(tenantInfo,tenantName); IIdentityProvider provider=tenantInfo.findProviderADAsFallBack(criteria.getDomain()); ServerUtils.validateNotNullIdp(provider,tenantName,criteria.getDomain()); return provider.findUsers(criteria.getSearchString(),criteria.getDomain(),limit); } catch ( Exception ex) { logger.error(String.format("Failed to find person users [Criteria : %s] in tenant [%s]",criteria,tenantName)); throw ex; } }
Finds regular users in one of the identity providers configured for the tenant. The search criteria defines the identity domain to be searched. A user account is chosen for the search results if the search string is part of either the account name, first name, last name, or description of the account. Regular expressions are not allowed in the search string at this time.
public String updateItem(String token,String itemUrl) throws MalformedURLException, IOException { return makeHttpRequest(token,itemUrl,NEW_DATA_ITEM,"PUT",HttpURLConnection.HTTP_OK); }
Updates <code>NEW_DATA_ITEM</code> by making a PUT request to <code>itemUrl</code>.
public static boolean deleteRecursively(File path){ boolean deleted=true; if (path.isDirectory()) { File[] files=path.listFiles(); for (int i=0; ((i < files.length) && deleted); i++) { if (files[i].isDirectory()) { deleted=deleteRecursively(files[i]); } else { deleted=files[i].delete(); } } deleted=deleted && path.delete(); } else { deleted=false; } return deleted; }
Deletes recursively a directory.
protected void updateSplashScreen(){ }
Does nothing.
@Override public void releaseWriter(){ writerLock.unlock(); }
Relinquishes exclusive write access to the Guacamole instruction stream. This function should be called whenever a thread finishes using a GuacamoleTunnel's GuacamoleWriter.
private void establecerElementosBusqueda(HttpServletRequest request){ String pFondoID=request.getParameter("fondo"); String pCodigo=request.getParameter("codigo"); String pTitulo=request.getParameter("tituloBuscar"); ServiceRepository services=ServiceRepository.getInstance(ServiceClient.create(getAppUser(request))); GestionSeriesBI serieBI=getGestionSeriesBI(request); List series=serieBI.findSeriesValorables(pFondoID,pCodigo,pTitulo); CollectionUtils.transform(series,SerieToPO.getInstance(services)); request.setAttribute(ValoracionConstants.LISTA_SERIES_KEY,series); }
Realiza la busqueda de las series segun el filtrado deseado estableciendo los elementos encontrados para mostrarlos en la vista
@RequestMapping(method=RequestMethod.POST) public HttpEntity<?> postProduct(@RequestBody Product input){ input=this.productRepository.save(input); HttpHeaders httpHeaders=new HttpHeaders(); httpHeaders.setLocation(linkTo(methodOn(Rest3Controller.class,input.getId()).getProduct(input.getId())).toUri()); return new ResponseEntity<>(httpHeaders,HttpStatus.CREATED); }
Return a product loaded from apache solr.
public IconDrawable(@NonNull Context context,@NonNull String iconKey){ this(context,new IconState(findValidIconForKey(iconKey))); }
Create an IconDrawable.
protected IRawStore reopenStore(final IRawStore store){ boolean closedForWrites=false; if (store.isReadOnly() && store instanceof Journal && ((Journal)store).getRootBlockView().getCloseTime() != 0L) { closedForWrites=true; } store.close(); final Properties properties=(Properties)getProperties().clone(); properties.setProperty(Options.CREATE_TEMP_FILE,"false"); final File file=store.getFile(); assertNotNull(file); properties.setProperty(Options.FILE,file.toString()); if (closedForWrites) { properties.setProperty(Options.READ_ONLY,"true"); } return new Journal(properties); }
Re-open the same backing store.
public boolean isStaticlyPolyfilled(N4MemberDeclaration element){ return isTaggedAs(Tag.staticlyPolyfilled,element); }
Tells if the given member was statically polyfilled.
public String invokeAPI(String path,String method,List<Pair> queryParams,Object body,Map<String,String> headerParams,Map<String,String> formParams,String accept,String contentType,String[] authNames) throws ApiException { updateParamsForAuth(authNames,queryParams,headerParams); Client client=getClient(); StringBuilder b=new StringBuilder(); b.append("?"); if (queryParams != null) { for ( Pair queryParam : queryParams) { if (!queryParam.getName().isEmpty()) { b.append(escapeString(queryParam.getName())); b.append("="); b.append(escapeString(queryParam.getValue())); b.append("&"); } } } String querystring=b.substring(0,b.length() - 1); Builder builder; if (accept == null) builder=client.resource(basePath + path + querystring).getRequestBuilder(); else builder=client.resource(basePath + path + querystring).accept(accept); for ( String key : headerParams.keySet()) { builder=builder.header(key,headerParams.get(key)); } for ( String key : defaultHeaderMap.keySet()) { if (!headerParams.containsKey(key)) { builder=builder.header(key,defaultHeaderMap.get(key)); } } ClientResponse response=null; if ("GET".equals(method)) { response=(ClientResponse)builder.get(ClientResponse.class); } else if ("POST".equals(method)) { if (contentType.startsWith("application/x-www-form-urlencoded")) { String encodedFormParams=this.getXWWWFormUrlencodedParams(formParams); response=builder.type(contentType).post(ClientResponse.class,encodedFormParams); } else if (body == null) { response=builder.post(ClientResponse.class,null); } else if (body instanceof FormDataMultiPart) { response=builder.type(contentType).post(ClientResponse.class,body); } else response=builder.type(contentType).post(ClientResponse.class,serialize(body)); } else if ("PUT".equals(method)) { if ("application/x-www-form-urlencoded".equals(contentType)) { String encodedFormParams=this.getXWWWFormUrlencodedParams(formParams); response=builder.type(contentType).put(ClientResponse.class,encodedFormParams); } else if (body == null) { response=builder.put(ClientResponse.class,serialize(body)); } else { response=builder.type(contentType).put(ClientResponse.class,serialize(body)); } } else if ("DELETE".equals(method)) { if ("application/x-www-form-urlencoded".equals(contentType)) { String encodedFormParams=this.getXWWWFormUrlencodedParams(formParams); response=builder.type(contentType).delete(ClientResponse.class,encodedFormParams); } else if (body == null) { response=builder.delete(ClientResponse.class); } else { response=builder.type(contentType).delete(ClientResponse.class,serialize(body)); } } else { throw new ApiException(500,"unknown method type " + method); } if (response.getStatusInfo() == ClientResponse.Status.NO_CONTENT) { return null; } else if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) { if (response.hasEntity()) { return (String)response.getEntity(String.class); } else { return ""; } } else { String message="error"; String respBody=null; if (response.hasEntity()) { try { respBody=String.valueOf(response.getEntity(String.class)); message=respBody; } catch ( RuntimeException e) { } } throw new ApiException(response.getStatusInfo().getStatusCode(),message,response.getHeaders(),respBody); } }
Invoke API by sending HTTP request with the given options.
public static void warpImageWithTransform(BufferedImage image,BufferedImage canvas,Matrix canvasToImageTransform){ if (image == null) { String message=Logging.getMessage("nullValue.ImageIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (canvas == null) { String message=Logging.getMessage("nullValue.CanvasIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (canvasToImageTransform == null) { String message=Logging.getMessage("nullValue.MatrixIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } int sourceWidth=image.getWidth(); int sourceHeight=image.getHeight(); int destWidth=canvas.getWidth(); int destHeight=canvas.getHeight(); for (int dy=0; dy < destHeight; dy++) { for (int dx=0; dx < destWidth; dx++) { Vec4 vec=new Vec4(dx,dy,1).transformBy3(canvasToImageTransform); if (vec.x >= 0 && vec.y >= 0 && vec.x <= (sourceWidth - 1) && vec.y <= (sourceHeight - 1)) { int x0=(int)Math.floor(vec.x); int x1=(int)Math.ceil(vec.x); double xf=vec.x - x0; int y0=(int)Math.floor(vec.y); int y1=(int)Math.ceil(vec.y); double yf=vec.y - y0; int color=interpolateColor(xf,yf,image.getRGB(x0,y0),image.getRGB(x1,y0),image.getRGB(x0,y1),image.getRGB(x1,y1)); canvas.setRGB(dx,dy,color); } } } }
Rasterizes the image into the canvas, given a transform that maps canvas coordinates to image coordinates.
public blink addElement(String hashcode,String element){ addElementToRegistry(hashcode,element); return (this); }
Adds an Element to the element.
public void addInvokevirtual(int clazz,String name,String desc){ add(INVOKEVIRTUAL); addIndex(constPool.addMethodrefInfo(clazz,name,desc)); growStack(Descriptor.dataSize(desc) - 1); }
Appends INVOKEVIRTUAL. <p>The specified method must not be an inherited method. It must be directly declared in the class specified by <code>clazz</code>.
public void testExportImportOneWithMarker_kml(){ testExportImportOneWithMarker(TrackFileFormat.KML); }
Tests export all as KML and import all KML when there is only one track and the track contains markers.
private boolean put(boolean isRoot,Vector names,int len,Object value){ if (len == 0) { if (isRoot) { if (rootValue != null) return false; rootValue=value; } else { if (otherValue != null) return false; otherValue=value; } return true; } else { Object name=names.elementAt(len - 1); ContextMap nestedMap=(ContextMap)nameTable.get(name); if (nestedMap == null) { nestedMap=new ContextMap(); nameTable.put(name,nestedMap); } return nestedMap.put(isRoot,names,len - 1,value); } }
Adds a single path (isRoot, names) and a mode to be used for this path = context.
@Override public void eSet(int featureID,Object newValue){ switch (featureID) { case SexecPackage.SCHEDULE_TIME_EVENT__TIME_EVENT: setTimeEvent((TimeEvent)newValue); return; case SexecPackage.SCHEDULE_TIME_EVENT__TIME_VALUE: setTimeValue((Expression)newValue); return; } super.eSet(featureID,newValue); }
<!-- begin-user-doc --> <!-- end-user-doc -->
private boolean checkTerminateStagingTrack(Track terminateStageTrack){ if (!terminateStageTrack.acceptsDropTrain(_train)) { addLine(_buildReport,FIVE,MessageFormat.format(Bundle.getMessage("buildStagingNotTrain"),new Object[]{terminateStageTrack.getName()})); return false; } if (((!Setup.isBuildAggressive() || !Setup.isStagingTrackImmediatelyAvail()) && terminateStageTrack.getNumberRS() != 0) || terminateStageTrack.getNumberRS() != terminateStageTrack.getPickupRS()) { addLine(_buildReport,FIVE,MessageFormat.format(Bundle.getMessage("buildStagingTrackOccupied"),new Object[]{terminateStageTrack.getName(),terminateStageTrack.getNumberEngines(),terminateStageTrack.getNumberCars()})); return false; } if (terminateStageTrack.getDropRS() != 0) { addLine(_buildReport,FIVE,MessageFormat.format(Bundle.getMessage("buildStagingTrackReserved"),new Object[]{terminateStageTrack.getName(),terminateStageTrack.getDropRS()})); return false; } if (terminateStageTrack.getPickupRS() > 0) { addLine(_buildReport,FIVE,MessageFormat.format(Bundle.getMessage("buildStagingTrackDepart"),new Object[]{terminateStageTrack.getName()})); } if (terminateStageTrack.getDropOption().equals(Track.TRAINS) || terminateStageTrack.getDropOption().equals(Track.ROUTES)) { addLine(_buildReport,SEVEN,MessageFormat.format(Bundle.getMessage("buildTrainCanTerminateTrack"),new Object[]{_train.getName(),terminateStageTrack.getName()})); return true; } if (!Setup.isTrainIntoStagingCheckEnabled()) { addLine(_buildReport,SEVEN,MessageFormat.format(Bundle.getMessage("buildTrainCanTerminateTrack"),new Object[]{_train.getName(),terminateStageTrack.getName()})); return true; } if (!checkTerminateStagingTrackRestrictions(terminateStageTrack)) { addLine(_buildReport,SEVEN,Bundle.getMessage("buildOptionRestrictStaging")); return false; } return true; }
Checks to see if staging track can accept train.
public DiscussionObject(DiscussionObject parent){ this.id=parent.getId(); this.projectId=parent.getProjectId(); this.subject=parent.getSubject(); this.content=parent.getContent(); this.creatorId=parent.getCreatorId(); this.deleted=parent.getDeleted(); this.created=parent.getCreated(); this.updated=parent.getUpdated(); this.bcId=parent.getBcId(); this.creatorName=parent.getCreatorName(); this.companyId=parent.getCompanyId(); this.creatorAvatar=parent.getCreatorAvatar(); }
This method was generated by MyBatis Generator. This method corresponds to the database table discussion
public void animate(MarkerWithPosition marker,LatLng from,LatLng to){ lock.lock(); mAnimationTasks.add(new AnimationTask(marker,from,to)); lock.unlock(); }
Animates a markerWithPosition some time in the future.
public void updateInventory(UpdateInventory update) throws Exception { Thread.sleep(100); LOG.info("Inventory " + update.getPartId() + " updated"); }
To simulate updating the inventory by calling some external system which takes a bit of time
public void validateCopiedS3Files(List<StorageFile> expectedStorageFiles,List<S3ObjectSummary> actualS3Files,String storageName,BusinessObjectDataKey businessObjectDataKey){ validateS3Files(expectedStorageFiles,actualS3Files,storageName,businessObjectDataKey,"copied"); }
Validates copied S3 files per list of expected storage files.
private boolean checkForKey() throws Exception { String query=m_query; query=query.replaceAll(" +"," "); if (!query.startsWith("SELECT *")) { return false; } m_orderBy.clear(); if (!m_DataBaseConnection.isConnected()) { m_DataBaseConnection.connectToDatabase(); } DatabaseMetaData dmd=m_DataBaseConnection.getMetaData(); String table=endOfQuery(true); ResultSet rs=dmd.getPrimaryKeys(null,null,table); while (rs.next()) { m_orderBy.add(rs.getString(4)); } rs.close(); if (m_orderBy.size() != 0) { return true; } rs=dmd.getBestRowIdentifier(null,null,table,DatabaseMetaData.bestRowSession,false); ResultSetMetaData rmd=rs.getMetaData(); int help=0; while (rs.next()) { m_orderBy.add(rs.getString(2)); help++; } rs.close(); if (help == rmd.getColumnCount()) { m_orderBy.clear(); } if (m_orderBy.size() != 0) { return true; } return false; }
Checks for a unique key using the JDBC driver's method: getPrimaryKey(), getBestRowIdentifier(). Depending on their implementation a key can be detected. The key is needed to order the instances uniquely for an inremental loading. If an existing key cannot be detected, use -P option.
@SuppressWarnings("deprecation") @Override public void run(){ try { String line; while ((line=in.readLine()) != null) { out.println(line); } } catch ( IOException e) { } synchronized (this) { done=true; notifyAll(); } }
Set the thread going.
public static void recordUse(RegisterOperand regOp){ Register reg=regOp.getRegister(); regOp.setNext(reg.useList); reg.useList=regOp; reg.useCount++; }
Record a use of a register
public static long roundDown(int field,long timeInMillis){ switch (field) { case Calendar.DAY_OF_MONTH: case Calendar.DAY_OF_WEEK: case Calendar.DAY_OF_YEAR: return (timeInMillis - timeInMillis % (24 * 60 * 60* 1000)); case Calendar.HOUR: return (timeInMillis - timeInMillis % (60 * 60 * 1000)); case Calendar.MINUTE: return (timeInMillis - timeInMillis % (60 * 1000)); case Calendar.SECOND: return (timeInMillis - timeInMillis % (1000)); default : return 0L; } }
this could be accurate only when timezone is UTC for the timezones other than UTC, there is possibly issue, for example assume timezone is GMT+8 in China When user time is "2014-07-15 05:00:00", it will be converted to timestamp first, internally it would be "2014-07-14 21:00:00" in UTC timezone. When rounded down to day, the internal time would be changed to "2014-07-14 00:00:00", and that means the user time is "2014-07-14 08:00:00". But originally user wants to round it to "2014-07-15 00:00:00"
final private void deleteServerSchema(Attributes origAttrs) throws NamingException { Attribute origAttrVal; switch (objectType) { case OBJECTCLASS_ROOT: origAttrVal=info.parser.stringifyObjDesc(origAttrs); break; case ATTRIBUTE_ROOT: origAttrVal=info.parser.stringifyAttrDesc(origAttrs); break; case SYNTAX_ROOT: origAttrVal=info.parser.stringifySyntaxDesc(origAttrs); break; case MATCHRULE_ROOT: origAttrVal=info.parser.stringifyMatchRuleDesc(origAttrs); break; case SCHEMA_ROOT: throw new SchemaViolationException("Cannot delete schema root"); default : throw new SchemaViolationException("Cannot delete child of schema object"); } ModificationItem[] mods=new ModificationItem[1]; mods[0]=new ModificationItem(DirContext.REMOVE_ATTRIBUTE,origAttrVal); info.modifyAttributes(myEnv,mods); }
When we delete an entry, we use the original to make sure that any formatting inconsistencies are eliminated. This is because we're just deleting a value from an attribute on the server and there might not be any checks for extra spaces or parens.
@DSSink({DSSinkKind.IO}) @DSSpec(DSCat.IO) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-09-03 14:59:51.770 -0400",hash_original_method="391E9756F83F23FF347EF2129E3A0E99",hash_generated_method="D1659AD21EAF8B4DE464BAC0141C052C") @Override public Writer append(CharSequence csq,int start,int end) throws IOException { try { beforeWrite(end - start); out.append(csq,start,end); afterWrite(end - start); } catch ( IOException e) { handleIOException(e); } return this; }
Invokes the delegate's <code>append(CharSequence, int, int)</code> method.
@Override public boolean isActive(){ return amIActive; }
Used by the Whitebox GUI to tell if this plugin is still running.
public SmallPuzzle(){ s=new int[2]; }
Initialize to empty.
public void test_uri_ordering(){ final V v=new V(); final IVComparator c=new IVComparator(); assertLT(c.compare(v.noninline_uri1,v.noninline_uri2)); }
Unit test of the relative ordering of URIs.
public void learnEdges(int iterLimit,int edgeChangeTol){ ProximalGradient pg=new ProximalGradient(.5,.9,true); pg.setEdgeChangeTol(edgeChangeTol); setParams(new MGMParams(pg.learnBackTrack(this,params.toMatrix1D(),0.0,iterLimit),p,lsum)); }
Learn MGM using edge convergence using edgeChangeTol (see ProximalGradient for documentation). Recommended when we only care about edge existence.
public boolean removeTime(When time){ return super.removeElement(time); }
Removes an existing event time.
public void showPrevious(){ setDisplayedChild(mWhichChild - 1); }
Manually shows the previous child.
public JSONArray put(boolean value){ this.put(value ? Boolean.TRUE : Boolean.FALSE); return this; }
Append a boolean value. This increases the array's length by one.
public boolean hasPhotosLeftExt(){ return hasExtension(GphotoPhotosLeft.class); }
Returns whether it has the number of photos that can be uploaded to this album.
private void checkBoundaryEncodes(String expected,String input){ final CharBuffer in=CharBuffer.wrap(input.toCharArray()); final int n=expected.length(); final CharBuffer out=CharBuffer.allocate(n); for (int i=0; i < n; ++i) { out.clear(); out.position(n - i); in.clear(); CoderResult cr=_encoder.encode(in,out,true); out.limit(out.position()).position(n - i); out.compact(); if (cr.isOverflow()) { CoderResult cr2=_encoder.encode(in,out,true); if (!cr2.isUnderflow()) { Assert.fail("second encode should finish at offset = " + i); } } out.flip(); String actual=out.toString(); if (!expected.equals(actual)) { Assert.assertEquals("offset = " + i,expected,actual); } } }
Checks boundary conditions of CharBuffer based encodes.
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:36:12.254 -0500",hash_original_method="2C3172373C11B75B4FA9213153A6C85C",hash_generated_method="D890C9DEA68AA972AD35B056A68FF470") public static AndroidHttpClient newInstance(String userAgent){ return newInstance(userAgent,null); }
Create a new HttpClient with reasonable defaults (which you can update).
public static UnaryExpression isNull(String propertyName){ return new UnaryExpression(Operator.NULL,propertyName); }
Apply an "is null" constraint to the named property
public void closeDialog(){ view.close(); }
Close dialog.
private static void multiplyAxB(final double[] aBlock,final double[] bBlock,final double[] cBlock,final int step){ final int blockStripeMini=step % 3; final int blockStripeMaxi=step / 3; final int blockArea=step * step; for (int iL=0; iL < blockArea; iL+=step) { int rc=iL; for (int kL=0; kL < blockArea; kL+=step) { int ra=iL; int rb=kL; double sum=0.0d; for (int jL=blockStripeMini; --jL >= 0; ) { sum+=aBlock[ra++] * bBlock[rb++]; } for (int jL=blockStripeMaxi; --jL >= 0; ) { sum+=aBlock[ra++] * bBlock[rb++] + aBlock[ra++] * bBlock[rb++] + aBlock[ra++] * bBlock[rb++]; } cBlock[rc++]+=sum; } } }
Multiply row-major block (a) x column-major block (b), and add to block c.
private void doDrillDownAdvanceScoring(Bits acceptDocs,LeafCollector collector,DocsAndCost[] dims) throws IOException { final int maxDoc=context.reader().maxDoc(); final int numDims=dims.length; int[] filledSlots=new int[CHUNK]; int[] docIDs=new int[CHUNK]; float[] scores=new float[CHUNK]; int[] missingDims=new int[CHUNK]; int[] counts=new int[CHUNK]; docIDs[0]=-1; int nextChunkStart=CHUNK; final FixedBitSet seen=new FixedBitSet(CHUNK); while (true) { DocsAndCost dc=dims[0]; int docID=dc.approximation.docID(); while (docID < nextChunkStart) { if (acceptDocs == null || acceptDocs.get(docID)) { int slot=docID & MASK; if (docIDs[slot] != docID && (dc.twoPhase == null || dc.twoPhase.matches())) { seen.set(slot); docIDs[slot]=docID; missingDims[slot]=1; counts[slot]=1; } } docID=dc.approximation.nextDoc(); } dc=dims[1]; docID=dc.approximation.docID(); while (docID < nextChunkStart) { if (acceptDocs == null || acceptDocs.get(docID) && (dc.twoPhase == null || dc.twoPhase.matches())) { int slot=docID & MASK; if (docIDs[slot] != docID) { seen.set(slot); docIDs[slot]=docID; missingDims[slot]=0; counts[slot]=1; } else { if (missingDims[slot] >= 1) { missingDims[slot]=2; counts[slot]=2; } else { counts[slot]=1; } } } docID=dc.approximation.nextDoc(); } int filledCount=0; int slot0=0; while (slot0 < CHUNK && (slot0=seen.nextSetBit(slot0)) != DocIdSetIterator.NO_MORE_DOCS) { int ddDocID=docIDs[slot0]; assert ddDocID != -1; int baseDocID=baseIterator.docID(); if (baseDocID < ddDocID) { baseDocID=baseIterator.advance(ddDocID); } if (baseDocID == ddDocID) { scores[slot0]=baseScorer.score(); filledSlots[filledCount++]=slot0; counts[slot0]++; } else { docIDs[slot0]=-1; } slot0++; } seen.clear(0,CHUNK); if (filledCount == 0) { if (nextChunkStart >= maxDoc) { break; } nextChunkStart+=CHUNK; continue; } for (int dim=2; dim < numDims; dim++) { dc=dims[dim]; docID=dc.approximation.docID(); while (docID < nextChunkStart) { int slot=docID & MASK; if (docIDs[slot] == docID && counts[slot] >= dim && (dc.twoPhase == null || dc.twoPhase.matches())) { if (missingDims[slot] >= dim) { missingDims[slot]=dim + 1; counts[slot]=dim + 2; } else { counts[slot]=dim + 1; } } docID=dc.approximation.nextDoc(); } } for (int i=0; i < filledCount; i++) { int slot=filledSlots[i]; collectDocID=docIDs[slot]; collectScore=scores[slot]; if (counts[slot] == 1 + numDims) { collectHit(collector,dims); } else if (counts[slot] == numDims) { collectNearMiss(dims[missingDims[slot]].sidewaysLeafCollector); } } if (nextChunkStart >= maxDoc) { break; } nextChunkStart+=CHUNK; } }
Used when drill downs are highly constraining vs baseQuery.
public void multiplyByScalar(float scalar){ this.points[0]*=scalar; this.points[1]*=scalar; this.points[2]*=scalar; this.points[3]*=scalar; }
Multiply by scalar.
public void bind(int index,long value){ mPreparedStatement.bindLong(index,value); }
Bind the value to an index. A prepareForInsert() or prepareForReplace() without a matching execute() must have already have been called.
private long cancelWaiter(WNode node,WNode group,boolean interrupted){ if (node != null && group != null) { Thread w; node.status=CANCELLED; for (WNode p=group, q; (q=p.cowait) != null; ) { if (q.status == CANCELLED) { U.compareAndSwapObject(p,WCOWAIT,q,q.cowait); p=group; } else p=q; } if (group == node) { for (WNode r=group.cowait; r != null; r=r.cowait) { if ((w=r.thread) != null) U.unpark(w); } for (WNode pred=node.prev; pred != null; ) { WNode succ, pp; while ((succ=node.next) == null || succ.status == CANCELLED) { WNode q=null; for (WNode t=wtail; t != null && t != node; t=t.prev) if (t.status != CANCELLED) q=t; if (succ == q || U.compareAndSwapObject(node,WNEXT,succ,succ=q)) { if (succ == null && node == wtail) U.compareAndSwapObject(this,WTAIL,node,pred); break; } } if (pred.next == node) U.compareAndSwapObject(pred,WNEXT,node,succ); if (succ != null && (w=succ.thread) != null) { succ.thread=null; U.unpark(w); } if (pred.status != CANCELLED || (pp=pred.prev) == null) break; node.prev=pp; U.compareAndSwapObject(pp,WNEXT,pred,succ); pred=pp; } } } WNode h; while ((h=whead) != null) { long s; WNode q; if ((q=h.next) == null || q.status == CANCELLED) { for (WNode t=wtail; t != null && t != h; t=t.prev) if (t.status <= 0) q=t; } if (h == whead) { if (q != null && h.status == 0 && ((s=state) & ABITS) != WBIT && (s == 0L || q.mode == RMODE)) release(h); break; } } return (interrupted || Thread.interrupted()) ? INTERRUPTED : 0L; }
If node non-null, forces cancel status and unsplices it from queue if possible and wakes up any cowaiters (of the node, or group, as applicable), and in any case helps release current first waiter if lock is free. (Calling with null arguments serves as a conditional form of release, which is not currently needed but may be needed under possible future cancellation policies). This is a variant of cancellation methods in AbstractQueuedSynchronizer (see its detailed explanation in AQS internal documentation).
public static boolean isSupport(int type){ return type == IPV4 || type == DOMAIN_NAME || type == IPV6; }
Return <code>true</code> if type is supported.
public Type basicGetDeclaredType(){ return declaredType; }
<!-- begin-user-doc --> <!-- end-user-doc -->
public static void copy(String src,String dst) throws IOException { copy(new File(src),new File(dst)); }
Copy object from one place to another. Can be used to copy file to file, or folder to folder.
public boolean isSimpleCover(){ return false; }
If this is a simple Cover, which can also be used on Bronze Machines and similar.
public Object newLatch(EventBean payload){ if (stateless) { return payload; } if (useSpin) { InsertIntoLatchSpin nextLatch=new InsertIntoLatchSpin(this,currentLatchSpin,msecWait,payload); currentLatchSpin=nextLatch; return nextLatch; } else { InsertIntoLatchWait nextLatch=new InsertIntoLatchWait(currentLatchWait,msecWait,payload); currentLatchWait.setLater(nextLatch); currentLatchWait=nextLatch; return nextLatch; } }
Returns a new latch. <p> Need not be synchronized as there is one per statement and execution is during statement lock.
public Object lastKey(){ return key(lastEntry()); }
Returns the last (highest) key currently in this sorted map.
public GitlabMilestone createMilestone(Serializable projectId,String title,String description,Date dueDate) throws IOException { String tailUrl=GitlabProject.URL + "/" + projectId+ GitlabMilestone.URL; GitlabHTTPRequestor requestor=dispatch().with("title",title); if (description != null) { requestor=requestor.with("description",description); } if (dueDate != null) { SimpleDateFormat formatter=new SimpleDateFormat("yyyy-MM-dd"); String formatted=formatter.format(dueDate); requestor=requestor.with("due_date",formatted); } return requestor.to(tailUrl,GitlabMilestone.class); }
Cretaes a new project milestone.
public boolean isOk(){ return ok; }
true if the conf has been loaded ok.
public void removeValueChangedListener(ValueChangedListener listener){ listeners.remove(listener); }
Remove the given listener.
public GlobalInterlockException(String msg,Throwable ex){ super(msg,ex); }
Creates a new GlobalInterlockException.
public static long str2Long(String s){ long i=0; try { i=Long.parseLong(strReplace(",","",null2Str(s,"0"))); } catch ( Exception e) { i=0; } return i; }
return 0 if input string is null or integer of input string
public static boolean isFileOlder(File file,long timeMillis){ if (file == null) { throw new IllegalArgumentException("No specified file"); } if (!file.exists()) { return false; } return file.lastModified() < timeMillis; }
Tests if the specified <code>File</code> is older than the specified time reference.
public CompanyPrivilegeObject(CompanyPrivilegeObject parent){ this.id=parent.getId(); this.userId=parent.getUserId(); this.companyId=parent.getCompanyId(); this.isAdmin=parent.getIsAdmin(); this.canCreateProject=parent.getCanCreateProject(); }
This method was generated by MyBatis Generator. This method corresponds to the database table company_privilege
private static JCheckBox createCheckBox(String key,ActionListener al){ JCheckBox cb=new JCheckBox(getMsg(key)); cb.setMnemonic(getMnemonic(key)); cb.addActionListener(al); return cb; }
Creates a new JCheckBox and sets its text, mnemonic, and ActionListener
@Override public void eSet(int featureID,Object newValue){ switch (featureID) { case UmplePackage.TRACE_OPTION___OPTION_1: setOption_1((String)newValue); return; } super.eSet(featureID,newValue); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public T caseReturnType(ReturnType object){ return null; }
Returns the result of interpreting the object as an instance of '<em>Return Type</em>'. <!-- begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
private void add(DAGNode node,String contextId){ Map<String,DAGNode> contextNodes=nodes.get(contextId); if (contextNodes == null) { contextNodes=new HashMap<>(); nodes.put(contextId,contextNodes); } contextNodes.put(node.getId(),node); }
Adds one node to the recursively
public void meet() throws ParseException { meet=true; }
Invoked when 'meet' has been parsed.
@Override public boolean nullPlusNonNullIsNull(){ debugCodeCall("nullPlusNonNullIsNull"); return true; }
Returns whether NULL+1 is NULL or not.
public static void tagList(final JFrame parent,final ZyGraph graph,final TraceList list,final CTag tag){ final List<NaviNode> nodes=CTraceNodeFinder.getTraceNodes(graph,list); for ( final NaviNode node : nodes) { CTaggingFunctions.tagNode(parent,node,tag); } }
Tags all nodes hit by an event list with a given tag.
public static void decodeFileToFile(String infile,String outfile) throws java.io.IOException { byte[] decoded=Base64.decodeFromFile(infile); java.io.OutputStream out=null; try { out=new java.io.BufferedOutputStream(new java.io.FileOutputStream(outfile)); out.write(decoded); } catch ( java.io.IOException e) { throw e; } finally { try { out.close(); } catch ( Exception ex) { } } }
Reads <tt>infile</tt> and decodes it to <tt>outfile</tt>.
@Override protected void onNewIntent(Intent intent){ LogUtils.i(TAG,"onNewIntent"); if (intent.getStringExtra(Constants.Column.TITLE) != null) { LogUtils.i(TAG,intent.getStringExtra(Constants.Column.TITLE)); } super.onNewIntent(intent); setIntent(intent); }
Override onNewIntent to get new intent when re-entering
public static void removeEmptyContainers(Map<Integer,List<InstanceId>> allocation){ Iterator<Integer> containerIds=allocation.keySet().iterator(); while (containerIds.hasNext()) { Integer containerId=containerIds.next(); if (allocation.get(containerId).isEmpty()) { containerIds.remove(); } } }
Removes containers from tha allocation that do not contain any instances
public void cancel(Account account,OCFile file){ mSyncFolderHandler.cancel(account,file); }
Cancels a pending or current synchronization.
public DoubleBufferSet(int b,int k){ this.buffers=new DoubleBuffer[b]; this.clear(k); }
Constructs a buffer set with b buffers, each having k elements
public boolean isEveryOwnedOutputSpent(TransactionBag transactionBag){ for ( TransactionOutput output : outputs) { if (output.isAvailableForSpending() && output.isMineOrWatched(transactionBag)) return false; } return true; }
Returns false if this transaction has at least one output that is owned by the given wallet and unspent, true otherwise.
public void testDoConfigureSetsAdminServer() throws Exception { configuration.setProperty(WebLogicPropertySet.SERVER,SERVER); configuration.doConfigure(container); String config=configuration.getFileHandler().readTextFile(DOMAIN_HOME + "/config/config.xml","UTF-8"); XMLAssert.assertXpathEvaluatesTo(SERVER,"//weblogic:admin-server-name",config); }
Test changed admin server.
public final void removeBrowseListener(BrowseListener l){ listeners.remove(BrowseListener.class,l); }
Delete from browse listener
public void valueChange(ValueChangeEvent e){ String name=e.getPropertyName(); Object value=e.getNewValue(); log.config(name + "=" + value); if (value == null) return; if (name.equals("AD_Org_ID")) { if (value == null) m_AD_Org_ID=0; else m_AD_Org_ID=((Integer)value).intValue(); loadBPartner(); } if (name.equals("C_BPartner_ID")) { bpartnerSearch.setValue(value); m_C_BPartner_ID=((Integer)value).intValue(); loadBPartner(); } else if (name.equals("C_Charge_ID")) { if (value == null) { m_C_Charge_ID=0; } else { m_C_Charge_ID=((Integer)value).intValue(); } setAllocateButton(); } else if (name.equals("C_Currency_ID")) { m_C_Currency_ID=((Integer)value).intValue(); loadBPartner(); } else if (name.equals("Date") && multiCurrency.isSelected()) loadBPartner(); }
Vetoable Change Listener. - Business Partner - Currency - Date
public void fireTextRemoved(final NetworkTextObject deleted){ for ( TextListener listener : textListeners) { listener.textRemoved(deleted); } }
Fire a text deleted event to all registered model listeners.
@Override @Transient public boolean isFullTextSearchable(){ return true; }
Override the gisFeature value.<br> Default to true;<br> If this field is set to false, then the object won't be synchronized with the fullText search engine
public JsonParser createJsonParser(byte[] data,int offset,int len) throws IOException, JsonParseException { IOContext ctxt=_createContext(data,true); if (_inputDecorator != null) { InputStream in=_inputDecorator.decorate(ctxt,data,offset,len); if (in != null) { return _createJsonParser(in,ctxt); } } return _createJsonParser(data,offset,len,ctxt); }
Method for constructing parser for parsing the contents of given byte array.
public static void deleteBookmarks(final CCodeBookmarkManager manager,final int[] rows){ Preconditions.checkNotNull(manager,"IE01262: Manager argument can not be null"); Preconditions.checkNotNull(rows,"IE01263: Rows argument can not be null"); final List<CCodeBookmark> bookmarks=new ArrayList<CCodeBookmark>(); for ( final int row : rows) { bookmarks.add(manager.get(row)); } for ( final CCodeBookmark bookmark : bookmarks) { manager.removeBookmark(bookmark); } }
Deletes a list of bookmarks.
public void toggleSelection(int position){ if (selectedItems.get(position,false)) { selectedItems.delete(position); } else { selectedItems.put(position,true); } notifyItemChanged(position); }
Toggle the selection status of the item at a given position
public Object runSafely(Catbert.FastStack stack) throws Exception { Object msgVars=stack.pop(); String msgString=getString(stack); int level=getInt(stack); int code=getInt(stack); if (Sage.client) { sage.msg.SystemMessage newMsg=new sage.msg.SystemMessage(code,level,msgString,(msgVars instanceof java.util.Properties) ? ((java.util.Properties)msgVars) : null); stack.push(new Integer(-1)); stack.push(new Integer(-1)); stack.push(newMsg.getPersistentString()); stack.push(null); return makeNetworkedCall(stack); } if (code < 0) { sage.msg.SystemMessage sysMsg=sage.msg.SystemMessage.buildMsgFromString(msgString); sage.msg.MsgManager.postMessage(sysMsg); return null; } sage.msg.SystemMessage newMsg=new sage.msg.SystemMessage(code,level,msgString,(msgVars instanceof java.util.Properties) ? ((java.util.Properties)msgVars) : null); sage.msg.MsgManager.postMessage(newMsg); return null; }
Creates a new SystemMessage and posts it to the message queue. Predefined message codes of interest for posting messages are: <br> SOFTWARE_UPDATE_MSG = 1202<br> STORAGE_MONITOR_MSG = 1203<br> GENERAL_MSG = 1204<br> <br> You may also use other user-defined message codes which should be greater than 9999. To give those messages a 'type name' which will be visible by the user; you can defined a message variable with the name 'typename' and then that will be displayed.
public WheelVerticalView(Context context){ this(context,null); }
Create a new wheel vertical view.
protected void handleModelChangedEvent(Model model,Object object,int index){ if (model == treeModel) { if (object instanceof TreeModel.TreeChangedEvent) { if (((TreeModel.TreeChangedEvent)object).isNodeChanged()) { updateNodeAndChildren(((TreeModel.TreeChangedEvent)object).getNode()); } else if (((TreeModel.TreeChangedEvent)object).isTreeChanged()) { updateAllNodes(); } else { } } } else if (model == branchRateModel) { if (index == -1) { updateAllNodes(); } else { if (DEBUG) { if (index >= treeModel.getNodeCount()) { throw new IllegalArgumentException("Node index out of bounds"); } } updateNode(treeModel.getNode(index)); } } else if (model == frequencyModel) { updateAllNodes(); } else if (model == tipStatesModel) { if (object instanceof Taxon) { for (int i=0; i < treeModel.getNodeCount(); i++) if (treeModel.getNodeTaxon(treeModel.getNode(i)) != null && treeModel.getNodeTaxon(treeModel.getNode(i)).getId().equalsIgnoreCase(((Taxon)object).getId())) updateNode(treeModel.getNode(i)); } else updateAllNodes(); } else if (model instanceof SiteModel) { updateAllNodes(); } else { throw new RuntimeException("Unknown componentChangedEvent"); } super.handleModelChangedEvent(model,object,index); }
Handles model changed events from the submodels.