code stringlengths 10 174k | nl stringlengths 3 129k |
|---|---|
public boolean retainAll(Collection<?> c){
if (c == null) throw new NullPointerException();
final ReentrantLock lock=this.lock;
lock.lock();
try {
Object[] elements=getArray();
int len=elements.length;
if (len != 0) {
int newlen=0;
Object[] temp=new Object[len];
for (int i=0; i <... | Retains only the elements in this list that are contained in the specified collection. In other words, removes from this list all of its elements that are not contained in the specified collection. |
public EncryptedDataElement(Element encDataElement){
initEncryptionElement(encDataElement);
}
| Construct an EncryptedDataElement object with an encData element. |
private void testTable(){
for (int j=0; j < ((NumericTable)table.getData()).getRowCount(); j++) {
((NumericTable)table.getData()).setCurrentRow(j);
table.scrollRectToVisible(table.getCellRect(((NumericTable)table.getData()).getCurrentRow(),table.getColumnCount(),true));
testRow();
}
}
| Advance through the entire table and test each row. |
public static void addValidator(IFrancaExternalValidator validator,String mode){
if (validatorMap == null) {
validatorMap=ArrayListMultimap.create();
}
putToMap(validator,mode);
}
| Add validator to registry with a given check mode. This should only be used in standalone mode. For the IDE, use the extension point (see above) for registration. |
@Override public void read(ArrayDataInput dis) throws TruncatedFileException, IOException {
if (dis instanceof RandomAccess) {
this.fileOffset=FitsUtil.findOffset(dis);
}
else {
this.fileOffset=-1;
}
boolean firstCard=true;
HeaderCardCountingArrayDataInput cardCountingArray=new HeaderCardCountingArra... | Read a stream for header data. |
protected boolean canParseContentType(String mimeType){
return ColladaConstants.COLLADA_MIME_TYPE.equals(mimeType) || "text/plain".equals(mimeType) || "text/xml".equals(mimeType);
}
| Determines if a MIME type can be parsed as COLLADA. Parsable types are the COLLADA MIME type, as well as "text/plain" and "text/xml". |
public ExtensibleIndex createUnsigned(){
return mType.createUnsigned(mLength);
}
| Create an unsigned index of the specified length and type. |
public static boolean containsTypeParameter(Type type){
if (type.isTypeParameter()) return true;
for ( Type pt : type.getTypeArgumentList()) {
if (containsTypeParameter(pt)) {
return true;
}
}
if (type.isIntersection()) {
List<Type> types=type.getSatisfiedTypes();
for (int i=0, l=types.... | Returns true if the given produced type is a type parameter or has type arguments which are type parameters. |
public String str(){
return (null != m_obj) ? ((String)m_obj) : "";
}
| Cast result object to a string. |
public static boolean isClassicWindows(){
return isClassicWindows;
}
| Gets the state of the flag which indicates if the old Windows look and feel should be rendered. This flag is used by the component UI delegates as a hint to determine which style the component should be rendered. |
public synchronized int addPeers(List<Peer> newPeers){
int nonDuplicateCount=0;
for ( Peer p : newPeers) {
if (addPeer(p)) {
nonDuplicateCount++;
}
}
return nonDuplicateCount;
}
| Add list of peers to the current peers list, just as though they were added individually with newPeer(). |
public Builder messageTimeout(Duration messageTimeout){
this.messageTimeout=messageTimeout;
return this;
}
| Sets the timeout for a message (will be retried if an ack is not received within the specified duration). |
public Object invokeMethodSynchronously(StorageSystem storageDevice,CIMObjectPath objectPath,String methodName,CIMArgument[] inArgs,CIMArgument[] outArgs,SmisJob job) throws WBEMException, SmisException {
Object obj=invokeMethod(storageDevice,objectPath,methodName,inArgs,outArgs);
CIMObjectPath cimJobPath=_cimPath.... | Makes a call to SMIS provider and returns the response back to the caller. If the SMIS call is a asynchronous, it waits for the SMIS job to complete before returning. This is done to allow callers to make consecutive asynchronous calls without the need for a workflow. <em>This function should be used for asynchronous S... |
private final void resize(){
final long[] newlist=allocate(list.length + DELTA);
java.lang.System.arraycopy(list,0,newlist,0,size);
list=newlist;
}
| Resize the list. Increase its capacity by DELTA elements. Any call to this method must be protected by a synchronized block on this LongList. |
public void resetTo(int begin,int end){
this.diet=false;
this.initialPosition=this.startPosition=this.currentPosition=begin;
if (this.source != null && this.source.length < end) {
this.eofPosition=this.source.length;
}
else {
this.eofPosition=end < Integer.MAX_VALUE ? end + 1 : end;
}
this.commentP... | Reposition the scanner on some portion of the original source. The given endPosition is the last valid position. Beyond this position, the scanner will answer EOF tokens (<code>ITerminalSymbols.TokenNameEOF</code>). |
public void add(int value){
throwIfImmutable();
growIfNeeded();
values[size++]=value;
if (sorted && (size > 1)) {
sorted=(value >= values[size - 2]);
}
}
| Adds an element to the end of the list. This will increase the list's capacity if necessary. |
@Nullable public FailedNodeException[] failures(){
return null;
}
| The failed nodes, if set to be captured. |
public CTrackingResultContainer(final IViewContainer viewContainer,final ZyGraph graph){
m_viewContainer=Preconditions.checkNotNull(viewContainer,"IE01683: View container argument can not be null");
m_graph=Preconditions.checkNotNull(graph,"IE01684: Graph argument can not be null");
}
| Creates a new results container object. |
@Override public PLCameraParameters clone(){
return new PLCameraParameters(this);
}
| clone methods |
public String toString(){
return String.format("%02d:%02d:%04.1f\n",this.hour,this.minute,this.second);
}
| Returns a String representation of the time. |
public static Sequence concatenate(List<Sequence> sequences){
List<SimpleList<Statement>> statements1=new ArrayList<>();
int newHashCode=0;
int newNetSize=0;
for ( Sequence c : sequences) {
newHashCode+=c.savedHashCode;
newNetSize+=c.savedNetSize;
statements1.add(c.statements);
}
return new Seq... | Create a new sequence that is the concatenation of the given sequences. |
public boolean isReboot(){
return reboot;
}
| Ruft den Wert der reboot-Eigenschaft ab. |
public void addChangeListener(ChartChangeListener listener){
ParamChecks.nullNotPermitted(listener,"listener");
this.changeListeners.add(ChartChangeListener.class,listener);
}
| Registers an object for notification of changes to the chart. |
private static boolean isInnerJoint(Point jointPoint,Rect pathBBox,double miterLimit,double halfWeight){
if ((jointPoint.x - pathBBox.xMin) > miterLimit * halfWeight && (pathBBox.xMax - jointPoint.x) > miterLimit * halfWeight && (jointPoint.y - pathBBox.yMin) > miterLimit * halfWeight && (pathBBox.yMax - jointPoint.y... | Returns true when a joint is an inner joint (lies miterLimit*strokeWeight/2 away from pathBox). |
public static void checkState(boolean expression){
if (!expression) {
throw new IllegalStateException();
}
}
| Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method. |
@Override @SuppressWarnings("try") public void close() throws IOException {
try (SequencesReader ignored=mSingle){
}
finally {
try (SequencesReader ignored=mLeft){
}
finally {
try (SequencesReader ignored=mRight){
}
}
}
}
| Closes the internal Sequence Readers |
public int hashCode(){
return rp == null ? m : m + rp.hashCode();
}
| Returns the hashcode value for this finite field. |
public boolean isDConnectedTo(Node node1,Node node2,List z){
throw new UnsupportedOperationException();
}
| Determines whether one node is d-separated from another. According to Spirtes, Richardson & Meek, two nodes are d- connected given some conditioning set Z if there is an acyclic undirected path U between them, such that every collider on U is an ancestor of some element in Z and every non-collider on U is not in Z.... |
@Override public void onFinished(BuildStatus buildStatus){
if (buildStatus == BuildStatus.SUCCESSFUL) {
projectExplorer.reloadChildren();
namesByTypes.clear();
widgetByTypes.clear();
view.clear();
updateGenerateButton();
}
}
| Callback used when build has been finished |
@Override protected void start(){
if (Cfg.DEBUG) {
Check.log(TAG + " (actualStart)");
}
readChatWeChatMessages();
}
| Estrae dal file RegisterPhone.xml il numero di telefono |
public Relation createAndInsertRelation(List<OsmElement> members){
dirty=true;
Relation relation=factory.createRelationWithNewId();
insertElementUnsafe(relation);
if (members != null) {
for ( OsmElement e : members) {
undo.save(e);
RelationMember rm=new RelationMember("",e);
relation.ad... | Create empty relation |
public T onkeyup(String value){
return attr("onkeyup",value);
}
| Sets the <code>onkeyup</code> attribute on the last started tag that has not been closed. |
public void onItemClick(AdapterView parent,View view,int position,long id){
String result=String.valueOf(mOptions.charAt(position));
replaceCharacterAndClose(result);
}
| Handles clicks on the character buttons. |
public CResolveAllFunctionsSingleAddressSpaceAction(final JComponent parent,final IDatabase database,final INaviAddressSpace addressSpace){
super("Resolve all imported functions");
m_parent=Preconditions.checkNotNull(parent,"IE01915: Parent argument can not be null");
m_database=Preconditions.checkNotNull(databas... | Creates a new action object. |
public ParsedQuery parseQuery(BytesReference source){
try {
ParsedQuery parsedQuery=null;
XContentParser parser=XContentHelper.createParser(source);
for (XContentParser.Token token=parser.nextToken(); token != XContentParser.Token.END_OBJECT; token=parser.nextToken()) {
if (token == XContentParser.T... | Selectively parses a query from a top level query or query_binary json field from the specified source. |
private boolean hasConnectivityToAllSystems(Initiator initiator,Collection<URI> storageSystems,List<URI> connectedStorageSystems,ExportGroup exportGroup){
boolean hasConnectivity=true;
if (connectedStorageSystems != null) {
connectedStorageSystems.addAll(storageSystems);
}
for ( URI storage : storageSystem... | Checks if an initiator has connectivity to a storage system in a varray. |
public void testCFII_ServerStartLater_Block() throws Exception {
ensureServerClosed();
assertTrue(this.channel1.isBlocking());
statusNotConnected_NotPending();
try {
this.channel1.connect(localAddr1);
fail("Should throw a ConnectException here.");
}
catch ( ConnectException e) {
}
statusChannelC... | no server-->connect-->server open-->finish-->close |
public static ListenNowFragment newInstance(){
return new ListenNowFragment();
}
| Use this factory method to create a new instance of this fragment using the provided parameters. |
public void show(){
mHandler.post(mShow);
if (mDuration > 0) {
mHandler.postDelayed(mHide,mDuration);
}
}
| schedule handleShow into the right thread |
@Command(description="Generate key on token") public void generateKey(@Param(name="tokenId",description="Token ID") String tokenId) throws Exception {
Map<String,Object> logData=new LinkedHashMap<>();
logData.put(TOKEN_ID_PARAM,tokenId);
KeyInfo response;
try {
response=SignerClient.execute(new GenerateKey(... | Generate key on token. |
public Entity insertPhoto(final String description,final String userId) throws DatastoreException {
List<Property> properties=ImmutableList.of(makeProperty("description",makeValue(description)).build(),makeProperty("userId",makeValue(userId)).build(),makeProperty("date",makeValue(new Date())).build(),makeProperty("fl... | Inserts a new photo flag. |
void cancelDisplayTaskFor(ImageAware imageAware){
cacheKeysForImageAwares.remove(imageAware.getId());
}
| Cancels the task of loading and displaying image for incoming <b>imageAware</b>. |
public void startDelayed(int seconds) throws SchedulerException {
try {
getRemoteScheduler().startDelayed(seconds);
}
catch ( RemoteException re) {
throw invalidateHandleCreateException("Error communicating with remote scheduler.",re);
}
}
| <p> Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>. </p> |
public static boolean isNetworkAvailable(Context context){
ConnectivityManager cm=(ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo=cm.getActiveNetworkInfo();
return netInfo != null && netInfo.isConnectedOrConnecting();
}
| check availability of Internet |
public void writeExif(byte[] jpeg,String exifOutFileName) throws FileNotFoundException, IOException {
if (jpeg == null || exifOutFileName == null) {
throw new IllegalArgumentException(NULL_ARGUMENT_STRING);
}
OutputStream s=null;
try {
s=getExifWriterStream(exifOutFileName);
s.write(jpeg,0,jpeg.leng... | Writes the tags from this ExifInterface object into a jpeg image, removing prior exif tags. |
public void add(final AbstractInsnNode insn){
++size;
if (last == null) {
first=insn;
last=insn;
}
else {
last.next=insn;
insn.prev=last;
}
last=insn;
cache=null;
insn.index=0;
}
| Adds the given instruction to the end of this list. |
public Task resize(String clusterId,int size) throws IOException {
String path=String.format("%s/%s/resize",getBasePath(),clusterId);
ClusterResizeOperation op=new ClusterResizeOperation();
op.setNewSlaveCount(size);
HttpResponse response=this.restClient.perform(RestClient.Method.POST,path,serializeObjectAsJson... | Resize the specified cluster. |
private void antiAliasFillRaster(int[] pixels,int off,int adjust,int x,int y,int w,int h){
final double constC=-(radiusSq) + (centerX * centerX) + (centerY * centerY);
final float precalc2=2 * centerY;
final float precalc3=-2 * centerX;
final float constX=(a00 * (x - .5f)) + (a01 * (y + .5f)) + a02;
final flo... | Fill the raster, cycling the gradient colors when a point falls outside of the perimeter of the 100% stop circle. Use the anti-aliased gradient lookup. This calculation first computes the intersection point of the line from the focus through the current point in the raster, and the perimeter of the gradient circle. The... |
public Version version(){
return version;
}
| Returns the OSGi version for this release. |
public ImageWarp(int[] pix,int width,int height,GeoCoordTransformation transform,WorldFile worldFile){
if (pix != null) {
iwidth=width;
iheight=height;
setGeoTrans(transform);
setImageBounds(worldFile);
pixels=pix;
}
}
| Create an image warp with some additional transform information. |
public static _Fields findByThriftId(int fieldId){
switch (fieldId) {
case 1:
return HEADER;
case 2:
return STORE_NAME;
case 3:
return CURSOR_ID;
case 4:
return CLOSE;
default :
return null;
}
}
| Find the _Fields constant that matches fieldId, or null if its not found. |
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 void write(byte[] buffer){
try {
mmOutStream.write(buffer);
}
catch ( Exception e) {
Log.e(TAG,"Exception during write",e);
}
}
| Write to the connected OutStream. |
public boolean hasText(){
return mHasText;
}
| Return true if the application has drawn any text. |
public static String extractAddrSpec(String address){
Matcher match=NAME_ADDR_EMAIL_PATTERN.matcher(address);
if (match.matches()) {
return match.group(2);
}
return address;
}
| Helper method to extract email address from address string. |
protected void sequence_ParameterizedTypeRefNominal_TypeRefWithoutModifiers(ISerializationContext context,ParameterizedTypeRef semanticObject){
genericSequencer.createSequence(context,semanticObject);
}
| Contexts: TypeRefWithoutModifiers returns ParameterizedTypeRef Constraint: (declaredType=[Type|TypeReferenceName] (typeArgs+=TypeArgument typeArgs+=TypeArgument*)? dynamic?='+'?) |
public static boolean startDocumentPrint(int type,MPrintFormat customPrintFormat,int Record_ID,ASyncProcess parent,int WindowNo,String printerName){
return (startDocumentPrint(type,customPrintFormat,Record_ID,parent,WindowNo,true,printerName));
}
| Start Document Print for Type with specified printer. Always direct print. |
public int port(){
return port;
}
| returns the remote port number |
public void clearParameters(){
cachedBuildResult=null;
parameters.clear();
}
| Removes all set parameters from this media type. |
private void assertPivot(String field,Object value,int count,PivotField actual){
assertEquals("FIELD: " + actual.toString(),field,actual.getField());
assertEquals("VALUE: " + actual.toString(),value,actual.getValue());
assertEquals("COUNT: " + actual.toString(),count,actual.getCount());
}
| asserts that the actual PivotField matches the expected criteria |
public T caseS_Global(S_Global object){
return null;
}
| Returns the result of interpreting the object as an instance of '<em>SGlobal</em>'. <!-- begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc --> |
public int lengthOfYear(){
return (isLeapYear() ? 366 : 365);
}
| Returns the length of the year. <p> This returns the length of the year in days, either 365 or 366. |
private void createLinks(Composite parent,FormToolkit toolkit,Map<String,String> commandMap){
for ( Map.Entry<String,String> entry : commandMap.entrySet()) {
Command command=commandService.getCommand(entry.getKey());
if (command.isDefined() && (null != command.getHandler()) && command.getHandler().isEnabled(... | Creates links for given commands on the parent composite. |
public static final long bitVectorOfStates(int[][] statuses) throws IllegalArgumentException {
if (statuses.length != NUMBER_OF_PROVERS) {
Activator.getDefault().logDebug("Method ColorPredicate.bitVectorOfStates must be reimplemented" + " when number of provers changes");
}
long result=0;
int[] array=new in... | Returns the bitVector with bit i set iff there exists some j_0, j_1, ... such that i = numberOfState(array) where array[0] = statuses[0][j_0], array[1] = statuses[1][j_1], etc. This implementation works only for 3 provers. |
Item newNameTypeItem(final String name,final String desc){
key2.set(NAME_TYPE,name,desc,null);
Item result=get(key2);
if (result == null) {
put122(NAME_TYPE,newUTF8(name),newUTF8(desc));
result=new Item(index++,key2);
put(result);
}
return result;
}
| Adds a name and type to the constant pool of the class being build. Does nothing if the constant pool already contains a similar item. |
private void writeAttribute(java.lang.String namespace,java.lang.String attName,java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName,attValue);
}
else {
registerPrefix(xmlWriter,namesp... | Util method to write an attribute without the ns prefix |
public String toXML(){
StringBuilder buf=new StringBuilder();
buf.append("<storage xmlns=\"storage:bookmarks\">");
final Iterator<BookmarkedURL> urls=getBookmarkedURLS().iterator();
while (urls.hasNext()) {
BookmarkedURL urlStorage=urls.next();
if (urlStorage.isShared()) {
continue;
}
buf.... | Returns the XML reppresentation of the PrivateData. |
public RStringVector execute(RAbstractIntVector factor){
Object attr=attrAccess.execute(factor.getAttributes());
RVector<?> vec;
if (nonScalarLevels.profile(attr instanceof RVector)) {
vec=(RVector<?>)attr;
}
else if (attr != null) {
vec=(RVector<?>)RRuntime.asAbstractVector(attr);
}
else {
no... | Returns the levels as a string vector. If the 'levels' attribute is not a string vector a cast is done. May return null, if the 'levels' attribute is not present. |
public final boolean isStarted(){
return _started;
}
| Indicates the interlock _started successfully. |
public T caseExecutionState(ExecutionState object){
return null;
}
| Returns the result of interpreting the object as an instance of '<em>Execution State</em>'. <!-- begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc --> |
public PosterizeEffect(){
}
| Initialize Effect |
public void drawImage(Graphics2D g,Image image){
mHasImages=true;
}
| The application is drawing the passed in image. |
public void close() throws IOException {
if (datagramConnection != null) {
datagramConnection.close();
}
if (logger.isActivated()) {
logger.debug("RTP transmitter closed");
}
}
| Close the transmitter |
public static void compareFromDifferentFoldersByName(final File sourceFolder,final File targetFolder,final String srcExtension,final String targetExtension,final ResourcePostProcessor processor) throws IOException {
compareFromDifferentFolders(sourceFolder,targetFolder,new WildcardFileFilter("*." + srcExtension),Tran... | Compares files with the same name from sourceFolder against it's counterpart in targetFolder, but allows source and target files to have different extensions. TODO run tests in parallel |
public static int lookupKeyword(String text){
return lookup(text,KEYWORD);
}
| Returns the type for the specified keyword text. Returns UNKNOWN if the text isn't found. |
public Object runSafely(Catbert.FastStack stack) throws Exception {
return new Long(getFile(stack).length());
}
| Returns the size in bytes of the specified file path |
public ColumnVector sqrt(){
return this.transform(null);
}
| Creates a new ColumnVector by taking the square root of each element in this vector. |
@Override public String toString(){
List<TcpSession> ls=new ArrayList<>(socks);
StringBuilder sb=new StringBuilder("connection total:");
sb.append(socks.size()).append("\r\n");
for ( TcpSession hp : ls) {
sb.append(hp.getRemoteAddress());
sb.append(",createtime:").append(TextUtils.Date2String(new Date(... | file handler list |
public static void main(String[] args) throws Exception {
DirectProvider dp=new DirectProvider();
Topology top=dp.newTopology();
TStream<String> helloStream=top.strings("Hello","Edgent!");
helloStream.print();
dp.submit(top);
}
| Print "Hello Edgent!" as two tuples. |
public boolean isSelectionVisible(){
return selectionVisible;
}
| Checks whether the current selection is visible. |
@Nullable private Module moduleBySingleContentRoot(@NotNull VirtualFile file){
if (ProjectRootsUtil.isModuleContentRoot(file,myProject)) {
Module module=ProjectRootManager.getInstance(myProject).getFileIndex().getModuleForFile(file);
if (module != null && !module.isDisposed() && ModuleRootManager.getInstance(... | Project view has the same node for module and its single content root => MODULE_CONTEXT data key should return the module when its content root is selected When there are multiple content roots, they have different nodes under the module node => MODULE_CONTEXT should be only available for the module node otherwise Vir... |
public boolean isError(){
return error;
}
| True if the command finished in error |
public void fileAdded(String filename) throws Exception {
deploy(filename);
}
| Handle a new deployment |
private boolean yCollission(OdorWorldEntity entityToCheck,float yCheck){
for ( OdorWorldEntity sprite : entityList) {
if (sprite == entityToCheck) {
continue;
}
if ((entityToCheck.getY() > sprite.getY()) && (entityToCheck.getY() < (sprite.getY() + sprite.getHeight()))) {
return true;
}
... | Handle collisions in y directions. |
@DSComment("Package priviledge") @DSBan(DSCat.DEFAULT_MODIFIER) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:57:57.393 -0500",hash_original_method="8A8EDD1088AB3F7694E04A76DE584752",hash_generated_method="8A6C9CCF0D097FF838DD1FBE220DAD25") synchronized boolean readCertificates(){... | If the associated JAR file is signed, check on the validity of all of the known signatures. |
public int length(){
return prevSize;
}
| The length of the previous array that was sorted |
private static String maskNull(String spaceName){
return spaceName != null ? spaceName : DFLT_SPACE_NAME;
}
| Masks null space name with default space name. |
public static void notifyNewConversationEvent(Context ctx,String action){
if (sActivityVisible) {
Intent intent=new Intent(ctx,TalkList.class);
intent.setAction(action);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
ctx.startActivity(intent);
}
}
| Notify new conversation event |
public final void yybegin(int newState){
zzLexicalState=newState;
}
| Enters a new lexical state |
public static Number[] applyFunction(short functorId,Number[] vals){
Number[] res=new Number[1];
switch (functorId) {
case FUN_SUM:
res[0]=SUM(vals);
return res;
case FUN_AVG:
res[0]=AVG(vals);
return res;
case FUN_MIN:
res[0]=MIN(vals);
return res;
case FUN_MAX:
res[0]=MAX(vals);
return res;
default :
return n... | Apply the given function of the given list of numbers and returns result |
void start(){
Thread.setDefaultUncaughtExceptionHandler(this);
sendStoredExceptions();
}
| Change application exception handler to our own (this class). Send any stored exceptions that were caught last time. |
public static ArrayList<ByteString> byteArraysToStrings(ArrayList<byte[]> byteArrays){
if (byteArrays == null) {
return null;
}
ArrayList<ByteString> byteStrings=new ArrayList<ByteString>();
for ( byte[] bytes : byteArrays) {
byteStrings.add(ByteString.of(bytes));
}
return byteStrings;
}
| Converts an ArrayList<byte[]> to an ArrayList<ByteString>. If the input is an empty list, the output is an empty list. If the input is null, the output is null. |
public void testNOT() throws Exception {
BooleanQuery.Builder expected=new BooleanQuery.Builder();
expected.add(new TermQuery(new Term("field","foo")),Occur.MUST_NOT);
expected.add(new MatchAllDocsQuery(),Occur.SHOULD);
assertEquals(expected.build(),parse("-foo"));
assertEquals(expected.build(),parse("-(foo)"... | test negated term |
@Override public void validate(){
ConfigVerification verification=controller.getConfigErrors();
if (verification != null) {
saveButton.setEnabled(!verification.hasFailed());
}
else {
saveButton.setEnabled(false);
}
}
| A call of this method should validate the positions of the panels components. |
public void open(String fileName) throws IOException {
model.setBytes(fileName);
}
| Sets the contents in the hex editor to the contents of the specified file. |
private static void clearOneAndTwoButtonClicked(ActionEvent e){
datePicker1.clear();
datePicker2.clear();
String message="The datePicker1 and datePicker2 dates were cleared!\n\n";
message+=getDatePickerOneDateText() + "\n";
String date2String=datePicker2.getDateStringOrSuppliedString("(null)");
message+=("T... | clearOneAndTwoButtonClicked, This clears date picker one. |
public String simplifyPath(String path){
if (path == null || path.isEmpty()) {
return "";
}
Deque<String> s=new ArrayDeque<>();
String[] words=path.split("/");
for ( String str : words) {
if (str.length() == 0 || str.equals(".")) {
continue;
}
if (str.equals("..")) {
if (!s.isEmpt... | Stack. Split words with slash, there can be 4 situations: 1) A correct name, push into stack. 2) A dot, skip. 3) Double dot, should pop last directory from stack, if not empty. 4) Empty, skip. Finally, go through stack and concatenate words. |
public HistoryReadResponse clone(){
HistoryReadResponse result=new HistoryReadResponse();
result.ResponseHeader=ResponseHeader == null ? null : ResponseHeader.clone();
if (Results != null) {
result.Results=new HistoryReadResult[Results.length];
for (int i=0; i < Results.length; i++) result.Results[i]=... | Deep clone |
@Override public OfferViewHolder newViewHolder(ViewGroup viewGroup){
View view=LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.telco_card_layout_view,viewGroup,false);
return new OfferViewHolder(view);
}
| creates a new ViewHolder using the provided xml layout |
public void cancelButtonActionPerformed(){
curNode=null;
addButton.setVisible(true);
cancelButton.setVisible(false);
this.dispatchEvent(new WindowEvent(this,WindowEvent.WINDOW_CLOSING));
}
| Method to handle cancel button |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.