code stringlengths 10 174k | nl stringlengths 3 129k |
|---|---|
private void readCpuUsage(){
try {
final BufferedReader reader=new BufferedReader(new InputStreamReader(new FileInputStream(M.e("/proc/stat"))),1000);
final String load=reader.readLine();
reader.close();
final String[] toks=load.split(" ");
final long currTotal=Long.parseLong(toks[2]) + Long.parse... | Read cpu usage. |
public URL(String protocol,String host,int port,String file) throws MalformedURLException {
this(protocol,host,port,file,null);
}
| Creates a new URL of the given component parts. The URL uses the protocol's default port. |
@Override public void writeTerm(final String term,final Posting post) throws IOException {
final MemorySBOS Docs=post.getDocs();
Docs.pad();
byte[] buffer=new byte[Docs.getMOS().getPos() + 1];
System.arraycopy(Docs.getMOS().getBuffer(),0,buffer,0,Math.min(Docs.getMOS().getBuffer().length,Docs.getMOS().getPos() ... | Write the posting to the output collector |
public static Object parse(String s){
StringReader in=new StringReader(s);
return parse(in);
}
| Parse JSON text into java object from the given string. Please use parseWithException() if you don't want to ignore the exception. |
public TPrimitiveHash(){
super();
}
| Creates a new <code>THash</code> instance with the default capacity and load factor. |
public XML write(){
try {
FilesManager.write(xmlJmapper,xmlPath);
}
catch ( IOException e) {
JmapperLog.ERROR(e);
}
return this;
}
| Writes the xml mapping file starting from xmlJmapper object. |
protected void updateCursorForDrag(int piece){
if (getPreferences().getBoolean(PreferenceKeys.BOARD_IS_USING_CROSSHAIRS_CURSOR)) {
getShell().setCursor(Raptor.getInstance().getDisplay().getSystemCursor(SWT.CURSOR_CROSS));
}
else if (piece != EMPTY) {
int imageSide=getImageSize();
getShell().setCursor... | Updates the cursor for a drag with the specified piece. |
private void startVoiceRecognitionActivity(){
Intent intent=new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_PROMPT,"Voice recognition test...");
startActivityForResult(i... | Fire an intent to start the voice recognition activity. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-09-03 14:59:52.241 -0400",hash_original_method="354338F8D39FF6509677FF2A4C707E5F",hash_generated_method="7D2535B6C55EA233FAA41D561AE981CE") public NullWriter(){
}
| Constructs a new NullWriter. |
private void showFeedback(String message){
if (myHost != null) {
myHost.showFeedback(message);
}
else {
System.out.println(message);
}
}
| Used to communicate feedback pop-up messages between a plugin tool and the main Whitebox user-interface. |
public boolean isFinished(){
AsyncHttpRequest _request=request.get();
return _request == null || _request.isDone();
}
| Returns true if this task completed. Completion may be due to normal termination, an exception, or cancellation -- in all of these cases, this method will return true. |
public static void declareAll(ExtensionProfile profile){
profile.declareAdditionalNamespace(NS);
profile.declare(BaseEntry.class,MediaGroup.getDefaultDescription());
profile.declare(BaseEntry.class,MediaContent.getDefaultDescription(false));
profile.declare(MediaGroup.class,MediaContent.getDefaultDescription(tr... | Extends given profile with Yahoo media RSS extensions. |
@SuppressWarnings("unchecked") protected E removeAt(int pos){
if (pos < 0 || pos >= size) {
return null;
}
final E ret=(E)queue[pos];
final Object reinsert=queue[size - 1];
queue[size - 1]=null;
size--;
heapifyDown(pos,reinsert);
heapModified();
return ret;
}
| Remove the element at the given position. |
public static CompactSketch union(CompactSketch skA,CompactSketch skB){
final short seedHash=checkOrderedAndSeedHash(skA,skB);
long thetaLong=Math.min(skA.getThetaLong(),skB.getThetaLong());
int indexA=0;
int indexB=0;
int outCount=0;
long[] cacheA=skA.getCache();
long[] cacheB=skB.getCache();
long[] ou... | This implements a stateless, pair-wise union operation on ordered, CompactSketches that are either Heap-based or Direct. |
private void writeDataToFile(File file) throws FileNotFoundException, IOException {
FileOutputStream fos=new FileOutputStream(file);
try {
fos.write(CONTENT_AS_BYTES);
}
finally {
fos.close();
}
}
| Initializes test file. |
@SuppressWarnings({"unchecked","rawtypes"}) public void fireChange(final Property property){
for ( final EntityChangeListener l : changeListeners) {
l.entityChanged(this,property);
}
}
| Fire change to all registered listeners. |
private void assertReadVarint(byte[] data,long value) throws Exception {
CodedInputStream input=CodedInputStream.newInstance(data);
assertEquals((int)value,input.readRawVarint32());
assertDataConsumed(data,input);
input=CodedInputStream.newInstance(data);
assertEquals(value,input.readRawVarint64());
assertD... | Parses the given bytes using readRawVarint32() and readRawVarint64() and checks that the result matches the given value. |
public double distance(IMultiPoint imp){
if (imp.dimensionality() != 2) {
throw new IllegalArgumentException("distance computation can only be performed between two-dimensional points");
}
double ox=imp.getCoordinate(1);
double oy=imp.getCoordinate(2);
return Math.sqrt((ox - x) * (ox - x) + (oy - y) * (oy... | Return the Euclidean distance between the given multipoint. Ensures that only valid for two-dimensional comparison. |
public PacProxyException(String message){
super(message);
}
| Creates a new PacProxyException with the specified message. |
private Segment segmentFor(int hash){
return segs[(hash >>> segmentShift) & segmentMask];
}
| Returns the segment that should be used for key with given hash |
@DSComment("From safe class list") @DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:34:10.558 -0500",hash_original_method="668D89CF48F3ADC6BE7AF94D782DA652",hash_generated_method="2ABA277C680FC2569DEF64D5B0C8092B") public ColorMatrix(ColorMatrix src){
Syste... | Create a new colormatrix initialized with the specified colormatrix. |
public DistributedLogMultiStreamWriter build(){
Preconditions.checkArgument((null != _streams && !_streams.isEmpty()),"No streams provided");
Preconditions.checkNotNull(_client,"No distributedlog client provided");
Preconditions.checkNotNull(_codec,"No compression codec provided");
Preconditions.checkArgument(_... | Build the multi stream writer. |
public void clear(){
userHostMap.clear();
}
| Clear all stored UUID-vhosts. |
public final void print(boolean b) throws IOException {
print(b ? "true" : "false");
}
| Prints a boolean. |
public void squareThis(){
long[] pol=getElement();
int f=mLength - 1;
int b=mBit - 1;
long TWOTOMAXLONGM1=mBitmask[MAXLONG - 1];
boolean old, now;
old=(pol[f] & mBitmask[b]) != 0;
for (int i=0; i < f; i++) {
now=(pol[i] & TWOTOMAXLONGM1) != 0;
pol[i]=pol[i] << 1;
if (old) {
pol[i]^=1;
... | squares <tt>this</tt> element. |
public static HostAndPortRange parse(String addrStr,int dfltPortFrom,int dfltPortTo,String errMsgPrefix) throws IgniteCheckedException {
assert dfltPortFrom <= dfltPortTo;
String host;
int portFrom;
int portTo;
final int colIdx=addrStr.indexOf(':');
if (colIdx > 0) {
String portFromStr;
String portT... | Parse string into host and port pair. |
public String toString(int max){
ensureOpen();
StringBuilder sb=new StringBuilder();
int upperl=Math.min(max,indexReader.maxDoc());
for (int i=0; i < upperl; i++) {
try {
FacetLabel category=this.getPath(i);
if (category == null) {
sb.append(i + ": NULL!! \n");
continue;
}
... | Returns ordinal -> label mapping, up to the provided max ordinal or number of ordinals, whichever is smaller. |
public boolean equals(Object other){
if (other == null) return false;
if (!other.getClass().equals(this.getClass())) return false;
NameValue that=(NameValue)other;
if (this == that) return true;
if (this.name == null && that.name != null || this.name != null && that.name == null) return false;
if (t... | Equality comparison predicate. |
public CacheHeader(String key,Entry entry){
this.key=key;
this.size=entry.data.length;
this.etag=entry.etag;
this.serverDate=entry.serverDate;
this.lastModified=entry.lastModified;
this.ttl=entry.ttl;
this.softTtl=entry.softTtl;
this.responseHeaders=entry.responseHeaders;
}
| Instantiates a new CacheHeader object |
public final BufferedImage filter(BufferedImage src,BufferedImage dst){
if (src == null) {
throw new NullPointerException("src image is null");
}
if (src == dst) {
throw new IllegalArgumentException("src image cannot be the " + "same as the dst image");
}
boolean needToConvert=false;
ColorModel srcC... | Transforms the source <CODE>BufferedImage</CODE> and stores the results in the destination <CODE>BufferedImage</CODE>. If the color models for the two images do not match, a color conversion into the destination color model is performed. If the destination image is null, a <CODE>BufferedImage</CODE> is created with the... |
public final boolean checkTag(int identifier){
return this.id == identifier;
}
| Tests provided identifier. |
public void deleteKernel(String name){
Kernel kernel=getKernelByName(name);
if (kernel != null) {
kernel.dispose();
Integer oldSize=Integer.valueOf(_kernelHashTable.size());
_kernelHashTable.remove(name);
setDirtyAndFirePropertyChange(KERNEL_LISTLENGTH_CHANGED_PROPERTY,oldSize,Integer.valueOf(_kerne... | Delete a Kernel by name |
private void updateProgress(int progress){
if (myHost != null && progress != previousProgress) {
myHost.updateProgress(progress);
}
previousProgress=progress;
}
| Used to communicate a progress update between a plugin tool and the main Whitebox user interface. |
public void testWriteVarint() throws Exception {
assertWriteVarint(bytes(0x00),0);
assertWriteVarint(bytes(0x01),1);
assertWriteVarint(bytes(0x7f),127);
assertWriteVarint(bytes(0xa2,0x74),(0x22 << 0) | (0x74 << 7));
assertWriteVarint(bytes(0xbe,0xf7,0x92,0x84,0x0b),(0x3e << 0) | (0x77 << 7) | (0x12 << 14)| (0... | Tests writeRawVarint32() and writeRawVarint64(). |
@Override public int readTimeout(byte[] buffer,int offset,int length,long timeout) throws IOException {
int sublen=getDelegate().readTimeout(buffer,offset,length,timeout);
if (sublen > 0) {
logStream().write(buffer,offset,sublen);
}
return sublen;
}
| Reads the next chunk from the stream in non-blocking mode. |
@LogMessageDoc(level="ERROR",message="Failed to clear all flows on switch {switch}",explanation="An I/O error occured while trying send " + "topology discovery packet",recommendation=LogMessageDoc.CHECK_SWITCH) public void doMultiActionPacketOut(byte[] packetData,IOFSwitch sw,Set<Short> ports,FloodlightContext cntx){
... | TODO This method must be moved to a layer below forwarding so that anyone can use it. |
public NaryJoin(TupleExpr... args){
super(args);
}
| Creates a new natural join operator. |
public ResultSet read(Reader reader,String[] colNames) throws IOException {
init(null,null);
this.input=reader;
return readResultSet(colNames);
}
| Reads CSV data from a reader and returns a result set. The rows in the result set are created on demand, that means the reader is kept open until all rows are read or the result set is closed. |
public boolean isProcessing(){
Object oo=get_Value(COLUMNNAME_Processing);
if (oo != null) {
if (oo instanceof Boolean) return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
| Get Process Now. |
public void memberJoined(final InternalDistributedMember id){
if (!isListening()) {
return;
}
synchronized (this) {
if (!this.distributedMembers.contains(id)) {
this.distributedMembers.add(id);
addPendingJoin(id);
joinProcessor.resumeHandling();
}
}
}
| This method is invoked when a new member joins the system. If the member is an application VM or a GemFire system manager, we note it. |
public StringSendPacket send(String str,SendListener listener){
if (str == null) throw new NullPointerException("Send string can't be null.");
StringSendPacket entity=null;
try {
entity=new StringSendPacket(str,listener);
send(entity);
}
catch ( Exception e) {
e.printStackTrace();
}
return e... | Send string to queue |
@Override public Future<List<Future<DLSN>>> writeBulk(final List<LogRecord> records){
final Stopwatch stopwatch=Stopwatch.createStarted();
return Future.value(asyncWriteBulk(records)).addEventListener(new OpStatsListener<List<Future<DLSN>>>(bulkWriteOpStatsLogger,stopwatch));
}
| Write many log records to the stream. The return type here is unfortunate but its a direct result of having to combine FuturePool and the asyncWriteBulk method which returns a future as well. The problem is the List that asyncWriteBulk returns can't be materialized until getLogSegmentWriter completes, so it has to be w... |
private void trimPc(Node t){
for ( Node x : new LinkedList<>(pc.get(t))) {
if (!pc.containsKey(x)) {
pc.put(x,mmpc(x));
}
if (!pc.get(x).contains(t)) {
pc.get(t).remove(x);
}
}
}
| Trims away false positives from the given node. Used in the symmetric algorithm. |
public void addItems(List<T> items){
if (items == null || items.isEmpty()) {
return;
}
if (mItemList != null && mItemList.isEmpty()) {
mItemList.addAll(items);
}
else {
mItemList.addAll(items);
}
mScrollAdapter=new AutoScrollPagerAdapter<T>(mItemList,this);
this.setAdapter(mScrollAdapter);
}
| Add set of item. |
synchronized void commit(Session session){
session.setAllCommitted();
}
| Commit the current transaction of the given session. |
public JSONObject(Object bean){
this();
this.populateMap(bean);
}
| Construct a JSONObject from an Object using bean getters. It reflects on all of the public methods of the object. For each of the methods with no parameters and a name starting with <code>"get"</code> or <code>"is"</code> followed by an uppercase letter, the method is invoked, and a key and the value returned from the ... |
public void runBenchmarks(Reporter reporter,boolean verbose){
for (int i=0; i < binfo.length; i++) {
if (verbose) System.out.println("Running benchmark " + i + " ("+ binfo[i].getName()+ ")");
try {
binfo[i].runBenchmark();
}
catch ( Exception e) {
System.err.println("Error: benchmark "... | Run benchmarks, writing results to the given reporter. |
public static Container encloseIn(int columns,boolean growHorizontally,Component... cmps){
int rows=cmps.length;
if (rows % columns > 0) {
rows=rows / columns + 1;
}
else {
rows=rows / columns;
}
TableLayout tl=new TableLayout(rows,columns);
tl.setGrowHorizontally(growHorizontally);
return Contai... | <p>Creates a table layout container, the number of rows is automatically calculated based on the number of columns. See usage:</p> <script src="https://gist.github.com/codenameone/2b4d9a13f409e297fb2e.js"></script> <img src="https://www.codenameone.com/img/developer-guide/table-layout-enclose.png" alt="TableLayout tha... |
public void clear(){
int oldSize=size();
super.clear();
if (oldSize > 0 && getComponent() != null) {
getComponent().componentInputMapChanged(this);
}
}
| Removes all the mappings from this object. |
public static String readStream(InputStream in){
BufferedReader reader=new BufferedReader(new InputStreamReader(in));
StringBuilder sb=new StringBuilder();
String line=null;
try {
while ((line=reader.readLine()) != null) {
sb.append(line + "\n");
}
}
catch ( IOException e) {
FreshAirLog.e(... | Utility method for pulling plain text from an InputStream object |
@Override public void eUnset(int featureID){
switch (featureID) {
case StextPackage.EVENT_RAISING_EXPRESSION__EVENT:
setEvent((Expression)null);
return;
case StextPackage.EVENT_RAISING_EXPRESSION__VALUE:
setValue((Expression)null);
return;
}
super.eUnset(featureID);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public void tagExport(String[] names,int[] ids) throws IOException {
if (tags != null) {
tags.tagExport(names,ids);
}
}
| SWFTagTypes interface |
private void generateL1(){
int dim=vi[vi.length - 1] - vi[0];
this.A1=new short[dim][dim];
this.A1inv=null;
ComputeInField c=new ComputeInField();
while (A1inv == null) {
for (int i=0; i < dim; i++) {
for (int j=0; j < dim; j++) {
A1[i][j]=(short)(sr.nextInt() & GF2Field.MASK);
}
}... | This function generates the invertible affine linear map L1 = A1*x + b1 <p> The translation part b1, is stored in a separate array. The inverse of the matrix-part of L1 A1inv is also computed here. </p><p> This linear map hides the output of the map F. It is on k^(n-v1). </p> |
public void testGetAttributeNodeNS1() throws Throwable {
Document doc;
Element element;
Attr attribute1;
Attr attribute2;
Attr attribute;
String attrValue;
String attrName;
String attNodeName;
String attrLocalName;
String attrNS;
doc=(Document)load("staffNS",builder);
element=doc.createElementNS... | Runs the test case. |
public static boolean checkURLforSpiders(HttpServletRequest request){
boolean result=false;
String spiderRequest=(String)request.getAttribute("_REQUEST_FROM_SPIDER_");
if (UtilValidate.isNotEmpty(spiderRequest)) {
if ("Y".equals(spiderRequest)) {
return true;
}
else {
return false;
}
}
... | checks, if the current request comes from a searchbot |
private void useGemFirePropertiesFileInTemporaryFolder(final String fileName,final Properties gemfireProperties) throws Exception {
File propertiesFile=new File(this.temporaryFolder.getRoot().getCanonicalPath(),fileName);
System.setProperty(DistributedSystem.PROPERTIES_FILE_PROPERTY,propertiesFile.getCanonicalPath(... | Creates a gemfire properties file in temporaryFolder: <li>creates <code>fileName</code> in <code>temporaryFolder</code> <li>sets "gemfirePropertyFile" system property <li>writes <code>gemfireProperties</code> to the file |
@Override @Deprecated public void shutdown(){
throw new UnsupportedOperationException();
}
| Not supported and throws an exception when used. |
@Override public void update(){
dispatchUpdate();
}
| UpdateDispatcher.update() -> BaseObservable.dispatchUpdate() |
public void updateUI(){
setUI((InternalFrameUI)UIManager.getUI(this));
invalidate();
if (desktopIcon != null) {
desktopIcon.updateUIWhenHidden();
}
}
| Notification from the <code>UIManager</code> that the look and feel has changed. Replaces the current UI object with the latest version from the <code>UIManager</code>. |
public Extensions extensions(){
if (extensions == null) {
extensions=new Extensions(this);
}
return extensions;
}
| Offers common utility extensions. |
public static Context fromUserPass(Subject s,String user,char[] pass,boolean storeKey) throws Exception {
Context out=new Context();
out.name=user;
out.s=s;
Krb5LoginModule krb5=new Krb5LoginModule();
Map<String,String> map=new HashMap<>();
Map<String,Object> shared=new HashMap<>();
if (pass != null) {
... | Logins with username/password as an existing Subject. The same subject can be used multiple times to simulate multiple logins. |
@SuppressWarnings("unchecked") public <T>Source<T> sequence(T... ts){
return sequence(java.util.Arrays.asList(ts));
}
| Generates a value in order deterministically from the supplied values. If more examples are requested than are supplied then the sequence will be repeated. |
public Builder cacheOnDisc(){
cacheOnDisc=true;
return this;
}
| Loaded image will be cached on disc |
private void removeEntry(String key){
CacheHeader entry=mEntries.get(key);
if (entry != null) {
mTotalSize-=entry.size;
mEntries.remove(key);
}
}
| Removes the entry identified by 'key' from the cache. |
public JSONObject put(String key,boolean value) throws JSONException {
this.put(key,value ? Boolean.TRUE : Boolean.FALSE);
return this;
}
| Put a key/boolean pair in the JSONObject. |
public static void writeBoolList(IonWriter writer,boolean[] values) throws IOException {
if (writer instanceof PrivateListWriter) {
((PrivateListWriter)writer).writeBoolList(values);
return;
}
writer.stepIn(IonType.LIST);
for (int ii=0; ii < values.length; ii++) {
writer.writeBool(values[ii]);
}
... | writes an IonList with a series of IonBool values. This starts a List, writes the values (without any annoations) and closes the list. For text and tree writers this is just a convienience, but for the binary writer it can be optimized internally. |
public OutlierResult run(Database database,Relation<N> nrel,Relation<? extends NumberVector> relation){
final NeighborSetPredicate npred=getNeighborSetPredicateFactory().instantiate(database,nrel);
WritableDoubleDataStore means=DataStoreUtil.makeDoubleStorage(relation.getDBIDs(),DataStoreFactory.HINT_TEMP);
Covar... | Main method. |
private String createString(String f){
return "maxThreadsPerBlock=" + maxThreadsPerBlock + f+ "maxThreadsDim="+ Arrays.toString(maxThreadsDim)+ f+ "maxGridSize="+ Arrays.toString(maxGridSize)+ f+ "sharedMemPerBlock="+ sharedMemPerBlock+ f+ "totalConstantMemory="+ totalConstantMemory+ f+ "regsPerBlock="+ regsPerBlock+... | Creates and returns a string representation of this object, using the given separator for the fields |
public void fireDataSourceRemoved(final int index){
for ( ChartListener listener : listenerList) {
listener.dataSourceRemoved(index);
}
}
| Fire data source removed event. |
public void testArrayListToJsonArrayConversion(){
try {
JSONArray array=StoreRetrieveData.toJSONArray(mTestData);
assertEquals(mTestData.size(),array.length());
}
catch ( Exception e) {
fail("Exception thrown when converting to JSONArray: " + e.getMessage());
}
}
| Ensure JSONArray conversion works as intended |
@DELETE @Produces(MediaType.APPLICATION_JSON) @Path("/{alertId}/triggers") @Description("Deletes all triggers for the given alert ID. All associations to alert notifications are also removed.") public Response deleteAllTriggersByAlertId(@Context HttpServletRequest req,@PathParam("alertId") BigInteger alertId){
if (al... | Deletes all triggers. |
@Override public void close(){
if (this.isTemporaryFile) {
File f1=new File(this.headerFile);
f1.delete();
f1=new File(this.dataFile);
f1.delete();
}
else {
if (saveChanges) {
if (isDirty) {
writeDataBlock();
}
findMinAndMaxVals();
writeHeaderFile();
}
}
... | Used to perform closing functionality when a whiteboxRaster is no longer needed. |
static int findBestSampleSize(int actualWidth,int actualHeight,int desiredWidth,int desiredHeight){
double wr=(double)actualWidth / desiredWidth;
double hr=(double)actualHeight / desiredHeight;
double ratio=Math.min(wr,hr);
float n=1.0f;
while ((n * 2) <= ratio) {
n*=2;
}
return (int)n;
}
| Returns the largest power-of-two divisor for use in downscaling a bitmap that will not result in the scaling past the desired dimensions. |
protected void initView(){
p.setFakeBoldText(false);
p.setAntiAlias(true);
p.setTextSize(MINI_DAY_NUMBER_TEXT_SIZE);
p.setStyle(Style.FILL);
mMonthNumPaint=new Paint();
mMonthNumPaint.setFakeBoldText(true);
mMonthNumPaint.setAntiAlias(true);
mMonthNumPaint.setTextSize(MINI_DAY_NUMBER_TEXT_SIZE);
mMont... | Sets up the text and style properties for painting. Override this if you want to use a different paint. |
protected void validateStartState(State startState){
ValidationUtils.validateState(startState);
ValidationUtils.validateTaskStage(startState.taskState);
}
| This method validates a state object for internal consistency. |
public ColladaPhong(String ns){
super(ns);
}
| Construct an instance. |
public final static byte[] decode(char[] sArr){
int sLen=sArr != null ? sArr.length : 0;
if (sLen == 0) return new byte[0];
int sepCnt=0;
for (int i=0; i < sLen; i++) if (IA[sArr[i]] < 0) sepCnt++;
if ((sLen - sepCnt) % 4 != 0) return null;
int pad=0;
for (int i=sLen; i > 1 && IA[sArr[--i]] <= 0; ... | Decodes a BASE64 encoded char array. All illegal characters will be ignored and can handle both arrays with and without line separators. |
public void ConfigParams(){
int height=Config.singletonConfig.getHeight();
int width=Config.singletonConfig.getWidth();
assertEquals((height > 0) & (width > 0),true);
}
| Check height and width types served by the singleton class Config |
static boolean isXAWTToplevelWindow(long window){
return XToolkit.windowToXWindow(window) instanceof XWindowPeer;
}
| Checks if the given window is a Java window and is an instance of XWindowPeer |
public static ComponentUI createUI(JComponent h){
return new BETableHeaderUI();
}
| Creates the ui. |
private String createAttribute(AttributeModel attr){
StringBuffer sb=new StringBuffer();
sb.append(" ");
String visibility=attr.getVisibility().toString();
if (!visibility.equals("package")) {
sb.append(attr.getVisibility().toString());
sb.append(" ");
}
if (attr.isStatic()) {
sb.append("stat... | Creates a part of an attribute. |
public static synchronized Bitmap decodeSampledBitmapFromFile(String filename,int reqWidth,int reqHeight){
final BitmapFactory.Options options=new BitmapFactory.Options();
options.inJustDecodeBounds=true;
BitmapFactory.decodeFile(filename,options);
options.inSampleSize=calculateInSampleSize(options,reqWidth,req... | Decode and sample down a bitmap from a file to the requested width and height. |
public AudioData duplicate() throws IOException, ClassNotFoundException {
AudioData result=new AudioData();
ByteArrayOutputStream baos=new ByteArrayOutputStream();
ObjectOutputStream oos=new ObjectOutputStream(baos);
writeExternal(oos);
oos.close();
byte[] buf=baos.toByteArray();
baos.close();
ByteArray... | Duplicate this message / event. |
public static void main(String[] args){
try {
File rootFolder=GeneratorUtils.getRootFolder(args);
System.out.println(" ------------------------------------------------------------------------ ");
System.out.println(String.format("Searching for Extensions in %s",rootFolder.getAbsolutePath()));
System.o... | Entry point. --rootDir is the optional parameter. |
public void add(KeywordInfo info){
keywords.put(info.getKeyword(),info);
}
| Adds information about a keyword to this collection. |
private void addReference(final int sourcePosition,final int referencePosition){
if (srcAndRefPositions == null) {
srcAndRefPositions=new int[6];
}
if (referenceCount >= srcAndRefPositions.length) {
int[] a=new int[srcAndRefPositions.length + 6];
System.arraycopy(srcAndRefPositions,0,a,0,srcAndRefPosi... | Adds a forward reference to this label. This method must be called only for a true forward reference, i.e. only if this label is not resolved yet. For backward references, the offset of the reference can be, and must be, computed and stored directly. |
public FileSystemConfiguration(FileSystemConfiguration cfg){
assert cfg != null;
blockSize=cfg.getBlockSize();
bufSize=cfg.getStreamBufferSize();
colocateMeta=cfg.isColocateMetadata();
dataCacheName=cfg.getDataCacheName();
dfltMode=cfg.getDefaultMode();
dualModeMaxPendingPutsSize=cfg.getDualModeMaxPending... | Constructs the copy of the configuration. |
public QueryPanel(JFrame parent){
super();
m_Parent=parent;
m_QueryExecuteListeners=new HashSet<QueryExecuteListener>();
m_HistoryChangedListeners=new HashSet<HistoryChangedListener>();
m_DbUtils=null;
m_Connected=false;
createPanel();
}
| initializes the panel. |
public void loadDataFromPush(Node sourceNode,InputStream in,OutputStream out) throws IOException {
loadDataFromPush(sourceNode,null,in,out);
}
| Load database from input stream and write acknowledgment to output stream. This is used for a "push" request with a response of an acknowledgment. |
public TStructMember basicGetDefinedMember(){
return definedMember;
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
private void declareExtensions(){
new IssueCommentsFeed().declareExtensions(extProfile);
new IssuesFeed().declareExtensions(extProfile);
new ProjectsFeed().declareExtensions(extProfile);
}
| Declare the extensions of the feeds for the Project Hosting GData API. |
public void addMethodThrowingExceptionNoBidirectionalUpdate(MethodType type){
if (null == methodsThrowingThisException) {
methodsThrowingThisException=new MethodTypeSet();
}
methodsThrowingThisException.add(type);
}
| Adds a method that is throwing this class as exception WITHOUT setting the back-reference. Please be aware that this method should only be called internally as this might mess up the bidirectional structure. |
private boolean isValid(int type,String value){
if (value == null) {
return false;
}
if (ALLOWED_STRINGS[type] != null) {
return verifyStringGroup(value,ALLOWED_STRINGS[type]);
}
switch (type) {
case TYPE_NUMBER:
return verify(value,DIGITS,null);
case TYPE_PIXELS_OR_PERCENTAGE:
if (value.endsWith(... | Verifies that the specified value conforms with the attribute's type restrictions. This basically checks the attribute type and according to that checks the value. |
public static Map<String,String> messageToMap(Message msg){
Map<String,String> map=new HashMap<>();
if (msg == null) return map;
if (msg.fixedHeader().messageType() == MqttMessageType.PUBLISH) {
MqttPublishVariableHeader variableHeader=(MqttPublishVariableHeader)msg.variableHeader();
MqttPublishPayload ... | Convert (MQTT) Message to Map |
public void startStatementWithinTransaction(){
startStatement=-1;
}
| Start a new statement within a transaction. |
public void remove(){
throw new UnsupportedOperationException();
}
| Not supported. |
@Override public int hashCode(){
return this.hash;
}
| Returns the hash used for routing. Never negative. |
public static Integer createServerCache() throws Exception {
new OperationsPropagationDUnitTest().createCache(new Properties());
AttributesFactory factory=new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setDataPolicy(DataPolicy.REPLICATE);
RegionAttributes attrs=factory.create();
r... | Create the server |
public MethodInfo(ConstPool cp,String methodname,String desc){
this(cp);
accessFlags=0;
name=cp.addUtf8Info(methodname);
cachedName=methodname;
descriptor=constPool.addUtf8Info(desc);
}
| Constructs a <code>method_info</code> structure. The initial value of <code>access_flags</code> is zero. |
public DTMIterator createDTMIterator(String xpathString,PrefixResolver presolver){
return m_dtmManager.createDTMIterator(xpathString,presolver);
}
| Create a new <code>DTMIterator</code> based on an XPath <a href="http://www.w3.org/TR/xpath#NT-LocationPath>LocationPath</a> or a <a href="http://www.w3.org/TR/xpath#NT-UnionExpr">UnionExpr</a>. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.