method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
541f6330-3b3b-4d39-8159-311f14fc4a41 | 5 | @Override
public String getColumnName(int column) {
switch(column) {
case ID : return "ID";
case MEDECIN : return "Médecin";
case SPECIALISATION : return "Spécialisation";
case DATE : return "Date";
case HEURE : return "... |
d589154d-6fb4-4e64-9cb6-fe0d7e249650 | 9 | private String cleanFontName(String fontName) {
// crystal report ecoding specific, this will have to made more
// robust when more examples are found.
if (fontName.indexOf('+') >= 0) {
int index = fontName.indexOf('+');
String tmp = fontName.substring(index + 1);
... |
08b2cbff-b888-4c67-9e20-49ac98615411 | 8 | public Object retrieve(String key) {
if(key == null) {
return null;
}
totalAccess++;
if(entryMap.containsKey(key)) {
LFUEntry entry = entryMap.get(key);
pq.remove(entry);
entry.hit++;
pq.add(entry);
if(debug) System.out.println("Hit cache entry: " + key);
return entry.value;
} else... |
76d31ee0-0e92-40ec-839b-ce3432588f87 | 8 | @Override
public void unInvoke()
{
// undo the affects of this spell
if(affected instanceof CagedAnimal)
{
final CagedAnimal target=(CagedAnimal)affected;
final MOB mob=target.unCageMe();
super.unInvoke();
if(canBeUninvoked())
{
final Ability A=mob.fetchEffect(ID());
if(A!=null)
mob.... |
14a34a69-7338-44d3-8f35-f255a764236d | 2 | public static void main(String[] args) {
Factory factory;
if (args.length > 0) {
factory = new PCFactory();
} else {
factory = new NotPCFactory();
}
for (int i = 0; i < 3; ++i) {
System.out.print(factory.makePhrase() + " ");
}
S... |
c194cdc0-c000-49b4-8e28-926f478a9337 | 5 | @Override
public void actionPerformed(ActionEvent e) {
/* When combo box changed, redraw preview panel. */
if (e.getSource()==m_mapList) {
m_previewContainer.removeAll();
m_previewPanel = DrawSwatches(m_mapList.getSelectedIndex());
... |
882dc084-23cd-4819-b555-b44fac892eb8 | 4 | @Override
public List<BankRequiredItem> getItemsNeededFromBank() {
List<BankRequiredItem> list = new ArrayList<BankRequiredItem>();
if (ctx.equipment.select().id(ids).isEmpty() && ctx.backpack.select().id(ids).isEmpty()) {
if (ctx.bank.opened()) {
final Item item = ctx.bank.select().id(ids).sort(new Compar... |
25d477a2-0089-4adf-b494-918698adcdfb | 1 | @Override
public int attack(double agility, double luck) {
if(random.nextInt(100) < luck)
{
System.out.println("I just did a sonic blow!");
return random.nextInt((int) agility) * 2;
}
return 0;
} |
f4e4639e-4aaf-417f-b106-07d8eb6c77c2 | 1 | public static String getStackTrace(Throwable t) {
String stackTrace = null;
try {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
t.printStackTrace(pw);
pw.close();
sw.close();
stackTrace = sw.getBuffer()... |
1c303920-f213-4469-9535-4c07ad55f56f | 8 | private void processGridResource_Polling(Sim_event ev)
{
Integer res_id_Integer;
int res_id;
AvailabilityInfo resAv = null;
// Polls the resources that are available right now, as those
// which are out of order were totally removed
for (int i = 0; i < resList_.size(... |
a13f0d9b-cc2c-41b6-b190-43ec874ee100 | 6 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
String fct = request.getParameter("fct");
// Remplir BDD
if(fct.compareTo("create")==0) {
UserModel user = DataStore.getUser("user001");
if(user==null) {
// Users
UserModel usermod001 ... |
abc3e35b-ebd3-4bd6-beaa-fb8cabc4af62 | 1 | public void clean(){
try{
socket.close();
}catch(Exception e){
}
} |
2f28a81a-57fe-47f6-9b86-c973955db4a4 | 4 | private void connect() {
send(0, Main.player.getName());
String data = recive().trim();
String[] text = data.split("/");
if (!(text.length < 2)) {
if (text[1].equalsIgnoreCase("success")) {
System.out.println("Connected to Server");
connected =... |
0c02af1b-6b5d-446e-9df6-0220c3d3961b | 7 | * @param offset
* @param kindofsym
* @return GeneralizedSymbol
*/
public static GeneralizedSymbol internBootstrapSymbolAt(String name, int offset, int kindofsym) {
{ ExtensibleSymbolArray symbolarray = null;
GeneralizedSymbol symbol = null;
switch (kindofsym) {
case 0:
sym... |
b9f7f3e1-1710-4414-a104-5363469a9a0c | 9 | public void load() throws IOException {
boolean before = SoundStore.get().isDeferredLoading();
SoundStore.get().setDeferredLoading(false);
if (in != null) {
switch (type) {
case OGG:
target = SoundStore.get().getOgg(in);
break;
case WAV:
target = SoundStore.get().getWAV(in);
break;
cas... |
b9250b98-7a9d-436b-bffd-9ce83c5ab3a8 | 7 | public boolean pointVisibleTest(Point p){
boolean ret=false;
if(
angleBetween(this.forward,p.difference(this.location))<this.maxangl &&
distanceToPoint(p)>mindistance &&
distanceToPoint(p)<maxdistance)
{
double[] transform=this... |
d985d9a2-943f-42de-8bfb-75a87a68a10a | 0 | public List findByEmail(Object email) {
return findByProperty(EMAIL, email);
} |
089a64e1-65b4-4fae-9473-54364468bd17 | 3 | public void sortByCost() {
Collections.sort(
images,
new Comparator<Card>() {
public int compare(Card a, Card b) {
if (a instanceof Climax) { //climaxes should sort to be after all level cards
if (b instanceof Climax) {
return 0;
}
return 1... |
a00a94e0-46dc-404b-be0c-a121e2c09553 | 5 | public void Solve() {
HashMap<String, HashSet<Integer>> results = Compute(new ArrayList<Integer>(), _maxDigits);
String result = "";
int max = 0;
for (Map.Entry<String, HashSet<Integer>> entry : results.entrySet()) {
int number = 1;
while (entry.getValue().contai... |
b33d5b3c-7a18-488c-952f-67caa612eb64 | 8 | private static void addToMap(File file, HashMap<String, Holder> map) throws Exception
{
System.out.println(file.getAbsolutePath());
boolean human = file.getName().indexOf("Human") != -1;
String[] splits = file.getName().split("_");
String fileName = splits[1] + "_" + splits[2];
Holder h = map.get(fileN... |
67930520-a887-41d3-a8da-b8a8ce15f1a0 | 8 | private void showSong(Song song) {
lblSongTitle.setText(song.getTitle());
if (!song.getArtists().isEmpty()) {
String artists = "by ";
for (int i = 0; i < song.getArtists().size(); i++) {
if (i < song.getArtists().size() - 2) {
artists += song.getArtists().get(i) + ", ";
} else if (i < song.getAr... |
29834319-1257-4d7b-ab05-70448eec254b | 0 | public void print() {
int y = 10; // local variable declaration
System.out.println(x+""+y);
} |
e480b138-8a80-4326-99d0-03eb7e795527 | 3 | public static List<String> getFolder(File dict) {
List<String> files = new ArrayList<String>();
if (dict.listFiles().length > 0)
for (File file : dict.listFiles()) {
if (file.isDirectory()) {
files.add(file.getName());
}
}
return files;
} |
f587267a-5f24-4d71-ab74-73e6f0e5e8d6 | 1 | private void getCityCollection(AbstractDao dao, List<Direction> directions) throws DaoException {
for (Direction dir : directions) {
Criteria crit = new Criteria();
crit.addParam(DAO_ID_DIRECTION, dir.getIdDirection());
List<LinkDirectionCity> links = dao.findLinkDirectionCit... |
40541ab3-ab84-4bf8-b8eb-2fc3d9b26483 | 0 | public FactoryOfCapturingsForCpuForPiece(Position position, Player cpu, int largestCapture){
super(position,cpu,largestCapture);
} |
4c3e0b6d-2e67-479c-9932-f003d4f12fd2 | 4 | private static double getMedianPixel(Image image, ChannelType color, int x,
int y, int maskWidth, int maskHeight) {
List<Double> pixelsAffected = new ArrayList<Double>();
for (int i = -maskWidth / 2; i <= maskWidth / 2; i++) {
for (int j = -maskHeight / 2; j <= maskHeight / 2; j++) {
if (image.validPixel(... |
8bda3244-f2e2-46a8-b234-b1690b52bc5b | 1 | public final String getSHA(String s)
{
try
{
MessageDigest md5 = MessageDigest.getInstance("SHA");
md5.update(s.getBytes(), 0, s.length());
signature = new BigInteger(1, md5.digest()).toString(16);
}
catch(NoSuchAlgorithmException e)
{
... |
f31e76d9-764a-45e5-be1a-1bddbfb90a03 | 2 | private void createButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createButtonActionPerformed
String first = firstNameTextField.getText();
String last = lastNameTextField.getText();
String maristID = maristUsernameTextField.getText();
String pw1 = UserModel.enco... |
5305e9cd-aa04-4367-8e66-21b9ab4c22ce | 3 | public String searchForCost(ArrayList<String[]> actualNode, String IPComing){
String returnValue = "0";
String[] tempStringArray = null;
for(int i=0; i<actualNode.size(); i++){
tempStringArray = actualNode.get(i);
if(tempStringArray[0].equals(IPComing) && tempStringArray[... |
669e86c8-cdea-4f39-b9fa-b0eeaa635b82 | 7 | public void undo()
{
if (DEBUG) log("Attempting to undo TaskRemoval");
if (taskViewsToUpdate != null)
{
if (DEBUG) log("Get existing tasks from TaskCommander");
ArrayList<Task> tasks = TaskCommander.getTasks();
if (DEBUG) log("Add the task contained in this command to the existing tasks ... |
0b6093d8-f28c-40bd-a6df-02ca8e45e21e | 3 | public boolean testCollisions( Tester t ) {
LinkedList<Explosion> explosionList1 = new LinkedList( );
LinkedList<Explosion> explosionList2 = new LinkedList( );
LinkedList<Enemies> scaryList1 = new LinkedList( );
LinkedList<Enemies> scaryList2 = new LinkedList( );
LinkedList<Enemies> scaryList3 = new LinkedLi... |
ab0f2530-aa3c-4a91-ba01-6b2cf603980e | 4 | private static void validatePassport(String passport) throws TechnicalException {
if (passport == null || passport.isEmpty() || passport.length() > PASSPORT_SIZE) {
throw new TechnicalException(PASSPORT_ERROR_MSG);
}
String regex = "[A-Z]{2}\\d{7}";
Pattern p = Pattern.compil... |
031204f3-5c0a-4f60-8570-7b12f5f42e9b | 2 | private static boolean haveItem(String string) {
for(ItemLabel item : stack){
if(item.item.name.equals(string)) return true;
}
return false;
} |
1789d127-9c98-47f1-9573-826773985dd4 | 6 | public String[] getBorderColors()
{
try
{
String[] clrs = new String[5];
if( borderElements.get( "top" ) != null )
{
clrs[0] = borderElements.get( "top" ).getBorderColor();
}
if( borderElements.get( "left" ) != null )
{
clrs[1] = borderElements.get( "left" ).getBorderColor();
}
if( ... |
021c629e-dbbc-43c1-a740-8ae1544de78d | 1 | public void visitIincInsn(final int var, final int increment) {
buf.setLength(0);
buf.append(tab2)
.append("IINC ")
.append(var)
.append(' ')
.append(increment)
.append('\n');
text.add(buf.toString());
if (m... |
268d8661-6e1b-4c79-8e48-3ff0669ebc81 | 4 | private void pelaajanAmmustenOsumatunnistusKokonaisuus(Iterator it, Kuti kuti, int kutiX, int kutiY) {
while (it.hasNext()) {
ufo = (Ufo) it.next();
int ufox = ufo.getX();
int ufoy = ufo.getY();
if (ufo.isVisible() && kuti.isVisible()) {
if (ufonO... |
61d5d69b-612e-4553-8914-e260dd819bab | 2 | private RequestData getRequestData(HttpServletRequest request){
RequestData rd = new RequestData();
rd.page = request.getParameter("page");
if (request.getParameter("id") == null){
rd.id = Long.valueOf(0);
}
else{
try{
rd.id = Long... |
92c37c39-398b-49b7-a3c5-6db6790ee1e6 | 5 | public void initialize() throws ResourceInitializationException {
// extract configuration parameter settings
String oPath = (String) getUimaContext().getConfigParameterValue("outputFile");
// Output file should be specified in the descriptor
if (oPath == null) {
throw new ResourceInitialization... |
0c9210db-235b-474d-b3cf-d9df9f5e0f1b | 7 | public void promptMove(GoEngine g){
int bestValue=Integer.MIN_VALUE;
List<Coord> bestMoves = new ArrayList<Coord>();
Board testBoard = new Board();
int alpha=Integer.MIN_VALUE;
int beta=Integer.MAX_VALUE;
for(int r=0;r<9;r++){
for(int c=0;c<9;c++){
g.board.calculateTerritory();
if(g.board.checkVa... |
2bb1bfa6-946d-4890-8d57-e229a2650937 | 6 | private void drawWest(Terrain[][] currentBoard,
Entities[][] currentObjects, Graphics g) {
//This is the opposite of east, so easy to figure out when you figure out east :)
Location playerDir = boardState.getPlayerCoords();
for (int i = 0; i < currentBoard.length; i++) {
for (int j = 0; j < currentBoard[0].... |
a095aa26-3f77-49c9-9940-a0a5d7d6d913 | 4 | public void move(){
// Is this enemy one of the inital 3
switch(priority){
case 1:
case 2:
case 3:{
initialEnemyMove();
break;
}
case 4:{
attackingMove();
break;
}
... |
27db49bd-4a16-42b3-a751-991be9a23142 | 5 | public static void unJar(File jarFile, File toDir) throws IOException {
JarFile jar = new JarFile(jarFile);
try {
Enumeration entries = jar.entries();
while (entries.hasMoreElements()) {
JarEntry entry = (JarEntry) entries.nextElement();
if (!entry... |
a28ed1f8-d9ef-4744-a783-c8956344162c | 4 | public boolean isCorrectPassword(Account a) {
Account tempAccount = null;
for (int i = 0; i < al.accountList.length; i++) {
if (al.accountList[i].getiban().equals(a.getiban())
&& al.accountList[i].getOwner().equals(a.getOwner())) {
tempAccount = al.accountList[... |
9eb0fea5-944b-408c-a9e3-33ae831ff6ee | 2 | public Tile(byte[] buf) {
t = (char) Utils.ub(buf[0]);
id = Utils.ub(buf[1]);
w = Utils.uint16d(buf, 2);
try {
img = ImageIO.read(new ByteArrayInputStream(buf, 4,
buf.length - 4));
} catch (IOException e) {
throw (new LoadException(e, Resource.this));
}
if (img == null)
throw (new... |
8a748c54-3c1d-4bb5-99ff-0cf3e4667915 | 4 | public void sendAddUser() throws IOException{
String str = new String("adduser"+ "," + hostFld.getText()+ ","+ jobFld.getText() + "," + pwdFld.getText());
System.out.println(str);
InetAddress serverAddr= null;
try {
serverAddr= InetAddress.getByName(GlobalV.serverIP);
} catch (UnknownHostExcep... |
6536b138-2ef8-452e-8739-b9a02e9d4402 | 5 | public int clearRows() {
// piece has NOT been placed
// if committed is already false, then we've
// backed up already. WE only need to clear rows.
if (committed) {
saveBackup();
committed = false;
}
int rowsCleared = 0;
// make array of rows that are filled, falsify such rows
boolean[]... |
5df41e77-5ae9-4725-b1cb-44bf5f8c1ad6 | 6 | public static Boolean isSlotMachinePart(Block b) {
Set<String> keys = null;
try {
keys = Global.config().getConfigurationSection("machines").getKeys(false);
} catch(Exception e) { return false; }
for(String k : keys) {
SlotMachine s = new SlotMachine(k);
if(s.getFirstItemFrame().equals(b.getLocation())... |
eaf1d13d-983c-475e-bca0-6819691f3a63 | 1 | @Override
public void loadMemory(Data[] programCode) {
for (Data line : programCode) {
MEMORY[pointer] = line; //Load pointer location with line of program code
pointer++;
}
fireUpdate(display());
} |
3a67a785-fd92-4848-aeb3-af0ff5b06c17 | 1 | public boolean isCheckedIcon(String name) {
Component comp = fetchComponent(null, name);
if (comp instanceof JRadioButton) {
JRadioButton radioButt = (JRadioButton) comp;
return radioButt.isSelected();
}
return false;
} |
d56042e9-e871-4bbd-995f-e24a1ddf00f4 | 3 | public void onAction(String sender, String login, String hostname, String target, String action) {
if (target.equalsIgnoreCase(DarkIRC.currentChan.name)) {
GUIMain.add_line("*" + sender + " " + action);
} else {
for (int i = 0; i < DarkIRC.... |
00b6322a-fc14-496b-9f5c-48142556e1ae | 0 | public Color getColor() {
return color;
} |
da0c7237-7722-4934-a8bc-0fea8cbc68e1 | 9 | protected void launch(AppDesc appDesc) throws LaunchException {
//create new appcontext if required
if(appDesc.useNewAppContext()) {
try {
Class cls = Class.forName("sun.awt.SunToolkit");
//Method m = cls.getMethod("createNewAppContext", new Class[]{});
//... |
7a046ad9-9c1a-4ef1-90b6-87120bdeb3b2 | 4 | @Override
public void mouseDragged(MouseEvent e) {
Point dragged = e.getLocationOnScreen();
int dragX = getDragDistance(dragged.x, pressed.x, snapSize.width);
int dragY = getDragDistance(dragged.y, pressed.y, snapSize.height);
int locationX = location.x + dragX;
int location... |
055ea1ea-ecc7-49ae-9257-a80bec180fef | 0 | @Override
public void selectionChanged(TreeSelectionEvent e) {
calculateEnabledState(e.getTree());
} |
b0863187-9499-49d1-869d-562a579a3c58 | 6 | public static NumberWrapper minusComputation(NumberWrapper x, NumberWrapper y) {
{ double floatresult = Stella.NULL_FLOAT;
{ Surrogate testValue000 = Stella_Object.safePrimaryType(x);
if (Surrogate.subtypeOfIntegerP(testValue000)) {
{ IntegerWrapper x000 = ((IntegerWrapper)(x));
... |
dd64664e-a1b6-4f30-bab9-a9efffe4ab1b | 8 | public static boolean writeUserSelectedFile() {
if (fileDialog == null)
fileDialog = new JFileChooser();
fileDialog.setDialogTitle("Select File for Output");
File selectedFile;
while (true) {
int option = fileDialog.showSaveDialog(null);
if (option != JFileChooser.APPR... |
5796c6cf-0cfd-44b4-910f-948a7b3322c3 | 0 | @Override
public Object getPropertyDefault(String key) {
return default_values.get(key);
} |
c01b2794-f52c-4862-be30-3b9635ac94a6 | 4 | public PDFFontEncoding(String fontType, PDFObject encoding)
throws IOException {
if (encoding.getType() == PDFObject.NAME) {
// if the encoding is a String, it is the name of an encoding
// or the name of a CMap, depending on the type of the font
if (fontType.equa... |
ae1bfdc6-3f1d-4f9d-8bc4-fd81575ab6fb | 0 | public void setR(float r) {
this.r = r;
} |
3b45fb39-ac36-452a-b380-317d64e54b3e | 3 | public ArrayList returnTree()
{
if(isEmpty())
return null;
ArrayList<Node<Word>> list1 = levelOrderTraversal(root);
ArrayList<Word> list2 = new ArrayList<Word>();
for(int i=0;i < list1.size();i++)
{
if(list1.get(i) != null)
{
list2.add(list1.get(i).data());
}
else
{
list2.add(nu... |
3fb026da-3341-4d93-b178-3dc0485798cd | 6 | void resetColorsAndFonts () {
super.resetColorsAndFonts ();
Color oldColor = itemForegroundColor;
itemForegroundColor = null;
setItemForeground ();
if (oldColor != null) oldColor.dispose();
oldColor = itemBackgroundColor;
itemBackgroundColor = null;
setItemBackground ();
if (oldColor != null) oldColor... |
8bbb8fa4-b83d-481a-a484-f66e21c611ef | 9 | public static void main(String[] args) throws Throwable{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb=new StringBuilder();
for(StringTokenizer st;(st=new StringTokenizer(in.readLine()))!=null;){
M=parseInt(st.nextToken());L=parseInt(st.nextToken());
if(M==0&&L==0)... |
bd1121e5-a598-4840-971b-fc74c7bec23d | 0 | public OutputStream getOutputStream() {
return os;
} |
1d89fd1c-fd5d-4c47-93f5-8f36de7c738e | 0 | public Distance add(Distance second) {
double sum = number + second.number;
return new Distance(sum, unit);
} |
7a4e5269-7342-4725-89bf-634ae2042a92 | 7 | public static int discrete(double[] a) {
double EPSILON = 1E-14;
double sum = 0.0;
for (int i = 0; i < a.length; i++) {
if (a[i] < 0.0) throw new IllegalArgumentException("array entry " + i + " is negative: " + a[i]);
sum = sum + a[i];
}
if (sum > 1.0 + EP... |
1437a54e-e81d-4c68-b7a2-1c18992f60a6 | 3 | public Component getListCellRendererComponent(JList list,
Object value, int index, boolean isSelected, boolean cellHasFocus)
{
setText(value.toString());
setBackground(isSelected ? list.getSelectionBackground() : list.getBackground());
setForeground(isSelected ? list.getSelectionForeground() : l... |
9387690f-f703-4782-b892-f92aa9651e2a | 5 | public void checkCredentials (String userName, String passWord) {
HttpConnector request = new HttpConnector();
try {
stream = request.authenticate(userName, passWord);
try {
JSONObject json = new JSONObject(stream.toStri... |
8ed7fbb0-dd37-4c77-a1e1-8d2b176325bf | 2 | @Override
public void run() {
if (validArgs) {
zip();
}
else {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} |
81cc8872-fa0c-4912-9b8c-5bd9b4353c18 | 4 | public Map<?, ?> getMap() throws IOException {
return (Map<?, ?>)getValue();
} |
64fc5f91-5d99-4382-9afa-c54dff31d072 | 5 | public static void main(String[] args) {
// args[0] = Number of times to complete - default 10
try {
n = Integer.parseInt(args[0]);
} catch (Exception e) {
n = 10;
}
// Set up fractal
FractalColourScheme scheme = FractalColourScheme.DEFAUL... |
aad49abd-bdcd-43b7-bbf7-4d1c81de8032 | 1 | public void run() {
for (int i = 1; i <= ConcurrentHashMapDemo.NUMBER; i++) {
map.get(key);
}
synchronized (lock) {
counter--;
}
} |
d171fc6d-3d07-479b-8bb6-da73b77cf689 | 2 | public boolean isElement()
{
if(miniCompounds.length == 1 && miniCompounds[0].isElement())
return true;
return false;
} |
2da150bd-050c-4b0e-947f-c1fbf85544f7 | 0 | @Test
public void testDeleteByKey() {
fail("Not yet implemented");
} |
f1db56d6-3f1f-455a-808c-46b53b921c22 | 2 | public void receive()
{
try
{
MulticastSocket socket = new MulticastSocket(DPORT);
socket.joinGroup(InetAddress.getByName(ADDRESS));
byte[] buf = new byte[SIZE];
DatagramPacket packet = new DatagramPacket(buf, buf.length);
socket.receive(packet);
Object o = toObject(pack... |
089ecda6-5533-4bc2-a504-9c66cbd550d9 | 7 | private boolean checkParameters(int high, int width, int minesNumber) {
if (high < 9 || high > 24) return false;
if (width < 9 || width > 30) return false;
if (minesNumber < 10 || minesNumber >= high * width || minesNumber > 668)
return false;
return true;
} |
746f1f95-1d99-4aa4-80b2-1cbb6a609013 | 1 | public int getNumberOfTeamPlayers(String teamName, String matchName){
try {
cs = con.prepareCall("{ call GET_TEAM_PLAYERCOUNT(?,?,?) }");
cs.setString(1, teamName);
cs.setString(2, matchName);
cs.registerOutParameter(3, Types.INTEGER);
cs.executeQuery();
//System.out.println("number of players in te... |
212928c6-8597-441e-a75d-420ed4fba5ab | 3 | public static boolean isNullOrEmpty(final String s){
boolean isEmpty = false;
if(s == null){
isEmpty = true;
}
if(!isEmpty){
if(s.toCharArray().length == 0){
isEmpty = true;
}
}
return isEmpty;
} |
8a864419-6816-4dc1-8abf-0c79d130b724 | 3 | public void shotFired(){
try {
file = new FileInputStream("sound/cannonshot.wav");
} catch (FileNotFoundException ex) {
System.out.println("file not found apparently");
Logger.getLogger(Sounds.class.getName()).log(Level.SEVERE, null, ex);
}
... |
1bb8c73e-bafa-4562-b50e-4d096282df1a | 9 | @Override
public void actionPerformed(ActionEvent emain) {
Object links = emain.getSource();
if(links==quitapp){
quitApp();
}
else if(links==newmember)
{
boolean b=openChildWIndow("Add New Record");
if(b==false){
... |
bba1e441-cd3b-4ee2-bc08-4c9c99858bba | 9 | public void close() {
for(Map.Entry<ObjectName, Set<ObjectNameAwareListener>> entry: registeredNotificationListeners.entrySet()) {
for(ObjectNameAwareListener listener: entry.getValue()) {
try {
removeNotificationListener(listener.getObjectName(), listener);
} catch (Exception e) {}
}
entry.getV... |
df3bc92a-ee7f-4c76-85e1-1390c46c5ae7 | 9 | public static HTTPResponse doHTTPRequest(HTTPRequest request) throws Exception{
HTTPResponse response = new HTTPResponse();
try{
HttpURLConnection conn;
URL url = new URL(request.getURL());
// Open connection
if (url.getProtocol().equalsIgnoreCase("https")){
conn = (HttpsURLConnection)url.op... |
2b7db79b-4d43-4c90-9b81-2c260b7cc2c6 | 2 | private void debugMode(String s, boolean ln) {
if (debug) {
if (ln) {
System.out.println(s);
} else {
System.out.print(s);
}
}
} |
430aaa40-6b6c-4347-9b90-5c53652bf0e4 | 4 | public void measure(long time) {
updateMessages();
if (list.size() > 0) {
double defdist = 1.0 / list.size();
Message prevMessage = null;
for (Message message : list) {
message.defDist = defdist;
message.prevM = prevMessage;
... |
ccf84111-580e-40dd-befb-126b33b0f0de | 4 | public void act(){
if (clicked){
if (counter >= 10){
counter = 0;
clicked = false;
}
else{
counter++;
hoverCounter = 0;
this.setImage (bg[2]);
}
}
else if (selected){
... |
8e866cd4-e67e-46ba-8bf0-13ae0c255c91 | 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... |
c63f7513-2423-4455-90d6-a448ffc3adcc | 3 | public Selector duplicate(Object selectionObject,
Class<?> selectionClass) throws SQLException
{
try
{
Constructor<? extends Selector> constr = getClass().getConstructor(Object.class,Class.class,boolean.class);
return constr.newInstance(selectionObject,selectionClass,this.isStrictInheritance());
}
... |
80a98985-7b73-4802-aa02-04667bd4099a | 9 | private boolean check() {
if (!isBST()) StdOut.println("Not in symmetric order");
if (!isSizeConsistent()) StdOut.println("Subtree counts not consistent");
if (!isRankConsistent()) StdOut.println("Ranks not consistent");
if (!is23()) StdOut.println("Not a 2-3 tree");
if (!isBalanced()) ... |
675c0aa3-6d48-4386-9093-4cd889542fea | 0 | public VertexSet copy(){
VertexSet tmp = new VertexSet();
tmp.addVertexSet(this);
return tmp;
} |
633179e5-e42a-4161-8860-ae85d22dc48e | 1 | public boolean collide(Actor player) {
if(loc.contains(player.getBox().getCenterX(), player.getBox().getCenterY())) {
return true;
}
return false;
} |
6acd3a55-e16f-487d-8bcf-eee0056f5853 | 8 | public void gridletPause(int gridletId, int userId, boolean ack)
{
boolean status = false;
// Find in EXEC List first
int found = gridletInExecList_.indexOf(gridletId, userId);
if (found >= 0)
{
// updates all the Gridlets first before pausing
updateG... |
3fa4d955-92dd-48d0-82e6-6c1f015aed3d | 0 | protected void catchException(Object object, Exception exception) {
fireServerExceptionEvent(new ExceptionEvent(object, exception));
} |
b50d74a7-41f8-412a-bd36-5c772390f33b | 3 | public void add(String letter) {
boolean found = false;
Probability proTemp = null;
for (Probability pro : probs) {
if (pro.afterLetter == letter) {
found = true;
proTemp = pro;
}
}
if (found) {
proTemp.incProb();
} else {
probs.add(new Probability(letter));
}
} |
40d3be1d-f3ba-4e10-8b8b-e4e6bcc61bcc | 1 | public void testFactory_standardHoursIn_RPeriod() {
assertEquals(0, Hours.standardHoursIn((ReadablePeriod) null).getHours());
assertEquals(0, Hours.standardHoursIn(Period.ZERO).getHours());
assertEquals(1, Hours.standardHoursIn(new Period(0, 0, 0, 0, 1, 0, 0, 0)).getHours());
assertEqual... |
785baa55-f08f-4a4e-afd5-d0286333c449 | 4 | public TextureRegion getRegion(int i, int j)
{
if(i < 0 || j < 0 || i >= regions.length || j >= regions.length)
throw new ArrayIndexOutOfBoundsException();
return regions[i][j];
} |
7289ab60-d74a-4d0b-9f4d-ad55d0b530c8 | 8 | public List<Tuple<Integer,Integer>> aStar ( Tuple<Integer,Integer> start, Tuple<Integer,Integer> goal) {
this.callsToAStar++;
log.debug("A* is looking for a path from " + start + " to " + goal);
// Set closedSet = empty set
HashSet<Tuple<Integer,Integer>> closedSet = new HashSet<Tuple<Integer,Integer>>();
//... |
21b8a538-f71c-4dd1-9d24-f1fa2ba47d98 | 6 | public synchronized void playbackLastMacro() {
if (currentMacro!=null) {
Action[] actions = getActions();
int numActions = actions.length;
List macroRecords = currentMacro.getMacroRecords();
int num = macroRecords.size();
if (num>0) {
undoManager.beginInternalAtomicEdit();
try {
for (int i... |
33f390e9-f59d-424f-b0ec-a1e2701bce38 | 5 | @Override
public void onWake() {
System.out.println("\n" + agent.getLocalName() + " is done waiting for offers, "
+ "picking best offer for " + item.getName());
Map<AID, Integer> offers = agent.pullOffers(item);
if (offers.size() == 0){
System.out.println("We've r... |
26d3fa1f-4cbb-4943-82f8-6f36f77063ba | 1 | protected void readScaleFactorSelection()
{
for (int i = 0; i < num_subbands; ++i)
((SubbandLayer2)subbands[i]).read_scalefactor_selection(stream, crc);
} |
b49e396f-fec7-4404-a61d-3765f2ea324e | 4 | public void hit(int damage) {
if (dead || flinching) return;
health -= damage;
sfx.get("enemyhit").play();
if (health < 0) health = 0;
if (health == 0) {
LevelCompletedState.eDead++;
LevelCompletedState.score++;
dead = true;
}
flinching = true;
flinchTimer = System.nanoTime();
} |
efbdd76d-3def-4c9d-834d-23dc807b6808 | 7 | public void removeValue(Comparable rowKey, Comparable columnKey) {
setValue(null, rowKey, columnKey);
// 1. check whether the row is now empty.
boolean allNull = true;
int rowIndex = getRowIndex(rowKey);
DefaultKeyedValues row = (DefaultKeyedValues) this.rows.get(rowInde... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.