anchor
stringlengths
10
14.3k
positive
stringlengths
10
14.9k
RMF 1/10/2009 Not sure this is at all necessary... but does it hurt? The X10DT PrefUtils did this...
protected void initializeField(FieldEditor pe, PreferencePage page) { if (page instanceof IPropertyChangeListener) { pe.setPropertyChangeListener((IPropertyChangeListener)page); } pe.setPreferenceStore(page.getPreferenceStore()); }
Replace the android default class loader
void injectorClassLoader() { //To get the package name String pkgName = context.getPackageName(); //To get the context Context contextImpl = ((ContextWrapper) context).getBaseContext(); //Access to the Activity of the main thread Object activityThread = null; try { activityThread = Reflection.getField(...
The event handler for SignChangeEvents. Allows signs to be colored using &codes.
@EventHandler(ignoreCancelled = true) public void onSignChange(SignChangeEvent event) { // Automatically flag players with bypass as posting non-empty signs to skip empty checks boolean empty = !event.getPlayer().hasPermission("sblock.sign.unlogged"); for (int i = 0; i < event.getLines().length; i++) { even...
Returns true if the attribute "message" is set.
public final boolean isMessageSetted() { return engine.isPropertySetted(Properties.MESSAGE); }
Helper Functions Precondition: key != null && key != ""
private Node<Value> get(Node<Value> x, String key, int d) { if (x == null) return null; char c = key.charAt(d); if (c > x.c) return get(x.right, key, d); else if (c < x.c) return get(x.left, key, d); else if (d < key.length()-1) ret...
Elige un gen aleatorio del fichero fasta y lo devuelve.
public static String leerFasta(File prueba) { String gen = "", genescogido = null; try { ArrayList<Integer> cabeceras = new ArrayList<>(); int contador = 0; Scanner leerfichero = new Scanner(prueba); while(leerfichero.hasNextLine()){ if (leerfichero.nextLine().startsWith(">")) { cabeceras.add(c...
Gets the poster URL address of the movie.
public String getPosterUrl() { return posterUrl; }
get name representing the running Java virtual machine.
public static String getPid() { String name = ManagementFactory.getRuntimeMXBean().getName(); // get pid return name.split("@")[0]; }
There are 35 key buttons available (KEYS.length), but the language may need a smaller amount (Start.keysArraySize) Starting with k = 1 to skip the header row
public void loadKeyboard() { keysInUse = keyList.size(); partial = keysInUse % (KEYS.length - 2); totalScreens = keysInUse / (KEYS.length - 2); if (partial != 0) { totalScreens++; } int visibleKeys; if (keysInUse > KEYS.length) { visibleKe...
/ Function to equip weapon for hero
public void equip(Hero h) { for(Weapon w : h.getInventory().getWeaponList()) { if(w.getName().equals(this.getName())) { w.setEquipped(true); w.statsIncrease(h, StatType.STRENGTH, getWeaponDmg()); } else { w.unequip(h); } } }
setPosition public void setPosition (int row, int col) Sets the position on the board that this object is present in.
public void setPosition(int row, int col) { this.row = row; this.col = col; }
.RegistrationResponse registrationResponse = 15;
public entities.Torrent.RegistrationResponse getRegistrationResponse() { if (registrationResponseBuilder_ == null) { return registrationResponse_ == null ? entities.Torrent.RegistrationResponse.getDefaultInstance() : registrationResponse_; } else { ...
Returns a short from a given byte array.
public static short getBytesAsShort(byte[] b) { int i = (b[0] & 0xFF << 8) | (b[1] & 0xFF); return (short) i; }
Recebe a string bidireccional com varios parametros e reencaminhaos para o servidor
public String comunicarServidor(String[][] parametros) { String xmlString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; xmlString += "<" + parametros[0][0] + " id=\"" + parametros[0][1] + "\">"; for (int i = 1; i < parametros.length; i++) { xmlString += "<" + parametros[i][0] + ">" + parametros[i][1] +...
/ Getting all Items from tSable
public Map<Integer, Item> getAllItems() { return hashOperations.entries(KEY); }
need to remove this json construction using a library call
public String toJsonMetric() { StringBuilder builder = new StringBuilder("{\"messageType\" : \"view\""); builder.append(",\"nodes\" : ["); int i = 0; for (Node node : getAllNodes().values()) { if (++i != 1) builder.append(","); builder.append("{"); bui...
returns true if the String argument is empty
public static String footerStatus(Connection conn,String kix,String type) { String footerStatus = ""; try{ if(type.equals("ARC")){ footerStatus = "Archived on " + getFndItem(conn,kix,"dateapproved"); } else if(type.equals("CUR")){ footerStatus = "Approved on " + getFndItem(conn,kix,"dateapproved"...
This method was generated by MyBatis Generator. This method returns the value of the database column cart.user_id
Long getUserId();
Test of isApellido_Paterno method, of class Entradas.
@Test public void testIsApellido_Paterno() { System.out.println("isApellido_Paterno"); String AP = "ulfric"; Entradas instance = new Entradas(); boolean expResult = false; boolean result = instance.isApellido_Paterno(AP); assertEquals(expResult, result); // TO...
repeated .FileInfo fileInfo = 3;
public entities.Torrent.FileInfo.Builder addFileInfoBuilder() { return getFileInfoFieldBuilder().addBuilder( entities.Torrent.FileInfo.getDefaultInstance()); }
throws key word will terminate the program as we are not handling the exception to overcome this we need to add a trycatch block using throws key word we won't report anything no option But in try catch block, we can report with the help of catch block where we can print the error message.
public static void main(String[] args){ ThrowsKeyword obj = new ThrowsKeyword(); obj.sum(); System.out.println("ABC"); }
An identifier with the intention of being globally unique.
@Schema(required = true, description = "An identifier with the intention of being globally unique. ") public String getId() { return id; }
Returns a new object of class 'Image'.
Image createImage();
This method was generated by Apache iBATIS ibator. This method sets the value of the database column cementerio.persona.sexo
public void setSexo(String sexo) { this.sexo = sexo; }
Actually Check user Creditentials if so opens main menu.
public void Login()throws Exception{ if(eMailField.getText().equals("user") && PasswordField.getText().equals("pass")){ displayMainMenu(); } else{ System.out.println("Username or Password Does not match"); } }
/ NOTE: Unfortunately, in MyBatis it's not possible to execute batch and nonbatch operations in single SqlSession. To support this scenario, we have to create completely new SqlSessionFactoryBean and completely new SqlSession. Surprisingly, this does not necessarily mean that the batch and nonbatch operations will be e...
@Bean @Qualifier("batch-operations") @SuppressWarnings("SpringJavaAutowiringInspection") public SqlSession myBatisBatchOperationsSession(DataSource dataSource) throws Exception { SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean(); sqlSessionFactoryBean.setDataSource(d...
Construct a new SwitchPreference with the given style options.
public GallerySwitchPreference(Context context, AttributeSet attrs) { super(context, attrs); mResources = context.getResources(); }
repeated .liubaninc.m0.pki.Certificate Certificate = 1;
public liubaninc.m0.pki.CertificateOuterClass.Certificate.Builder addCertificateBuilder() { return getCertificateFieldBuilder().addBuilder( liubaninc.m0.pki.CertificateOuterClass.Certificate.getDefaultInstance()); }
by default machine is off
@Test //checks for state switching (on/off) void SwitchStates() { Assertions.assertFalse(machine.isTurnedOn()); //then, switch on and check if on machine.setTurnedOn(true); Assertions.assertTrue(machine.isTurnedOn()); //switch off to see if turned off correctly ...
Take appropriate action for each action item click
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.salir: finish(); return true; default: return super.onOptionsItemSelected(item); } }
Creates a new instance of UpgradeData
public UpgradeData(int c) { super(); JLabel l; // GridLayout grid; JPanel pan; JButton val; confignb = c; String fichier; NumberFormatter formatter = new NumberFormatter(new DecimalFormat("0")); formatter.setAllowsInvalid(false); try { sz_rss = new JFormattedTextField((NumberForm...
creates a new hibernate session and transaction.
IDAOSession createNewSession();
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
@Override public int cantAlumnos(String curso) throws Exception { Connection c = null; PreparedStatement pstmt = null; ResultSet rs = null; int cantAlumnos = 0; try { c = DBUtils.getConnection(); pstmt = c.prepareStatement("select count(a.id) as cant f...
Shows the activity of SMS sending
private void showSendSMSActivity() { Uri uri = getIntent().getData(); if (uri == null) { return; } // get phone number where to send the SMS String ssp = uri.getSchemeSpecificPart(); String number = ContactsAccessHelper.normalizePhoneNumber(ssp); if (...
DO NOT MODIFY THIS METHOD Prints the total number of requests and the number of requests that resulted in a cache hit.
public void reportStats() { System.out.println("Number of requests: " + (requestCount - warmUpRequests)); System.out.println("Number of hits: " + hitCount); System.out.println("hit ratio: " + (double) hitCount / (requestCount - warmUpRequests)); System.out.println("Average hit cost: " + (double) hitCost...
Use the current date as the default date in the picker
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { int year; int month; int day; if (!this.getArguments().containsKey("date")) { final Calendar c = Calendar.getInstance(); year = c.get(Calendar.YEAR); month = c.get(Calendar.MONTH); day = c.get(Calendar.DAY_OF_MONTH); } else { ...
/ JADX WARNING: Illegal instructions before constructor call / Code decompiled incorrectly, please refer to instructions dump.
private FieldSumMap(com.shopee.protocol.ads.action.FieldSumMap.Builder r17) { /* r16 = this; r0 = r17 java.lang.Long r2 = r0.impression java.lang.Long r3 = r0.click java.lang.Long r4 = r0.order java.lang.Long r5 = r0.order_amount ...
The max Z value of the 2D point projected to 3D
public float max3DZ() { return Math.max(stop3D.z, start3D.z); }
Metodo update del patron Observer, actualiza las notificaciones
public void update(){ addNotificaciones(nombre + " " + this.sucursal.descuento()); mostrarNotificaciones(); notificaciones.clear(); }
Returns a new object of class 'FData'.
FData createFData();
write your code here
public static void removeAllNumbersGreaterThan10(Set<Integer> set) { Iterator<Integer> iterator = set.iterator(); while (iterator.hasNext()) { Integer integer = iterator.next(); if (integer.intValue() > 10) { iterator.remove(); } } }
All parameters are injected by GIN
@Inject public AppControllerImpl(PlaceController placeController, EventBus eventBus, PlaceHistoryHandler placeHistoryHandler, AppLayout appLayout, ActivityManagerInitializer activityManagerInitializer) { this.placeController = placeController; this.placeHistoryHandler = placeHistoryHandler; this.appPanelView = a...
Return a set containing all repair kits on board.
@Override public Set<RepairKit> getRepairKits(Board board) { return board.getElements(RepairKit.class); }
Takes no arguments and returns an array containing the states of each block of the ship
public int[] getDamage(){ return shipDamage; }
If no status gadget is provided, it uses a basic one.
public SingleUploader() { this(null); }
This method was generated by MyBatis Generator. This method returns the value of the database column t_mp_num.twoMerchant
public Long getTwomerchant() { return twomerchant; }
Parses a user's favorites into a map of page views keyed by section (e.g. MARKET, COMPANY, etc.).
@SuppressWarnings("unchecked") protected Map<String, List<PageViewVO>> processUserFavorites(ModuleVO mod) throws ActionException { log.debug("processUserFavorites..."); Map<String, List<PageViewVO>> pageMap = initializePageMap(); if (mod.getErrorCondition()) return pageMap; List<FavoriteVO> favs = (List<F...
The title property is a short plain text description of the RESTful API. The value SHOULD be suitable for use as a title for the contained user documentation.
String title();
.DownloadRequest downloadRequest = 12;
entities.Torrent.DownloadRequestOrBuilder getDownloadRequestOrBuilder();
TODO Autogenerated method stub
@Override public void onClick(View v) { }
/ Generic TextView creation.
private TextView getTextView(String content) { TextView textView = new TextView(this.getContext()); textView.setEms(30); textView.setTextColor(getResources().getColor(R.color.ldstools_black)); if(content != null && !content.isEmpty()) { textView.setText(content); } ...
/ renamed from: e
public final void mo3957e() { this.f1313w = true; }
No special processing if dialog has been canceled
@Override public void onError(DialogError e) { }
Deletes a User from the data store.
void deleteUser(int id) throws DataAccessException;
/ / / / / / / / / / /
public boolean equals(Object object) { /* 326 */ if (object == null) { /* 327 */ return false; /* */ } /* 329 */ if (object == this) { /* 330 */ return true; /* */ } /* 332 */ if (object instanceof DefaultTimeline) { /* 333 */ return true; /* */...
disconnect ReceivingSpace with goods_allocation in Goods
public ReceivingSpace planToRemoveGoodsListWithGoodsAllocation(ReceivingSpace receivingSpace, String goodsAllocationId, Map<String,Object> options)throws Exception;
/// returns the trig function of the equation purely for walk through
public static String function_2(String question) { //int first_par = 0; //int second_par = question.indexOf(")"); //int third_par = question.indexOf("(", second_par); String function_2 = question.substring(find_par(2,question)+1,find_par(3,question)); return function_2; }
The HashMap is productId to count
public Buyer(String username, String password, String firstName, String lastName, String emailAddress, String phoneNumber) { super(username, password, firstName, lastName, emailAddress, phoneNumber); this.role = 1; credit = 10000; ProgramManager.getProgramManagerInstance().addAccountToLi...
and csmi_place is null
public M csmiPlaceNull(){if(this.get("csmiPlaceNot")==null)this.put("csmiPlaceNot", "");this.put("csmiPlace", null);return this;}
Returns the total number of consumed work units by the engine instance at hand since the engine's last deployment.
long getConsumedWorkUnits();
d) Optional: Generar endpoint para recibir un listo de platos y devolver el listado procesado.
@Test void processListOfPlates() throws Exception { String request = "[" + "{\"name\": \"Ensalada\", \"ingredients\": [" + createIngredient("Calabaza", 100) + "," + createIngredient("Cebolla", 70) + "]}," + "{\"name\": \"Hamburguesa\", \"ingredients\": [" + createIngredient...
Timestamp; when this request should be considered invalid optional uint64 expires = 4;
private void setExpires(long value) { bitField0_ |= 0x00000004; expires_ = value; }
Read a single car based on the plate number.
Car readCar(String plateNo) throws CarNotFoundException;
Comment for the specified element (last contentvisited or any parent).
void visitComment(MappedElementKind targetKind, String comment);
The file descriptor set used to generate this result. .google.protobuf.FileDescriptorSet fdset = 5 [json_name = "fdset"];
@java.lang.Override public boolean hasFdset() { return fdset_ != null; }
Display the main menu
public void displayInput() { scan = new Scanner(System.in); boolean exit = false; while (!exit) { System.out.println("\n1.Display Product"); System.out.println("2.Buy Product"); System.out.println("3.Cart"); System.out.println("4.Exit"); System.out.println("Enter Your Choice:-"); choice = getVal...
User cancelled the dialog
public void onClick(DialogInterface dialog, int id) { }
/ WARNING void declaration
@Override public void update(int n, int n2) { void mouseY; void mouseX; super.update((int)mouseX, (int)mouseY); float[] hsb = Color.RGBtoHSB(this.setting.getValue().getRed(), this.setting.getValue().getGreen(), this.setting.getValue().getBlue(), null); double difference = Mat...
Returns the value of the 'Version' attribute. If the meaning of the 'Version' attribute isn't clear, there really should be more of a description here...
String getVersion();
Lists all services belonging to a namespace.
default void listServices( com.google.cloud.servicedirectory.v1beta1.ListServicesRequest request, io.grpc.stub.StreamObserver<com.google.cloud.servicedirectory.v1beta1.ListServicesResponse> responseObserver) { io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( getListServi...
Only creates one NuxeoConnector instance and returns it.
public NuxeoConnector getNuxeoInstance() { if(this.nuxeoConnector==null) { nuxeoConnector = new NuxeoConnector(); } return this.nuxeoConnector; }
Start typing your Java solution below DO NOT write main() function
public int lengthOfLongestSubstring(String s) { int l=s.length(),len=0,r=0; HashMap<Character,Integer> h=new HashMap<Character,Integer>(); for(int i=0;i<l;) { char c=s.charAt(i); if(h.containsKey(c)) { i=h.get(c)+1; // we should restart and clear the hash...
Returns the total cellularity percentage.
public double getTotalCellularityPercentage() { return totalCellularityPercentage; }
tempt algorithm with higher cards (strategy hand has both wild and wd4)
@Test public void testPlayer_getBoldStrategyCard_numeric_colorBeatsNumber() { player2 = new Player("Player Two", true); player2.setHand(strategyHand.getAllCards()); // pick a cpc that could return two possible options // and assert that the higher value card comes back ...
The same RequestContext is used throughout the processing, and retries need to be reset once successfully connected so that any earlier (successful) recoveries are not considered when performing any new future recoveries. This test ensures that a reset clears the retry counter and that we can attempt retries again up t...
@Test public void testResetAndCanRetry() { assertTrue(rc.attempt()); assertTrue(rc.attempt()); assertTrue(rc.attempt()); rc.reset(); assertTrue(rc.attempt()); assertTrue(rc.attempt()); assertTrue(rc.attempt()); assertFalse(rc.attempt()); asser...
System.out.println("voPlace = " + voPlace);
@ApiOperation("新增一个会场") @PostMapping("/insertOnePlace") public ResultResponse insertOnePlace(@ApiParam("place对象") @RequestBody VoPlace voPlace){ Object data = null; StringBuilder message = new StringBuilder("新增会场"); try { data = placeService.insertOnePlace(voPlace); }...
/ access modifiers changed from: packageprivate
public void setRTLParams() { ViewGroup.LayoutParams layoutParams = this.mSkipView.getLayoutParams(); if (layoutParams instanceof RelativeLayout.LayoutParams) { RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) layoutParams; layoutParams2.removeRule(20); ...
Returns the result of interpreting the object as an instance of 'Data Type'. This implementation returns null; returning a nonnull result will terminate the switch.
public T caseDataType(DataType object) { return null; }
/ renamed from: b
public void mo38284b(C7998s sVar) { this.f27044g = sVar; }
/ / / / / / / 235
public long toTimelineValue(long millisecond) { return millisecond; }
Determines a ZScore for the specific key's win rate compared to the overall win rate Test from:
public double getZScore(K keyToCheck) { V winRateDataForKey = this.winRateData.get(keyToCheck); double p1 = winRateDataForKey.getWinRate(); double n1 = winRateDataForKey.playedCount; double p2 = (this.totalWinCount - winRateDataForKey.winCount) / (this.totalPlayedCount - winRateDataFor...
/ renamed from: b
public A mo9868b() { return this.f2527b; }
Constructor that makes document with Document Model docModel and Title title.
public Document(String title, CopyOnWriteArrayList<String> docModel, String location, int id) { this.docModel = docModel; this.name = title; this.location = location; this.id = id; /* Starts up command listener for document */ Thread t = new Thread(new Runnable() { @Override public voi...
Main method used to import dataset from CVS files: the file must contain: feature name;commitId; The program then takes each commit and extract the feature oriented changes from it and stores everything into the Neo4J database.
static public void extractFromCSVRefFile(String file_path) throws Exception { DataExtractor de = new DataExtractor(); File commitFile = new File(file_path); BufferedReader reader = new BufferedReader(new FileReader(commitFile)); String line = ""; List<String> commit_ids = new ArrayList<String>(); wh...
getTotalCustomers() Gets the total customers and returns.
public int getTotalCustomers() { return totalCustomers; }
Creates a quadric robust estimator based on 3D point samples and using provided points and robust estimator method.
public static QuadricRobustEstimator create(List<Point3D> points, RobustEstimatorMethod method) { switch (method) { case LMedS: return new LMedSQuadricRobustEstimator(points); case MSAC: return new MSACQuadricRobustEstimator(points); ...
this returns the record for a specified day, this method stores all the records in the array
public Record query(final PlayerType p_type, final int p_queryDate) throws RemoteException { for(int x= 0; x <= 100; x++) { records [x][1] = query(PlayerType.LEADER, x); records [x][2] = query(PlayerType.FOLLOWER, x); } return null; }
TODO Autogenerated method stub
public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int num = scanner.nextInt(); int i; int result = 1; for (i = 1; i <= num; i++) { result = result * i; if (i == num) { System.out.println(result); } } }
Disables a player from attacking for 10 seconds
public void disablePlayerAttacking(final Player p) { p.sendMessage(ChatColor.GRAY + "You cannot attack for 10 seconds."); final Listener l = new Listener() { @EventHandler public void onPlayerDamage(EntityDamageByEntityEvent e) { if (e.getDamager() instanceof Player && e.getEntity() instanceof Player) { ...
Function to check if array has 2 elements whose sum is equal to the given value
static boolean hasArrayTwoCandidates(int A[], int arr_size, int sum) { int l, r; /* Sort the elements */ Arrays.sort(A); /* Now look for the two candidates in the sorted array*/ l = 0; r = arr_size-1; while (l < r) { if(A[l] + A[r] == sum) return true; else if(A[l] + A...
Log.enter(this, "removeFramesWithValue", slot, facet, new Boolean(isTemplate));
public void removeFramesWithValue(Slot slot, Facet facet, boolean isTemplate) throws SQLException { trace("removeFramesWithValue", slot, facet); String command = "DELETE FROM " + _tableName + " WHERE " + SLOT + "= ? AND " + FACET + "= ? AND " + IS_TEMPLATE + "= ?"; PreparedStatement stmt = _stat...
records purchase of the given shares at the given price
public void purchase(double shares, double pricePerShare) { this.totalShares += shares; super.addCost(shares * pricePerShare); }
Get captured `from` argument.
public Optional<Tag> capturedFrom() { return this.from.get(); }
It returns the geometry representing agent location
public MasonGeometry getGeometry() {return agentLocation;}
Validation Functions Description : To validate the Postcode of Billing Address in Customer Tab Coded by :Raja Created Data:05 Oct 2016 Last Modified Date:05 Oct 2016 Modified By:Raja Parameter:Postcode
public void validate_the_Postcode_of_Billing_Address_in_Customer_Tab(String Postcode)throws Exception { VerifyElementPresent(Desktop_XPATH_Verify_Customer_Page_BillingAddress.replaceAll("M_Header", "Billing Address").replaceAll("M_Category", "Postcode").replaceAll("M_InnerText", Postcode), "Postcode of Billing Addres...
Sets the user id.
public void setUserId(int userId) { this.userId = userId; }
/ Choose a random Color
private int getRandomMaterialColor(String typeColor) { int returnColor = Color.GRAY; int arrayId = getResources().getIdentifier("mdcolor_" + typeColor, "array", getContext().getPackageName()); if (arrayId != 0) { TypedArray colors = getResources().obtainTypedArray(arrayId); ...
Humanreadable message for the merchant optional string memo = 4;
public Builder clearMemo() { copyOnWrite(); instance.clearMemo(); return this; }
TODO: Move to core...
protected AbstractMetadata(final boolean pStandardFormatSupported, final String pNativeFormatName, final String pNativeFormatClassName, final String[] pExtraFormatNames, final String[] pExtraFormatClassNames) { super(pStandardFormatSupported, pNative...
Defines literals for the meta objects that represent each class, each feature of each class, each enum, and each data type
interface Literals { /** * The meta object literal for the '{@link com.devoxx2012.xtext.demo1.demo1.impl.ModelImpl <em>Model</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see com.devoxx2012.xtext.demo1.demo1.impl.ModelImpl * @see com.devoxx2012.xtext.demo1.demo1.impl....