method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
bd4c401a-038c-4bdb-bb5f-8c75103474b8 | 4 | private boolean isAttacking(){
if(state == StateActor.ATTACKINGUP || state == StateActor.ATTACKINGDOWN || state == StateActor.ATTACKINGLEFT || state == StateActor.ATTACKINGRIGHT){
return true;
}
else return false;
} |
e03a488b-0e53-4bcf-ac0e-484c700bcef5 | 3 | public void WGAdmin(String sender, String login, String hostname, Command command) {
if(adminpass == null) {
System.out.println("[!] Admin identification attempt (no pass set). Nick: " + sender + " Login: " + login + " Hostname: " + hostname);
sendMessage(sender, "No admin password has b... |
8c1e1715-bf10-4096-bba8-6d4ee858a82d | 4 | @SuppressWarnings("unchecked")
public void changeCapacityBy(int number) {
int newSize = array.length + number;
E[] temparray = (E[]) new Object[newSize];
System.arraycopy(array, 0, temparray, 0, array.length > newSize ? newSize : array.length);
array = temparray;
if (lastPos... |
a37b44ae-4291-4b24-9c9a-84827af0e435 | 6 | protected void processGlobalResourceList(Sim_event ev)
{
/***
NOTE: possible cases are
- if there is only 1 local GIS and no other regional GISes
- if there is only 1 user queries for this
- if there are 2 or more users query at different time
****/
LinkedLis... |
0a6cbe25-4346-4bff-a5b2-e192f3d7a62d | 1 | public String addGradeItem() throws IOException {
InputStreamReader in = new InputStreamReader(System.in);
BufferedReader keyboard = new BufferedReader(in);
DBConnector db = new DBConnector();
System.out.println("Adding an assignment");
System.out.println("Assignment tit... |
a5b55180-d5ee-4aad-9170-3e464178c679 | 1 | private void addQuarter()
{
_numQuarters++;
if (_numQuarters <= getMaxQuarters())
{
refreshLcd();
} else
{
returnQuarter();
}
} |
17e90357-d2fa-4f05-a95f-0733bcec005d | 0 | public synchronized void dispose() {
//System.out.println("disposing...");
_outputThread.interrupt();
_inputThread.dispose();
} |
e00746ae-5d31-406d-b581-fb860f1753aa | 6 | @Override
public int smarts(Algebra algebra) {
Fraction frac = (Fraction) algebra;
//if the fraction is a positive integer on top and bottom, but it's not fully simplified
if(frac.getTop() instanceof Number && frac.getBottom() instanceof Number &&
((Number)frac.getTop()).isInteger() && ((Number)frac.getBott... |
018b52ba-7abb-4b0e-9bf1-1d86ecf6efef | 9 | @Override
public String getErrorMessage(RecognitionException erro, String[] nomeDosSimbolos) {
if (erro instanceof UnwantedTokenException) {
UnwantedTokenException erroDeSimboloNaoDesejado = (UnwantedTokenException) erro;
String entradaNaoDesejada = getTokenErrorDisplay(erroDeSimboloNaoDesejado... |
110f9cd1-cbab-4432-b0dd-b4950e679b76 | 7 | private String selectWindow(String seleniumWindowName) {
if (!proxyInjectionMode) {
String result;
try {
result = doCommand("selectWindow", seleniumWindowName, "");
} catch (RemoteCommandException rce) {
result = rce.getMessage();
}
retur... |
9ee0ca8f-a31c-4b6a-8d46-814227ba6d06 | 8 | public Set<Map.Entry<Double,Float>> entrySet() {
return new AbstractSet<Map.Entry<Double,Float>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TDoubleFloatMapDecorator.this.isEmpty();
}
... |
3471b93e-3884-4012-bc64-ed020b38681d | 7 | private void adicionarItemVenta(String idProd, int cantidad){
this.productosNegativos.clear();
if(!GuiPrincipal.listaFactCompProdExistentes.isEmpty()){
// booleano para comprobar si existe el producto en la lista.
boolean existeProducto= false;
for (HashMap compra : G... |
14cdce74-54ce-41a9-904e-c376d022c93d | 5 | public ResultSet executeQuery(String statement) {
if (isFault()) {
System.out.println("[Apply] Can't execute query, something wrong with connection");
return null;
}
if (statement.toLowerCase().startsWith("update") || statement.toLowerCase().startsWith("insert") || statem... |
7d452ba7-06cf-49f9-8844-68ed63ad468d | 3 | public void actionPerformed(ActionEvent e) {
Grammar grammar = environment.getGrammar();
if (grammar == null)
return;
if (grammar.getProductions().length == 0) {
JOptionPane.showMessageDialog(Universe
.frameForEnvironment(environment),
"The grammar should exist.");
return;
}
// Create the i... |
c415072c-fcc8-4d82-ab6f-b934d3beee80 | 5 | public static void update() {
updateMouseButtons();
Point p = new Point(Mouse.getX(), Display.getHeight() - Mouse.getY());
if (pressPoint!=null)
if (draggedModel != null && startPlate.contains(pressPoint)) {
Point d=Camera.getTranslatedPoint(draggedModel.getCenter().x, drag... |
ac56a779-6264-4d0d-b20d-c52dadfe9cea | 8 | static boolean isValidXmlChar(char ch) {
return ((ch >= 0x20) && (ch <= 0xD7FF)) ||
(ch == 0x9) ||
(ch == 0xA) ||
(ch == 0xD) ||
((ch >= 0xE000) && (ch <= 0xFFFD)) ||
((ch >= 0x10000) && (ch <= 0x10FFFF));
} |
e52cc96b-c576-413e-ab54-10ca98ace3b4 | 3 | public static void main(String[] args) throws InterruptedException
{
terminal = new TestTerminalFactory(args).createTerminal();
terminal.enterPrivateMode();
terminal.clearScreen();
terminal.moveCursor(10, 5);
terminal.putCharacter('H');
terminal.putCharacter('e');
... |
3de23388-e11b-41a5-89d8-5ce40f3f5db6 | 6 | static private Token jj_consume_token(int kind) throws ParseException {
Token oldToken;
if ((oldToken = token).next != null) token = token.next;
else token = token.next = token_source.getNextToken();
jj_ntk = -1;
if (token.kind == kind) {
jj_gen++;
if (++jj_gc > 100) {
jj_gc = 0;... |
e4677348-0e1b-4d10-b802-ebaeb1661f94 | 1 | private Tile[] gettrans(Coord tc) throws Loading {
Tile[] r = map.gettrans(tc);
if (r == null)
throw (new Loading());
return (r);
} |
ccfb09a3-739c-4bb7-8aa3-13e8ee32b3b2 | 1 | public float getRYAxisDeadZone() {
if (ryaxis == -1) {
return 0;
}
return getDeadZone(ryaxis);
} |
3c894cab-f146-4e4c-b295-f9edd2d47dc1 | 2 | public Record getRecord(String username){
for(Record record:table){
if(record.getUsername().compareToIgnoreCase(username)==0){
return record;
}
}
return null;
} |
7fee285e-7bce-401e-9ba9-3869fe781fdf | 1 | @Before
public void create_samples() throws IOException, URISyntaxException {
// read them from file
Path p = Paths.get(getClass().getResource("dbupdates.txt").toURI());
File file = p.toFile();
FileReader in = new FileReader(file);
BufferedReader reader = new BufferedReader(in);
samples = new ArrayList<St... |
6a361dda-0e71-4d51-aded-a03d8f079e0e | 6 | public void twrInJava6(URL url){
InputStream is = null;
try{
File file = new File("");
is = url.openStream();
OutputStream out = new FileOutputStream(file);
try{
byte[] buf = new byte[4096];
int len;
while((l... |
d70acfb0-3e4d-4284-8d6a-d145cfe382a2 | 3 | public void test_04_del() {
initSnpEffPredictor("testCase");
String fileName = "./tests/vcf_04_del.vcf";
VcfFileIterator vcf = new VcfFileIterator(fileName, genome);
vcf.setCreateChromos(true);
for (VcfEntry vcfEntry : vcf) {
for (Variant seqChange : vcfEntry.variants()) {
if (!seqChange.isDel()) thro... |
0cc11ef4-bb5b-4171-b723-87446bd04041 | 6 | private void attachListeners() {
_raceListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
Object index = _raceBox.getSelectedItem();
for (BaseRace br : Character.RACES) {
if (br.getName().equals(in... |
d4102210-0a93-4ae1-8d90-4c44902eef88 | 9 | public void scoreHand(Player myHand) {
you.sortHand();
you.showHand();
boolean goOn = true;
goOn = checkRoyalFlush(myHand);
if (goOn == false) {
goOn = checkStraightFlush(myHand);
}
if (goOn == false) {
goOn = checkFourKind(myHand);
}
if (goOn == false) {
goOn = checkFullHouse(myHand);
... |
f53556bf-ebe6-4bdd-860e-dd91641a6e89 | 7 | private static CallFrame initFrameForApplyOrCall(Context cx, CallFrame frame,
int indexReg, Object[] stack, double[] sDbl, int stackTop, int op,
Scriptable calleeScope, IdFunctionObject ifun,
InterpretedFunction iApplyCallable)
{
Scriptable applyThis;
if (indexReg... |
c0cddcea-ff57-441b-a230-c716a1da2dd2 | 1 | private static char nextChar(StringBuilder buffer) {
return buffer.length() > 0 ? buffer.charAt(0) : 0;
} |
d7553bf4-08c0-490c-b6f1-e851c251ecc2 | 9 | private void roomFromInt(int room)
{
switch (room)
{
case 1: this.room =(RoomCard.Rooms.Ballroom);
RoomCard.Rooms.Ballroom.setActive();
break;
case 2: this.room =(RoomCard.Rooms.BilliardRoom);
RoomCard.Rooms.BilliardRoom.setA... |
cde16f61-fdcf-4416-94aa-bc5cb8e319ee | 4 | public static <T> String implodeAlt(String glue, List<T> list) {
// list is empty, return empty string
if (list == null || list.isEmpty()) {
return "";
}
if (glue == null) glue = "";
Iterator<T> iter = list.iterator();
// init the builder with the first element
StringBu... |
1e3bd5b8-fe4b-4637-8d41-b9ea6a3a5b41 | 8 | final public void Field() throws ParseException {
/*@bgen(jjtree) Field */
ASTField jjtn000 = new ASTField(JJTFIELD);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
Identifier();
Type();
} catch (Throwable jjte000) {
... |
ac03dd6c-c5db-4709-8ede-859d4c8ac8a0 | 7 | 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--;
} |
ccb8e143-d23a-4748-aac6-f968d94c9179 | 6 | private void parseNodes() {
String lines[] = textArea_.getText().split("\n");
HashMap<Integer, ValueType> out = new HashMap<>();
for (int i = 0; i < lines.length; i++) {
if (lines[i].contains(Export)) {
out.put(new Integer(i), getExportType(lines[i]));
}
}
for (Integer l : out.keySet()) {
if (... |
affc750a-6544-40e7-8dc0-981878d3d1b3 | 1 | public Color getColor() {
if (color == null) {
Image image = sprite.getImage();
int clr= ((BufferedImage) image).getRGB(10,10);
int red = (clr & 0x00ff0000) >> 16;
int green = (clr & 0x0000ff00) >> 8;
int blue = clr & 0x000000ff;
color = new Color(red,green,blue);
return color;
} el... |
46b3135d-84a9-468f-9276-9e0682bcf16d | 2 | public static int charCount(String s) {
char c[] = s.toCharArray();
int count = 0;
for (char element : c) {
if (element != ' ') {
count++;
}
}
return count;
} |
05147c63-535a-407a-9d3c-4a3376512046 | 0 | private void setFullScreen()
{
setExtendedState(Frame.MAXIMIZED_BOTH);
removeNotify();
setUndecorated(true);
addNotify();
} |
32e767cc-7727-488c-bd41-0b909119cbce | 1 | private void handleCannotJoinChannel(String response) {
String channel = response.split(" ")[1];
ChannelEventsListener listener = getChannelEventsListener(channel);
if (listener != null)
listener.userLeft( this.getNick() );
} |
1fec1f66-3cab-4899-86bb-bdada17e19a2 | 6 | public static void copyFolder(File src, File dest) throws IOException {
if (src.isDirectory()) {
// if directory not exists, create it
if (!dest.exists()) {
dest.mkdir();
}
// list all the directory contents
String[] files = src.list();
for (String file : files) {
// construct ... |
452f7c04-ce49-454e-aaf4-20adf84a4b1d | 5 | private void powVectors() {
for (wordsDocument doc : webDocs) {
HashMap<String, Integer> uniqueCounter = doc.uniqueCounter;
doc.vectors = new double[dictionarySize];
int i = 0;
int z = 0;
for (String dictionaryKey : sortedDictionaryUniqueWords.keySet()) {
for (String uniqueWord... |
a080a597-2022-44b1-9c63-585537edd695 | 4 | private boolean handleLogin(TACMessage msg) {
int status = NO_ERROR;
while (msg.nextTag()) {
if (msg.isTag("userID")) {
userID = msg.getValueAsInt(-1);
log.fine("Logged in as " + userID);
TACMessage msg2 = new TACMessage("serverTime");
sendMessage(msg2, this);
// Do not request "nextGame" if already... |
c78e7060-3804-42ce-b29f-699ad5afa360 | 9 | private void compareDirectories() {
progress = 0;
long start = System.currentTimeMillis();
// create array and fill him directories size
ArrayList<Long> sizes = new ArrayList<Long>();
for (int i=0; i<directoryArray.size(); i++) {
calculataAndPublishProgress(i, directoryArray.size(), "State 2 of 5: Calculat... |
c2774df3-1044-46fe-ad8d-0758494e3fd6 | 1 | public void decrementEffectsLifetime() {
for (Effect effect : effects)
effect.decrementLifetime();
} |
caf0c12d-1e74-453d-9454-9b8c0d438f37 | 5 | public static void sort(int[] source) {
int len = source.length;
if (len == 0) {
System.out.println("Empty!");
return;
} else if (len == 1) {
return;
}
for (int i = 1; i < source.length; i++) {
int j = i;
int temp = source[j];
while (j > 0 && temp < source[j - 1]) {
source[j] = source... |
799e80be-c595-48f5-aa36-554eb1ee2314 | 1 | public void clearRegisters() {
pc.setPC(0);
ir.clear();
mar.write(-1); // -1 triggers clear
mbr.write(null);
for (int i = 0; i < 16; i++) {
genRegisters.write(i, null); //Set each general purpose register to null
}
rCC.write(null);
} |
fa0553c5-6e38-495e-814f-4f9ed85c3cc5 | 2 | public ArrayList<Restriction> getRestrictionsFromEvent(String identifier)
{
//We iterate through the whole list, checking for the Event with that identifier
//If we don't find any events with that identifier, we throw an exception
for(Event e: events){
if(e.getIdentifier().e... |
ec905531-a5ce-4558-9d35-3d3e694a8893 | 1 | public static String sign(String data, String key) throws InvalidKeyException {
Mac sha256HMAC;
try {
sha256HMAC = Mac.getInstance(HMAC_SHA256);
} catch (NoSuchAlgorithmException e) {
return null;
}
SecretKeySpec secret_key = new SecretKeySpec(key.getBytes(), HMAC_SHA256);
sha256HM... |
5a88f8c5-b087-448c-a90b-5dc769dd5aa2 | 2 | private void runAction(String paramName, String name){
Task task = new Task(name);
switch(paramName){
case "end_task":
task.finish(); break;
case "new_task":
task.create(); break;
}
} |
6a46a65f-2932-4b4b-af3a-d687d8e9b6e1 | 8 | protected int[] initCenterRoomXY(int dirCode)
{
final int[] xy=new int[2];
switch(dirCode)
{
case Directions.NORTHEAST:
xy[0]=xGridSize()-1;
break;
case Directions.NORTHWEST:
break;
case Directions.NORTH:
xy[0]=xGridSize()/2;
break;
case Directions.SOUTHEAST:
xy[1]=yGridSize()-1;
xy[... |
3290db3a-bef9-429d-a2a1-2e10be11494e | 7 | @EventHandler
public void SkeletonMiningFatigue(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("Skelet... |
b71f5e8e-eb3e-4437-b31b-2b6f4c8485a4 | 4 | public static void main(String[] args)
throws IOException
{
InputStream is = FindSchedulerError.class.getResourceAsStream("crontabjob.log");
BufferedReader br = new BufferedReader(new InputStreamReader(is) );
String line = null, duplicated = null;
int count = 1;
while ( (line = br.readLine() ) != n... |
009ccc41-b1ab-4891-b8d9-c996d9f475ea | 7 | public static void merger(LinkedList<Integer> a, LinkedList<Integer> b) {
int apos = 0;
int bpos = 0;
while (apos < a.size() && bpos < b.size()) {
if (a.get(apos) < b.get(bpos)) {
System.out.print(a.get(apos) + " ");
apos++;
} else {
System.out.print(b.get(bpos) + " ");
bpos++;
}
}
if... |
e4082c31-b3b2-4db8-a7e2-b4e2abdb62e8 | 3 | public void save() {
File save = new File("assets/save");
if (!save.exists()) {
try {
save.mkdir();
} catch (SecurityException e) {
e.printStackTrace();
}
}
try {
FileOutputStream fout = new FileOutputStream(new File(
"assets/save/" + "save1"));
ObjectOutputStream oos = new ObjectO... |
3e1c1ee9-4ef6-4a69-89e3-e0428bf0ea5d | 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... |
dd39559f-e8e3-4638-b1dd-a011def43c39 | 6 | public static Cons inheritAsTopLevelProposition(Proposition proposition, KeyValueMap mapping) {
{ Cons resultlist = Stella.NIL;
if (mapping == null) {
mapping = KeyValueMap.newKeyValueMap();
}
{ Keyword testValue000 = proposition.kind;
if (testValue000 == Logic.KWD_AND) {
... |
982e5b75-be00-4e66-bc18-4434abcba50f | 6 | private boolean validarDatos() {
//unicamente valido el numero de cuenta
boolean valido = false;
Validaciones val = new Validaciones();
if (jTextField1.getText().equals("") || jTextField2.getText().equals("")){
mensajeError("Ingrese un valor para Desde.. Hasta.");
... |
590c9305-8545-4e62-995c-c8fa827d18ce | 7 | protected BallNode mergeNodes(Vector list, int startIdx, int endIdx)
throws Exception {
for(int i=0; i<list.size(); i++) {
TempNode n = (TempNode) list.get(i);
n.anchor = calcPivot(n.points, new MyIdxList(), m_Instances);
n.radius = calcRadius(n.points, new MyIdxList(), n.anchor, m_Instan... |
2beee735-fc8a-4399-aabb-169d347c84e7 | 5 | public void updateLayout() {
switch (state) {
case 0:
newGame.setVisible(true);
loadGame.setVisible(true);
options.setVisible(true);
break;
case 1:
newGame.setVisible(false);
loadGame.setVisib... |
7ab91469-ee3e-4667-b1c4-f90888486c15 | 4 | void seek()
{
if ( x == 0 && index == 0 )
extend();
if ( left == null )
addLeft();
if ( right == null )
addRight();
advance();
} |
9e475377-22d8-46f6-9948-10c4296fdecb | 2 | public Content getContent(String name){
int i = 0;
while(i < content.size()){
if(content.get(i).getName().equals(name))return content.get(i);
i++;
}
return null;
} |
31240051-b110-4b72-aefa-76d5be050381 | 1 | public String getInput() {
try {
return lineInput.readLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return "";
}
} |
afd022f2-03d3-4b19-b9c5-f00797a7bf82 | 2 | public double getDouble(int index) throws JSONException {
Object object = get(index);
try {
return object instanceof Number ?
((Number) object).doubleValue() :
Double.parseDouble((String) object);
} catch (Exception e) {
throw new J... |
702a40ec-2624-4c5d-8a96-43b81114c452 | 5 | * @return Returns true if the given cell is a valid source terminal.
*/
public boolean isValidSource(Object cell)
{
return (cell == null && allowDanglingEdges)
|| (cell != null
&& (!model.isEdge(cell) || isConnectableEdges()) && isCellConnectable(cell));
} |
72da52a9-ad1c-4aaf-b3c4-b4e4513f50ba | 4 | private static void dfsR(int node){
if(visited[node] == true) return;
visited[node] = true;
for(Integer neighbor:gR.get(node)){
dfsR(neighbor);
}
removed[node] = true;
if(cost[node]<min){
min = cost[node];
minCount=1;
} else if (cost[node]==min){
minCount++;
}
} |
8818639a-d56b-4692-a5af-2e9d3f7241d5 | 6 | public boolean matches(Identifier ident) {
String test = ident.getFullName();
if (firstStar == -1) {
if (wildcard.equals(test)) {
return true;
}
return false;
}
if (!test.startsWith(wildcard.substring(0, firstStar)))
return false;
test = test.substring(firstStar);
int lastWild = firstStar;
... |
00ef5241-1055-4863-8412-23eea7f708af | 3 | private void setColorForPlayer(String line, int player){
String input = line.substring(2, line.length());
try {
int colNo = Integer.parseInt(input);
Color retCol = getColor(colNo);
if (retCol != null) {
if (player == 1){
controller.... |
de2c1e21-42ae-4c32-8068-fdd867a66332 | 0 | public double getWidth()
{
return width;
} |
c6629823-6a0d-40bc-9cec-5f10b2974290 | 0 | public void setSequenceId(int sequence_Id)
{
this.sequence_Id = sequence_Id;
TypeConvert.int2byte(sequence_Id, buf, 8);
} |
90347c6c-d9ee-4695-91cc-938f0ade8d88 | 0 | public void setModuleId(String moduleId) {
this.moduleId = moduleId;
} |
9d209ce5-5e0a-4d36-9c4b-2ae2146705e1 | 1 | private static boolean deletePrescription(Prescription bean, PreparedStatement stmt) throws SQLException{
stmt.setInt(1, bean.getPrescriptionID());
int affected=stmt.executeUpdate();
if(affected==1){
System.out.println("Prescription with ID "+bean.getPrescriptionID()+" has been Removed from database.");... |
697caa2c-71eb-40f5-8fa6-961d10ce807f | 9 | public mainUI() {
setContentPane(contentPane);
setModal(true);
getRootPane().setDefaultButton(buttonOK);
vecList = new ArrayList<IClusterCalculable>();
// for (int i = 1; i < 19; i++) {
// typeBox.addItem(i + "");
//// rgbs[i] = (int) (Math.random() * 1000 %... |
7ee8dbba-48a5-4976-89f3-a667700d41e4 | 0 | @Test
public void testSingleTablePopulation() throws SQLException, ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Populator p = new Populator();
p.generators.add(new IntegerGenerator("ride", "id", 0));
p.generators.add(new RandomDateGenerator("ride", "cre... |
e7f519b8-3cee-4dfa-a056-b1f3f6180f28 | 8 | public void computeShortestPaths(DialARideModel model) {
List<Node> nodes = model.getNodes();
int numOfNodes = nodes.size();
int[][] cost = model.getCost();
int[][] prev = model.getPrev();
for (int sourceNode = 0; sourceNode < numOfNodes; sourceNode += 1) {
boolean[] visited = new boolean[numOfNodes];
f... |
761b5c8f-516a-444d-be26-bd4dab6c2d56 | 3 | private void btnGuncelleMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnGuncelleMousePressed
if(!btnGuncelle.isEnabled())
return;
HashMap<String, String> values = new HashMap<>();
values.put("ad", txtAd.getText().trim());
values.put("soyad... |
9fbe8ae4-3a20-41b4-813a-504eb35989a1 | 1 | public WeightedQuickUnion(int N) {
super(N);
this.treeSize = new int[N];
for(int i = 0; i < this.treeSize.length; i++) {
this.treeSize[i] = 1;
}
} |
f396fba6-2e8b-44a9-b971-a4d81a00c4e5 | 2 | @Override
public int hashCode()
{
int hash1 = first == null ? 0 : first.hashCode();
int hash2 = second == null ? 0 : second.hashCode();
return hash1 ^ hash2;
} |
397224c7-8502-4de0-88d7-de01d5fb704a | 4 | public List<Object> findFirstNodeNotInTree(String pattern, Tree.Node root) {
Tree.Node parent = root;
List<Object> returnList = new ArrayList<Object>();
for (int i = 0; i < pattern.length(); i++) {
boolean found = false;
String stringToCompare = String.valueOf(pattern.c... |
bf4c0d84-4583-4905-aeb6-4fd3a87c38e3 | 6 | protected Animator getAnimation() {
if (standardAnimation) return animation;
if (direction == Direction.WEST) return animationLeft;
if (direction == Direction.EAST) return animationRight;
if (Game.type != GameType.PLATFORMER) {
if (direction == Direction.NORTH) return animati... |
cdd29534-9de4-4170-b7e1-3a39e57c852a | 8 | @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public void onEvent(@Observes LogEvent logEvent) {
if (!this.enabled) {
return;
}
LogRecord lr = new LogRecord(Level.OFF, String.format(logFormat, logEvent.getTimestamp(), logEvent.getSource(), logEvent.getMessage()));... |
3fe2d252-c64d-4282-baa7-8d7c2531e225 | 9 | public void examineDirectory(File folder) throws ParseException,
IOException {
for (File file : folder.listFiles()) {
if (file.isDirectory()) {
examineDirectory(file);
} else {
if (file.getName().endsWith(".java")) {
parsedInput = JavaParser.parse(file);
String fileName = file.getName().su... |
ae00d8d4-5609-42fe-97bc-20aacb54a696 | 2 | public void reset()
{
//float[] floatp;
// float[] floatp2;
// initialize v1[] and v2[]:
//for (floatp = v1 + 512, floatp2 = v2 + 512; floatp > v1; )
// *--floatp = *--floatp2 = 0.0;
for (int p=0;p<512;p++)
v1[p] = v2[p] = 0.0f;
// initialize samples[]:
//for (floatp = samples +... |
a0bef7d1-7951-47ff-9d2a-a566bbb1ee72 | 0 | @Override
protected EntityManager getEntityManager() {
return em;
} |
1f6d0295-2cd3-4a1e-a762-2bcc48db454e | 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.equals(Boolean.... |
e4ab8a69-6b23-4ab4-ba2c-101447763b03 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
WithList withList = (WithList) o;
if (list != null ? !list.equals(withList.list) : withList.list != null) return false;
return true;
} |
b190d163-483b-4636-b915-b089541330f8 | 8 | private boolean computeCell(int col, int row)
{
// liveCell is true if the cell at position (col,row) in world is live
boolean liveCell = getCell(col, row);
// neighbours is the number of live neighbours to cell (col,row)
int neighbours = countNeighbours(col, row);
// we will return this... |
2feb7c39-dadc-4f3a-a134-1681d0f3906c | 6 | public String goRoom(String direction)
{
// Try to leave current room.
if(currentRoom instanceof BlockedRoom)
{
BlockedRoom br = (BlockedRoom) currentRoom;
if(br.isBlocked())// why is this here?
{
if(br.getBlocked(direction))
{
return "There is a gate in the wa... |
ca70f13d-7436-4efa-b586-c73d31909ee4 | 0 | public String[] getDataAt(int index) {
return allPorts.get(index);
} |
72bed20c-5780-425d-a8a7-e1069d63ac72 | 0 | public int getRowCount() {
return rows;
} |
4f471f45-724d-4e9c-adcd-02b6448ab7e2 | 7 | public static Cons mostSpecificCollections(Cons descriptions) {
if (descriptions.rest == null) {
return (descriptions);
}
{ Cons cursor1 = descriptions;
Cons cursor2 = null;
Stella_Object value1 = null;
Stella_Object value2 = null;
while (!(cursor1 == Stella.NIL)) {
va... |
7051827f-b321-446f-ad22-a3cec4465848 | 9 | @Override
public void checkForMutations()
{
// Convenience variables.
ReplicatableCollection<ReplicatableInteger> replicateCollection = (replicationResult.getReplicate());
Collection<ReplicatableInteger> original = collection.getSubcomponents();
Collection<ReplicatableInteger> replicate = replicateCollection.... |
d2f36070-ee65-4633-be8d-7831c42808bf | 3 | private void makeTable() {
int tableSize = (int) Math.pow(2, Expression.getVariableCount());
compactTable.clear();
String compactTableString = new String(Expression.getCompactExpression());
List<String> expressionRow = new ArrayList<>();
List<String> emptyRow = new ArrayList<>();
for (int i = 0; i < compac... |
3b1a1b50-3ee6-4ceb-a588-18236de2ca49 | 6 | public int getInterval ()
{
int interval = getU8 (6);
String type = getType ();
boolean highspeed = iface.getDevice ().getSpeed () == "high";
if (type == "iso" || highspeed) {
if ((type == "bulk" || type == "control") && interval == 0)
/* never NAKs */ ;
else
interval = 1 << (interval - 1);
}
i... |
503cf848-01e1-40ab-a7e4-1e56ecd07e59 | 3 | private void list() {
if (agents.isEmpty()) {
UI.setError("No hay agents activos");
} else {
UI.clearError();
Agent agent;
int i;
UI.printHeader();
System.out.println(agents.size() + " agentes activos:");
System.out.println("");
for (i = 0; i < agents.size(); i++) {
agent = agents.get(... |
b8763d0e-a4fd-4a57-bf83-974c54164695 | 0 | public void setExecute(boolean execute) {
this.execute = execute;
} |
3712903a-31b7-4c13-826a-f3f3507edf8e | 4 | public GameBoardGraphics getGridPanel() {
boolean test = false;
if (test || m_test) {
System.out.println("Drawing :: getGridPanel() BEGIN");
}
if (test || m_test)
System.out.println("Drawing:: getGridPanel() - END");
return gameBoardGraphics;
} |
ea30a033-dfb4-4f40-8e53-015084de2782 | 5 | @Test
public void test() throws BiffException, IOException{
Workbook workbook = null;
workbook = Workbook.getWorkbook(new File("/Users/kimgyupyo/project/workspace/kbs6/resuorcemanager_t/src/test/java/data.xls"));
int sheetnumber = workbook.getNumberOfSheets();
System.out.println(sheetnumber);
Sheet she... |
754db4c9-84d1-4cb7-819a-03d6924a1009 | 5 | public void facePlayer(){
if(main.character!=null){
float dx = main.character.getPosition().x - getPosition().x;
if(dx > 0 && isFacingLeft()) changeDirection();
else if (dx < 0 && !isFacingLeft()) changeDirection();
}
} |
0520b75d-441c-4e2f-a7fd-030b346f37da | 1 | public void luoLukija(){
try {
lukija = new Scanner(tiedosto);
} catch (FileNotFoundException ex) {
System.out.println("Tiedostoa ei löydy!");
}
} |
5651c843-baa9-474f-9533-0633743b6cd4 | 0 | public ListenerManager getListenerManager() {
return this.listener;
} |
9dc87e68-802a-479c-9ca5-ddc27cc90701 | 3 | private void choseFood() {
for (int i : RSC.FOOD_IDS) {
if (Bank.getItem(i) != null) {
foodId = i;
break;
}
}
if (foodId == -1) {
KingBlackDragon.stop = true;
}
} |
d5e241c1-8a98-45df-a54a-bae5c1d4daea | 7 | public void sendCorrectMessages(Player player, int count) {
if (player.hasPermission("idc.keepallitems")) {
player.sendMessage(ChatColor.GOLD
+ plugin.getFiles().ALL_ITEMS_SURVIVED);
return;
}
String itemMessage = plugin.getFiles().ITEMS_MESSAGE_ON_RESPAWN
.replace("{0}", count + "");
player.se... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.