method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
9d41fd3c-ef0f-4f4e-890f-b76851315f2f | 5 | public static void main(String[] args)
{
try
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (Exception e)
{
e.printStackTrace();
}
if(args.length > 0 && args[0] != null)
{
username = TextFormatting.escapeString(args[0]);
}
if(args.length > 1 && args[1] !=... |
89ad4db2-8014-4568-b09c-0e4a9d28c2d6 | 8 | public Tile getTile(int x, int y) {
if (x < 0 || y < 0 || x >= width || y >= height) return Tile.voidTile;
if (tiles[x + y * width] == Tile.col_grass) return Tile.grass;
if (tiles[x + y * width] == Tile.col_flower) return Tile.flower;
if (tiles[x + y * width] == Tile.col_rock) return Tile.rock;
if (tiles[x... |
9c8bf720-3451-4406-8cef-f88bd72facb6 | 2 | public boolean hasNextDouble()
{
if(hasNext())
try
{
Double.parseDouble(token);
return true;
}
catch(Exception e)
{
return false;
}
else
return false;
... |
32ecaad7-8389-4695-b078-4bb6cebdf9be | 4 | public void update() {
if(!active) {
return;
}
Vector thrust = this.thrust.clone();
// normalize thrust if we need to
if(thrust.lengthSq() > Rules.MISSILE_MAX_THRUST * Rules.MISSILE_MAX_THRUST) {
thrust.normalize().scale(Rules.MISSILE_MAX_THRUST);
}
// update velocity
velocity.add(thrust);
/... |
a7c75113-0825-47fd-9ebc-24dd30392300 | 9 | public String getHighestDownloadedVersion() {
File f = new File(Launcher.getGameDirectory() + "/versions");
if (f.exists() && f.listFiles().length > 0) {
List<File> versionFolders = new ArrayList<File>();
for (File q : f.listFiles()) {
if (q.getName().startsWith("Experiment X ")) {
versionFolders.add... |
2f33cb8f-709f-4a5f-8cdd-ad06bdbe2fc5 | 8 | private JPanel transtab() {
JPanel trans = new JPanel();
trans.setLayout(null);
JButton newtrans, viewtrans;
newtrans = new JButton("New Transaction");
viewtrans = new JButton("View Transactions");
newtrans.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ar... |
1aa77df3-0ae7-4cd2-8e38-a07e35bef932 | 9 | @Override
public void contextInitialized(ServletContextEvent evt) {
// Read JPA persistence unit name from xml file,
// value is <persistence-unit name="myjpaunit" ...> attribute.
InputStream is=null;
try {
is = evt.getServletContext().getResourceAsStream("/WEB-INF/classes/META-INF/persistence.xml");
if ... |
9ec27bef-6bdf-4d64-bcfb-f56b7e9b78b8 | 7 | public void renderArea(int col, int xMin, int xMax, int yMin, int yMax, boolean offset) {
if (offset) {
xMin -= xOffset;
xMax -= xOffset;
yMin -= yOffset;
yMax -= yOffset;
}
for (int y = yMin; y < yMax; y++) {
for (int x = xMin; x < xMax; x++) {
if (x < 0 || x >= w || y < 0 || y >= h) break;
... |
8cfb12dc-9de8-4865-9e6a-c9c4bb09db52 | 0 | public static void setSimulator(Simulator simulator) {
Main.simulator = simulator;
} |
e7ebfb6e-1b3b-405a-8659-ef02569d4165 | 7 | public static void delete(JoeTree tree, OutlineLayoutManager layout, boolean deleteMode) {
Node youngestNode = tree.getYoungestInSelection();
if (youngestNode == null) {
return;
}
Node parent = youngestNode.getParent();
CompoundUndoableReplace undoable = new CompoundUndoableReplace(parent, deleteMode... |
ba990f23-414d-489d-8317-c2d7ddd17410 | 4 | int[] gjFromFixed(long date) {
long approx = div(4 * (date - JULIAN_EPOCH) + 1464, 1461);
long year = (approx <= 0) ? approx - 1 : approx;
int year_i = (int)year;
if (year_i != year) {
throw new RuntimeException("year cannot be cast to an int: " + year);
}
lon... |
cad4df86-d8ef-46ed-95f6-f109ccc1bcb9 | 9 | private void offerDonation(int newPriority, ThreadState masterThread)
{
deadlockKiller.add(masterThread);
if (masterThread.getEffectivePriority() == newPriority || masterThread.hasGreaterPriorityThan(newPriority))
{
return;
}
for(PriorityQueue queue: masterThread.listOfQueues)
{
... |
d8d57a47-c20e-4cc9-a346-957656c844bd | 4 | public char readChar()
{
char ch = '\u0000';
try
{
if (ready())
{
ch = (char)myInFile.read();
}
}
catch (IOException e)
{
if (myFileName != null)
System.err.println("Error reading " + myFileName + "\n");
myErrorFlags |= READERROR;
}
if (... |
7f4a6664-c77d-436c-a6d5-19f8be5ef3ed | 1 | @Override
public void paint(Graphics g0) {
super.paint(g0); // may be necessary for some look-and-feels?
Graphics2D g = (Graphics2D) g0;
Color c = getForeground();
int w2 = Math.min(getWidth(), this.w);
int h2 = Math.min(getHeight(), this.w);
Rectangle r = new Recta... |
102a2a58-4e1b-4d8c-89d3-e1926ed26ab2 | 3 | public void setInventoryContents(ItemStack[] contents)
{
for (int i = 0; i < Inventory.length; i++)
{
if (i < contents.length && contents[i] != null)
Inventory[i] = contents[i].clone();
else
Inventory[i] = null;
}
} |
d98e0362-58cf-4e86-a316-7403f14c3d1b | 5 | @Override
public void caseASysoutStmt(ASysoutStmt node)
{
inASysoutStmt(node);
if(node.getSmc() != null)
{
node.getSmc().apply(this);
}
if(node.getRPar() != null)
{
node.getRPar().apply(this);
}
if(node.getExp() != null)
... |
52fc4880-590f-4ce3-b51d-ce8a1a0bca1b | 4 | public double value(StateObservation a_gameState) {
boolean gameOver = a_gameState.isGameOver();
Types.WINNER win = a_gameState.getGameWinner();
double rawScore = a_gameState.getGameScore();
if(gameOver && win == Types.WINNER.PLAYER_LOSES)
rawScore += HUGE_NEGATIVE;
... |
dab6b25a-0b4f-4868-accb-3f96addc56e9 | 5 | public static void main(String[] args) {
// File whose words are to be counted:
String fileName = "WordCountXML.java";
// Set of unique words in file:
Set<String> uniqueWords = new TreeSet<String>(new TextFile(fileName,
"\\W+"));
// List of all words in file:
... |
51a76c39-f626-4011-99a1-a99f0f73d052 | 4 | public boolean isOptOut() {
synchronized (optOutLock) {
try {
// Reload the metrics file
configuration.load(getConfigFile());
} catch (IOException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.g... |
b22505ee-1ea9-4a0a-b161-8fb60c68e753 | 8 | private void singleOrderProgressButtonActionPerfomed(ActionEvent event) {
if (loggedInEmployee.getOrder() != null) {
if (loggedInEmployee.getOrder().getOrderContent() != null) {
DefaultListModel<OrderContent> ordercontent = loggedInEmployee.getOrder().getOrderContent();
for (int i = 0; i < ordercontent.siz... |
899575d4-c3c5-4e33-97c5-74b12d8fe40f | 3 | @Override
public void update(long currentTime) {
if (hidden) {
return;
}
super.update(currentTime);
for (GUIComponent component : subComponents) {
component.update(currentTime);
}
if (isNewGroupBounds) {
determineGroupBounds();
... |
2565a415-00ad-417e-84a9-f628e4c0fab0 | 3 | public void load() {
this.extractLibs();
this.gson = new Gson();
if (!new File("config.yml").exists()) Config.saveConfig();
Config.loadConfig();
//Servericon
if (new File("server-icon.png").exists()) {
try {
BufferedImage image = ImageIO.read(new File("server-icon.png"));
this.icon = "data:... |
412fd271-82d8-4e7e-81ce-bb687d060f0f | 3 | public void print() {
int count = 0;
for (int i = 0; i < mineField.length; i++) {
System.out.print("(");
for (int j = 0; j < mineField[i].length; j++) {
if (mineField[i][j].hasMine()) {
System.out.print(" T ");
count++;
... |
44e211b2-5400-4d71-ae4a-9d866cb3e4ee | 9 | public static boolean isValueCode(char ch)
{
return ch == '@'
|| ch == ':'
|| ch == '%'
|| ch == '+'
|| ch == '#'
|| ch == '<'
|| ch == '>'
|| ch == '*'
|| ch == '/'
... |
29f3770a-356d-404e-9019-f3c719aeff2e | 8 | public static void main(String[] args) {
String server = "polaris";
int port = 35088;
String user = "ftp";
String pass = "ftp";
if (args != null) {
if (args.length >= 1) {
server = args[0];
}
if (args.length >= 2) {
try {
port = Integer.parseInt(args[1]);
} catch (Exception e) {
... |
f4efdd05-20c7-4fb4-b699-08cd464cf42b | 1 | public static ArrayList<Rectangle2D> getMapSector(Point p) {
if(rectMap.containsKey(p)) {
//System.out.println(p + " " + propMap.containsKey(p));
return rectMap.get(p);
} else {
return new ArrayList<Rectangle2D>();
}
} |
763319a7-f135-47af-b7a6-ecac46243468 | 8 | @Override
public void importRead(String path) {
InputStream is = null;
int start;
int end;
float etx;
float rate;
float mtm;
float ett;
Tools.reevaluateConnections();
try {
is = new FileInputStream(path);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.pri... |
df4abe70-ac66-4f95-9b05-80ee86003424 | 7 | protected void movePiece(HantoCoordinate from, HantoCoordinate to, HantoPieceType pieceType) throws HantoException{
if (!getCurrentPlayer().getPiecesRemaining().contains(pieceType) && from == null){
throw new HantoException("None of those pieces remaining");
}
HantoCell toCell = new HantoCell(to.getX(), to.get... |
a5d15f03-9035-4a49-816d-d3acd3dabc0f | 2 | private void stop() {
if (server == null)
return;
readyToGo = false;
if (taskID != -1)
server.getScheduler().cancelTask(taskID);
server = null;
} |
f857825b-6210-49e9-a71b-51cbe7372374 | 6 | public void move(boolean flagLeft, boolean flagRight){
if(flagLeft && !flagRight){
posX -= speed;
}
if(flagRight && !flagLeft){
posX += speed;
}
if(flagLeft && flagRight){
System.out.println("Whoa there!");
}
} |
9f7e9c74-f1a5-4218-be6a-2e6ee9aa88f4 | 6 | @Override
public void mouseDragged(MouseEvent e) {
final int modifiersEx = e.getModifiersEx();
if ((modifiersEx & MouseEvent.BUTTON2_DOWN_MASK) != 0) {
int dx = WorkingAreaPanel.this.fromMouseX - e.getX();
int dy = WorkingAreaPanel.this.fromMouseY - e.getY... |
8658cb98-3dd1-4a4a-ba69-5aeb48ce055e | 1 | public void setPos3(int val){ if (val == 1){p3 = true;} else { p3 = false; }} |
fc0826ec-2222-4254-850f-b119e7ce357b | 3 | public void addProtection(Armor.Type type, Armor value){
if (protections.containsKey(type)){
int i = MessageControl.showConfirmDialog("¿Estás seguro de cambiar tu armadura?", null, 0, 2);
if (i != 0) return;
}
if (checkWeight(value)) protections.put(type, value);
} |
2b03817a-e56e-4276-955d-de44d7e71af8 | 9 | public static Serializable[] checkAndCorrectMessageArgs(final Object[] messageArgs, final Throwable setCauseOn,
final boolean noExplicitCause) {
Serializable[] retMessageArgs = EMPTY_SERIALIZABLE_ARRAY;
// Set the message args.
if (messageArgs != null && messageArgs.l... |
f387e5bc-6fa7-4ab2-8f8f-620e2c1088b7 | 0 | public int getPaniculata() {
return paniculata;
} |
209fc0dd-85d1-4473-be75-076cec1a5a4a | 9 | static final int method1961(int i, int i_2_, int i_3_) {
anInt2376++;
if ((CacheNode_Sub4.aClass1_9466.anInt110 ^ 0xffffffff) == 0) {
return 1;
}
if ((i_2_ ^ 0xffffffff) != (Class213.aNode_Sub27_2512.aClass320_Sub29_7270.method3791(false) ^ 0xffffffff)) {
Class356.method4024(true, true, Class22.aClass22_3... |
71f96f70-37c3-4875-b27c-d6bf87913d2c | 3 | private void copyPALtoBGRA(ByteBuffer buffer, byte[] curLine) {
if(paletteA != null) {
for(int i=1,n=curLine.length ; i<n ; i+=1) {
int idx = curLine[i] & 255;
byte r = palette[idx*3 + 0];
byte g = palette[idx*3 + 1];
byte b = palette[i... |
4273f107-69c2-4251-bfb5-d636ca1ce2e5 | 8 | public ActionListener mouseListener()
{
return new ActionListener()
{
@Override
public void onAction(String name, boolean isPressed, float tpf)
{
if (isPressed)
if (name.equals(MAP_SELECT))
{
CollisionResults results = new CollisionResults();
Vector2f click2d = inputManager.... |
02836225-8129-40b8-b613-61145b4ccd4d | 4 | @Override
public int hashCode() {
if (frames == null || frames.size() == 0)
return 0;
int result = 1;
for (ZFrame frame : frames)
result = 31 * result + (frame == null ? 0 : frame.hashCode());
return result;
} |
3564cfdb-df72-43b3-8ea9-eefb4f146847 | 1 | public void printFirstNameStr(String enteredFirstName, boolean lineSeparator) {
if (lineSeparator) {
System.out.printf("First name: %s\n", enteredFirstName);
} else {
System.out.printf("First name: %s", enteredFirstName);
}
} |
15ea226d-e38e-437c-afeb-530ed9a0969c | 3 | private void handleKeyEvent(KeyEvent keyEvent) {
switch (keyEvent.getID()) {
case KeyEvent.KEY_TYPED:
handleKeyTypedEvent(keyEvent);
break;
case KeyEvent.KEY_PRESSED:
handleKeyPressedEvent(keyEvent);
break;
case ... |
e272d351-0e8e-41e7-a713-3550fcb98a67 | 6 | public boolean isAdjacent(final int x, final int y){
boolean isAdjacent = false;
if (isCellOccupied(x, y + 1)){
isAdjacent = true;
} else if (isCellOccupied(x + 1, y)){
isAdjacent = true;
} else if (isCellOccupied(x - 1, y)){
isAdjacent = true;
} else if (isCellOccupied(x, y - 1)){
isAdjacent =... |
c7da130d-b140-4b86-91fa-f049eb58827b | 2 | @Override
public boolean login(Funcionario funcionario) {
try {
conn = ConnectionFactory.getConnection();
String sql = "SELECT nome "
+ " FROM funcionario "
+ " WHERE login = ? "
+ " AND senha = ?";
p... |
4d2e8944-7188-4683-adef-61fd2efa2521 | 9 | public static void sort(String[] array) {
if (array == null)
return;
int startIndex = 0;
int endIndex = array.length - 1;
int leftLength = 1;
int leftIndex = 0;
int rightLength = findMaxLength(array);
int rightIndex = endIndex;
int currentIndex = 0;
String temp;
// sort length 1 an... |
38d48f33-f463-48e2-b81e-6ec19f3c70d4 | 4 | public void skip(long pFrames) throws AudioDeviceException {
if ( !(this.mAudio instanceof SeekableAudio) ) {
throw new UnsupportedOperationException( "skipping is not possible on the current AudioFile" );
}
if ( this.mDone || this.mStopped ) {
throw new IllegalStateException( "can't skip if stopped or alre... |
424e95e0-d2ec-4892-8b93-2cc5105e3644 | 3 | public char skipTo(char to) throws JSONException {
char c;
try {
int startIndex = this.index;
int startCharacter = this.character;
int startLine = this.line;
reader.mark(Integer.MAX_VALUE);
do {
c = next();
if (c... |
b4156f80-f2e6-4860-a5d1-82da726d69a1 | 2 | public void setEquipa(Collection<String> equipa, String cod_Competicao) {
try {
Statement stm = conn.createStatement();
for (String p : equipa) {
String sql = "Insert into EquipaCampeonato(cod_equipa,cod_competicao)Values('" + p + "','" + cod_Competicao + "')";
... |
202ac985-b787-4053-bd3e-035cfb6c25ab | 4 | public boolean isPalindrome(Node head){
if(head==null)
return false;
Stack s=new Stack();
Node p=head;
while(p!=null){
s.push(p.data);
p=p.next;
}
p=head;
while(p!=null&!s.isEmpty()){
if(p.data!=s.pop())
return false;
p=p.next;
}
return true;
} |
42dc6e62-e8f5-406f-9673-e9d62cf3d41b | 0 | public void show(AbstractAttributesPanel panel) {
this.panel = panel;
attributeField.setText("");
valueField.setText("");
errorLabel.setText(" ");
attributeField.requestFocus();
Rectangle r = Outliner.outliner.getBounds();
setLocation((int) (r.getCenterX() - getWidth()/2), (int) (r.getCenterY() -... |
45dd897f-6ceb-4441-b54f-46214e338c24 | 5 | public JSONObject increment(String key) throws JSONException {
Object value = this.opt(key);
if (value == null) {
this.put(key, 1);
} else if (value instanceof Integer) {
this.put(key, ((Integer)value).intValue() + 1);
} else if (value instanceof Long) {
... |
5dfe2dae-93f4-419e-9ba7-c9019957ff8c | 8 | private double decodeResize(String token) {
if (token.equals("g") || token.equals("grow")) {
return DEFAULT_GROW;
}
if (token.equals("n") || token.equals("nogrow") || token.equals("none")) {
return NO_GROW;
}
// Must have format: grow(<double>)
if ((token.startsWith("grow(") || token.startsWith("g("))... |
6744994b-7966-4822-99a3-7d7f36dbd0a5 | 1 | private boolean jj_2_6(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_6(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(5, xla); }
} |
3ad2dbce-e56e-474b-afe5-187c2331e8db | 0 | @Override
public void goOnline() {
chatCore.startServer();
} |
a391c2e8-434a-47ee-964a-6881ac4c7f78 | 5 | @Override
public synchronized void serialEvent(SerialPortEvent oEvent)
{
if (oEvent.getEventType() == SerialPortEvent.DATA_AVAILABLE) {
try {
if (input.ready()) {
String inputLine = input.readLine();
this.state.parseInput(inputLine);
for (ArduinoDataEventListener listener : this.listeners) {
... |
63401824-f085-4d7b-ac6a-028bbb9c33f1 | 9 | @Override
public List<String[]> DBRawQuery(String sql) throws CMException
{
DBConnection DBToUse=null;
final List<String[]> results=new LinkedList<String[]>();
try
{
DBToUse=DB.DBFetch();
final ResultSet R=DBToUse.query(sql);
final ResultSetMetaData metaData=R.getMetaData();
if(metaData!=null)
... |
1ef76fac-8250-46a3-8ba1-50fa49448221 | 3 | public void setStorageUnit(StorageUnit storageUnit) {
if (this.storageUnit == storageUnit) return;
if (this.storageUnit != null) {
this.storageUnit.removeTray(this);
}
this.storageUnit = storageUnit;
if (this.storageUnit != null) {
this.storageUnit.addTray(this);
}
} |
166af8a1-4479-4985-a244-496cc353dd15 | 9 | public static void main(String[] args) {
@SuppressWarnings("resource")
Scanner scan = new Scanner(System.in);
String[] header = new String[3];
for (int i = 0; i < header.length; i++) {
header[i] = scan.nextLine();
}
TreeMap<Integer, TreeMap<String, Double>> exam = new TreeMap<>();
while(... |
5d6bcb31-1407-4a26-8161-cd46551a299d | 8 | public void fromJSONObject(JSONObject obj) throws ParseException {
numInitialContestants = ((Number) obj.get(KEY_NUM_CONTEST)).intValue();
// tribes
JSONArray ts = (JSONArray) obj.get(KEY_TRIBES);
setTribeNames((String) ts.get(0), (String) ts.get(1));
// week info:
weeksRem = Utils.numToInt(obj.get(KEY_WE... |
74351dc0-94d3-425c-8de3-84fae9dbbeb8 | 2 | public int jump(int [] A){
int minStep = 0; //当前所需要的步数
int distance =0; //当前步数所能到达的最远距离
int current =0; // 下一步能到达的最远距离
for (int i=0; i< A.length ;i++) {
if(i > distance){
++minStep;
distance = current;
}
current = M... |
2dc14069-94c0-4e34-992c-581ef1b10adb | 9 | private boolean r_verb_suffix() {
int among_var;
int v_1;
int v_2;
int v_3;
// setlimit, line 164
v_1 = limit - cursor;
// tomark, line 164
if (cursor < I_pV)
{
... |
ff08be3d-73f4-42a1-82ea-4d08f4b301d8 | 7 | public static void setWindowResolution(int width, int height){
Globals.windowWidth = width;
Globals.windowHeight = height;
Globals.aspectRatio = (float) Globals.windowWidth / (float) Globals.windowHeight;
Globals.windowMatrix.set(1/Globals.aspectRatio, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
... |
260f28c8-271f-4e31-a9ca-03aee2a88769 | 8 | @Override
protected void menuOpciones() {
printBlankSpace();
System.out.println(OPCIONES);
if (terminal.hasNext(OPCIONES_PATTERN)) {
switch (Integer.parseInt(terminal.nextLine())) {
case 1:
askAndConnect();
break;
... |
82f156dd-2b23-44e8-b610-e039b9de532c | 4 | public WidgetBuy(core.Player p, core.Castle c, core.CastleBuilding b)
{
super();
castle = c;
player = p;
building = b;
setLayout(layout);
//setFrameStyle(1);
//setMinimumHeight(200);
//setMaximumWidth(200);
setSizePolicy(Policy.MinimumExpanding, Policy.Maximum);
layout.addWidget(new QLabel... |
529caa2c-ce5c-40fc-9b45-f06312f075a8 | 5 | @SuppressWarnings({"unchecked"})
public boolean equals(Object o) {
if (o == null) return false;
if (getClass() != o.getClass()) return false;
SinglyLinkedList other = (SinglyLinkedList) o; // use nonparameterized type
if (size != other.size) return false;
Node walkA = head; ... |
90abeb37-7306-49f8-8765-2ca3d5de0078 | 9 | public static Automaton makeDecimalInterval(int min, int max, int digits)
throws IllegalArgumentException {
String x = Integer.toString(min);
String y = Integer.toString(max);
if (min > max || (digits > 0 && y.length() > digits)) {
throw new IllegalArgumentException();
}
int d;
if (d... |
9135457b-f4bc-498d-801c-9ec07334fd18 | 2 | public int numTaken()
{
int unavailableSeat = 0;
for(int index = 0; index < seat.length ; index++)
{
if(seat[index] == true)
{
unavailableSeat += 1;
}
}
return unavailableSeat;
} |
47ea1f9e-cefc-4ef4-92cb-05692c21fd2e | 5 | @RequestMapping(value = "del", method = RequestMethod.POST)
@ResponseBody
public Map del(@RequestParam int[] id) {
Map<String, Object> map = new HashMap<>();
List<String> l1 = new ArrayList<>();
List<String> l2 = new ArrayList<>();
List<String> l3 = new ArrayList<>();
f... |
986d27e7-fd46-4d05-b946-a278c4392d11 | 7 | protected AttrTypes testsPerClassType(int classType, EstTypes estTypes) {
// in none of the estimators yet is the estimation depending on the class type
// since this could change the basic structure taken from checkclassifiers is kept here
// test A: simple test - if can estimate
AttrTypes at... |
89803343-2f88-418c-b79d-1d0f062e31a2 | 2 | public boolean contains(AnyType x)
{
for(AnyType tmp : this)
if(tmp.equals(x)) return true;
return false;
} |
1424f417-88d4-433e-964c-49cb7608d7e1 | 6 | public boolean searchInBlissTree(int findThis)
{
boolean found = false;
TreeNode currentNodeSearch;
TreeNode previousNodeSearch;
currentNodeSearch = rootBliss;
previousNodeSearch = rootBliss;
//while there are nodes in the tree and the node has not been found
... |
e7f7e43e-ee94-4a29-a88e-f04ce66948f4 | 1 | public String moveCardOntoTopRowFromDeck(int boardIndexTo) {
String result = moveCardOntoTopRow(Arrays.asList(deck.peek()), boardIndexTo, 0);
if (result.isEmpty()) {
deck.poll();
}
return result;
} |
ad37d58a-c72d-4e74-b47d-96b89f623d8f | 9 | private boolean noValidMoves(){
int capturedLoc = (getPlayerToMove() - 1) * 25;
if (getCount(capturedLoc) != 0){ //player has a captured piece
if (isValid(capturedLoc) != 0) return false;
if (changeSelectedDie()){
if (isValid(capturedLoc) != 0){
... |
f806f0ae-98b0-4b49-9f6c-5d7de4057708 | 3 | public void run() {
while (true) {
if (hasSeen.size() > 0) {
hasSeen.remove(0);
}
try {
Thread.sleep(time);
} catch (Exception ex) {
}
}
} |
cb5b7f36-ba69-4474-9b05-db6646cfcced | 7 | @Override void sameOwnerCheck() {
int index = 0;
PurchasableCircularList next = nextGroupElement;
while(!next.equals(this)) {
if(next.getOwner() != null && next.getOwner().equals(getOwner())) {
index++;
if(index == INCOME.length - 1) {
break;
}
}
next = next.getNextGroupElement();
}
... |
65ff1ac6-0465-4daa-8fa5-3a01e4699963 | 9 | public static void main(String[] args) {
if (args.length == 0) {
LOG.info(null,
"The tool to calculate amortization plan\n"
+ "Usage: java -jar amortization.jar --duration=[1-60] --amount=[300-80000] --rate=[0.01-100] --openingrate=[0-5] --monthlyrate=[0-5]");... |
388cb289-efb7-4e92-836f-979114c9a469 | 2 | public void persistVendor(Vendor vendor) {
String sqlStatement; // SQL statement to persist the student
// could pass a student object in as parameter to this method
dao.connect();
sqlStatement = generateInsertStmt(vendor);
if(dao.getErrorLogs().getErrorMsgs().size() == 0){
dao.executeUpdate(sqlStateme... |
f1d6eb83-5e8f-4b5e-b274-aba979b96c10 | 4 | private String createAccount(String name, String instanceUrl,
String accessToken, PrintWriter writer) throws ServletException,
IOException {
String accountId = null;
HttpClient httpclient = new HttpClient();
JSONObject account = new JSONObject();
try {
... |
40d9b9d3-94ff-4c3a-a15c-f910180643e0 | 6 | @SuppressWarnings("deprecation")
@EventHandler
public void handleItemSale(InventoryClickEvent event) {
if (event.getClick() == ClickType.RIGHT) {
Player player = (Player) event.getWhoClicked();
Inventory inventory = event.getInventory();
Cuboid cuboid = Cuboid.getCuboid(player.getLocation());
if... |
7fd89ad4-2083-4d32-a13c-3e9312e260fb | 8 | public static void do511Fits(int start, int stop){
DataHolder data = CDF_Gen.data;
int length = stop - start;
int max_cnts = MAX_CNT_FACTOR * length;
if(length < 2){return;}
DescriptiveStatistics stats = new DescriptiveStatistics();
float peak;
double max_bin, min_b... |
6da9f4ee-a9f2-4504-8390-5d0556bafa0d | 1 | public int hashCode() {
return type == null ? 0 : type.hashCode();
} |
ff87b194-abe5-438c-a013-7937d5474248 | 9 | private String currentCategory() {
if (places[currentPlayer] == 0) return "Pop";
if (places[currentPlayer] == 4) return "Pop";
if (places[currentPlayer] == 8) return "Pop";
if (places[currentPlayer] == 1) return "Science";
if (places[currentPlayer] == 5) return "Science";
... |
d1e829db-849c-441a-a19d-cf60d2bf60d5 | 5 | @SuppressWarnings("unchecked")
public static <E> E[][] powerSet(E[] set) {
if (set == null)
return null;
int setLength = set.length;
Class<?> setClass = set.getClass().getComponentType();
E[][] sets = (E[][]) Array.newInstance(set.getClass(), 1 << setLength);
sets[0] = (E[]) Array.newInstance(setClass... |
57489ed4-5859-4c56-ab78-73c48e5553fb | 0 | @Override
public void changedMostRecentDocumentTouched(DocumentRepositoryEvent e) {
calculateEnabledState(e.getDocument());
} |
e7d3d0d1-f2cb-40eb-8c0b-1105986f8526 | 8 | private int applySortConfigInternal(String config) {
int result = -1;
if (config != null && config.startsWith("S")) { //$NON-NLS-1$
try {
StringTokenizer tokenizer = new StringTokenizer(config, "\t"); //$NON-NLS-1$
if (Numbers.getInteger(tokenizer.nextToken().substring(1), 0) == CONFIG_VERSION) {
in... |
16d81be9-8e9e-4312-94f4-2bda3a7bfc99 | 3 | private void newAttachmentButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newAttachmentButtonActionPerformed
JFileChooser filechooser = new JFileChooser();
filechooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
int result = filechooser.showOpenDialog(null);
... |
6fcaa5e6-c4a7-4843-b1b3-20b5742be47c | 9 | public Widget createWidget(Composite parent, int style)
{
String tooltip = getTooltip();
GridData controlGD = new GridData( SWT.FILL, SWT.FILL, false, false );
// label
if ( control.getLabel() != null ) {
label = new Label( parent, SWT.NONE );
label.setText( control.getLabel() );
if ( tooltip != nu... |
f94e1161-570a-4794-94ef-eaecd831ba6d | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Empleado)) {
return false;
}
Empleado other = (Empleado) object;
if ((this.idEmpleado == null && other.idEmplea... |
c1081d9f-0a79-4751-938d-4c5fa9f23539 | 3 | @Test
public void cTest2() {
userInput.add("hi");
userInput.add("my name is meng meng");
userInput.add("cavideria");
userInput.add("i meant the first");
this.runMainActivityWithTestInput(userInput);
assertTrue((nlgResults.get(2).contains("cavideria") || nlgResults.get(2).contains("cafeteria"))
&&... |
4504a3c7-51ce-423d-b54e-e933f3b9af9d | 5 | public void tokenise() {
try {
file = readFile(fileLocation);
} catch (IOException e) {
e.printStackTrace();
}
file = file.replaceAll("\\s", "");
tokens.clear();
while (!file.equals("")) {
boolean match = false;
for (To... |
97bbeb89-67eb-4667-9de6-df0e3e10b1e2 | 4 | public TreeMap<Double,DatasetObject> retrieve(TreeMap<Integer,Double> identifiers, int k)
{
java.util.Iterator s=identifiers.entrySet().iterator();
TreeMap res=null;
if(dataset!=null)
{
res=new TreeMap();
while(s.hasNext()&& k>0)
{
... |
607db786-6204-455a-a095-33a9d3255bfb | 7 | public boolean processing(OutputStream out, InputStream in,int operation){
try{
BufferedReader bf = new BufferedReader(new InputStreamReader(in));
PrintWriter toClient= new PrintWriter(out,true);
toClient.println("Hello,Dude!\n" +
"Choose one menu item and send me number of this operation:\n" +
"1 ... |
772a05f5-bf2a-46df-b5a5-405531962b8f | 0 | public Object getValueAt(int rowIndex, int columnIndex) {
// TODO Auto-generated method stub
return null;
} |
8fc3f02f-f040-48cf-b770-fc1debc98f29 | 2 | public Opcional buscarOpcional(String nome) {
for (PecaOpcional o : opcionais) {
if (o.getOpcional().getNome().compareToIgnoreCase(nome) == 0) {
return o.getOpcional();
}
}
return null;
} |
5bc592b4-efa3-4596-af88-58a761dea837 | 1 | @SuppressWarnings("deprecation")
public void testConstructor_RP_RP4() throws Throwable {
YearMonthDay dt1 = new YearMonthDay(2005, 7, 17);
YearMonthDay dt2 = null;
try {
new Period(dt1, dt2);
fail();
} catch (IllegalArgumentException ex) {}
} |
ba300dca-9b60-4fb8-a0e9-61aaaca8b6aa | 5 | @Override
public boolean equals(Object obj)
{ if(obj instanceof Element)
{ Element that=(Element)obj;
if(this.i!=that.i||
this.j!=that.j||
!this.a.equals(that.a)||
!this.b.equals(that.b)
)
{ return false;
}
else
{ return true;
}
}
e... |
ed9c84da-9425-42da-9a5d-5ce773d0067e | 3 | public AnchorPane topRight() {
Rectangle rectangle = new Rectangle();
rectangle.autosize();
rectangle.setWidth(240);
rectangle.setHeight(240);
rectangle.setFill(Paint.valueOf(Color.WHITE.toString()));
rectangle.setStroke(Paint.valueOf(Color.GRAY.toString()));
rect... |
4e5a7dc9-9239-460a-a55e-1cb258341ee5 | 9 | public List<Location> adjacentLocations(Location location)
{
assert location != null : "Null location passed to adjacentLocations";
// The list of locations to be returned.
List<Location> locations = new LinkedList<Location>();
if(location != null) {
int row = location.ge... |
5cd0d7fe-ffa1-4755-8edb-907d1a79a73f | 8 | public void deal() {
if (players.size() == 0)
return;
List<Card> deck = new LinkedList<Card>(cards); // duplicate the cards list for dealing
Collections.shuffle(deck);
Card person = null;
Card weapon = null;
Card room = null;
int i = 0;
while (deck.size() > 0) {
Card card = deck.remove(0); //... |
b21485c4-c83a-4b8e-b652-22d4485a9d5b | 6 | public void delete(Key key) {
if (isEmpty()) return;
// compute rank
int i = rank(key);
// key not in table
if (i == N || keys[i].compareTo(key) != 0) {
return;
}
for (int j = i; j < N-1; j++) {
keys[j] = keys[j+1];
vals[j]... |
c73041e1-b342-4218-bead-e7a071fb4cb5 | 3 | void addModifier(char c) {
switch (c) {
case '=':
case '^':
if (value != 0)
generateNote();
break;
default:
}
modifiers.append(c);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.