code
stringlengths
10
174k
nl
stringlengths
3
129k
static AxesWalker findClone(AxesWalker key,Vector cloneList){ if (null != cloneList) { int n=cloneList.size(); for (int i=0; i < n; i+=2) { if (key == cloneList.elementAt(i)) return (AxesWalker)cloneList.elementAt(i + 1); } } return null; }
Find a clone that corresponds to the key argument.
public void wiggleSort(int[] nums){ int n=nums.length; int median=quickSelect((n + 1) / 2,nums); int left=0; int i=0; int right=n - 1; while (i <= right) { if (nums[newIndex(i,n)] > median) { swap(nums,newIndex(left,n),newIndex(i,n)); left++; i++; } else if (nums[newIndex(i,n)] < median) { swap(nums,newIndex(right,n),newIndex(i,n)); right--; } else { i++; } } }
Quick select + Three-way partition. Find the median with quick select. Then put smaller ones on even indices. Put larger ones on odd indices. https://discuss.leetcode.com/topic/41464/step-by-step-explanation-of-index-mapping-in-java/11
public final int readLine(char[] buf,int length) throws IOException { return readLine(buf,length,true); }
Reads a line into the character buffer. \r\n is converted to \n.
public ManageReferralControl(boolean criticality){ super(OID,criticality,null); }
Constructs a manage referral control.
@Ignore(MARIONETTE) @Test @NeedsLocalEnvironment public void crossDomainHistoryNavigationWhenProxyInterceptsHostRequests(){ testServer1.start(); proxyServer.start(); proxyServer.setPacFileContents(Joiner.on('\n').join("function FindProxyForURL(url, host) {"," if (host.indexOf('example') != -1) {"," return 'PROXY " + proxyServer.getHostAndPort() + "';"," }"," return 'DIRECT';"," }")); String page1Url=buildPage1Url(testServer1,"http://www.example.com" + buildPage2Url()); String page2Url=buildPage2Url("http://www.example.com",buildPage3Url(testServer1)); String page3Url=buildPage3Url(testServer1); WebDriver driver=customDriverFactory.createDriver(proxyServer.getPacUrl()); performNavigation(driver,page1Url); assertEquals(ImmutableList.of(new HttpRequest(page1Url,null),new HttpRequest(page3Url,page2Url)),testServer1.getRequests()); assertEquals(ImmutableList.of(new HttpRequest(page2Url,page1Url)),proxyServer.getRequests()); }
Tests navigation across multiple domains when the browser is configured to use a proxy that intercepts requests to a specific host (www.example.com) - all other requests are permitted to connect directly to the target server.
private int readVersion(String name) throws IOException { try (DataInputStream in=new DataInputStream(new FileInputStream(name))){ return in.readInt(); } }
Reads version number from a file.
public String toString(){ StringBuffer sb=new StringBuffer("MPaySelectionLine["); sb.append(get_ID()).append(",C_Invoice_ID=").append(getC_Invoice_ID()).append(",PayAmt=").append(getPayAmt()).append(",DifferenceAmt=").append(getDifferenceAmt()).append("]"); return sb.toString(); }
String Representation
public BasicDiagnosticFormatter(JavacMessages msgs){ super(msgs,new BasicConfiguration()); }
Create a standard basic formatter
private void writeHeader(int rowCount,short headerLength,short recordLength) throws IOException { _leos.writeByte(3); _leos.writeByte(96); _leos.writeByte(4); _leos.writeByte(30); _leos.writeLEInt(rowCount); _leos.writeLEShort(headerLength); _leos.writeLEShort(recordLength); _leos.writeByte(0); _leos.writeByte(0); _leos.writeByte(0); _leos.writeByte(0); _leos.writeByte(0); _leos.writeByte(0); _leos.writeByte(0); _leos.writeByte(0); _leos.writeByte(0); _leos.writeByte(0); _leos.writeByte(0); _leos.writeByte(0); _leos.writeByte(0); _leos.writeByte(0); _leos.writeByte(0); _leos.writeByte(0); _leos.writeByte(0); _leos.writeByte(0); _leos.writeByte(0); _leos.writeByte(0); }
Writes the header to the class scope LittleEndianOutputStream
public Map<GraphNode,GraphNode> buildHiddenNodeMap(){ Map<GraphNode,GraphNode> result=Maps.newHashMap(); for ( CollapseData masterData : collapsedData.values()) { Collection<GraphNode> masterNodes=Lists.newArrayList(); masterData.addMemberNodes(masterNodes); for ( GraphNode childNode : masterNodes) { result.put(childNode,masterData.getMasterNode()); } } return result; }
Build a map of hidden nodes to their top-level master nodes. This is often used to filter exposed nodes and edges.
void addConsumer(final MessageConsumer consumer){ if (ActiveMQRASession.trace) { ActiveMQRALogger.LOGGER.trace("addConsumer(" + consumer + ")"); } synchronized (consumers) { consumers.add(consumer); } }
Add consumer
public static _Fields findByName(String name){ return byName.get(name); }
Find the _Fields constant that matches name, or null if its not found.
@Override public double java2DToValue(double java2DValue,Rectangle2D area,RectangleEdge edge){ double result; double min=0.0; double max=0.0; double axisMin=this.first.getFirstMillisecond(); double axisMax=this.last.getLastMillisecond(); if (RectangleEdge.isTopOrBottom(edge)) { min=area.getX(); max=area.getMaxX(); } else if (RectangleEdge.isLeftOrRight(edge)) { min=area.getMaxY(); max=area.getY(); } if (isInverted()) { result=axisMax - ((java2DValue - min) / (max - min) * (axisMax - axisMin)); } else { result=axisMin + ((java2DValue - min) / (max - min) * (axisMax - axisMin)); } return result; }
Converts a coordinate in Java2D space to the corresponding data value, assuming that the axis runs along one edge of the specified dataArea.
private void addIndex(Index<K,V> idx,HeadIndex<K,V> h,int indexLevel){ int insertionLevel=indexLevel; Comparable<? super K> key=comparable(idx.node.key); if (key == null) throw new NullPointerException(); for (; ; ) { int j=h.level; Index<K,V> q=h; Index<K,V> r=q.right; Index<K,V> t=idx; for (; ; ) { if (r != null) { Node<K,V> n=r.node; int c=key.compareTo(n.key); if (n.value == null) { if (!q.unlink(r)) break; r=q.right; continue; } if (c > 0) { q=r; r=r.right; continue; } } if (j == insertionLevel) { if (t.indexesDeletedNode()) { findNode(key); return; } if (!q.link(r,t)) break; if (--insertionLevel == 0) { if (t.indexesDeletedNode()) findNode(key); return; } } if (--j >= insertionLevel && j < indexLevel) t=t.down; q=q.down; r=q.right; } } }
Adds given index nodes from given level down to 1.
public boolean isHostname(){ return addressType == HOSTNAME; }
Return true if the address is a DNS host name (and not an IPV4 address)
private static char bcdToChar(byte b){ if (b < 0xa) { return (char)('0' + b); } else switch (b) { case 0xa: return '*'; case 0xb: return '#'; case 0xc: return PAUSE; case 0xd: return WILD; default : return 0; } }
returns 0 on invalid value
public void flush(){ LinkedList<Runnable> queue=new LinkedList<>(); synchronized (mQueue) { queue.addAll(mQueue); mQueue.clear(); } for ( Runnable r : queue) { r.run(); } }
Runs all queued Runnables from the calling thread.
public ActionEvent(Object source,int id,String command){ this(source,id,command,0); }
Constructs an <code>ActionEvent</code> object. <p> This method throws an <code>IllegalArgumentException</code> if <code>source</code> is <code>null</code>. A <code>null</code> <code>command</code> string is legal, but not recommended.
public StandardCrosshairLabelGenerator(){ this("{0}",NumberFormat.getNumberInstance()); }
Creates a new instance with default attributes.
public void Done(){ nextCharBuf=null; buffer=null; bufline=null; bufcolumn=null; }
Set buffers back to null when finished.
protected void processKeywords(Object keywords,String errorMessage) throws ViewParameterException { if (!(keywords instanceof String)) { throw new ViewParameterException(errorMessage); } String[] keyword=((String)keywords).split(","); for (int i=0; i < keyword.length; i++) { String keywordText=keyword[i].toLowerCase().trim(); if (keywordText.length() == 0) { continue; } if (keywordText.equals(FORCE_UPDATE_KEYWORD)) { isForceUpdate=true; } else if (keywordText.equals(START_EAGER_KEYWORD)) { isForceUpdate=true; isStartEager=true; } else { String keywordRange=FORCE_UPDATE_KEYWORD + "," + START_EAGER_KEYWORD; throw new ViewParameterException("Time-length-combination view encountered an invalid keyword '" + keywordText + "', valid control keywords are: "+ keywordRange); } } }
Convert keywords into isForceUpdate and isStartEager members
protected void annotationValueToString(final StringBuilder sb,final BOp val,final int indent){ sb.append(val.toString()); }
Add a string representation of a BOp annotation value into a string builder. By default this is a non-recursive operation, however subclasses may override and give a recursive definition, which should respect the given indent.
public void xml_error(String format,Object... args) throws InvalidPropertiesFormatException { if (errors_are_exceptions) { String msg=String.format(format,args); throw new InvalidPropertiesFormatException(msg); } else { log.printf(format + "\n",args); } }
Handles any errors in parsing the XML file. Throws an exception if errors_are_exceptions is true, otherwise prints messages to log
private void updateProgress(String progressLabel,int progress){ if (myHost != null && ((progress != previousProgress) || (!progressLabel.equals(previousProgressLabel)))) { myHost.updateProgress(progressLabel,progress); } previousProgress=progress; previousProgressLabel=progressLabel; }
Used to communicate a progress update between a plugin tool and the main Whitebox user interface.
public void testNewlines() throws Exception { String newlineStr="Foo\nBar\n\rBaz"; createTable("newlineRegressTest","(field1 MEDIUMTEXT)"); this.stmt.executeUpdate("INSERT INTO newlineRegressTest VALUES ('" + newlineStr + "')"); this.pstmt=this.conn.prepareStatement("INSERT INTO newlineRegressTest VALUES (?)"); this.pstmt.setString(1,newlineStr); this.pstmt.executeUpdate(); this.rs=this.stmt.executeQuery("SELECT * FROM newlineRegressTest"); while (this.rs.next()) { assertTrue(this.rs.getString(1).equals(newlineStr)); } }
Tests newline being treated correctly.
public int deleteCalendar(Connection conn,String calendarName) throws SQLException { PreparedStatement ps=null; try { ps=conn.prepareStatement(rtp(DELETE_CALENDAR)); ps.setString(1,calendarName); return ps.executeUpdate(); } finally { closeStatement(ps); } }
<p> Delete a calendar. </p>
public static String spaces(int length){ return duplicate(" ",length); }
Returns a String with the specified number of spaces.
public static void write(String s,int r){ for (int i=0; i < s.length(); i++) write(s.charAt(i),r); }
Write the String of r-bit characters to standard output.
private static void close(Closeable c){ if (c != null) { try { c.close(); } catch ( IOException e) { } } }
Closeable helper
public void changedClientInfo(ClientInfo clientInfo){ this.mClientInfo=clientInfo; if (DEBUG) { printClientContext(this.mClientInfo); } }
Change client info.
protected void createX_axis(int i){ Log.e("graph height",graphheight + ""); horizontal_width=((graphwidth / size) * i) + horstart; horizontal_width_list.add(horizontal_width); if (i == 0) { canvas.drawLine(horizontal_width,graphheight + border,horizontal_width,border,paint); } else { canvas.drawLine(horizontal_width,graphheight + border,horizontal_width,graphheight + (2 * border),paint); } DrawLabels(i); }
Function to create the axis and its vertical breakdowns. This function also initiate the method which is responsible to plot the labels related to vertical breakdowns
public static java.util.Properties defaultModuleProperties() throws tv.sage.SageException { java.util.Properties moduleProperties=new java.util.Properties(); try { java.io.InputStream is=new java.io.FileInputStream(DEFAULT_PROPERTIES_FILENAME); try { moduleProperties.load(is); } finally { is.close(); } } catch ( java.io.IOException iox) { iox.printStackTrace(); } return (moduleProperties); }
Get the default Module properties from the default place.
@Override public synchronized int lastIndexOf(Object object){ return lastIndexOf(object,elementCount - 1); }
Searches in this vector for the index of the specified object. The search for the object starts at the end and moves towards the start of this vector.
@Override public void visitInsn(int opcode){ switch (opcode) { case IDIV: case IREM: mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESTATIC,VM_FQ,BYTECODE_NAME[opcode],I_V); break; case LDIV: case LREM: mv.visitInsn(DUP2); mv.visitMethodInsn(INVOKESTATIC,VM_FQ,BYTECODE_NAME[opcode],J_V); break; case FDIV: case FREM: mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESTATIC,VM_FQ,BYTECODE_NAME[opcode],F_V); break; case DDIV: case DREM: mv.visitInsn(DUP2); mv.visitMethodInsn(INVOKESTATIC,VM_FQ,BYTECODE_NAME[opcode],D_V); break; case IALOAD: case LALOAD: case DALOAD: case FALOAD: case AALOAD: case BALOAD: case CALOAD: case SALOAD: mv.visitInsn(DUP2); mv.visitMethodInsn(INVOKESTATIC,VM_FQ,BYTECODE_NAME[opcode],LI_V); break; case IASTORE: case FASTORE: case AASTORE: case BASTORE: case CASTORE: case SASTORE: stack.c1b1a1__c1b1a1c1(); stack.c1b1a1__c1b1a1c1(); mv.visitMethodInsn(INVOKESTATIC,VM_FQ,BYTECODE_NAME[opcode],LI_V); break; case LASTORE: case DASTORE: stack.c1b1a2__c1b1a2c1(); stack.c1b2a1__c1b2a1c1(); mv.visitMethodInsn(INVOKESTATIC,VM_FQ,BYTECODE_NAME[opcode],LI_V); break; case ATHROW: case ARRAYLENGTH: mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESTATIC,VM_FQ,BYTECODE_NAME[opcode],L_V); break; default : mv.visitMethodInsn(INVOKESTATIC,VM_FQ,BYTECODE_NAME[opcode],V_V); } super.visitInsn(opcode); }
Insert call to our method directly before the corresponding user instruction
public DataSet findAll(Closure where){ return new DataSet(this,where); }
Return a lazy-implemented filtered view of this DataSet.
public boolean isReadonly(){ return readonly; }
Tests whether this node is readonly.
public ScaleOutAnimation(View view){ this.view=view; interpolator=new AccelerateDecelerateInterpolator(); duration=DURATION_LONG; listener=null; }
This animation scales out the view from 1 to 0. On animation end, the view is restored to its original state and is set to <code>View.INVISIBLE</code>.
public ItemsetDbAdapter open() throws SQLException { mDbHelper=new DatabaseHelper(); mDb=mDbHelper.getWritableDatabase(); return this; }
Open the database. If it cannot be opened, try to create a new instance of the database. If it cannot be created, throw an exception to signal the failure
public static IMultiPoint[] randomPoints(int n,int d){ IMultiPoint points[]=new IMultiPoint[n]; for (int i=0; i < n; i++) { StringBuilder sb=new StringBuilder(); for (int j=0; j < d; j++) { sb.append(rGen.nextDouble()); if (j < d - 1) { sb.append(","); } } points[i]=new Hyperpoint(sb.toString()); } return points; }
generate array of n d-dimensional points whose coordinates are values in the range 0 .. 1
private List<GenericEntry> retrieveAllPages(URL feedUrl) throws IOException, ServiceException { List<GenericEntry> allEntries=new ArrayList<GenericEntry>(); try { do { GenericFeed feed=service.getFeed(feedUrl,GenericFeed.class); allEntries.addAll(feed.getEntries()); feedUrl=(feed.getNextLink() == null) ? null : new URL(feed.getNextLink().getHref()); } while (feedUrl != null); } catch ( ServiceException se) { AppsForYourDomainException ae=AppsForYourDomainException.narrow(se); throw (ae != null) ? ae : se; } return allEntries; }
Utility method that follows the next link and retrieves all pages of a feed.
public static final double[][] timesTranspose(final double[] v1,final double[][] m2){ assert (m2[0].length == 1) : ERR_MATRIX_INNERDIM; final double[][] re=new double[v1.length][m2.length]; for (int j=0; j < m2.length; j++) { for (int i=0; i < v1.length; i++) { re[i][j]=v1[i] * m2[j][0]; } } return re; }
Linear algebraic matrix multiplication, v1 * m2^T
public void assureBlackList(){ AbstractMastersListener.clearBlacklist(); }
Assure that blacklist is reset after each test.
public Vector2f negate(){ x=-x; y=-y; return this; }
Negate this vector.
@PUT @Consumes({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON}) @Path("/{id}/export") @CheckPermission(roles={Role.TENANT_ADMIN},acls={ACL.OWN,ACL.ALL}) public TaskResourceRep updateSnapshotExportRules(@PathParam("id") URI id,SnapshotExportUpdateParams param) throws InternalException { _log.info("Update Snapshot Export Rules : request received for {} with {}",id,param); String task=UUID.randomUUID().toString(); ArgValidator.checkFieldUriType(id,Snapshot.class,"id"); Snapshot snap=queryResource(id); ArgValidator.checkEntity(snap,id,true); FileShare fs=_permissionsHelper.getObjectById(snap.getParent(),FileShare.class); StorageSystem device=_dbClient.queryObject(StorageSystem.class,fs.getStorageDevice()); String path=snap.getPath(); _log.info("Snapshot Export path found {} ",path); Operation op=_dbClient.createTaskOpStatus(Snapshot.class,snap.getId(),task,ResourceOperationTypeEnum.UPDATE_EXPORT_RULES_FILE_SNAPSHOT); try { ExportVerificationUtility exportVerificationUtility=new ExportVerificationUtility(_dbClient); exportVerificationUtility.verifyExports(fs,snap,param); _log.info("No Errors found proceeding further {}, {}, {}",new Object[]{_dbClient,fs,param}); FileServiceApi fileServiceApi=FileService.getFileShareServiceImpl(fs,_dbClient); fileServiceApi.updateExportRules(device.getId(),snap.getId(),param,false,task); auditOp(OperationTypeEnum.UPDATE_EXPORT_RULES_FILE_SNAPSHOT,true,AuditLogManager.AUDITOP_BEGIN,fs.getId().toString(),device.getId().toString(),param); } catch ( URISyntaxException e) { op.setStatus(Operation.Status.error.name()); _log.error("Error Processing Export Updates {}, {}",e.getMessage(),e); return toTask(snap,task,op); } catch ( BadRequestException e) { op=_dbClient.error(Snapshot.class,snap.getId(),task,e); _log.error("Error Processing Export Updates {}, {}",e.getMessage(),e); } catch ( Exception e) { op.setStatus(Operation.Status.error.name()); toTask(snap,task,op); throw APIException.badRequests.unableToProcessRequest(e.getMessage()); } return toTask(snap,task,op); }
Existing file system exports may have their list of export rules updated.
private void wrapAndAddAppender(Object appender,List<TomcatSlf4jLogbackAppenderAccessor> appenders){ TomcatSlf4jLogbackAppenderAccessor appenderAccessor=wrapAppender(appender); if (appenderAccessor != null) { appenders.add(appenderAccessor); } }
Wrap and add appender.
static IntSet makeLivenessSet(int countRegs){ return countRegs <= LIVENESS_SET_THRESHOLD_SIZE ? new BitIntSet(countRegs) : new ListIntSet(); }
Make IntSet for register live in/out sets.
private boolean isContentVisibleInShop(final Long contentId){ final Set<Long> catIds=shopService.getShopContentIds(ShopCodeContext.getShopId()); Category content=categoryService.getById(contentId); final Date now=new Date(); if (DomainApiUtils.isObjectAvailableNow(true,content.getAvailablefrom(),content.getAvailableto(),now)) { while (content != null && content.getCategoryId() != content.getParentId()) { if (catIds.contains(content.getCategoryId())) { return true; } content=categoryService.getById(content.getParentId()); } } return false; }
Check if given content is visible in current shop. NOTE: we are using categoryService for retrieving content since Breadcrumbs use categoryService and thus cache will work better Criteria to satisfy: 1. Content parent must be root content for given shop 2. Only current content object must satisfy Availablefrom/Availableto time frame
public void rollbackRestoreResync(URI vplexURI,URI vplexVolumeURI,URI mirrorVolumeURI,URI cgURI,String detachStepId,String stepId){ _log.info("Executing rollback of restore/resync volume {} on VPLEX {}",new Object[]{vplexVolumeURI,vplexURI}); try { WorkflowStepCompleter.stepExecuting(stepId); @SuppressWarnings("unchecked") Map<String,String> rollbackData=(Map<String,String>)_workflowService.loadStepData(detachStepId); if (rollbackData != null) { boolean reattachMirror=Boolean.parseBoolean(rollbackData.get(REATTACH_MIRROR)); boolean addVolumeBackToCG=Boolean.parseBoolean(rollbackData.get(ADD_BACK_TO_CG)); if (reattachMirror || addVolumeBackToCG) { StorageSystem vplexSystem=getDataObject(StorageSystem.class,vplexURI,_dbClient); VPlexApiClient client=getVPlexAPIClient(_vplexApiFactory,vplexSystem,_dbClient); _log.info("Got VPLEX API client"); Volume vplexVolume=getDataObject(Volume.class,vplexVolumeURI,_dbClient); String vplexVolumeName=vplexVolume.getDeviceLabel(); _log.info("Got VPLEX volume"); if (reattachMirror) { String mirrorDeviceName=rollbackData.get(DETACHED_DEVICE); client.reattachMirrorToDistributedVolume(vplexVolumeName,mirrorDeviceName); _log.info("Reattached the mirror"); } if (addVolumeBackToCG) { ConsistencyGroupManager consistencyGroupManager=getConsistencyGroupManager(vplexVolume); consistencyGroupManager.addVolumeToCg(cgURI,vplexVolume,client,false); _log.info("Added volume back to consistency group."); } } } WorkflowStepCompleter.stepSucceded(stepId); _log.info("Updated workflow step state to success"); } catch ( VPlexApiException vae) { _log.error("Exception in restore/resync volume rollback for VPLEX distributed volume" + vae.getMessage(),vae); WorkflowStepCompleter.stepFailed(stepId,vae); } catch ( Exception e) { _log.error("Exception in restore/resync volume rollback for VPLEX distributed volume " + e.getMessage(),e); WorkflowStepCompleter.stepFailed(stepId,VPlexApiException.exceptions.failedAttachingVPlexVolumeMirror(mirrorVolumeURI.toString(),vplexVolumeURI.toString(),e)); } }
Called if the restore/resync volume operation fails
@Override public Result decode(BinaryBitmap image) throws NotFoundException, ChecksumException, FormatException { return decode(image,null); }
Locates and decodes a Data Matrix code in an image.
public void paintImmediately(int x,int y,int w,int h){ Component c=this; Component parent; if (!isShowing()) { return; } JComponent paintingOigin=SwingUtilities.getPaintingOrigin(this); if (paintingOigin != null) { Rectangle rectangle=SwingUtilities.convertRectangle(c,new Rectangle(x,y,w,h),paintingOigin); paintingOigin.paintImmediately(rectangle.x,rectangle.y,rectangle.width,rectangle.height); return; } while (!c.isOpaque()) { parent=c.getParent(); if (parent != null) { x+=c.getX(); y+=c.getY(); c=parent; } else { break; } if (!(c instanceof JComponent)) { break; } } if (c instanceof JComponent) { ((JComponent)c)._paintImmediately(x,y,w,h); } else { c.repaint(x,y,w,h); } }
Paints the specified region in this component and all of its descendants that overlap the region, immediately. <p> It's rarely necessary to call this method. In most cases it's more efficient to call repaint, which defers the actual painting and can collapse redundant requests into a single paint call. This method is useful if one needs to update the display while the current event is being dispatched. <p> This method is to be overridden when the dirty region needs to be changed for components that are painting origins.
private void writeAbbreviatedPredicate(IRI pred,Value obj) throws IOException, RDFHandlerException { writeStartOfStartTag(pred.getNamespace(),pred.getLocalName()); if (obj instanceof Resource) { Resource objRes=(Resource)obj; if (objRes instanceof IRI) { IRI uri=(IRI)objRes; writeAttribute(RDF.NAMESPACE,"resource",uri.toString()); } else { BNode bNode=(BNode)objRes; writeAttribute(RDF.NAMESPACE,"nodeID",getValidNodeId(bNode)); } writeEndOfEmptyTag(); } else if (obj instanceof Literal) { Literal objLit=(Literal)obj; IRI datatype=objLit.getDatatype(); boolean isXmlLiteral=datatype.equals(RDF.XMLLITERAL); if (Literals.isLanguageLiteral(objLit)) { writeAttribute("xml:lang",objLit.getLanguage().get()); } else { if (isXmlLiteral) { writeAttribute(RDF.NAMESPACE,"parseType","Literal"); } else { writeAttribute(RDF.NAMESPACE,"datatype",datatype.toString()); } } writeEndOfStartTag(); if (isXmlLiteral) { writer.write(objLit.getLabel()); } else { writeCharacterData(objLit.getLabel()); } writeEndTag(pred.getNamespace(),pred.getLocalName()); } writeNewLine(); }
Write out an empty property element.
public double optDouble(int index){ return this.optDouble(index,Double.NaN); }
Get the optional double value associated with an index. NaN is returned if there is no value for the index, or if the value is not a number and cannot be converted to a number.
public boolean isAddingLabel(){ return isAddingAsLabel; }
This method returns whether this cluster model should add the assignment as a label.
protected void pathWasExpanded(TreePath path){ if (tree != null) { tree.fireTreeExpanded(path); } }
Messaged from the VisibleTreeNode after it has been expanded.
public static Spark spark(int pwmPort){ return pwmRegistrar.fetch(pwmPort,Spark.class,null); }
Get a Spark instance from the Registrar
public void update(EventBean newData){ if (updateObserver != null) { updateObserver.updated(this); } arrayList.add(0,newData); }
Apply event
protected String composeIntelligenceSymCode(){ StringBuilder sb=new StringBuilder(); appendFieldValue(sb,this.getScheme(),1); appendFieldValue(sb,this.getStandardIdentity(),1); appendFieldValue(sb,this.getBattleDimension(),1); appendFieldValue(sb,this.getStatus(),1); appendFieldValue(sb,this.getFunctionId(),6); sb.append(UNUSED_POSITION_CODE).append(UNUSED_POSITION_CODE); appendFieldValue(sb,this.getCountryCode(),2); appendFieldValue(sb,this.getOrderOfBattle(),1); return sb.toString(); }
Composes a 15-character symbol identification code (SIDC) for the Signals Intelligence coding scheme. Signals Intelligence symbol codes contain the following fields: Scheme, Standard Identity, Battle Dimension, Status, Function ID, Country Code, Order of Battle. <p/> The Signals Intelligence coding scheme is defined in MIL-STD-2525C table D-I (page 964).
public void checkCosting(){ if (getCostingMethod() != null && getCostingMethod().length() > 0) MCostElement.getMaterialCostElement(this); }
Check Costing Setup
private String loadLicense() throws IOException { StringBuilder sb=new StringBuilder(); BufferedReader reader=null; String line=null; boolean isNewParagraph=false; try { reader=new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/META-INF/LGPL-LICENSE"))); while ((line=reader.readLine()) != null) { line=line.trim(); if (line.isEmpty()) { isNewParagraph=true; } else { if (isNewParagraph) { sb.append(Settings.NEW_LINE); sb.append(Settings.NEW_LINE); } else { sb.append(' '); } sb.append(line); isNewParagraph=false; } } return sb.toString(); } finally { if (reader != null) { reader.close(); } } }
Loads the GNU LGPL license file and formats it for display.
public String removeContactMech(String contactMechPurposeTypeId){ return contactMechIdsMap.remove(contactMechPurposeTypeId); }
Remove the contactMechId from this cart given the contactMechPurposeTypeId
public static Instances curveDataMacroAveraged(int Y[][],double P[][]){ Instances curveData[]=curveData(Y,P); int L=curveData.length; int noNullIndex=-1; for (int i=0; i < curveData.length; i++) { if (curveData[i] == null) { L--; } else { if (noNullIndex == -1) { noNullIndex=i; } } } Instances avgCurve=new Instances(curveData[noNullIndex],0); int D=avgCurve.numAttributes(); for (double t=0.0; t < 1.; t+=0.01) { Instance x=(Instance)curveData[noNullIndex].instance(0).copy(); boolean firstloop=true; for (int j=0; j < L; j++) { if (curveData[j] == null) { continue; } int i=ThresholdCurve.getThresholdInstance(curveData[j],t); if (firstloop) { for (int a=0; a < D; a++) { x.setValue(a,curveData[j].instance(i).value(a) * 1. / L); } firstloop=false; } else { for (int a=0; a < D; a++) { double v=x.value(a); x.setValue(a,v + curveData[j].instance(i).value(a) * 1. / L); } } } avgCurve.add(x); } return avgCurve; }
Get Data for Plotting PR and ROC curves.
public short readShortFromXML(Element node) throws Exception { if (DEBUG) { trace(new Throwable(),node.getAttribute(ATT_NAME)); } m_CurrentNode=node; return ((Short)getPrimitive(node)).shortValue(); }
builds the primitive from the given DOM node.
@Override public void createFont(final PdfObject pdfObject,final String fontID,final boolean renderPage,final ObjectStore objectStore,final Map<String,PdfJavaGlyphs> substitutedFonts) throws Exception { fontTypes=StandardFonts.CIDTYPE0; this.fontID=fontID; final PdfObject Descendent=pdfObject.getDictionary(PdfDictionary.DescendantFonts); final PdfObject pdfFontDescriptor=Descendent.getDictionary(PdfDictionary.FontDescriptor); createCIDFont(pdfObject,Descendent); if (pdfFontDescriptor != null) { final float[] newFontBBox=pdfFontDescriptor.getFloatArray(PdfDictionary.FontBBox); if (newFontBBox != null) { FontBBox=newFontBBox; } readEmbeddedFont(pdfFontDescriptor); } if (renderPage && !isFontEmbedded && substituteFontFile != null) { isFontSubstituted=true; subFont=new CIDFontType2(currentPdfFile,TTstreamisCID); subFont.substituteFontUsed(substituteFontFile); this.isFontEmbedded=true; glyphs.setFontEmbedded(true); } if (renderPage) { setFont(getBaseFontName(),1); } }
read in a font and its details from the pdf file
public synchronized MetadataRegistry merge(MetadataRegistry other){ synchronized (other) { for ( Map.Entry<RootKey,AttributeMetadataRegistryBuilder> entry : other.attributes.entrySet()) { RootKey key=entry.getKey(); AttributeMetadataRegistryBuilder builder=attributes.get(key); if (builder == null) { builder=new AttributeMetadataRegistryBuilder(this); attributes.put(key,builder); } builder.merge(entry.getValue()); } for ( Map.Entry<RootKey,ElementMetadataRegistryBuilder> entry : other.elements.entrySet()) { RootKey key=entry.getKey(); ElementMetadataRegistryBuilder builder=elements.get(key); if (builder == null) { builder=new ElementMetadataRegistryBuilder(this); elements.put(key,builder); } builder.merge(entry.getValue()); } } return this; }
Merges another metadata registry into this metadata registry. Both registries are locked during this time, first this registry and then the other registry. Do not attempt to do a.merge(b) and b.merge(a) in separate threads at the same time or a deadlock may occur.
public synchronized void pool(){ if (this.state == ActiveState.SHUTDOWN) { log(this,"Already shutdown",Level.INFO); return; } if (this.state == ActiveState.POOLED) { log(this,"Already pooled",Level.INFO); return; } String name=memory().getMemoryName(); log(this,"Pooling instance",Level.INFO,name); synchronized (memory()) { memory().getShortTermMemory().clear(); } if (Utils.checkLowMemory()) { log(this,"Low memory - clearing server cache",Level.WARNING); memory().freeMemory(); } if ((Utils.checkLowMemory(0.2) && (memory().cacheSize() > MIN_CACHE)) || memory().cacheSize() > MAX_CACHE) { log(this,"Cache too big - clearing server cache",Level.WARNING,memory().cacheSize(),MIN_CACHE,MAX_CACHE); memory().freeMemory(); } if (instances.containsKey(name)) { shutdown(); return; } while (instances.size() >= POOL_SIZE) { try { String oldest=instancesQueue.remove(); Bot instance=instances.remove(oldest); if (instance != null) { instance.shutdown(); } } catch ( Exception exception) { log(instancesQueue,exception); } } try { awareness().pool(); mind().pool(); mood().pool(); avatar().pool(); memory().pool(); } catch ( Exception exception) { log(this,exception); } setState(ActiveState.POOLED); setDebugLevel(Level.INFO); if (null != instances.putIfAbsent(name,this)) { shutdown(); return; } else { instancesQueue.add(name); } }
Return the instance to the pool, or shutdown if too many instances pooled.
private StunMessageEvent doTestII(TransportAddress serverAddress) throws StunException, IOException { Request request=MessageFactory.createBindingRequest(); ChangeRequestAttribute changeRequest=AttributeFactory.createChangeRequestAttribute(); changeRequest.setChangeIpFlag(true); changeRequest.setChangePortFlag(true); request.putAttribute(changeRequest); StunMessageEvent evt=requestSender.sendRequestAndWaitForResponse(request,serverAddress); if (evt != null) logger.fine("Test II res=" + evt.getRemoteAddress().toString() + " - "+ evt.getRemoteAddress().getHostAddress()); else logger.fine("NO RESPONSE received to Test II."); return evt; }
Sends a binding request to the specified server address with both change IP and change port flags are set to true.
public ConditionsTree createCopy(){ ConditionsTree copyTree=new ConditionsTree(); List<Node<AbstractCondition>> newRootNodes=new ArrayList<>(); for ( Node<AbstractCondition> rootNode : this.getRootNodes()) { Node<AbstractCondition> newRootNode=new Node<>(); newRootNodes.add(newRootNode); recursivelyCopyNode(rootNode,newRootNode); } copyTree.setRootNodes(newRootNodes); return copyTree; }
Creates a copy of conditionsTree. Each node of new tree contains a copy of source condition.
private static void updateListSpanBeginning(Editable editable,int start,int before,int after){ MDOrderListSpan mdOrderListSpan=getOrderListBeginning(editable,start,before,after); MDUnOrderListSpan mdUnOrderListSpan=getUnOrderListBeginning(editable,start,before,after); if (mdOrderListSpan != null) { int spanEnd=editable.getSpanEnd(mdOrderListSpan); int position=EditUtils.findBeforeNewLineChar(editable,start) + 1; if (!isOrderList(editable,position,false)) { editable.removeSpan(mdOrderListSpan); return; } int nested=calculateNested(editable,position,0); if (nested == -1) { return; } editable.removeSpan(mdOrderListSpan); int number=calculateOrderListNumber(editable,position + nested,0); editable.setSpan(new MDOrderListSpan(10,nested,number),position,spanEnd,Spanned.SPAN_INCLUSIVE_INCLUSIVE); } else if (mdUnOrderListSpan != null) { int spanEnd=editable.getSpanEnd(mdUnOrderListSpan); int position=EditUtils.findBeforeNewLineChar(editable,start) + 1; if (!isUnOrderList(editable,position,false)) { editable.removeSpan(mdUnOrderListSpan); return; } int nested=calculateNested(editable,position,0); if (nested == -1) { return; } editable.removeSpan(mdUnOrderListSpan); editable.setSpan(new MDUnOrderListSpan(10,mdUnOrderListSpan.getColor(),nested),position,spanEnd,Spanned.SPAN_INCLUSIVE_INCLUSIVE); } }
"1. aaa" --> " 1. aaa" change nested number "1. aaa" --> "12. aaa" change list number
public UnsupportedCapabilityException(String message){ super(message); }
Construct a <code>UnsupportedCapabilityException</code> object with the specified message.
private static int deleteInMediaDatabase(Context context,String[] oldPathNames){ int modifyCount=0; if ((oldPathNames != null) && (oldPathNames.length > 0)) { String sqlWhere=FotoSql.getWhereInFileNames(oldPathNames); try { modifyCount=FotoSql.deleteMedia(context.getContentResolver(),sqlWhere,null,true); if (Global.debugEnabled) { Log.d(Global.LOG_CONTEXT,CONTEXT + "deleteInMediaDatabase(len=" + oldPathNames.length+ ", files='"+ oldPathNames[0]+ "'...) result count="+ modifyCount); } } catch ( Exception ex) { Log.e(Global.LOG_CONTEXT,CONTEXT + "deleteInMediaDatabase(" + sqlWhere+ ") error :",ex); } } return modifyCount; }
delete oldPathNames from media database
public ccColor3B tile(ccGridSize pos){ assert tgaInfo != null : "tgaInfo must not be null"; assert pos.x < tgaInfo.width : "Invalid position.x"; assert pos.y < tgaInfo.height : "Invalid position.y"; ccColor3B value=new ccColor3B(tgaInfo.imageData[pos.x + 0 + pos.y * tgaInfo.width],tgaInfo.imageData[pos.x + 1 + pos.y * tgaInfo.width],tgaInfo.imageData[pos.x + 2 + pos.y * tgaInfo.width]); return value; }
returns a tile from position x,y. For the moment only channel R is used
public void createSubUsageScenario04() throws Exception { long usageStartTime=DateTimeHandling.calculateMillis("2012-12-01 00:00:00") + DateTimeHandling.daysToMillis(5); BillingIntegrationTestBase.setDateFactoryInstance(usageStartTime); VOServiceDetails serviceDetails=serviceSetup.createPublishAndActivateMarketableService(basicSetup.getSupplierAdminKey(),"SCENARIO04_PERUNIT_MONTH",TestService.EXAMPLE,TestPriceModel.EXAMPLE_PERUNIT_MONTH_ROLES,technicalService,supplierMarketplace); setCutOffDay(basicSetup.getSupplierAdminKey(),1); VORoleDefinition role=VOServiceFactory.getRole(serviceDetails,"ADMIN"); container.login(basicSetup.getCustomerAdminKey(),ROLE_ORGANIZATION_ADMIN); VOSubscriptionDetails subDetails=subscrSetup.subscribeToService("SCENARIO04_PERUNIT_MONTH",serviceDetails,basicSetup.getCustomerUser2(),role); long usageEndTime=DateTimeHandling.calculateMillis("2013-01-01 00:00:00") - DateTimeHandling.daysToMillis(5); BillingIntegrationTestBase.setDateFactoryInstance(usageEndTime); subscrSetup.unsubscribeToService(subDetails.getSubscriptionId()); resetCutOffDay(basicSetup.getSupplierAdminKey()); BillingIntegrationTestBase.updateSubscriptionListForTests("SCENARIO04_PERUNIT_MONTH",subDetails); }
Creates the subscription test data for the usage scenario with in billing period . Usage started after the billing period start time and ended before the Billing Period End Time. usage started after Billing Period Start Time usage ended before Billing Period End Time
public boolean testLowDiskSpace(StorageType storageType,long freeSpaceThreshold){ ensureInitialized(); long availableStorageSpace=getAvailableStorageSpace(storageType); if (availableStorageSpace > 0) { return availableStorageSpace < freeSpaceThreshold; } return true; }
Check if free space available in the filesystem is greater than the given threshold. Note that the free space stats are cached and updated in intervals of RESTAT_INTERVAL_MS. If the amount of free space has crossed over the threshold since the last update, it will return incorrect results till the space stats are updated again.
public static int computeEnumSizeNoTag(final int value){ return computeInt32SizeNoTag(value); }
Compute the number of bytes that would be needed to encode an enum field. Caller is responsible for converting the enum value to its numeric value.
public final void removeMessage(TXCommitMessage deadMess){ synchronized (this.txInProgress) { this.txInProgress.remove(deadMess.getTrackerKey()); if (txInProgress.isEmpty()) { this.txInProgress.notifyAll(); } } }
Indicate that this message is never going to be processed, typically used in the case where none of the FarSiders received the CommitProcessMessage
public LuceneQueryFactoryImpl(final AttributeService attributeService,final ProductService productService,final ShopSearchSupportService shopSearchSupportService,final Map<String,SearchQueryBuilder> productBuilders,final Map<String,SearchQueryBuilder> skuBuilders,final Set<String> useQueryRelaxation){ this.attributeService=attributeService; this.productService=productService; this.shopSearchSupportService=shopSearchSupportService; this.productBuilders=productBuilders; this.skuBuilders=skuBuilders; this.productCategoryBuilder=productBuilders.get(ProductSearchQueryBuilder.PRODUCT_CATEGORY_FIELD); this.productCategoryIncludingParentsBuilder=productBuilders.get(ProductSearchQueryBuilder.PRODUCT_CATEGORY_INC_PARENTS_FIELD); this.productShopBuilder=productBuilders.get(ProductSearchQueryBuilder.PRODUCT_SHOP_FIELD); this.productShopStockBuilder=productBuilders.get(ProductSearchQueryBuilder.PRODUCT_SHOP_INSTOCK_FIELD); this.productShopPriceBuilder=productBuilders.get(ProductSearchQueryBuilder.PRODUCT_SHOP_HASPRICE_FIELD); this.productAttributeBuilder=productBuilders.get(ProductSearchQueryBuilder.ATTRIBUTE_CODE_FIELD); this.productTagBuilder=productBuilders.get(ProductSearchQueryBuilder.PRODUCT_TAG_FIELD); this.skuAttributeBuilder=skuBuilders.get(ProductSearchQueryBuilder.ATTRIBUTE_CODE_FIELD); this.useQueryRelaxation=useQueryRelaxation; }
Construct query builder factory.
public String restOfText(){ return nextToken(null,null); }
Retrieves the rest of the text as a single token. After calling this method hasMoreTokens() will always return false.
public Scanner(Reader r) throws ParseException { try { reader=new StreamNormalizingReader(r); current=nextChar(); } catch ( IOException e) { throw new ParseException(e); } }
Creates a new Scanner object.
public Statement withUpdatedParameters(Value updates){ if (updates == null || updates.isEmpty()) { return this; } else { Map<String,Value> newParameters=new HashMap<>(Math.max(parameters.size(),updates.size())); newParameters.putAll(parameters.asMap(ofValue())); for ( Map.Entry<String,Value> entry : updates.asMap(ofValue()).entrySet()) { Value value=entry.getValue(); if (value.isNull()) { newParameters.remove(entry.getKey()); } else { newParameters.put(entry.getKey(),value); } } return withParameters(value(newParameters)); } }
Create a new statement with new parameters derived by updating this' statement's parameters using the given updates. Every update key that points to a null value will be removed from the new statement's parameters. All other entries will just replace any existing parameter in the new statement.
public static byte[] threeBytePacket(int address,boolean longAddr,byte arg1,byte arg2,byte arg3){ if (!addressCheck(address,longAddr)) { return null; } byte[] retVal; if (longAddr) { retVal=new byte[6]; retVal[0]=(byte)(192 + ((address / 256) & 0x3F)); retVal[1]=(byte)(address & 0xFF); retVal[2]=arg1; retVal[3]=arg2; retVal[4]=arg3; retVal[5]=(byte)(retVal[0] ^ retVal[1] ^ retVal[2]^ retVal[3]^ retVal[4]); } else { retVal=new byte[5]; retVal[0]=(byte)(address & 0xFF); retVal[1]=arg1; retVal[2]=arg2; retVal[3]=arg3; retVal[4]=(byte)(retVal[0] ^ retVal[1] ^ retVal[2]^ retVal[3]); } return retVal; }
Create a packet containing a three-byte instruction.
public GenericDocument(DocumentType dt,DOMImplementation impl){ super(dt,impl); }
Creates a new uninitialized document.
public void draw(Graphics g,float xcoords[],float[] ycoords){ LinkedList<Point2D> points=new LinkedList<Point2D>(); for (int i=0; i < xcoords.length; i++) { points.add(new Point2D.Double(xcoords[i],ycoords[i])); } draw(g,points); }
Draws a decorated polyline
public XmlTransformer(List<String> schemaFilenames,Class<?>... recognizedClasses){ try { this.jaxbContext=JAXBContext.newInstance(recognizedClasses); this.schema=loadXmlSchemas(schemaFilenames); } catch ( JAXBException e) { throw new RuntimeException(e); } }
Create a new XmlTransformer that validates using the given schemas, but uses the given classes (rather than generated ones) for marshaling and unmarshaling.
public final boolean intersectsAny(Vec4 pa,Vec4 pb){ for ( PickPointFrustum frustum : this) { if (frustum.intersectsSegment(pa,pb)) return true; } return false; }
Returns true if a specified line segment intersects the space enclosed by ANY of the Frustums.
public static List propertyDescriptors(int apiLevel){ if (apiLevel == AST.JLS2_INTERNAL) { return PROPERTY_DESCRIPTORS_2_0; } else { return PROPERTY_DESCRIPTORS_3_0; } }
Returns a list of structural property descriptors for this node type. Clients must not modify the result.
public final void normalize(){ double[] tmp_rot=new double[9]; double[] tmp_scale=new double[3]; getScaleRotate(tmp_scale,tmp_rot); this.m00=tmp_rot[0]; this.m01=tmp_rot[1]; this.m02=tmp_rot[2]; this.m10=tmp_rot[3]; this.m11=tmp_rot[4]; this.m12=tmp_rot[5]; this.m20=tmp_rot[6]; this.m21=tmp_rot[7]; this.m22=tmp_rot[8]; }
Performs singular value decomposition normalization of this matrix.
@SuppressLint("NewApi") @NonNull public Observable<List<GithubUser>> searchUser(@NonNull final String query){ return mGithubApi.searchGithubUsers(query,GithubApi.GITHUB_API_PARAMS_SEARCH_SORT_JOINED,GithubApi.GITHUB_API_PARAMS_SEARCH_ORDER_DESC).map(null).doOnNext(null); }
search github user.
public static final Date maxDate(){ return new Date(maximumSerialNumber()); }
Latest allowed date
private static int indexOfNonDigit(String string,int offset){ for (int i=offset; i < string.length(); i++) { char c=string.charAt(i); if (c < '0' || c > '9') return i; } return string.length(); }
Returns the index of the first character in the string that is not a digit, starting at offset.
public void addSequence(final double[] datum){ for (int i=0; i < datum.length; i++) { add(datum[i]); } }
adds a sequence of data to the set, with default weight
public static <E>ImmutableList<E> copyOf(Iterator<? extends E> elements){ if (!elements.hasNext()) { return of(); } E first=elements.next(); if (!elements.hasNext()) { return of(first); } else { return new ImmutableList.Builder<E>().add(first).addAll(elements).build(); } }
Returns an immutable list containing the given elements, in order.
public void start(boolean passiveMode){ if (!permGranted) { Log.w(TAG,"Can't start receiving the location updates. You have no ACCESS_FINE_LOCATION permission enabled."); return; } if (started) { Log.w(TAG,"Can't start receiving the location updates. Already started."); return; } started=true; try { this.passiveMode=passiveMode; if (passiveMode) { locManager.requestLocationUpdates("passive",0,0,this); Log.d(TAG,"Registering for receiving updates from passive provider."); } else { locManager.addGpsStatusListener(gpsStatusListener); if (locManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) { locManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,refreshRate,minDistance,this); } locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,refreshRate,minDistance,this); } Location loc1=locManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); Location loc2=locManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); if (loc1 != null && loc2 != null) { if (loc1.getAccuracy() < loc2.getAccuracy()) { onLocationChanged(loc1); } else { onLocationChanged(loc2); } } else { Location loc=loc1 != null ? loc1 : loc2; if (loc != null) { onLocationChanged(loc); } } if (listener != null) { listener.onChangePinVisibility(true); } } catch ( SecurityException e) { Log.w(TAG,"Can't get location provider due to " + e); } }
Registers location update listeners.
private Object invokeNoSelectMethod(Object handler,String methodName,Object... params){ if (handler == null) return null; Method method=null; try { method=handler.getClass().getDeclaredMethod(methodName,AdapterView.class); if (method != null) return method.invoke(handler,params); else throw new AbAppException("no such method:" + methodName); } catch ( Exception e) { e.printStackTrace(); } return null; }
Invoke no select method.
public void cancelRequest(int senderWhat,Handler target,int targetWhat){ synchronized (this) { Registration start=mReg; Registration r=start; if (r == null) { return; } do { if (r.senderWhat >= senderWhat) { break; } r=r.next; } while (r != start); if (r.senderWhat == senderWhat) { Handler[] targets=r.targets; int[] whats=r.targetWhats; int oldLen=targets.length; for (int i=0; i < oldLen; i++) { if (targets[i] == target && whats[i] == targetWhat) { r.targets=new Handler[oldLen - 1]; r.targetWhats=new int[oldLen - 1]; if (i > 0) { System.arraycopy(targets,0,r.targets,0,i); System.arraycopy(whats,0,r.targetWhats,0,i); } int remainingLen=oldLen - i - 1; if (remainingLen != 0) { System.arraycopy(targets,i + 1,r.targets,i,remainingLen); System.arraycopy(whats,i + 1,r.targetWhats,i,remainingLen); } break; } } } } }
Unregister for notifications for this senderWhat/target/targetWhat tuple.
public void writeToSdfDir(File sdfDir) throws IOException { if (ReaderUtils.isSDF(sdfDir)) { writeToFile(new File(sdfDir,ReferenceGenome.REFERENCE_FILE)); } else { throw new IOException(String.format("%s is not an SDF",sdfDir.getPath())); } }
install this reference.txt into an SDF
public boolean isDiscountLineAmt(){ Object oo=get_Value(COLUMNNAME_IsDiscountLineAmt); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; }
Get Discount calculated from Line Amounts.
public static MemoryMappedFile mmapRO(String path) throws ErrnoException { FileDescriptor fd=Libcore.os.open(path,O_RDONLY,0); long size=Libcore.os.fstat(fd).st_size; long address=Libcore.os.mmap(0L,size,PROT_READ,MAP_SHARED,fd,0); Libcore.os.close(fd); return new MemoryMappedFile(address,size); }
Use this to mmap the whole file read-only.
protected int index(int slice,int row,int column){ return this.offset + sliceOffsets[sliceZero + slice * sliceStride] + rowOffsets[rowZero + row * rowStride]+ columnOffsets[columnZero + column * columnStride]; }
Returns the position of the given coordinate within the (virtual or non-virtual) internal 1-dimensional array.
private boolean isGoto(Instruction instruction){ return instruction.getOpcode() == Constants.GOTO || instruction.getOpcode() == Constants.GOTO_W; }
Determine whether or not given instruction is a goto.
public SchedulerConfigException(String msg){ super(msg); }
<p> Create a <code>JobPersistenceException</code> with the given message. </p>