method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
f7c44988-2dfb-4bc0-9f03-312d62bfee00 | 9 | private void loadDrop(final int npcId) {
npcIdLabel.setText(Integer.toString(npcId) + " " + NPCDefinitions.getNPCDefinitions(npcId).name);
ArrayList<Drop> drops = loader.getDropArray().get(npcId);
DefaultTableModel model = new DefaultTableModel();
model.addTableModelListener(new TableMod... |
badc84b4-ab1d-4811-848a-cb97fb1845d7 | 0 | public void removeAll() {
imageTemplateRepository.removeAll();
} |
d63373b4-1fae-47b0-b848-cbecebaf6d6c | 2 | private void placeEquationParameters() {
equationParametersPanel.setLayout(gridBagLayout);
//Create GridBagConstraints
GridBagConstraints constraints = new GridBagConstraints();
constraints.anchor = GridBagConstraints.NORTHWEST;
constraints.insets = DEFAULT_INSETS;
const... |
6b60b674-c9bc-4212-b1f5-db6e96b875c1 | 0 | public float convertRADAngleIntoFOV(float angle) {
return cam.convertRADAngleIntoFOV(angle);
} |
4c68262e-20b5-45e6-adfd-5d7c99d05b82 | 1 | public void connect(String host, int port) {
bootstrap = new ClientBootstrap(new NioClientSocketChannelFactory(
Executors.newCachedThreadPool(),
Executors.newCachedThreadPool()));
handler = new MqttMessageHandler();
handler.setListener(listener);
bootstrap.setPipelineFactory(new ChannelPipelineFactory(... |
a21787ce-94a8-4877-8dd2-38c0a9aebbae | 6 | public static Object[][] getData(String testName,Xls_Reader excel){
/*
* this will tell you where the test starts from
*/
int testCaseStartIndex=0;
for(int rNum=1;rNum<=excel.getRowCount("test data"); rNum++){
if(testName.equals(excel.getCellData("test data", 0, rNum))){
testCaseStartIndex=rN... |
f649af50-26ae-427f-ad90-5ee9f307cabe | 6 | public int getDPadX() {
int povValue = joystick.getPOV();
if (povValue == 0 || povValue == 180 || povValue == -1){
return 0;
} else if (povValue == 270 || povValue == 315 || povValue == 225){
return -1;
} else {
return 1;
}
} |
c538ff8f-4fa7-449f-a26b-66c9919b4b4d | 5 | public static int greenTicket( int a, int b, int c )
{
if ( a == b && b == c )
{
return 20;
}
if ( a == b || b == c || a == c )
{
return 10;
}
return 0;
} |
984a2094-77f2-4af4-91b0-6b787f0793dc | 8 | public IdCount[] getTop(int topN) {
final TreeSet<IdCount> topList = new TreeSet<IdCount>(new Comparator<IdCount>() {
public int compare(IdCount a, IdCount b) {
return (a.count > b.count ? -1 : (a.count == b.count ? (a.id < b.id ? -1 : (a.id == b.id ? 0 : 1)) : 1)); // Descending ord... |
757fd02e-52af-42a8-93df-20ac5495e5c1 | 2 | public void update(long deltaMs) {
cameraX += cameraSpeedX;
cameraY += cameraSpeedY;
if(cameraX < 0) {
cameraX = 0;
}
if(cameraY < 0) {
cameraY = 0;
}
} |
8d0d3693-f45a-4956-a30e-bad74148be27 | 8 | public void render() {
GL11.glPushMatrix();
setRenderLoc(2);
renderColor(Colors.boxColor);
if (!(this.open && this.type==0))
{
renderSingleModel(this.model);
}
GL11.glPopMatrix();
GL11.glPushMatrix();
setRenderLoc(1);
if (this.open && this.type!=0) {
if (type==-1)
{
rend... |
02a431e8-3bb9-4cf3-bf3e-057202dcdd63 | 8 | public Updater(Plugin plugin, int id, File file, UpdateType type, boolean announce) {
this.plugin = plugin;
this.type = type;
this.announce = announce;
this.file = file;
this.id = id;
this.updateFolder = plugin.getServer().getUpdateFolder();
final File pluginFile... |
d98ec797-6547-4d60-8c7d-afd9b627c726 | 9 | public static void line(int x1, int y1, int x2, int y2, PointMarker marker) {
// delta of exact value and rounded value of the dependant variable
int d = 0;
int dy = Math.abs(y2 - y1);
int dx = Math.abs(x2 - x1);
int dy2 = (dy << 1); // slope scaling factors to avoid floating
int dx2 = (dx << ... |
fab1c220-c48a-49f1-b175-b22c00bd9273 | 2 | private boolean isUnderMouse(int x, int y) {
if(Math.abs(x-meX)<width && Math.abs(y-meY)<height )
return true;
return false;
} |
2c24e8df-194e-4fa4-8273-144190acc25e | 9 | public boolean instant_win(){
if(this.dievalue1!=4&&this.dievalue2!=4&&this.dievalue3!=4)
return false;
else if(this.dievalue1!=5&&this.dievalue2!=5&&this.dievalue3!=5)
return false;
else if(this.dievalue1!=6&&this.dievalue2!=6&&this.dievalue3!=6)
return false... |
14b080d3-0864-43fd-9512-31af8094d059 | 0 | public void setLongitude(double longitude)
{
this.longitude = longitude;
} |
f30dcb50-09fb-4b49-82e2-b701f88516f1 | 5 | public Vector<Case> getNearestNeighbors(Case NewCase, String type, double []Attributesweights)
{
Vector<Case> neighbors = new Vector<Case>();
Vector<Double> distances = new Vector<Double>();
Vector<DistanceCase> sortingCases = new Vector<DistanceCase>();
if (type=="Euclidean Distance")
{
for (in... |
3d55fefd-a799-4ed6-ba50-aa4a702105a7 | 8 | private boolean doAddAll( Collection<? extends E> c, boolean strong ) {
vacuum();
int num = c.size();
if( num == 0 )
return false;
if( num > mThreshold ) {
int targetCap = (int)(num / mLoadFactor + 1);
if( targetCap > MAXIMUM_CAPACITY )
... |
837cf98b-2f2c-48b5-a2ee-400cf3b014a7 | 4 | public void insertID_CitationList() {
String insert = "insert into idcitationlist(indexid,citationlist) values(?,?)";
String query = "select distinct indexid from dblpcitation order by indexid asc";
ResultSet rsSet = null;
rsSet = sqLconnection.Query(query);
int count = 0;
try {
PreparedStatement stateme... |
8468b077-10c8-4011-9e46-be346947592b | 5 | private void remonterNoeudUnCran(NoeudArbre<E> noeud) {
assert (noeud.pere != NIL) : "Noeud.pere = NIL";
// père du noeud
NoeudArbre<E> p = noeud.pere;
// fils droit du noeud
NoeudArbre<E> d = noeud.filsDroit;
// fils gauche du noeud
NoeudArbre<E> g = noeud.filsGa... |
7489e13f-c9da-4664-949f-d17315afb94a | 9 | public static void move(File pSrc, File pDst, boolean pForce) throws IOException {
// Check for invalid arguments
if (pSrc == null || !pSrc.canRead()) {
throw new IOException("FileHelper.ReadError" + (pSrc == null ? "" : pSrc.getAbsolutePath()));
}
if (pDst == null || !pDst... |
f8fd6d4a-d5fa-4b52-a1fd-604a65e78e72 | 8 | public int checkLogin(String loginID, String loginPW ) {
int result = 0;
String sql = "select * from user WHERE `ID`=?";
try {
con = getConnection();
pstmt = con.prepareStatement(sql);
pstmt.setString(1, loginID);
rs = pstmt.executeQuery();
while (... |
49b8dce0-b536-42de-be43-3bfda6e398fe | 3 | public static SkeletonPacket create(OggPacket packet) {
// Special header types detection
if(isSkeletonSpecial(packet)) {
byte type = packet.getData()[3];
switch(type) {
case (byte)'h': // fishead
return new SkeletonFishead(packet);
case (byte)'b'... |
2e43fe76-0ba4-4fd6-9a0e-7fbbc4374ccb | 0 | @Test
public void test_get_property()
{
Assert.assertEquals("www.google.com", getProperty("b_remote_host"));
} |
966097b7-70af-4010-a139-66a968233635 | 6 | @Override
public void input(float delta) {
float movAmt = speed * delta;
if (Input.getKey(forwardKey))
move(getTransform().getRot().getForward(), movAmt);
if (Input.getKey(backKey))
move(getTransform().getRot().getForward(), -movAmt);
if (Input.getKey(leftKey))
move(getTransform().getRot().getLeft(),... |
a792959f-023b-4a65-b88a-aea9f78a5c21 | 8 | public Type getType(String fullyQualifiedTypeName)
{
Type result = null;
if (fullyQualifiedTypeName != null)
{
if (this._types.containsKey(fullyQualifiedTypeName))
{
result = this._types.get(fullyQualifiedTypeName);
// make sure we tag this type with all browser types
if (this._browser != nul... |
56c5320f-e4a5-473e-9df0-a7c9d906849a | 6 | private String POST_Request(String url, String url_params) {
StringBuffer response;
String json_data = "";
HttpsURLConnection con = null;
try {
con = (HttpsURLConnection) set_headers(url);
con.setDoOutput(true);
con.setRequestMethod("POST");
con.setRequestProperty("User-Agent", "Mozilla/5.0 ( compat... |
f1deb23e-8849-4659-a82b-a15201cd540e | 0 | @Test
public void testGetS1() {
System.out.println("getS1");
Flip instance = new Flip(3,6,9);
int expResult = 6;
int result = instance.getS1();
assertEquals(expResult, result);
} |
252bdf15-966f-44cd-bdce-01900acdf634 | 3 | @EventHandler
private void ede(EntityDamageEvent evt) {
if (evt.getEntity() instanceof Player && evt.getCause() == DamageCause.FALL) {
Player p = (Player) evt.getEntity();
if (exempt.contains(p.getName())) {
exempt.remove(p.getName());
evt.setCancelled(true);
}
}
} |
ef1cb7e2-ee42-4eb0-83f0-10c61227b16f | 3 | public void reduceStresses() {
// Do a look-ahead stress reduction- if current and next unit have stress,
// reduce the current
for (int i=0; i < stresses.length - 1; i++) {
if (stresses[i] && stresses[i + 1])
stresses[i] = false;
}
} |
869560aa-ea90-424c-9274-85891ad75c73 | 9 | public void run(RobotController rc) throws GameActionException {
if (rc.isActive()) {
// Spawn a soldier
Direction dir = rc.getLocation().directionTo(rc.senseEnemyHQLocation());
if (rc.canMove(dir)&&(rc.getTeamPower()>130)) {
if(doResearch... |
b8e1d23c-325e-4aec-a20b-d4de4aed64ce | 4 | @Override
public void onPlayerDropItem(PlayerDropItemEvent event) {
if (event.isCancelled()) {
return;
}
if (!this.config.yml.getBoolean("Creative Players.Disable Item Dropping", true)) {
return;
}
Player player = event.getPlayer();
if (player.... |
680438eb-7859-4c8b-8cc3-e82b454c4fc0 | 0 | public static void main(String[] args) {
ArrayList list = new ArrayList();
} |
fc44d3f2-9826-4095-9c87-66ae564b86a8 | 8 | @Override
public String toString() {
return "DetailedFunction {"
+ (extReferences != null ? " extReferences [" + extReferences + "]" : "")
+ (cls != null ? " cls [" + cls + "]" : "")
+ (recommendedValue != null ? " recommendedValue [" + recommendedValue + "]" : "")
+ (quality != null ? " q... |
332b6f87-bf94-4c67-8732-a165d0625929 | 0 | public void setIntelligentX(int intelligentX) {
this.intelligentX = intelligentX;
} |
136ac828-a996-4283-aec5-4677e49f0200 | 0 | public static void setDefault()
{
breeding_age = 1;
max_age = 100;
breeding_probability = 0.02;
max_litter_size = 100;
} |
5f6d0189-01cc-4e86-8fa8-c20539b806b3 | 7 | @Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
Object source = e.getSource();
String command = e.getActionCommand();
if(command.equals("Exit"))
{
exitApplication();
}
else if (command.equals("Save"))
{
Serialize s = new Serialize(p, l);
s.saveTo... |
138791a2-c260-4fa5-b032-5f24e97add03 | 8 | public void actionPerformed(ActionEvent ev) {
if (ev.getActionCommand().equals("open")) {
UIManager.put("FileChooser.readOnly", true);
JFileChooser fileChooser = new JFileChooser();
FileExtensionFilter filter = new FileExtensionFilter();
filter = new FileExtensionFilter();
... |
7d166f62-b330-4133-a23a-d75be613bad4 | 3 | public Elements combine(Elements e)
{
Elements returnE=NONE;
switch(this)
{
case NONE:
returnE=e;
break;
case AIR:
break;
case EARTH:
break;
}
return returnE;
} |
4cd111b4-6295-4ef1-a309-643eb1a8fd49 | 7 | public int[] makeBuildOrderArray(int i) {
double[] percentage_to_use = new double[FacilityHierarchy[i].length];
double[] how_often_to_add=new double[FacilityHierarchy[i].length];
double[] current_queue=new double[FacilityHierarchy[i].length];
double next_up;
int the_next_one;
double norm = 0.;
int[] the_... |
c8a43dcf-c6f8-4541-9d55-c20b41c70a29 | 7 | public boolean isSubtree(TreeNode largeTree, TreeNode smallTree){
if(largeTree == null || smallTree == null){
return false;
}
//BFS on large tree
Queue<TreeNode> BFSQueue = new ArrayDeque<TreeNode>();
BFSQueue.add(largeTree);
while(!BFSQueue.isEmpty()){
... |
4fb97f1e-0f91-45e8-adcc-08a69cb6106e | 3 | @Override
public boolean hasStack(ItemStack stack) {
for(int i = 0; i < inventory.length; i++)
if(getStackInSlot(i) != null && getStackInSlot(i).getItem().equals(stack.getItem()))
return true;
return false;
} |
9b20a6d1-09ce-4348-87ca-c9858ed63198 | 9 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(sender instanceof Player) {
UPlayer player = plugin.getPlayerManager().getUPlayer(sender.getName());
if(player == null) return true;
if(!StaffRank.isEqualOrGreater(player, StaffRank.HELPER) && player.getL... |
821ddc1e-8198-4558-9440-fc9ea74c8d7e | 2 | private final static byte[] getAlphabet( int options ) {
if ((options & URL_SAFE) == URL_SAFE) {
return _URL_SAFE_ALPHABET;
} else if ((options & ORDERED) == ORDERED) {
return _ORDERED_ALPHABET;
} else {
return _STANDARD_ALPHABET;
}
} // end getAlp... |
dd881eee-77aa-4c75-82e8-0ae133797225 | 3 | public void mmousemove(Coord mc) {
if(!dm)
return;
Coord tc = mc.div(MCache.tileSize);
Coord c1 = new Coord(0, 0), c2 = new Coord(0, 0);
if(tc.x < sc.x) {
c1.x = tc.x;
c2.x = sc.x;
} else {
c1.x = sc.x;
c2.x = tc.x;
... |
4bf01b4b-5e51-408a-9baf-141f8b7cdbec | 8 | @Override
protected ReturnValue doInBackground() throws Exception {
startTime = System.nanoTime();
//clear out anything still left in the DB
// (note that we do this in a lazy manner)
mStatement.execute("DROP ALL OBJECTS");
// Unlike phase 1, the script is not given to us in a file,
// so we woul... |
3ab0e00e-60a2-4f13-b896-518c82890359 | 9 | public void layout() {
if (tree == null || tree.isDisposed())
return;
if (item == null || item.isDisposed())
return;
int columnCount = tree.getColumnCount();
if (columnCount == 0 && column != 0)
return;
if (columnCount > 0 && (column < 0 || column >= columnCount))
return;
super.layout();
} |
2d064790-e941-4ccb-aa56-f0222f6059d1 | 9 | private synchronized void coreClient() {
LinkedList subscriptions = new LinkedList();
// Waiting for the broker...
try {
wait(BROKER_STARTUP_TIME * 1000);
} catch (InterruptedException e2) {
e2.printStackTrace();
}
// Opening connection with the local broker
try {
srv.open();
} catch (ConnectEx... |
9971cd58-3d73-4df4-b333-f6fad7c1fb8e | 2 | public Matrix(int rows, int columns) {
matrix = new int[rows][columns];
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < matrix[i].length; j++) {
matrix[i][j] = 1;
}
}
} |
8e4cd27c-fe0c-474a-8ca5-9eccb7104604 | 4 | private void updateTops() {
try {
CTT.debug("Updating Top Kills");
ResultSet rs = sql.query("SELECT player,kills FROM ctt_stats ORDER BY kills DESC");
plugin.getTopKills().clear();
int r = 1;
while (rs.next()) {
plugin.getTopKills().put... |
c454c5ae-c8fb-4155-94a6-5a16a3ed9c9a | 3 | boolean atEnd()
{
return (x==parent.B.length-1 && x-index==parent.A.length)
|| (x == parent.B.length && x-index>=parent.A.length-1);
} |
b9c32f84-83de-4fa0-9f90-4c732749729f | 2 | public synchronized void saveBlock(Block b) {
if(b.getIndex() != this.index)
return;
if(completed)
return;
this.blocks.put(b.getOffset(), b);
this.checkCompleted();
} |
2acbba20-405f-4fb5-b877-86d1de4dd5c4 | 5 | public IrcHandler() {
configure();
if (debug) {
System.out.println("Activate options");
}
if (buffertype.equalsIgnoreCase("autopop")) {
eventQueue = new Fifo(buffersize, Fifo.AUTOPOP);
} else if (buffertype.equalsIgnoreCase("refuse")) {
eventQueue = new Fifo(buffersize, Fifo.REFUSE);
} else {
... |
d007b086-7896-42ed-bba3-dc24e3ac6e03 | 7 | public GuiSlotStatsItem(GuiStats par1GuiStats)
{
super(par1GuiStats);
this.field_27275_a = par1GuiStats;
this.field_27273_c = new ArrayList();
Iterator var2 = StatList.itemStats.iterator();
while (var2.hasNext())
{
StatCrafting var3 = (StatCrafting)var2.n... |
eb07a6b5-31fb-4d2b-8694-6693751e920f | 8 | public boolean mousedown(Coord c, int button) {
if (button == 1) {
if (ui.modshift)
wdgmsg("xfer");
else
wdgmsg("click");
return (true);
} else if (button == 3 && ui.modshift) //Kerri
{
if (boxValues != null) {
... |
63e46563-30cc-4945-abcc-2ee909e94184 | 0 | @Override
public String toString() {
return name;
} |
58cc070c-ad69-458e-9d9e-3f1076d6e59b | 3 | private void setLoanTermInYears(Loan loan) throws LoanEntryException {
String termYears_str = readLoanTermInYears();
// Loan term in years
float termYears = 0; // in years
try {
termYears = (termYears_str != null)?
Float.parseFloat(... |
97beee31-1c6c-46c6-949f-edafb1f5b8d0 | 0 | @Override
public String getMessageTextAsHTML() {
String msg = "";
msg += "<font color="+Constants.NOTIFICATION_COLOR+">";
msg += name + " " + settings.getLanguage().getLabel("text_leftchat");
msg += "</font>";
return msg;
} |
101ce7d9-e7b6-4ce2-b525-2f26da76cb18 | 7 | @Override
public void keyPressed(KeyEvent e) {
if (!changed) {
if (e.getKeyCode() == KeyEvent.VK_DOWN) {
selection = (selection + 1) % choices.size();
} else if (e.getKeyCode() == KeyEvent.VK_UP) {
selection = Math.abs(selection - 1) % choices.size();
... |
d3eb573e-863e-4155-ba3b-2d7672aa41c2 | 2 | private static boolean delete(File file) {
if (file.isDirectory()) {
File[] children = file.listFiles();
for (File f : children) {
delete(f);
}
}
return file.delete();
} |
868cbc50-0662-43c3-ac91-264a24582c49 | 2 | private void centrerTable(JTable table) {
((DefaultTableCellRenderer)table.getTableHeader().getDefaultRenderer()).setHorizontalAlignment( JLabel.CENTER );
table.getTableHeader().setForeground(Color.RED);
if(table.getRowCount()!=0)
table.setRowSelectionInterval(0, 0);
DefaultTableCellRenderer custom = ... |
38d96cc9-508d-4e34-8b78-838116d5c08a | 4 | public int[] collectPV(Board board, int current_depth) {
int[] arrayPV = new int[128];
int move = getMove(board.zobristKey);
// int i = current_depth;
int i = 20;
int index = 0;
while (i > 0) {
if (move == 0 || !board.validateHashMove(move))
break;
arrayPV[index] = move;
board.makeMove(move);
... |
15c05640-190e-42aa-add9-0fcf034b0095 | 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 fe... |
c0351b5e-9344-412e-8a29-725de5c2911c | 4 | @Override
public void process(IMessage message) {
if (message instanceof JobMetaData) {
JobMetaData meta = (JobMetaData) message;
meta.setId(this.jobcounter);
this.jobcounter++;
System.out.println("DEBUG: Received JobMetaData" + meta.getId() + " from " + meta.getSender());
this.monitor.addjobWaiti... |
bff0af71-c881-4df8-a957-83a738f7f7bb | 5 | public static void main(String args[]) {
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (Exception e) {
// If Nimbus i... |
e8f8d7f3-b7f9-48ed-811f-18634054b32b | 7 | private static <T> List<T> execute4Been(Connection conn, Class<T> clazz, String sql, Object... objects) throws Exception {
PreparedStatement ps = null;
ResultSet rs = null;
List<T> list = new ArrayList<T>();
try {
ps = conn.prepareStatement(sql);
for (int i = 1; i <= objects.length; i++) {
ps.setObjec... |
dab6bfda-c11d-46e5-84c9-6a02d4c7c801 | 3 | public void dispose() {
disposing = true;
if (isDirtyTimer != null)
isDirtyTimer.stop();
removeMouseListener(this);
removeMouseMotionListener(this);
removeComponentListener(this);
// remove annotation listeners.
removeMouseMotionListener(annotationH... |
45829cec-001b-4169-8ded-8cfd33c7d939 | 2 | public static ScoreBoard getInstance() throws IOException{
if(instance == null){
try{
instance = new ScoreBoard();
}
catch(SlickException e){
}
}
return instance;
} |
dec8b59e-8d4c-4a5a-b875-9e6e048ece95 | 7 | public ArrayList<ArrayList<Integer>> fourSum(int[] num, int target) {
//sort the array
Arrays.sort(num);
HashSet<ArrayList<Integer>> hashSet = new HashSet<ArrayList<Integer>>();
ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
for (int i = 0; i < num.... |
81d432e9-d63d-44bf-9c20-78e69b69d0e8 | 6 | public void run()
{
Iterator<Map.Entry<String, MembershipBean>> iterator = GroupMembership.membershipList
.entrySet().iterator();
while (iterator.hasNext())
{
Map.Entry<String, MembershipBean> entry = iterator.next();
MembershipBean membershipBean = entry.getValue();
//If current node's heartb... |
3eee387f-9e6b-4e51-a1b1-cd9cb875d99a | 3 | private static void imprimir_lexema(Token token, int i) {
String lexema = token.getLexema();
//Formateamos de manera legible el EOF
if (token.getLexema().contains("\uffff") ) {
lexema = "eof";
}
//Imprime de acuerdo a lo parametrizado
if (i == 1) {
... |
c6c2f02a-2c49-49d4-ae98-125e1ab7096e | 5 | public void handleKeyPress(int value) {
switch (value) {
case MinuetoKeyboard.KEY_UP:
this.keyUp = true;
break;
case MinuetoKeyboard.KEY_LEFT:
this.keyLeft = true;
break;
case MinuetoKeyboard.KEY_RIGHT:
this.keyRight = true;
break;
case MinuetoKeyboard.KEY_DOWN:
this.keyDown... |
3a6e561a-1cd4-42ed-81fc-9e41848f8698 | 0 | public String getFQN(){
cardFullName = rank+" of "+suit+" with a value of "+cardValue;
return cardFullName;
} |
ef2dc6cc-3e96-45ee-baab-b1ef0694bba6 | 1 | public int findRep(int n) {
if (this.nReps.get(n) == n) {
return n;
}
else {
return this.findRep(this.nReps.get(n));
}
} |
c359bd95-39d8-4733-b632-f31bb0fa6d46 | 5 | public Writer write(Writer writer) throws JSONException {
try {
boolean commanate = false;
Iterator keys = keys();
writer.write('{');
while (keys.hasNext()) {
if (commanate) {
writer.write(',');
}
... |
a16bc9a1-4c83-46ba-87ba-8b794af739e6 | 2 | private void analyzeClass(SootClass sootClass, SootClass lifecycleElement) {
// Do not analyze system classes
if (sootClass.getName().startsWith("android.")
|| sootClass.getName().startsWith("java."))
return;
// Check for callback handlers implemented via interfaces
analyzeClassInterfaceCallbacks(soot... |
0b46cfdc-8d89-4fc4-8e2e-98930dde1891 | 7 | @Override
public void move(final Doodle.Coordinates coordinates) throws GameEndedException {
final int iterations;
final double iterationVelocity;
iterations = Math.abs(hVelocity);
iterationVelocity = (double) hVelocity / iterations;
for (int i = 0; i < iterations; i++) {
... |
d4ebd5b3-8a58-4e24-bfe6-b13c1504245e | 1 | public void setToDead() {
setAlive(false);
setImortality(true);
// makeDeadBody();
for( Tower currentTower : board.getAllTowers()) {
currentTower.removePlaceableInRange(this);
}
setActive(false);
// setJustDied(false); // temporär tilldelning så... |
97947943-5e8d-4316-98fa-ecaa9c83a43a | 3 | private void process(Request request, Response response,
OutputStream body) throws IOException {
/* Parse the query parameters.
*
* Unfortunately we need to rely on our own parsing function here
* because SimpleHTTP's Query map will contain UTF-8 decoded
* parameters, which doesn't work well for the by... |
7b5c0cf1-b82a-4de6-9e50-6d1695624a0c | 7 | public static UndirectedEdge selectAppropriateEdge(Vertex vertex,
Graph graph) {
ArrayList<UndirectedEdge> connectedEdges = graph
.getConnectedEdges(vertex);
UndirectedEdge mandatory = null;
if (!connectedEdges.isEmpty() && connectedEdges != null) {
for (int i = 0; i < connectedEdges.size(); i++) {
... |
ca5f2a20-3ae3-4830-9b6c-35d3e176cea5 | 3 | public void init()
{
Level2State.level2 = false;
checkpoint1 = true;
checkpoint2 = false;
checkpoint3 = false;
checkpoint4 = false;
spaceCount = 0;
gsm.score = 0;
heart.init(100);
bg.init(heart.currentHappinessLevel);
if (!stars.isEmpty())
{
stars.clear();
}
for(int i=0; i <numOfSt... |
835e58dd-f453-46de-8469-253b04cb7c8d | 6 | @Override
public int compareTo(Status o) {
return i > o.i ? 1 : (i < o.i ? -1 : (j > o.j ? 1 : (j < o.j ? -1 : (visited > o.visited ? 1 : (visited < o.visited ? -1 : 0)))));
} |
bfd3424a-4b6e-43d9-a4f7-bdd21e031288 | 8 | public void fillRectangle(int x, int y, int cx, int cy, int color) {
// clip here instead
if (x > this.right || y > this.bottom)
return; // off screen
int Bpp = option.getColourDepthInBytes();
// convert to 24-bit colour
color = Bitmap.convertTo24(color, option);
// correction for 24-bit colour
if (... |
f4fb24d1-6b47-4fb8-ba87-67b448a14a59 | 7 | public static void stripFileFromWraps(File file, String[] wraps)
throws FileNotFoundException, IOException, Exception {
if (wraps == null || wraps.length == 0) return;
List<String> lines = new ArrayList<String>();
BufferedReader reader = new BufferedReader(new FileReader(file));
try ... |
2f391e0f-f4be-4f08-98d9-c4085fbae14e | 2 | @Test
public void addtest() {
for (int i = 0; i < TESTS; i++) {
double v1 = rand.nextDouble() * rand.nextInt();
double v2 = rand.nextDouble() * rand.nextInt();
Angle a1 = new Angle(v1);
Angle a2 = new Angle(v2);
double trueValue = (v1 + v2) % 360;
if (trueValue < 0) trueValue += 360;
assertEqual... |
4416598a-c0bb-44e7-a329-3b1acef6ca37 | 1 | @Override
public void paint(Graphics g) {
super.paint(g);
int x=0, y = 0;
int startX=2*8, startY=2*8;
g.setColor(Color.GRAY);
g.fillRect(0, 0, 32*8, 30*8);
g.setColor(Color.BLACK);
g.fillRect(startX, startY, 26*8, 26*8);
g.setColor(Color.RED);
for (x=0; x<=26; x++){
g.drawLine(startX+x*8,... |
ad2c27b8-0c09-4a1d-9ee3-938a3ca28397 | 0 | public int getxNopeus() {
return xNopeus;
} |
4b0644e8-e0d9-420f-9b0c-74ad5f3adeb0 | 6 | public static Packet Deserialize(String m)
{
Packet p = new Packet();
try
{
for ( int i = m.indexOf(delimiter), j = 0, k = 0 ;
i != -1;
j = i + delimiter.length(), i = m.indexOf(delimiter, i+1), k++ )
{
... |
ce9c0406-aa5c-41a8-957e-65a383d55b24 | 6 | @Test
public void testAsteroidStartingVelocityX() {
for (int i = 0; i < 20; i++) {
p.spawnAsteroids();
}
for (Asteroid a : p.getAsteroids()) {
if (a.getVelX() > -0.5 && a.getVelX() < 0.5) {
assertTrue(false);
}
if (a.getVelX()... |
b9b55baa-f18e-4a26-9ccf-0e8280ea377d | 8 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (this.getClass() != obj.getClass()) {
return false;
}
OpItem other = (OpItem) obj;
if (!Arrays.equ... |
b5303e92-6f61-44c3-b596-e2383e19f4cd | 8 | static int process(String line) {
int cases = Integer.parseInt(line.trim());
for(int i = 0; i < cases; i++) {
char[] inst = readLine().trim().toCharArray();
int size = 100;
int[] mem = new int[size];
int ind = 0;
String out = "Case "+(i+1)+":";
for(char c : inst) {
switch (c) {
case '>'... |
3c19abc8-38c0-42e3-9316-7bda9803c666 | 6 | public boolean setBlockAndMetadata(int par1, int par2, int par3, int par4, int par5)
{
if (par1 >= -30000000 && par3 >= -30000000 && par1 < 30000000 && par3 < 30000000)
{
if (par2 < 0)
{
return false;
}
else if (par2 >= 256)
... |
1d3cc522-0fa2-467c-a300-af2b50eaac92 | 1 | public void testConstructor_ObjectStringEx3() throws Throwable {
try {
new LocalDate("1970-04-06T10:20:30.040+14:00");
fail();
} catch (IllegalArgumentException ex) {}
} |
c1c53ba1-f991-4749-b411-000d34abed0d | 2 | @Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
try {
Integer idUsuario=(Integer)((HttpServletRequest)servletRequest).getSession().getAttribute("idUsuario");
if (... |
7f2da76d-baf3-47d6-ad4f-fb5fa04a4fbf | 0 | public ReferenceType createReferenceType() {
return new ReferenceType();
} |
a27995e8-ad3d-487d-a80b-725a4b1a56e1 | 5 | private void init(boolean flag) {
int i;
int a, b, c, d, e, f, g, h;
a = b = c = d = e = f = g = h = RATIO;
for(i = 0; i < 4; ++i) {
a ^= b << 11;
d += a;
b += c;
b ^= c >>> 2;
e += b;
c += d;
c ^= d << 8;
f += c;
d += e;
d ^= e >>> 16;
g += d;
e += f;
e ^= f << 10;
h +... |
408f0495-d0b6-4967-b6d4-85fff73ccd6f | 4 | public int calculateDefenseValue() {
int actualDefenseValue = defenseValue;
if (Agility > 10) {
actualDefenseValue += Agility - 10;
}
if (Dexterity > 10) {
actualDefenseValue += Dexterity - 10;
}
if (rightWeapon != null) {
actualDefense... |
ff4d06f7-c6c8-4bd9-90a3-e22056e1f027 | 7 | private void cacheResources() {
if (plugin == null)
return;
if (cachedFileNames != null) {
String[] t = cachedFileNames.split(",");
for (int i = 0; i < t.length; i++) {
t[i] = t[i].trim();
if (t[i].equals(""))
continue;
URL x = createURL(t[i]);
if (x != null)
cache(x);
}
}
... |
c2491606-613c-4ff1-b838-53cb646be333 | 5 | private static boolean validatePlanClass(Class planClass) {
final Boolean valid = validations.get(planClass) ;
if (valid != null) return valid ;
final String name = planClass.getSimpleName() ;
boolean okay = true ;
int dataSize = 0 ;
for (Field field : planClass.getFields()) {
fi... |
0decf843-4709-4d07-a772-bfbcaed477bb | 8 | @Override
public boolean onCommand(CommandSender sender, Command command, String label,
String[] args) {
if (args.length == 0) {
return help(sender);
}
String cmd = args[0];
if (!commands.containsKey(cmd.toLowerCase())) {
return help(sender);
}
try {
Method m = getClass().getMethod(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.