code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
public static Intent makeObservedFileIntent(Context context,OCFile file,Account account,boolean watchIt){
Intent intent=new Intent(context,FileObserverService.class);
intent.setAction(watchIt ? FileObserverService.ACTION_ADD_OBSERVED_FILE : FileObserverService.ACTION_DEL_OBSERVED_FILE);
intent.putExtra(FileObserverService.ARG_FILE,file);
intent.putExtra(FileObserverService.ARG_ACCOUNT,account);
return intent;
}
| Factory method to create intents that allow to start or stop the observance of a file. |
@SuppressWarnings("rawtypes") public FilteredRowSetImpl(Hashtable env) throws SQLException {
super(env);
}
| Construct a <code>FilteredRowSet</code> with a specified synchronization provider. |
public static void writeConfigFile(File configFile,File searchDir) throws SQLException, IOException {
List<Class<?>> classList=new ArrayList<Class<?>>();
findAnnotatedClasses(classList,searchDir,0);
writeConfigFile(configFile,classList.toArray(new Class[classList.size()]));
}
| Finds the annotated classes in the specified search directory or below and writes a configuration file. |
@Override public void addAttribute(String name,double value){
String str=Double.toString(value);
if (str.endsWith(".0")) str=str.substring(0,str.length() - 2);
current.setAttribute(name,str);
}
| Adds an attribute to current element of the DOM Document. |
public boolean isSelected(){
return m_selected;
}
| Is Selected |
public static void assertNumInstances(Set<PackingPlan.ContainerPlan> containerPlans,String component,int numInstances){
int instancesFound=0;
for ( PackingPlan.ContainerPlan containerPlan : containerPlans) {
for ( PackingPlan.InstancePlan instancePlan : containerPlan.getInstances()) {
if (instancePlan.getComponentName().equals(component)) {
instancesFound++;
}
}
}
Assert.assertEquals(numInstances,instancesFound);
}
| Verifies that the containerPlan contains a specific number of instances for the given component. |
private static BlockNode splitBlock(MethodNode mth,BlockNode block,int splitIndex){
BlockNode newBlock=BlockSplitter.startNewBlock(mth,-1);
newBlock.getSuccessors().addAll(block.getSuccessors());
for ( BlockNode s : new ArrayList<BlockNode>(block.getSuccessors())) {
removeConnection(block,s);
connect(newBlock,s);
}
block.getSuccessors().clear();
connect(block,newBlock);
block.updateCleanSuccessors();
newBlock.updateCleanSuccessors();
List<InsnNode> insns=block.getInstructions();
int size=insns.size();
for (int i=splitIndex; i < size; i++) {
InsnNode insnNode=insns.get(i);
insnNode.add(AFlag.SKIP);
newBlock.getInstructions().add(insnNode);
}
Iterator<InsnNode> it=insns.iterator();
while (it.hasNext()) {
InsnNode insnNode=it.next();
if (insnNode.contains(AFlag.SKIP)) {
it.remove();
}
}
for ( InsnNode insnNode : newBlock.getInstructions()) {
insnNode.remove(AFlag.SKIP);
}
return newBlock;
}
| Split one block into connected 2 blocks with same connections. |
public byte[] processBlock(byte[] in,int inOff,int inLen){
if (core == null) {
throw new IllegalStateException("RSA engine not initialised");
}
return core.convertOutput(core.processBlock(core.convertInput(in,inOff,inLen)));
}
| Process a single block using the basic RSA algorithm. |
public FolderEntry(VirtualFile virtualFile){
super(virtualFile);
}
| Project's folder |
private List<String> splitPhoneNumbers(final String phoneNumber){
final List<String> phoneList=new ArrayList<>();
StringBuilder builder=new StringBuilder();
final int length=phoneNumber.length();
for (int i=0; i < length; i++) {
final char ch=phoneNumber.charAt(i);
if (ch == '\n' && builder.length() > 0) {
phoneList.add(builder.toString());
builder=new StringBuilder();
}
else {
builder.append(ch);
}
}
if (builder.length() > 0) {
phoneList.add(builder.toString());
}
return phoneList;
}
| <p> Splits a given string expressing phone numbers into several strings, and remove unnecessary characters inside them. The size of a returned list becomes 1 when no split is needed. </p> <p> The given number "may" have several phone numbers when the contact entry is corrupted because of its original source. e.g. "111-222-3333 (Miami)\n444-555-6666 (Broward; 305-653-6796 (Miami)" </p> <p> This kind of "phone numbers" will not be created with Android vCard implementation, but we may encounter them if the source of the input data has already corrupted implementation. </p> <p> To handle this case, this method first splits its input into multiple parts (e.g. "111-222-3333 (Miami)", "444-555-6666 (Broward", and 305653-6796 (Miami)") and removes unnecessary strings like "(Miami)". </p> <p> Do not call this method when trimming is inappropriate for its receivers. </p> |
public TObjectLongHashMapDecorator(TObjectLongHashMap<V> map){
super();
this._map=map;
}
| Creates a wrapper that decorates the specified primitive map. |
private boolean addViewItem(int index,boolean first){
View view=getItemView(index);
if (view != null) {
if (first) {
itemsLayout.addView(view,0);
}
else {
itemsLayout.addView(view);
}
return true;
}
return false;
}
| Adds view for item to items layout |
boolean isNonProxySet(String endpoint){
String nonProxy=System.getProperty(HTTP_NON_PROXY_HOSTS);
if (nonProxy != null) {
String[] split=nonProxy.split("\\|");
for (int i=0; i < split.length; i++) {
String np=split[i].trim();
if (np.length() > 0) {
boolean wcStart=np.startsWith("*");
boolean wcEnd=np.endsWith("*");
if (wcStart) {
np=np.substring(1);
}
if (wcEnd) {
np=np.substring(0,np.length() - 1);
}
if (wcStart && wcEnd && endpoint.contains(np)) {
return true;
}
if (wcStart && endpoint.endsWith(np)) {
return true;
}
if (wcEnd && endpoint.startsWith(np)) {
return true;
}
if (np.equals(endpoint)) {
return true;
}
}
}
}
return false;
}
| Checks whether system proxy settings tell to omit proxying for given endpoint. |
private void initialize(){
this.setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR));
this.setResizable(false);
this.setContentPane(getAboutPanel());
this.pack();
centerFrame();
}
| This method initializes this |
public Source copy(){
if (unit != null && unit.isDone()) {
VirtualFile f=new InMemoryFile(unit.getByteCodes(),getName(),MimeMappings.ABC,fileTime);
Source s=new Source(f,pathRoot,relativePath,shortName,owner,isInternal,isRoot,isDebuggable);
s.fileIncludeTimes.putAll(fileIncludeTimes);
s.logger=logger;
CompilationUnit u=s.newCompilationUnit(null,new CompilerContext());
copyCompilationUnit(unit,u,true);
return s;
}
else {
return null;
}
}
| Make a copy of this Source object. Dependencies are multinames in the clone. |
public static String escapeRegex(final String regex){
Matcher match=REGEX_CHARS.matcher(regex);
return match.replaceAll("\\\\$1");
}
| This function will escape special characters within a string to ensure that the string will not be parsed as a regular expression. This is helpful with accepting using input that needs to be used in functions that take a regular expression as an argument (such as String.replaceAll(), or String.split()). |
public List<A> toList(){
shared=true;
return elems;
}
| Convert buffer to a list of all its elements. |
public boolean isI_IsImported(){
Object oo=get_Value(COLUMNNAME_I_IsImported);
if (oo != null) {
if (oo instanceof Boolean) return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
| Get Imported. |
public boolean isWheelScrollingEnabled(){
return wheelScrollState;
}
| Indicates whether or not scrolling will take place in response to the mouse wheel. Wheel scrolling is enabled by default. |
public Object clone() throws CloneNotSupportedException {
WalkingIterator clone=(WalkingIterator)super.clone();
if (null != m_firstWalker) {
clone.m_firstWalker=m_firstWalker.cloneDeep(clone,null);
}
return clone;
}
| Get a cloned WalkingIterator that holds the same position as this iterator. |
private void returnData(Object ret){
if (myHost != null) {
myHost.returnData(ret);
}
}
| Used to communicate a return object from a plugin tool to the main Whitebox user-interface. |
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:36:29.522 -0500",hash_original_method="4CD681E2D11D80A916993A5E2A67B6D2",hash_generated_method="088B63961957732197A9E3C8FB47F4E7") public void onError(SipSession session,int errorCode,String errorMessage){
}
| Called when an error occurs during session initialization and termination. |
private List<VPlexInitiatorInfo> findInitiators(VPlexClusterInfo clusterInfo,List<PortInfo> initiatorPortInfo) throws VPlexApiException {
List<PortInfo> unfoundInitiatorList=new ArrayList<PortInfo>();
unfoundInitiatorList.addAll(initiatorPortInfo);
String clusterName=clusterInfo.getName();
List<VPlexInitiatorInfo> initiatorInfoList=findInitiatorsOnCluster(clusterName,initiatorPortInfo,unfoundInitiatorList);
if (initiatorInfoList.size() == initiatorPortInfo.size()) {
return initiatorInfoList;
}
VPlexApiDiscoveryManager discoveryMgr=_vplexApiClient.getDiscoveryManager();
discoveryMgr.discoverInitiatorsOnCluster(clusterInfo);
initiatorInfoList.addAll(findInitiatorsOnCluster(clusterName,unfoundInitiatorList,null));
return initiatorInfoList;
}
| Finds the initiator ports on the VPlex corresponding to the ports specified in the passed port information. Note that the functions presumes that all initiators to be found are on the same VPlex cluster. This function will execute an initiator discovery if some of the initiators are not found. After the discovery it will then try to find the initiators that could not be found initially. |
public Title(String titleText) throws WikiTitleParsingException {
if (titleText.length() == 0) {
throw new WikiTitleParsingException("Title is empty.");
}
this.rawTitleText=titleText;
String titlePart=null;
String sectionPart=null;
if (rawTitleText.contains("#")) {
titlePart=rawTitleText.substring(0,rawTitleText.lastIndexOf("#"));
sectionPart=rawTitleText.substring(rawTitleText.lastIndexOf("#") + 1,rawTitleText.length());
}
else {
titlePart=rawTitleText;
}
this.sectionText=sectionPart;
String regexFindParts="(.*?)[ _]\\((.+?)\\)$";
Pattern patternNamespace=Pattern.compile(regexFindParts);
Matcher matcherNamespace=patternNamespace.matcher(this.decodeTitleWikistyle(titlePart));
if (matcherNamespace.find()) {
this.entity=matcherNamespace.group(1);
this.disambiguationText=matcherNamespace.group(2);
String relevantTitleParts=this.entity + " (" + this.disambiguationText+ ")";
this.plainTitle=decodeTitleWikistyle(relevantTitleParts);
this.wikiStyleTitle=encodeTitleWikistyle(relevantTitleParts);
}
else {
this.plainTitle=decodeTitleWikistyle(titlePart);
this.wikiStyleTitle=encodeTitleWikistyle(titlePart);
this.entity=this.plainTitle;
this.disambiguationText=null;
}
if (getEntity() == null) {
throw new WikiTitleParsingException("Title was not properly initialized.");
}
}
| Create a title object using a title string. The string gets parsed into an entity part and a disambiguation part. As Wikipedia page names represent spaces as underscores, we create a version with spaces and one without. |
public synchronized void deactivateCheckOid(){
checkOid=false;
}
| Access Control will not check the oids. By default is false. |
public Object clone(){
return this.copy();
}
| Clone the Matrix object. |
public void removeNotification(Notification notification){
notification.removeObserver(this);
notifications.remove(notification);
nContainer.removeNotification(notification);
onValueChanged();
}
| Remove notification. |
@DSComment("Private Method") @DSBan(DSCat.PRIVATE_METHOD) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 13:00:09.090 -0500",hash_original_method="C492543C28BFA45A4A603454FE30EBBB",hash_generated_method="406E91A8533F3B594944B702203E858F") private String readUntil(char[] delimiter,boolean returnText) throws IOException, XmlPullParserException {
int start=position;
StringBuilder result=null;
if (returnText && text != null) {
result=new StringBuilder();
result.append(text);
}
search: while (true) {
if (position + delimiter.length >= limit) {
if (start < position && returnText) {
if (result == null) {
result=new StringBuilder();
}
result.append(buffer,start,position - start);
}
if (!fillBuffer(delimiter.length)) {
checkRelaxed(UNEXPECTED_EOF);
type=COMMENT;
return null;
}
start=position;
}
for (int i=0; i < delimiter.length; i++) {
if (buffer[position + i] != delimiter[i]) {
position++;
continue search;
}
}
break;
}
int end=position;
position+=delimiter.length;
if (!returnText) {
return null;
}
else if (result == null) {
return stringPool.get(buffer,start,end - start);
}
else {
result.append(buffer,start,end - start);
return result.toString();
}
}
| Reads text until the specified delimiter is encountered. Consumes the text and the delimiter. |
public XMLFilter newXMLFilter(Source src) throws TransformerConfigurationException {
Templates templates=newTemplates(src);
if (templates == null) return null;
return newXMLFilter(templates);
}
| Create an XMLFilter that uses the given source as the transformation instructions. |
@XmlTransient public boolean isSelected(){
return mSelected;
}
| Indicates if this channel has been selected for prioritized audio output and display of processing chain products |
public synchronized byte[] toByteArray(){
int remaining=count;
if (remaining == 0) {
return EMPTY_BYTE_ARRAY;
}
byte newbuf[]=new byte[remaining];
int pos=0;
for ( byte[] buf : buffers) {
int c=Math.min(buf.length,remaining);
System.arraycopy(buf,0,newbuf,pos,c);
pos+=c;
remaining-=c;
if (remaining == 0) {
break;
}
}
return newbuf;
}
| Gets the curent contents of this byte stream as a byte array. The result is independent of this stream. |
public MutableInterval(ReadablePeriod period,ReadableInstant end){
super(period,end);
}
| Constructs an interval from a time period and an end instant. <p> When forming the interval, the chronology from the instant is used if present, otherwise the chronology of the period is used. |
public NetworkResponse(int statusCode,byte[] data,Map<String,String> headers,boolean notModified,long networkTimeMs){
this.statusCode=statusCode;
this.data=data;
this.headers=headers;
this.notModified=notModified;
this.networkTimeMs=networkTimeMs;
}
| Creates a new network response. |
public Chunk loadChunk(int p_73158_1_,int p_73158_2_){
return this.provideChunk(p_73158_1_,p_73158_2_);
}
| loads or generates the chunk at the chunk location specified |
public CharacterPickerDialog(Context context,View view,Editable text,String options,boolean insert){
super(context,com.android.internal.R.style.Theme_Panel);
mView=view;
mText=text;
mOptions=options;
mInsert=insert;
mInflater=LayoutInflater.from(context);
}
| Creates a new CharacterPickerDialog that presents the specified <code>options</code> for insertion or replacement (depending on the sense of <code>insert</code>) into <code>text</code>. |
protected POInfo initPO(Properties ctx){
POInfo poi=POInfo.getPOInfo(ctx,Table_ID,get_TrxName());
return poi;
}
| Load Meta Data |
private Object executeLTE(PageContext pc,SQL sql,Query qr,Operation2 expression,int row) throws PageException {
return (executeCompare(pc,sql,qr,expression,row) <= 0) ? Boolean.TRUE : Boolean.FALSE;
}
| execute a less than or equal operation |
protected GenericProcessingInstruction(){
}
| Creates a new ProcessingInstruction object. |
@Override public void activate(){
ValueMap properties=getProperties();
String size=properties.get("size",String.class);
String style=properties.get("style",String.class);
boolean block=properties.get("block",Boolean.class);
StringBuilder css=new StringBuilder("btn");
if (size != null) {
if (size.equals("large")) {
css.append(" btn-lg");
}
else if (size.equals("small")) {
css.append(" btn-sm");
}
else if (size.equals("extraSmall")) {
css.append(" btn-xs");
}
}
if (block) {
css.append(" btn-block");
}
if (style != null) {
if (style.equals("primary")) {
css.append(" btn-primary");
}
else if (style.equals("success")) {
css.append(" btn-success");
}
else if (style.equals("info")) {
css.append(" btn-info");
}
else if (style.equals("warning")) {
css.append(" btn-warning");
}
else if (style.equals("link")) {
css.append(" btn-lnk");
}
else {
css.append(" btn-default");
}
}
cssClass=css.toString();
}
| Initialization of the component. Reads the resource, gets the properties and creates the CSS for the component. Options for "size" are: <ul> <li>large <li>default <li>small <li>extraSmall </ul> Options for "style" are: <ul> <li>default <li>primary <li>success <li>info <li>warning <li>danger <li>link </ul> Options for "block" are true/false. |
public RemoteNodeStatus loadDataFromPull(Node remote,String channelId) throws IOException {
RemoteNodeStatus status=new RemoteNodeStatus(remote != null ? remote.getNodeId() : null,channelId,configurationService.getChannels(false));
loadDataFromPull(remote,status);
return status;
}
| Connect to the remote node and pull data. The acknowledgment of commit/error status is sent separately after the data is processed. |
final public void write(String v,int offset,int length){
try {
_out.print(v,offset,length);
}
catch ( IOException e) {
log.log(Level.FINE,e.toString(),e);
}
}
| Writes a string |
protected void before() throws Throwable {
}
| Override to set up your specific external resource. |
public static long[] copyOfRange(long[] original,int start,int end){
if (start <= end) {
if (original.length >= start && 0 <= start) {
int length=end - start;
int copyLength=Math.min(length,original.length - start);
long[] copy=new long[length];
System.arraycopy(original,start,copy,0,copyLength);
return copy;
}
throw new ArrayIndexOutOfBoundsException();
}
throw new IllegalArgumentException();
}
| Copies elements in original array to a new array, from index start(inclusive) to end(exclusive). The first element (if any) in the new array is original[from], and other elements in the new array are in the original order. The padding value whose index is bigger than or equal to original.length - start is 0L. |
public static void main(String[] argv){
runClassifier(new NaiveBayes(),argv);
}
| Main method for testing this class. |
public AsyncResponse(Throwable ex){
this.executionException=new ExecutionException(ex);
this.isCompletedExceptionally=true;
this.isDone=true;
}
| Create a new, completed AsyncResponse with the supplied Exception. The AsyncResponse is marked as completed exceptionally. When the client invokes one of the <code>get</code> methods, an ExecutionException will be thrown using the supplied Exception as the cause of the ExecutionException. |
public boolean optBoolean(int index,boolean defaultValue){
try {
return this.getBoolean(index);
}
catch ( Exception e) {
return defaultValue;
}
}
| Get the optional boolean value associated with an index. It returns the defaultValue if there is no value at that index or if it is not a Boolean or the String "true" or "false" (case insensitive). |
public void add(OHLCItem item){
ParamChecks.nullNotPermitted(item,"item");
add(item.getPeriod(),item.getOpenValue(),item.getHighValue(),item.getLowValue(),item.getCloseValue());
}
| Adds a data item to the series. The values from the item passed to this method will be copied into a new object. |
public AbstractDataSource(Class<? extends Comparable<?>>... types){
this(null,types);
}
| Initializes a new instance with the specified number of columns and column types. |
public static void passedBranch(int val,int opcode,int branch,int bytecode_id){
ExecutionTracer tracer=getExecutionTracer();
if (tracer.disabled) return;
if (isThreadNeqCurrentThread()) return;
checkTimeout();
ConstantPoolManager.getInstance().addDynamicConstant(val);
double distance_true=0.0;
double distance_false=0.0;
switch (opcode) {
case Opcodes.IFEQ:
distance_true=Math.abs((double)val);
distance_false=distance_true == 0 ? 1.0 : 0.0;
break;
case Opcodes.IFNE:
distance_false=Math.abs((double)val);
distance_true=distance_false == 0 ? 1.0 : 0.0;
break;
case Opcodes.IFLT:
distance_true=val >= 0 ? val + 1.0 : 0.0;
distance_false=val < 0 ? 0.0 - val + 1.0 : 0.0;
break;
case Opcodes.IFGT:
distance_true=val <= 0 ? 0.0 - val + 1.0 : 0.0;
distance_false=val > 0 ? val + 1.0 : 0.0;
break;
case Opcodes.IFGE:
distance_true=val < 0 ? 0.0 - val + 1.0 : 0.0;
distance_false=val >= 0 ? val + 1.0 : 0.0;
break;
case Opcodes.IFLE:
distance_true=val > 0 ? val + 1.0 : 0.0;
distance_false=val <= 0 ? 0.0 - val + 1.0 : 0.0;
break;
default :
logger.error("Unknown opcode: " + opcode);
}
tracer.trace.branchPassed(branch,bytecode_id,distance_true,distance_false);
}
| Called by the instrumented code each time a new branch is taken |
@Override public void draw(Graphics2D g){
drawCircle(g,(Color)getEditor().getHandleAttribute(HandleAttributeKeys.SCALE_HANDLE_FILL_COLOR),(Color)getEditor().getHandleAttribute(HandleAttributeKeys.SCALE_HANDLE_STROKE_COLOR));
}
| Draws this handle. |
@Override public int compareTo(final TDerived rhs){
return this.value.compareTo(rhs.getValue());
}
| Compares this primitive to another TDerived instance. |
private List<FieldInfo> createFieldInfoMap(String str){
fieldInfos=new ArrayList<FieldInfo>();
StringTokenizer strtok=new StringTokenizer(str,RECORD_SEPARATOR);
while (strtok.hasMoreTokens()) {
String[] token=strtok.nextToken().split(FIELD_SEPARATOR);
try {
fieldInfos.add(new FieldInfo(token[0],token[1],SupportType.valueOf(token[2])));
}
catch ( Exception e) {
LOG.error("Invalid support type",e);
}
}
return fieldInfos;
}
| Creates a map representing fieldName in POJO:field in Generic Record:Data type |
private CalendarAlerts(){
}
| This utility class cannot be instantiated |
private Ed25519GroupElement select(final int pos,final int b){
final int bNegative=ByteUtils.isNegativeConstantTime(b);
final int bAbs=b - (((-bNegative) & b) << 1);
final Ed25519GroupElement t=Ed25519Group.ZERO_PRECOMPUTED.cmov(this.precomputedForSingle[pos][0],ByteUtils.isEqualConstantTime(bAbs,1)).cmov(this.precomputedForSingle[pos][1],ByteUtils.isEqualConstantTime(bAbs,2)).cmov(this.precomputedForSingle[pos][2],ByteUtils.isEqualConstantTime(bAbs,3)).cmov(this.precomputedForSingle[pos][3],ByteUtils.isEqualConstantTime(bAbs,4)).cmov(this.precomputedForSingle[pos][4],ByteUtils.isEqualConstantTime(bAbs,5)).cmov(this.precomputedForSingle[pos][5],ByteUtils.isEqualConstantTime(bAbs,6)).cmov(this.precomputedForSingle[pos][6],ByteUtils.isEqualConstantTime(bAbs,7)).cmov(this.precomputedForSingle[pos][7],ByteUtils.isEqualConstantTime(bAbs,8));
final Ed25519GroupElement tMinus=precomputed(t.Y,t.X,t.Z.negate());
return t.cmov(tMinus,bNegative);
}
| Look up 16^i r_i B in the precomputed table. No secret array indices, no secret branching. Constant time. <br> Must have previously precomputed. |
public void method(String param){
}
| A sample method. |
public void printHelp(){
System.err.println("Commands");
System.err.println("help\t\t\tPrint brief description of arguments");
System.err.println("printOptions\t\tPrint the current values of options");
System.err.println();
System.err.print("Boolean Options (");
System.err.print("<option>=true or ");
System.err.println("<option>=false)");
System.err.println("Option Description");
Option o=getFirst();
while (o != null) {
if (o.getType() == Option.BOOLEAN_OPTION) {
String key=o.getKey();
System.err.print(key);
for (int c=key.length(); c < 39; c++) {
System.err.print(" ");
}
System.err.println(o.getDescription());
}
o=o.getNext();
}
System.err.print("\nValue Options (");
System.err.println("<option>=<value>)");
System.err.println("Option Type Description");
o=getFirst();
while (o != null) {
if (o.getType() != Option.BOOLEAN_OPTION && o.getType() != Option.ENUM_OPTION) {
String key=o.getKey();
System.err.print(key);
for (int c=key.length(); c < 31; c++) {
System.err.print(" ");
}
switch (o.getType()) {
case Option.INT_OPTION:
System.err.print("int ");
break;
case Option.ADDRESS_OPTION:
System.err.print("address ");
break;
case Option.FLOAT_OPTION:
System.err.print("float ");
break;
case Option.MICROSECONDS_OPTION:
System.err.print("usec ");
break;
case Option.PAGES_OPTION:
System.err.print("bytes ");
break;
case Option.STRING_OPTION:
System.err.print("string ");
break;
}
System.err.println(o.getDescription());
}
o=o.getNext();
}
System.err.println("\nSelection Options (set option to one of an enumeration of possible values)");
o=getFirst();
while (o != null) {
if (o.getType() == Option.ENUM_OPTION) {
String key=o.getKey();
System.err.print(key);
for (int c=key.length(); c < 31; c++) {
System.err.print(" ");
}
System.err.println(o.getDescription());
System.err.print(" { ");
boolean first=true;
for (String val : ((EnumOption)o).getValues()) {
System.err.print(first ? "" : ", ");
System.err.print(val);
first=false;
}
System.err.println(" }");
}
o=o.getNext();
}
Main.exitWithFailure();
}
| Print a short description of every option |
public boolean hasReceiversFor(DistributedMember endPoint){
ConnectionTable ct=this.conTable;
return (ct != null) && ct.hasReceiversFor(endPoint);
}
| check to see if there are still any receiver threads for the given end-point |
public void runTest() throws Throwable {
Document doc;
NodeList elementList;
Node nameNode;
CharacterData child;
doc=(Document)load("hc_staff",true);
elementList=doc.getElementsByTagName("acronym");
nameNode=elementList.item(0);
child=(CharacterData)nameNode.getFirstChild();
{
boolean success=false;
try {
child.deleteData(-5,3);
}
catch ( DOMException ex) {
success=(ex.code == DOMException.INDEX_SIZE_ERR);
}
assertTrue("throws_INDEX_SIZE_ERR",success);
}
}
| Runs the test case. |
public void java_lang_reflect_Proxy_defineClass0(SootMethod method,ReferenceVariable thisVar,ReferenceVariable returnVar,ReferenceVariable params[]){
throw new NativeMethodNotSupportedException(method);
}
| We have to assume all possible classes will be returned. But it is still possible to make a new class. NOTE: assuming a close world, and this method should not be called. private static native java.lang.Class defineClass0(java.lang.ClassLoader, java.lang.String, byte[], int, int); |
public ScaleIOVolume queryVolume(String volId) throws Exception {
ClientResponse response=get(URI.create(ScaleIOConstants.getVolumeURI(volId)));
return getResponseObject(ScaleIOVolume.class,response);
}
| Query the volume details |
private void gsave(){
GState oldGState=getGState();
mGStateStack.add(new GState(oldGState));
mPSStream.println(GSAVE_STR);
}
| Emit a PostScript gsave command and add a new GState on to our stack which represents the printer's gstate stack. |
@NonNull public static Animator rotateTo(float rotation){
return rotateTo(rotation,0);
}
| Rotates view to specified degree instantly |
public void indent(){
currentIndentLevel++;
}
| Increases indentation level from the next line to be written, onwards. |
public AnnotationsDecorator(final ProcessRendererView view,final AnnotationsVisualizer visualizer,final AnnotationsModel model){
this.view=view;
this.model=model;
this.rendererModel=view.getModel();
this.drawer=new AnnotationDrawer(model,rendererModel);
this.hook=new AnnotationEventHook(this,model,visualizer,drawer,view,rendererModel);
this.visualizer=visualizer;
}
| Creates a new workflow annotation decorator |
private void lockFocus(){
Log.d(TAG,"lockFocus: ");
try {
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER,CameraMetadata.CONTROL_AF_TRIGGER_START);
mState=STATE_WAITING_LOCK;
mCaptureSession.setRepeatingRequest(mPreviewRequestBuilder.build(),mCaptureCallback,mBackgroundHandler);
}
catch ( CameraAccessException e) {
Log.e(TAG,"CameraAccessException: " + e);
e.printStackTrace();
}
}
| Lock the focus as the first step for a still image capture. |
public boolean canWrite(){
return true;
}
| The stream is always writable (?) |
public static void writeTo(OutputStream stream,byte[] value) throws IOException, InterruptedException {
BufferedOutputStream os=new BufferedOutputStream(stream);
try {
for ( byte element : value) {
Streams.checkIfCanceled();
os.write(element);
}
os.flush();
}
finally {
close(os);
}
}
| Writes all bytes to the given stream. |
public void removePerspective(Perspective perspective){
if (!perspective.isUserDefined()) {
return;
}
model.deletePerspective(perspective);
if (model.getSelectedPerspective() == perspective && !model.getAllPerspectives().isEmpty()) {
showPerspective(model.getAllPerspectives().get(0));
}
}
| Removes the given perspective. If the perspective which should be deleted is also the selected perspective, the first perspective will be shown. |
public SimpleHash(int tableSize){
this.tableSize=tableSize;
}
| Hash needs to know size of the table. |
public String encodeBody(){
return this.getLanguageTag();
}
| Canonical encoding of the value of the header. |
private Base64(){
}
| Defeats instantiation. |
public CorePlusQueriesParser(Analyzer analyzer,QueryParser parser){
this(null,analyzer,parser);
}
| Construct an XML parser that uses a single instance QueryParser for handling UserQuery tags - all parse operations are synchronized on this parser |
public Fraction multiplyBy(final Fraction fraction){
if (fraction == null) {
throw new IllegalArgumentException("The fraction must not be null");
}
if (numerator == 0 || fraction.numerator == 0) {
return ZERO;
}
final int d1=greatestCommonDivisor(numerator,fraction.denominator);
final int d2=greatestCommonDivisor(fraction.numerator,denominator);
return getReducedFraction(mulAndCheck(numerator / d1,fraction.numerator / d2),mulPosAndCheck(denominator / d2,fraction.denominator / d1));
}
| <p>Multiplies the value of this fraction by another, returning the result in reduced form.</p> |
@Override public boolean isActive(){
return amIActive;
}
| Used by the Whitebox GUI to tell if this plugin is still running. |
public static void encodeFileToFile(String infile,String outfile) throws java.io.IOException {
String encoded=Base64.encodeFromFile(infile);
java.io.OutputStream out=null;
try {
out=new java.io.BufferedOutputStream(new java.io.FileOutputStream(outfile));
out.write(encoded.getBytes("US-ASCII"));
}
catch ( java.io.IOException e) {
throw e;
}
finally {
try {
if (out != null) out.close();
}
catch ( Exception ex) {
}
}
}
| Reads <tt>infile</tt> and encodes it to <tt>outfile</tt>. |
public static void sleep(long millis){
try {
Thread.sleep(millis);
}
catch ( InterruptedException e) {
Thread.currentThread().interrupt();
}
}
| Invokes Thread.sleep(). If sleep() is interrupted, interrupted-state will be asserted again, in order to support cancellation. For explanation of cancellation in this context, see: http://g.oswego.edu/dl/cpj/cancel.html |
private void pruneStack(){
while (true) {
Entry<V> last=stack.stackPrev;
if (last.isHot()) {
break;
}
removeFromStack(last);
}
}
| Ensure the last entry of the stack is cold. |
@Override public void cancelThrottleRequest(int address,boolean isLong,ThrottleListener l){
if (waitingForNotification.containsKey(address)) {
waitingForNotification.get(address).interrupt();
waitingForNotification.remove(address);
}
super.cancelThrottleRequest(address,isLong,l);
}
| Cancel a request for a throttle |
public void initService(Ads ads){
this.os=Display.getInstance().getPlatformName();
if (os.equals("and")) {
if (banner) {
po=559;
}
else {
po=600;
}
}
else if (os.equals("rim")) {
if (banner) {
po=635;
}
else {
po=634;
}
}
else if (os.equals("ios")) {
if (banner) {
if (Display.getInstance().isTablet()) {
po=947;
}
else {
po=642;
}
}
else {
if (Display.getInstance().isTablet()) {
po=946;
}
else {
po=632;
}
}
}
else if (os.equals("me")) {
if (banner) {
po=551;
}
else {
po=519;
}
}
String url=REQUEST_URL;
setPost(false);
setUrl(url);
addParam(this,"aid",ads.getAppID());
addParam(this,"po","" + po);
String version=protocolVersion;
addParam(this,"v",version);
if (os.equals("ios")) {
hid=Display.getInstance().getProperty("UDID",null);
}
else {
hid=Display.getInstance().getProperty("IMEI",null);
}
addParam(this,"hid",hid);
addParam(this,"w","" + Display.getInstance().getDisplayWidth());
addParam(this,"h","" + Display.getInstance().getDisplayHeight());
addParam(this,"a",ads.getAge());
addParam(this,"g",ads.getGender());
addParam(this,"c",ads.getCategory());
addParam(this,"l",ads.getLocation());
addParam(this,"mn",Display.getInstance().getProperty("MSISDN",null));
String[] keywords=ads.getKeywords();
if (keywords != null && keywords.length > 0) {
int klen=keywords.length;
String k="";
for (int i=0; i < klen; i++) {
k+="," + keywords[i];
}
addParam(this,"k",k.substring(1));
}
if (testAds) {
addParam(this,"test","1");
}
setDuplicateSupported(true);
}
| initialize the ads service |
@Action(value="/receipts/challan-newform") @ValidationErrorPage(value=ERROR) @SkipValidation public String newform(){
setLoginDept();
SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy");
try {
cutOffDate=sdf.parse(collectionsUtil.getAppConfigValue(CollectionConstants.MODULE_NAME_COLLECTIONS_CONFIG,CollectionConstants.APPCONFIG_VALUE_COLLECTIONDATAENTRYCUTOFFDATE));
}
catch ( ParseException e) {
LOGGER.error(getText("Error parsing Cut Off Date") + e.getMessage());
}
return NEW;
}
| This method is invoked when the user clicks on Create Challan from Menu Tree |
@Override public void close() throws IOException {
in.close();
}
| Closes this stream. This implementation closes the filtered stream. |
@Override public String toString(){
StringBuilder message=new StringBuilder();
for (int i=0; i < size(); i++) {
if (i > 0) message.append(" --> ");
message.append(elementAt(i));
}
return message.toString();
}
| Return a string representation of the context. |
@Override public void updateArray(int columnIndex,Array x) throws SQLException {
throw unsupported("setArray");
}
| [Not supported] |
public boolean increment(K key){
return adjustValue(key,1);
}
| Increments the primitive value mapped to key by 1 |
public Object clone(){
DoubleBufferSet copy=(DoubleBufferSet)super.clone();
copy.buffers=(DoubleBuffer[])copy.buffers.clone();
for (int i=buffers.length; --i >= 0; ) {
copy.buffers[i]=(DoubleBuffer)copy.buffers[i].clone();
}
return copy;
}
| Returns a deep copy of the receiver. |
@After public void tearDown() throws Exception {
}
| Method tearDown. |
private MemberMXBean createMemberMXBeanForManagerUsingProxy(final MBeanServer server,final ObjectName managingMemberObjectName){
return JMX.newMXBeanProxy(server,managingMemberObjectName,MemberMXBean.class);
}
| Creates a Proxy using the Platform MBeanServer and ObjectName in order to access attributes and invoke operations on the GemFire Manager's MemberMXBean. |
public byte[] toByteArray(){
if (index > 0xFFFF) {
throw new RuntimeException("Class file too large!");
}
int size=24 + 2 * interfaceCount;
int nbFields=0;
FieldWriter fb=firstField;
while (fb != null) {
++nbFields;
size+=fb.getSize();
fb=(FieldWriter)fb.fv;
}
int nbMethods=0;
MethodWriter mb=firstMethod;
while (mb != null) {
++nbMethods;
size+=mb.getSize();
mb=(MethodWriter)mb.mv;
}
int attributeCount=0;
if (bootstrapMethods != null) {
++attributeCount;
size+=8 + bootstrapMethods.length;
newUTF8("BootstrapMethods");
}
if (ClassReader.SIGNATURES && signature != 0) {
++attributeCount;
size+=8;
newUTF8("Signature");
}
if (sourceFile != 0) {
++attributeCount;
size+=8;
newUTF8("SourceFile");
}
if (sourceDebug != null) {
++attributeCount;
size+=sourceDebug.length + 6;
newUTF8("SourceDebugExtension");
}
if (enclosingMethodOwner != 0) {
++attributeCount;
size+=10;
newUTF8("EnclosingMethod");
}
if ((access & Opcodes.ACC_DEPRECATED) != 0) {
++attributeCount;
size+=6;
newUTF8("Deprecated");
}
if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
if ((version & 0xFFFF) < Opcodes.V1_5 || (access & ACC_SYNTHETIC_ATTRIBUTE) != 0) {
++attributeCount;
size+=6;
newUTF8("Synthetic");
}
}
if (innerClasses != null) {
++attributeCount;
size+=8 + innerClasses.length;
newUTF8("InnerClasses");
}
if (ClassReader.ANNOTATIONS && anns != null) {
++attributeCount;
size+=8 + anns.getSize();
newUTF8("RuntimeVisibleAnnotations");
}
if (ClassReader.ANNOTATIONS && ianns != null) {
++attributeCount;
size+=8 + ianns.getSize();
newUTF8("RuntimeInvisibleAnnotations");
}
if (ClassReader.ANNOTATIONS && tanns != null) {
++attributeCount;
size+=8 + tanns.getSize();
newUTF8("RuntimeVisibleTypeAnnotations");
}
if (ClassReader.ANNOTATIONS && itanns != null) {
++attributeCount;
size+=8 + itanns.getSize();
newUTF8("RuntimeInvisibleTypeAnnotations");
}
if (attrs != null) {
attributeCount+=attrs.getCount();
size+=attrs.getSize(this,null,0,-1,-1);
}
size+=pool.length;
ByteVector out=new ByteVector(size);
out.putInt(0xCAFEBABE).putInt(version);
out.putShort(index).putByteArray(pool.data,0,pool.length);
int mask=Opcodes.ACC_DEPRECATED | ACC_SYNTHETIC_ATTRIBUTE | ((access & ACC_SYNTHETIC_ATTRIBUTE) / TO_ACC_SYNTHETIC);
out.putShort(access & ~mask).putShort(name).putShort(superName);
out.putShort(interfaceCount);
for (int i=0; i < interfaceCount; ++i) {
out.putShort(interfaces[i]);
}
out.putShort(nbFields);
fb=firstField;
while (fb != null) {
fb.put(out);
fb=(FieldWriter)fb.fv;
}
out.putShort(nbMethods);
mb=firstMethod;
while (mb != null) {
mb.put(out);
mb=(MethodWriter)mb.mv;
}
out.putShort(attributeCount);
if (bootstrapMethods != null) {
out.putShort(newUTF8("BootstrapMethods"));
out.putInt(bootstrapMethods.length + 2).putShort(bootstrapMethodsCount);
out.putByteArray(bootstrapMethods.data,0,bootstrapMethods.length);
}
if (ClassReader.SIGNATURES && signature != 0) {
out.putShort(newUTF8("Signature")).putInt(2).putShort(signature);
}
if (sourceFile != 0) {
out.putShort(newUTF8("SourceFile")).putInt(2).putShort(sourceFile);
}
if (sourceDebug != null) {
int len=sourceDebug.length;
out.putShort(newUTF8("SourceDebugExtension")).putInt(len);
out.putByteArray(sourceDebug.data,0,len);
}
if (enclosingMethodOwner != 0) {
out.putShort(newUTF8("EnclosingMethod")).putInt(4);
out.putShort(enclosingMethodOwner).putShort(enclosingMethod);
}
if ((access & Opcodes.ACC_DEPRECATED) != 0) {
out.putShort(newUTF8("Deprecated")).putInt(0);
}
if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
if ((version & 0xFFFF) < Opcodes.V1_5 || (access & ACC_SYNTHETIC_ATTRIBUTE) != 0) {
out.putShort(newUTF8("Synthetic")).putInt(0);
}
}
if (innerClasses != null) {
out.putShort(newUTF8("InnerClasses"));
out.putInt(innerClasses.length + 2).putShort(innerClassesCount);
out.putByteArray(innerClasses.data,0,innerClasses.length);
}
if (ClassReader.ANNOTATIONS && anns != null) {
out.putShort(newUTF8("RuntimeVisibleAnnotations"));
anns.put(out);
}
if (ClassReader.ANNOTATIONS && ianns != null) {
out.putShort(newUTF8("RuntimeInvisibleAnnotations"));
ianns.put(out);
}
if (ClassReader.ANNOTATIONS && tanns != null) {
out.putShort(newUTF8("RuntimeVisibleTypeAnnotations"));
tanns.put(out);
}
if (ClassReader.ANNOTATIONS && itanns != null) {
out.putShort(newUTF8("RuntimeInvisibleTypeAnnotations"));
itanns.put(out);
}
if (attrs != null) {
attrs.put(this,null,0,-1,-1,out);
}
if (invalidFrames) {
anns=null;
ianns=null;
attrs=null;
innerClassesCount=0;
innerClasses=null;
bootstrapMethodsCount=0;
bootstrapMethods=null;
firstField=null;
lastField=null;
firstMethod=null;
lastMethod=null;
computeMaxs=false;
computeFrames=true;
invalidFrames=false;
new ClassReader(out.data).accept(this,ClassReader.SKIP_FRAMES);
return toByteArray();
}
return out.data;
}
| Returns the bytecode of the class that was build with this class writer. |
private void extractAndSetCoverArt(OCFile file){
if (file.isAudio()) {
try {
MediaMetadataRetriever mmr=new MediaMetadataRetriever();
mmr.setDataSource(file.getStoragePath());
byte[] data=mmr.getEmbeddedPicture();
if (data != null) {
Bitmap bitmap=BitmapFactory.decodeByteArray(data,0,data.length);
mImagePreview.setImageBitmap(bitmap);
}
else {
mImagePreview.setImageResource(R.drawable.logo);
}
}
catch ( Throwable t) {
mImagePreview.setImageResource(R.drawable.logo);
}
}
}
| tries to read the cover art from the audio file and sets it as cover art. |
private static void checkForNullElement(Object[] arg,String argName){
if ((arg == null) || (arg.length == 0)) {
throw new IllegalArgumentException("Argument " + argName + "[] cannot be null or empty.");
}
for (int i=0; i < arg.length; i++) {
if (arg[i] == null) {
throw new IllegalArgumentException("Argument's element " + argName + "["+ i+ "] cannot be null.");
}
}
}
| Checks that Object[] arg is neither null nor empty (ie length==0) and that it does not contain any null element. |
public boolean monthBefore(DateOnlyCalendar other){
int day=other.get(DAY_OF_MONTH);
other.set(DAY_OF_MONTH,1);
boolean before=getTimeInMillis() < other.getTimeInMillis();
other.set(DAY_OF_MONTH,day);
return before;
}
| Checks if this instance falls in some month before given instance |
public static String toStringLow(long[] v,int minw){
if (v == null) {
return "null";
}
int mag=magnitude(v);
mag=mag >= minw ? mag : minw;
if (mag == 0) {
return "0";
}
char[] digits=new char[mag];
int pos=0;
outer: for (int w=0; w < v.length; w++) {
long f=1L;
for (int i=0; i < Long.SIZE; i++) {
digits[pos]=((v[w] & f) == 0) ? '0' : '1';
f<<=1;
++pos;
if (pos >= mag) {
break outer;
}
}
}
for (; pos < mag; ++pos) {
digits[pos]='0';
}
return new String(digits);
}
| Convert bitset to a string consisting of "0" and "1", in low-endian order. |
public ClusterInfo resetProps(PropertyList propertyList,boolean removeObsoleteProps){
UriBuilder builder=client.uriBuilder(CONFIG_PROP_RESET_URL);
if (removeObsoleteProps) {
addQueryParam(builder,REMOVE_OBSOLETE_PARAM,REMOVE_OBSOLETE);
}
return client.postURI(ClusterInfo.class,propertyList,builder.build());
}
| Reset configuration properties to their default values. Properties with no default values will remain unchanged. <p> API Call: POST /config/properties/reset |
public JSONArray(){
this.myArrayList=new ArrayList<Object>();
}
| Construct an empty JSONArray. |
public static <T extends IService>void registerService(final Class<T> clazz,final T implementation){
Check.assumeNotNull(clazz,"Param 'clazz' not null");
Check.assumeNotNull(implementation,"Param 'implementation' not null");
checkAndRegister(clazz,implementation);
}
| Register a new service class and an implementing instance. |
public static int v(String tag,Object... msg){
return isPrint ? android.util.Log.v(tag,getLogMessage(msg)) : -1;
}
| Log with object list |
private void returnData(Object ret){
if (myHost != null) {
myHost.returnData(ret);
}
}
| Used to communicate a return object from a plugin tool to the main Whitebox user-interface. |
public void runTest() throws Throwable {
Document doc;
NodeList elementList;
Node nameNode;
CharacterData child;
String substring;
doc=(Document)load("staff",false);
elementList=doc.getElementsByTagName("name");
nameNode=elementList.item(0);
child=(CharacterData)nameNode.getFirstChild();
substring=child.substringData(9,10);
assertEquals("characterdataSubStringExceedsValueAssert","Martin",substring);
}
| Runs the test case. |
public Object clone(){
IntVector u=new IntVector(size());
for (int i=0; i < size(); i++) u.V[i]=V[i];
return u;
}
| Clones the IntVector object. |
static MediaType createApplicationType(String subtype){
return create(APPLICATION_TYPE,subtype);
}
| Creates a media type with the "application" type and the given subtype. |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.