method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
4ff063b7-a594-40f9-895f-987ce3974139 | 9 | public static int newLeaveRequest(JSONObject jsonObj) {
JSONArray detailList = new JSONArray();
float ttlDays = 0;
int caseId = -1;
ArrayList<String> subSqls = new ArrayList<String>();
try {
String eid = jsonObj.getString("EmployeeId");
String leavaTypeId = jsonObj.getString("Le... |
ed117b1d-869f-4a27-a0aa-a10d3a225474 | 0 | @Override
public void setMetaDataObject(IRemoteCallObjectMetaData meta) {
this.meta = meta;
} |
f009fbe5-c691-4eb3-952d-f950776a4d5b | 5 | @Override
protected void readPayload(InputBuffer b) throws IOException, ParsingException {
InputBuffer signed = b.getSubBuffer(0);
VariableLengthIntegerMessage v = getMessageFactory().parseVariableLengthIntegerMessage(b);
b = b.getSubBuffer(v.length());
if (BROADCAST_VERSION != v.getLong()) {
throw new Pa... |
aa0bd643-6d89-4dfa-bd38-e03a0832fff8 | 0 | public Entradas getEntradasIdEntrada() {
return entradasIdEntrada;
} |
97af312b-a9c3-405b-b0d4-3196d3509b2a | 1 | protected Boolean getValue(String key) throws UnknownKeyException {
if (values.containsKey(key) == false)
throw new UnknownKeyException("unknwon key " + key);
return values.get(key);
} |
238b6517-93e1-475d-a492-7611e721053c | 1 | public String toString() {
// Replace the following line with your solution.
String stringvalue = "{";
SListNode current = image.getHead();
while (current != null) {
stringvalue += "<";
stringvalue += current.red + " ";
stringvalue += current.green + " ";
stringvalue += current.blue + " ";
string... |
4786f29c-ec24-48db-b448-60eba14807cd | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Posicao other = (Posicao) obj;
if (x != other.x)
return false;
if (y != other.y)
return false;
if (dx != other.dx)
return false;
i... |
7f64b39a-6e5a-4521-abe5-6a22b05d885e | 2 | private void initCells() {
for(int i = 0; i < width; i++) {
for(int j = 0; j < height; j++) {
grid[i][j] = new Cell(i, j, this);
}
}
} |
3210d820-2297-499b-94f3-7f554b1f2989 | 1 | public static void update() {
for(Keybinds keybinds : Keybinds.values()) {
keybinds.key.setHeld(keybinds.key.isPressed());
keybinds.key.update();
}
} |
ffcc7028-b674-495f-ac64-fa87b3b38629 | 6 | public void handle() {
while (Keyboard.next()) {
World world = Game.instance().world;
switch (Keyboard.getEventKey()) {
case Keyboard.KEY_ESCAPE:
Display.destroy();
System.exit(0);
break;
case Keyboard.KEY_W:
world.setAt(playerX, playerY, Color.BLACK);
world.setAt(playerX, playe... |
d1d73fcf-68c1-432c-80b3-659d82a1bf3e | 8 | public static void main(String[] args) throws Exception
{
int numColumns = 3000;
File inFile = new File(
ConfigReader.getCREOrthologsDir() + File.separator + "bitScoreOrthologsAsColumns.txt");
BufferedReader reader =new BufferedReader(new FileReader(inFile));
BufferedWriter writer= new BufferedWr... |
334dfca5-aa4a-4c23-9df2-e587cee23bdb | 1 | public static void test(int i) {
anIntArray1[(anInt1 += -30241709) * 1450153947 - 1] = 5;
if(anInt1 * 1450153947 == i) {
System.out.println("yay");
} else {
System.out.println("noo");
}
} |
9b60c858-c462-40cf-b007-75ccaeaef0d8 | 0 | public boolean isIsBlueLayer() {
return isBlueLayer;
} |
8d8b384c-5e09-4428-b3db-d2e825c1a532 | 1 | public void closePopUp() {
Parent parentRoot = ((Stage) stage.getOwner()).getScene().getRoot();
if (parentRoot instanceof StackPane) {
((StackPane) parentRoot).getChildren().remove(mask);
}
stage.close();
} |
ca983e27-26af-4342-a92d-184297ffad8d | 5 | public static Method getZeroArgMethod(Class cls, String methodName)
{
Assert.notNull(cls, "cls cannot be null");
Assert.notNull(methodName, "methodName cannot be null");
// First check for method using getMethod()
Method method = null;
try
{
metho... |
b0485afd-7b0c-4ea4-8bd2-0c9174650840 | 2 | public PdbFileFormat() {
try {
// the ancestors are called
// in this case, that's Object()
// create a reader-writer
createReaderWriter() ;
// tell it we'll handle content and errors
ourReaderWriter.setContentHandler (this) ;
ourReaderWriter.setErrorHandler (this) ;
} // end tr... |
f6a0bcbf-11b3-4eef-a4ff-1cdb0e24c524 | 6 | public void changeAmount(String productName, int amount) {
if (amount == 0) {
OrderLine toRemove = null;
for (OrderLine line : this.myLines) {
if (line.getProduct().getName().equalsIgnoreCase(productName)) {
toRemove = line;
}
}
if (toRemove != null) {
this.... |
ae10018f-a2d7-499a-a67e-81cf5ee3de69 | 7 | public static Map countOccurrences(Map imagesTags) {
if (PRINT == 1)
System.out.println("Creating tagpool and counting occurrences...\n");
Map tagpool = new HashMap();
/* Iterate through the map */
Iterator itMap = imagesTags.entrySet().iterator();
while (itMap.ha... |
9da0f5b6-876b-449e-8b4a-aed08f706b6f | 7 | @Override
public boolean onResponse(Message message) {
int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
if (hour <= 9) {
for (String word :moringWords) {
if (message.content.contains(word)) {
message.reply(moringResponseWord[new Random().nextInt(moringResponseWord.length)]);
return t... |
6f078f2d-ba60-4442-b684-d09aa7ce6201 | 5 | private void mouseReleased()
{
for (int i = 0;i<parent.cells.size();i++) {
if (mouse.width>parent.cells.get(i).getX() &&
mouse.width<parent.cells.get(i).getX() + parent.cells.get(i).getW() &&
mouse.height>parent.cells.get(i).getY() &&
mouse.height<parent.cells.get(i).getY() + parent.cells.get(i).ge... |
e3549d34-9eaa-42eb-ba75-12ea21a20afa | 4 | public static boolean chkRow(char[] arr){
Set<Character> set = new HashSet<>();
boolean res = true;
for(int i=0;i<arr.length;i++){
if(arr[i]!='.') {
if (set.contains(arr[i])) {
if(log) {
prints(set);
System.out.println(arr[i]);
}
res = false;
break;
} else {
set.add... |
241af742-9bb0-4d5f-ac05-d177db0ede12 | 7 | public static void main(String[] args) throws IOException {
ServerSocket server = new ServerSocket(LISTENING_PORT, 1, InetAddress.getByName("127.0.0.1"));
Socket socket = null;
BufferedReader input = null;
PrintWriter output = null;
while (true) {
socket = server.a... |
627bdaa0-cd99-45a7-b3a2-bfe975417a34 | 4 | @Override
public void update(GameContainer gc, StateBasedGame sb, float delta)
throws SlickException {
if (gc.getInput().isKeyDown(Input.KEY_LEFT)) {
owner.setVelocity(new Vector2f(-speed*delta, owner.getVelocity().y));
}
if (gc.getInput().isKeyDown(Input.KEY_RIGHT)... |
2639ada7-690a-48c3-b415-b232243b8307 | 6 | public static void getProfInfo(CommandSender sender,String prof,Professions plugin) throws Exception {
prof = prof.toLowerCase();
Player p = (Player) sender;
/*
* Output sexy messages...
*/
if ( plugin.getConfig().getString("profs." + prof) != ... |
d47d13d8-073f-4f23-9b44-12d764e9e942 | 5 | public static void scanForFiles(File file, IFileScanner sc)
{
assert FileHelper.isReal(file);
File[] files = file.listFiles();
if (files == null || files.length == 0)
{
return;
}
for (File f : files)
{
if (f.isDirectory())
{
scanForFiles(f, sc);
}
if (!sc.scan(f))
... |
4082f5d2-15ff-4bc1-a0d9-89491fc23360 | 6 | @Override
public int match(String[] argsToTest) {
for (String testArg : argsToTest) {
if (isCommandArg(testArg)) {
boolean argIsInDisallowedList = false;
for (String disallowedElem : disallowed) {
if (testArg.equals(disallowedElem)) {
argIsInDisallowedList = true;
}
}
if (argIsIn... |
a058c041-6bdf-434e-bee8-9ed0d3f3d2be | 2 | private boolean isLeaf() {
return this.left == null && this.right == null && this.middle == null;
} |
d46159b0-0164-4dd8-80dd-db60297fa924 | 9 | private static int getC(Integer[] a, int count, int start, int[] values){
int mindiff = Integer.MAX_VALUE;
if (count == 1){
int leftsum = 0;
int rightsum = 0;
for (int j = 0; j<a.length;j++){
if (a[j] ==1)
leftsum += values[j];
else
rightsum += values[j];
}
for (int i = start; i<a.... |
239f55e5-3fcc-49b6-b65b-725052f9517b | 5 | public ThongTinSV() throws Exception {
initComponents();
setComponents();
LoadData();
//st Tim Kiem cai dat thuoc tinh
sfTimKiem.setSearchMode(JXSearchField.SearchMode.INSTANT);
sfTimKiem.setInstantSearchDelay(180);//delay mot khoang 180 milisecond giua 2 lan tim tiem
... |
349cd3e8-c2e2-4a9e-b61f-e8aa2309d01f | 6 | public void mousePressed(MouseEvent e) {
Point p = e.getPoint();
if (p.x >= BOUNDS.width) {
return;
} else if (p.y >= BOUNDS.height) {
return;
} else if (p.y < 0) {
return;
} else if (p.x < 0) {
return;
... |
41cb3a51-2ec3-400a-9964-dbd8f76345b7 | 9 | private void executeCommand(final String text) {
final InputStream procInput;
new Thread(new Runnable() {
public void run() {
String newRequestText = "";
try {
temp_files_to_clean_up.add(buffer_file.getCanonicalPath());
... |
a6108b62-b7e9-4d3e-a876-b122fd49f7c8 | 2 | public XmlLoader(String name) {
if (!name.equals("")) {
try {
file = new File(name);
dbFactory = DocumentBuilderFactory.newInstance();
dBuilder = dbFactory.newDocumentBuilder();
doc = dBuilder.parse(file);
doc.getDocumentElement().normalize();
} catch (Exception e) {
e.printStackTrace()... |
242e97b0-01c6-4f33-889e-d718bf4909f2 | 2 | public int onClock() {
for(Slot s : slots) {
if (Slot.BasicStates.PENDING.equals(s.state)) {
return s.pickId;
}
}
throw new RuntimeException("No pending draft picks");
} |
9c1c28fd-eb2c-481b-b8f6-f9b62c6408d4 | 9 | public void playerKilledPlayer(Player player, Player damagedPlayer){
if(plugin.isEnabled() == true){
Quester quester;
try{
quester = plugin.getQuestInteraction().getQuester(player);
}catch(NullPointerException npe){
return;//player logged out since they hurt a monster so exit out
... |
93a0f6e6-5428-4262-9225-c0a9997057b3 | 4 | public static DataProviderStatus parse(String value) {
DataProviderStatus status = null;
if(!Utilities.isNullOrWhitespace(value)) {
String[] items = value.split("[\\s\\[\\]]");
if(items != null) {
if(items.length == 2) {
status = new DataProviderStatus(items[0], items[1]);
} else if(items.... |
806f8ace-8052-413c-9fcd-464657a385db | 9 | public static void main(String[] args) throws Exception {
boolean cinetFileSet = false;
boolean modelCheckerSet = false;
boolean modelCheckerCommandSet = false;
String cinetFile = new String();
for (String string : args) {
if(string != null && string.length()>0) {
if (string.startsWith("-cinetFile="... |
29b82126-a900-4b76-9c42-717845a06503 | 9 | @EventHandler
public void onPlayerInteract(PlayerInteractEvent event){
Player player = event.getPlayer();
Action action = event.getAction();
@SuppressWarnings("unused")
ItemStack hand = player.getItemInHand();
if(GameUtils.isInGame(player)){
if(event.getAction() == Action.RIGHT_CLICK_BLOCK){
Block ... |
98160cb4-fb1a-403d-8126-64961638643f | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Question other = (Question) obj;
if (!Objects.equals(this.triviaQuestion, other.triviaQuestion)) {
... |
ca850fac-ae4c-497b-9779-2b8b619e3811 | 8 | private List<String> generaCacheKey(Object obj) {
ORMTable ormTable = obj.getClass().getAnnotation(ORMTable.class);
if (ormTable != null) {
String cachedTableKey = "".equalsIgnoreCase(ormTable.cachedShortAlias()) ? ormTable.tableName() : ormTable.cachedShortAlias();
String[] cachedKeys = ormTable.cachedKey();... |
6343773f-661a-4efc-bb60-e157a9e4e486 | 1 | @Override
public void reSize(long newMaxSize) {
if (newMaxSize <= 0) {
throw new IllegalArgumentException("newMaxSize <= 0");
}
synchronized (this) {
mMaxSize = newMaxSize;
}
trimToSize(newMaxSize);
} |
b484b16f-424e-44b8-9240-a984ba715507 | 4 | private boolean useUlt(){
return Global.useRejuvenate ? Methods.getHpPercent() >= (Eat.HEAL_PERCENT +5) && ActionBar.getNode(1).canUse()
&& ActionBar.getAdrenaline() == 1000 : ActionBar.getNode(1).canUse() && ActionBar.getAdrenaline() == 1000;
} |
eb464d9b-301e-42b1-a0a1-4d9489db7a0a | 6 | public void paint(Graphics g)
{
if (pal == null)
return;
g.setColor(Color.BLACK);
g.fillRect(0, 0, ((pal.length / rows) * squareSize) + 1,
(rows * squareSize) + 1);
if (pal == null)
{
g.setColor(Color.BLACK);
for (int i = 0; i <... |
40b760c3-cefb-455c-bc4b-cc32d9b7e131 | 5 | @Override
public byte[] generate(World arg0, Random arg1, int arg2, int arg3) {
byte[] result = new byte[32768];
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
for (int y = 0; y < 64; y++) {
if (y < 54) {
result[(x * 16 + z)... |
7c38e53f-a3b9-46ef-9855-e44035aa5091 | 0 | public NameChangeMessage(String oldName, String newName) {
this.oldName = oldName;
this.newName = newName;
} |
8d464fc1-312a-48dd-9f3e-ffa13298d728 | 4 | private void showAccount(String accountId, String instanceUrl,
String accessToken, PrintWriter writer) throws ServletException,
IOException {
HttpClient httpclient = new HttpClient();
GetMethod get = new GetMethod(instanceUrl
+ "/services/data/v20.0/sobjects/Accou... |
b1ff4595-672d-4187-acda-c5b094ea6c2b | 5 | int besterror(float[] a, int step, int addmul){
int best=best(a, step);
switch(addmul){
case 0:
for(int i=0, o=0; i<dim; i++, o+=step)
a[o]-=valuelist[best*dim+i];
break;
case 1:
for(int i=0, o=0; i<dim; i++, o+=step){
float val=valuelist[best*dim+i];
... |
e8f1796d-2620-41ba-b7cf-4c1502e84fba | 1 | public boolean hasPermission(Permissions p) {
if (permissions.contains(p))
return true;
return false;
} |
4062a13a-c9e3-430f-a3fb-31498f384924 | 3 | public String getCreator() {
Object value = library.getObject(entries, "Creator");
if (value != null && value instanceof StringObject) {
StringObject text = (StringObject) value;
return cleanString(text.getDecryptedLiteralString(securityManager));
}
else if (value... |
5520ac7d-7c6d-4f55-84bf-f289e9b4b30c | 9 | public Vector NumberofSoils(String pathname)
{
//String filename = pathname +"/soil.cdf";
String aFile = this.getClass().getResource("/Data/187/2012-03-21/soil.cdf").getPath();
//String filename = "/Data/187/2012-03-21/soil.cdf";
Vector uniqueVals = new Vector();
Vector soilVector = new Vector();
Net... |
b05b5e9e-6cbb-4257-90d4-d028804411ca | 3 | public static int posMax2(CharSeq s)
{
CharSeqIt csi = new CharSeqIt(s); //initialize iterator
char next; //char for holding the next value
char MaxVal = 0; //initialize at 0
int MaxValPos = -1; //initialize position of max value at error value
int i = 0; //for keeping track of current position
... |
71abc9e1-806a-4aeb-b564-e13fed69f3c1 | 3 | private void loadFile(File file){
try {
numberOfLinesInFile = 0;
BufferedReader reader = new BufferedReader(new FileReader(file));
String line = null;
while ((line = reader.readLine()) != null) {
numberOfLinesInFile++;
}
rea... |
c0aef979-4cc0-4756-be4c-a98dbf3102ae | 4 | private double getPesoLlaveEntera(int llave){
double peso = 0;
switch (llave) {
case 0:
peso = this.getPeso(LONGITUD_SEPALO);
break;
case 1:
peso = this.getPeso(ANCHO_SEPALO);
break;
case 2:
peso = this.getPeso(LONGITUD_PETALO);
break;
case 3:
peso = this.getPeso(ANCHO_PET... |
23a3035d-883f-493a-be6c-eeadc1a7e9a9 | 1 | private void drawNumberInsideCardArea(Graphics g, Card aFaceDownCard) {
Rectangle cardArea = aFaceDownCard.getCardArea();
int numberLeftInPack = cardStack.size();
g.setFont(new Font("Times", Font.BOLD, 48));
if (numberLeftInPack < 10) {
g.drawString("" + numberLeftInPack,
cardArea.x + cardArea.width / 3... |
dbfa255d-8a5d-4000-8dc8-c4152769a1e4 | 9 | public void mouseMoved(MouseEvent e) {
// TODO Auto-generated method stub
handXPos = e.getX();
handYPos = e.getY();
handInView = e.getSource().equals(mapScrollPane.getMapView());
footerContainer.updateHand(handXPos, handYPos);
boolean found = false;
if (hand != 0)
{
//Check that map is creat... |
5e6b0bef-8ec0-46f6-8a7c-e13fd36509e3 | 0 | public void setaField2(long aField2) {
this.aField2 = aField2;
} |
e7af268f-bda0-49a5-bd71-6eb184cf0b8b | 2 | public boolean equals(Song s){
boolean isEqual; //Holds value of test
/*Nested if to test if Song Title then Artist match
*/
if (title.equals(s.title)){ //If titles =, test artist
if(artist.equals(s.artist)) //If artist =, pass true
... |
ec3b3807-abb4-45ec-ba5e-9cd193545dc1 | 6 | public JMenuItem createLoadItem() {
load = new JMenuItem("Load");
load.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_L, ActionEvent.CTRL_MASK));
load.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
File... |
1c0ac6d1-ecbf-40f5-ae45-63e21a3110f8 | 0 | public float getMaxSpeed() {
return 0.05f;
} |
f8a1c5ad-848a-4316-9cc1-cae418701d71 | 4 | public void setPositionPossible()
{
for(int a=0; a<8; a++)
{
for(int b=0; b<8; b++){
this.PositionPossible[a][b]=0;
}
}
for (int a = 0 ; a < 8 ; a++)
this.PositionPossible[a][this.position.getJ()] = 1;
for (int a = 0 ; a < 8 ; a++)
this.PositionPossible[this.position.getI()][a] = 1;
... |
de40d725-7870-473b-aa02-832759a73366 | 7 | public void keyReleased(KeyEvent e) {
int key = e.getKeyCode();
switch(key){
case KeyEvent.VK_CONTROL:
fire();
break;
case KeyEvent.VK_W:
bu = false;
break;
case KeyEvent.VK_A :
bl = false;
break;
case KeyEvent.VK_D :
br = false;;
break;
case KeyEvent.VK_S :
bd = false;;
... |
b9b4bd33-16cf-49fd-8856-ff1e17e75162 | 9 | public void checkLineOfSight(ChessPosition start, ChessPosition end)
throws IllegalMove {
ChessGame g = getGame();
ChessBoard b = g.getBoard();
int dx = 0;
int dy = 0;
if (start.getY() > end.getY()) {
dy = -1;
}
if (start.getY() < end.getY()) {
dy = 1;
}
if (start.getX() >... |
2b031ed0-8345-4917-b2c7-72bbf2564267 | 7 | private String translate(Throwable t) {
Throwable err = t;
while (err.getCause() != null
&& err.getClass().equals(RuntimeException.class)) {
err = err.getCause();
}
if (err instanceof InfoRequestException) {
if (err.getCause() != null
&& err.getCause().getMessage().contains("1404")) {
return... |
a7070698-563b-4f8d-b78c-64521071e729 | 2 | public void display(){
LinkedNode root = this;
if(root == null)
return;
while(root!=null){
System.out.println("Key is "+root.getKey()+ " : Value is "+root.getValue());
root = root.getNext();
}
} |
318899ef-a17b-43af-9e0b-c142617e15c8 | 9 | public void clearmarks ()
// clear all marks in the current node
{
getinformation();
undonode();
ListElement la = Pos.node().actions(), lan;
Action a;
while (la != null)
{
a = (Action)la.content();
lan = la.next();
if (a.type().equals("M") || a.type().equals("L")
|| a.type().equals("MA") || a... |
90a74b9b-b351-4a12-be1c-28b3cce0eaab | 4 | public void outOfBoundsCorrection(GameObject background) {
if(this.getX() < background.getX()){
this.setX(background.getX());
}
if((this.getX() + this.getSize().width) > (background.getX() + background.getSize().getWidth())){
this.setX((int)(background.getX() + background.getSize().getWidth() - this.getSize... |
a1f61307-311f-44e1-a571-7af5c9dfcdc0 | 3 | public static void assignHall() {
initStuIDVec();
for (int i = 0; i < DiningRoom.size(); i++) {
Table thisTable = new Table((Table) DiningRoom.get(i));
thisTable.reset();
}
Integer startTableNum = new Integer(R.nextInt(27)); // pick a random
// starting table
unAssignedStudents = Assig... |
21d7a6ab-c9bb-4e04-acd6-d6103bed3d4a | 5 | @Test
public void twoFilesInTwoFolderTrees() throws IOException {
File newFolder = tempFolder.newFolder();
File folderCom = new File(newFolder.getAbsolutePath() + "/src/java/com");
File folderWmi = new File(newFolder.getAbsolutePath() + "/src/java/com/wmi");
if(!folderCom.mkdirs() ||... |
4e108af7-534a-4c44-bb18-952c5b53f4f4 | 0 | @Basic
@Column(name = "id_elemento")
public int getIdElemento() {
return idElemento;
} |
e3a5fc03-f0ab-4a8c-9a59-2e67693c8cad | 3 | @Override
public Editor ListById(int id_editor) {
Connection conn = null;
PreparedStatement pstm = null;
ResultSet rs = null;
Editor ed = new Editor();
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(LISTBYID);
p... |
160ee098-b0c0-4741-a816-be7774d91024 | 8 | public void displayBoard(CheckersSetup setup) {
int piecesOnBoard[][] = setup.getPiecesOnBoard();
//remove all pegs from prev board.
for(int i=0; i<this.rows; i++) {
for(int j=0; j<this.columns; j++) {
this.removePeg(i, j);
}
}
//Display based on board array:
for(int i=0; i<this.rows;... |
0f4998d5-de55-4661-a776-381da56d2f48 | 5 | private void processMessage(Message message){
MessageType type = message.getType();
String strMsg = String.valueOf(message.getMessage());
if(type == MessageType.sending){
writer.sendAllsUsers(message);
}
else if(type == MessageType.connec... |
6a7ccb34-0c9f-473c-b77c-7ecec9dfdf41 | 1 | public void GenerateLevel() {
this.width = 64;
this.height = 64;
this.tiles = new byte[64*64];
for (int i = 0; i < tiles.length; i++) {
tiles[i] = (byte)(rand.nextInt(2)+1);
}
} |
837ef819-9d59-4d92-8490-cca2918b27eb | 6 | @PUT
@Path("/{id}")
@Consumes(MediaType.LIBROS_API_LIBRO)
@Produces(MediaType.LIBROS_API_LIBRO)
public Libro updateLibro(@PathParam("id") int id, Libro libro) {
if (security.isUserInRole("registered")) {
throw new NotAllowedException();
}
Connection conn = null;
Statement stmt = null;
try {
conn = d... |
593da03f-2f6c-43f7-8bb2-d7e1e702d561 | 0 | public void windowClosed(WindowEvent e)
{
// TODO Auto-generated method stub
} |
622df316-4611-419a-8e89-68a7dcb6735c | 4 | private static void mycrossi(IntSeq i1, IntSeq i2) {
IntSeqIt ii1 = new IntSeqIt(i1);
boolean first = true;
while ( ii1.hasNext() ) {
try {
int p1 = ii1.next();
IntSeqIt ii2 = new IntSeqIt(i2);
while ( ii2.hasNext() ) {
... |
e2709e45-e0d8-4318-ac8a-c64314e1d60a | 7 | protected Container[][][] getContainerLevel(int diff){
Container[][][] cLevel = new Container[6][5][3];
do{
for(int i = 0; i < 6; i++){
for(int j = 0; j < 5; j++){
//TODO: Revert the condition to 'k < 3' when done with testing.
for(int ... |
8b62e4b0-125a-4990-b420-c37e6f0e153d | 4 | public void clearDisplay() {
if(userPaint!=null && systemPaint!=null) {
for(int row = 0; row < systemPaint.length; row++) {
for(int col = 0; col < systemPaint[row].length; col++) {
userPaint[row][col] = background;
}
}
updat... |
c82896bd-3f55-48c1-9573-521cf8ffe74e | 3 | @Override
void removeChild(@SuppressWarnings("unused") Node child)
{
// Remove child
if(this._identificador_ == child)
{
this._identificador_ = null;
return;
}
if(this._declaracao_.remove(child))
{
return;
}
if... |
15030f8a-5f13-4be8-a030-4a2f71892497 | 4 | private static Expression getExpression(Tree t, Root entity, CriteriaBuilder cb)
{
if ( t != null )
{
String myval = t.getText();
int type = t.getType();
if ( type == eelLexer.STRING )
{
return cb.literal( (String) myval );
... |
664b234f-a4b3-4211-9e2b-67635a005959 | 2 | public boolean isGetMethodPresentFor(Field field) {
FieldStoreItem item = store.get(FieldStoreItem.createKey(field));
if(item != null) {
return item.getGetMethod() != null ? true : false;
}
return false;
} |
8a9c0705-2c8e-40b4-bae7-24c22b5af91d | 1 | @Test
public void testAcceptableError() {
halt = new AcceptableError(2,4);
vanillaSwarm.setHaltingCriteria(halt);
Vector<Double> opt = vanillaSwarm.optimise(function);
double result = function.CalculateFitness(opt);
assertTrue(result >= 2 - 4 && result <= 2 + 4);
} |
9023e5a8-c7dd-4915-9dad-4d3a39ba76d6 | 5 | public void doSave(String path) {
FileOutputStream outputStream = null;
ObjectOutputStream serializer = null;
try {
outputStream = new FileOutputStream(path);
serializer = new ObjectOutputStream(outputStream);
serializer.writeObject(dictionary);
} catc... |
9d41d8b5-596f-413b-b9a2-3efcaeed109c | 5 | public File getUserDirectoryForApp(String appName) {
String userHome = System.getProperty("user.home", ".");
switch (this) {
case LINUX:
return new File(userHome, "."+appName+"/");
case WINDOWS:
String applicationData = System.getenv("APPDATA");
... |
b8486a27-df14-4544-9f9a-d12c7e094b6d | 7 | @Override
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == addPeriodicTaskButton) {
addPeriodicTaskButtonClicked();
} else if (arg0.getSource() == removePeriodicTaskButton) {
removePeriodicTaskButtonClicked();
} else if (arg0.getSource() == addAperiodicTaskButton) {
addAperiodicTa... |
9e6e3031-e350-4d53-a9f2-3a4ce79c910e | 7 | public void write(int bits, int width) throws IOException {
if (bits == 0 && width == 0) {
return;
}
if (width <= 0 || width > 32) {
throw new IOException("Bad write width.");
}
while (width > 0) {
int actual = width;
if (actual > t... |
8e7f2df7-9ee6-4942-bb66-aa47653fdd38 | 7 | String print(Object o) {
if (!this.enabled) {
return null;
}
final StringBuilder builder = new StringBuilder();
builder.append(this.clazz.getSimpleName()).append('{');
for (final Map.Entry<String, Field> entry : (this.full ? this.internalMap : this.mappings).entrySet(... |
ea458038-cc06-429f-9230-9b00fd05bd45 | 7 | public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof XYAreaRenderer)) {
return false;
}
XYAreaRenderer that = (XYAreaRenderer) obj;
if (this.plotArea != that.plotArea) {
return false;
... |
033fc871-fa35-45c6-8689-6541afd9a536 | 6 | public static void main( String[] args ) throws Exception {
if(hasCommandLineArg(args,Constants.DEBUG_FLAG)) {
DebugPrint.DEBUG = true;
}
if(hasCommandLineArg(args,Constants.ZOMBIE_FLAG)) {
Logger.formInstance(Constants.ZOMBIE_LOG_FILE);
Zombie runner;
... |
85925f17-ffc4-4b24-a31b-7e75a0694e51 | 0 | @Override
public String getDesc() {
return "SilenceAttack";
} |
9b53917b-e3f2-4a4a-b6ad-d3bae8f7fb61 | 6 | static final char method990(char c, byte i) {
anInt8444++;
if ((c ^ 0xffffffff) == -199)
return 'E';
if ((c ^ 0xffffffff) == -231)
return 'e';
if (c == 223)
return 's';
if ((c ^ 0xffffffff) == -339)
return 'E';
if (c == 339)
return 'e';
if (i >= -18)
return 'M';
return '\0';
} |
b07ba758-50bc-4bea-9dc4-17c3429798a4 | 9 | @Override
public int attack(final NPC npc, final Entity target) {
final NPCCombatDefinitions defs = npc.getCombatDefinitions();
int attackStyle = Utils.random(3);
if(attackStyle == 0) {
int distanceX = target.getX() - npc.getX();
int distanceY = target.getY() - npc.getY();
int size = npc.getSize();
i... |
2e2d353d-8ec4-4652-87a4-5ab32d827ab4 | 6 | public static Polynomial berlekampMassey(final Sequence seq) {
final int n = seq.getLength();
Polynomial C = new Polynomial(1);
Polynomial B = new Polynomial(1);
int x = 1;
int L = 0;
int b = 1;
int N = 0;
while(N != n) {
int temp = 0;
... |
4c2c1378-0929-4761-954e-2f33ad95ad98 | 8 | private Set<Class<?>> getFromDirectory(final File directory, final String packageName) {
final Set<Class<?>> classes = new HashSet<Class<?>>();
if (directory.exists()) {
final File[] files = directory.listFiles();
for (final File file : files) {
if (file.isDirec... |
7b9873d4-3b77-41fe-b708-32948c55363b | 9 | public void onMapCLick(int x, int y){
if(parent.getDelObjMode()){
for(int i = 0; i < parent.xmlObjs.get(myNum).size(); i++){
XMLObj temp = parent.xmlObjs.get(myNum).get(i);
if(temp.vars.get(0).intValue() == x && temp.vars.get(1).intValue() == y){
parent.xmlObjs.get(myNum).remove(i);
i--;
... |
eb26edbc-fc23-4b4d-b406-c53a5a62160d | 3 | StatementSequenceNode statementSequence() {
ArrayList<AbstractNode> list = new ArrayList<AbstractNode>();
AbstractNode stmt = statement();
if (stmt != null) {
list.add(stmt);
}
// while (!testLookAhead(END) && !testLookAhead(ELSE) && !testLookAhead(ELSIF) && !testLookAhead(UNTIL)) {
while (test(SEMICOL... |
6ff9aeae-0cb7-4963-bf0f-571e43f3ea72 | 9 | public static void bindToEquivalentValue(LogicObject from, Description to) {
if (from == to) {
return;
}
if (Surrogate.subtypeOfP(Stella_Object.safePrimaryType(from), Logic.SGT_LOGIC_SKOLEM)) {
{ Skolem from000 = ((Skolem)(from));
{ Skolem object000 = from000;
Stella_Object va... |
8c78c585-2904-4e70-866c-11feb3fb1efa | 4 | private static List<int[]> getRandomResources(BookmarkReader reader, int count, int trainSize) {
List<int[]> resources = new ArrayList<int[]>();
int resCount = reader.getResources().size();
for (int userID : reader.getUniqueUserListFromTestSet(trainSize)) {
List<Integer> userResources = Bookmark.getResources... |
d8a0ba10-3caf-49a9-8733-4f048e8fd4ac | 0 | public GroupAi(GoAiGame game1)
{
game = game1;
pieces = new HashSet<Piece>();
liberties = new HashSet<Square>();
} |
6f4d73b8-92cd-491e-baad-b1b8c99fea82 | 3 | public void pop() {
int tmp = stack.pop();
if(tmp == min){
min = Integer.MAX_VALUE;
for(Integer e : stack) {
if(e < min) {
min = e;
}
}
}
} |
9c2356be-cfa4-4eba-b0a4-b02743ce1d99 | 2 | @Override
public void initialize(String filePath) {
patternEncoderUtil = new PatternEncoderUtil();
try {
setUtil(patternEncoderUtil);
analyzePattern(new FileReader(filePath));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
try {... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.