method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
0b8cbced-ef48-4542-8f0b-a65385fb88fc | 1 | public boolean isStrike() {
if (first == 10)
return true;
else
return false;
} |
597ff8ef-c7de-463d-98c3-8c8caf2769d3 | 0 | private static SecretKey getSecretKey(String publicKey, String privateKey)
throws Exception {
// 初始化公钥
byte[] pubKeyBytes = SecurityCoder.base64Decoder(publicKey);
KeyFactory keyFactory = KeyFactory.getInstance(ALGORITHM);
X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(pubKeyBytes);
PublicKey pu... |
8445894b-f6dc-4443-b8f6-ea92a91021dc | 8 | private boolean updateSession(Response re) {
byte[] token = re.getSessionToken();
try {
if (token == null || token.length == 0) {
throw new NotLoggedInException("Your session has expired. Please log in again to continue.");
}
if (userProfile != null) {
if (!Arrays.equals(token, userProfile.get... |
79b3915d-fbf6-48cc-a549-8a5b74a84aaa | 4 | private void leave(StateEnum state, final C context) {
if (context.isTerminated()) {
return;
}
try {
if (isTrace())
log.info("when leave %s for %s <<<", state, context);
handlers.callOnStateLeaved(state, context);
if (isTrace())
... |
ac1b4b33-847e-4bda-9c5e-b65ea9ef5657 | 8 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// String for which page to forward to (assigned after switch)
String goToThisPage = null;
// Get parameter
String director = request.getParameter("director");
///////////////////////... |
80404afa-79e4-4db6-9050-31ca24252036 | 2 | @Override
public boolean validGameID(int id){
if(id >= 0 && id < gameModels.size()){
return true;
}
else return false;
} |
558be324-488a-4604-9aa1-b402a7083e3a | 8 | private void check(File f, String[] splits, int i, String file) throws IOException{
if(splits.length-1==i){
String s = splits[i];
s = "\\Q"+s+".xsm\\E";
final Pattern pattern = Pattern.compile(s.replace("*", "\\Q.*\\E").replace("?", "\\Q.\\E"));
File[] files = f.listFiles(new FileFilter() {
@Override
... |
4d8aeb03-980f-4375-a079-cf064dc6ae9f | 9 | @Override
public Card turn(Card[] table, int stepNum) {
Iterator<Card> iterBatchOnHand;
Card card;
// Мы ходим первыми?
if (stepNum == 0) {
// Мы назначали козырь?
if (getTrumpSetterFlag()) {
// Ходим любой
return batchOnHand.remove();
} else {
// Не назначали козыря, ходим простой картой
... |
c926c2e9-5f88-4c62-a875-240a234271aa | 2 | public static ArrayList<ItemSet> findRuleSubsets(ItemSet candidates, ArrayList<ItemSet> sets){
ArrayList<ItemSet> allRuleSets = sets;
if(!allRuleSets.contains(candidates)){
allRuleSets.add(candidates);
}
for(int i = 0; i < candidates.getItemSet().size();i++){
ArrayList<Item> subset = new ArrayLi... |
736fdd3a-5457-4780-b5cd-8819f9978d13 | 2 | private void initFileList() {
fileList = new HashSet<FileModel>();
File folder = new File(dir);
File[] listOfFiles = folder.listFiles();
for (int i = 0; i < listOfFiles.length; i++)
{
if (listOfFiles[i].isFile())
{
fileList.add(new FileModel(listOfFiles[i].getName(),0));
}
}
} |
fb198e6a-675b-4604-aefb-e11206fcfd43 | 5 | private void drawGrid(Graphics g, Tile[][] grid)
{
for (int i = 0; grid != null && i < grid.length; i++)
for (int j = 0; j < grid[i].length; j++)
{
if (grid[i][j] != null && grid[i][j].getActive())
{
Tile current = grid[i][j];
g.setColor(current.getColor());
g.fillRect(current.getX()*32,... |
9b962584-c845-4872-a524-76932b77d197 | 1 | public static void putRandomInput(Comparable[] a)
{
Random r = new Random();
for (int i = 0; i < a.length; i++)
a[i] = Math.abs(r.nextInt());
} |
59702157-1e86-402c-986a-2f6e8abc423c | 2 | public void testFactory_parseDays_String() {
assertEquals(0, Days.parseDays((String) null).getDays());
assertEquals(0, Days.parseDays("P0D").getDays());
assertEquals(1, Days.parseDays("P1D").getDays());
assertEquals(-3, Days.parseDays("P-3D").getDays());
assertEquals(2, Days.pars... |
2184b437-86d5-420f-99de-ddbf606fa0a7 | 3 | public void toggleDecodingMethod(int methodID) {
if(methodID > 0) {
if(!CipherHandler.activeCiphers.containsKey(methodID)) {
CipherHandler.activeCiphers.put(methodID, new CipherPanel(methodID).createPanel(this));
}
else CipherHandler.activeCiphers.remove(metho... |
fd13cf24-0fc4-4074-a682-6960c14ae90d | 8 | public static void render(){
for(int i = 0; i < ACTIONSLOTS; i++){
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glColor3f(0f, 0f, 0f);
GL11.glBegin(GL11.GL_QUADS);
GL11.glVertex2f(Game.PLAYER.getCameraX() + Game.SCREEN_WIDTH / 2 - 2 - ACTIONSLOTS*17 + i*2 + i*32, Game.PLAYER.getCameraY());
GL11.glV... |
1c9fc5d6-d123-48b5-b32e-df1f894e2273 | 3 | private void modifyObjectClass(SootClass cl) {
// TODO Auto-generated method stub
//add 'implements' relation
cl.addInterface(poolObj);
//add finalizePoolObject() method
SootMethod finalize = new SootMethod("finalizePoolObject", new ArrayList<Type>(), VoidType.v(), Modifier.PUBLIC);
cl.addMethod(finaliz... |
11f753c9-aad2-436c-9bbb-1b5ba20e0125 | 3 | private void printLocationInfo() {
String presentCharacters = "Present characters: ";
boolean found = false;
for (Character character : characters.values()) {
if (character.getLocation() == player.getLocation()) {
presentCharacters += character.getName() + "; ";
... |
17048f06-1079-45cc-a729-e2bb1dae30ad | 7 | private void signUpButtonActionPerformed(java.awt.event.ActionEvent evt) {
String psw, cpsw;
String u_name;
String fname;
String lname;
String emailId;
psw = new String(password.getPassword());
cpsw = new String(confirmPsw.getPassword());
u_name = userName.getText();
fname ... |
d99e9872-a69b-4e47-a412-b45e0016d70e | 7 | static private final void step6()
{ j = k;
if (b[k] == 'e')
{ int a = m();
if (a > 1 || a == 1 && !cvc(k-1)) k--;
}
if (b[k] == 'l' && doublec(k) && m() > 1) k--;
} |
2352e23c-2ef5-4bae-a787-a714bae59cc4 | 3 | private boolean checkSquare(int row,int col,int val) {
int rowStart = (-1)*(row % 3);
int colStart = (-1)*(col % 3);
for(int i = rowStart; i < rowStart+3;i++) {
for(int j = colStart; j < colStart+3;j++) {
if(b[row+i][col+j] == val)
return false;
}
}
return true;
} |
5eab1c61-9959-49ad-b71d-9b0746e0de55 | 2 | public void loadBoardDimensions(String layoutFile) throws BadConfigFormatException, FileNotFoundException {
FileReader reader = new FileReader(layoutFile);
Scanner scan = new Scanner(reader);
String temp;
int lineCount = 0;
int cellCount = 0;
int cellCount2 = 0;
temp = scan.nextLine();
lineCount++;
St... |
f496eb37-a381-49b3-a7b8-a888cdd8718b | 6 | public static int toInteger(Object value) {
if(value != null && Double.class.isAssignableFrom(value.getClass()) ){
return ((Double)value).intValue();
}
else if(value != null && String.class.isAssignableFrom(value.getClass()) ){
String text = (String)value;
if( ... |
15aa878a-5446-40bf-b76d-bf4d040fa137 | 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... |
0bbb4544-23fd-4e73-b18e-ed28588015ef | 6 | private static Mat generateBoardProjection(Mat boardThreshold, boolean ui)
throws VisionException {
// Find the polygon enclosing the blue connect four board
LinkedList<MatOfPoint> contours = new LinkedList<MatOfPoint>();
Mat hierarchy = new Mat();
Imgproc.findContours(boardThreshold, contours, hierarchy,
... |
952be821-3044-4ed3-8a66-ca31559ccceb | 2 | public static void main(String[] args) {
riverDB = readCSV ("/home/arno/workspace/CampPlaner/data/river.csv");
System.out.println (riverDB);
try {
System.out.println ("saving...");
riverDB.write ("riverdb.xml");
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
... |
55abbc28-2b84-45b8-a3cf-1fb7fe591c9b | 4 | public void keyReleased(KeyEvent e) {
int keyCode = e.getKeyCode();
if (keyCode == e.VK_W) {
}
if (keyCode == e.VK_S) {
}
if (keyCode == e.VK_A) {
}
if (keyCode == e.VK_D) {... |
15a1ed9e-0958-44bc-bca6-6e1b8ff0e422 | 3 | @Override
public String toString() {
String wString = "";
switch (this) {
case ROCK:
wString = "R";
break;
case PAPER:
wString = "P";
break;
case SCISSORS:
wString = "S";
... |
58fbd682-011a-4734-aa66-06e7f0f05287 | 1 | public void testWithFieldAdded_nullField_zero() {
MonthDay test = new MonthDay(9, 6);
try {
test.withFieldAdded(null, 0);
fail();
} catch (IllegalArgumentException ex) {}
} |
cf24b64f-69be-469f-a298-59fb547f1c5c | 9 | public String convertHarga(int harga){ // jadi tar kalo 50000 jadi 50.000 dst...
// harga = 444;
int ribuan[] = new int[10];
int counter=0;
String temphasil="";
while(harga/1000!=0){
ribuan[counter] = harga%1000;
counter++;
//temphasil = temphasil + ribuan+".";
harga = harga /1000... |
a6d490f0-e3ab-49ad-85ca-d2e63d354a85 | 5 | public void execute(
String line,
Map<String, EntityUser> users,
Map<String, EntityDocument> documents,
ConstantTime constantTime) {
this.st = new StringTokenizer(line);
this.users = users;
this.documents = documents;
String commandName = st.nextToken();
if (commandName.equa... |
634b11d7-84d0-4a2c-a784-271e7be77d4d | 2 | public static boolean isInputPressed(GameContainer container, List<Integer> input) {
for (Integer key : input) {
if (container.getInput().isKeyPressed(key)) {
return true;
}
}
return false;
} |
5f7614df-be06-4a3d-ac37-f515f6733e0e | 1 | public List<String> findStrings(String expr)
throws XPathExpressionException
{
List<String> strings = new ArrayList<String>();
NodeList nodes = findNodes(expr);
for(int i=0; i<nodes.getLength(); i++)
{
strings.add(nodes.item(i).getNodeValue());
... |
2109c8b4-dae0-41d6-9a13-dcbc9183258d | 1 | public void setCommandButtonFontstyle(Fontstyle fontstyle) {
if (fontstyle == null) {
this.buttonComFontStyle = UIFontInits.COMBUTTON.getStyle();
} else {
this.buttonComFontStyle = fontstyle;
}
somethingChanged();
} |
3f2d2157-6fe2-4117-9c9a-f403e410a7fb | 3 | public void updateTeam(String newId) {
if (id != null) {
PreparedStatement st = null;
String q = "UPDATE team SET id = ?, name = ?, location = ? WHERE id = ?";
try {
conn = dbconn.getConnection();
st = conn.prepareStatement(q);
... |
755f79aa-dee9-42ab-9ae4-663889d9e13d | 8 | @Override
public List<AdminNotice> getNoticeList() {
log.debug("get admin notice list");
Connection conn = null;
Statement statement = null;
ResultSet rs = null;
ArrayList<AdminNotice> list = new ArrayList<AdminNotice>();
StringBuilder sql = new StringBuilder();
sql.append(" select note_id, note_type,... |
16cb540d-8bda-4a4c-ab9b-9d30214c848b | 1 | public static void main(String[] args) {
// LinkedHashMap<Integer, Compra> compras = new LinkedHashMap<>();
// compras.put(1, new Compra(1,2,"bolis"));
// compras.put(2, new Compra(2,4,"pera"));
// compras.put(3, new Compra(3,8,"gafas"));
LinkedHashMap<Integer, Persona> pers... |
66735ee1-25a5-4de1-973d-9c14ccb875c6 | 5 | public void run() {
String command;
try {
while (true) {
command = input.readLine();
if (command.startsWith("MOVE")) {
System.out.println(command);
//TODO make the split command more reada... |
7f8dc0a5-6d9d-4a1d-942e-aa171d0ba673 | 3 | public static void main(String[] args){
int sum=0;
for(int i=2;i<1e7;i++){
int dsum=0;
for(char c:Integer.toString(i).toCharArray()){
dsum+=Math.pow(Integer.parseInt(""+c), 5);
}
if (dsum==i){ sum+=i; System.out.println(i);}
}
System.out.println(sum);
} |
b0dfd8de-0e15-49a5-9e42-b58365854418 | 1 | public void refresh(Camera camera) {
for(GraphicForm gForm : graphForms)
gForm.refresh(camera);
} |
ec1fdadf-9194-4c23-a1e8-ae9a92926dd1 | 5 | public static boolean isBlue(int c) {
int r = (c >> 16) & 0xFF;
int g = (c >> 8) & 0xFF;
int b = c & 0xFF;
return (r < 100 && r > 60) && (g < 115 && g > 80) && (b < 215 && b > 190);
} |
bb7b9709-ed9e-48eb-9adf-379dfab8e3e7 | 1 | public static CtMethod delegator(CtMethod delegate, CtClass declaring)
throws CannotCompileException
{
try {
return delegator0(delegate, declaring);
}
catch (NotFoundException e) {
throw new CannotCompileException(e);
}
} |
df6a1f63-ca32-4996-b44d-8cacfd74c971 | 6 | public String getDescription() {
if (fullDescription == null) {
if (description == null || isExtensionListInDescription()) {
fullDescription = description == null ? "(" : description + " (";
// build the description from the extension list
Enumeration ... |
b9ceaa8b-52e4-4109-a736-4e82017530d7 | 7 | public static void main(String[] args){
Set<Long> pent = new HashSet<Long>();
for(long i=1;i<1e4;i++){
pent.add(i*(3*i-1)/2);
}
Long min = Long.MAX_VALUE;
for(Long a : pent){
for(Long b : pent){
if (pent.contains(a+b) && pent.contains(Math.abs(a-b)) && a!=b){
if (Math.abs(a-b) < min){
Sys... |
114db03d-91ff-40cf-84e3-1587be4b2201 | 8 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
// Pega o contato referente a linha especificada.
Contato contato = linhas.get(rowIndex);
switch (columnIndex) {
case ID:
return contato.getId();
case NOME:
return contato.getNome();
case APELIDO:
... |
614302e1-5b08-4bd4-935a-598ae6c9b00c | 0 | @Override
public void closeWindows() {
System.out.println("closeWindows");
} |
419f88c4-5220-4473-b80b-b2ba240aaa2a | 1 | private Secteur chargerUnEnregistrement(ResultSet rs) throws DaoException {
try {
Secteur secteur = new Secteur(null,null);
secteur.setCode(rs.getString("SEC_CODE"));
secteur.setLibelle(rs.getString("SEC_LIBELLE"));
return secteur;
} catch (SQ... |
9476d1cf-9fb4-4747-912b-c2e7ab82e5ee | 4 | public boolean run() {
Utils.getString("city/index");
Utils.getString("casino/slotmachine");
try {
JSONObject data = Utils.getJSON("casino/slotmachineData/0");
// {"jackpot":"192028","fortunes":"990","error":"ok","freispiele":0,"spiele":100,"bet":0}
int min = 100;
if (modus == 2) {
min = 250;
... |
9254bb3d-fcb0-40ed-bb68-0797b73fc512 | 0 | public void addScore (final String score) {
this.scores.add(score);
} |
390b7427-1a61-4bb5-aa19-fd19d5e832e7 | 9 | private static void performPerHalogenoSubstitution(BuildState state, Fragment perhalogenFrag, Element subBracketOrRoot) throws StructureBuildingException {
List<Fragment> fragmentsToAttachTo = findAlternativeFragments(subBracketOrRoot);
List<Atom> atomsToHalogenate = new ArrayList<Atom>();
for (Fragment fragment ... |
76961a2d-2af6-46d3-9a49-e6de7f5d8f20 | 8 | public void doBetting(GameVars gv, CustomPoker cp)
{
boolean ripe = false;
int idx = betOffset;
int lastPlayerToRaise = -1;
while (!ripe)
{
idx = idx%players.size();
if (idx != -1 && idx == lastPlayerToRaise)
{
ripe = true;
break;
}
if (lastPlayerToRaise == -1)
lastPlayerToRaise = ... |
d3c20eaa-1e11-46fb-b681-64140501177e | 6 | @EventHandler
public void CaveSpiderJump(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.getCaveSpiderConfig().getDouble("CaveSpide... |
806a2349-eebd-4020-8e6c-c275f8d4b294 | 5 | public static void sayit(int tc,String msg){
String tmsg[]=msg.split("<4;2>0:");
String player = tmsg[0];
String capplayer=player;
player=player.toLowerCase().trim();
String u1=GosLink.prps("muser1");
String u2=GosLink.prps("muser2");
if (TC1.ghost ==1 || TC2.ghost == 1){tmsg[1]=tmsg[1]+"\n";}
if (!play... |
4c79e81a-407a-4f03-bb72-196a0e5cb55f | 9 | private ITaggedValue getTaggedValue(String tagKey, boolean isCreateIfNotExist) {
ITaggedValue ret = null;
boolean isInTransaction = TransactionManager.isInTransaction();
try {
ProjectAccessor projectAccessor = ProjectAccessorFactory.getProjectAccessor();
IModel project =... |
25c42374-277f-49b7-859d-7ae70b79ade4 | 7 | private void tryToCookIt(final Order o) {
EnumItemType food = o.choice;
if(mRole.mItemInventory.get(food) < mItemThreshold) {
if(!mRole.mHasCreatedOrder.get(food)) {
mRole.mItemsDesired.put(food,baseNeed);
}
}
... |
4a269ceb-9a21-4263-96b5-5b825c9c711c | 7 | private boolean calculateVelocities() {
boolean end1 = true, end2 = true;
for (Point p : frontier.innerBorder) {
velocities[p.x][p.y] = calculateVelocity(p);
if (end1 && velocities[p.x][p.y] < 0) {
end1 = false;
}
}
for (Point p : frontier.outerBorder) {
velocities[p.x][p.y] = calculateVelocity(... |
6e9dbda1-70d7-4e69-b02f-124683a5b996 | 1 | public void visitJumpInsn(final int opcode, final Label label) {
buf.setLength(0);
buf.append(tab2).append(OPCODES[opcode]).append(' ');
appendLabel(label);
buf.append('\n');
text.add(buf.toString());
if (mv != null) {
mv.visitJumpInsn(opcode, label);
... |
a3855bfa-803c-4e29-ad87-363a318b707d | 8 | public ResultatenScherm(final Spel spel) {
ArrayList<GekozenAntwoord> gekozenAntwoorden = spel.getGekozenAntwoorden();
setBackground(new Color(43, 43, 43));
setBorder(null);
setLayout(new MigLayout("", "[grow][77px][grow]", "[grow][20px,growprio 50,grow][grow]"));
JPanel panel = JPanelFactory.createBackgrou... |
17c7427b-041c-4f69-bb44-a20a0c0fcf1a | 4 | public static Matrice getShortestPaths(Matrice mat){
Matrice A = new Matrice(mat.getData());
for(int k=0; k < mat.getNbLines(); k++){
for(int i=0; i< mat.getNbLines(); i++){
for(int j=0; j< mat.getNbColumns(); j++){
if((A.getValueAt(i,k) + A.getValueAt(k,j)) < A.g... |
09adb03a-d25b-469d-a558-7d59988fd062 | 3 | @Override
public void draw(Graphics2D g) {
if(flicker)
flickerTimer++;
if(flickerTimer > 50){
flickerTimer = 0;
flicker = false;
}
if(flickerTimer % 5 == 0)
{
super.draw(g);
}
} |
67febc91-80bf-4d18-8b47-02ecc08f033b | 1 | @Override
public Item swap(Item newItem) {
Item temp = null;
try{
temp = weaponItem;
//weaponItem = null;
weaponItem = (WeaponItem) newItem;
return temp;
}catch(Exception e){
weaponItem = (WeaponItem) temp;
temp= null;
return newItem;
}
//return temp;
} |
7602fc18-6b4a-41d1-86d2-4be647082c06 | 3 | public static <T extends Enum<T>> T getEnumFromString(Class<T> c, String string) {
if (c != null && string != null) {
try {
return Enum.valueOf(c, string.trim().toUpperCase());
} catch (IllegalArgumentException ex) {
}
}
return null;
} |
d658080b-69a6-46b6-8640-a051dab8012d | 3 | public void setHmac(Key key){
Mac hmac = null;
try {
hmac = Mac.getInstance("HmacSHA256");
} catch (NoSuchAlgorithmException e) {
System.err.println("NoSuchAlgorithmException (HmacSHA256 not valid): " + e.getMessage());
}
try {
hmac.init(key);
} catch (InvalidKeyException e) {
System.err.println... |
f30338db-ddc7-4683-bc68-63c38ced6e15 | 6 | private LLNode exchangeUp(LLNode t) {
LLNode left = t.prev.left;
LLNode right = t.prev.right;
LLNode prev = t.prev.prev;
LLNode cleft=t.left;
LLNode cright=t.right;
int vcheck=t.prev.val;
LLNode cprev = t;
if(!isEqual(t,left)){
t.left=... |
45d15dc0-5265-43a8-8cea-c6768741c72c | 3 | public void setPriceCode(int arg) {
switch (arg) {
case REGULAR:
price = new RegularPrice();
break;
case NEW_RELEASE:
price = new NewReleasePrice();
break;
case CHILDRENS:
price = new ChildrensPrice();
break;
default:
throw new IllegalArgumentException("Incorrect Price Code");
}
... |
5552434d-c702-49b2-92b4-7530143cc192 | 2 | private static String testDataToStiring(classifiedData Data){
String out = "";
//Add Cedd data
int i = 0;
for(i = 0; i < Data.getCEDDData().length; i++){
out = out + Data.getCEDDData()[i] + ",";
}
// System.out.println("CEDD data added for image " + Data.getImgName() + " is: " + i);
//Add FCTH d... |
617bbb3b-037f-4362-a347-886e924dd81f | 6 | public void getInput() {
String command;
Scanner inFile = new Scanner(System.in);
do {
this.display();
command = inFile.nextLine();
command = command.trim().toUpperCase();
switch (command) {
... |
2dfcfb03-bda9-492c-a1a0-ed61b596aeb0 | 0 | @Override
protected void paintComponent(Graphics g){
super.paintComponent(g);
g.drawString("test", 0, 0);
} |
3261e7ec-6690-4dfa-98dd-cefbbb97ec92 | 9 | private void nextEvent()
{
if (eventCount >= TOTAL_EVENTS)
{
state = BanditState.DONE;
if (currentUser.isLogging())
{
game.log.sendByteBySocket(SocketToParallelPort.TRIGGER_BANDIT_DONE);
}
}
else
{
eventCount++;
if (winCount >= TOTAL_WIN)
{
... |
55706a89-832f-4d42-b963-dca3950b8ead | 0 | public void dismissBox() {
dispose();
// CLIP.stop();
} |
28c88214-cf20-44a4-8214-461dd4bf72a6 | 1 | private void reset(JCheckBoxMenuItem... checkBoxMenuItems) {
for (JCheckBoxMenuItem checkBoxMenuItem : checkBoxMenuItems) {
checkBoxMenuItem.setState(false);
}
} |
12a281c8-8a9d-4e42-ad89-0c6d65287293 | 5 | @Override
public List<Player> findWinner() {
sortHands();
// Find the top score
List<Player> winners = new ArrayList<Player>();
for (int i = currentPlayers.size() - 1; i >= 0; i--) {
if (Hand.getHandValue_OneCard(currentPlayers
.get(currentPlayers.size() - 1).getHands().get(0)) == Hand
.getHandVa... |
b31d3093-d7a9-4bc4-8dea-fa7b81f36b2e | 4 | public Zone retrieveZone(String zoneName)
{
if(zones != null)
{
//Iterate through zones, returning the zone with name specified by
//zoneName. Once a zone is returned the method terminates
for(int i=0; i< zones.size(); i++)
{
if(zones.get(i).name == zoneName)
return zones.get(i);
}
}
/... |
ae8a8b8e-d291-4767-a653-174e3a197c97 | 8 | @Override
public String toString() {
StringBuilder sb = new StringBuilder("User(");
boolean first = true;
sb.append("firstName:");
if (this.firstName == null) {
sb.append("null");
} else {
sb.append(this.firstName);
}
first = false;
if (!first) sb.append(", ");
sb.appe... |
e7df0031-c9bc-4d6a-aff8-e30b4f3b1f52 | 3 | boolean isPerpendicularAttackPlacementNotHarming(int position, int dimension, char[] boardElements) {
return isAttackPlaceHorizontallyRightNotHarming(position, boardElements, dimension, attackPlacesOnTheRight(position, dimension))
&& isAttackPlaceHorizontallyLeftNotHarming(position, boardElement... |
1bd46052-d328-4c0e-a29a-c35473d00e79 | 0 | @BeforeClass
public static void beforeClass() {
System.out.println("Testing WordReader Started.");
_dictionary = new WordReader("/dict4test.txt");
} |
2bdc6d45-da57-433f-9864-ce19b9d0cb3a | 0 | public static void main(String[] args) {
int x = 7;
System.out.println("x = " + Integer.toBinaryString(x));
System.out.println("x <<= 1 = " + Integer.toBinaryString(x <<= 1));
System.out.println("x <<= 1 = " + Integer.toBinaryString(x <<= 1));
System.out.println("x <<= 1 = " + Integer.toBinaryString(x <<= 1));
... |
fdfd0d0b-a5d4-40a0-8212-875158543858 | 6 | public boolean onCommand(Player player, String[] args) {
File fichier_language = new File(OneInTheChamber.instance.getDataFolder() + File.separator + "Language.yml");
FileConfiguration Language = YamlConfiguration.loadConfiguration(fichier_language);
if(player.hasPermission(getPermission())){
if(args.length... |
77ebd484-0a3e-4512-8d73-abbf177e034f | 0 | public JointAppointmentFinalized(Appointment appt)
{
this.appt = appt;
} |
9d88f2c2-6bfb-4e00-9cf7-0dc6a2a1d2ee | 0 | public void setHeight(Double height) {
this.height = height;
} |
66595233-653f-4642-bfc1-bca4c71434de | 9 | public void performStructureConsistencyVerification(Tile topTile){
int jWidthTop = 0;
int kWidthTop = 0;
int jWidthBot = 0;
int kWidthBot = 0;
int total = 0;
System.out.println("DATASTRUCTURE CONSISTENCY VERIFICATION");
Tile leftCornerTile = topTile;
while(leftCornerTile.leftDown != null){
leftCornerTile =... |
d84f9ed6-63ae-4968-b707-4dee1f82d1d0 | 1 | public final void setAlias(String name) {
if (name != null) {
Identifier rep = getRepresentative();
rep.wasAliased = true;
rep.alias = name;
}
} |
e6d45251-35c1-4e08-b4ab-4688a1f8091a | 8 | @Test
public void testInsert() {
int size = 10000;
int range = 10000;
Random r = new Random();
int[] test = new int[size];
for(int i=0;i<size;i++)
test[i] = r.nextInt(range);
long start = System.currentTimeMillis();
for(int i=0;i<size;i++)
instance.insert(i, test[i]);
long end = System.currentTim... |
8de61a0d-19ff-41c2-8385-79d0184645ca | 3 | public boolean contains(int x, int y)
{
return x1 <= x &&
y1 <= y &&
x2 >= x &&
y2 >= y;
} |
f9b65576-0d1f-4f11-b9b3-b4bcc732f005 | 5 | public void addScore(int score){
scores.add(score);
//Calculates average score
int total = 0;
for(int s : scores){
total+=s;
}
if(score < lowscore || lowscore == 0){
lowscore = score;
}
if(score > highscore){
highscore = score;
}
//Checks for zero division
if(scores.size() ... |
e81aedc0-fca9-4e64-8c60-5be8d115fd56 | 9 | public ArrayList<ArrayList<Integer>> rangeCombine(int startN, int endN,
int k) {
ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
int countInRange = endN - startN + 1;
if (startN > endN || countInRange < k)
return result;
// count in range same as k, only one comb
if (countI... |
87cb9313-10ba-473f-b103-709b420d1794 | 1 | protected synchronized void scheduleNext() {
if ((active = tasks.poll()) != null) {
executor.execute(active);
}
} |
65a0411e-b535-402f-bbcd-c8dbda8ed5f8 | 2 | public static URL getCharacterPortraitURL(long characterID, short size) throws ApiException {
if(Arrays.binarySearch(characterPortraitSizes, size) < 0)
throw new ApiException("Invallid image size: "+Short.toString(size)+". Allowed sizes are: "+Arrays.toString(characterPortraitSizes));
try {
return new URL(IMA... |
319d0f4a-0c47-42e0-ba85-de71265d36fb | 2 | public static void main(String args[]) throws IOException {
System.out.println(" ___ \n" +
" / _ \\ \n" +
"/ /_\\ \\_ __ __ _ _ __ __ _ _ __ ___ __ _ _ __ \n" +
"| _ | '_... |
9f1b62f5-b171-40cb-9221-186b8630d0d7 | 1 | public boolean InsertarProveedor(Proveedor p){
if (p!=null) {
cx.Insertar(p);
return true;
}else {
return false;
}
} |
5845655f-c982-4b85-97fa-b17ce35b4b42 | 9 | public static void main(String[] args) {
if (args.length != 1) {
System.err.println("Please input the robot name!");
return;
}
String[] answer = null;
if (args[0].equalsIgnoreCase("Judy")) {
answer = JudyAnswer;
} else if (args[0].equalsIgnoreCase("Max")) {
answer = MaxAnswer;
}
if (null == ... |
3fa52fe6-097a-4d7e-9b57-4049da2ba0c1 | 2 | public void run() {
ReplyMessage sysinfo;
try {
while(comm.isOpen()) {
sysinfo = comm.execute(new SystemStatusRequest());
System.out.println(sysinfo);
Thread.sleep(2000);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
bdbdb71a-5e9c-4c27-b268-aced2e955791 | 5 | @Override
public String getColumnName(int column){
String name = "??";
switch (column){
case 0:
name ="RaavareID";
break;
case 1:
name ="Raavare Navn";
break;
case 2:
name ="Kostpris pr. stk.";
break;
case 3:
name ="Antal Total";
break;
case 4:
name ="Kostpris Ialt";
break;
... |
f853b6de-a322-4f8a-9edc-a991f9002770 | 4 | public static final void next(boolean goUp, long[] x, long[] n) {
if(goUp == false) {
if(!isLeaf(x)) {leftChild(x,n);} else next(true,x,n);
} else {
if(isRoot(x)) done(n);
else {
long[] p = {0,0,0,0};
parent(x,p);
if(isL... |
287385c7-2154-472f-be37-3cc66ce88482 | 1 | private void printTaskTrees() {
System.out.println("Task Trees:");
for (Iterator iter = taskTrees.iterator(); iter.hasNext(); ) {
Tree nextTree = (Tree)iter.next();
Tree.printTree(nextTree);
}
} |
9f73a2f9-0311-40b5-87f6-c8384a46800d | 5 | @Override
public void add(Task taskBean) {
try {
connection = getConnection();
ptmt = connection.prepareStatement("INSERT INTO Task(description, title, id_owner) VALUES(?,?,?);");
ptmt.setString(1, taskBean.getDescription());
ptmt.setString(2, taskBean.getTitl... |
38a38855-ed46-4579-9340-4501b4ac014a | 3 | public CacheIndice(RandomAccessFile dataFile, RandomAccessFile indexFile, int id) {
this.maxFileSize = 99999999;
this.id = id;
this.dataFile = dataFile;
this.indexFile = indexFile;
try {
for (int i = 0; i < indexFile.length() / 6L; i++) {
byte[] data = null;
data = get(i);
if (data != null)
... |
3e6206c6-c5a6-489f-86ea-c7b5cc26c299 | 6 | public static void main(String[] args) {
String use = "";
LookAndFeelInfo[] available = UIManager.getInstalledLookAndFeels();
for(LookAndFeelInfo info : available) {
if(info.toString().contains("Nimbus")) {
use = info.toString();
}
}
try {
... |
87726f0e-e81c-4da2-bb1f-63dfdc87bbe6 | 9 | private static void parseValueElement(Element element,
ConfigurableEmitter.Value value) {
if (element == null) {
return;
}
String type = element.getAttribute("type");
String v = element.getAttribute("value");
if (type == null || type.length() == 0) {
// support for old style which did not write the... |
36f83fbc-08e9-43ff-9089-50c76e79ebd4 | 9 | public static void printPokerCombInOrder(int minRank, int maxRank) {
int hand[] = new int[5];
int answerHand[][] = new int[2598960][5];
double maxValue = maxRank * Math.pow(13, 5);
double minValue = minRank * Math.pow(13, 5);
System.out.println("max Value: " + minValue);
System.out.println("min Val... |
15920771-1084-42d4-8fe3-6d70cf32670a | 2 | public Perceptron getPerceptron(String name) {
for (String a : perceptrons.keySet()) {
if (name.equalsIgnoreCase(a)) {
return perceptrons.get(a);
}
}
return null;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.