method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
3a7144ad-740a-443f-b409-280131b4a20b | 7 | public static double activatePropositionalNeuralNetwork(PropositionNeuralNetwork net) {
{ int numIn = net.input.length();
int numHidden = net.hidden.length();
Vector arguments = net.proposition.arguments;
int stop = numIn - 1;
Vector input = net.input;
Vector hidden = net.hidden;
... |
0d2fe142-ae32-4583-88d9-e95852e495fd | 1 | public double funcR(int x, int y){
double q = funcQ(x, y);
if (q >= 0){
return k*pow(q, n);
}
else {
return 0;
}
} |
a94eb0e7-e73c-44f5-810a-fb5ede97f5e4 | 0 | @Test
public void testSetDrawOutput()
{
assertNotNull(_underTest);
_underTest.setDrawOutput(Output.Paper);
assertEquals(Output.Paper, _underTest.draw());
_underTest.setDrawOutput(Output.Rock);
assertEquals(Output.Rock, _underTest.draw());
_underTest.setDrawOutpu... |
4fe2ae20-b3cd-4211-a5cf-a98872a2833b | 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) {
... |
aba6f595-a1b7-4dfa-a3e5-8766d98938ff | 8 | public void decodeVideoPacket(int pktLength, long pts)
throws MpegVideoDecodeException
{
Statistics.startLog(DECODE_VIDEO_STRING);
m_lPTS = pts;
try
{
if( !m_bRunMode )
m_ioTool.nextStartCode();
do
{
if( !m_bRunMode )
{
pa... |
93306b32-fd0d-4161-b380-4a0df6fdaec3 | 5 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
response.setContentType("text/html;charset=UTF-8");
String bookUuid = request.getParameter("bookUuid");
HttpSession session = request.getSession();
... |
c6e31937-5360-4a90-a70c-2c48b12d620e | 4 | @Override
public void mousePressed(MouseEvent event) {
if (event.isPopupTrigger()) {
Column column = mOwner.overColumn(event.getX());
if (column != null && mOwner.allowColumnContextMenu()) {
ArrayList<Column> selection = new ArrayList<>();
selection.add(column);
}
} else if (mOwner.overColumnDivid... |
d3403f70-0de7-4b0f-8d11-87815320a6e5 | 5 | public String execute() {
String ret = ERROR;
Connection conn = null;
try {
String URL = "jdbc:mysql://localhost/bookdatabase3";
String sql1 = new String();
ResultSet rs, rs1 = null;
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection(URL, "root", "123456789");
String sql ... |
c061ff8f-ae87-4a6e-8400-10e7fdc2e9f1 | 3 | public void run() {
try {
ProcessBuilder builder = new ProcessBuilder("/bin/bash");
builder.redirectErrorStream(true);
Process process = builder.start();
BufferedReader reader = new BufferedReader(
new InputStreamReader(process.getInputStream()));
BufferedWriter writer = new BufferedWriter(... |
f88c6e09-c2c9-4c25-92ce-d837e3e7808e | 9 | private static void writeNumber(final StringWriter writer, final Number object) {
if(object instanceof Byte
|| object instanceof Short
|| object instanceof Integer
|| object instanceof Long
|| object instanceof Float
|| object instanceof Double
|| object instanceof BigInteger
|| object ins... |
a311644f-7ca8-446c-ab5e-fb0cbb3c411f | 5 | @Override
public boolean tableExists(String table) {
ResultSet res = null;
table = table.replace("#__", prefix);
try {
DatabaseMetaData data = this.con.getMetaData();
res = data.getTables(null, null, table, null);
return res.next();
}catch (SQLException e) {
plugin.getLogger().log(Level.SEVERE,... |
bef9bae4-be22-438b-9e12-3a9639aee0fc | 7 | @Override
public void actionPerformed(final ActionEvent e) {
if (e.getSource() == bConnect) {
connect();
} else if (e.getSource() == bJoin) {
join(Integer.parseInt((String) nrPlayers.getSelectedItem()));
} else if (e.getSource() == aiList) {
if (aiList.getSelectedIndex() == 0) {
client.setIsPlay... |
a839682f-0a42-458e-b8fe-94f1ffae92a0 | 4 | public void move(){
//Randomly moves the enemy, no path checking
Random randomGenerator = new Random();
int randomInt = randomGenerator.nextInt(2);
if (randomInt==0){
locX++;
}else if (randomInt == 1){
locX--;
}
randomInt = randomGenerator.nextInt(2);
if (randomInt==0){
locY++;
}el... |
558eff56-871f-4cd6-a773-85ea9ee68a5f | 7 | public FeatureTemplate load(File file) throws IOException
{
FeatureTemplate featureTemplate = new FeatureTemplate();
BufferedReader reader = new BufferedReader(new FileReader(file));
String line;
for(int lineNum = 1 ; (line = reader.readLine()) != null; ++lineNum)
{
... |
29ce19b7-375c-4ed9-99df-38a55d3c7397 | 7 | @Override
public Explorable createExplorable(ProcessConfiguration config, IdGenerator idGenerator, Explorable origin, String type, Object... params) throws ExplorationException {
if (log.isLoggable(Level.FINEST)) log.finest("org.opencompare.explorable.RootFactory.newExplorable2(" + origin + ", " + type + ", " + Arra... |
85a231f6-293a-4a15-addd-38a7aaf9dc3d | 8 | public void deleteUser() {
int id_userTmp = -1;
System.out.println("ID :");
id_userTmp = Integer.parseInt(sc.nextLine());
UserDB user = null;
user = new UserDB(id_userTmp);
try {
user.read();
} catch (Exception ex) {
Logger.getLogger(Contro... |
d88f36d8-29e4-4d24-a752-08a2d49a4541 | 0 | public void setTitle(String title) {
this.title = title;
} |
53f9c695-f722-403e-8dc4-0db58c4f20c5 | 1 | @OnMessage
public void message(String message, Session client)
throws IOException, EncodeException {
for (Session peer : peers) {
peer.getBasicRemote().sendText(message);
}
} |
67ca1a6f-a25f-4ec2-af66-c185a95a7495 | 3 | private Object handleCont(Object tos, boolean insertNewLine) throws SAXException {
FieldRef fieldRef;
if (tos instanceof FieldRef) {
fieldRef = (FieldRef)tos;
}
else {
fieldRef = new FieldRef(tos, "Value");
}
if (insertNewLine) {
try {
fieldRef... |
7c17a820-3701-4434-ba40-ae8bee56c97e | 3 | public static void updateOrange() {
for (int i = 0; i < oOrgs.size(); i++) {
Organism g1 = oOrgs.get(i);
g1.move();
for (int j = i + 1; j < oOrgs.size(); j++) {
Organism g2 = oOrgs.get(j);
if (g1.getDist(g2) < 40) {
g1.closeTo(g2);
}
}
}
} |
a73d7d20-ba9c-439a-b745-e9ef0230e38e | 2 | public static int doctorSearch(Db db, LogAc logAc, String Username){
int i = 0;
while (logAc.getDoctor(i) != null){
if (Username.equals(logAc.getDoctor(i).userName))
return i;
i++;
}
return -1;
} |
cdb070d1-466a-45c2-a736-35805dc660c9 | 6 | public int getAverageScore(User user) {
PreparedStatement sumStatement = null;
PreparedStatement weekStatement = null;
PreparedStatement questionSumStatement = null;
Connection connection = null;
int avgScore = -1;
try {
try {
connection = data.getConnection();
... |
99849509-1c80-4261-bce0-d6ee84535eff | 9 | @Override
public void run() {
while(alive) {
Socket s = this.socketPipe.read_buffer();
if(s == null) {
continue;
}
try {
ObjectInputStream in;
Object[] o;
switch (state) {
case MAPPING:
in = new ObjectInputStream(s.getInputStream());
o = (Object[]) in.readObject();
in.c... |
7560a957-23bc-4899-805e-ae18dff8de07 | 1 | @Override
public int hashCode() {
int hash = 0;
hash += (areidArea != null ? areidArea.hashCode() : 0);
return hash;
} |
d31a103d-f229-41e9-aef8-a346877d83d5 | 2 | private void doSelectTest() {
System.out.println("[OUTPUT FROM SELECT]");
String query = "SELECT COF_NAME, PRICE FROM COFFEES";
try {
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery(query);
while (rs.next()) {
String s = r... |
0d83d1b5-a841-41b8-bbfe-566942c7bbf3 | 0 | public void rotate(int angle)
{
} |
938aec1f-0623-4bba-ad7b-311865e8ec04 | 4 | public static boolean isBlank(String str)
{
int strLen;
if (str == null || (strLen = str.length()) == 0)
{
return true;
}
for (int i = 0; i < strLen; i++)
{
if ((Character.isWhitespace(str.charAt(i)) == false))
{
ret... |
9c1800ff-3914-4c8b-83cb-6169fed2eb04 | 4 | Map getDeclaredInterfaces(CtClass clazz, Map map) {
if (map == null)
map = new HashMap();
if (clazz.isInterface())
map.put(clazz.getName(), clazz);
CtClass[] interfaces;
try {
interfaces = clazz.getInterfaces();
} catch (NotFoundException e) ... |
336136ba-2dbc-41da-b154-3182989109b7 | 5 | public void addListener(SequenceListener listener, int preOrPost) {
List<SequenceListener> toAdd = null;
SequenceGenerator gen = null;
if (preOrPost == POST) {
toAdd = postTrimListeners;
gen = (TrimmingListener) getListener(TrimmingListener.class, PRE);
}
if (preOrPost == PRE) {
toAdd = preTrimListen... |
537b7e90-883c-4015-af45-66719b972f58 | 7 | private static QuadTree sibling( QuadTree node, int[] ancestortype, int[] reverter )
{
int[] path = new int[MAXDEPTH + 1];
int pathlength = 0;
// recherche du plus proche ancetre commun
QuadTree ancestor = node;
while ( true )
{
if ( ancestor.type == -1 ) return null; // no common ancestor -> exit
p... |
c0cb39f6-b2d8-4596-9026-b3380b2a015e | 9 | @Override
public boolean okMessage(Environmental affecting, CMMsg msg)
{
if(!super.okMessage(affecting, msg))
return false;
switch(msg.sourceMinor())
{
case CMMsg.TYP_ENTER:
if((this.loyalShipItem!=null)
&&(msg.source().riding() == this.loyalShipItem)
&&(msg.target() instanceof Room)
&&(msg.sou... |
60d1b167-fbb2-4b27-a27b-5007c5b2c2bc | 9 | private double findSplitNominalNominal(int index) throws Exception {
double bestVal = Double.MAX_VALUE, currVal;
double[][] counts = new double[m_Instances.attribute(index).numValues()
+ 1][m_Instances.numClasses()];
double[] sumCounts = new double[m_Instances.numClasses()];
double[][] bestDist ... |
3eca5e80-944d-4c2c-9a8a-479fcff8eabe | 3 | public Component getListCellRendererComponent(
JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus) {
//这点代码基本上从DefaultListCellRenderer.java中抄袭的。
setCo... |
db65c616-3562-4080-ab13-367402dc2d68 | 2 | public GameServer (int port)
{
//Load data from files
loadAccounts();
System.out.println("Done loading users");
/* create socket server and wait for connection requests */
try
{
serverSocket = new ServerSocket (port);
System.out.println ("Server waiting for client ... |
68c70770-1e89-4053-b98b-f9ca06f25787 | 9 | @SuppressWarnings({ "rawtypes", "unchecked" })
private void decodeJSON_Array(ArrayList list, JSONArray value)
{
int len = value.length();
for(int i=0; i<len; i++)
{
Object o;
try {
o = value.get(i);
String keyType = "";
if(o instanceof Number)
{
keyType = JSONConst.TYPE_NUMER;
Ke... |
b181cffc-b4ed-4a10-bacc-f4ad78c1f30c | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="cjpBodyd" 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://downl... |
e4136844-f61c-408e-8406-379fde7c37c0 | 1 | public Constant newInteger(final int value) {
key1.set(value);
Constant result = get(key1);
if (result == null) {
result = new Constant(key1);
put(result);
}
return result;
} |
cf37d82c-035f-4916-8974-e7f295e93907 | 7 | protected List<Map<String, Object>> getMigrationMapFromUnderUtilizedHosts(
List<PowerHostUtilizationHistory> overUtilizedHosts) {
List<Map<String, Object>> migrationMap = new LinkedList<Map<String, Object>>();
List<PowerHost> switchedOffHosts = getSwitchedOffHosts();
// over-utilized hosts + hosts that are se... |
1d3dd051-8053-4459-9546-5c14080521a5 | 1 | private void doUrganceStuff(Patient patient) {
HospitalPart part = random.getHospitalizeRoom();
LinkedBlockingDeque<Patient> q = doc_queues.get(part);
q.add(patient);
patient.setHospitalized(true);
log("enter " + part + " Q", clock, patient, part.toString(), doc_queues
.get(part).size());
if (q.size() ... |
376ed38c-a2ae-4fe0-9158-a5faec4d4b40 | 2 | public void seek_notify()
{
frame_start = 0;
for(int ch=0;ch<2;ch++)
for (int j=0; j<576; j++)
prevblck[ch][j] = 0.0f;
br = new BitReserve();
} |
ead27bd7-c1be-4168-9dd8-787f13283a15 | 5 | public void Update(int xBound, int yBound) {
//Make sure model is fully initialized before running
if (!initialized) return;
//Find difference in time
long currentTime = System.currentTimeMillis();
double timeModifier = (currentTime-lastTick)/TICK_RATE;
//System.... |
251ea9ff-dfce-4a18-aeff-81773369d778 | 4 | public ArrayList<Libros> getAll(){
PreparedStatement ps;
ArrayList<Libros> libros = new ArrayList<>();
try {
ps = mycon.prepareStatement("SELECT * FROM Libros");
ResultSet rs = ps.executeQuery();
if(rs!=null){
try {
while(rs... |
5b80ea86-fb75-4479-8e58-ffa657a02d92 | 6 | private boolean aRight (int y){
boolean ret = false;
for (int i = 3 ; i > 0 ; i--){
if (grid.get(y).get(i) != null && grid.get(y).get(i-1) != null){
if (grid.get(y).get(i).getValue() == grid.get(y).get(i-1).getValue()){
grid.get(y).get(i).addValue(grid.get(y).get(i - 1).getValue());
//nulling
... |
0b18b0dc-1eb1-48ee-984d-2c1a8a143b26 | 8 | public void start()
{
if (this.isRunning || this.simulationResult != null) {
return;
}
this.latch = new CountDownLatch(this.nrOfWorkers);
int roundsPerWorker = getNrOfRoundsPerWorker(this.nrOfWorkers);
this.executor = Executors.newFixedThreadPool... |
c66f9c47-8b43-480b-a362-9eab3f35642a | 2 | @Override
public void init() {
// TODO Auto-generated method stub
if(this.ID == 1){
t.startRelative(.01, this);
t = new Temporizador(new MBT("Ola2 sou o "+this.ID));
t.startRelative(.02, this);
Iterator<Event> it = Runtime.eventQueue.iterator();
Event e;
while(it.hasNext()){
e = it.next();
... |
cc4a2de0-7e0c-4609-abdb-3b6d08633841 | 0 | public String getName() {
return delegate.getName();
} |
7036bdb1-2ec4-4b1b-84e5-069c2de094ae | 8 | public String askAction(){
boolean valid = false;
String string = null;
// print message with available options
System.out.println((this.message==null)? "" : this.message);
System.out.print("Select from (");
// show all options
for(String option:this.options){
System.out.print("|"+option+"|");
... |
24b4c6a3-43b4-4e87-a2c7-9f2fbd618f60 | 0 | public static void main (String [] args)
{
IntArrayBag bag = new IntArrayBag();
bag.add(10);
bag.addMany(1,2,3,4,10,100);
System.out.printf("getCapacity() = %d\n",bag.getCapacity());
System.out.printf("bag.size() = %d\n",bag.size());
System.out.println(bag.toString());
bag.remove(1);
Sy... |
a6a1b80e-f91f-4099-8757-f0e82993df0c | 7 | public void endElement(String uri, String localName, String qName) throws SAXException {
if (qName.equals("voyageur")) {
// we are no longer processing a <reg.../> tag
voyageurs.addElement(currentVoyageur);
currentVoyageur = null;
} else if (qName.equals("id_voyageur... |
f7256c10-2e32-40a0-8b5c-04365c467634 | 6 | @EventHandler
public void MagmaCubePoison(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.getMagmaCubeConfig().getDouble("MagmaCube... |
0f49fc1e-35d2-4bc8-a74b-a0a6758abfa2 | 8 | public static MapleNPC getNPC(final int nid) {
if (nid >= 9901000 && nid <= 9901551) {
final MapleNPCStats stats = new MapleNPCStats("", true);
final MapleNPC npc = new MapleNPC(nid, stats);
PreparedStatement ps = null;
ResultSet rs = null;
try {
Connection con = DatabaseConnection.getConne... |
3da57e9b-2c10-4dc2-beff-2fdc16eea356 | 4 | private static double nodalDelay(double speed, double proDelay, double packets, double distance){
if (speed <= 0 || distance <= 0) {
return (proDelay * packets) / 60;
} else if (proDelay <= 0 || packets <= 0) {
return (distance/speed) * 60;
} else {
// (dist... |
9f05a2ec-4dd3-4aa1-9196-fa20cce7d4bb | 9 | * @param type The type of migration occurring.
* @param random A pseudo-random number source.
* @param cs A <code>ChangeSet</code> to update.
*/
public void csEmigrate(int slot, MigrationType type, Random random,
ChangeSet cs) {
// Valid slots are in [1,3], recruita... |
efeb8cde-68cc-41ed-b4cf-2c13e8f4ed58 | 6 | public static List<Player> getPlayers(int gameid) throws SQLException {
String sql = null;
Connection connection = null;
PreparedStatement query = null;
ResultSet results = null;
try {
sql = "SELECT playerid, playername, points, notes, rolenotes, gameid from player wh... |
54019811-2b1f-428f-9f6a-a668ec7dd73d | 1 | public stackOps(int[] intArray) {
forSort = new Stack<Integer>();
for (int i = 0; i < intArray.length; i++) {
forSort.push(new Integer(intArray[i]));
}
} |
e79eead8-e9c8-4148-a757-7a01753c20e9 | 0 | @Override
public String toString(){
return "" + this.armorItem.toString();
} |
99c2ab6c-05bf-4ecb-9d1a-35614455e478 | 8 | public void startMovingToTarget(float maxVelocity)
{
// LET ITS POSITIONG GET UPDATED
movingToTarget = true;
// CALCULATE THE ANGLE OF THE TRAJECTORY TO THE TARGET
float diffX = targetX - x;
float diffY = targetY - y;
float tanResult = diffY/diffX;
... |
7a938b32-6d21-41be-b327-bdcc15fae2a0 | 8 | private static boolean a4 (int i, int j, BufferedImage image) {
boolean ul = ((image.getRGB(i-1, j ) == BLACK) ||
(image.getRGB(i-1, j+1) == BLACK) ||
(image.getRGB(i , j+1) == BLACK));
boolean with = ((image.getRGB(i-1, j-1) == WHITE) &&
... |
76617c2a-8a0b-42c5-930a-b4f08c673a5a | 5 | @Command(command = "freeze",
arguments = {"target player[s]"},
description = "freezes the target players in their place",
permissions = {"freeze"})
public static boolean freeze(CommandSender sender, String targetPlayer) throws EssentialsCommandException {
// get a list of all target players
ArrayList<Play... |
58926f68-20ca-468f-a958-f8a3def6162d | 7 | public ArrayList<String> process(ArrayList<String> tokens){
ArrayList<String> processed_tokens = new ArrayList<String>();
for( String token: tokens ){
if( stoplist == null ||
!stoplist.contains(token.toLowerCase()) )
{
if( lowercase ){
token = token.toLowerCase();
}
if( stem ){
... |
13d57423-38f4-42b9-b77a-8951c7560bac | 6 | private boolean onCommandList(Player player, String[] args){
int p = 10;
if(args.length == 2){
try{
p = Integer.parseInt(args[1]);
} catch (Exception e){}
}
if(p < 0) p = 10;
Message.send(player, 8, p);
ArrayList<LastActivity> las = new ArrayList<LastActivity>();
Set<String> set = LastA... |
c2f66e02-ef91-43ed-8018-067ae7644878 | 6 | private static String establishConnectionString(CommandLineWrapper pCommandLine){
String lConnectionString;
String lCmdLineJDBC = pCommandLine.getOption(CommandLineOption.JDBC_CONNECT_STRING);
if(!XFUtil.isNull(lCmdLineJDBC)){
//1) if specified in full, use that
lConnectionString = lCmdLine... |
4b6dc024-4a4f-4a01-b50d-6cc60dd87702 | 9 | @Override
public double[] updatePlanes(ArrayList<Plane> planes, int round, double[] bearings) {
//logger.info(round + " "+ planes.get(1).getLocation());
for(int i = 0; i < planes.size(); i++) {
if (planes.get(i).getLocation().distance(planes.get(i).getDestination())<=2) {
} else if(dynamicPlanes.contains(i) ... |
6d4a3ad1-897b-4be2-8e9e-f756d7ef27fe | 8 | public List<P2S1B1> lookup(String binaryKey, final short[] states) {
List<P2S1B1> res = new ArrayList<P2S1B1>();
List<P2S1B1> caches = cacheDir.get(binaryKey);
P2S1B1 csp;
boolean b;
if (caches != null) {
for (int i = 0; i < caches.size(); i++) {
csp = caches.get(i);
b = false;
for (int j = 0; ... |
3f237e28-aad3-401e-8ca9-f2172e77610a | 1 | public void sendCodeMove(String code){
check(isMyTurn() && currentMove == CODE);
int maxDigit = (Integer)state.get(MAXDIGIT);
check(masterMindLogic.checkValidCode(code, maxDigit));
this.sendCodeOperation(coderId, guesserId, code);
} |
74a58409-035d-4841-bcca-78be4231c644 | 6 | public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int a = s.nextInt();
int b = s.nextInt();
int c = s.nextInt();
int d = s.nextInt();
if(b > c && d > a && c + d > a + b && c >= 0 && d >= 0 && a % 2 == 0){
System.out.println("Valor... |
583b4aa3-8e45-4dbe-b086-e1333a59414d | 5 | public Matrix forwardSubstitution(Matrix b) {
if(rows != cols) {
throw new IllegalArgumentException("Matrica nije kvadratna!");
}
if(b.rows != rows || b.cols != 1) {
throw new IllegalArgumentException("Krivi format vektora!");
}
double[] y = new double[rows];
for(int i = 0; i < rows; i++) {
... |
18799fb0-7af2-4044-b79e-cb04438688b9 | 0 | public Integer getMemoryLimit() {
return this.memoryLimit;
} |
17e1e726-2cd7-45e6-ab0d-b98e7a0ad43a | 8 | public TileEntity getBlockTileEntity(int par1, int par2, int par3)
{
if (par2 >= 256)
{
return null;
}
else
{
Chunk var4 = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4);
if (var4 == null)
{
return null;
... |
96544411-84be-4201-aa55-711f6fe9505d | 2 | public int length() {
if (_map != null && _map.length > 0) return _map.length * _map[0].length;
return 0;
} |
c1da79e8-de9c-481e-b51b-f1b607ee730f | 2 | public static void main(String args[]) {
double inches, metres;
int counter;
counter = 0;
for(inches = 1; inches <= 144; inches++) {
metres = inches / 39.37;
System.out.println(inches + " inches is " + metres + " metres.");
counter++;
if (counter == 10) {
System.out.println();
counter = 0;
... |
616115e6-6eeb-426b-8ae4-58c8e7d4bc5a | 2 | public static void main(String args[]){
setUpDisplay();
setUpOpenGL();
setUpEntities();
setUpTimer();
System.out.println(bat.getX() + " , " + bat.getY());
while (isRunning) {
System.out.println(ball.getX() + " , " + ball.getY());
render();
... |
6f2a671d-53a7-4656-b4ad-cf5fd4d149f1 | 9 | @SuppressWarnings("rawtypes")
protected Object createDataNode(Class<?> root, Object parent, String field) {
Class<?> pclass = parent.getClass(), clz;
try {
if (List.class.isAssignableFrom(pclass)) {
return new Data();
}
if (Map.class.isAssignableFrom(pclass)) {
return new Data();
}
clz = pcl... |
b3abd618-f706-49ec-be01-0c0272774873 | 6 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
BitSet prices = new BitSet(1000002);
while ((line = in.readLine()) != null && line.length() != 0) {
int size = Int... |
00dd7e34-ad88-4b4b-8b72-c9c842c65bf4 | 2 | private void setupPermissions() {
Plugin permissionsPlugin = this.getServer().getPluginManager().getPlugin("Permissions");
if (this.permissionHandler == null) {
if (permissionsPlugin != null) {
this.permissionHandler = ((Permissions) permissionsPlugin).getHandler();
SheepFeed.log("Permissions plugin det... |
a76087de-fbab-40e6-8724-f7c56d8919e0 | 6 | public Highscore(final Spel spel) {
setBounds(0, 0, 800, 600);
setLayout(new MigLayout("", "[grow][400px:n][grow]", "[80.00][450.00,grow][40.00][10.00,grow]"));
JLabel lblNewLabel = new JLabel("Highscores");
lblNewLabel.setForeground(Color.WHITE);
lblNewLabel.setFont(new Font("Lucida Grande", Font.PLAIN, 40)... |
ff230654-ecc5-4da2-912b-170a8742d138 | 0 | public String getId() {
return id;
} |
78457baf-91eb-4e37-960b-e8317a2ba394 | 4 | @Override
public void doTask()
{
if (!playing.isRunning())
{
if (isLooping)
{
Clip temp = playing;
while (temp.equals(playing))
{
temp = Utils.getRandomItem(clips);
}
this.playing = temp;
playing.start();
}
else if(!started)
{
close();
}
}
} |
440a8daf-7a03-4848-b8da-6c74a38eed4c | 2 | public static void main (String[] args) {
if (args.length < 3){
System.out.println("Please specify the user that starts the app");
return;
}
ArrayList<String> files = new ArrayList<String> ();
File dir = new File(args[0]);
for (String filename : ... |
64b2d6eb-d050-4bdf-83f0-0d95cfeccf03 | 9 | public void paint(Graphics g) {
fillBackground(g);
drawWalls(g);
drawLives(g);
drawPellets(g);
drawScore(g);
drawGhosts(g);
drawPlayer(g);
drawBorder(g);
if (board.gameFrame != 0) {
handleGameStartFrames();
return;
... |
1c37e94c-8775-460d-8243-c37084a279d1 | 3 | public String version_string()
{
switch (h_version)
{
case MPEG1:
return "MPEG-1";
case MPEG2_LSF:
return "MPEG-2 LSF";
case MPEG25_LSF: // SZD
return "MPEG-2.5 LSF";
}
return(null);
} |
6c28956e-2b00-4bf7-8c86-a798b12c95b5 | 1 | public void testConstructor_long_long3() throws Throwable {
DateTime dt1 = new DateTime(2005, 7, 10, 1, 1, 1, 1);
DateTime dt2 = new DateTime(2004, 6, 9, 0, 0, 0, 0);
try {
new Interval(dt1.getMillis(), dt2.getMillis());
fail();
} catch (IllegalArgumentException e... |
0db4a766-1890-485f-860b-d2bf6a843313 | 4 | public String genElement(){
rand = new Random();
elementRoll = (rand.nextInt(4)+1);
switch(elementRoll){
case 1:
element = "Air";
break;
case 2:
element = "Earth";
break;
case 3:
element = "Fire";
break;
case 4:
element = "Water";
break;
default:
System.out.println("element... |
dbc95136-ad76-4dae-aef4-085c805db2d9 | 3 | /* */ @EventHandler(priority=EventPriority.HIGHEST)
/* */ public void onPlayerGameModeChange(PlayerGameModeChangeEvent event)
/* */ {
/* 277 */ if (!event.isCancelled())
/* */ {
/* 279 */ if (Main.getAPI().isBeingSpectated(event.getPlayer()))
/* */ {
/* 281 */ for (... |
5d7dd13d-89a2-4810-b433-65745dc25a07 | 5 | public String getRadixString(int radix) {
String result = "";
switch (radix) {
case 2:
result = "Binary";
break;
case 8:
result = "Octal";
break;
case 10:
result = "Decimal";
break;
case 16:
result = "Hexadecimal";
break;
case 18: //mask question
result = "mask";
... |
19f850eb-259b-46c4-acfa-f278294b7f52 | 8 | private void jTextField1FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField1FocusLost
if(!nombreAntiguo.equals(jTextField1.getText())){
int i = JOptionPane.showConfirmDialog(frame, "Seguro que quieres cambiar el nombre del Rol: "+nombreAntiguo+
"\npor "+jTextField1... |
32e9a9ac-9c5a-42e1-85bd-1655689a82f4 | 7 | @Override
public void doSteps(){
stuck = true;
double etime = System.currentTimeMillis() + repTime;
int i = 0;
while(( (nrOfSteps > 0 && i < nrOfSteps)
|| (repTime > 0 && System.currentTimeMillis() < etime) )){
// run Local Search step
nh.... |
9cc53e73-6849-41f0-9e8b-7c4616b4b9ec | 2 | public static void main(String[] args) throws IOException {
String[] tokens = readTokens();
System.out.println("Tokens: " + Arrays.toString(tokens));
System.out.println("Combinations:");
for (int i = 0; i < tokens.length; i++) {
for (int j = i; j < tokens.length; j++) {
... |
4d11c09f-662a-40fb-b720-76381f589e05 | 0 | private static void cancel() {
dialog.hide();
} |
09a69a27-05d9-4f65-8cf5-2731c0ef91e6 | 8 | public void run() {
try {
boolean eos=false;
byte[] buffer=new byte[8192];
while(!eos) {
OggPage op=OggPage.create(source);
synchronized (drainLock) {
int listSize=pageOffsets.size();
long pos=
... |
39b3bcb3-4602-4bca-a90f-d62aed4c4419 | 5 | private void getCurrentMods() {
listModel.removeAllElements();
String updateableMods="";
if(modDir!=null){
listModel.addElement("base");
for(int i=0; i<modDir.length; i++){
listModel.addElement(modDir[i]);
String modname = modDir[i];
if(tglbtnAlertOnModUpdateAvailable.isSelected()) {updateableMo... |
6cd3110f-0373-4ed9-a0ca-949dc729ff49 | 1 | public void spider(Boolean mode){
if (mode != null){
spider = mode;
}else{
spider = true;
}
} |
d798292e-87c7-40aa-85e2-c0485f3c9bb7 | 6 | public int endRoundScore(int team) {
int ret = 0;
for (ArrayList<Group> a : board.get(team).values()) {
for (Group g : a) {
ret += g.getScore();
}
}
for (int i = 0; i < numPlayers; i++) {
if (i % 2 != team)
continue;
for (Card c : players[i].getFoot()) {
ret -= c.getPoints();
}
for... |
51afcc4c-3b3a-41fb-85d6-195d0899409b | 0 | @Override
public void execute(VirtualMachine vm) {
vm.loadRunTimeStack(offset);
} |
d6e157f2-fa5e-4a09-bf98-06e4bb63300b | 8 | @Override
public void e(float sideMot, float forMot) {
if (this.passenger == null || !(this.passenger instanceof EntityHuman)) {
super.e(sideMot, forMot);
this.W = 0.5F; // Make sure the entity can walk over half slabs,
// instead of jumping
return;
}
EntityHuman human = (EntityHuman) this.passe... |
bb8beefb-4f43-43ef-9463-6b23fcdbf4d5 | 2 | public void setWindowScreen() {
JFrame w = (JFrame) vc.getFullScreenWindow();
if (w!=null && fullScreen) {
w.dispose();
vc.setFullScreenWindow(null);
w.setUndecorated(false);
w.setVisible(true);
fullScreen=false;
}
} |
214c112f-6eca-49db-b6f5-fa188ead1bf2 | 2 | public void initializeArray(){
for(int i=0;i<rows;i++)
for(int j=0;j<columns;j++)
table[i][j]=-1;
} |
debb495c-ae21-4491-b651-a80fa7a99aca | 4 | private void lifeCycle() {
String s = "";
int attempt_number = 0;
do {
try {
s = readInput();
if (s.length()==0) {
break;
}
if (isValidInput(s))
{
results[attempt_number] = getCalculationResult(Integer.parseInt(s));
attempt_number++;
} else {
System.o... |
a1b41fa0-f6dc-4302-a710-cadc250e54e8 | 7 | public void act()
{
if (Greenfoot.isKeyDown("space")) //Tests if space key is down
{
start = true; //When start is true the next if will start play
}
if (start == true)
{
play(); //This runs the code for making the cat move up... |
aec40d7d-feb7-4842-ba30-973c9577cd3c | 2 | public Class getTypeClass() throws ClassNotFoundException {
if (topType.isClassType() || !bottomType.isValidType())
return topType.getTypeClass();
else
return bottomType.getTypeClass();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.