code stringlengths 10 174k | nl stringlengths 3 129k |
|---|---|
public RemoteObjectInvocationHandler(RemoteRef ref){
super(ref);
if (ref == null) {
throw new NullPointerException();
}
}
| Creates a new <code>RemoteObjectInvocationHandler</code> constructed with the specified <code>RemoteRef</code>. |
public Categories addCategory(Category category){
super.addElement(Category.KEY,category);
return this;
}
| Adds a new category. |
public static void append(File file,byte[] bytes) throws IOException {
OutputStream stream=null;
try {
stream=new FileOutputStream(file,true);
stream.write(bytes,0,bytes.length);
stream.flush();
OutputStream temp=stream;
stream=null;
temp.close();
}
finally {
closeWithWarning(stream)... | Append bytes to the end of a File. It <strong>will not</strong> be interpreted as text. |
public DescriptorImpl(final String description,final String label){
this.description=description;
this.label=label;
}
| Construct descriptor. |
@Nullable public synchronized V remove(K key){
V oldValue=mMap.remove(key);
mSizeInBytes-=getValueSizeInBytes(oldValue);
return oldValue;
}
| Removes the element from the map. |
public MediaConfig createChannelFileAttachment(String file,MediaConfig config){
config.addCredentials(this);
String xml=POSTFILE(this.url + "/create-channel-attachment",file,config.name,config.toXML());
Element root=parse(xml);
if (root == null) {
return null;
}
try {
MediaConfig media=new MediaConf... | Create a new file/image/media attachment for a chat channel. |
public static boolean matchUserStatus(String id,User user){
if (id.equals("$mod")) {
if (user.isModerator()) {
return true;
}
}
else if (id.equals("$sub")) {
if (user.isSubscriber()) {
return true;
}
}
else if (id.equals("$turbo")) {
if (user.hasTurbo()) {
return true;
... | Checks if the id matches the given User. The id can be one of: $mod, $sub, $turbo, $admin, $broadcaster, $staff, $bot. If the user has the appropriate user status, this returns true. If the id is unknown or the user doesn't have the required status, this returns false. |
public static Selection createFromStartLength(int s,int l){
Assert.isTrue(s >= 0 && l >= 0);
Selection result=new Selection();
result.fStart=s;
result.fLength=l;
result.fExclusiveEnd=s + l;
return result;
}
| Creates a new selection from the given start and length. |
public static byte[] hash(InputStream in) throws IOException {
if (HASH_DIGEST == null) {
throw new EvernoteUtilException(EDAM_HASH_ALGORITHM + " not supported",new NoSuchAlgorithmException(EDAM_HASH_ALGORITHM));
}
byte[] buf=new byte[1024];
int n;
while ((n=in.read(buf)) != -1) {
HASH_DIGEST.update(b... | Returns an MD5 checksum of the contents of the provided InputStream. |
@LayoutlibDelegate static long uptimeMillis(){
return System.currentTimeMillis() - sBootTime;
}
| Returns milliseconds since boot, not counting time spent in deep sleep. <b>Note:</b> This value may get reset occasionally (before it would otherwise wrap around). |
void unregisterDownloadFileChangeListener(OnDownloadFileChangeListener onDownloadFileChangeListener){
mDownloadFileCacher.unregisterDownloadFileChangeListener(onDownloadFileChangeListener);
}
| unregister an OnDownloadFileChangeListener |
public DateParser(){
this(DateFormat.getDateInstance(DateFormat.SHORT));
}
| Create a new DateParser. |
public ShoppingCartItem(ShoppingCartItem item){
this.delegator=item.getDelegator();
try {
this._product=item.getProduct();
}
catch ( IllegalStateException e) {
this._product=null;
}
try {
this._parentProduct=item.getParentProduct();
}
catch ( IllegalStateException e) {
this._parentProduc... | Clone an item. |
public void writeText(char text[],int off,int len) throws IOException {
if (text == null) {
throw new NullPointerException("Argument Error: One or more parameters are null.");
}
if (off < 0 || off > text.length || len < 0 || len > text.length) {
throw new IndexOutOfBoundsException();
}
closeStartIfNec... | <p>Write properly escaped text from a character array. If there is an open element that has been created by a call to <code>startElement()</code>, that element will be closed first.</p> <p/> <p>All angle bracket occurrences in the argument must be escaped using the &gt; &lt; syntax.</p> |
public void pleaseStop(){
stopping=true;
mc.pleaseStop();
}
| Requests that the MCMC chain stop prematurely. |
public static boolean checkTransactionLockTime(Transaction transaction,int locktime){
if (Math.abs(transaction.getLockTime() - locktime) > 5 * 60) {
System.out.println("Locktime not correct. Should be: " + locktime + " Is: "+ transaction.getLockTime()+ " Diff: "+ Math.abs(transaction.getLockTime() - locktime));
... | Check transaction lock time. |
@Override public void renderLimitLines(Canvas c){
List<LimitLine> limitLines=mXAxis.getLimitLines();
if (limitLines == null || limitLines.size() <= 0) return;
float[] pts=new float[2];
Path limitLinePath=new Path();
for (int i=0; i < limitLines.size(); i++) {
LimitLine l=limitLines.get(i);
mLimitLin... | Draws the LimitLines associated with this axis to the screen. This is the standard YAxis renderer using the XAxis limit lines. |
public static void showCommandLineOptions(){
showCommandLineOptions(new TextUICommandLine());
}
| Print command line options synopses to stdout. |
public WordEntry find(final String str){
final WordEntry entry=words.get(trimWord(str));
return entry;
}
| Find an entry for a given word. |
private void registerListener(final String requestUrl,final String target,String[] methods,Integer expireTime,String filter){
registerListener(requestUrl,target,methods,expireTime,filter,null);
}
| Registers a listener. |
public AbstractTestContext(){
super();
}
| Constructs a new <code>AbstractTestContext</code> instance. |
public final String value(int valIndex){
if (!isNominal() && !isString()) {
return "";
}
else {
Object val=m_Values.elementAt(valIndex);
if (val instanceof SerializedObject) {
val=((SerializedObject)val).getObject();
}
return (String)val;
}
}
| Returns a value of a nominal or string attribute. Returns an empty string if the attribute is neither nominal nor a string attribute. |
public static void readSkel(BufferedReader reader) throws IOException {
Vector lines=new Vector();
StringBuffer section=new StringBuffer();
String ln;
while ((ln=reader.readLine()) != null) {
if (ln.startsWith("---")) {
lines.addElement(section.toString());
section.setLength(0);
}
else {
... | Reads an external skeleton file from a BufferedReader. |
@Override public void finishTerm(BlockTermState _state) throws IOException {
IntBlockTermState state=(IntBlockTermState)_state;
assert state.docFreq > 0;
assert state.docFreq == docCount : state.docFreq + " vs " + docCount;
final int singletonDocID;
if (state.docFreq == 1) {
singletonDocID=docDeltaBuffer[... | Called when we are done adding docs to this term |
public ApiException(int code,ObjectNode jsonResponse){
super((jsonResponse.get(ApiMethod.ERROR_NODE) != null) ? JsonUtils.stringFromJsonNode(jsonResponse.get(ApiMethod.ERROR_NODE),"message") : "No message returned");
this.code=code;
}
| Construct exception from JSON response |
@Override public boolean isActive(){
return amIActive;
}
| Used by the Whitebox GUI to tell if this plugin is still running. |
public void testReorderAppDeploymentsAfterConfigurationVersionAndBeforeAdminServerName() throws Exception {
WAR war=createWar();
deployer.createElementForDeployableInDomain(war,domain);
deployer.reorderAppDeploymentsAfterConfigurationVersion(domain);
String xml=this.xmlUtil.toString(domain);
int indexOfConfig... | Test application deployment reordering. |
public static int decode(byte[] data,OutputStream out) throws IOException {
int off=0;
int length=data.length;
int endOffset=off + length;
int bytesWritten=0;
while (off < endOffset) {
byte ch=data[off++];
if (ch == '_') {
out.write(' ');
}
else if (ch == '=') {
if (off + 1 >= end... | Decode the encoded byte data writing it to the given output stream. |
public boolean isFovVisible(){
return (frustum.getSceneHints().getCullHint() != CullHint.Always);
}
| Get FOV visibility |
public NotificationChain basicSetTypeArg(TypeArgument newTypeArg,NotificationChain msgs){
TypeArgument oldTypeArg=typeArg;
typeArg=newTypeArg;
if (eNotificationRequired()) {
ENotificationImpl notification=new ENotificationImpl(this,Notification.SET,TypeRefsPackage.TYPE_TYPE_REF__TYPE_ARG,oldTypeArg,newTypeArg... | <!-- begin-user-doc --> <!-- end-user-doc --> |
public static String join(String separator,float[] elements){
if (elements == null || elements.length == 0) {
return "";
}
List<Float> list=new ArrayList<Float>(elements.length);
for ( Float element : elements) {
list.add(element);
}
return join(separator,list);
}
| Returns a string containing all float numbers concatenated by a specified separator. |
public Position(int offset){
this(offset,0);
}
| Creates a new position with the given offset and length 0. |
protected void onUnhandledException(WebURL webUrl,Throwable e){
String urlStr=(webUrl == null ? "NULL" : webUrl.getURL());
logger.warn("Unhandled exception while fetching {}: {}",urlStr,e.getMessage());
logger.info("Stacktrace: ",e);
}
| This function is called when a unhandled exception was encountered during fetching |
private void createLdifFilesDirectory() throws FileOperationFailedException {
String schemaExportDirName=getSchemaFilesDirectory();
_log.info("Schema ldif files directory {}",schemaExportDirName);
File schemaExportDir=new File(schemaExportDirName);
if (!schemaExportDir.exists()) {
if (!schemaExportDir.mkdir... | Creates the dummy directory for the ldif files. |
public void assertNull(Object object){
TestUtils.assertNull(object);
}
| This method just invokes the test utils method, it is here for convenience |
public static String escapeXml(String s){
initializeEscapeMap();
if (s == null || s.length() == 0) {
return s;
}
char[] sChars=s.toCharArray();
StringBuilder sb=new StringBuilder();
int lastReplacement=0;
for (int i=0; i < sChars.length; i++) {
if (isInvalidXMLCharacter(sChars[i])) {
sb.appe... | Escape XML entities and illegal characters in the given string. This enhances the functionality of org.apache.commons.lang.StringEscapeUtils.escapeXml by escaping low-valued unprintable characters, which are not permitted by the W3C XML 1.0 specification. |
public ButtonGroup(){
}
| Creates a new <code>ButtonGroup</code>. |
public JSONArray names(){
JSONArray ja=new JSONArray();
Iterator<String> keys=this.keys();
while (keys.hasNext()) {
ja.put(keys.next());
}
return ja.length() == 0 ? null : ja;
}
| Produce a JSONArray containing the names of the elements of this JSONObject. |
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 boolean isHasBack(){
FacesContext realContext=FacesContext.getCurrentInstance(), copyContext=createShadowFacesContext(realContext);
NavigationHandler nav=copyContext.getApplication().getNavigationHandler();
nav.handleNavigation(copyContext,null,"back");
return compareUIViewRoots(realContext.getViewRoot()... | <p>Check to see whether the current page should have a back button</p> |
public LongSparseArrayDataRow(int size){
super(size);
values=new long[size];
}
| Creates a sparse array data row of the given size. |
public PropertyAtom(final String id,final String key,final Object val){
super(id);
this.key=key;
this.val=val;
}
| Fully construct a property atom. |
public void print(final CharSequence text) throws IOException {
final int size=text.length();
int pos=0;
for (int i=0; i < size; i++) {
if (text.charAt(i) == '\n') {
write(text.subSequence(pos,size),i - pos + 1);
pos=i + 1;
atStartOfLine=true;
}
}
write(text.subSequence(pos,size),siz... | Print text to the output stream. |
private boolean isClosureProgram2(IStep step){
if (step == null) throw new IllegalArgumentException();
if (step.isRule()) return false;
final IProgram program=(IProgram)step;
if (program.isClosure()) return true;
final Iterator<IStep> itr=program.steps();
while (itr.hasNext()) {
if (isClosureProgr... | <code>true</code> iff this program is or contains a closure operation. |
public void destroy(){
super.destroy();
}
| Destruction of the servlet. <br> |
public void expandAll(){
if (!chkExpand.isChecked()) chkExpand.setChecked(true);
TreeUtils.expandAll(menuTree);
}
| expand all node |
public static SavedAdStyles run(AdSense adsense,int maxPageSize) throws Exception {
System.out.println("=================================================================");
System.out.printf("Listing all saved ad styles for default account\n");
System.out.println("=================================================... | Runs this sample. |
public static Border createEtchedLowered(){
Border b=new Border();
b.type=TYPE_ETCHED_LOWERED;
b.themeColors=true;
return b;
}
| Creates a lowered etched border with default colors, highlight is derived from the component and shadow is a plain dark color |
public void reset(){
m_currentSearchIndex=0;
}
| Resets the cursor to the beginning. |
public static void minimizeApp(Context context){
Intent startMain=new Intent(Intent.ACTION_MAIN);
startMain.addCategory(Intent.CATEGORY_HOME);
startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(startMain);
}
| Minimizes the app |
public static void logDeviceInfo(String tag){
Log.d(tag,"Android SDK: " + Build.VERSION.SDK_INT + ", "+ "Release: "+ Build.VERSION.RELEASE+ ", "+ "Brand: "+ Build.BRAND+ ", "+ "Device: "+ Build.DEVICE+ ", "+ "Id: "+ Build.ID+ ", "+ "Hardware: "+ Build.HARDWARE+ ", "+ "Manufacturer: "+ Build.MANUFACTURER+ ", "+ "Model... | Information about the current build, taken from system properties. |
private void writePostResource(String path,Element postResourceEl){
if (getFileHandler().isDirectory(path)) {
writeDirectoryPostResource(postResourceEl,path);
}
else if (path.toLowerCase().endsWith(".jar")) {
writeJarPostResource(postResourceEl,path);
}
else {
writeFilePostResource(postResourceEl,... | Write post Resources using with a PostResources xml element |
private Producer<CloseableReference<CloseableImage>> newBitmapCacheGetToBitmapCacheSequence(Producer<CloseableReference<CloseableImage>> inputProducer){
BitmapMemoryCacheProducer bitmapMemoryCacheProducer=mProducerFactory.newBitmapMemoryCacheProducer(inputProducer);
BitmapMemoryCacheKeyMultiplexProducer bitmapKeyMu... | Bitmap cache get -> thread hand off -> multiplex -> bitmap cache |
static Pair<byte[],Long> decomposeName(Column column){
ByteBuffer nameBuffer;
if (column.isSetName()) {
nameBuffer=column.bufferForName();
}
else {
nameBuffer=ByteBuffer.wrap(column.getName());
}
return decompose(nameBuffer);
}
| Convenience method to get the name buffer for the specified column and decompose it into the name and timestamp. |
public synchronized boolean hasMoreTokens(){
return (this.pos < this.sourceLength);
}
| Does this tokenizer have more tokens available? |
public String sanitizeString(String string){
StringBuilder retval=new StringBuilder();
StringCharacterIterator iterator=new StringCharacterIterator(string);
char character=iterator.current();
while (character != java.text.CharacterIterator.DONE) {
if (character == '<') {
retval.append("<");
}
... | Sanitize strings for output. Copy from anet_java_sdk_sample_app\common\helper.jsp |
public void install(RSyntaxTextArea textArea){
if (this.textArea != null) {
uninstall();
}
this.textArea=textArea;
textArea.addCaretListener(this);
}
| Installs this listener on a text area. If it is already installed on another text area, it is uninstalled first. |
public static int schemaInitialId(){
return FNV1_OFFSET_BASIS;
}
| Schema initial ID. |
public long remainder(long instant){
throw unsupported();
}
| Always throws UnsupportedOperationException |
public Vertex randomSynthesize(Vertex source){
log("random synthesize",Level.FINE);
return synthesizeResponse(null,null,null,true,null,source.getNetwork());
}
| Self API for synthesizing a new response. |
public final void testGetEncryptedData03() throws IOException {
boolean performed=false;
for (int i=0; i < EncryptedPrivateKeyInfoData.algName0.length; i++) {
try {
AlgorithmParameters ap=AlgorithmParameters.getInstance(EncryptedPrivateKeyInfoData.algName0[i][0]);
ap.init(EncryptedPrivateKeyInfoData... | Test #3 for <code>getEncryptedData()</code> method <br> Assertion: returns the encrypted data <br> Test preconditions: test object created using ctor which takes algorithm parameters and encrypted data as a parameters <br> Expected: the equivalent encrypted data must be returned |
@HLEFunction(nid=0x7D2F3D7F,version=271) public int sceJpegFinishMJpeg(){
return 0;
}
| Finishes the MJpeg library |
@Override public void save(){
if (hasItem()) {
EventLogConfiguration config=getItem().getEventLogConfiguration();
config.clear();
if (mBinaryLogger.isSelected()) {
config.addLogger(EventLogType.BINARY_MESSAGE);
}
if (mDecodedLogger.isSelected()) {
config.addLogger(EventLogType.DECODED_... | Saves the current configuration as the stored configuration |
public static VOPricedParameter toVOPricedParameter(PricedParameter pricedParam,LocalizerFacade facade){
Parameter parameter=pricedParam.getParameter();
VOParameterDefinition paraDef=ParameterDefinitionAssembler.toVOParameterDefinition(parameter.getParameterDefinition(),facade);
VOPricedParameter result=new VOPri... | Converts a priced parameter to the appropriate value object. |
boolean isSimulation(){
return this.simulation;
}
| Returns true if this is a simulation. |
public boolean easyConfig(String ssid,String password,boolean isVersion2){
JsonObject initJsonObjectParams=broadlinkStandardParams(BroadlinkConstants.CMD_EASY_CONFIG_ID,BroadlinkConstants.CMD_EASY_CONFIG);
initJsonObjectParams.addProperty("ssid",ssid);
initJsonObjectParams.addProperty("password",password);
init... | Magic config |
public Object newInstance(String owner) throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException {
return itemCtor.newInstance(owner);
}
| Called by the APIProviderImpl to construct the API wrapper passed to it on its construction. |
public static boolean canWrite(String fileName){
return FilePath.get(fileName).canWrite();
}
| Check if the file is writable. This method is similar to Java 7 <code>java.nio.file.Path.checkAccess(AccessMode.WRITE)</code> |
public boolean implies(Permission p){
return true;
}
| Checks if the specified permission is "implied" by this object. This method always returns true. |
@DSComment("Utility function") @DSSafe(DSCat.UTIL_FUNCTION) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:27:51.466 -0500",hash_original_method="A988E80FBF926E38476CB13622AE0017",hash_generated_method="7C5E5705B6EC3452A5193A1A55FAF86A") public static boolean isWellFormedSmsAddress... | Return true iff the network portion of <code>address</code> is, as far as we can tell on the device, suitable for use as an SMS destination address. |
public List<Map<String,Object>> query(final String indexName,final String q,final Operator operator,final int offset,final int count){
assert count > 1;
SearchRequestBuilder request=elasticsearchClient.prepareSearch(indexName).setQuery(QueryBuilders.multiMatchQuery(q,"_all").operator(operator).zeroTermsQuery(ZeroTe... | Query with a string and boundaries. The string is supposed to be something that the user types in without a technical syntax. The mapping of the search terms into the index can be different according to a search type. Please see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html.... |
public static boolean isPattern(String pattern){
return pattern.indexOf('*') != -1 || pattern.indexOf('?') != -1;
}
| Returns <code>true</code> if the specified pattern string contains wildcard characters. |
public static void sort(int[] array,int start,int end){
DualPivotQuicksort.sort(array,start,end);
}
| Sorts the specified range in the array in ascending numerical order. |
public static void main(String[] args) throws Exception {
int timeout=Integer.MIN_VALUE;
int maxContentLength=Integer.MIN_VALUE;
String logLevel="info";
boolean followTalk=false;
boolean keepConnection=false;
boolean dumpContent=false;
String urlString=null;
String usage="Usage: Ftp [-logLevel level] [-... | For debugging. |
public void write(ArrayList data){
data.add(xCoord);
data.add(yCoord);
data.add(zCoord);
data.add(dimensionId);
}
| Writes this Coord4D's data to an ArrayList for packet transfer. |
public String toString(){
if (_name != null) return "Lifecycle[" + _name + ", "+ getStateName()+ "]";
else return "Lifecycle[" + getStateName() + "]";
}
| Debug string value. |
public SVG12DOMImplementation(){
factories=svg12Factories;
registerFeature("CSS","2.0");
registerFeature("StyleSheets","2.0");
registerFeature("SVG",new String[]{"1.0","1.1","1.2"});
registerFeature("SVGEvents",new String[]{"1.0","1.1","1.2"});
}
| Creates a new SVGDOMImplementation object. |
private static <T>T attemptLoad(final Class<T> ofClass,final String className){
if (LOG.isLoggable(Level.FINEST)) {
LOG.finest("Attempting service load: " + className);
}
Level level;
Exception thrown;
try {
Class clazz=Class.forName(className);
if (!ofClass.isAssignableFrom(clazz)) {
if (LO... | Attempts to load the specified implementation class. Attempts will fail if - for example - the implementation depends on a class not found on the classpath. |
@Override public void write(byte b[]) throws IOException {
write(b,0,b.length);
}
| Write <code>b.length</code> bytes from the specified byte array to our output stream. |
protected POInfo initPO(Properties ctx){
POInfo poi=POInfo.getPOInfo(ctx,Table_ID,get_TrxName());
return poi;
}
| Load Meta Data |
public int countTestCases(){
return 1;
}
| Counts the number of test cases executed by run(TestResult result). |
public void overwriteSetSelectedText(String str){
if (!overwrite || selectionStart != selectionEnd) {
setSelectedText(str);
return;
}
int caret=getCaretPosition();
int caretLineEnd=getLineEndOffset(getCaretLine());
if (caretLineEnd - caret <= str.length()) {
setSelectedText(str);
return;
}
... | Similar to <code>setSelectedText()</code>, but overstrikes the appropriate number of characters if overwrite mode is enabled. |
public void runTest() throws Throwable {
Document doc;
NodeList elementList;
Element testEmployee;
Attr domesticAttr;
doc=(Document)load("hc_staff",true);
elementList=doc.getElementsByTagName("acronym");
testEmployee=(Element)elementList.item(0);
domesticAttr=testEmployee.getAttributeNode("invalidAttrib... | Runs the test case. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:30:30.339 -0500",hash_original_method="72982976B71B01DF2412198462460DF0",hash_generated_method="3FC970F17DE45AAF7F1BC31C989BC4E0") final public boolean isVisible(){
return isAdded() && !isHidden() && mView != null && mView.getWindowT... | Return true if the fragment is currently visible to the user. This means it: (1) has been added, (2) has its view attached to the window, and (3) is not hidden. |
public boolean checkError(){
Writer delegate=out;
if (delegate == null) {
return ioError;
}
flush();
return ioError || delegate.checkError();
}
| Flushes this writer and returns the value of the error flag. |
private boolean showHelpOnFirstLaunch(){
try {
PackageInfo info=getPackageManager().getPackageInfo(PACKAGE_NAME,0);
int currentVersion=info.versionCode;
SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this);
int lastVersion=prefs.getInt(PreferencesActivity.KEY_HELP_VERSION_SHOWN,... | We want the help screen to be shown automatically the first time a new version of the app is run. The easiest way to do this is to check android:versionCode from the manifest, and compare it to a value stored as a preference. |
public boolean isReviewer(ReviewDb db,@Nullable ChangeData cd) throws OrmException {
if (getUser().isIdentifiedUser()) {
Collection<Account.Id> results=changeData(db,cd).reviewers().all();
return results.contains(getUser().getAccountId());
}
return false;
}
| Is this user a reviewer for the change? |
public CLocalEdgeCommentWrapper(final INaviEdge edge){
m_edge=edge;
}
| Creates a new wrapper object. |
public void reverse(){
long tmp;
int limit=size / 2;
int j=size - 1;
long[] theElements=elements;
for (int i=0; i < limit; ) {
tmp=theElements[i];
theElements[i++]=theElements[j];
theElements[j--]=tmp;
}
}
| Reverses the elements of the receiver. Last becomes first, second last becomes second first, and so on. |
@Override public Boolean visitArray_Array(final AnnotatedArrayType type1,final AnnotatedArrayType type2,final VisitHistory visited){
if (!arePrimeAnnosEqual(type1,type2)) {
return false;
}
return areEqual(type1.getComponentType(),type2.getComponentType(),visited);
}
| Two arrays are equal if: 1) Their sets of primary annotations are equal 2) Their component types are equal |
private void addRoleBasedRecuringCharges(PriceConverter formatter,RDOUserFees userFee,List<RDORole> roles){
for ( RDORole role : roles) {
RDORole existingRole=userFee.getRole(role.getRoleId());
if (existingRole == null) {
userFee.getRoles().add(role);
}
else {
existingRole.setBasePrice(role.... | Merge the given RDORoles into the given RDOUserFees |
public StreamStatusWriter(String path,TwitchApi api){
this.path=path;
this.api=api;
}
| Creates a new instance. |
private static void addWeaponQuirk(List<QuirkEntry> quirkEntries,@Nullable Mounted m,int loc,int slot,String unitId,Entity entity){
if (m == null) {
return;
}
if (m.countQuirks() > 0) {
WeaponQuirks weapQuirks=m.getQuirks();
Enumeration<IOptionGroup> quirksGroup=weapQuirks.getGroups();
Enumeration... | Convenience method for adding a weapon quirk to the quirk entries list. |
public static void toggleFavorite(){
try {
if (musicPlaybackService != null) {
musicPlaybackService.toggleFavorite();
}
}
catch ( final RemoteException ignored) {
}
}
| Toggles the current song as a favorite. |
public void onSwapRemove(int cnt){
swapRemoves.addAndGet(cnt);
if (delegate != null) delegate.onSwapRemove(cnt);
}
| Swap remove callback. |
private final void nextToken(){
if (m_queueMark < m_ops.getTokenQueueSize()) {
m_token=(String)m_ops.m_tokenQueue.elementAt(m_queueMark++);
m_tokenChar=m_token.charAt(0);
}
else {
m_token=null;
m_tokenChar=0;
}
}
| Retrieve the next token from the command and store it in m_token string. |
public static int dp2px(Context context,float dp){
float px=TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,dp,context.getResources().getDisplayMetrics());
return Math.round(px);
}
| Convert a dp float value to pixels |
@Override public void run(){
amIActive=true;
String inputFile;
String outputFile;
int progress;
int i, n;
int numFeatures;
int oneHundredthTotal;
ShapeType shapeType, outputShapeType;
GeometryFactory factory=new GeometryFactory();
double distTolerance=10;
boolean loseNoFeatures=false;
if (args.l... | Used to execute this plugin tool. |
private boolean isIdentifier(String token){
int size=token.length();
for (int i=0; i < size; i++) {
char c=token.charAt(i);
if (isOperator(c)) return false;
}
if (token.startsWith("'") && token.endsWith("'")) return false;
else {
try {
new BigDecimal(token);
return false;
}
c... | Check if token is a valid sql identifier |
@Override public void run(){
amIActive=true;
String inputHeader;
String outputHeader;
int row, col;
int progress=0;
double z, w, wN;
int i, n;
int[] dX={1,1,1,0,-1,-1,-1,0};
int[] dY={-1,0,1,1,1,0,-1,-1};
double largeValue=Float.MAX_VALUE;
double smallValue=0.0001;
boolean somethingDone;
int l... | Used to execute this plugin tool. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.