method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
98abe579-b0c5-40bc-b4b5-c40a81f8e723 | 6 | public void playGame() {
boolean isAlive = true;
printWelcome();
printHelp();
while (!game.hasWon() && isAlive) {
printScreen();
System.out.println("Cheese collected: " + game.getCheeseCount() + " of 5");
Coordinate move;
do {
move = resolveInput(getInput());
} while (!game.validMove(move));
... |
6f023389-26c8-4b36-8107-d89d1a4ce1b8 | 1 | @Override
public Item swap(Item newItem) {
Item temp = null;
try{
temp = armorItem;
armorItem = null;
armorItem = (BodyArmor) newItem;
return temp;
}catch(Exception e){
armorItem = (BodyArmor) temp; // swap fail, return to original
return newItem;
}
} |
fd81817b-15be-4ab3-8f65-20b584bc3c59 | 8 | private int ParseGameState(String s) {
planets.clear();
fleets.clear();
int planetID = 0;
String[] lines = s.split("\n");
for (int i = 0; i < lines.length; ++i) {
String line = lines[i];
int commentBegin = line.indexOf('#');
if (commentBegin >=... |
6c7281fa-db51-4009-907f-331d2b9a3aef | 5 | @Override
protected Event doExecute(RequestContext req) throws Exception {
boolean rslt = true;
SecurityChallenge challenge = (SecurityChallenge) req.getFlowScope().get(LookupSecurityQuestionAction.SECURITY_CHALLENGE_ATTRIBUTE);
if (challenge != null) {
List<Sec... |
d86e2a70-be96-49ec-b11e-8588f78b435e | 6 | public boolean AddUser(String PlayerName, Location loc, ArrayList<String> players, String Mod){
File file = new File(getDataFolder(),"Plates.prop");
if(PlayerName == null || loc == null || players.isEmpty() || Mod == null){
return false;
}
String string = PlayerName +":"+loc.getWorld().getName()+","+ loc.get... |
ec1209e1-404d-483e-b94c-8aed621a1cf3 | 9 | public void filtrarContratos() {
try {
String filtro = panelInformacion.getTextoFiltro();
int tipoFiltro = panelInformacion.getTipoFiltro();
if(!filtro.trim().equals("")) {
if(tipoFiltro == Contrato.FILTRO_ID_DUENIO ||
tipoFiltro == ... |
86ecc8c9-6770-4c57-a2cd-c6eb909149e8 | 0 | @Override
public void setPhone(String phone) {
super.setPhone(phone);
} |
eee879c6-63a2-4daf-a474-24a25728da34 | 4 | @Override
public int compare(AndroidMethod m1, AndroidMethod m2) {
if(m1.getCategory() == null && m2.getCategory() == null)
return 0;
else if(m1.getCategory() == null)
return 1;
else if(m2.getCategory() == null)
return -1;
else
return m1.getCategory().compareTo(m2.getCategory());
} |
2d843ed1-ca2d-4c33-8251-d09b4ca3f911 | 2 | public boolean isPrime(int num) {
for (int i = 2; i < num; i++) {
if (num % i == 0) {
return false;
}
}
return true;
} |
a6d14bea-45ea-4dfc-838d-bedc7aec8b32 | 1 | public void test_DateTime_withHourZero_Gaza() {
DateTime dt = new DateTime(2007, 4, 1, 8, 0, 0, 0, MOCK_GAZA);
assertEquals("2007-04-01T08:00:00.000+03:00", dt.toString());
try {
dt.withHourOfDay(0);
fail();
} catch (IllegalFieldValueException ex) {
//... |
3faa2124-ac4e-4629-9faf-3b29c9e5404f | 6 | public static boolean extract(LauncherAPI api, GameFile source, File dest,
int min, int max, boolean recursive) throws Exception
{
final String[] exts = source.getFileName()
.substring(source.getFileName().indexOf('.', 0) + 1)
.split("\\.");
File ... |
f4e54b0e-b269-4471-8e0d-a640b4dfd1da | 7 | String codons() {
char seq[] = chromoSequence.toCharArray();
char seqNew[] = chromoNewSequence.toCharArray();
codonsOld = "";
codonsNew = "";
int codonIdx = 0;
int i = 0;
int step = transcript.isStrandPlus() ? 1 : -1;
char codonOld[] = new char[3];
char codonNew[] = new char[3];
for (Exon ex : tran... |
3b9b034c-2e69-4ec8-a05f-47e6f161b230 | 5 | private void deleteData() {
if(model.getRowCount() == 0) {
// 削除するものがなければ抜ける
return;
}
// 警告ダイアログ
int opt = Dialogs.showQuestionDialog("本当に削除しますか?", "");
if(opt != Dialogs.OK_OPTION) {
// OK が選択されなければ何もしない
return;
}
// 現在行を削除
model.removeRow(nowDataRow);
// 削除された行の次にあたる行を表示する
// 最終行を... |
f820877a-3447-46e6-b845-f2c3354157c4 | 5 | public boolean left() {
for(boolean[] position : emplacement.getCoordoneeJeu())
if(position[0] == true)
return false;
for(boolean[] position : emplacement.getCoordoneeJeu())
for(int x=0; x<emplacement.getNombreColonne(); x++)
if (position[... |
241b6271-3100-485d-9fe1-2c8466b14cf1 | 6 | public boolean validate() throws IllegalStateException {
if(populationSize<parentSize){
throw new IllegalStateException("Liczba populacji mniejsza od liczby rodziców");
}
if(populationSize==0||parentSize==0){
throw new IllegalStateException("Liczba populacji lub rodziców ... |
fd30a345-0749-41c8-b9bc-b27054bb336a | 2 | @Override
public void save() {
try {
saveFile.createNewFile();
fo = new FileOutputStream(saveFile);
JAXB.marshal(dataholder, fo);
} catch (FileNotFoundException e) {
} catch (IOException e) {
}
} |
f8816e0a-4adc-447a-b152-805990f1e764 | 5 | public static ParseResult parseXmlAttribute( char[] chars, int offset ) throws XMLParseException {
offset = skipWhitespace(chars, offset);
switch( chars[offset] ) {
case( '>' ): case( '/' ): return new ParseResult(null, offset);
}
ParseResult nameParseResult = parseXmlText(chars, offset, '=');
String name =... |
3df044e6-aece-4129-bbae-78f76ad653e6 | 3 | public boolean hasNext() {
if(empty) return false;
// first check if current data block can be read for next
if(bedFeatureIndex < bedFeatureList.size())
return true;
// need to fetch next data block
else if(leafItemIndex < leafHitList.size())
r... |
250e8da9-0bb4-468c-873d-d727aeb6d6d1 | 7 | public static void main(String[] args) {
Scanner inputType = new Scanner(System.in);
while (true) {
try {
TypeTable table = new TypeTable("table.csv");
System.out.println("***********************... |
e4bc3390-6fa1-460d-bb11-d30de69c0736 | 5 | private void pop(char c) throws JSONException {
if (this.top <= 0) {
throw new JSONException("Nesting error.");
}
char m = this.stack[this.top - 1] == null ? 'a' : 'k';
if (m != c) {
throw new JSONException("Nesting error.");
}
this.top -= 1;
... |
3f9ca39d-5c2a-4a45-9cb6-8c2a907c5edf | 6 | public int numDistinct(String S, String T) {
// Start typing your Java solution below
// DO NOT write main() function
int m = S.length();
int n = T.length();
if (n == 0 || m < n)
return 0;
int[][] res = new int[n + 1][m + 1];
for (int i = m; i >= 0; i--)
res[n][i] = 1; // 额外初始化一层,方便统一处理
for (int i... |
9c20acbc-aeb8-4840-a6b4-6b7aa9a17c97 | 4 | private void firstBeepers() {
if (facingEast()) {
if (rightIsClear()) {
turnRight();
move();
if (noBeepersPresent()) {
turnAround();
move();
putBeeper();
turnRight();
} else {
turnAround();
move();
turnRight();
}
}
} else {
turnLeft();
move();
if... |
d2f40523-4c1c-4466-b232-971e0ddbead4 | 2 | public float getDistanceBetween(Node node1, Node node2) {
// if the nodes are on top or next to each other, return 1
if (node1.getX() == node2.getX() || node1.getY() == node2.getY())
return 1 * (mapHeight + mapWith);
else
return (float) 1.7 * (mapHeight + mapWith);
} |
824c86f6-a5f8-46c3-9469-2ae2985a62f8 | 1 | static Set<Point> getCirclePoints(int r, int cx, int cy) {
Set<Point> points = new HashSet<Point>();
points.add(new Point(cx + r, cy));
points.add(new Point(cx - r, cy));
points.add(new Point(cx, cy + r));
points.add(new Point(cx, cy - r));
int y = r;
for(int x = 1; x <= y; ++x) {
y = (int) Math.round(... |
2a5ef756-26e7-4679-bece-c6dd004bcbf1 | 9 | private void openHttpsPostConnection(final String urlStr, final byte[] data, final int sampleRate) {
new Thread () {
public void run() {
HttpsURLConnection httpConn = null;
ByteBuffer buff = ByteBuffer.wrap(data);
byte[] destdata = new byte[2048];
int resCode = -1;
OutputStream out = null;
... |
b0faf38b-e0b5-4214-95ec-965798c57931 | 9 | public static void main(String[] args) {
setCloseTime(Calendar.getInstance());
setOpenTime(Calendar.getInstance());
//** Setup the members with gender and homeclub
for(int i=0;i<max_members;i++){
mp.put(i,new Member(i, getGender(), getClub(null)));
}
System.out.println("Generating stats... "); //mp.... |
9bd7f7fd-f207-465b-ac21-ca122965522f | 6 | protected void onOk() {
try {
iteracoes = Integer.parseInt(txtIterations.getText());
} catch (NumberFormatException e) {
iteracoes = 0;
}
if (iteracoes < 1) {
JOptionPane.showMessageDialog(this,
"You must define at least one intera... |
3b81164e-5119-4d84-9c85-2371522d4e93 | 0 | protected void end() {
Robot.tilter.stop();
} |
85295a33-5a5b-4ac2-a323-667a2b941944 | 4 | public int delete() {
if (size == 1) {
int helpvalue = root.value;
root = null;
return helpvalue;
}
int returnedvalue = root.value;
Binarynode help = root;
help.value = root.value;
String binary = Integer.toBinaryString(size);
... |
b252c8b5-89e3-4831-ba59-b94216331704 | 3 | public void actualizarTurnosBD() {
conexion.conectar();
for (Turno turno : turnos) {
if (turno.getDescripcion() != null && turno.getDuración() != 0) {
String sql = "UPDATE turno SET estado = true, descripcion='" + turno.getDescripcion() + "',"
+ " dura... |
75eb6dc8-bcad-4559-bce3-2623e801625d | 9 | @Test
public void testGetNextCard() throws Exception {
Shoe shoe = new Shoe(1, 0);
Map<String, Integer> seenCards = new HashMap<String, Integer>();
for(int i = 0; i < 52; i++) {
Card card = shoe.getNextCard();
if(seenCards.containsKey(card.toString())) {
... |
eb4a09ef-3a33-4f74-aade-6f002817319a | 9 | public Persona actualizarLicencias(Persona p) {
Persona persona = personas.get(p.getCi());
List<LicenciaConductor> eliminar = new ArrayList<>();
for (LicenciaConductor vieja : persona.getLicenciasDeConducir()) {
boolean remover = true;
for (LicenciaConductor nueva : p.ge... |
6b8b10e7-186a-4e7f-b5e9-d2ccccdc2716 | 1 | public Controller() {
try {
bar = new OtpNode("java", "cake");
mbox = bar.createMbox();
} catch (IOException ex) {
Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, null, ex);
}
ok = new OtpErlangAtom("ok");
// new Thread(new Runna... |
22296f3e-496b-4e14-9316-ee3b3e4de3f9 | 9 | private void explode(int damage){
if(absoluteHitPosition.tileType == TileType.ROCK
|| absoluteHitPosition.tileType == TileType.VOID
|| absoluteHitPosition.tileType == TileType.SPAWN){
Debug.warn("Mortar hit " + absoluteHitPosition.tileType + " tile, did not explode");
return;
}
int baseDamage = dam... |
e7251c0e-9624-4e16-a7ae-32dc967bc647 | 3 | public CircleAccumulator(boolean[][] edgeImage, int minRadius, int maxRadius) {
if(edgeImage.length < 1 || edgeImage[0].length < 1) throw new IllegalArgumentException("edgeImage must have positive dimensions");
if(minRadius >= maxRadius) throw new IllegalArgumentException("minRadius must be less than maxRadius");
... |
298ac288-d922-4f2b-92d9-ed7be43abd55 | 2 | public int terminateRental(DrivingLicense drivingLicense){
String typeOfCar = "";
int fuelToFillTank = 0;
int distanceTravelled = 0;
Car c = AbstractCar.getInstance(typeOfCar, RegistrationNumber.getInstance(extracted(registrationNumber).getLetterIdentifier(), extracted(registrationNumber).getNumberIdentifier())... |
bab7c5c6-5d79-412f-ae52-6ea8ecef32d0 | 8 | public int right(){
int movedNr = 0;
for(int i=0;i<getX();i++){
ArrayList<Integer> merged = new ArrayList<Integer>(2); //list of all tiles which are already merged and are not allowed to be merged again
for(int u=getY()-1;u>0;u--){//go from right to left
int cv = u-1;
if(cells[i][cv] != 0){
Boole... |
f754b129-9917-4cec-9c8b-d0f922a61f38 | 1 | private byte[] compressBytes(byte[] orginal) {
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
try {
GZIPOutputStream gzip = new GZIPOutputStream(byteStream);
gzip.write(orginal);
gzip.close();
} catch (IOException e) {
this.parent.server.Log("Error compressing level!");
e.printStac... |
e8357616-58e5-47a8-9cde-57cfce7b1e8b | 7 | public void addTask(Task item) {
try {
String filepath = System.getProperty("user.home")
+ "/.TODO-group9/savedata.xml";
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.parse(filepath); ... |
047d564f-ba2c-4857-b61c-4dad52f65a59 | 6 | public String iniciarProduccion() {
double materiaPrima = getCantMateriaPrima();
String averia = "";
String msj = "";
if(isActivo()){
if(modoOperacion == 'C'){
while (getCantMateriaPrima() > 0) {
materiaPrima = materiaPrima - getMoldeEnvases().obtenerPorcMateria();
setCantMateriaPrima(materiaP... |
4104473d-f8d5-488e-af4b-e3ecd0fd012a | 4 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
comboCliente = new javax.swing.JComboBox();
tfProcesso... |
fd87f0f4-59a3-4c67-babc-be112166cdde | 8 | public void handleSaveMachineButton(){
String name = JOptionPane.showInputDialog(this,"Machine name?",null);
if(name == null){
}
else if(name.trim().length() > 0){
File savingDir = new File("Saved");
if (!savingDir.exists()){
savingDir.mkdirs();
}
Fil... |
6b9a9836-be83-488e-a1ba-2127faf46d29 | 0 | public int GetOffBusTicks()
{
//get the tick time person got off the bus
return offBusTicks;
} |
99b41148-fe93-4a97-9fe0-8d07fef8312b | 2 | public boolean isPushTwoTransition(Transition transition) {
PDATransition trans = (PDATransition) transition;
String toPush = trans.getStringToPush();
if (toPush.length() != 2)
return false;
/*
* String input = trans.getInputToRead(); if(input.length() != 1) return
* false;
*/
String toPop = trans... |
a92b87d8-cb2e-4c64-a4ec-41b1c59cb83b | 5 | public static Integer versionCompare(String str1, String str2) {
String[] vals1 = str1.split("\\.");
String[] vals2 = str2.split("\\.");
int idx = 0;
// set index to first non-equal ordinal or length of shortest version
// string
while (idx < vals1.length && idx < vals2.length && vals1[idx].eq... |
fce6c942-76ac-406f-83b1-487f8658086b | 2 | private void pasteUrlFromClipboard() {
if (Config.getInstance().getAddURLAutoPaste()) {
String text = getPasteString();
URL url = getUrlFromString(text);
if (url != null) {
view.setUrlText(url.toString());
}
}
} |
c205925b-0e87-49e9-8968-f9f51f39edbc | 2 | private void render(Graphics2D graphics) {
for (Tile[] tileArray : tiles) {
for (Tile tile : tileArray) {
tile.render(graphics);
}
}
} |
38d5f340-e006-4f44-add3-ba68cf692589 | 4 | private void removeFile() {
JFrame frame = new JFrame();
// if there is at least one file parsed
if( fileIndex.numOfFilesParsed() != 0 ) {
// get the file name to remove
String fileName = (String) JOptionPane.... |
8f97a0b0-a7ea-4d32-97f0-1bb696c6b81f | 9 | private void extractJar(File file, String path) throws Exception
{
final int initialPercentage = launcher.getPercentage();
final JarFile jarFile = new JarFile(file);
Enumeration<JarEntry> entries = jarFile.entries();
int totalSizeExtract = 0;
while (entries.hasMoreEl... |
9f9c2dd7-e557-4682-889a-409fd6ac01ef | 3 | @Override
public void put(Key key, Value val)
{
if (N > M * 10)
resize(2 * M);
if (val == null)
{
delete(key);
return;
}
int i = hash(key);
if (!st[i].contains(key)) // Note: More efficient than contains(key) as
// duplicate calculation of hash(key) not
// involved
N++;
s... |
74b49495-9586-449e-919d-608ac397e4a0 | 4 | @Override
public void exportDone(JComponent c, Transferable data, int action)
{
initialImportCount = 1;
if (c instanceof mxGraphComponent
&& data instanceof mxGraphTransferable)
{
// Requires that the graph handler resets the location to null if the drag leaves the
// component. This is the conditi... |
93f12449-acfa-4e76-911a-3f351084d6f2 | 1 | public boolean partidoCompleto() {
return (listaJugadores.size()==10) && listaJugadores.stream().allMatch(j->j.getModo() instanceof Estandar);
} |
d32fa12b-6957-4c0d-9f7a-187a628dbd64 | 0 | public ExponentialTerm(double base) {
_base = base;
} |
91996f53-3952-48ea-81ba-04c9b85b1a94 | 4 | @Override
public void keyPressed(KeyEvent arg0) {
switch(arg0.getKeyCode()){
case KeyEvent.VK_UP:
upArrow = true;
break;
case KeyEvent.VK_DOWN:
downArrow = true;
break;
case KeyEvent.VK_LEFT:
leftArrow = true;
break;
case KeyEvent.VK_RIGHT:
rightArrow = true;
break;
}... |
031c6e7e-3256-4b9f-8b65-a4dbcacbe726 | 9 | private void parseResponse(String rawResponce, GoogleResponse googleResponce) {
if (rawResponce == null || googleResponce == null)
return;
String responce1 = StringUtil.substringBetween(rawResponce, "[", "]");
boolean confident = true;
if (responce1 == null || responce1.equals("")) {
confident = false;
... |
98f00475-085c-4a55-af1b-ac8f4c23b7ad | 0 | public void clickPlayGame(ArrayList<MainMenuHeroSlot> heroies) {
//Initializes main menu for game play
MainMenuGame.MainMenuGame.main(new String [0], heroies);
//Once game is played reset the game so he can play again
gumballMachine.setState(gumballMachine.hasNotChosenCharactersState());
} |
759cae86-fc42-405e-8d47-64944db45b65 | 0 | public int getPort() {
return this.port;
} |
75ca275b-3da9-4b8a-be6b-4442f773bfea | 7 | @Override
public Object getValueAt(int i, int i1) {
Tenant t = tenants.get(i); //To change body of generated methods, choose Tools | Templates.
switch (i1) {
case 0:
return t.getId();
case 1:
return t.getName();
... |
eec2e5ae-2b53-48d5-bcd7-51442bd771e0 | 8 | public List<Prize> execute() throws IOException {
FileInputStream fis = new FileInputStream(new File(inputFile));
XSSFWorkbook wb = new XSSFWorkbook(fis);
XSSFSheet sheet = wb.getSheet(MAGIC);
Iterator<Row> it = sheet.iterator();
while (it.hasNext()) {
Row row = it.next();
String category = getCellStrin... |
9e4d4d7a-7f4a-4cd9-b58e-dbb90bc71b54 | 4 | public void uploadDirectory(FTPFile srcDir, FTPFile dstDir)
throws IOException, FtpWorkflowException, FtpIOException {
if (!srcDir.isDirectory())
throw new FtpFileNotFoundException("Uploading: " + srcDir.getName()
+ " is not possible, it's not a directory!");
... |
d06d3183-7591-4975-9fe2-778ff1e70a4d | 0 | public String getSourceLine(int lineNumber) {
return sourceLines.get(lineNumber).getSourceLine();
} |
9c7b1c56-a867-415e-b4e3-7dd542a51a55 | 3 | @Override
public void mouseReleased(MouseEvent e)
{
super.mouseReleased(e);
if (e.getButton() == MouseEvent.BUTTON1)
addVertex(draggedToX, draggedToY);
else if (e.getButton() == MouseEvent.BUTTON2)
removeVertex(draggedToVertex);
else if (e.getButton() == M... |
d3e11c47-9360-446b-8d6e-ba30a87a5490 | 8 | @Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof IterableComparator)) {
return false;
}
final IterableComparator<?> other = (IterableComparator<?>) obj;
if (iteratorComparator == null) {
if (other.i... |
5f65fd3b-59e5-4cc4-a224-f54bf52f6939 | 2 | @Override
public void out() throws Exception {
Object val = fa.getFieldValue();
// Object val = access;
if (ens.shouldFire()) {
DataflowEvent e = new DataflowEvent(ens.getController(), this, val);
//// DataflowEvent e = new DataflowEvent(ens.getController(), this, acce... |
319c5f94-c66b-45da-be44-bbf3da44dfe0 | 2 | public static int[][] getArray() {
int [][] num={{1,2,3},{4,5},{2}};
for(int i = 0; i < num.length; i++) {
for(int j = 0; j < num[i].length; j++)
System.out.println(num[i][j]);
}
return num;
} |
83368dbf-ba58-413d-9a67-08a03fa07941 | 6 | public static TreeSet<Integer> primeSieve(int limit) {
boolean[] numberList = new boolean[limit + 1];
TreeSet<Integer> primeList = new TreeSet<>();
for(int i = 2; i <= limit; i++) {
numberList[i] = true;
}
for(int i = 2; i * i <= limit; i++) {
if(numberL... |
24a16cfd-fcc9-4e0e-9d54-a043fb8a2fe4 | 7 | public boolean delete(T item) {
if(current != null) {
if(current == current.getNext() && current.getData().equals(item)) {
current = null;
return true;
} else {
Link<T> cur = current;
Link<T> prev = null;
whi... |
ed2c222d-15ad-41d6-b00a-4774157cdeeb | 0 | public Builder(final Object paramValue) {
this.value = null;
this.paramValue = paramValue;
} |
d079ae2f-74b0-4ac8-9b62-7c4790dd24d0 | 3 | public void run()
{
try
{
this.MReading.acquire();
if(this.counter == 0)
this.MWriting.acquire();
this.counter++;
this.MReading.release();
System.out.println("Lecture");
Thread.sleep(1000);
this.MReading.acquire();
this.counter--;
if(this.counter == 0)
this.MWriting.re... |
ca837c4f-4cc2-4e7c-9f04-28d3be7690b6 | 7 | public void pack() {
boolean isrunestone = cap.text.equals("Runestone");
Coord max = new Coord(0, 0);
for (Widget wdg = child; wdg != null; wdg = wdg.next) {
if ((wdg == cbtn) || (wdg == fbtn))
continue;
if ((isrunestone) && (wdg instanceof Label)) {
Label lbl = (Label) wdg;
lbl.settext(GoogleTr... |
f95dcefe-6ee3-4474-8649-d58c5f223737 | 3 | @Override
public Object get( ByteBuffer in )
{
byte nil = in.get();
if (nil == Compress.NULL)
{
return null;
}
try
{
Object o = constructor.newInstance();
for (int i = 0; i < fields.length; i++)
{
... |
a84faed1-49e6-4510-94ac-9a532762c436 | 0 | public Cookies(Cookie[] cookies) {
// TODO Auto-generated constructor stub
this.cookies = cookies;
} |
9aad3408-1696-452d-a92c-ea13eb2ea1f7 | 9 | public boolean equip(final int... ids) {
Item item;
if (ctx.bank.opened()) {
item = ctx.bank.backpack.select().id(ids).poll();
} else {
item = ctx.backpack.select().id(ids).poll();
if (item.id() > -1) {
if (!ctx.hud.opened(Hud.Window.BACKPACK) && ctx.hud.open(Hud.Window.BACKPACK)) {
ctx.sleep(40... |
14074c5a-66b2-4f91-9712-67831db8fa19 | 6 | public void handleInput() {
if (Keys.isPressed(Keys.ESCAPE)) gsm.setPaused(true);
if (player.getHealth() == 0) return;
player.setUp(Keys.keyState[Keys.UP]);
player.setDown(Keys.keyState[Keys.DOWN]);
player.setLeft(Keys.keyState[Keys.LEFT] || Keys.keyState[Keys.A]);
player.setRight(Keys.keyState[Keys.RIGHT] ... |
fd3d914f-613f-47b4-8642-701c3f889391 | 0 | public void execute( JobExecutionContext context )
throws JobExecutionException
{
this.invocationsA++;
} |
68544a69-fbcc-4bb7-a8f0-475ba8fcad6e | 6 | @Override
public void run() {
if (Updater.this.url != null) {
// Obtain the results of the project's file feed
if (Updater.this.read()) {
if (Updater.this.versionCheck(Updater.this.versionName)) {
if ((Updater.this.versionLi... |
0e7dc403-4751-4777-9322-2a77baa99b0c | 0 | @Override
public void move(long ticks, FrameBuffer buffer){} |
3f464a9c-f4be-4cd8-b7b4-fcdcdb581b4c | 7 | public boolean addSpawnedMob(Mob mob, MobReference mobRef)
{
if (!mobRef.isValid())
return false;
// Add the mob to the regions limit
if (maxAliveLimiter != null && !maxAliveLimiter.add(mobRef))
return false;
// Add the mob to its grouped limit
if (groupedMaxAliveLimiters != null && mob.regionLim... |
4ead7214-da6e-4087-8907-e02716773fe9 | 4 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {// 非空性
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Point p = (Point) obj;
return this.x == p.x && this.y == p.y;
} |
a3de28e2-ade4-4698-ba73-fcdf634f4c34 | 2 | public int maxSubArray3(int[] A) {// O(1) space
int last = 0;
int max = A[0];
for (int i = 0; i < A.length; i++) {
if (last >= 0)
last += A[i];
else
last = A[i];
max = Math.max(last, max); // keep track of the largest sum
}
return max;
} |
60f0c24c-5582-4341-9f4d-ba167c541405 | 3 | public String getWinningTeam(String matchName){
for(String teamName: TEAM_NAMES){
if(teamIsWipedOut(matchName, teamName)){
return teamName.equalsIgnoreCase(TEAM_NAMES[0]) ? TEAM_NAMES[1] : TEAM_NAMES[0];
}
}
return null;
} |
bd568bcb-c336-414a-9c12-fb0d7b7ce07b | 1 | public Vector3f normalized()
{
float length = this.length();
if ( length == 0 )
return new Vector3f( 0, 0, 0 );
return ( new Vector3f( x / length, y / length, z / length ) );
} |
46f23a4e-6ca1-4a30-917a-516c4081758d | 9 | private boolean decode5(ByteArrayOutputStream baos)
throws PDFParseException {
// stream ends in ~>
int[] five = new int[5];
int i;
for (i = 0; i < 5; i++) {
five[i] = nextChar();
if (five[i] == '~') {
if (nextChar() == '>') {
... |
49976388-98f2-4d64-ba3a-1db2dd454226 | 6 | public MyClient(){
super(header);
gameState = 0;
Container c = getContentPane();
c.setLayout(null);
Border loweredbevel, raisedbevel;
loweredbevel = BorderFactory.createLoweredBevelBorder();
raisedbevel = BorderFactory.createRaisedBevelBorder();
imgHolder = new JLabel(new ImageIcon("images\\Kashiwazak... |
2091c109-3835-4578-ae9f-3cf362c32f69 | 4 | public static Operation createOperation(int operation) {
Operation opt = null;
switch (operation) {
case OPERATION_ADD:
opt = new OperationAdd();
break;
case OPERATION_SUB:
opt = new OperationSub();
break;
case OPERATION_MUL:
... |
e8209281-ddea-4b30-946c-57fde708f6dc | 1 | public boolean opEquals(Operator o) {
return (o instanceof OuterLocalOperator && ((OuterLocalOperator) o).local
.getSlot() == local.getSlot());
} |
fa1dfd39-5011-4f61-bb14-281d80dcc349 | 8 | private final Path generateMap(final Object name, final Object title) {
final Path map = this.midi.getParent().resolve(
this.midi.getFilename() + ".map");
final OutputStream out = this.io.openOut(map.toFile());
final String style = this.STYLE.value();
this.io.writeln(out, String.format("Name: %s", title));... |
17031f51-d874-4963-954f-d6c121fbdf67 | 7 | public PROJECTView(SingleFrameApplication app) {
super(app);
initComponents();
//below code remove the required components from frame
filefield.setVisible(false);
filelabel.setVisible(false);
passfield.setVisible(false);
passlabel.setVisible(false);
brows... |
ad988bcc-133c-402a-87e9-f19dee132359 | 0 | public void setDiscount(int index, float discount){
this.discount[index]=discount;
} |
c912ef4b-00c7-40df-8ca1-85fe8f418be6 | 7 | private boolean isObstructed() {
if (pastLeftEdge()) {
return true;
}
if (pastRightEdge()) {
return true;
}
int[][] rotation = currentDroppingBlock.getCurrentRotation();
for(int i = 0; i < rotation.length; i++) {
for (int j = 0; j < rot... |
d241638f-c406-4b07-893b-a76460e859f3 | 0 | public T getFoo()
{
return foo;
} |
a2be2d0b-2bc5-497a-beb0-14d94bc75a4f | 1 | public void removeOnetimeLocals() {
StructuredBlock[] subBlocks = getSubBlocks();
for (int i = 0; i < subBlocks.length; i++)
subBlocks[i].removeOnetimeLocals();
} |
8d251e5b-7f8e-4eab-9c43-38dea0ad10de | 3 | boolean isAttackPlaceVerticallyBelowNotHarming(int position, char[] boardElements, int dimension, int numberOfLinesBelow) {
while (numberOfLinesBelow > 0) {
if (isPossibleToPlaceOnNextLine(boardElements, elementVerticallyBelow(dimension, position, numberOfLinesBelow))
&& isBoardE... |
06602dfb-461e-4754-8dba-b66056c793cd | 1 | public final void visitMethodInsn(final int opcode, final String owner,
final String name, final String desc) {
AttributesImpl attrs = new AttributesImpl();
if (opcode != Opcodes.INVOKEDYNAMIC) {
attrs.addAttribute("", "owner", "owner", "", owner);
}
attrs.addAttribute("", "name", "name", "", name);
att... |
c599df2a-d6a6-4329-8b67-b9ea4e9e3562 | 0 | public Contents contents() {
return new Contents();
} |
dbe6ba89-6916-43ee-97b0-d153fc543339 | 3 | @Test
public void resolve() {
int i = 1;
long sum = 0;
long limit = 4 * 1000 * 1000;
while (true) {
long value = f(i);
if (value > limit) {
print(sum);
break;
} else if (value % 2 == 0) {
sum += value;
}
i++;
}
} |
9b92702c-7e54-48f4-8511-ce7133f212a2 | 2 | public static void main(String[] args) {
/*
* Порахувати опір ланки яка скл. з двох резисторів, що можуть бути з"єднані
* або послідовно, або паралельно.
*/
System.out.print("Введіть опір 1 >> ");
Scanner in = new Scanner (System.in);
int r1 = in.nextInt();
System.out.print("Введіть опір 2 >> ");
... |
26ebadf4-26b5-4a81-8aa8-0d263d11f28a | 5 | public void act(List<Actor> newRabbits)
{
if (isZiek) {
timeToDie--;
if(timeToDie<0) {
setDead();
}
}
incrementAge();
if(isAlive()) {
giveBirth(newRabbits);
// kijken of het konijntje andere konijnen kan besmetten
if(isZiek) {
... |
12a71d01-48b4-49ac-a6b5-5bf8add64e09 | 5 | void workerUpdate(File dir, boolean force) {
if (dir == null) return;
if ((!force) && (workerNextDir != null) && (workerNextDir.equals(dir))) return;
synchronized(workerLock) {
workerNextDir = dir;
workerStopped = false;
workerCancelled = true;
workerLock.notifyAll();
}
if (workerThread == null) ... |
c18904d8-ef7d-43e8-8ef9-c498194360e1 | 0 | public int getA() {
return this.a;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.