anchor
stringlengths
10
14.3k
positive
stringlengths
10
14.9k
Find the element in the list which matches the object
private <T> T findActual(T matchingObject, List<? extends T> list) { T actual = null; for (T check : list) { if (check.equals(matchingObject)) { actual = check; } } return actual; }
method ensureCapacity() double the capacity of the Dynamic Array it creates new array with increased length, then copies all elements of current array in this array and then assigns current array to new one Time Complexity is O(n) linear
private void ensureCapacity() { int newSize = elements.length * 2; Object[] newElements = new Object[newSize]; for (int i = 0; i < elements.length; i++) { newElements[i] = elements[i]; } elements = newElements; }
This method was generated by MyBatis Generator. This method returns the value of the database column AD_WSLOG.HEADING
public String getHeading() { return heading; }
.ReplicateRequest replicateRequest = 8;
public boolean hasReplicateRequest() { return replicateRequestBuilder_ != null || replicateRequest_ != null; }
This method was generated by MyBatis Generator. This method sets the value of the database column T_LOG_BASERECORD.COUNT
public void setCount(Integer count) { this.count = count; }
This method was generated by MyBatis Generator. This method returns the value of the database column bjwg_withdrawals.user_id
public Long getUserId() { return userId; }
Recursive "Bruteforce" metode BubbleSort O(n^2)
public void recursiveBubbleSort(int[] numbers) { boolean sorted = false; int posA; int posB; for(int i = 0; i < numbers.length - 1; i++) { if(numbers[i] > numbers[i + 1] && numbers[i] != numbers.length) { posA = numbers[i]; posB = numbers[i + ...
Generate the Etag hash string that is returned by the assets location.
protected String getFileETag(File file) { FileInputStream is = null; try { is = new FileInputStream(file); return "\"" + DigestUtils.md5Hex(is) + "\""; } catch (IOException e) { return ""; } finally { closeQuietly(is); } }
optional string name = 1;
java.lang.String getName();
ExecuteQuery. xmlMessage is the string containing the BioMart query to execute. bos is the the output stream where the results of xmlMessage is written Updates npercentdone[nstatusfield] after obtaining lock on lockpd
public void executeQuery(BufferedOutputStream bos, String xmlMessage, int[] npercentdone,int nstatusfield, Object lockpd) throws IOException { URL biomartServer = new URL(SZBIOMARTURL); URLConnection conn = biomartServer.openConnection(); // use POST method conn.setDoOutput(true);...
Be sure the menus are current
public void updateMenus() { System.out.println("BarGraphDisplayer.updateMenus"); CommandRegistrar.gRegistrar.checkAction("barGraph"); CommandRegistrar.gRegistrar.enableAction("viewOptions"); }
Called as the drawer slides by percentage
@Override public void onDrawerSlide(View drawerView, float slideOffset) { super.onDrawerSlide(drawerView, slideOffset); //SlideOffset comes in on a scale of 0-1. //40% looks roughly about right to swap out if (slideOffset > 0.4) { ...
TODO Autogenerated method stub
public void onClick(View v) { Intent i=new Intent(TimeOutActivity.this,Playlevel10Activity.class);finish(); startActivity(i); //buttonSound.start(); }
Validation Functions Description : To validate the Telephone Work in Contact Details of Customer Tab Coded by :Raja Created Data:05 Oct 2016 Last Modified Date:05 Oct 2016 Modified By:Raja Parameter:TelephoneWork
public void validate_the_Telephone_Work_in_Contact_Details_of_Customer_Tab(String TelephoneWork)throws Exception { VerifyElementPresent(Desktop_XPATH_Verify_Customer_Page_TelephoneWork.replaceAll("M_Header", "Contact Details").replaceAll("M_Category", "Telephone - Work").replaceAll("M_InnerText", TelephoneWork), "Tel...
Inflate the menu; this adds items to the action bar if it is present.
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu, menu); return true; }
function that get customers by userId
@GET @Path("getCustomerByUser") public Customer getCustomerByUser(@QueryParam("user")int user) { return ManagerHelper.getCustomerManager().getCustomerByUser(user); }
Writes to file, replacing user's existing secret with newSecret Returns true if new file was created properly with appropriate contents
private boolean replaceSecretWith(String user, String newSecret) { // System.out.println(); System.out.println(); System.out.println(); System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); System.out.println...
/ renamed from: a
public int encodedSize(ZABEMobileNetwork jVar) { return jVar.unknownFields().mo132944h(); }
repeated .ProfileMessage.ContactAddress contactAddress = 4;
java.util.List<kr.pik.message.Profile.ProfileMessage.ContactAddress> getContactAddressList();
Sets the background color of a view
public S<T> bg(String color){ try{ int c = Color.parseColor(color); bg(c); }catch(IllegalArgumentException ex){ ex.printStackTrace(); } return this; }
Load the detailed state of a game for a particular level, including highlevel information and elements present.
void loadOriginalGameState(String saveName, int level) throws IOException;
The name of the column.
public String getName() { return name; }
Set / Get Prefix Code
public String getPrefixCode() { return sharedPreferences.getString(PREFIX_CODE, ""); }
/ renamed from: a
public void mo38281a(short s) { this.f27039b = s; }
Get list of customers
public List<CustomerModel> readDatabase() throws Exception{ List<CustomerModel> list = new ArrayList<CustomerModel>(); try{ log.info("Loading MySql driver"); Class.forName("com.mysql.jdbc.Driver"); log.info("Setting up connection with db"); connect= DriverManager.getConnection("jdbc:mysql://localhost:3306/apidft","r...
Send SMS Method Body
private void sendSms(String strPhoneNumber, String strSms) { if (ActivityCompat.checkSelfPermission(this, Manifest.permission.SEND_SMS) == PackageManager.PERMISSION_GRANTED) {// checking runtime permission for Sending SMS try { SmsManager smsManager = SmsManager.getDefault(); ...
Checks if this is capable of being a valid done command based on the criteria of length being more than 1.
public boolean satisfiesMinimumDoneCommandLength(String[] command) { return (command.length > 1); }
additional method for method findPeriodForTwoFirstPositiveNumbersInARow
static int[] findFirstTwoPositiveNumbersInARow(int... sourceNumbers) { return IntStream.of(sourceNumbers) .filter(x -> x > 0) .peek(x -> System.out.format("%d, ", x)) .limit(2).toArray(); }
scegliere groupId e label per ogni server
@Override public boolean prepareOp() { Iterator<Server> iter = this.serverList.iterator(); Server current = null; /* * the first replicaNumber servers received the label 0. * then the label of other servers is calculated by sql.getNewLabel() */ int groupId = 0; long label = Constants.maxLabel; ...
.cosmos.base.query.v1beta1.PageRequest pagination = 1;
public cosmos.base.query.v1beta1.Pagination.PageRequestOrBuilder getPaginationOrBuilder() { return getPagination(); }
Creates a new xforms error indication.
public XFormsErrorIndication(String message, Exception cause, EventTarget target, Object info) { super(message, cause); this.target = target; this.info = info; }
Feature Code to Offset Offset has no clear meaning in V3
int getFeatureOffset(int feat) { throw new UIMARuntimeException(UIMARuntimeException.NOT_SUPPORTED_NO_HEAP_IN_UIMA_V3); }
Serializes the specified name.
private void _writeName(final Name name) throws IOException { _out.startObject(); _writeReifier(name); _writeItemIdentifiers(name); if (!name.getType().equals(_defaultNameType)) { _writeType(name); } _writeScope(name); _writeKeyValue("value", name.getV...
string regex = 1;
public java.lang.String getRegex() { java.lang.Object ref = regex_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8...
Adds a result for the script; cannot have multiple query results.
public ExecServiceMethodDescription queryResult(String name, String description) { if (resultAdded) { throw new IllegalArgumentException("The query can only have one result"); } resultAdded = true; addResult(name, description, VType.class); return this; }
Creates a wishlist when one product is added to the list when created
public void createWishlist(Customer customer, Product product) { wishlistService.createWishlist(customerRepository.findByID(customer.getAccountID()), product); }
load the first page of results
void load(Request req);
This is a callback from the PublisherLink
private void messageRecv(M msg) { if (LOG.isTraceEnabled()) { LOG.trace("messageRecv = {}", msg); } else if (LOG.isDebugEnabled()) { LOG.debug("messageRecv = {}", msg.getClass().getName()); } synchronized (_subscribers) { for (SubscriberImpl subscribe...
.SubnetResponse subnetResponse = 17;
public Builder setSubnetResponse(entities.Torrent.SubnetResponse value) { if (subnetResponseBuilder_ == null) { if (value == null) { throw new NullPointerException(); } subnetResponse_ = value; onChan...
initialises Map based on data
@Override public void start(final Stage primaryStage) { loadDemoData(demoDataFile); ProcessingProfiler.setVerboseOutputState(true); ProcessingProfiler.setLoggerOutputState(true); ProcessingProfiler.setDebugState(false); DefaultErrorDataSet bubbleDataSet1a = new DefaultError...
Determines if the updateDate has been initialized. It is useful to determine if a field is null on purpose or just because it has not been initialized.
public boolean isUpdateDateInitialized() { return updateDate_is_initialized; }
Method is used to call the getAllVehicles() method from the service object to populate on create of the managed bean Used so that the List vehicles contains data when vehicles.xhtml renders
@PostConstruct public void init() { if (vehicles == null) { try { vehicles = getVehicles(); } catch (Exception e) { // } } }
Is this a Priority Flight
public Flight(String flightNumber, String airline, int passengerCapacity, String destination){ this.flightNumber = flightNumber; this.airline = airline; this.passengerCapacity = passengerCapacity; this.destination = destination; passengerManifest = new ArrayList<Passenger>(); ...
Overwrites the rest of the protocol and sets the protocol state to finish
void endNegotiation(String reason);
Tests handling of errors in isEmpty().
@Test public void testIsEmptyError() throws ConfigurationException { assertTrue(setUpErrorConfig().isEmpty()); checkErrorListener(ConfigurationErrorEvent.READ, ConfigurationErrorEvent.READ, null, null); }
clear all the text fields
public void clearTextFields() { firstNameTextField.setText(""); lastNameTextField.setText(""); roomNoTextField.setText(""); phoneTextField.setText(""); studentIDTextField.setText(""); createPasswordTextField.setText(""); confirmPasswordTextField.setText(""); }
Responsible for handling the creation of table columns during the process of executing CREATE TABLE DDL statements.
private Column processCreateColumn(HsqlName hsqlName) throws HsqlException { boolean isIdentity = false; long identityStart = database.firstIdentity; long identityIncrement = 1; boolean isPrimaryKey = false; String typeName; int ...
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { try { int itemPosition = position; switch (itemPosition) { case 0: ...
ListView Clicked item index
@Test public void testTradesAdapter() throws IOException { InputStream is = CryptopiaAdaptersTest.class.getResourceAsStream( "/org/knowm/xchange/cryptopia/dto/marketdata/example-trades.json"); // Use Jackson to parse it ObjectMapper mapper = new ObjectMapper(); CryptopiaBaseRespon...
Read in the JSON from the example resources
public MovieDetails transform(Movie movie){ String genres = ""; for (int i = 0; i < movie.getMovieGenres().size(); i++) genres += movie.getMovieGenres().get(i).getName() + ", "; genres = genres.substring(0,genres.length() - 2); String originalTitle = movie.getOriginalTitle...
Convertimos la lista de generos
public String estadisticasFinancieras(String anio) { String html = ""; DefaultTableModel dtm1 = venta.estadisticaFinancierasMeseVsIngresoGasto(anio); DefaultTableModel dtm2 = venta.estadisticaFinancierasIngresosGastosUtilidades(anio); html = Utils.dibujarGraficasHTMLLineasYTorta...
Proveedores mas solicitados (de todos los tiempos) (Grafica Barras => Proveedor vs NumeroCompras)
private void populateEntityToDeletetList() { entityNameListDelete = new ArrayList<String>(); entityNameListDelete.add("edu.wustl.catissuecore.domain.Quantity"); entityNameListDelete .add("edu.wustl.catissuecore.domain.SpecimenCollectionRequirementGroup"); }
This method populates Entity To Deletet List.
@Override public HashMap<String, Airport> findAll() { List<City> cities = cityDao.findAll(0); airportFile = new File(AirportDao.class.getClassLoader().getResource("airports.txt").getPath()); try { FlightFileReader.consumeNonEmptyLinesFromFile(airportFile, line -> { ...
Finds all airports in provided txt file, with corresponding city with comments in database. Airport that does not have active city in database is not part of resulting HashMap.
public void printList(TernaryTreeNode head) { // System.out.println(" head :: " + head.right.right.data); TernaryTreeNode current = head; while (true) { System.out.print(current.data + " "); current = current.right; if...
Do a traversal of the list and print it out
public static boolean tryParse(String str) { try { Integer.parseInt(str); return true; } catch (NumberFormatException ex) { return false; } catch (Exception ex) { logError(ex); return false; } }
attempt to parse an integer
public String getNoPagedMessage() { return getNoPagedMessage(null); }
Returns a string specifying the message to display when there is no row to display.
@Override public BaseResponse testResponse() { return setResultSuccess(); }
TODO Autogenerated method stub
public static List<Comment> getCommentByMB(int idtargetmicroblog) throws SQLException { List<Comment> comments = new ArrayList<Comment>(); Connection c = DriverManager.getConnection(connectionString,dbUsername, dbPassword); PreparedStatement ps = null; ResultSet rs = null; try { /*List focusingIdusers = ge...
get comment to see
public Object visitReturnStmt(GoIRReturnStmtNode node) { return node.getChild().accept(this); }
/ returns a string of its children types (nonJavadoc)
@Override protected void onDestroy() { super.onDestroy(); if(mReceiver != null) unregisterReceiver(mReceiver); }
Activity wird beendet BroadcastReceiver deregistrieren
public User(){ this(null, null); }
creates new user with null fields
@Test public void testDACKLoadedMessage() throws Exception { final CacheTransactionManager txMgr = getCache().getCacheTransactionManager(); final String rgnName = getUniqueName(); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); factory.setEarlyAck(fals...
Test distributed ack transactions that consist only of data from loaded values
public static ArrayList<Integer> union(ArrayList<Integer> list1, ArrayList<Integer> list2) { ArrayList<Integer> union = new ArrayList<>(); //adding elements from first array list to the new array list for (int i = 0; i < list1.size(); i++) { union.add(list1.get(i)); } //adding elements from...
Combining two array list into one
public void setDefaultPricebookAccess(java.lang.String defaultPricebookAccess) { this.defaultPricebookAccess = defaultPricebookAccess; }
Sets the defaultPricebookAccess value for this Organization.
public Packet1Login () { }
private boolean accepted = false;
public Dialog onCreateDialog(Bundle savedInstanceState) { final Calendar c = Calendar.getInstance(); int year = c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH); int day = c.get(Calendar.DAY_OF_MONTH); // Create a new instance of DatePickerDialog and return it Dat...
Use the current date as the default date in the picker
@Override protected String toCloudEventsKey(final String key) { return key.substring(AmqpConstants.CE_PREFIX.length()); }
Gets the cloud event attribute key without the preceding prefix.
private int getIncrement(Value v) { if (v instanceof IntConstant) { return ((IntConstant) v).value; } else { return 0; } }
JimpleLocal local = (JimpleLocal) v;
public void executeFromGui(Player target) { removeTrail(target); }
Invoked from the GUI because it's easier this way
public InaccessibleTile(int x, int y) { super(true, true, true, true, x, y); }
Inaccessible tiles always have all 4 walls since you can't get to them
@Override public boolean getElemento(T elemento) { return false; }
TODO Autogenerated method stub
@JsonIgnore public void setType(URI type) { this.type = type == null ? null : new TypeReference<AlternateIdType>(type); }
The type of the id.
private void initInfo(Map<String, String> _info) { this.jlCPU.setText(_info.get("Model"));// FIXME may be very long name this.jlCores.setText(_info.get("TotalCores")); this.jlVendor.setText(_info.get("Vendor")); this.jlFrequency.setText(_info.get("Mhz") + " MHz"); this.jlRAM.setT...
End of variables declaration//GENEND:variables
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel2 = new javax.swing.JPanel(); jLabel1 ...
This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
public synchronized Object read() throws PipeException { if (!connected) { throw new PipeException("Pipe not connected"); } else if (closedByReader) { throw new PipeException("Pipe closed"); } else if (writeSide != null && !writeSide.isAlive() && !closedByWriter && (in < 0)) ...
read Reads the next Object from this piped stream. If no Object is available because the end of the stream has been reached, the value null is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown. If a thread was providing Objects to the connected pipe...
public static void main(String[] args) { int [] a={5,10,90}; int [] b={4,7,9,10}; List <Integer> l1=new ArrayList<>(); l1=mergeSorted(a,b); System.out.println(l1); Map <Integer,Integer> se=new HashMap<>(); se.put(4,6); se.putIfAbsent(4,7); se.put(...
String s=" My name is Sayantika Ghosh "; String reverseString=reverse(s); System.out.println(reverseString);
@Test public void testBlocking() throws Exception { FutureRecordMetadata future = new FutureRecordMetadata(asyncRequest(baseOffset, null, 50L), relOffset, RecordBatch.NO_TIMESTAMP, 0, 0, Time.SYSTEM); assertEquals(baseOffset + relOffset, future.get().offset()); }
Test that an asynchronous request will eventually return the right offset
public void destroy() { }
Remove the filter from service
@GetMapping public List<Recipe> get(HttpSession httpSession){ List<Recipe> recipes = new ArrayList<>(); String username = (String) httpSession.getAttribute("username"); //recipeRepository.findByAcess("PUBLIC").iterator().forEachRemaining(x -> recipes.add(x)); if(username != null){ ...
To Get All the recipes with the username same as the one that is logged in
public Node<E> getPresentNode(E data){ for(Node<E> node: nodes.keySet()){ if(node.data.equals(data)){ return node; } } return null; }
get node based from value
public String getName() { return name; }
Gets the name of this Settlement.
List<Seller> findByDepartment(Department department);
retorna todos os funcionario atraves de uma lista
public VistaCrearPedidoAbonado() { initComponents(); errorLabel.setVisible(false); controlador = new CtrlVistaCrearPedidoAbonado(this); }
Creates new form VistaCrearPedidoAbonado
public static String gmtFormat(String $formatString) { return gmtFormat($formatString, 0); }
Format current time to GMT string presentation.
public void registerAdministrative(String[] fields) throws BadEntryException{ int id = Integer.parseInt(fields[1]); if(_persons.get(id) != null){ throw new BadEntryException(fields[0]); } Administrative _administrative = new Administrative(id, fields[2], fields[3]); _administratives.put(id, ...
Registers the administratives that come from the file that is imported.
public void setleZoom( double valeur) { zoomMonde = valeur; }
Methode qui permet changer l'argrandissement du monde
public static void main(String[] args) { LocalDate localDate = LocalDate.now(); System.out.println("LocalDate: " + localDate); System.out.println(LocalDate.of(2019, 04, 16)); System.out.println(LocalDate.parse("2019-04-16")); //////////////////////////////////////////////////////// LocalDate tomorrow =...
The LocalDate represents a date in ISO format (yyyyMMdd) without time.
public void onSurfaceCreated(GL10 gl, EGLConfig config) { gl.glDisable(GL10.GL_DITHER); /* * Some one-time OpenGL initialization can be made here * probably based on features of this particular context */ gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, ...
/ By default, OpenGL enables features that improve quality but reduce performance. One might want to tweak that especially on software renderer.
private boolean isAuthenticated(@Nonnull final InetAddress address, @Nonnull @NonnullElements final Collection<IPRange> ranges) { final byte[] resolvedAddress = address.getAddress(); for (final IPRange range : ranges) { if (range.contains(resolvedAddress)) { retu...
Checks whether the given IP address meets a set of IP range requirements.
public native void setScrollIndocatorStyle(double value) /*-{ var jso = this.@com.emitrom.ti4j.core.client.ProxyObject::getJsObj()(); jso.scrollIndicatorStyle = value; }-*/;
Style of the scrollbar, specified using one of the constants from Titanium.UI.iPhone.ScrollIndicatorStyle. Default: Titanium.UI.iPhone.ScrollIndicatorStyle.DEFAULT
public PermisosPyS obtenerPermisos(String user) { try { PreparedStatement pstm = null; ResultSet rs = null; String query = "SELECT * FROM permisos WHERE ID_permiso IN (SELECT ID_permisos FROM Roles as r INNER JOIN Usuario as u ON r.ID_Rol = u.ID_Rol WHERE u.username...
Metodo que devuelve los permisos segun el tipo de usuario
@JSONWebService @Transactional(isolation = Isolation.PORTAL, rollbackFor = { PortalException.class, SystemException.class}) public interface VcmsDiscussionService { /* * NOTE FOR DEVELOPERS: * * Never modify or reference this interface directly. Always use {@link VcmsDiscussionServiceUtil} to access the vcms d...
The interface for the vcms discussion remote service. This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS credentials because this service can be accessed remotely.
public void fetchTasks() { tasksTotales.clear(); for (String taskId : taskList) { databaseTaskReference.child(taskId).addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { ...
todo trabajar aqui para mostrar los elementos en el adapter tasksTotales=new ArrayList();
public BaseStoreGrnM (java.lang.Integer id) { this.setId(id); initialize(); }
Constructor for primary key
@RequestMapping(value = "/flood/addComment", method = RequestMethod.POST) public String addCommentPost(@ModelAttribute("newComment") Comment comment, HttpServletRequest request, Model model) { comment.setUserId(1L); model.addAttribute...
comment.setUserId((Long) request.getSession().getAttribute("userId")); //TODO looks ugly, need learn best practice
private void rehash() { int oldSize = this.size; int newSize = size * 2; while (!isPrime(newSize)) newSize++; this.size = newSize; DataItem[] newHashArray = new DataItem[newSize]; String temp; this.collision = 0; Boolean repeatValue; for (int i = 0; i < oldSize; i++) { if (hashArray[i] != null &...
doubles array length and rehash items whenever the load factor is reached
public GetOpt(String [] sargs, String flags) throws BadOptException { int size = sargs.length; try { StringReader sreader = new StringReader(flags); for (int i = 0; i < flags.length(); i++) { int opt = sreader.read(); if (opt == ':') ((OptPair) optlist.elementAt(optlist.size() - 1)).bool = fals...
Constructor for creating an instance that will parse a set of String arguments with respect to a set of command line options. Option switches are required to be a single character. By default switches are assumed to be boolean unless followed by a colon. example : &nbsp;&nbsp;&nbsp "cvf:" In this example "c" and "v" ar...
String getWiki();
Returns the value of the 'Wiki' attribute. If the meaning of the 'Wiki' attribute isn't clear, there really should be more of a description here...
@Override public int compare(Person o1, Person o2) { return o1.payGrade - o2.payGrade; }
compares two Person objects by their pay grades.
public static void main(String[] args) { FundsTransfer transfer = new FundsTransfer(clientId, clientSecret, Interswitch.ENV_DEV); try { BankResponse response = transfer.fetchBanks(); // makes network call Bank[] bank = response.getBanks(); // a bank array of all banks ...
Interswitch.ENV_SANDBOX, is for sandbox environment Interswitch.ENV_PROD, is for production environment