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)... | 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 'PR... | 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.... | 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) ... | 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=... | 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;
f... | 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... | 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 (?)");... | 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(... | 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 {
... | 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:
... | 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 Hyp... | 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()... | 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];
}
}
ret... | 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,SnapshotExportUpdateP... | 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.getAvai... | 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/Availabl... |
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);
@SuppressWarni... | 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),painting... | 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 ... |
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.N... | 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()... | 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... |
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.read... | 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;
... | 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(PdfDic... | 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 == nu... | 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,... | 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(... | 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);
recursivelyC... | 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 spanEn... | "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,tru... | 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 + ... | 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.createPublishAndActivateMarketab... | 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 updat... |
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.attributeS... | 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> ent... | 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);
retVa... | 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]... | 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;... | 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... | 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.send... | 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> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.