method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
30b2b9f8-63e7-4eb5-ba46-28da6b351f09 | 5 | private Node findNode(Node node, int width, int height, int depth) {
Node foundNode = null;
if (node.used) {
foundNode = findNode(node.right, width, height, ++depth);
depth--;
if (foundNode == null && depth == 0)
foundNode = findNode(node.down, width, height, depth);
} else if (width <= (this... |
e7f8438f-f803-41ba-81b2-395acb1f9ddb | 3 | public void buyGarr() {
if(Gold<10) {
MF.writeNarra("You don't have enough gold!");
return;
}
if(Pop<20) {
MF.writeNarra("You don't have the Population to support an army!");
return;
}
if(Pop<10) {
MF.writeNarra("You don... |
16d2307e-e7b8-4b7e-ac0f-c28aeae24021 | 3 | public VgerBibData getBibData()
{
VgerHoldingDataGenerator holdingGen;
VgerItemDataGenerator itemGen;
makeConnection();
bibData = new VgerBibData();
bibData = ( VgerBibData ) new JdbcTemplate( ds ).queryForObject( BIB_QUERY, new Object[]
{ getBibID() }, new VgerBibDataMapper() );
... |
1d37070a-0292-47dc-be65-455c95749a55 | 1 | @Override
public void testFinished(Description description) {
if (hasPassed()) {
logger.info("END Testcase '{}' {} PASSED", getId(description), description.getDisplayName());
}
} |
4e28aaee-9592-42b5-b7d0-77438505995a | 9 | static final boolean method778(int i, int i_59_, int i_60_, boolean bool, int i_61_, int i_62_, int i_63_, int i_64_, int i_65_) {
anInt1040++;
int fromSceneX = Class295.myPlayer.scenePositionXQueue[0];
int fromSceneY = Class295.myPlayer.scenePositionYQueue[0];
if ((fromSceneX ^ 0xffffffff) > -1 || fromSceneX >... |
79e5343b-255b-488d-9e7f-40aea7c4bcf0 | 8 | @Override
public void actionPerformed(ActionEvent e) {
int position = tabManager.GetCursorPosition();
String text = tabManager.getText();
/*
* int startOfCurLine = text.lastIndexOf('\n', position)+1; if
* (text.lastIndexOf('\t', position)>startOfCurLine)
* startOfCurLine=text.lastIndexOf('\t', position... |
cf8788d3-43bd-4d78-b515-c591ab1d3400 | 9 | public static double density(double x, double shape, double scale) {
/*!* #ifdef IEEE_754 /*4!*/
if (Double.isNaN(x) || Double.isNaN(shape) || Double.isNaN(scale)) return x + shape + scale;
/*!* #endif /*4!*/
if (shape <= 0 || scale <= 0) { throw new java.lang.ArithmeticException("Math ... |
953d3ef7-aa76-444f-b803-793226c1b429 | 3 | public static boolean byteArraysEqual(byte[] first, byte[] second)
{
if (first.length == second.length)
{
boolean equals = true;
for (int i = 0; i < first.length; i++)
{
equals = equals && first[i] == second[i];
}
return equals;
}
return false;
} |
913d4a9d-b13e-4ae6-a8a0-135d5f1a00c1 | 3 | public Whitelist addProtocols(String tag, String key, String... protocols) {
Validate.notEmpty(tag);
Validate.notEmpty(key);
Validate.notNull(protocols);
TagName tagName = TagName.valueOf(tag);
AttributeKey attrKey = AttributeKey.valueOf(key);
Map<AttributeKey, Set<Proto... |
1ab64cbd-87c2-4240-96bf-2067f639a439 | 8 | public int[] getDiagonalCoord(int x1,int y1,int x2, int y2)
{
int [] arr = new int[4];
if((x1-x2)>0 && (y1-y2)<0)
{
arr[0]=x2; arr[2]=x1;
arr[1]=y1; arr[3]=y2;
}
if((x1-x2)<0 && (y1-y2)>0)
{
arr[0]=x1; arr[2]=x2;
arr[1]=... |
6a8565e5-4b8f-4f47-9409-0e197a044fc8 | 1 | public BufferedImage getBackdropImage(int layer) {
if(backdrop[layer].getAnimated()) return game.bitmapFact.getAnimatedBackgroundImage(backdrop[layer].getImage());
else return game.bitmapFact.getBackgroundImage(backdrop[layer].getImage());
} |
c235cc0d-b1c0-4742-b99c-dfb812b457a5 | 3 | public BackupManager(){
String OS = System.getProperty("os.name");
String HOME = (System.getProperty("user.home"));
if (OS.contains("Windows 7")||OS.contains("Windows 8")) {
BACKUP_DIR = HOME+SEVEN_DIR;
}else if (OS.contains("Windows XP")) {
BACKUP_DIR = HOME+XP_DIR;
}else{
BACKUP_DIR = HOME+MAC_DIR;... |
3228c036-d7e4-4fe7-9dab-7c75702036a9 | 7 | private double[] getTotalKineticEnergy(byte type, Shape shape) {
double[] result = new double[2];
result[0] = result[1] = 0;
Atom a = null;
for (int i = 0; i < numberOfAtoms; i++) {
a = atom[i];
if (type == -1) {
if (shape == null || a.isCenterOfMassContained(shape)) {
result[0]++;
result[1]... |
a6881006-5a62-45cb-8388-95cab6e3c2a1 | 2 | public void testPropertyCompareToMinute() {
TimeOfDay test1 = new TimeOfDay(TEST_TIME1);
TimeOfDay test2 = new TimeOfDay(TEST_TIME2);
assertEquals(true, test1.minuteOfHour().compareTo(test2) < 0);
assertEquals(true, test2.minuteOfHour().compareTo(test1) > 0);
assertEquals(true, t... |
2306125e-f3f1-4d3b-a899-860d1ea88a88 | 5 | public static void draw() {
Display.setTitle("Main Menu");
glPushMatrix();
BaseTextureLoader.texture.release();
glLoadIdentity();
glColor3f(0.32f, 0.32f, 0.32f);
glBegin(GL_QUADS);
glVertex2f(0f, 720f);
glVertex2f(1280f, 720f);
glVertex2f(1280f, 0f);
glVertex2f(0f, 0f);
glEnd();
startButt... |
2e84ecc2-b73c-4471-88f9-e21f27423969 | 8 | @Override
public void enable(boolean force) throws IllegalStateException
{
// Make sure MobManager is enabled
if (P.p() == null || !P.p().isEnabled())
{
throw new IllegalStateException("MobManager must be enabled to enable the Limiter");
}
// Check if the Spawner is already enabled
if (this.isEnable... |
46cc2f00-ff40-48de-884e-b04ac834748a | 4 | @Override
public void execute(CommandSender sender, String Command, List<String> args) {
this.init(sender);
MarketSign ms = this.getClicked().get(sender.getName());
if (ms == null) {
this.error("Du musst erst ein MarketSign auswählen!");
return;
}
if (!ms.getOwner().equals(player.getName()) && !player... |
b434a51d-c1e7-4bac-b12e-48d1e92cfbac | 1 | public boolean InsertarPunto(Punto p){
if (p!=null) {
cx.Insertar(p);
return true;
}else {
return false;
}
} |
ba96509c-7c72-4df7-904e-0a27f38b0c5d | 7 | public void selectAll() {
ResultSet res = null; // получает результаты SQL запросов
ResultSet res_struct = null;
Statement stment = null; // хранит и выполняет SQL запросы
Statement stment_struct = null;
String sql = "SELECT * FROM Detail"; // подготовка SQL запроса
String sql_s... |
ea5feedd-2259-4c96-b823-3258fada1c04 | 6 | @Override
public void actionPerformed(ActionEvent e) {
if(e.getSource().equals(serverLocator)) {
if(AdminClient.client != null) {
try {
AdminClient.client.signOut();
} catch (SocketTimeoutException e1) {
}
AdminClient.client = null;
}
SwitchServerWindow ssw = new SwitchServerWindow();
... |
294ea9e1-048b-409b-8759-96f4684c25b3 | 8 | public synchronized Object insert( Object key, Object value,
boolean replace )
throws IOException
{
if ( key == null ) {
throw new IllegalArgumentException( "Argument 'key' is null" );
}
if ( value == null ) {
throw new I... |
e32d4b02-3faf-4b7e-b078-233eb88885d2 | 7 | public void createTuple(ArrayList<XmlAttr> tupleData, ArrayList<XmlAttr> base, int iteration, int size)
{
// Test if tuple size is reached.
if (base.size() == size)
{
// Create unique tag
String tag = "";
for (int i = 0; i < size; ++i)
tag += base.get(i).id+";";
Tuple tuple = new Tuple();
tupl... |
adceb4a0-26ef-49fa-8d0a-b00c8ba6fbdb | 6 | public boolean getBoolean(int index) throws JSONException {
Object object = this.get(index);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equal... |
5679356d-edac-41fa-839b-865b943a0d9d | 5 | public int get_BY(int INDEX, String code)
{
log.log(4, log_key, "call get_BY, INDEX = ", new Integer(INDEX).toString(), "\n");
for(;;INDEX++)
{
if ( (code.charAt(INDEX) == 'D') &&
(code.charAt(INDEX + 1) == 'O') )
{
log.log(4, lo... |
6a2f3999-5237-48e1-bd5c-63d88bb176f2 | 1 | protected FileRef fieldToFileRef(Field field, FileRef basedir) {
String path = fieldToPath(field);
if (basedir == null) {
return fileHandle(path);
}
return basedir.child(path);
} |
e476ece8-b54b-42ef-9610-ea46de73783b | 8 | public void tickItem() throws Exception
{
for(int Par1 = 0; Par1 < Items.size(); Par1++)
{
tempItem = Items.get(Par1);
if(tempItem.getBounds().intersects(Main.Character.getBounds(Main.Frame.getWidth(), Main.Frame.getHeight())))
{
if(tempItem.getName() == "Heart")
{
if(Main.Character.ge... |
d9d5b6c6-3dbc-45ab-8e41-111ba9964cb3 | 2 | public static void update() {
for (int i = 0; i < NUM_KEYCODES; i++)
lastKeys[i] = getKey(i);
for (int i = 0; i < NUM_MOUSEBUTTONS; i++)
lastMouse[i] = getMouse(i);
} |
79489096-e1cb-4e01-8bc7-f7df09ac1706 | 7 | @EventHandler
public void SkeletonHunger(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.getZombieConfig().getDouble("Skeleton.Hung... |
5103c86e-7d48-4391-8362-b62f98cc810a | 1 | public void setHave(int index){
if(index < this.bitfield.length)
this.bitfield[index] = true;
} |
182214a9-c2db-4eed-8ba9-0b19da92dbcf | 0 | public Blog updateBlog(Blog pBlog){
return this.blogModelBS.updateBlog(pBlog);
} |
63cac43e-0f52-4403-af96-08693c001445 | 0 | public JLabel getjLabel2() {
return jLabel2;
} |
315a6841-b11d-4724-8de4-5aeb4f0b6e63 | 3 | private static void accessServer() {
try {
datagramSocket = new DatagramSocket();
// Set up stream for keyboard entry...
Scanner userEntry = new Scanner(System.in);
String message = "", response = "";
do {
System.out.println("Enter message: ");
message = userEntry.nextLine();
if (!message.... |
f20cfdef-af36-4791-a59d-77a8659f8fb2 | 1 | @Override
public void closeHandler() {
try {
con.close();
} catch (SQLException e) {
// TODO 自動生成された catch ブロック
e.printStackTrace();
}
} |
2e5f155b-2b16-432e-8502-63d313c4f995 | 0 | @Override
public boolean supportsMoveability() {return true;} |
aced87f3-ac45-44c6-88f3-ca528a9bb622 | 1 | public void enQueue(Process p) // Add process to the tail.
{
if(head == null)
head = tail = p;
else{
tail.next = p;
p.previous = tail;
tail = p;
}
} |
80ac8703-29ee-4bd5-8710-4b9439c6568e | 4 | public void draw() {
System.out.println("Starting GUI client.");
// Establish the sockets:
try {
for (int i = 0; i < 4; i++) {
this.sockets[i] = new Socket(hostNames[i], portNumber);
out[i] = new ObjectOutputStream(sockets[i].getOutputStream());
... |
1a2e93c9-d8ff-4fbf-90b6-caa8b379ade6 | 7 | protected void dumpTree(int depth,StringBuffer text)
throws Exception {
for (int i = 0; i < m_sons.length; i++) {
text.append("\n");
for (int j = 0; j < depth; j++)
text.append("| ");
if(m_hasConstr)
text.append(m_localModel.leftSide(m_train)+ "#" + m_id);
else
... |
817e683f-20d1-44a0-ab68-3802de53a50e | 7 | public static float buildFloat(int mant, int exp)
{
if (exp < -125 || mant == 0)
{
return 0.0f;
}
if (exp >= 128)
{
return (mant > 0) ? Float.POSITIVE_INFINITY
: Float.NEGATIVE_INFINITY;
}
if (exp == 0)
{
return mant;
}
if (mant >= (1 << 26))
{
mant++; // round up trailing bit... |
4e7b9f39-82e7-4a2b-b3c4-cc3e36d3f1d0 | 7 | @Override
public void aplicarOferta(List<IProducto> productos) {
Boolean hubo_coincidencias = true;
List<IProducto> productos_encontrados;
List<RegistroProducto> copia_registros;
// productos que coinciden con un registro de la oferta
productos_encontrados = new ArrayList<IProducto>();
copia_registros = n... |
56869ddb-41fc-4d7c-b311-a5d6a50e75aa | 6 | public static String getCreateResult(String result) {
JSONObject jsonObject = new JSONObject();
if (result.equals("true")) {
try {
jsonObject.put("isSuccess", true);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else if (result.equals("false")) {
t... |
660d3ae4-8a3b-4556-b6da-04e73bb8b958 | 7 | public String getLFTRunsPerExperiment() {
SetupParameters lftSetup = this.parent.getOpenProject().getSetupParameters("lftSetup-");
if(lftSetup==null)return "N/A";
Parameter numScenarios = lftSetup.getParameter("numScenarios");
if(numScenarios==null || numScenarios.getValidationType()==MetaParameter.ValidationTy... |
eac4f4f6-d40d-4734-83f7-bc583a677b7e | 4 | @Override
public void run() {
try {
while (true) {
int len = in.read(buf);
if (len == -1) {
// System.out.println("INFO: Connection lost.");
return;
}
byte[] data = new byte[len];
... |
0559d71f-38f4-4b9d-8f73-32ead8c24360 | 3 | public boolean hasMove(Player active_player) {
boolean result = false;
for(int i = 0 ; i < board_row; i++) {
for(int j = 0; j < board_col; j++) {
Coords coords = new Coords(i, j);
if(isValid(coords, active_player, false)) {
result = true;
... |
27456b21-1571-48f5-b238-883470c010f7 | 4 | private static CycAccess getCyc() {
if (cycAccess == null) {
if (SHOULD_SET_CONNECTION_PARAMS_INTERACTIVELY && !areConnectionParamsSet) {
cycAccess = CycAccess.getNewCycAccessInteractively();
hostname = cycAccess.getHostName();
port = cycAccess.getBasePort();
areConnectionParam... |
706d4f5d-dbdc-44a6-98dd-fab7758672a3 | 3 | public Item(){
int createItem = itemGen.nextInt(20); //Generate random item
if (createItem > 10){
itemName = "Potion";
}
else if (createItem <= 10 && createItem != 0 ){
itemName = "MagicStone";
}
else {
itemName = "UltimaStone"... |
0b5204ce-260d-4e53-ad8c-6966a4c1eb57 | 0 | public void setPoints(Points points) {
this.points = points;
} |
3dd8a0ea-92d3-4ac7-b607-5fd5143420b7 | 5 | public static double entropyCal(ArrayList<ArrayList<String>> records){
double entropy = 0;
if(records.size() == 0) {
return 0;
}
for(int i = 0; i < ID3.classVals; i++) {
int count = 0;
for(int j = 0; j < records.size(); j++) {
ArrayList<String> record = records.get(j);
if(record.get(ID3.inde... |
3d696e19-2087-4355-9f27-119776535bac | 5 | public File getFile(String fileName) {
File obj = null;
// check first whether file name is valid or not
if (fileName == null || fileName.length() == 0) {
System.out.println(name_ + ".getFile(): Warning - invalid "
+ "file name.");
return obj;
... |
2183c06c-639c-458f-99f6-208b03f9d6ff | 3 | public Labyrinth toLaby(String file) {
try (
FileInputStream fInputStream = new FileInputStream(new File(file));
) {
ObjectInputStream oisCompressed = new ObjectInputStream(fInputStream);
Labyrinth laby = (Labyrinth) oisCompressed.readObject();
laby.re... |
5c296853-2f08-4115-88cb-3d0e2c39c8ed | 9 | private LinkType getLinkTypeFromKey(String k) {
if (k == null) {
return new LinkType(LinkDecor.NONE, LinkDecor.NONE);
}
if (k.equals("+")) {
return new LinkType(LinkDecor.PLUS, LinkDecor.NONE);
}
if (k.equals("*")) {
return new LinkType(LinkDecor.COMPOSITION, LinkDecor.NONE);
}
if (k.equalsIgnore... |
1df7d102-0c29-4f8f-abc7-2725da8614a0 | 1 | @Override
public void actionPerformed(ActionEvent event) {
Object src = event.getSource();
if (src == mServices) {
HashPrintRequestAttributeSet set = new HashPrintRequestAttributeSet();
rebuild(accept(set), set);
}
} |
33f1de34-4574-4c96-8331-f22684e69bbb | 9 | @Override
protected boolean validateNode(Node<T> node) {
boolean bst = super.validateNode(node);
if (!bst)
return false;
AVLNode<T> avlNode = (AVLNode<T>) node;
int balanceFactor = avlNode.getBalanceFactor();
if (balanceFactor > 1 || balanceFactor < -1) {
return false;
}
if (avlNode.isLeaf()) {
... |
0dac05ed-4623-4c40-b648-35d7fc7a4b92 | 2 | @Override
public boolean verify()
{
String sol;
if (getPhrase().core.reverse)
sol = getPhrase().phrase1;
else
sol = getPhrase().phrase2;
boolean answerCorrect = answerPanel.getAnswer().equals(sol);
updatePerfData(answerCorrect);
if (!answerCorrect)
{
answerPanel.setSolution(sol);
answerPa... |
0edc524a-dc5f-4cb9-842f-5624cdb81ae2 | 7 | public static boolean isOnScreen(final Entity e) {
if (e instanceof WidgetChild) {
return ((WidgetChild) e).visible();
} else {
Rectangle loc = screen;
if (Widgets.get(548).validate()) {
final Widget w2 = ActionBar.BarWidgets.get();
if (w2 != null && w2.validate()) {
final Rectangle rect = Wid... |
c89d261e-a4be-4add-b15e-4d1f5ddca538 | 1 | private boolean removeButton() {
if(cur > 0) {
buttons[cur - 1] = new JButton();
buttons[cur - 1].setVisible(false);
cur--;
return true;
}
return false;
} |
fd8e310f-0967-4735-977e-10b2d676e56b | 4 | private void printGraph(long[][] graph) {
System.out.print(" ");
for (int i = 0; i < graph.length; i++) {
System.out.printf(" %06d ", i);
}
System.out.print("\n----");
for (int i = 0; i < graph.length; i++) {
System.out.print("--------");
}
... |
c2de49f8-c681-4364-8268-2c1bc2b9453b | 3 | public void openSong(String string) {
// TODO Auto-generated method stub
while(true){
if(ready){
wavThread = new Thread(this);
this.filename= string;
wavThread.start();
break;
}
}
auIndex++;
if(auIndex==auline.length)auIndex=0;
} |
85209d23-74ae-4bb3-a322-bb187be7ea3a | 5 | @EventHandler
public void onClick(PlayerInteractEvent event)
{
Player player = event.getPlayer();
String pName = player.getName();
if(plugin.steps.containsKey(pName))
{
int step = plugin.steps.get(pName);
if(step==1)
{
if(event.getClickedBlock()==null)
return;
Location loc = event.getCli... |
199297de-8b0a-486e-ad97-7a559d2e9ac1 | 0 | public Validator<T> getValidator() {
return validator;
} |
be016e36-d946-4b68-b2e8-2f19da5b915b | 2 | private void shoot() {
if (x-40 < player.getX() && x+50 > player.getX()) {
gameScreen.newMissile();
new BulletSound();
}
} |
eb973515-cbed-48f0-ad3b-ec47294e6810 | 8 | @Override
public int posicionFichaX(int ficha, int torre) {
int k = (torre - 1) * 200;
switch (ficha) {
case 1:
return 110 + k;
case 2:
return 100 + k;
case 3:
return 90 + k;
case 4:
retu... |
443f39d7-b770-4a8a-a7d4-a60ece612625 | 6 | public void getInput()
{
if(Keyboard.isKeyDown(Keyboard.KEY_D))
{
right=true;
left=false;
walking=true;
xSpd=xVel;
}
else if(Keyboard.isKeyDown(Keyboard.KEY_A))
{
left=true;
right=false;
walking=true;
xSpd=-xVel;
}
else{xSpd=0; walking=false;}
if(Keyboard.isKeyDown(Keyboard.KEY... |
612e9322-ff64-4282-96e9-9c7f1a37402e | 5 | public Font loadResource(String path, Object... info) {
try {
path = ModManager.getPath(path);
int size = 12;
boolean bold = false, italic = false;
for (int i = 0; i < info.length; i++) {
assert info[i] instanceof String;
if (((String)info[i]).equalsIgnoreCase("size")) size = (Integer)info... |
789062e5-2ed2-43aa-929f-6b487b329595 | 0 | public void setAvb(double avb) {
this.avb = avb;
} |
1e89900b-8263-4538-b498-c97e381b4c9a | 8 | public String runMachine() {
curState = cmds.get(0).getCurState();
Character readSymb = tape.get(0);
while(0 <= searchCommand(curState, readSymb)) {
Command tmpCurCmd = cmds.get(searchCommand(curState, readSymb));
tape.set(idCurCell, tmpCurCmd.getNewSymb());
/... |
713eae30-9401-4d53-bd62-6df904a43810 | 9 | void find (boolean forward)
{
JTextComponent textComponent = (forEditor) ? frame.getEditor() : frame.getOutputArea();
String findText = findTF.getText();
if (findText.equals("")) return;
String text = textComponent.getText();
if (ignoreCaseCB.isSelected())
{
findText = findText.toLowerCase();
text = ... |
022af80f-fd26-44f5-b628-dba779545fb6 | 2 | public void addMovie(Movie movie) {
if (movie == null) {
throw new NullObjectInsertionException("Movie shouldn't be NULL.");
}
if (existMovie(movie)) {
throw new DuplicateInsertionException();
}
movies.add(movie);
} |
8a4b7fc4-87a7-4e2d-8a13-da7c5aff7d6e | 9 | private int makeMoveHelper(int x, int y, int dir, int pnt)
{
if(pnt > 0)
{
pnt--;
if(dir == 0)
{
x++;
}
if(dir == 1)
{
x++;
y--;
}
if(dir == 2)
... |
f9491d6b-3bf2-47a5-a562-5ef3e21c789b | 7 | public String dump(int enderecoInicial, int enderecoFinal)
throws MVNException{
if(!isValidAddress(enderecoInicial)){
throw new MVNException(ERR_INVALID_ADDRESS, enderecoInicial);
}
if(!isValidAddress(enderecoFinal)){
throw new MVNException(ERR_INVALID_ADDRESS, enderecoFinal);
}
// Inverte o... |
6feac241-d436-4bbe-9277-943161e0c2a4 | 9 | public static int globalBalance() {
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
int current = 0;
if (mysql) {
try {
conn = MySQL();
ps = conn.prepareStatement("SELECT balance FROM iBalances");
rs = ps.executeQuery();
while (rs.next()) {
current += rs.getInt("balan... |
000bb486-bdbc-47e7-926c-90e0001a1275 | 4 | public String createOutput(DialogState dialogState) {
//get the dialog state class, old implementation gave out just the abstract name dm.dialogState
String output = "";
String dialogStateClass = dialogState.getClass().getCanonicalName();//getStateClassFromEnum(dialogState.getCurrentState());
//tempSentence... |
e127866f-856d-42bb-9be9-97cfa77fe9eb | 0 | public boolean isSensitive() {
return this.isSensitive;
} |
d2ff475b-69b8-418b-af18-d417ab2f39d4 | 8 | void acceptUserInputUntilExit() throws IOException, CancelEditException, CancelDeleteException, ParseException {
try {
engine.executeCommand(new DisplayCommandType());
console.setPrompt(MESSAGE_COMMAND_PROMPT);
console.addCompleter(new StringsCompleter(this.getCommandsList()));
String line = null;
whil... |
c8a47201-8789-4d77-8979-446172a7da9a | 7 | public static Venue establishVenue(
final Venue v, int atX, int atY, boolean intact, final World world,
Actor... employed
) {
Tile init = world.tileAt(atX, atY) ;
init = Spacing.nearestOpenTile(init, init) ;
if (init == null) return null ;
final TileSpread search = new TileSpread(ini... |
c86fbdfa-0c02-41a0-9c79-ac84e81335c3 | 1 | private int myGcd(int a, int b) {
while (b != 0) {
int t = b;
b = a % b;
a = t;
}
return a;
} |
2251e436-cb6f-4b71-a658-639546e94f57 | 6 | public boolean isBasicSpecial(String s)
{
if(s.length() > 1)
{
System.out.println("string bigger than one");
}
if(s.equals("*"))
{
return true;
}
else if(s.equals("/"))
{
return true;
}
else if(s.equ... |
c85523a1-6d34-40c8-a33a-991416785001 | 7 | public void setSymtab(Symtab st) {
if (!Utils.isValidType(type.toString(), st) && !type.toString().equals("void"))
Main.error("invalid type (" + type.toString() + ")");
boolean hasReturn = statement_list.hasReturn();
if (!type.toString().equals("void")) {
if (!hasReturn)
Main.error("Function " + id
... |
fd22f788-0bfd-40c3-94cb-db221d046d35 | 3 | private static final byte[] encodeDictionary(HashMap<ByteBuffer, Object> dictionary) throws BencodingException
{
TreeMap<ByteBuffer, Object> sorted_dictionary = new TreeMap<ByteBuffer, Object>();
sorted_dictionary.putAll(dictionary);
byte[][] dictionary_parts = new byte[sorted_dictionary.key... |
f6894fee-c24a-4929-816e-769eca1b84a0 | 3 | protected boolean authenticateUser(HttpServletRequest request) {
try {
String username = DatatypeHelper.safeTrimOrNullString(request.getParameter(usernameAttribute));
String password = DatatypeHelper.safeTrimOrNullString(request.getParameter(passwordAttribute));
SimpleCallb... |
08a63a13-ac5b-4464-8385-6d3502728aef | 4 | public static Node FindNthLast(Node head,int n){
Node p = head.next;
Node q = head.next;
while(true){
if(n == 0){
break;
}
if(q==null)
return null;
q = q.next;
n--;
}
while(q!=null){
q = q.next;
p = p.next;
}
return p;
} |
0fe51558-9309-4eca-ae1e-368701da3394 | 8 | void sint1(int n, double war[], double wtable[])
{
final double sqrt3=1.73205080756888;
int modn, i, k;
double xhold, t1, t2;
int kc, np1, ns2;
int iw1, iw2, iw3;
double[] wtable_p1 = new double[2*(n+1)+15];
iw1=n / 2;
iw2=iw1... |
b4c4221f-5c97-4ab4-b033-4e2088cc0a5d | 3 | public static String makeUrl(String url) {
if (StringUtils.isBlank(url)) {
return url;
}
String result = StringUtils.removeEnd(url, "/");
if (!result.startsWith("http://") && !result.startsWith("https://")) {
result = StringUtils.removeStart(result, "/");
... |
079e809f-3578-48ed-baa0-3a7fb4d93024 | 6 | private void addTableColor(Thread t) {
switch (t.getState().toString()) {
case "NEW":
colors.add(Color.GREEN);
break;
case "RUNNABLE":
colors.add(Color.CYAN);
break;
case "BLOCKED":
colors.add(Color.RED);
break;
case "WAITING":
colors.add(Color.YELLOW);
break;
case "TIMED_WAITING"... |
3bd4e2ac-c49a-49f9-a0f0-abd01fcfdd59 | 6 | protected ArrayList<Coordinate> takeMove(Coordinate xy) {
boolean test = false;
if (test || m_test)
System.out.println("ConnectFour::takeMove() - BEGIN");
Grid grid = getGrid();
ArrayList<Coordinate> result = new ArrayList<Coordinate>();
for (int y = GAME_HEIGHT - 1; y >= 0; y--) {
if (grid.getCoordina... |
c989ee06-6efd-4d12-9ab4-a9abbc1c8be9 | 6 | public boolean shouldExecute()
{
if (this.childAnimal.getGrowingAge() >= 0)
{
return false;
}
else
{
List var1 = this.childAnimal.worldObj.getEntitiesWithinAABB(this.childAnimal.getClass(), this.childAnimal.boundingBox.expand(8.0D, 4.0D, 8.0D));
... |
18e12b89-9d58-4e24-b1c5-595d8058410a | 5 | public void save()
{
User assignedTo = null;
for (User u : users.getUsers())
{
if (u.getUserName().equals(cboxAssignedTo.getText()))
{
assignedTo = u;
}
}
try
{
theTask.setTitle(txtTitle.getText());
theTask.setComments(txtComments.getText());
theTask.setDescription(txtDescriptio... |
9343769f-a972-41e4-8a1f-690a642471ce | 7 | public void setOptions(String[] options) throws Exception {
String tmpStr;
tmpStr = Utils.getOption('P', options);
if (tmpStr.length() != 0)
setPruningMethod(
new SelectedTag(Integer.parseInt(tmpStr), TAGS_PRUNING));
else
setPruningMethod(
new SelectedTag(PRUNING_NONE, TAGS_PRUNIN... |
cc79362b-802e-4202-b46e-bcaae112495d | 2 | private String join(String[] split, int delimiter) {
String joined = "";
int length = split.length;
int i = delimiter;
while (i < length - 1) {
joined = joined + split[i] + " ";
i++;
}
while (i == length - 1) {
joined = joined + split[i... |
f98f0dda-9a71-4a97-b77b-a61aabe33d84 | 9 | @Override
public void keyPressed(KeyEvent e){//set the right X/Y-add
int key = e.getKeyCode();
if(key == KeyEvent.VK_LEFT || key == KeyEvent.VK_A){
xAdd = getSpeed();
left = true;
right = false;
}
if(key == KeyEvent.VK_RIGHT || key == K... |
1f0ff438-1c0c-4f96-b923-b9a088fece64 | 0 | public void setAtTime(String atTime) {
AtTime = atTime;
} |
75ac68f7-2e4e-4b1f-b861-67ca68ad1a7c | 0 | @Test
public void isEmptyReturnsFalseWhenNotEmpty() {
s.push(0);
assertFalse(s.isEmpty());
} |
18beabfb-d0b1-4ffc-a2cb-5274f81aa2df | 8 | boolean selectSubjectId(byte[] data, short offset, short length) {
if(currentCertSubjectId[0] == 0) {
if(rootCertHolderReference != null && rootCertHolderReference[0] == (byte)length) {
if(Util.arrayCompare(rootCertHolderReference, (short)1, data, offset, length) == 0) {
... |
3133086f-dcf6-4ba3-83bf-54d07d41f0c1 | 3 | public void close() throws IOException {
in.close();
if(!ncwe || readeof) {
synchronized(forked) {
for(OutputStream s : forked)
s.close();
}
}
} |
fa52dfd6-1ca2-4f8b-80cd-b98b489f09df | 5 | @Test
public void ExpColSingle() throws InterruptedException{
String classplus = "accordion-icon icon-plus";
String classmin = "accordion-icon icon-minus";
String allbtn = actualstr = driver.findElement(By.xpath("//div[@class=\"control-accordion\"]/span[position()=2]")).getText();
elements = driver.findElement... |
a6b9bd56-8743-4710-a086-e529137db1a5 | 6 | public double segmentDistanceTo(Point p )
{
double leftMost;
double rightMost;
double lowest;
double highest;
if (p1.x < p2.x)
{
leftMost = p1.x;
rightMost = p2.x;
}
else
{
leftMost = p2.x;
rightMost = p1.x;
}
if (p1.y < p2.y )
{
highest = p1.y;
lowest = p2.y;
}
... |
f5e76824-6034-4053-8416-f44329e7d347 | 8 | public static void main(String[] args) throws IOException, InterruptedException {
Path dirToWatch = Paths.get("C:\\Users\\MANOJ\\Desktop\\TestFolder");
WatchService service = FileSystems.getDefault().newWatchService();
dirToWatch.register(service, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTR... |
b9683b26-938a-432c-9fd8-3f3a3052ece6 | 6 | private boolean equalObjects(Object o1, Object o2) {
if (o1.getClass().isArray()) {
int len = Array.getLength(o1);
if (len != Array.getLength(o2)) {
return false;
}
for (int i = 0; i < len; ++i) {
Object item1 = Array.get(o1, i);
... |
5afd60b6-f7dc-40d3-96f8-94c1f7ff1b74 | 1 | public void actionPerformed(ActionEvent event)
{
Tile clickedTile = (Tile) event.getSource();
if(myBoard != null)
{
myBoard.clickReceived(clickedTile.getID());
}
} |
110674e5-cb24-4e47-a568-35c6e34646a3 | 6 | public ChildContainerResult handle(WikiContext context) throws ChildContainerException {
try {
if (!context.getAction().toLowerCase().equals("sentfile")) {
context.raiseAccessDenied("Illegal parameters");
}
byte[] blob = context.getQuery().getBytes("upload");... |
6ce8bdfe-627f-459d-9c86-d93ad692a711 | 3 | public void attemptAttack(Entity attackingEntity, Shape attackBB, Vector2f direction, float damage, float knockbackStrength)
{
for(Entity ent : entityList)
{
if(attackBB.intersects(ent.getBB(ent.getCoords())) && ent != attackingEntity)
{
ent.takeDamage(attackingEntity, direction, damage, knockbackStrengt... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.