method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b972aa1b-e20b-45fb-90e0-b4f160ca097d | 7 | public static int translate(int unicode) {
if ((unicode >= 0x20 && unicode <= 0x7e) ||
(unicode >= 0xa0 && unicode <= 0xff))
return unicode;
int min = 0;
int max = table.length - 1;
int mid;
while (max >= min) {
mid = (min + max) / 2;
if (table[mid][1] < unicode)
... |
6592de36-1e80-49cd-a150-305c2075aa42 | 2 | private void initRGB(BufferedImage bi) {
int[] rgbData = bi.getRGB(0, 0, bi.getWidth(), bi.getHeight(), null, 0,
bi.getWidth());
int colorRed;
int colorGreen;
int colorBlue;
for (int x = 0; x < bi.getWidth(); x++) {
for (int y = 0; y < bi.getHeight(); y++) {
colorRed = (rgbData[(y * bi.getWidth())... |
ce75e648-b879-44a1-b1c2-b6c5fca22cb1 | 0 | @Override
public void mouseClicked(MouseEvent e) {
unprocessedEvents.add(e);
mouse = e.getPoint();
} |
74ab8fcf-61f2-448f-b661-43cde9f1b390 | 3 | public static void main(String[] args) {
// Build model
Model model = new CPModel();
// Declare every letter as a variable
IntegerVariable s = Choco.makeIntVar("S", 0, 9, Options.V_ENUM);
IntegerVariable e = Choco.makeIntVar("E", 0, 9, Options.V_ENUM);
IntegerVariable n = Choco.makeIntVar("N", 0, 9, Options... |
4bb89555-e1cb-4935-9139-b517cf71f019 | 1 | public int numImages(String name) {
ArrayList imsList = (ArrayList) imagesMap.get(name);
if (imsList == null) {
//EIError.debugMsg("No image(s) stored under " + name, EIError.ErrorLevel.Warning);
return 0;
}
return imsList.size();
} |
def8c9cb-638a-4ca7-8a20-0b5bed52dfa0 | 6 | public void drawStartMenu(Graphics2D g2) {
g2.setColor(Color.BLACK);
g2.fillRect(0, 0, 400, 400);
g2.setColor(Color.WHITE);
g2.setFont(fontHeader);
g2.drawString("Snake", 100, 100);
g2.drawString("Created by Jake", 100, 120);
g2.setFont(fontMenu);
g2.drawString("Start game", 100, 200);
g2.drawString("... |
fd308407-0c56-44f6-82eb-8d44ec47426e | 7 | public Map<Integer, StringBuilder> getCommandsForKeys(Collection<String> keys)
throws MemcachedException {
List activeList = hostListObj.getActiveList();
String commandString = "get ";
if (activeList == null || activeList.isEmpty()) {
throw new MemcachedException("No active list available to service requests... |
83e461ce-6c84-4102-a849-29146130e1d4 | 3 | private void btnAcessarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAcessarActionPerformed
if (txtLogin.getText().equals("") || txtSenha.getText().equals("")) {
JOptionPane.showMessageDialog(null, " Preencha todos os campos!!!",
"Cadastro de Departamento"... |
74de574f-f12f-4520-8e5d-59c595b2364b | 4 | private void loadDatabase() {
//Declare a few local variables for later use
ClassLoader currentClassLoader = null;
Field cacheField = null;
boolean cacheValue = true;
try {
//Store the current ClassLoader, so it can be reverted later
currentClassLoader = ... |
0dab0952-a355-4bac-969c-9551b31212dd | 1 | public static String[] read (org.omg.CORBA.portable.InputStream istream)
{
String value[] = null;
int _len0 = istream.read_long ();
value = new String[_len0];
for (int _o1 = 0;_o1 < value.length; ++_o1)
value[_o1] = istream.read_string ();
return value;
} |
6f106a41-190e-48f0-8687-68f90ca83271 | 4 | static ArrayList<String> loadBackup(){
ArrayList<String> liste = new ArrayList<String>();
try
{
File f = new File ("backup.ml0");
FileReader fr = new FileReader (f);
BufferedReader br = new BufferedReader (fr);
try{
for (int i = 0; i < 2; i++){
liste.add(br... |
8a52db38-e249-4720-a2a5-905619f5eba7 | 8 | protected <T> T timeout(Callable<T> waitFor, Callable<Object> run, int sleep, int operationTimeout) {
try {
long start = System.currentTimeMillis();
boolean timeout = false;
T value = null;
do {
value = waitFor.call();
if (run != null) {
run.call();
}
if (sleep > 0) {
... |
8a7c5154-cbcd-4b3e-882b-0364e0af982a | 0 | @Override
public String toString() {
return "PersonListModel [result=" + result + ", message=" + message
+ ", data=" + data + "]";
} |
58361f92-1b7f-4aab-9994-f63c73bd10f2 | 5 | private void updatemove() {
xa = 0;
ya = 0;
Player player = level.getPlayerRadius(this, 50);
if(player != null) {
if (x < player.getX()) xa++;
if (x > player.getX()) xa--;
if (y < player.getY()) ya++;
if (y > player.getY()) ya--;
}
} |
24797e02-e039-48d0-9533-c1145bcf3b92 | 1 | public void testToLocalDateTime_wrongChronologyLocalTime() {
LocalDate base = new LocalDate(2005, 6, 9, COPTIC_PARIS); // PARIS irrelevant
LocalTime tod = new LocalTime(12, 13, 14, 15, BUDDHIST_PARIS); // PARIS irrelevant
try {
base.toLocalDateTime(tod);
fail();
... |
b90a54f0-7cb3-41e8-b1ab-b5f5d669973c | 7 | public String getScore() {
String s;
if (puntosJugador1 < 4 && puntosJugador2 < 4 && !(puntosJugador1 + puntosJugador2 == 6)) {
s = frases.getFrase(puntosJugador1);
return (empate(puntosJugador1,puntosJugador2)) ? s + frases.getIguales() : s + "-" + frases.getFrase(puntosJugador2... |
68e3c7f9-9b34-482b-b50d-903dabe95ffd | 3 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((birthday == null) ? 0 : birthday.hashCode());
result = prime * result + ((email == null) ? 0 : email.hashCode());
result = prime * result
+ ((password == null) ? 0 : password.hashCode());
return resu... |
912d63c1-ff10-4c41-a31d-27855d0907ec | 4 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Tile other = (Tile) obj;
if (!Arrays.equals(data, other.data))
return false;
return true;
} |
36cc013a-4afb-4435-83e0-3e7f2aaf0019 | 2 | private String getURIRequest(HttpRequest req)
{
String uri = req.getUri();
System.out.println(documentRoot + uri);
try
{
uri = URLDecoder.decode(uri, "UTF-8");
}
catch(UnsupportedEncodingException e)
{
try
{
... |
b0cb4803-5f87-4ff5-98d7-85bf4fbf4ae4 | 0 | public void setGameClockInMinutes(int timeInMinutes) {
this.playerWhite.time = timeInMinutes * 60;
this.playerBlack.time = timeInMinutes * 60;
} |
9123418b-943a-4c24-8c79-f2b4ceb17c2a | 0 | public MenuBar(Game game) {
// Game
this.game = game;
// Menus
this.fileMenu = new JMenu("File");
this.fileMenu.setMnemonic(KeyEvent.VK_F);
this.helpMenu = new JMenu("Help");
this.helpMenu.setMnemonic(KeyEvent.VK_H);
this.newLocalMultiplayerGameMenuItem = new JMenuItem("New local mul... |
05d1530b-b3f5-4138-9a39-7388abdf89f3 | 3 | public Projectile(int size, int range, int speed, int damage, Point startPoint, Point endPoint, String texture, int rotateDegree) {
super(false, false, size, size, texture);
this.shootRange = range;
this.speed = speed;
this.damage = damage;
this.startPoint = startPoint;
this.endPoint = endPoint;
thi... |
c163f878-a2b3-454c-bc23-650d062b3a97 | 6 | private static Image getImage(String filename) {
// to read from file
ImageIcon icon = new ImageIcon(filename);
// try to read from URL
if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) {
try {
URL url = new URL(filename);
... |
a3e78c06-b644-4494-807b-08a5d3bdd99a | 6 | public static String escape(String string) {
char c;
String s = string.trim();
StringBuffer sb = new StringBuffer();
int length = s.length();
for (int i = 0; i < length; i += 1) {
c = s.charAt(i);
if (c < ' ' || c == '+' || c == '%' ... |
88a20e71-d3e5-4ced-8e3c-b77cee433df8 | 9 | public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(in.readLine().trim());
long[] potencias ={1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000L};
for (int i = 0; i ... |
72360f97-83c0-4bc7-9168-e11589b1ccb9 | 5 | protected SoundPlayer() {
this.buffers = new ArrayList<SoundPlay>();
AudioFormat format = new AudioFormat(44100.0f, 16, 2, true, false);
try {
this.line = AudioSystem.getSourceDataLine(format);
this.line.open(format, 4410);
this.line.start();
this.thread = new Thread(new Runnable() {
@Override
... |
2fcab7ab-6e6f-40a1-8eba-2d3d8a5f0ff5 | 1 | public Map<String, TuringMachine> getBlockMap(){
Map<String, TuringMachine> ret = new HashMap<String, TuringMachine>();
for (TMState s: (Collection<TMState>) states) //that's right, EVERY state in TM has an inner Auto, even if that inner auto might be empty.
ret.put(s.getInternalName(), s.ge... |
9e7ea8dc-6523-491f-b584-2a31c6445ec0 | 1 | public Receiver(ActionListener al, int port) {
this.actionList = al;
this.port = port;
try {
recvSock = new DatagramSocket(port);
} catch (SocketException ex) {
Logger.getLogger(Receiver.class.getName()).log(Level.SEVERE, null, ex);
}
} |
65a116ad-b707-4bdc-a9af-ffba64ebcae1 | 6 | protected void prepareAuthenticationHeaders(HttpRequestBase request) throws Exception {
if (grantToken == null && username != null && password != null) {
FetchGrantService fgs = new FetchGrantService(username, password);
executeService(fgs);
grantToken = fgs.getResult().getAccessToken();
username = nu... |
8afe801b-258a-40a1-a6fd-1d1a7f0eb991 | 7 | static final void getSize(CellRenderer self, Widget widget, Rectangle cellArea, int[] xOffset, int[] yOffset, int[] width, int[] height) {
if (self == null) {
throw new IllegalArgumentException("self can't be null");
}
if (widget == null) {
throw new IllegalArgumentExcep... |
7a861c5e-508e-4666-bf71-dd7bc578c4eb | 1 | private void confirmSubmission()
{
QuestionPanel.removeAll();
JLabel submitted = new JLabel();
submitted.setText("Your results have been saved!");
submitted.setSize(submitted.getPreferredSize());
submitted.setLocation(100, 100);
qnumLbl.setVisible(false);
Time... |
3e708e9e-9b1b-45f1-bd76-6db7bcd6a091 | 9 | public static void main(String[] args) {
Sisaloca sis = new Sisaloca();
try {
sis.cadastraProfessor("Breno", "111");
System.out.println("Funcionou cadas. prof");
} catch (ProfessorJaExisteException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
sis.adicionaDiscipli... |
d8be8858-6987-4f59-9436-4fd7655ba1a3 | 3 | @Override
public GameState doAction(GameState state, Card card, int time)
{
if(time == Time.DAY)
{
state = carpenterDay(state, card);
}
else if(time == Time.DUSK)
{
PickTreasure pick = new PickTreasure();
state = pick.doAction(state, card, time);
}
else if(time == Time.NIGHT)
{
//Nothing ... |
16de0788-ee26-4143-b94c-c4ea65043f08 | 5 | public void keyPressed(int k){
if(k == KeyEvent.VK_RIGHT) player.setRight(true);
if(k == KeyEvent.VK_LEFT) player.setLeft(true);
if(k == KeyEvent.VK_W) player.setJumping(true);
if(k == KeyEvent.VK_R) player.setScratching();
if(k == KeyEvent.VK_F) player.setFiring();
} |
10db191c-cfc9-498c-bd95-1105cecc6238 | 7 | private static final JSON.Node loadSettings(final String settingsFilename) {
File f = new File(Main.appDir, settingsFilename);
InputStream stream = null;
try {
stream = new FileInputStream(f);
}
catch (Exception e) {
stream = null;
}
if (stream == null) {
stream = Main.class.getResourceAsStream("... |
1c0232c7-440b-4d7d-9377-565222332b49 | 2 | public void save() {
String[] text = textArea.getText().split("\n");
if(text.length != 0) {
dialogue = "@Text:" + text[0];
for(int x = 1; x<text.length; x++) {
dialogue += ";" + text[x];
}
}
} |
d6939df7-2e9a-444e-b0ff-0433bd8db8d1 | 7 | public int threeSumClosest(int[] nums, int target)
{
if (nums.length <= 3) {
int sum = 0;
for (int num : nums) {
sum += num;
}
return sum;
}
Arrays.sort(nums);
int lastIndex = nums.length - 1;
i... |
314697a5-bbac-4c85-8dc2-76c8a11a313e | 2 | public static Double stoDouble(String str){
Double i=0.0;
if(str!=null){
try{
i = Double.parseDouble(str.trim());
}catch(Exception e){
i = null;
}
}else{
i = null;
}
return i;
} |
a5307d4d-4899-42e0-b4d1-5401e7edbd0c | 6 | protected void onTick() {
AgentContainer container = this.myAgent.getContainerController();
try {
switch (state) {
case 0:
container.createNewAgent("Banana", Banana.class.getName(), new Object[0]).start();
break;
case 1:
container.createNewAgent("Jim", Jim.class.getName(), new Object[0]).start()... |
2fd5c585-2a64-4f36-843b-0ed69fd20074 | 4 | private void readFile(File diffMapperFile) {
try {
BufferedReader reader = new BufferedReader(new FileReader(diffMapperFile));
String[] title = reader.readLine().split("\t");
String line;
while((line = reader.readLine()) != null) {
String[] value = line.split("\t");
for(int i = 0; i < title.le... |
fe547c7b-496b-4850-8424-b9e6ab6286c5 | 1 | @Override
public void startObstacle(List<Element> elements, Element e) {
if (e instanceof Player)
((Player) e).decrementAction();
} |
4c9ea6db-83be-4c59-aec2-ccacb762a546 | 2 | @Override
public boolean equals(Object obj) {
if (((((Bill) obj).getDate().get(Calendar.MONTH)) == (date
.get(Calendar.MONTH)))
&& (((Bill) obj).getDate().get(Calendar.YEAR)) == (date
.get(Calendar.YEAR))) {
return true;
}
return false;
} |
fa792cb5-1c12-4e26-a8ba-41f8c4c8f26b | 9 | private void handleKeys(){
switch(keyListener.getCurrentKeyCode()){
case KeyEvent.VK_ESCAPE:
gameEngine.startMenu();
break;
case KeyEvent.VK_W:
case KeyEvent.VK_UP:
pacman.setNewDirection(0);
break;
case KeyEvent.VK_D:
case KeyEvent.VK_RIGHT:
pacman.setNewDirection(1);
break;... |
049b0d14-2114-477f-aaf2-ee3073f67811 | 4 | public void process() {
BigDecimal sumaReda;
for (int i = 2; i <= N; i++) {
switch (checkNumber(i)) {
case 1:
// Broj je prim broj
sumaReda = getSumAll(i);
// System.out.println(i + ": " + sumaReda.toString());
sumaUkupno = sumaUkupno.add(sumaReda);
break;
case 2:
// broj ima parn... |
42af6860-5d17-4e12-bda5-df0edf781390 | 7 | public Wave19(){
super();
MobBuilder m = super.mobBuilder;
for(int i = 0; i < 400; i++){
if(i % 17 == 0)
add(m.buildMob(MobID.JIGGLYPUFF));
else if(i % 20 == 0)
add(m.buildMob(MobID.KADABRA));
else if(i % 5 == 0)
add(m.buildMob(MobID.PIDGEY));
else if (i % 4 == 0)
add(m.buildMob(MobID.... |
db4a040d-45d4-4664-a257-dc4cb944da18 | 2 | public CodePanel(Handler handler, int random) {
super();
if(random == 0) color = "_green";
else if(random == 1) color = "_blue";
else color = "_orange";
//set LayoutMng
this.setLayout(new MigLayout("fill"));
//setLayout
this.setBackground(Color.BLACK);
... |
08dc1f3c-3993-499f-960c-438114183068 | 1 | public boolean ModificarPlaga(Plaga p){
if (p!=null) {
cx.Modificar(p);
return true;
}else {
return false;
}
} |
d8b73eb6-f76e-4122-8330-6fc41b9ed267 | 8 | public int[] generate(int length, int[] seed) {
//Check to make sure seed is the correct depth
if (seed.length != this.depth) {
System.err.println("[WARNING] Wrong seed length for this Matrix depth");
return null;
}
int[] array = new int[length];
String se... |
b3fb2ca9-c129-4e7a-ab86-2cabd0fce82d | 7 | protected FrameDecoder retrieveDecoder(Header header, Bitstream stream, int layer)
throws DecoderException
{
FrameDecoder decoder = null;
// REVIEW: allow channel output selection type
// (LEFT, RIGHT, BOTH, DOWNMIX)
switch (layer)
{
case 3:
if (l3decoder==null)
{
l3decoder = new LayerIIIDec... |
940ebca4-2abc-4d5e-ad22-8c736d0751f7 | 3 | public byte[] encrypt(String plainText) {
byte[] text = plainText.getBytes();
int[] intText = byte2int(text);
if(intText.length < 4){
int[] aux = {intText[0],0,0,0};
intText = aux;
}
int sum, n, rounds, z, e, y, ind;
n = blockSize;
rounds = 6 + 52 / n;
z = intText[n - 1];
// v0 = intText[i];
/... |
8761b1c0-de13-41a7-8637-6c6436aad7f3 | 8 | public static void main(String[] args) throws IOException,
ClassNotFoundException, InterruptedException {
allCompaniesList = readContentsFromFile();
// totalSize = allCompaniesList.size();
fw = new FileWriter(file2.getAbsoluteFile(), true);
if (!file2.exists()) {
file2.createNewFile();
}
while (totalS... |
db2b9db3-9938-4d02-bbeb-64807a47e231 | 1 | public void insert(Connection conn) throws SQLException {
if (isValid())
{
PreparedStatement stmt = conn.prepareStatement("INSERT INTO crmusers VALUES (?, ?, ?, ?, ?)");
stmt.setInt(1, id);
stmt.setString(2, firstName);
stmt.setString(3, lastName);
stmt.setString(4, gender);
stmt.setInt(5, age);
... |
8b700a19-ef37-4061-a78d-d8a6885e2dce | 5 | public NVBase search(String str_key) {
for(String lstr_key : keys()) {
if(lstr_key.equals(str_key)) {
return getValue().get(lstr_key);
}
}
for(String lstr_key : keys()) {
NVBase lcl_child = getValue().get(lstr_key);
if(lcl_child instanceof NVObject) {
NVBase lcl_r = ((NVObject)lcl_child).se... |
94ccd069-9119-4e03-987e-987111bd0be8 | 9 | public MainPage(final PageParameters params){
MySession sess = (MySession)getSession();
int playertype1 = params.getInt(PARAM_PLAYER_TYPE1);
int playertype2 = params.getInt(PARAM_PLAYER_TYPE2);
for(int i=1;i<65; i++){
CELL_ARRAY[i] = new StoneLink(i){
private static final long serialVersionUID = 7308... |
c064a213-c12f-416e-84dd-b45edd6f190f | 2 | public String toString()
{
StringBuilder sb = new StringBuilder();
int counter = 1;
for(Card c : cards)
{
sb.append(c).append(" | ");
if(counter++ % 10 == 0)
sb.append("\n");
}
return sb.toString();
} |
58f7e23e-b14f-40ca-bf90-e5f09bd419ea | 2 | void updateState(ExtractState es) {
this.lblCurrentFile.setText(es.currentFile);
this.pbProgress.setMaximum(es.totalNumFiles);
this.pbProgress.setValue(es.filesDone);
this.pbProgress.setString(String.format("%.2f", es.filesDone / (float) es.totalNumFiles * 100) + "%");
... |
54f771ab-62a5-4b5c-a6ff-84c6b8926e08 | 1 | public String toString(){
return super.getColor() ? "*":"$";
} |
f4e63b0d-5a28-4b68-a6c7-290bb8ae1581 | 2 | private Hash instanceFromXml(int status, String content) {
Hash hash = new Hash();
try {
Error error = errorFromXml(status, content);
if(error == null) {
JAXBContext context = JAXBContext.newInstance(Hash.class);
Unmarshaller unmarshaller = context.createUnmarshaller();
StringReader xml = new ... |
892275f0-0118-4ba0-98ec-39f9bf725fbe | 1 | @Test
public void findBillssByHouseholdTest() throws BillNotFoundException {
Household hh = null;
try {
hh = familyService.findHousehold(0);
} catch (InstanceNotFoundException e) {
fail("Household not found");
}
billService.createBill(hh);
assertEquals(1, hh.getBills().size());
ArrayList<Bill> ar ... |
e40ddaeb-d2c6-4f23-8461-83d916ecc95f | 9 | private void transmitMessage(MsgHeaderRequest_PI msgHeaderPI,
IRodsPI bodyPart,
RError_PI errorPart, BitstreamCallback bitstreamData,
ResultCallback callback) throws IOException
{
byte[] headerSize;
byte[] header;
OutputStream output;
if ( isClos... |
6dc820e7-7f24-4c45-99c2-c225ea1c4f60 | 5 | public StructuredBlock findCase(FlowBlock destination) {
for (int i = 0; i < caseBlocks.length; i++) {
if (caseBlocks[i].subBlock != null
&& caseBlocks[i].subBlock instanceof EmptyBlock
&& caseBlocks[i].subBlock.jump != null
&& caseBlocks[i].subBlock.jump.destination == destination)
return case... |
e4be13e3-d8c1-4904-b6d8-fbc6e28295ee | 9 | public boolean isValidMove(Move mov) {
// Space is taken
if(getPiece(mov.getEnd().row, mov.getEnd().column).getColor() != Color.GRAY) {
return false;
}
// Can't travel the same direction twice
if(previousDirection == mov.getDirection())
return false;
if(Piece.isValidSpace(mov.getStart().row, mov.getSt... |
7cb28446-d7f0-4095-adf0-d806ae17d146 | 4 | public static NBTTagCompound parseNBTStream(InputStream is) throws IOException {
if (is == null) {
throw new IllegalArgumentException("Input stream must not be null");
}
DataInputStream in = null;
if (is instanceof DataInputStream) {
in = (DataInputStream) is;
... |
bec0b622-ca21-464b-a88f-4d4f014f8b9c | 0 | public void setFechaEncargo(GregorianCalendar fechaEncargo) {
this.fechaEncargo = fechaEncargo;
} |
7dad4a24-1035-40dc-8a70-6cfdcedc3b7b | 7 | public IndexedSprite(Archive container, String name, int entry) {
Stream image = new Stream(container.get(name + ".dat"));
Stream index = new Stream(container.get("index.dat"));
index.offset = image.getUnsignedShort();
trimWidth = index.getUnsignedShort();
trimHeight = index.getUnsignedShort();
int pallete_... |
73678c26-41e8-431f-9e2d-e77aa42db181 | 6 | @Override
public void onPrivmsg(String target, IRCUser user, String msg) {
if(target.equals(channel)) {
StringTokenizer tokenizer = new StringTokenizer(msg);
String command = tokenizer.nextToken();
if(command.equals(".bg")) {
if(tokenizer.hasMoreTokens()) ... |
491f34bb-d2d9-4523-b596-ba489a906fc7 | 4 | public static void main(final String[] args) {
/* Set up the error handler as early as humanly possible. */
ThreadGroup g = new ThreadGroup("Haven client") {
@Override
public void uncaughtException(Thread t, Throwable e) {
APXUtils.handleException(t, e);
}
};
Thread.setDefaultUncaughtExceptionHandl... |
739f8992-04fa-4bb7-a4e5-ada3fe68dcf9 | 7 | public static void scrap() {
HibernateDAOFactory factory = new HibernateDAOFactory();
ProjectDAOImpl projectDAO = factory.getProjectDAOImpl();
Set<String> projectUrlSet = new HashSet<String>();
List<String> urlList = Constant.getCategoriesMostFundedURL();
ExecutorService projectExecutor = Executors.newFixedTh... |
f120edf6-9607-4222-809d-bb3e883c0ecb | 3 | public void printDB() {
ArrayList<Test>tests = queryTests();
for(Test test : tests) {
Gson gson = new Gson();
String json = gson.toJson(test);
System.out.println(json);
}
ArrayList<TestDistance> tdistances = queryTestDistances();
for(TestDistance distances : tdistances) {
Gson gson = new... |
9a481b3c-9b76-4be9-8d8a-1e3fbb7c4f8d | 7 | public static boolean hasAnnotations(Class<?> c, Class <? extends java.lang.annotation. Annotation> annotationClass ) {
if (c.isAnnotationPresent(annotationClass)) {
System.out.println("c.getAnnotation(): " + c.getAnnotation(annotationClass));
System.out.println("c.isAnnotationPresent("+... |
6355229c-a7a2-4feb-a66d-147285ebf200 | 6 | public PluginImpl getByPath(String[] url , int n){
if(url.length -1 == n){
for(UrlNode childNode: this.childNodes){
if(childNode.selfUrl.equals(url[n])){
return childNode.pluginNode ;
}
}
return null ;
}else{
for(UrlNode node : childNodes){
if(node.selfUrl.equals(url[n])){
PluginIm... |
f2d032f6-da50-479a-9ecf-ee159c9c5c5b | 9 | public ListNode mergeKLists(ArrayList<ListNode> lists) {
if (lists == null || lists.size() == 0)
return null;
if (lists.size() == 1)
return lists.get(0);
int min = 0;
int count = 0;
ListNode head = new ListNode(0);
ListNode curr = new ListNode(0);
while (count != lists.size()) {
count=0;
int i... |
107e7830-8d44-4c3f-815e-f49671671777 | 3 | public boolean canSplit(Player player) {
// if player is null
// if player has != 1 hand
// if player has != 2 cards in that hand
if (player == null || player.numberOfHands() != 1 || player.getActiveHand().getSize() != 2) {
return false;
}
List<Card> cards = ... |
4cecbb3f-1c1d-480c-92eb-7878fc05723a | 8 | public static boolean equivalentEnumerationsP(Collection self, Collection other) {
{ Surrogate testValue000 = Stella_Object.safePrimaryType(self);
if (Surrogate.subtypeOfP(testValue000, Logic.SGT_STELLA_SET)) {
{ Set self000 = ((Set)(self));
{ boolean testValue001 = false;
tes... |
bf547fd2-d6dc-436f-be66-be0b1f178b92 | 6 | public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... |
34f5f4a9-fb14-4421-8018-4dd438be3fc2 | 4 | @Override
public Boolean StopApplianceCycle(String said) {
// TODO Auto-generated method stub
for (ArrayentBackEndCommunication app : _applainces)
{
if(app._applInstance.get_said()== said)
{
if(app._applInstance.get_isApplianceInitialized()&& app._applInstance.get_isCycleStarted())
{
app._app... |
0e6ae398-d3fd-40a4-946f-3d0d82f80048 | 4 | private static synchronized void clean() {
for(Iterator<Entry<?>> i = set.keySet().iterator(); i.hasNext();) {
Entry<?> e = i.next();
if(e.arr.get() == null)
i.remove();
}
} |
6e5f576c-fc00-47f8-babb-d1c6a4a3356e | 3 | @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof Categoria)) {
return false;
}
Categoria categoria = (Categoria) obj;
if (this.id == categoria.getId()) {
return true;
}
return false;
} |
473ec773-7e0c-4932-b1f2-8e5d1e34f6fb | 0 | public debug()
{
// TODO Auto-generated constructor stub
} |
b4a2117e-22b7-4a81-86ff-091056da98d6 | 2 | public static int numOfFactors(int tri){
int factorCount=0;
for(int i=1;i<Math.sqrt(tri);i++){
if(tri % i ==0){
factorCount++;
}
}
return factorCount*2;
} |
ab02db15-5078-47ea-a657-3ede526cdf58 | 6 | private void compileVariablesList() throws ParseException, IOException {
// <data-type>
Type type = compileDataType();
do {
// <variable-name>
if (tokenizer.tokenType() != Tokenizer.IDENTIFIER) {
throw new ParseException("variable name is excepted after type",
tokenizer.l... |
07c330d1-7fc8-4829-a509-597b95e7e6a2 | 7 | protected void init( int defaultIndexSizePower ) {
int headerSize = 32; // "SLF2" + "INDX" + chunkRef + "RECY" + chunkRef + "EHDR"
if( blob.getSize() == 0 ) {
indexOffset = headerSize;
indexMask = indexMask(defaultIndexSizePower);
indexSize = indexSize(defaultIndexSizePower);
reclRefOffset = 20;
... |
d1efee25-ec10-45a3-b490-c66bba6c9dcc | 3 | private void processGridletStatus(Sim_event ev)
{
int gridletId = 0;
int userId = 0;
int status = -1;
try
{
// if a sender using gridletXXX() methods
int data[] = (int[]) ev.get_data();
gridletId = data[0];
userId = data[1];
... |
be676b0b-9acb-4f62-bd4e-b20cd47fcfa5 | 8 | public int atoi(String str) {
long num = 0;
str = str.trim(); // discards the whitespace at beginning and ends
if (str.isEmpty()) return 0; // if str is empty or only contains whitespace
java.util.regex.Pattern pattern = java.util.regex.Pattern.compile("[-+]?\\d+.*");
java.util.regex.Matche... |
1f6c388b-cf91-420f-af38-67684be64c4c | 6 | @Override
protected void writeMessage(OutputStream out) throws IOException {
out.write(0x00);
switch (status) {
case ACCEPTED:
out.write(0x00);
break;
case UNACCEPTABLE_PROTOCOL_VERSION:
out.write(0x01);
break;
case IDENTIFIER_REJECTED:
out.write(0x02);
break;
case SERVER_UNAVAILABLE:
... |
a4116b78-be53-43c7-a304-72ac003b7184 | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Telefone other = (Telefone) obj;
if (this.Id != other.Id) {
return false;
}
i... |
fb8f3ff9-fa52-4dc5-a94a-62ae049f20b9 | 8 | public void tableChanged(TableModelEvent e_u)
{
TableModelEvent e_t;
// _u = underlying table, _t = this table
//System.out.println("ColPermute: " + e_u);
int type = e_u.getType();
int col_u = e_u.getColumn();
switch(type) {
case TableModelEvent.UPDATE :
// if (col_u == TableModelEvent.ALL_COLUMNS) {
// thi... |
c26b06fd-aa97-454d-a64f-1e0a8b991232 | 7 | public void crashRobots() {
//Thread worker = new Thread();
for (int i = 1; i <= 2; i++) {
try{
final PlayerClient robot = new PlayerClient(SERVER_NAME, PORT_NUMBER);
final Position2DInterface pos2d = robot.requestInterfacePosition2D(i, PLAYER_OPEN_MODE);
... |
8b605ca6-1c91-4040-bf5d-253c389e1028 | 5 | public void keoista(int i) {
int vasen = vasen(i);
int oikea = oikea(i);
int pienin;
if (oikea <= keonKoko) {
if (keko[vasen].getPisteet() < keko[oikea].getPisteet()) {
pienin = vasen;
} else {
pienin = oikea;
}
... |
b000ae8f-02dd-4c64-8af7-cd54a775f42b | 9 | public static void detectNoiseInTrainingExamples(List examples) {
{ Module home = ((Module)(Stella.$MODULE$.get()));
int sigLength = 0;
boolean same = true;
{ TrainingExample example = null;
Cons iter000 = examples.theConsList;
for (;!(iter000 == Stella.NIL); iter000 = iter000.re... |
57617be2-a74e-404e-bd33-8c89fff25f4a | 6 | protected void UpdateLineColumn(char c) {
column++;
if (prevCharIsLF) {
prevCharIsLF = false;
line += (column = 1);
} else if (prevCharIsCR) {
prevCharIsCR = false;
if (c == '\n') {
prevCharIsLF = true;
} else
line += (column = 1);
}
switch (c) {
case '\r':
prevCharIsCR = true;
... |
9017cb45-a4b7-428c-a78b-3c87f998c880 | 5 | public boolean hasFlag(int flags, int flag) {
boolean hasFlag = false;
boolean finished = false;
int waarde = 1024;
int newFlag = flags;
while (!finished) {
newFlag -= waarde;
if (waarde < flag) {
finished = true;
} else {
if (newFlag <= 0) {
if (waarde == 1) {
finished = true;
... |
5e12c5ed-e9cf-4413-94b0-8724bab27796 | 8 | public TopMenuBar(final Controller controller,final GUI gui){
this.controller = controller;
this.gui = gui;
//create JMenus
//Tools
JMenu settings = new JMenu("Tools");
settings.setMnemonic(KeyEvent.VK_O);
JMenuItem settingsMenuItem = new JMenuIt... |
3e39cfc9-848e-42b6-9937-0d031b124a8f | 2 | public void unequip() {
if (active) {
String gearType = Defines.gearTypes[vectorToId(selectedX,
selectedY)];
if (inv.getGearSlots().get(gearType).isOccupied()) {
inv.unequip(gearType);
}
}
} |
ab23da91-d7d8-40e3-9105-d0842c6b80a7 | 9 | public void control(){
while(parent.keyPressed){
if(parent.key == PConstants.CODED){
if(parent.keyCode == PConstants.UP){ //up
//speed up
}
if(parent.keyCode == PConstants.DOWN){ //down
//slow down
}
if(parent.keyCode == PConstants.LEFT){ //left
//turn left
}
if(parent.ke... |
81519ead-1090-4c66-b2d0-2994cfbbcaf2 | 1 | private ClassPool getClassPool(Type rootComponent) {
ClassPool pool = rootComponent.clazz.getClassPool();
return pool != null ? pool : ClassPool.getDefault();
} |
c02a334e-5573-4a5a-80c0-eec2b285cc1e | 4 | public void writeFile(File file) {
try {
writeLine(file.toString());
if (file.isDirectory()) {
File list[] = file.listFiles();
if (list != null) {
for (int i = 0; i < list.length; ++i) {
writeFile(list[i]);
}
}
}
} catch (IOException e) {
// NYI: Show message.
e.printStac... |
5f78f405-f5fa-46f8-b8d2-25904be50e1e | 9 | public DownloaderFrame() {
pb = new JProgressBar();
pb.setMinimum(0);
pb.setMaximum(100);
url = new FontTextField();
url.setPreferredSize(new Dimension(280, url.getPreferredSize().height));
url.setToolTipText("URL");
nbConnection = new FontComboBox();
nbConnection.setToolTipText("Nb connection");
for ... |
c20f11ce-926f-4160-8c63-34ce544c694a | 1 | public void testSetDayOfMonth_int2() {
MutableDateTime test = new MutableDateTime(2002, 6, 9, 5, 6, 7, 8);
try {
test.setDayOfMonth(31);
fail();
} catch (IllegalArgumentException ex) {}
assertEquals("2002-06-09T05:06:07.008+01:00", test.toString());
} |
e4b62074-1ea1-4566-80dd-6d392b8aa3f2 | 6 | * @return Stella_Object
*/
public static Stella_Object tryToEvaluate(Stella_Object tree) {
{ Stella_Object otree = tree;
if (tree != null) {
if (Stella_Object.safePrimaryType(tree) == Stella.SGT_STELLA_CONS) {
{ Cons tree000 = ((Cons)(tree));
if (Stella_Object.symbolP(tree... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.