method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
0ce9dd13-f1b1-4c4a-9f83-8b5e30339c84 | 2 | public void startServer(String serverPort) {
int port = 8080;
if (!serverPort.isEmpty()) {
port = Integer.parseInt(serverPort);
}
try {
sleep(100);
socket = new ServerSocket(port);
} catch (Exception e) {
// TODO Автоматически созданный блок catch
e.printStackTrace();
}
serverIsRaning = tr... |
31d5db76-0be3-4075-880c-c874b5e77ab8 | 8 | private void btonaceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btonaceptarActionPerformed
//yyyy-MM-dd HH:mm:ss
java.util.Date fecha = new Date();
String fecreg1 = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(fecha);
fecreg1 = (PROCE.fechasys(fecreg1));... |
18868ec5-e1f2-4111-95ce-df5fc1e6bee2 | 5 | public static Map<String, UIObject> parsePageUIObjects(String pageName) {
String objectFile = ConfigReader.getInstance().getObjectsFile();
Map<String, UIObject> pageUIObjectsMap = new HashMap<String, UIObject>();
try {
File fXmlFile = new File(objectFile); //TODO : read from class path
DocumentBuilderF... |
7a715c4b-778c-4aae-97bb-19c8196dc1ce | 8 | @EventHandler(priority = EventPriority.NORMAL)
public void onBlockDestroy(final BlockBreakEvent event)
{
if (event.isCancelled() || event.getPlayer() == null
|| event.getBlock() == null)
{
return;
}
final Player player = event.getPlayer();
// Check for ignore permission node
if (plugin.getPermissio... |
23a7fd72-b896-4339-b391-5959017e1652 | 1 | public void nextImage() {
if (historyIndex >= history.size() - 1) {
textArea.append("No images left!\n");
} else {
historyIndex++;
imagePanel.updatePanel(history.get(historyIndex));
imagePanel.update(imagePanel.getGraphics());
}
} |
4c7bd539-c4d7-48d1-b484-5037877f7e15 | 0 | public FSAConfiguration(State state, FSAConfiguration parent, String input,
String unprocessed) {
super(state, parent);
myInput = input;
myUnprocessedInput = unprocessed;
} |
39aeefe3-9ef3-4d15-9c91-3e9c9871fd0c | 4 | * @return Returns the edge that has been flipped.
*/
public Object flipEdge(Object edge)
{
if (edge != null && alternateEdgeStyle != null)
{
model.beginUpdate();
try
{
String style = model.getStyle(edge);
if (style == null || style.length() == 0)
{
model.setStyle(edge, alternateEdgeSt... |
1a18d650-a3b3-40eb-996c-aa59c5757d8b | 6 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Pair)) return false;
Pair pair = (Pair) o;
if (a != null ? !a.equals(pair.a) : pair.a != null) return false;
if (b != null ? !b.equals(pair.b) : pair.b != null) return false;
return true;
} |
a3739b3e-6782-4555-a450-0e2747184d84 | 2 | public Object read(ByteReader reader)
{
Object output = null;
try {
InputStream is = new ByteReaderStream(reader);
ObjectInputStream ois = new ObjectInputStream(is);
output = ois.readObject();
}
catch (RuntimeException e) {
throw e;
}
catch (Exception e) {
throw new RuntimeException( e );
... |
404f6866-1a46-410d-87e5-d2ac846b941d | 5 | private String scanBlockScalarBreaks (int indent) {
StringBuilder chunks = new StringBuilder();
while (column < indent && peek() == ' ')
forward();
while (FULL_LINEBR.indexOf(peek()) != -1) {
chunks.append(scanLineBreak());
while (column < indent && peek() == ' ')
forward();
}
return chunks.toStr... |
04529597-fd21-410d-89de-dbb84290e426 | 2 | public void valorarSerie(String idUsuario, String idSerie, float puntuacion) throws Exception{
if (puntuacion < 0 || puntuacion > 10){
throw new Exception("Puntuación no válida.");
}
Serie serie = buscarSerie(idSerie);
UsuarioRegistrado usuario = buscarUsuario(idUsuario);
... |
aea39b21-9c83-4e98-be3f-e7d6312f847b | 1 | private static boolean canRemove(int patientID) {
boolean canRemove = false;
Models.DatabaseModel.Bill bill = new Models.DatabaseModel.Bill();
ArrayList<Models.DatabaseModel.Bill> patientOutstandingBills = bill.findUserOutstandingBill(patientID);
if (!patientOutstandingBills.isEmpty())... |
c8ec8827-0c49-462a-8cce-bf651bb364e1 | 3 | public void generateRandoms()
{
// Number of stations Zone #2
n = new Random().nextInt(10) + 1;
// Number of stations Zone #3
m = new Random().nextInt(10) + 1;
XtoZoneOne = new int[m]; // Ui (1 < i < m)
ZoneTwotoZoneThree = new int[m][n]; //Bij
ZoneThreetoY = new int[n];
for(int i = 0; i < m; i++)... |
46cd1512-4e96-47c9-a816-fd5fa69b1c15 | 5 | private void initLineWriter() {
lineWriter = new Thread() {
public void run() {
byte[] data = new byte[1024];
try {
while(!killThread) {
if(playing) {
if(ais.available() > 0) {
ais.read(data);
soundLine.write(data, 0, data.length);
}
else if(repeating) {
... |
6fcbb19b-a61a-492f-b1a3-d6d52a9dac75 | 4 | public ConnectToDatabase()
{
p = new Properties();
(new File(ResourceLoader.dir)).mkdirs();
if (new File(ResourceLoader.dir+"login.xyz").exists())
{
try {
p.load(new FileInputStream(new File(ResourceLoader.dir+"login.xyz")));
} catc... |
51de4dfc-aa77-4391-97f5-847299faeec2 | 5 | private boolean etsiRuutuJaLiiku(Robotti robo, int i, int suunta) {
for (int j = 0; j < i; j++) {
Set<Ruutu>ruudut= new HashSet<>();
ruudut.add(robo.getRuutu());
Ruutu seuraava=lauta.seuraavaRuutu(robo.getRuutu(), suunta);
ruudut.add(seuraava);
if (... |
ce7ed50f-2d97-49f7-820b-4d1570471aed | 7 | @Override
public String toString() {
if (etat == Etat.vide) {
return "0";
}
if (etat == Etat.jeunePousse) {
return "1";
}
if (etat == Etat.arbuste) {
return "2";
}
if (etat == Etat.arbre) {
return "3";
}
... |
a7cf4aa5-8d73-45a9-8c87-8f9244baaf08 | 6 | @Override
public double[] computeValue(final char refBase, FastaWindow window, AlignmentColumn col) {
value[0] = 0;
double counted = 0;
if (col.getDepth() > 0) {
Iterator<MappedRead> it = col.getIterator();
while(it.hasNext()) {
MappedRead read = it.next();
if (read.hasBaseAtReferencePos(col.... |
e5916845-bb0a-4ef1-afd4-73068ca2defa | 7 | public void updateUserInfo(UserInfo user) throws Exception {
Connection conn = null;
// get connection from data source
try {
conn = datasource.getConnection();
} catch (SQLException e) {
throw new RuntimeException("Could not get JDBC Connection", e);
}
... |
06bfae73-9411-45ff-a1b6-2316d5f0342f | 9 | public Object[][] getCells() {
int i;
int n;
Vector<Object[]> result;
Object[] row;
int rowCount;
boolean proceed;
initialize();
result = new Vector<Object[]>();
try {
// do know the number of rows?
rowCount = getRowCount();
if (rowCount == -1)... |
ede4be91-d3b2-4e36-a5ec-552de65b642a | 6 | public boolean saveProdutos( Produtos produtos ){
this.getConectaBanco();
try {
if (this.getConn() != null || !this.getConn().isClosed()) {
this.getConn().setAutoCommit(false);
this.setStmt(this.getBuscaProdutos());
this.getStmt().setInt(1, produtos.getIdProduto());
this.s... |
037e4d2e-9586-4040-a45d-b9fa53e72bc3 | 8 | private void parseDayWordDetails(int i, String checkWord) {
int firstOccurance = 0;
for (int j=i-1; j>=0; j--) {
if (parts[j].equals("next") || parts[j].equals("following") ) {
isCommandDetails[j] = false;
} else {
firstOccurance = j+1;
break;
}
}
if (firstOccurance!=i) {
isCommandDetail... |
71b6a462-8258-4cfe-9e4a-71da0a5dda03 | 3 | public static boolean setNumTeams(int n)
{
if ((n >= 1) && (n <= players.length))
{
teams = new Team[n];
//initializing the teams
for (int i = 0; i < n; i++)
{
teams[i] = new Team();
}
return true;
}
else
return false;
} |
b38ea46f-9a31-4aea-8755-214d2a7e4537 | 0 | @Override
public void buildSauce() { pizza.setSauce("mild"); } |
8077babd-ced8-4a6c-8285-567be0df4d1b | 2 | public void setMsgLabel(String txt) {
if (t == null || !t.isRunning()) {
resetColor();
msgLabel.setText(txt);
}
} |
672125ae-261c-4ccc-b72b-c59627ecd079 | 2 | @Test
public void test() throws InterruptedException {
for (int i = 0; i < 100; i++) {
for (ChildData data : PathCacheFactory.getBabyDuncanPathData()) {
System.out.println(data.getPath() + " = " + new String(data.getData()));
}
Thread.sleep(1000);
... |
1f026ea3-effb-409c-bfdc-6697056b4c74 | 3 | public static void selectInverse(Node currentNode, JoeTree tree, OutlineLayoutManager layout) {
// select all siblings
Node parent = currentNode.getParent();
for (int i = 0, limit = parent.numOfChildren(); i < limit; i++) {
Node child = parent.getChild(i);
if (child.isSelected()) {
tree.removeNod... |
9a0db19a-8bfd-465f-9576-e3eface1d6ed | 8 | public void Move(int dir)
{
switch(dir)
{
case 0:
if(cube.getLoc()%4 != 0)
{
cube.Left();
}
break;
case 1:
if(cube.getLoc()%4 != 3)
{
cube.Right();
}
break;
case 2:
if(cube.getLoc() > 3)
{
cube.Down();
}
break;
case 3:
if(cube.getLoc() < 12)
{
cube.Up(... |
bd1758de-29b6-4564-8951-cac90df485de | 3 | static void testJogger()
{
Scanner in = new Scanner(System.in);
Board b = Board.readBoard(in);
ArrayList<Integer> nextPiece = new ArrayList<Integer>();
while(in.hasNextInt())
nextPiece.add(in.nextInt());
Searcher s;
for (int i = 2; i <7; i++){
for(int j= 1; j < i; j++){
s = new Jogger(new Line... |
39e7a0c8-ed09-47ce-b955-bf49d86717a4 | 5 | @Override
public boolean equals(Object other){
if (other == null) return false;
if (other == this) return true;
if (!(other instanceof PairInt))return false;
PairInt otherMyClass = (PairInt)other;
if (otherMyClass.x.equals(this.x) && otherMyClass.y.equals(this.y))
{
return tru... |
def5eb10-5642-4926-8240-cfaff87fda04 | 4 | public void recibirConnection(String updateId, int precio, long id, long adyacente) {
if (!updateIdsList.find(updateId)) {
updateIdsList.append(updateId);
if (id == this.id)
for (int i = 0; i < connections.getLength(); i++) {
Connection connection = co... |
5392255d-5c6c-48bc-87bd-b74c9a8ebdd5 | 7 | public byte[] extract() {
List<Byte> bitData = new ArrayList<Byte>();
// 获得Y的colorid
Integer colorid = (Integer) mImg.getColorIDs().toArray()[0];
// 获得Y的color unit
JPEGDataUnits dataUnits = mImg.getDataUnits();
List<int[]> YUnits = dataUnits.getColorUnit(colorid);
... |
2474b109-a000-4c60-8255-0a6f61d21c31 | 2 | private void siftDown(int pos) {
if (2 * pos >= size) return;
int maxI = getMaxInd(2 * pos, 2 * pos + 1);
if (heap.get(maxI).compareTo(heap.get(pos)) > 0) {
swap(pos, maxI);
siftDown(maxI);
}
} |
a09e7bc8-0437-4673-a542-77cfd2fd1632 | 6 | public ArrayList<String> recListaAmigos(String nick) {//ok
//verificar logueo
ArrayList<String> amigos;
amigos = new ArrayList<String> ();
System.out.println(nick);
try {
String queryString = "select nick2 from serAmigos where nick1=?";
connection = getConnec... |
87b8bd7d-35cd-44c4-8e71-38e2254cc659 | 3 | public boolean saveSign(Location signLoc, int doorID){
int i=1;
while(signConfig.get("signs." + i)!=null){
if(signConfig.get("signs." + i + ".DoorID")!=null){
i++;
}else{
break;
}
}
signConfig.set("signs." + i + ".DoorID", doorID);
signConfig.set("signs." + i + ".location.world", sig... |
b7bdcb30-ee70-4f7d-93e7-7ed721914198 | 7 | @Override
public ArrayList<Locations> getPath(Locations begin, Locations end) {
int startRow = begin.getRow();
int startColumn = begin.getColumn();
int endRow = end.getRow();
int endColumn = end.getColumn();
ArrayList<Locations> list = new ArrayList<Locations>();
i... |
297eb918-228f-460c-a378-1251d23eea30 | 2 | private void signalEditorDelSignal() {
if(se_signal.getSelectionIndex() == -1) return;
if(signals == null) signals = new SignalBundle();
Contact contact = new Contact(se_signal.getText());
signals.getSignals().remove(contact);
signalEditorSelectionChanged();
... |
2e45a199-912d-4279-a83a-e810bebdc3f2 | 0 | public static void main(String[] args) {
// TODO code application logic here
Menu menu = new Menu();
menu.setVisible(true);
} |
b47d8a81-01df-4e16-b2f1-dae82e1ef8f5 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final CreateObjectRequest other = (CreateObjectRequest) obj;
if (listOfInitialValues ... |
240ad927-4c6a-4df9-adc8-c3c99e9ca95e | 8 | public Registration readClass (Input input) {
int classID = input.readInt(true);
switch (classID) {
case Kryo.NULL:
if (TRACE || (DEBUG && kryo.getDepth() == 1)) log("Read", null);
return null;
case NAME + 2: // Offset for NAME and NULL.
return readName(input);
}
if (classID == memoizedClassId) ret... |
d5b81b89-94cb-44f7-8282-31897bde13c4 | 9 | public int pit2(Block set, Material m, BlockFace bf)
{
int x = 1;
int a = gen.nextInt(30);
if (a < 12) {
a = 12;
}
while (x < a) {
int newx = x - 1;
Block otherset = set.getRelative(bf, newx);
Block clr10 = otherset.getRelative(BlockFace.DOWN, 1);
Block clr20 = others... |
849d19a6-d956-4529-8ab8-9b3b6070c5e9 | 3 | public synchronized static void deleteBlob(String fullPath) {
String blobName = FileFunctions.getRelativePath(fullPath);
if (blobName.contains("\\")) {
blobName = blobName.replace("\\", "/");
}
System.out.println("Blob is " + blobName);
try {
CloudStorageAccount storageAccount = CloudStorageAccount
... |
782fb75f-c2e1-4214-a5a6-2fbe1d012a60 | 2 | public String stringApiValue() {
StringBuffer buf = new StringBuffer(bytes.length*4);
buf.append( "(read-from-string \"#(");
for (int i = 0; i < bytes.length; i++) {
buf.append( ' ');
int value = bytes[i];
if (value < 0) {
value += 256;
}
buf.append( v... |
7901d4c0-adaf-49ee-abb6-7a5f5d1a4c24 | 2 | public String toString(){
String ss = "";
ss = ss + this.coeffCopy(0).toString();
if(this.deg>0)ss = ss + " + (" + this.coeffCopy(1).toString() + ").x";
for(int i=2; i<=this.deg; i++){
ss = ss + " + (" + this.coeffCopy(i).toString() + ... |
2e750863-330d-4697-b78c-ad11d1ebb09d | 2 | public void setBtn_Std_Font(String font) {
if ((font == null) || font.equals("")) {
this.buttonStdFont = UIFontInits.STDBUTTON.getFont();
} else {
this.buttonStdFont = font;
}
somethingChanged();
} |
1107dd25-1b4b-4ccb-ba1d-7d5d176553c0 | 2 | private static boolean isSpatialMaxima(double[][] hmap, int x, int y) {
int n = 8;
int[] dx = new int[] { -1, 0, 1, 1, 1, 0, -1, -1 };
int[] dy = new int[] { -1, -1, -1, 0, 1, 1, 1, 0 };
double w = hmap[x][y];
for (int i = 0; i < n; i++) {
double wk = hmap[x + dx[i]][y + dy[i]];
if (wk >= w)
return ... |
734c6f73-b456-4aac-a007-0e778ce54839 | 9 | public static short getAgeClass1(int age) {
if (age < 16) {
return 0;
}
if (age < 20) {
return 16;
}
if (age < 25) {
return 20;
}
if (age < 30) {
return 25;
}
if (age < 45) {
return 30;
... |
16841e19-e6a1-430b-bbce-ea052c2765e9 | 5 | private final short method683(int i, int i_97_, long l, int i_98_,
Model class124, int i_99_, float f,
int i_100_, int i_101_, float f_102_) {
try {
anInt5599++;
int i_103_ = anIntArray5528[i_101_];
int i_104_ = anIntArray5528[1 + i_101_];
int i_105_ = i_100_;
for (int i_106_ = i_1... |
c7c3c0dd-d658-44fb-80e1-ebc25134afa7 | 0 | @Override
public void start(Stage stage) throws Exception {
AnchorPane main = FXMLLoader.load(PosApplication.class.getResource("main.fxml"));
stage.setTitle("みせっこくちない専用POSシステム");
stage.setScene(new Scene(main, 800, 600));
stage.show();
} |
5d4ecbb1-4957-4624-8d3c-7200eb75448b | 2 | public void paintComponent(Graphics g) {
if (getCreator().automaton.getEnvironmentFrame() !=null)
if (!((AutomatonEnvironment)(getCreator().automaton.getEnvironmentFrame().getEnvironment())).shouldPaint())
return;
// EDebug.print(Thread.currentThread().getName());
super.paintComponent(g);
toolbar.drawTool(... |
9566e273-6fa4-40bb-8cc3-273662601775 | 0 | public void setProtocol(FileProtocol protocol) {
this.protocol = protocol;
setText(protocol.getName());
} |
8492c772-6098-4453-bcb2-e23991d8169a | 8 | public FieldPanel(DataStore datastore) {
super();
addComponentListener(new ComponentAdapter() {
@Override
public void componentShown(ComponentEvent e) {
fields = ds.getFields();
classtypes = ds.getTypes();
}
@Override
public void componentHidden(ComponentEvent e) {
ds.setFields(field... |
ecc52266-8555-49b5-a192-239f3d3432e7 | 5 | private List<String> cleanOfNotPossibleKeywords(List<String> possibleKeywords) {
LinkedList<String> result = new LinkedList<String>();
LinkedList<String> finalResult = new LinkedList<String>();
for(int i = 0; i < possibleKeywords.size(); i++) {
if(possibleKeywords.get(i).matches(".*;.*;[0-9]+... |
9a7d685e-d298-4fe2-99d3-46b0023e0af9 | 7 | private void processKilnExchange(int componentId, int packetId) {
int itemId = StealingCreation.SACRED_CLAY[index];
int amount = 0;
if (packetId == WorldPacketsDecoder.ACTION_BUTTON1_PACKET)
amount = 1;
else if (packetId == WorldPacketsDecoder.ACTION_BUTTON2_PACKET)
amount = 5;
else if (packetId == Worl... |
0591493b-286f-46a7-b1a0-bcd876879c32 | 5 | public Vector<Card> whichCardsShouldISwap() {
/** Here we calculate the possible difference in rank for swapping
* 1,2 or 3 cards. The double returns the effect on rank of the current
* hand for making the specified number of changes
*/
if (current... |
22e53b01-246c-4620-9893-a13d6472169a | 2 | private void showMessage(String typeMessage, String text, String title){
if(typeMessage.equals("error")){
JOptionPane.showMessageDialog(this, text, title,JOptionPane.ERROR_MESSAGE);
}
if(typeMessage.equals("info")){
JOptionPane.showMessageDialog(this, text, title,JOptionP... |
84aece37-3d81-4f62-b0fd-070fb457fa8f | 4 | public void mouseReleased(MouseEvent e)
{
mouseReleasedX = e.getX();
if(mouseDragged)
{
mousePressed = mousePressedX;
mouseReleased = mouseReleasedX;
if (mousePressed > mouseReleased)//selected right to left
{
int temp = mousePressed;
mousePressed... |
d515a967-326b-44a3-8be7-53d47faeb060 | 2 | public void dbConnect(String db_connect_string,
String db_userid,
String db_password) {
try {
Class.forName("net.sourceforge.jtds.jdbc.Driver");
Connection conn = DriverManager.getConnection(db_connect_string, db_userid, db_password);
System.out.printl... |
86b2bb5f-2ef4-4b3b-94f8-0f0d92a8b795 | 2 | public static void main(String[] args) {
Image[] input = {new IR(), new IR(), new LS(), new IR(), new LS(), new LS()};
Processor[] procs = {new Processor(), new Processor(), new Processor()};
for (int i = 0, j; i < input.length; ++i) {
j = 0;
while (!procs[j].handle(input... |
d82b2d52-ca13-4089-b610-ecc857378d3f | 9 | public void connect(TreeLinkNode root) {
if(root==null) {
return;
}
if(root.left != null && root.right !=null) {
root.left.next = root.right;
}
if(root.next!=null) {
TreeLinkNode left, right=null;
left = root.right==null?root.left... |
78a4350a-6ad9-46a3-8380-3801c98efce5 | 9 | public void update(final Protocol update)
{
switch(update.command) {
case USERSINROOM:
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
String room = update.textField;
synchronized(messagePane) {
int tabIndex = messagePane.indexOfTab(room);
if (tabIndex != ... |
d46f4567-75ae-4ac5-9bd8-7a1be5c8a27b | 4 | public InformationLine(String[] line, Headline headline) throws EndOfCSVFileException, BrokenCSVFileException {
if (line == null) {
throw new EndOfCSVFileException("CSV File completely parsed");
}
if (headline == null) {
throw new BrokenCSVFileException("The given headline was null");
}
if (line.leng... |
8bde95af-13ca-4f10-a81b-03d99ce4c40f | 3 | @Override
public void manageInput(InputEvent e) {
if (e.isKeyInput()) {
if (e.getKeyCode() == KeyEvent.VK_ESCAPE)
Launcher.exit();
}
for (Item m : menuItems) {
m.manageInput(e);
}
} |
361afaa6-6222-411b-94c6-d4a176c43794 | 3 | public void setAvalie(PExp node)
{
if(this._avalie_ != null)
{
this._avalie_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
... |
ece6d209-623a-4ad9-85e9-d4f549092244 | 3 | public void close() {
try {
if (read != null)
read.close();
if (write != null)
write.close();
} catch (IOException e) {
e.printStackTrace();
}
} |
aec7e8c4-864c-452a-9d86-91f4853166ac | 1 | @Test
public void testGenerate() {
byte[] key = ByteHelper.convertBinaryStringToByteArray("00010011 00110100 01010111 01111001 10011011 10111100 11011111 11110001".replace(" ", ""));
String[] expectedSubKeysStrings = new String[] {
"000110 110000 001011 101111 111111 000111 000001 ... |
365e4e15-754b-4770-98d5-55683f687ce7 | 3 | @Override
public void allocate(JobMetaData job) {
if (job.getNumFiles() < CUTOFF) {
// We dont split so just use the regular allocator
IAllocator onejob = new JobPerVMAllocator(pool, monitor);
onejob.allocate(job);
} else {
int vmsneeded = 3;
ArrayList<SlaveVM> vms = pool.requestVMs(vmsneeded);
A... |
4803f332-0520-49e3-b496-0e895ffad6bd | 8 | public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new FileReader("stamps.in"));
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("stamps.out")));
int n, k;
int[] coins;
StringTokenizer st = new StringTokenizer(f.readLine());
k = Integer.pars... |
bb5aa106-8838-4d75-a1c5-ed527bc82b2f | 2 | public void damage(int amt) {
if (health > MAX_HEALTH)
health = MAX_HEALTH;
health -= amt;
System.out.println(health);
if (health <= 0) {
MainComponent.isRunning = false;
System.out.println("GAME OVER!");
}
} |
e06ff09f-2ae1-4b32-a022-c3f76c99fa88 | 3 | public void physics( PhysicObject object, float delta )
{
PhysicalProperties properties = object.getPhysicalProperties();
if ( properties.getFloat( "gravity" ) != 0 )
{
float gravity = (float) Math.sqrt( ( 2 * properties.getFloat( "mass" ) * NEWTON ) / ( AIR_DENSITY * properties.getFloat( "surface" ) * prope... |
0d20cfe9-574f-4502-bac2-4dd20aa77887 | 5 | private void changeTrack(int x){
int tempBid=(x-10)/70;
System.out.println("Dans ChangeTrack : temp ="+tempBid);
if(selectedBid==tempBid){//cancel the selected bid
selectedBid=-1;
}else if(selectedBid==-1 && tempBid<bidding.getTrack().length){ //select a family
selectedBid=tempBid;
}else if(tempBid<bidd... |
0eedb17c-1f3b-4e35-aa46-d506521aaca7 | 0 | public Set keySet() {
return map.keySet();
}//keySet |
1b250fce-a127-49b6-b9a0-2854a97f519a | 8 | private long readNumber ( int db, int l )
{
long r = 0, b = 1;
int q=0;
RandomAccessFile f = ( db==0 ? fdbf : db==1 ? ffpt : fcdx );
byte[] g = new byte[l];
try { f.read(g); }
catch (IOException e) { e.printStackTrace(); }
if(db>0 && l>1) b<<=((l-1)<<3);
for(int i=0;i<l;i++)
{
q = g[i]; if(q<0... |
138b701a-17d0-475e-89f1-1fbfad9f7443 | 9 | private DisplayMode findDisplayModeInternal(DisplayMode[] displayModes, int requestedWidth, int requestedHeight, int requestedDepth, int requestedRefreshRate) {
DisplayMode displayModeToUse = null;
for (int i = 0; i < displayModes.length; i++) {
DisplayMode displayMode = displayModes[i];
... |
ae0fef17-406d-4ba5-ad95-55eb4e459b89 | 2 | public static void sumNegativeBalances() {
// External iteration
BigInteger total = BigInteger.ZERO;
for (BankAccount account: christmasBank.getAllAccounts())
if (account.getBalance().signum() < 0)
total = total.add(account.getBalance());
System.out.println("T... |
59d88d51-20b8-45cc-8965-abdb6b101cab | 6 | public static void main(String[] args) {
if(args.length == 0) {
System.err.println("No command input");
System.exit(1);
}
HashMap<String, String> cmd;
try {
//SETUP PHASE
MFESetup setup= new MFESetup();
cmd= setup.getCommands();
if(cmd.isEmpty()) {
System.err.println("No command... |
1d816cd9-ff70-4491-9fc6-d162a4339c6b | 7 | private void startCut()
{
btnPause17.setEnabled(true);
btnFinish18.setEnabled(true);
try
{
txtStartTime17.setText(jodaTimeFormat.print(startTime));
startTime = jodaTimeFormat.parseDateTime(txtStartTime17.getText());
GregorianC... |
822b9352-09f2-4dd3-9b03-301f04f5f21c | 1 | private void toggleShowOutPut() {
this.showOutput = !this.showOutput;
if (this.showOutput) {
this.panel_1.add(txtrResultats);
this.lblConsole.setText("vvv Console :");
}
else {
this.panel_1.remove(txtrResultats);
this.lblConsole.setText(">>> Console :");
}
} |
cfd21e52-8c66-4679-9774-de86193a7e37 | 3 | private void makeDirs(final String key) throws IOException {
if (dirs == null) {
dirs = new HashSet();
}
int idx = 0;
int last = 0;
while ((last = key.indexOf('/', idx + 1)) != -1) {
final String aDir = key.substring(0, last + 1);
if (!dirs.contains(aDir)) {
dirs.add(aDir);
this.putNextEntry(... |
4a11590d-68ac-4a0f-8ab3-58370d17c670 | 9 | public void codeProcess() {
if (!player.isFreezed) {
// atualizar x e y da classe Robo para o user usar
Proto.x = (int) (player.x / 50) + 1;
Proto.y = (int) (player.y / 50) + 2;
//System.out.println("Coordenadas do Robo: [" + Robo.x + ", " + Robo.y + ... |
bb61ce57-38a7-40ec-8b0a-0a969445673c | 0 | public void shutdown() {
interrupt();
socket.close();
} |
214947ae-b722-4597-987c-a16512129321 | 9 | private void moveColumn(Board b, int caller) {
int posNr = 0;
Position tmp = null;
int i, j;
int foundPos = -1;
i = j = 1;
while (i <= b.getWidth()) {
j = 1;
while (j + 1 <= b.getHeight()) {
if (b.isFree(i, j) && b.isFree(i, j + 1)) {
b.set(i, j);
b.set(i, j + 1);
foundPos = pos.sea... |
4527e358-8a06-4c25-9071-d3735276d29b | 2 | @Override
public void main() {
cleanOutput();
Element[] elements = {new ElementOne(), new ElementTwo(), new ElementThree()};
VisitorOne visOne = new VisitorOne();
VisitorTwo visTwo = new VisitorTwo();
for (Element el : elements) {
el.accept(visOne);
}
for (Element el : elements) {
el.ac... |
5b40f1d0-d983-4426-abad-17310eed72d2 | 7 | public GUIAltaEmpleado(){
final ControlErrores control=new ControlErrores();
this.setTitle("Alta Empleado");
setBounds(100, 100, 500, 400);
this.setLocationRelativeTo(null);
this.setLayout(new BorderLayout());
ArrayList<Departamento> depts = Factori... |
4c885fb5-ca8c-48af-959a-7a1590a8dd45 | 7 | public int solution(int[] H) {
int blocks = 1;
Stack stack = new Stack(H.length);
stack.push(H[0]);
for (int i = 1; i < H.length; i++) {
if (stack.peek() < H[i]) {
stack.push(H[i]); //increase of wall height, which adds the need of a new block
... |
16bb02d1-43ca-45fb-b9ca-96c483144f8f | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ReadNode other = (ReadNode) obj;
if (prompt == null) {
if (other.prompt !... |
57fceb56-02ee-4d6a-96dd-63eefd2a7cc9 | 9 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Cube cube = (Cube) o;
if (permutationId != null ? !permutationId.equals(cube.permutationId) : cube.permutationId != null)
return false;
... |
16d81563-07ed-46dc-891d-5e55c118c692 | 2 | public static String getStreamID(String streamerName) {
for (int i = 0 ; i < streamName.size(); i++) {
if (streamName.get(i).equalsIgnoreCase(streamerName)) {
return streamList.get(i);
}
}
return null;
} |
c8c52c17-a54e-44c0-be52-49a4b9608a7d | 3 | public void playersMove(Value player) {
boolean fault = true;
while (fault) {
Scanner in = new Scanner(System.in);
System.out.println(player + ": Введите число от 1 до " + field.sizeField);
try {
int x = in.nextInt()-1;
int y = in.nextI... |
e6423545-7e70-4814-8f41-22b432d9ff1d | 7 | public static StorageNodeMetadata getNode(int key){
StorageNodeMetadata nodeMeta;
int hashKey = key % moduloRange;
if (storageNodes.isEmpty())
return null;
else
{
nodeMeta = null;
int diff = modulo... |
01ffb6fa-b3de-4831-8a41-a0619fc7a9ce | 5 | public void setStatement(Integer i, PreparedStatement stmt, Object stuff) throws SQLException {
switch (this.s_to_int(this.campos[i][1])) {
case 0:
stmt.setInt(i, (Integer) stuff);
break;
case 1:
stmt.setString(i, (S... |
fa83c3fd-e75b-46b0-8e55-43cbfee8858e | 1 | @SuppressWarnings("unchecked")
public List<BEValue> getList() throws InvalidBEncodingException {
if (this.value instanceof ArrayList) {
return (ArrayList<BEValue>)this.value;
} else {
throw new InvalidBEncodingException("Excepted List<BEvalue> !");
}
} |
9b03118b-2f6c-40f0-b917-d7eb81faf7f5 | 2 | public PhasorMatrix subarray_as_Phasor_rowMatrix(int start, int end){
if(end>=this.length)throw new IllegalArgumentException("end, " + end + ", is greater than the highest index, " + (this.length-1));
Phasor[] pp = this.getArray_as_Phasor();
Phasor[] retArray = new Phasor[end-start+1];
f... |
81e6684a-d3dc-4eba-8e99-6fffa9ca2345 | 8 | public static void main(String[] args) {
Set<String> digits = permutate("0123456789");
Set<Long> total = new HashSet<>();
for (String s : digits) {
if (getDigits(s, 2) % 2 != 0) continue;
if (getDigits(s, 3) % 3 != 0) continue;
if (getDigits(s, 4) % 5 != 0) c... |
e1ae58c7-6991-4903-a13a-78650c297b84 | 8 | public Class getObjectClass() {
if (_wrapperObject instanceof Boolean)
return boolean.class;
else if (_wrapperObject instanceof Integer)
return int.class;
else if (_wrapperObject instanceof Float)
return float.class;
else if (_wrapperObject instanceof Double)
return double.class;
else if (_wrap... |
3edc117a-6038-40db-855a-d5b62a3b8c7d | 4 | public void update() {
up = keys[KeyEvent.VK_UP] || keys[KeyEvent.VK_W];
down = keys[KeyEvent.VK_DOWN] || keys[KeyEvent.VK_S];
left = keys[KeyEvent.VK_LEFT] || keys[KeyEvent.VK_A];
right = keys[KeyEvent.VK_RIGHT] || keys[KeyEvent.VK_D];
} |
81e3ac5d-fde6-4b59-8410-3e3a4137ac98 | 0 | public void updatePanel() {
repaint();
} |
129e626a-ac95-4df1-b346-077dcc11888d | 1 | public void setUserlistImageOverlay_Width(int width) {
if (width <= 0) {
this.userlistImgOverlay_Width = UISizeInits.USERLIST_IMAGEOVERLAY.getWidth();
} else {
this.userlistImgOverlay_Width = width;
}
somethingChanged();
} |
d7bbbb92-73c7-4489-aab5-4136f118d793 | 4 | public static void main(String[] args){
try{
TestClass to = new TestClass();
String s = to.toString();
System.out.println(s);
registerEvents();
Class<?> c = MyJsonUtils.findClass("TestClass");
System.out.println(c);
for(Class<?> cl: ClassFinder.find("bluefrost.serializable.objects.v1.json")){... |
0538d044-2f8f-4b0b-ad1f-9079bc4b484e | 7 | private static String getDay(Calendar c) {
int day = c.get(Calendar.DAY_OF_WEEK);
switch (day) {
case 1:
return "Sunday";
case 2:
return "Monday";
case 3:
return "Tuesday";
case 4:
return "Wednesday";
case 5:
return "Thursday";
case 6:
return "Friday";
case 7:
retur... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.