method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
11a5b62f-f7df-475d-8a6d-af17dfbc4648 | 3 | private void save(String kodikosV,String daidromiV){
/*
* apothikeuei ta stoixia sthn vash kai emfanizei to katalilo minima ston xristi
*/
String query="insert into oximata(id,diadromi,lat,lon) values(?,?,'37.973263','23.740768') on duplicate key update diadromi=?";
try {
con.pS=con.conn.prepareStatemen... |
a2924822-cccb-47b3-b848-dc361c0fce9c | 6 | @EventHandler
public void EnderDragonStrength(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getEnderDragonConfig().getDouble("End... |
81a88ecb-f2a0-4cdf-843c-138c95727721 | 8 | public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int T = Integer.parseInt(br.readLine().trim());
for (int t = 0; t < T; t++) {
int N = Integer.parseInt(br.readLine().trim());
String[] name ... |
4550c275-3410-4618-9625-941e35b8d21d | 2 | private void writeBookList() {
BookXMLHandler addBook = new BookXMLHandler();
try {
addBook.writeToFile(bookList);
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SAXException e) {
// TODO Auto-g... |
b7579d65-5d91-4041-b896-75d666272a89 | 2 | @Override
public void onEnable() {
configData.load();
PluginManager pm = this.getServer().getPluginManager();
pm.registerEvent(Event.Type.PLAYER_INTERACT, this.playerListener, Priority.Normal, this);
pm.registerEvent(Event.Type.BLOCK_BREAK, this.blockListener, Priority.Highest, this);
pdfFile = t... |
d7ad5380-b3d6-485f-bc4d-12f8776db63b | 1 | @Override
public void setVisible(boolean state) {
if (state) {
eventStart.setTime(MainWindow.setupData.getEventStartDate());
startDatePicker.getModel().setDate( eventStart.get(Calendar.YEAR),
eventStart.get(Calendar.MONTH),
eventStart.get(Calendar.DATE));
startDatePicker.getMode... |
75e1c780-d610-4160-a291-095fcec53d36 | 5 | public static void main(String[] args) throws Exception {
switch (args.length) {
case 2:
expr = args[1];
/*FALLTHROUGH*/
case 1:
fileName = args[0];
break;
case 0:
default:
System.err.println("Usage: XPathRunner file [xpath-expr]\n");
return;
}
DocumentBuilder parser = DocumentBuilde... |
4081f3e5-e28e-432e-8939-560c798d1a36 | 0 | private String parseMethodName(String signature) {
String methodBeforeArguments = signature.substring(0, signature.indexOf("("));
int positionOfMethodNameStart = methodBeforeArguments.lastIndexOf(".");
return methodBeforeArguments.substring(positionOfMethodNameStart + 1);
} |
ce986a6c-23b6-49cc-a07b-b3dd0aeec42c | 3 | public Objective getObjectiveFromTypes(String type, String name){
for(Objective obj : this.objectives){
if(obj.type.equalsIgnoreCase(type) && obj.getObjectiveName().equalsIgnoreCase(name))
return obj;
}
//no matching objective
return null;
} |
56baed21-2cfe-43a9-b21d-2e5c75dcfcde | 0 | public Integer getFrequency() {
return frequency;
} |
fa96505b-3993-447a-9269-2ee10f1b907d | 5 | public void applicationLoop() {
int sign = -1;
float height = 0;
Transform3D transform = new Transform3D();
Transform3D transform2 = new Transform3D();
screen = canvas.getGraphics2D();
canvas.setFrameRate(String.format("Frame [%d]", frameCounter));
canvas.setCameraPosition(String.format("Camera Position... |
7bad9a65-36e3-412e-9d76-392da3a9722c | 3 | public String sendMessage(String messageWithName) {
Set<String> clientList = this.updater.getClientList();
for (String s : clientList) {
try {
// Angepasst
this.udpVerbindung.send(s, this.userName + ": " + messageWithName);
} catch (UnknownHostExce... |
12f810e9-247f-46f3-b00e-7d10206c6d7d | 7 | private void jbInit() throws Exception {
this.contentPane = (JPanel) this.getContentPane();
this.contentPane.setLayout(this.gridBagLayout2);
this.setDefaultCloseOperation(0);
this.setJMenuBar(this.menuBar);
this.setSize(new Dimension(759, 548));
this.setTitle("State Table Editor");
JComboBox<String> in... |
3a82a42b-8ee5-4610-83cb-32c0fffbd4b6 | 0 | public CipherReferenceType createCipherReferenceType() {
return new CipherReferenceType();
} |
58414b72-1372-4b66-87ec-9eaf59e76666 | 4 | public ProtocolElem(JFrame frame, String key, String type) {
this.id = StringUtils.Md5("" + System.nanoTime());
this.setText(key, type);
this.setSize(type);
this.addMouseListener(new MouseAdapter() {
private void button1Clicked() {
MessageBox.showPEInfoBox(f... |
546d511e-2add-4a92-bb8f-153834fe4d64 | 6 | @Override
public Class<?> getColumnClass(int columnIndex){
Class type = String.class;
switch (columnIndex){
case 0:
type = Integer.class;
break;
case 1:
type = String.class;
break;
case 2:
type = Double.class;
break;
case 3:
type = Double.class;
break;
case 4:
type = Double.cla... |
2670bf80-af45-460b-84ca-e01c947198c2 | 1 | public void dividirEquipos(Collection<Inscripcion> equipo1, Collection<Inscripcion> equipo2, PriorityQueue<Inscripcion> primeros10Ordenados){
for (int i=1;i<=5;i++){
equipo1.add(primeros10Ordenados.poll());
equipo2.add(primeros10Ordenados.poll());
}
} |
0f86de2a-cedf-443f-9d0a-8f8def5ab8c6 | 0 | public Date getEventDate() {
return eventDate;
} |
388bd859-b6a6-4ada-b053-0af7ac5e4d04 | 7 | public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double) o).isInfinite() || ((Double) o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
28c636cc-40a0-4998-87b4-f861b58c3c9e | 1 | public int getDepth() {
Row parent = mParent;
int depth = 0;
while (parent != null) {
depth++;
parent = parent.mParent;
}
return depth;
} |
c6defda8-1007-4288-be89-647ed9e7a1be | 5 | public void moveRobot(int ID)
{
robotar.get(ID).moveForward();
for(int i = 0;i < block.length;i++)
{
if(robotar.get(ID).touches(block[i]))
{
feedback.get(ID).setRobotkrock(true);
robotar.get(ID).moveBackward();
}
}
... |
f5c49124-cc29-4ec4-bf59-d2e44b8a770c | 6 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
btn_addeditC = new javax.swing.JButton();
btn_addeditE = new javax.swing.JButton();
btn_refresh = new javax.swing.JButton();
b... |
0647848a-79c4-477e-a34b-6c7a50a36c91 | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
HairDryer other = (HairDryer) obj;
if (windSpeed != other.windSpeed) {
re... |
41545ddd-63b9-4ef7-bb78-11f43c9f0eb8 | 9 | private static void buttonPointSettings(final JButton button) {
button.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
String text = textField.getText();
if (text.contains(".")) {
if (text.contains("+")) {
String subText = text.substring(text.indexOf(... |
3073757c-f952-44a8-90ff-27897e58fa46 | 8 | private boolean camposCompletos (){
if((!field_codigo.getText().equals(""))&&
(!field_descripcion.getText().equals(""))&&
(!field_cantidad.getText().equals(""))&&
(!field_costo_u.getText().equals(""))&&
(!field_precio_venta.getText().equals(""))&&
(!field_t... |
7c4bac1d-25cf-446f-88fc-d18ede5fa930 | 5 | public boolean checkGuess(String question, String guess)
{
for(int i = 0; i < wordpairs.size(); i++)
{
if(question.equalsIgnoreCase(wordpairs.get(i).getDanishWord()))
{
if(wordpairs.get(i).getEnglishWord().equalsIgnoreCase(guess))
{
... |
5b44f938-53c1-486c-8139-f8e03f80f9e3 | 2 | public float getLow() {
float lowVal = Float.MIN_VALUE;
try {
lowVal = Float.parseFloat(low.getText());
if (lowVal == lowVal)
return lowVal;
} catch (Exception e) {
}
return lowVal;
} |
f86006b8-170f-4522-a67b-24b2fe9bb15e | 0 | public static Font getDisplayFont()
{
return displayFont;
} |
49e9a983-988c-4e7f-8be2-f64688ff1506 | 7 | private String getSelectClause() {
if (!groupByColumns.isEmpty()) {
if (selectedColumns.isEmpty()) {
throw new RuntimeException("The SELECT list cannot be empty when the GROUP BY clause is specified.");
}
for (Column column : selectedColumns) {
if (!groupByColumns.contains(column)... |
79a9469b-1a5e-40f4-9607-c9cd4aad8b4f | 4 | @Override
public void setGroup(ResourceGroup group) {
if (group != null && !group.equals(this.group)) {
if (this.group != null) {
this.group.removeResourceDefinition(this);
}
if (!group.containsDefinition(this)) {
group.addResourceDefinition(this);
}
}
this.group = group;
} |
405df4b6-f140-417c-a8ec-fb868c7c7745 | 8 | private final void method212(Frame frame, byte i) {
boolean bool = false;
if (i <= 47)
method212(null, (byte) -25);
try {
Field field = Class.forName("sun.awt.Win32GraphicsDevice")
.getDeclaredField("valid");
field.setAccessible(true);
boolean bool_7_
= ((Boolean) field.get(aGraphicsDevice157)).... |
be833281-aa24-458c-894d-f108f2a07c0c | 2 | @Override
public void run() {
ServerSocket server;
try {
server = new ServerSocket(8080);
while (true) {
Socket socket = server.accept();
ReceivingThread thread = new ReceivingThread(socket, window);
thread.start();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.prin... |
489af7e4-d8d0-4b06-93d2-4d7d879ca06f | 4 | public static boolean arrayIncludes(Object a[], Object e) {
if (a == null || e == null) return false ;
for (Object o : a) if (o == e) return true ;
return false ;
} |
424ff1ac-1e38-4f25-b768-4a6040b4b926 | 5 | public static void main(String[] args) throws IOException
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
while (true)
{
String name = reader.readLine();
if (name.isEmpty()) break;
int age = Integer.parseInt(reader.readLin... |
e3baed44-4ae2-4e68-aed9-72a8aefe6bd2 | 5 | public void init(String game){
Connection conn = new Connection("130.243.137.236", 8080);
NetManager network = new NetManager(conn);
Encoder enc = new Encoder();
try {
network.connectToServer();
} catch (IOException e2) {
e2.printStackTrace();
}
String JSONtext = "";
try {
JSONtext = enc.... |
eed9de4c-30bc-4f88-b72c-c41f9b079579 | 0 | public Position getHuffPosition() {
return huffPosition;
} |
f20197d3-baa5-453a-a82b-e4b331158e5b | 9 | public static String multiply(String num1, String num2) {
int len1 = num1.length();
int len2 = num2.length();
List<Integer> res = new ArrayList<Integer>();
for (int i = len2 - 1; i >= 0; i--) {
//if ('0' == num2.charAt(i)) continue;
for (int j = len1 - 1; j >= 0; j--) {
int start... |
5b555b38-e765-4a0e-81a7-2b89b78e12e6 | 2 | public String toString() {
if (this == Male) {
return "♂";
}
if (this == Female) {
return "♀";
}
return "";
} |
54f237f5-9aa3-4ff7-856a-378bbac92b7e | 8 | public static void main(String[] args) {
description = "Description: " + "Testing some crazy hardcore!!!!!" +
"Testing overprocessing by Bank. " +
"Works until requests == 0.";
System.out.println("Main thread started");
String hours = new SimpleDateFormat("HH")... |
c79baca1-85ec-41cb-adc1-5fa663ac5004 | 2 | public final JSONObject putOpt(String key, Object value) throws JSONException {
if (key != null && value != null) {
put(key, value);
}
return this;
} |
268e97c5-ee83-46c9-9313-d3ebad5dbcc1 | 1 | public ActionPanel(final Joculus app)
{
this.app_instance = app;
setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
// Setting an empty border on a button removes its decoration.
final EmptyBorder btn_border = new EmptyBorder(4, 4, 4, 4);
JButton b;
b = new JButton(getToolbar... |
f723dd45-d5a6-40be-919e-a1cf01ab0293 | 5 | private Station(){
this.lineQueue = new Queue();
switch(Define.batcherType){
case Define.RoundRobinBatcher :
this.batcher = new RoundRobinBatcher();
break;
case Define.PriorityQueueBatcher :
this.batcher = new PriorityQueueBatcher();
break;
case Define.RandomBatc... |
9ba9f066-3bc2-423d-91fd-ca51180d6979 | 9 | public static void main(String[] args) throws IOException, ParseException {
numArgs = args.length;
if(numArgs == 0)
{
GUI freezeUI = new GUI();
freezeUI.setVisible(true);
}
else
{
//Expect multiple switches but one command
command = "";
f... |
803b7385-d214-4ae6-b195-2b24deec9f0f | 8 | protected synchronized void acquire(boolean throwInterrupt) throws InterruptedException {
if(acquired)
return;
if(throwInterrupt && Thread.interrupted())
throw new InterruptedException();
owner=getOwner();
sendGrantLockRequest(name, lock_id... |
cb7f0496-61c2-41b0-a541-8e4d643aa73e | 1 | public static Object best(List quantity_list) {
if(quantity_list == null) throw new NullPointerException();
Collections.sort(quantity_list);
return quantity_list.get(0);
} |
17223bb1-5e3d-4e31-9af1-ef148fe9266a | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Vehicle other = (Vehicle) obj;
if (!Objects.equals(this.szVehicleId, other.szVehicleId)) {
re... |
ae27da64-15f8-4f32-b2c8-cfb90fd74357 | 5 | private void addPars()
{
int beginParCount=0, endParCount=0;
for (int i=0;i<input.length();i++)
{
switch (input.charAt(i))
{
case '(':
beginParCount+=1;
break;
case ')':
endParCount+=1;
break;
}
}
... |
74dc2285-8b6b-4893-a6cd-9e8d7d88454a | 1 | public Collection realsAtBlock(final Block block) {
LinkedList l = reals[cfg.preOrderIndex(block)];
if (l == null) {
l = new LinkedList();
reals[cfg.preOrderIndex(block)] = l;
}
return l;
} |
d1b68827-e4d6-4027-b152-82008994228e | 0 | private Animation createPlayerStanding(Image player1, Image player2)
{
Animation anim = new Animation();
anim.addFrame(player1, 250);
anim.addFrame(player2, 250);
return anim;
} |
dd85d1d3-d775-4e92-866d-f20a9d0b9cad | 6 | private void loadAdjacentMaps() {
String[] ways = new String[] { "north", "east", "south", "west" };
for (int i = 0; i < ways.length; i++) {
String way = ways[i];
String newMap = map.getMapProperty(way, null);
if (newMap != null) {
if (way.equals("north")) {
transitions.put(Globals.DIRECTION_UP,
... |
a2417334-d4f6-4f6a-ad10-bd99659121c4 | 0 | AbstractDialog()
{
super();
setAlwaysOnTop(true);
setUndecorated(true);
} |
10a0ec84-4b72-4623-a27c-9e3c9cbcd7ae | 5 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
txt_codigo = new j... |
f6af79e8-9434-43ce-ae01-2740616cfd76 | 5 | */
public String toString() {
int f = front;
int r = rear;
String outString = "";
if (f < r) {
while (f < r) {
outString += array.get(f).toString();
f++;
}
} else if (f > r) {
while (f < array.size()) {
outString += array.get(f).toString();
}
for (int i = 0; i <= r; i++) {
outS... |
ab66a630-4f87-425e-92ab-32034be05724 | 5 | public static CorePhrase[] getPhrases(Connection con, Dictionary dict, User user)
{
LinkedList<CorePhrase> data = new LinkedList<CorePhrase>();
try
{
PreparedStatement ps = con.prepareStatement(
"SELECT Phrases.ID, Success, RevSuccess, Performances.ID " +
"FROM Phrases " +
"LEFT OUTER JOIN Perf... |
d7d55613-901d-417e-bb4d-3d8866e7df03 | 9 | public void getSavedFiles(String file) {
try{
int duplicate = 1;
String textLine = "";
Scanner fileScanner = new Scanner(new File(file));
while (fileScanner.hasNextLine()) {
textLine = fileScanner.nextLine() + ","; //add a comma to the end to make parsing easier
int count = 0; //count the numb... |
416fe334-40b4-4ccf-b36e-924521d88fc4 | 6 | public UserRole role(String username) {
// Open the connection
connect();
// Make the statement
PreparedStatement statement;
try {
statement = getConnection().prepareStatement(
"select * from users where username = ?");
statement.setString(1, username);
set = statement.executeQuery();
// ... |
99528913-2bca-48d7-b9bf-a1fb9652e9e8 | 4 | private KeyValuePair transferColumn(ColumnMapping column,ResultSet records,int i,KeyValuePair pair){
ResultSetMetaData metaData = null;
try {
metaData = records.getMetaData();
if(R.entity.type.transfer.equalsIgnoreCase(column.getType())){
if(column.getSrc_name().e... |
926d0e16-f983-4729-bf5c-e94c66865f10 | 1 | public void setState2(State state2) throws IllegalArgumentException{
if(state2 != null)
this.state2 = state2;
else
throw new IllegalArgumentException();
} |
159273e9-606d-4ba4-a0ab-4ece2bcdcd1c | 1 | protected StdImage getIcon(TreeRow row) {
return mIconAccessor != null ? mIconAccessor.getIcon(row) : null;
} |
77dab48d-0459-4a3b-8d2c-afd690f13e64 | 3 | public static List<String> getFolderNameInList(String path) {
List<String> list = null;
File file = new File(path);
if (file.isDirectory()) {
list = new LinkedList<String>();
File[] ary = file.listFiles();
for (int i = 0; i < StringUtil.size(ary); i++) {
if (ary[i].isDirectory()) {
list.add(ary[... |
2a8308cc-6416-44cb-8d33-0c228952c3c1 | 2 | public void execute(final State state) {
//do something special if this is the first scan
if (isPreInitialScan) {
isPreInitialScan = false;
doInitialScan(state);
} else if (state.targetPosition != null) {
// don't bother if we don't know where the enemy is yet
doExecute(state);
}
} |
5e2a29b5-2c41-4f43-889e-b11fb51fd523 | 2 | public static void main(String[] args) {
Scanner s = new Scanner(System.in);
String str;
Integer a, b, c, d;
System.out.println("This program will divide two numbers that you enter.");
System.out.print("Please enter your first number: ");
str = ... |
59d263a5-e5b1-48fc-970d-767ba1531df9 | 2 | public void KeyListener(){
for(int i=0;i<keys.length;i++){
keys[i]=false;
typed[i]=true;
}
for(int i=0;i<mouse.length;i++){
mouse[i]=false;
}
} |
2e1f475d-90c5-4c33-938a-e4f9b3631792 | 0 | public void setGraph(LaenderGraph graph) {
laenderGraph = graph;
} |
15febc2a-ddee-4f68-b139-f804fc2287b8 | 4 | protected int unicodeEscapeLexer(int c) throws IOException {
int ret = 0;
// ignore 'u' (assume c==\ now) and read 4 hex digits
c = in.read();
code.clear();
try {
for (int i = 0; i < 4; i++) {
c = in.read();
if (isEndOfFile(c) || isEndO... |
b21574fb-d937-4bcc-8bb3-04ab8db2e993 | 7 | public void bucketSort(int[] data){
int max = data[0] , min = data[0];
for (int i = 0; i < data.length; i++) {
if(max < data[i]){
max = data[i];
}
if(min > data[i]){
min = data[i];
}
}
int bucketSize = (max - min + 1)/10 + 1;
Node[] bucket = new Node[bucketSize];
for (int i = 0; i < b... |
c3f334ec-2734-4c8a-abcb-9d7919850ebf | 7 | public void show(){
Scanner scan = new Scanner(System.in);
int choice=0;
while(choice!=4){
System.out.println("==============");
System.out.println(" Movie Menu ");
System.out.println("==============");
System.out.println("1) Create Movie");
System.out.println("2) Update Movie");
System.out... |
5f4ee80b-634b-450a-8a3c-6fe8a88e7986 | 2 | public void deposit(BigInteger amount) throws IllegalArgumentException {
if ( (amount == null) || (amount.compareTo(BigInteger.ZERO) < 0) )
throw new IllegalArgumentException();
setBalance(this.getBalance().add(amount));
} |
eb7448a3-7a21-458b-8942-24642035c028 | 3 | public String getStateParametersValueKeyPair() {
String parameters = "";
for (int i = 0; i < parameterKeys.length; i++) {
// Add the parameter key
parameters += parameterKeys[i] + "=";
// add the parameter values if you can null otherwise
if (parameterValues.length > i) {
parameters += parameterValu... |
f4520c01-78d8-457f-874c-6031bc1fb87f | 3 | String transformValue(int val) {
switch (val) {
case 0: return "Arithmetic";
case 1: return "Geometric";
case -1:
default:
return "-1";
}
} |
7a4b940c-8736-4338-ad66-7171dc66ca51 | 6 | private void run()
{
init();
log("Initializing game");
game.init();
System.out.println();
boolean running = true;
long time = 0, lastTime = 0, currentFPSSample = 0;
float delta = 0, fps = 0;
float[] fpsSamples = new float[targetFPS/2];
while(running)
{
if(Display.wasResized())
{
... |
3ed36aca-4fc8-4cc2-baba-579c76832cb6 | 7 | public NexTClient(){
// The default port
int port_number=2222;
String host="localhost";
// Initialization section:
// Try to open a socket on a given host and port
// Try to open input and output streams
try {
clientSocket = new Socket(host, port_number);
inputLine = new Buffere... |
fb0d2cc1-f6b4-4f8a-b4d3-88d936e35538 | 8 | public Task[] generateWISCandidates(PQModel2 model, PQInput2 input,
PQOutput2 correctOutput, double lossWeight) {
// Implementation of a method for comparison between two tasks.
// It is used to find out in which position we have to insert the
// new task in the list of tasks. Ordered by task end.
Comparator... |
4cf6105f-4a6b-427f-843a-6dac6dc1b478 | 8 | static double grad(int hash, double x, double y, double z) {
int h = hash & 15; // CONVERT LO 4 BITS OF HASH CODE
double u = h < 8 || h == 12 || h == 13 ? x : y, // INTO 12 GRADIENT DIRECTIONS.
v = h < 4 || h == 12 || h == 13 ? y : z;
return ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? v : -v);
... |
2f87d3a9-4e48-431b-920f-dfca1e1caed3 | 8 | public void addVertex(double d, double d1, double d2) {
if (!this.renderingChunk) {
GL11.glVertex3f((float) (d + this.xOffset), (float) (d1 + this.yOffset), (float) (d2 + this.zOffset));
} else {
++this.addedVertices;
if (this.drawMode == 7 && Tessellator.convertQuads... |
f77e5545-8171-4f92-b7d6-b22aa8e9dc4e | 5 | public void paintEndFallingBlocks(Graphics g){
Graphics2D g2d = (Graphics2D) g;
if(tetrominoes.size()>1)
for(int index =0 ; index<tetrominoes.size()-1;index++)
for(int x=0; x < coordonneJeu.getNombreColonne(); x++)
for(int y=0; y < coordonneJeu.getNombr... |
d2cfadfb-a257-427d-a47f-c5bc08492dcd | 6 | public void file_save_as(){
JFileChooser fc = new JFileChooser();
fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
int r = fc.showSaveDialog(this);
if(r==fc.CANCEL_OPTION)
return;
File myfile = fc.getSelectedFile();
if(myfile==null || myfile.getName().equals(... |
619a6b22-11e1-4d5f-b0ab-299a84dfa141 | 9 | public static void main(String[] args) throws Throwable{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(in.readLine());
for (int h = 0; h < n; h++) {
in.readLine();
String entrada = in.readLine();
String salida = "";
int ultimoOval = -1;
int ultim... |
2b042848-2799-40dd-8296-4809c01b9854 | 1 | public void testParsePeriod_simple() {
Period expect = new Period(1, 2, 3, 4, 5, 6, 7, 8);
assertEquals(expect, f.parsePeriod("P1Y2M3W4DT5H6M7.008S"));
try {
f.parsePeriod("ABC");
fail();
} catch (IllegalArgumentException ex) {}
} |
648d2a44-5196-46f0-8780-f454e54044ca | 0 | public CustomConfig(File configFile) {
this.config = new YamlConfiguration();
this.configFile = configFile;
} |
e878c243-3faf-4b42-bad6-6002ee86996f | 5 | public static void endTurn()
{
game.totalTurns++;
if(isTwoPlayers)
{
swap();
}
else
{
game.myTurn = true;
readyToSwap = false;
int[] bombPoint = BattleShipAI.takeShot(game.mySea.getObfuscatedSea());
Ship shipSunk = game.mySea.bombTile(bombPoint[0], bombPoint[1]);
int bombedTile = game... |
9e8b13a5-9d77-451b-9946-5904c64fca23 | 5 | public boolean sameOrder(Matrix a) { //Doesn't work with jagged arrays, call isJagged() first
if (a == null) {
return false;
}
if (this.isJagged || a.isJagged) {
return false;
}
if (this.rowCount != a.rowCount) {
return false; //different row ... |
95a644af-458a-4f1b-9c41-697938b5f10b | 2 | static Function<Class<?>, Object> getDefaultInstanceSupplier() {
return (c) -> {
try {
return c.newInstance();
} catch (InstantiationException | IllegalAccessException ex) {
throw new IllegalStateException("Cannot instantiate view: " + c, ex);
... |
f81c9dcf-f4be-4bbf-be18-9e0f6a1909f1 | 1 | private void doClearAppenders() {
for (Iterator<String> it = appenders.iterator(); it.hasNext();) {
removeAppender(it.next());
}
} |
0f95a931-23d9-4f04-ab0d-136a883118f5 | 9 | public static List<Estado> listaDeEstados() {
Estado estado;
List<Estado> listaEstado;
Statement statement = null;
ResultSet tr = null;
String select = "SELECT * FROM estados";
listaEstado = new ArrayList<Estado>();
Connection conexion = null;
try {
... |
107e2215-7cd0-4bbe-a611-29ebb70e6eed | 9 | public synchronized String getShortName(String realName) {
realName = realName.trim();
//prüfen, ob bereits ein shortname existiert
String shortName = realToShortNames.get(realName.toLowerCase());
if (shortName != null) {
return shortName;
}
//ansonsten prüfen... |
5ca56d3a-a9a1-4f0e-8e14-e966a3344761 | 8 | public ArrayList<Point> getPossibleMoves(Point start) {
ArrayList<Point> result = new ArrayList<Point>();
int colStart = start.getX();
int rowStart = start.getY();
int numOfPieces = 0;
// col. up
numOfPieces = getNumPiecesInCol(colStart);
if (checkMove(rowStart, colStart, rowStart - numOfPieces, colStart... |
0a5d552b-af7e-47ba-ab02-39c12a3e28ea | 0 | @Override
public String toString(){
return "id= "+this.getId()+", "+this.getName()+"\n"+getTime()+"\n"+"Высота: "+this.getHig()+"\n"+"Радиус: "+this.getRad()+"\n"+"Диагональ: "+this.getDiag()+"\n"+ "Площадь тела вращения: "+this.getArea_Body()+"\n"+"S=: "+this.getArea()+" V=: "+this.getVolume()+"\n";
} |
8799c779-f8c2-4804-a014-c8471d91f82d | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
223f1cbc-70a5-409b-a5d6-6d269b661ce5 | 8 | public List<String> getMinor() {
Connection conn = null;
ResultSet rs = null;
PreparedStatement ps = null;
List<String> minor = Constants.Minor;
String asString = (String)Constants.Minor.get(0) + "," + (String)Constants.Minor.get(1);
try
{
conn = iConomy.getiCoDatabase().getConnection(... |
1c7e0b56-2097-447b-975e-9e3794baf1c3 | 7 | public static boolean MatchRankSuit(Card playercard, Card openedcard) {
if (playercard.getRank().equals(Rank.ACE)) {
if (openedcard.getRank().equals(Rank.ACE)) {//ace on ace
return false;
} else {//ace match
return true;
}
} else if ((o... |
b26dbb35-4740-4450-a697-c9bc0a167c1e | 0 | public void exit()
{
setVisible(false);
} |
138b3a7c-66a3-47fb-b228-18c48a51183a | 0 | public void setDepartureStation(String value) {
this._departureStation = value;
} |
e2130d25-5977-4a82-9a35-d1879a7d3a2e | 0 | public List findByInputFormat(Object inputFormat) {
return findByProperty(INPUT_FORMAT, inputFormat);
} |
987442cf-9319-4b93-91d7-bd3f36d05913 | 8 | final void method3685(Class98 class98, int i) {
Class167 class167 = method3724(Thread.currentThread());
Class318_Sub9 class318_sub9
= (((Class88) ((Class98) class98).aClass88_1569)
.aClass318_Sub9_1503);
for (Class318_Sub9 class318_sub9_65_
= ((Class318_Sub9) class318_sub9).aClass318_Sub9_6469;
... |
481b5f9f-b949-4e40-9bda-a683e112d7e9 | 3 | public void drawCities() {
cities=new BufferedImage(w.WIDTH,w.HEIGHT,BufferedImage.TYPE_INT_ARGB);
Graphics2D page=cities.createGraphics();
for (int y1=0;y1<w.HEIGHT;y1++)
for (int x1=0;x1<w.WIDTH;x1++) {
if (w.map[x1][y1].owner!=null) {
page.setColor(Color.getHSBColor(w.map[x1][y1].owner.owner.hue... |
31b490eb-5bd3-4c3a-a1f9-08e03ea4216d | 7 | public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... |
dcfde899-e22c-4173-988b-60c6b4e0d465 | 9 | public List<String> topTags(){
PreparedStatement stmt = null;
Connection conn = null;
ResultSet rs = null;
List<String> tags = new ArrayList();
try {
conn = DbConnection.getConnection();
stmt = conn.prepareStatement(TOP_TAG_STMT);
rs = stmt.executeQuery();
for(int i = 0 ;i<10;i++){
if(!... |
57d50ecc-c11b-44e9-9db8-a881a8b985da | 2 | protected Stmt createStore(VarExpr target, final Expr source) {
target = (VarExpr) target.clone();
// Source is an undefined variable, initialize it
if ((source instanceof VarExpr) && (source.def() == null)) {
return createUndefinedStore(target);
}
return new ExprStmt(new StoreExpr(target, (Expr) source.... |
55216634-2d52-43fa-ac94-b9ca697ad94e | 1 | private boolean indexOK(int index) {
return index < array.length && index >= 0;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.