method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
064abf92-8fbe-4f38-9f71-be3ed6477729 | 2 | public static void divideLargeFile(final String filePath) throws IOException {
int fileIndex = 0;
File extractFile = new File("E://WDMRDB//Wiki//2009-11-5_LeavesNode_" + fileIndex + ".txt");
FileWriter extractFileWriter = new FileWriter(extractFile);
int count=0;
for(String tmp : leavesSet){
count++;
ex... |
6d22c03c-9b97-4156-bd6b-408e427131ab | 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... |
543932e7-aa85-4f31-848f-21e933615161 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof SiteBoundaryAttribute)) {
return false;
}
SiteBoundaryAttribute other = (SiteBoundaryAttribute) object;
if ((th... |
4ac143ef-4ec7-4d3a-a3ae-e3e57da3d80d | 8 | private void setBackgroundColor(int i) {
if (atom == null)
return;
String s = ((AtomisticView) atom.getHostModel().getView()).getColorCoding();
if ("Lego".equals(s)) {
if (AMINO_ACID[i].getCharge() > 0) {
mi[i].setBackground(new Color(ColorManager.LEGO_BASIC_COLOR));
}
else if (AMINO_ACID[i].getCh... |
46266902-a47b-4377-80f9-d87d84b7a33a | 5 | public static String getBinaryFloat (float f) {
assert ( 0.0 < f && f < 1.0) : " f in (0.0, 1.0)";
StringBuffer sb = new StringBuffer();
sb.append("0.");
f = f*2;
while ( f > 0 ) {
if ( sb.length() > 32 ) {
return "ERROR";
}
if ( f >= 1) {
sb.append( 1 );
f = ( f - 1 ) * 2;
} else i... |
92951172-9732-45e0-9f88-5e2a36285071 | 9 | protected void loadFields(com.sforce.ws.parser.XmlInputStream __in,
com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException {
super.loadFields(__in, __typeMapper);
__in.peekTag();
if (__typeMapper.isElement(__in, IsDeleted__typeInfo)) {
... |
a79e1b6b-4dd1-4fc3-8ba0-63ea5fb287ee | 9 | * @param settlement The <code>Settlement</code> that is trading.
*/
private void attemptSellToSettlement(Unit unit, Settlement settlement) {
Goods goods = null;
for (;;) {
// Choose goods to sell
goods = gui.showSimpleChoiceDialog(unit.getTile(),
"sellPro... |
706491fe-2425-4768-9f96-c6fbbcc72174 | 6 | public Console() {
for(int i = 0; i < COUNT_OF_COMMANDS; i++) {
switch (i) {
case 0: {
COMMANDS_DESCRIPTION[i] = START_GAME_WITH_COMPUTER_COMMAND + " - start game with computer";
break;
}
case 1: {
... |
7ff0e6fb-759b-4303-9e2f-407d53a92b8c | 4 | private void setHeuristicValue()
{
if(this.map == null || this.heuristic == null)
return;
for(int i = 0; i < this.map.columnsCount(); i++)
{
for(int j = 0; j < this.map.rowsCount(); j++)
{
this.map.getState(i, j).setH(this.heuristic.getHeuricticValue(i, j,
this.map.getGoalState().getX(), th... |
77c0fc03-7443-4789-be6c-624acd59b331 | 0 | @Test
public void esteKuuluukoPiste() {
assertTrue("Vasen yläkulma pieleen", e.kuuluukoPiste(p) != null);
p.siirra(10, 0);
assertTrue("Oikea yläkulma pieleen", e.kuuluukoPiste(p) != null);
p.siirra(0, 10);
assertTrue("Oikea alakulma pieleen", e.kuuluukoPiste(p) != null);
... |
937836f9-ecb2-482d-b011-a9b95b5d3fb7 | 4 | @Override
public Map<String, String> getParsedResults() {
if (!resultingMap.isEmpty()) {
return resultingMap;
}
String[] lines = stringBuilder.toString().split("\n");
for (String line : lines) {
line = line.trim();
if (line.startsWith("活动时间:")) {
parseStartAndEndTime(line.substring("活动时间:".length(... |
49f670c8-a3af-4783-8202-a38dc0f128d7 | 6 | private void diffOffering(CourseRec oldRec, OffRec oldOff,
HashMap<String, Object> newOff, ArrayList<Change> changes) {
// Start date.
Date newDate = getStartDate(newOff);
if (oldOff.getStart() == null && newDate != null
|| oldOff.getStart() != null
&& !oldOff.getStart().equals(newDate)) {
changes.a... |
f1af8376-83b6-4afa-a539-40364c5b00bd | 6 | public void send_TCP_packet(Packet app_pack) throws InterruptedException
{
//faz 3-way-handshake
if (!open_connection(app_pack))
return;
//constrói pacote TCP
Packet packet = build_TCP_packet(app_pack);
if (packet == null)
return;
int ACK = (int)Math.round(Math.random()*1000) + 2; //numero entre ... |
b48df1c7-6c3d-4bff-ab94-035293174c2a | 1 | public Juoma haeJuoma(int id) throws DAOPoikkeus {
// luodaan olio johon juoman tiedot tallennetaan
Juoma juoma = new Juoma();
// haetaan hörpyn tiedot tietokannasta
try {
JuomaDAO jDao = new JuomaDAO();
juoma = jDao.haeJuoma(id);
} catch (DAOPoikkeus e) {
throw new DAOPoikkeus("Juoman hakemine... |
ac5a791f-bb6a-42b2-a7aa-d793be8485ab | 3 | public static boolean canPlayerToggleToChannel( BSPlayer p, Channel channel ) {
if ( channel.isDefault() ) {
if ( p.getServerData().forcingChannel() ) {
String forcedChannel = p.getServerData().getForcedChannel();
if ( channel.getName().equals( forcedChannel ) ) {
... |
17ff0c4d-ac04-4ca3-ae9e-53756b5859a7 | 4 | @Override
public String toString()
{
final int height = board.length;
final int width = board[ 0 ].length;
final StringBuilder sb = new StringBuilder( height * (width + 1) );
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
if ( !traversable[y][x] )
{
sb.append(' ')... |
1d6997e4-9165-494e-8175-5d7dca4384b9 | 3 | void print(Node t, int n, boolean p)
{
if (p)
{
printCond(t, n);
}
else
{
if (n > 0)
{
for (int i = 0; i < n; i++)
System.out.print(" ");
}
System.out.println("(cond ");
}... |
365848ca-dc95-4a60-a7e3-9c869837b4d7 | 3 | public boolean isSyncCurrentPosition(int syncmode) throws BitstreamException
{
int read = readBytes(syncbuf, 0, 4);
int headerstring = ((syncbuf[0] << 24) & 0xFF000000) | ((syncbuf[1] << 16) & 0x00FF0000) | ((syncbuf[2] << 8) & 0x0000FF00) | ((syncbuf[3] << 0) & 0x000000FF);
try
{
source.unread(syncbuf, 0,... |
efe529d6-2aba-48b3-ba77-dcda9c3e3419 | 6 | void verifikasiBtnHapus(){
if(textSaldoA.getText().isEmpty() && textSaldoB.getText().isEmpty() && textOmset.getText().isEmpty()){
buttonHapus.setEnabled(false);
}
if(textSaldoA.getText().isEmpty() || textSaldoB.getText().isEmpty() || textOmset.getText().isEmpty()){
... |
e84303c4-48a4-4d57-8a62-28ca3b6249a5 | 9 | public final void metodos() throws RecognitionException {
try {
// fontes/g/CanecaSemantico.g:236:2: ( ^( METODOS_ ( metodo )* ) )
// fontes/g/CanecaSemantico.g:236:4: ^( METODOS_ ( metodo )* )
{
match(input,METODOS_,FOLLOW_METODOS__in_metodos726); if (state.faile... |
20f05e06-aad7-40aa-9c48-4b73eb434981 | 2 | public static AbstractFactory getFactory(int factoryTag) {
switch(factoryTag) {
case 1: return new ConcreteFactory1();
case 2: return new ConcreteFactory2();
}
return null;
} |
8158c5c7-036f-4fea-897f-4473f42b7621 | 0 | public void mouseMoved(MouseEvent event) {
adapter.mouseMoved(event);
} |
c7a290e5-48ea-48f8-b984-81a55e17d4ab | 6 | public Credentials(String loc) throws IOException {
try {
stream = new FileInputStream(loc);
reader = new BufferedReader(new InputStreamReader(stream,
Charset.forName("UTF-8")));
} catch (FileNotFoundException e) {
System.out.println("File does not exist.");
return;
}
String[] lns = new Stri... |
39cb47f5-45e1-4af9-a95e-34ef06b430f5 | 4 | public Effect(final String name, final int duration, final int delay) {
if (name == null) {
this.theName = "";
}
else {
this.theName = name;
}
if (duration < 0 && duration != Effect.PERMANENT_DURATION) {
this.theDuration = 0;
}
else {
this.theDuration = duration;
}
if (delay < 0) {
this... |
8a3c7303-07bd-48d4-bdca-dcb6606088a3 | 5 | public static void main(String[] args){
ArrayList<Long> primes = new ArrayList<Long>();
long f = 600851475143L;
long i = 0;
do {
i = factorOf(f);
if(f % i == 0 && !primes.contains(i)){
primes.add(i);
f = f / i;
}
} while(i != f);
primes.add(f);
long largest = 0;
for(long p : primes){... |
af5631ef-2d5a-4842-a249-492569ca900b | 4 | @Override
public void menu() {
out.println();
out.println("[1] Buscar");
out.println("[2] Cadastrar");
out.println("[3] Listar Todos");
out.println("[0] Sair");
switch(sc.nextInt()){
case 1: buscarPacientes(); break;
case 2: cadastraPaciente(); break;
case 3: mostraPacienteLista(); break;
cas... |
8e2b32ed-e1a3-44dd-ad65-f2500a555548 | 2 | public static int readIntValue() {
boolean isCorrectValue = false;
Scanner console = new Scanner(System.in);
int readValue = 0;
do {
if (console.hasNextInt()) {
readValue = console.nextInt();
isCorrectValue = true;
} else {
... |
c1f79426-b287-4c74-9c85-dcecde98179c | 8 | public boolean checkIntegrity() {
boolean ok = true;
for (AIObject ao : aiObjects.values()) {
if (!ao.checkIntegrity()) {
logger.warning("Invalid AIObject: " + ao.getId()
+ " (" + ao.getClass() + ")");
ok = false;
}
}
... |
ff28d89f-8cc0-4a15-bb13-82c8b4f73ef2 | 9 | @Override
public void actionPerformed(ActionEvent e) {
JButton button = (JButton)e.getSource();
String key = button.getText();
Boolean command = StringUtils.indexOf("0123456789.",key) < 0;
if(!command){
if((number + key).matches("[0-9]*|[0-9]+.[0-... |
c03b32e0-ff17-4d9f-9474-7db0b5f9e4ca | 6 | public scoreboard() throws IOException{
super("A Hole in the Universe");
setSize(950,650);
setLocationRelativeTo(null);
//retrieves all player info
//format: "GET_PLAYER_INFO username character ready score comets deaths powerups max_spin max_vel"
allPlayerInfoP1 = Client.sendMsg(msg);
... |
277b227d-86ec-4dd3-a9ac-99709b79aab4 | 2 | public void run() {
try {
ObjectOutputStream outStream = new ObjectOutputStream(
new BufferedOutputStream(clientSocket.getOutputStream()));
//Game game = Game.getInstance();
while (true) {
Data data = dataQueue.take();
... |
65beb9ae-e12d-4003-931e-4f1cf31efba4 | 5 | public List<City> getCities() {
List<City> list = new ArrayList<>();
Connection con = null;
Statement stmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDATABAS... |
685d4e03-4034-4c86-83ca-28c8c94d18d8 | 8 | public void putAll( Map<? extends K, ? extends Long> map ) {
Iterator<? extends Entry<? extends K,? extends Long>> it = map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends K,? extends Long> e = it.next();
this.put( e.getKey(), e.getValue() );
... |
5dcf9ca3-5c90-426c-9b71-958aaa9dba2c | 2 | private void flushAndCloseOutputStream(OutputStream stream) {
if (stream == null) {
return;
}
try {
stream.flush();
} catch (IOException ex) {
System.out.println(ex);
}
closeStream(stream);
} |
7aa5bc41-f288-4746-afa8-c1521692bde1 | 5 | public boolean isValid(int x, int y)
{
//determines whether a particular location is a valid location to put someone/something
if(x > -1 && x < width && y > -1 && y < height)
{
if(theMap[x][y].getType() != 0)
{
return false;
}
else
{
return true;
}
}
return false;
} |
e6e82604-895d-474a-ab54-0c293501dd3f | 5 | private void writeObject(ObjectOutputStream out) throws IOException {
purgeThread.interrupt();
processQueue();
HashMap<Object, Object> wcache = new HashMap<Object, Object>();
Iterator<String> it = map.keySet().iterator();
Object key = null;
Object value = null;
while(it.hasNext()) {
key = it.next(... |
699f5afa-2d88-4228-a4e1-879e04e503bc | 2 | public boolean neljaSamaa(){
for(int i=0; i<2; i++){
if(nopat[i].getValue()==nopat[i+3].getValue()){
return true;
}
}
return false;
} |
26a0c317-51ee-4fd5-af25-f90d451d3cf9 | 5 | public boolean checkifHasOwner(String uuid){
ArrayList<String> allAnimals = new ArrayList<String>();
if(!plugin.getAnimalData().contains("Farmer")){
return false;
}else{
Set<String> farmers = plugin.getAnimalData().getConfigurationSection("Farmer").getKeys(false);
//getting the farmers animals
for(String ... |
db0cc32e-a11f-477c-8191-5d69024d349e | 3 | public String[] whichPages(String word) {
word = word.toLowerCase();
ArrayList<String> pages = new ArrayList<String>();
for(Term term: termIndex){
if (term.getName().equals(word)){
for(Occurrence occ: term.getDocsList()){
pages.add(occ.getDocName()... |
f6c14171-2843-45fc-9176-77ef1753601c | 8 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder out = new StringBuilder();
String line = "";
while ((line = in.readLine()) != null && line.length() != 0) {
int[] v = readInts(line.trim());
if (v[0] == 0 && ... |
a4917407-1081-46cf-80da-49f465f3249b | 0 | public static String createWhoIsOnlineMessage(String myName) {
JSONObject jsonMsg = new JSONObject()
.element( "code", "1" )
.element( "name", myName )
;
return jsonMsg.toString();
} |
1055191d-4f5a-485b-9db1-1305286003cd | 4 | private void makeInputItems() {
boolean first = true;
for (Connector c : element.getConnectors()) {
if (c instanceof InputConnector) {
InputConnector ic = (InputConnector) c;
if (ic.isConnected()) {
if (first) {
first = false;
add(new JPopupMenu.Separator());
}
ComponentMenuIte... |
e48c4a55-0cd9-4bc6-89f7-b8eea4ceb9f8 | 8 | public int findIndex(char ch)
{
if(Character.getNumericValue(ch)==1) {return 0;}
if(Character.getNumericValue(ch)==2) {return 1;}
if(Character.getNumericValue(ch)==3) {return 2;}
if(Character.getNumericValue(ch)==4) {return 3;}
if(Character.getNumericValue(ch)==5) {return 4;}
if(Character.getNume... |
79d395ce-db15-41b7-bdd5-f2504c2e1224 | 9 | private boolean check(FlowNetwork G, int s, int t) {
// check that flow is feasible
if (!isFeasible(G, s, t)) {
System.err.println("Flow is infeasible");
return false;
}
// check that s is on the source side of min cut and that t is not on source side
if... |
729d3265-1b73-4644-8ff2-9894e1439b2f | 8 | public static void testFillTable() throws DatabaseException {
Connection conn = null;
ResultSet rs = null;
PreparedStatement ps = null;
Random randomGenerator = new Random();
int uid, i;
String q = "INSERT INTO test(uid,bid,auctionID) VALUES(?,1,17)";
try {
conn = DBPool.getInstance().getConnection()... |
44510521-a9f6-471d-b13b-6ac5af286a19 | 2 | public void load(String pedFileName) {
String pedBaseFileName = Gpr.removeExt(pedFileName);
String mapFile = pedBaseFileName + ".map";
PedFileIterator pedFile = new PedFileIterator(pedFileName, mapFile);
// Load all entries for this family
int count = 1;
for (PedEntry pe : pedFile) {
if (verbose) Gpr.s... |
0c4fc39a-0454-4405-a83c-337172604ece | 4 | protected Value runBlock(Block body, CodeBlock i) throws InterpreterException{
Block b = body;
Value last = null;
while (b != null && !__end && !__return) {
last = b.run(i);
if (b instanceof ReturnBlock) {
__return = true;
System.out.println("RETURN!");
} else
b = b.next();
}
return last;... |
0b2deeb0-9b29-4f8d-b2c6-0c1803c94c67 | 0 | public int getWarnings(Account account){ return account.getWarnings(); } |
71ca9374-be2a-4fcd-9b81-b6e77382f2a0 | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
Physical target=mob;
if((auto)&&(givenTarget!=null))
target=givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(mob,target,null,L("<T-NAME> <T-IS-ARE> already affected by @x1.",... |
63d967ad-ebf2-4636-91ef-1401e3e7136a | 7 | public boolean initialize() {
CommPortIdentifier portID = null;
Enumeration ports = CommPortIdentifier.getPortIdentifiers();
System.out.println("Trying ports:");
while(portID == null && ports.hasMoreElements()) {
CommPortIdentifier testPort = (CommPortIdentifier) ports.nextElement();
System.out.println("... |
2064f357-27c5-4484-9478-57ad4453c87a | 8 | void doMovement(){
if(hitsObstacle(me())){
dead=true;
}
double currentSpeed=walkSpeed;
if(Display.left)xVel-=currentSpeed;
if(Display.right)xVel+=currentSpeed;
if(hitsObstacle(me(0,1))){
if(Display.up)yVel-=jumpHeight;
}else{
yVel+=2;
}
xVel*=walkDelay;
yVel*=gravity;
double uvx = xVel/... |
733bbdc9-61ca-4538-8b60-e04219e70749 | 8 | public int compare(Object arg1, Object arg2)
{
Segment A = (Segment) arg1;
Segment B = (Segment) arg2;
Point Agauche = (A.a.x > A.b.x) ? A.b : A.a;
Point Adroite = (A.a.x > A.b.x) ? A.a : A.b;
Point Bgauche = (B.a.x > B.b.x) ? B.b : B.a;
Point Bdroite = (B.a.x > B.b.x) ? B.a : B.b;
if (Agauche.... |
b8da09b2-0d2f-4b8c-8e9d-c4ae755e1ae7 | 8 | private static String dozensContains( Map recordMap, String host, String ip )
{
if( !recordMap.containsKey( "record" ) )
{
return null;
}
List recordList = ( List )recordMap.get( "record" );
for( int i = 0; i < recordList.size(); ++i )
{
Map record = ( Map )recordList.get( i );
if( record.containsKey( "type" ) &... |
4b67402f-1144-4c58-aa60-6eabb3a28e82 | 4 | private void addHour(List<QlockWord> timeList, final int HOUR) {
if (HOUR == 12) {
timeList.add(QlockLanguage.EINS);
} else {
if (HOUR + 1 == 5) {
timeList.add(QlockLanguage.FÜNF2);
} else if (HOUR + 1 == 10) {
timeList.add(QlockLanguag... |
78c68ab0-8796-4bf2-b86a-e4db35f28f6f | 4 | public boolean suorita(String s) {
this.s = s;
ArrayList<String> edelliset = new ArrayList<String>();
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
if (grid[i][j].equals(Character.toString(s.charAt(0)))) {
//tN = tarkistaNaapurit
... |
27d40a11-2453-4a91-9015-c847d09854c5 | 7 | public static void main(String[] arg) {
//this program determines whether user inputted horizontal and vertical line intersect in the x-y plane
double Hy, Hxl, Hxr, Vx, Vyt, Vyb;
boolean validVertical = false;
Scanner input = new Scanner(System.in);
for (;;){
System.out.print("Please enter the... |
d843a645-e0ad-4b21-9d92-81ba641c0e12 | 5 | public boolean checkBox(int row, int col)
{
int i = 0, j = 0, k = 0, count = 0;
for(k = 1; k < 10; k++)
{
for(i = row; i < row+3; i++)
{
for(j = col; j < col+3; j++)
{
count = 0;
if(k == Integer.parseInt(entries[i][j].getText()) )
{
count++;
}
if(count >= ... |
65083e7c-0d33-49a8-9712-00b2bef6b8d1 | 9 | public void discover() {
InetAddress pingAddr;
System.out.println("Attempting to resolve gateway...");
try {
pingAddr = InetAddress.getByName("www.google.com");
this.ARPListener.setFilter("tcp and dst host "+pingAddr.getHostAddress(),true);
this.ARPListener.getListener().setPacketReadTimeout(5000);
th... |
580258a1-cb05-4307-b850-2ef762d3996c | 9 | @Override
public boolean sendDeath() {
WorldTasksManager.schedule(new WorldTask() {
int loop;
@Override
public void run() {
if (loop == 0) {
player.setNextAnimation(new Animation(836));
} else if (loop == 1) {
player.getPackets().sendGameMessage(
"Oh dear, you have died.");
} e... |
d314b457-e20e-48ff-b866-27cf9199eaf0 | 1 | @Test
public void shouldThrowErrorWhenBoardDimensionsWrong() throws IOException {
//given
File tmpFile = folder.newFile(FILENAME);
FileOutputStream fileOutputStream = new FileOutputStream(tmpFile, true);
CharsetEncoder charsetEncoder = Charset.forName(ENCODING).newEncoder();
... |
1a1702d4-27d9-4278-bc0f-30964e17f49a | 5 | void simple2 (){
int counter = 0;
for (int i = 3; ; i++) {
for (int j = 2; j < i; j++) {
if (i % j != 0) {
if (j == i - 1) {
counter += 1;
System.out.print(i + " ");
}
} el... |
d88b9fa4-7c9b-409d-9b25-3e0cedffb495 | 5 | public static boolean placeRailAt(ItemStack stack, World world, int i, int j, int k) {
if (stack == null)
return false;
if (stack.getItem() instanceof ITrackItem)
return ((ITrackItem) stack.getItem()).placeTrack(stack.copy(), world, i, j, k);
if (stack.getItem() instanceo... |
d973ec94-3b02-4080-a848-2709b8148a0a | 3 | public static void majority(Integer[] v) {
int median = getNthValue(v, 0, v.length - 1, v.length / 2);
int majorityCount = 0;
for (Integer value : v) {
if(value == median) majorityCount++;
}
if(majorityCount > v.length / 2) {
System.out.println(median);
... |
e64197fe-d807-4ec2-8668-6cdbe7615652 | 5 | public String createEdgeLabel(String vertex1, String vertex2) {
if(vertex1.substring(1).equals(vertex2.substring(0, vertex2.length()-1))){
String suffix="";
if(containsEdge(findEdge(vertex1,vertex2))){
Collection<String> fromV1 = getOutEdges(vertex1);
Collection<String> intoV2 = getInEdges(vertex2);
... |
446ee00c-7dc7-4c57-b11a-53ee432a34e6 | 0 | public boolean getSelectionOnly() {
return this.selectionOnly;
} |
0299afdc-662a-4de9-83f1-5e8800efe089 | 5 | private BufferedImage chooseImage(String title, String text,
boolean sameSize) {
List<String> imagens = getImageNames(sameSize);
imagens.remove(getSelectedFrame().getTitle());
if (imagens.size() == 0)
return null;
String imgName = (Stri... |
c388c35a-dbd8-47e7-a7c6-5135bcef6c0b | 9 | private CommucObj handleDoResEntropySlave(CommucObj cObj){
//TODO: understand what this function does and fix it for multiple strands
long startTime = System.currentTimeMillis();
//Set nonprotein strands as not present
for(int i=0; i<cObj.strandPresent.length;i++){
boolean isProtein = (new Boolean((String)c... |
9bad1294-4fc4-4722-8934-586f0a46fe2b | 2 | public core.render.Texture getTexture(String resourceName,
int target,
int dstPixelFormat,
int minFilter,
int magFilter) throws IOException
{
int srcPixelFormat = 0;
... |
683db84a-b1c0-4f58-8760-8c5c7bd85c64 | 7 | public static RunPhylipOutput consenseRootedTrees(String query, String consensusType)
{
GetAbsolutePath pt = new GetAbsolutePath();
String absolutePath = pt.getPath();
Runtime rt = Runtime.getRuntime();
String output = "";
String status = "Job Successfully Submitted"... |
2464ea1e-5b6c-45d8-8bd8-d374ea871876 | 4 | public NewItemDialog(JFrame frame) {
super(frame, true);
this.setTitle("Add new item to library");
this.setLayout(new BorderLayout());
this.setPreferredSize(new Dimension(240, 230));
jcbType = new JComboBox<Item.ItemType>();
for (Item.ItemType type : Item.ItemType.values())
jcbType.addItem(type);
... |
5e24f046-8ba8-4455-8efb-909a13b8d781 | 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... |
0e32b697-d97b-4769-9f9b-81902f39800f | 2 | public static void stop() {
if (task != null && !task.isDone()) {
task.cancel(true);
task = null;
BmLog.info("TestListController is stopped");
}
} |
f6238ac8-1379-43b2-98c5-77d300afbe2f | 7 | public static void main(String[] args) {
System.out.print("Podaj tytul pierwszego utworu: ");
String tytulPiosenki1 = IO.readString();
System.out.print("Podaj czas trwania pierwszego utworu (minuty): ");
int pierwszyUtworMinuty = IO.readInt();
System.out.print("Podaj czas trwani... |
fcf9b32d-f9d0-407b-8ef8-4b9bb4240c39 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
State other = (State) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return fals... |
37e5ba5d-ce54-4631-8c13-ce8df5e83097 | 0 | public GregorianCalendar getFechaEncargo() {
return fechaEncargo;
} |
e56c971c-fab6-47f4-8544-aabb082d36de | 6 | static public int get(int itemLevel, QualityT quality, ArmorT armor, EquipT equip) {
if (armor.armorTotalIndex < 0) {
if (armor == ArmorT.SHIELD) {
if (itemLevel < 1 && itemLevel > Shield.data.length) {
throw new IllegalArgumentException("Invalid Item Leve... |
e668df4b-a973-4f33-be6f-2c5c3a56deb9 | 7 | public static boolean addEndAndStartOfSequenceAfterThisWord(String currentWord,
String prevWord, SpacingModel nextSpace,int lengthSinceLastBreak) {
//System.out.println("currentWord="+currentWord+" prev="+prevWord+" nextSpace="+nextSpace+" int="+lengthSinceLastBreak);
if (currentWord.equals(ENDER)) {
re... |
c13b3241-2bf8-4601-ad25-cb91ae4a1710 | 4 | public void SetSmithing(int WriteFrame) {
outStream.createFrameVarSizeWord(53);
outStream.writeWord(WriteFrame);
outStream.writeWord(Item.SmithingItems.length);
for (int i = 0; i < Item.SmithingItems.length; i++) {
Item.SmithingItems[i][0] += 1;
if (Item.SmithingItems[i][1] > 254) {
outStream.writeByt... |
b54da95e-7df7-4854-88ce-34e20ece9787 | 5 | @Override
public void run()
{
Query currentQuery;
while(!Thread.interrupted())
{
synchronized(queries)
{
try
{
while(queries.isEmpty()) queries.wait();
}
catch(Interrupte... |
dc190ab1-0fb9-4941-ac8d-100b65da579b | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Persona other = (Persona) obj;
if (!Objects.equals(this.nombre, other.nombre)) {
return false... |
2c62e795-04bc-4e72-80eb-f2c4ee8bf3b5 | 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... |
72126474-9c92-4ca0-b8e5-e876a12dcdc8 | 5 | @Override
public void run()
{
Path path = new Path();
PathSource pathSource = new PathSourceLink(map);
int sx = player.location.x;
int sy = player.location.y;
int dx, dy;
while(go) {
// Find a random empty spot on the map
do {
... |
e5ba4340-6ab2-40d2-a783-1d24e0c8dcfb | 0 | public Queen(boolean isWhite, ImageIcon imgIcon) {
super(isWhite, imgIcon);
this.setIcon();
} |
fdf6517d-187f-4301-96ea-7d0989ff9718 | 0 | private void jButtonSauvegarderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSauvegarderActionPerformed
//Récupération de la méthode contrôleur 'sauvegarderRapport'
ctrlCR.sauvegarderRapport();
}//GEN-LAST:event_jButtonSauvegarderActionPerformed |
c37b952d-8ebb-45d4-90f3-c0824ead1e1c | 6 | public void write(Size size, int bank, int addr, int val) {
boolean fastrom = false;
// Determine speed by bank
if (bank >= 0x80) {
fastrom = true;
}
if ((bank == 0x00 || bank == 0x80) && addr >= 0x4000 && addr <= 0x41FF) {
Timing.cycle(12); // 12 master cycles to access these
set(size,bank,ad... |
bebde774-de23-44d4-93e9-5b3f466d11c9 | 1 | private void loginButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loginButtonActionPerformed
if(login(usernameField.getText(),passwordField.getText())){
JOptionPane.showMessageDialog(null, "Logged in as " + account.getUsername());
this.dispose();
}
}/... |
558a38d6-8015-4bfc-8935-2fc1eb3e3747 | 0 | public WidthChangeHandler(boolean increment) {
this.increment = increment;
} |
1edcefe8-dae0-4fdf-8b3c-f3d20cdebe31 | 5 | public static Reponse creerReponse(Sujet sujet, String message, Utilisateur utilisateur)
throws ChampInvalideException, ChampVideException {
if (!sujet.peutRepondre(utilisateur))
throw new InterditException("Vous n'avez pas les droits requis pour répondre");
EntityTransaction tr... |
e3938a40-6612-44b6-86d8-a7f64dcfd331 | 5 | public boolean eq(Matrix B) {
Matrix A = this;
if (B.M != A.M || B.N != A.N)
throw new RuntimeException("Illegal matrix dimensions.");
for (int i = 0; i < M; i++)
for (int j = 0; j < N; j++)
if (A.data[i][j] != B.data[i][j])
return false;
return true;
} |
fa4ed28c-f63f-465b-8011-dc7a3a472f99 | 6 | private Formula negotiate(int snum) {
Formula offer = null, prevOffer= null;
int step = 0;
Formula finalOffer = null;
System.out.println("");
System.out.println("************* Negotiation Starts *************");
while (true) {
step++;
//System.out.println("");
System.out.println("Step: " + st... |
b2615462-580d-4bf7-843b-189eede75488 | 1 | public void visitFieldInsn(final int opcode, final String owner,
final String name, final String desc) {
buf.setLength(0);
buf.append(tab2).append(OPCODES[opcode]).append(' ');
appendDescriptor(INTERNAL_NAME, owner);
buf.append('.').append(name).append(" : ");
appendDescriptor(FIELD_DESCRIPTOR, desc);
bu... |
ed6d72fe-a5d5-4739-9d6f-89cf38f1ec5f | 4 | public boolean takeDamage(int amount, Living from) {
if (from != null && !from.living()) {
return false;
}
if (amount > 0) {
washurt.add(amount);
}
hp -= amount;
if (hp < 1) {
hp = 0;
dead = true;
return true;
... |
d62b9e4a-d479-4a4a-b42d-cb33d417fa37 | 9 | @Override
public String mover(int fila, int columna, int turno) {
if(this.columna==columna){
if((this.fila>=1&&this.fila<=6)&&(this.fila+1==fila||this.fila-1==fila))
return getPeon(turno);
else if((this.fila==6&&fila==4)||(this.fila==1&&fila==3))
retur... |
c0578457-1a66-4c2a-a429-b6d85592dfff | 3 | @SuppressWarnings("unchecked")
protected <C extends Component> C get(Entity entity,
Class<? extends Component> componentClass) {
int entityId = entity.getId();
int componentId = getId(componentClass);
Bag<Component> components = componentIdToComponents.get(componentId);
if (components == null) {
throw ne... |
01133ce2-735b-4c70-a5df-2c45a3ae32d2 | 9 | @Override
public void stateChanged(/*@NotNull*/ ChangeEvent<State> event) {
Util.checkNotNullArgument(event);
if (!isBackground(event)) {
return;
}
if (event.getNewValue() != null) {
State state = event.getNewValue();
int count = getBackgroundTaskCount();
upda... |
777db14d-5ffc-4ac9-90f2-b33d30ce0ab6 | 3 | private void stopFileSender() {
while (this.fileSenderThread != null && this.fileSenderThread.isAlive()) {
this.fileSenderThread.interrupt();
try {
this.fileSenderThread.join();
System.out.println("fileSenderThread finish");
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} |
e9b611b4-7e9f-4677-9b22-6f4246dcb610 | 6 | public boolean[][] analyseData() {
// creates a 2D boolean array for each grade and period
boolean[][] checkboxBooleanArray = new boolean[totalGrades][perPerDay];
// for loop cycles through each one and checks to which checkboxes are
// selected and assigns that value to the sepcific position
for (int y = 0... |
6aede72c-2fc4-4f13-b44e-dbb5e3d7ed4c | 9 | public void carregaMusicas(File[] arquivos,Atualizador atualizador, ArrayList<Tags> listaTags)
throws ListaNulaException, ListaVaziaException {
// declara variaveis
String artista = ConstantesUI.STRING_VAZIA;
String album = ConstantesUI.STRING_VAZIA;
String ano = ConstantesUI.STRING_VAZIA;
String genero =... |
de430f0f-7560-413a-afcf-22cf88a67b2f | 3 | @Override
public Iterable<? extends Position<T>> children(Position<T> p)
throws InvalidPositionException, BoundaryViolationException {
// focusing on a particular node, return 0, 1 or 2 children
ArrayList<Position<T>> children = new ArrayList<Position<T>>();
if (hasLeft(p))
children.add(left(p));
if (ha... |
81b7962a-10cd-497d-97a0-e563118d83b0 | 7 | private static void vote(Desc desc) {
List<String> keywords = desc.keywords;
int[] votes = new int[N];
for (BookName bn : booknames) {
for (String kw : keywords) {
if (!ignoredKeywords.contains(kw) && bn.keywordSet.contains(kw)) {
votes[bn.index]... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.