method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
58562d46-0ca9-43c0-8d2b-7127649d1fee | 4 | @Override
public StatusType getInput(Object object) {
StatusType status = StatusType.PLAYING;
do {
try {
this.display(); //displays the display method from this class
//get the input command entered by user
String input = this.getCommand()... |
18fdc050-a0fe-4d23-b53d-c2ef7b04a57e | 4 | @Override
public void render() {
if (!enabled && grayOnDisable) Color.gray.bind();
super.render();
glEnable(GL_BLEND);
int fac = 8;
TextureImpl.bindNone();
color.bind();
RenderAssistant.drawRect(x + fac, y + fac, width - fac * 2, height - fac * 2);
glColor4f(1, 1, 1, 0.5f);
RenderAssistant.bind... |
e8ada115-03ab-49cc-b9be-31701b98f7f0 | 6 | private void moisture(double[][] array, boolean[][] water, int x, int y) {
if (water[x][y]) {
calc[x][y] = 6.0;
for (int k = 1; k < 4; k++) {
ArrayList<Object[]> a = getNearbyRegions(array, x, y, k);
for (Object[] r : a)
if (r != null && !(array[x][y] > 0.5)) {
double m = calc[x][y] * (1.0 / ... |
9c478fcc-c387-4c37-9168-89d9343b471b | 7 | private void cargarProgramaDesdeFichero(){
// Si estamos en medio de una ejecución paso a paso, finalizarla
if (ejecucionSBS)
accionParar(true);
// Comprobamos los cambios en el fichero actual antes de cargar uno nuevo
comprobarCambios("Antes de cargar otro programa...",
"¿Desea guardar los cambio... |
76585e64-e0d3-430f-8726-d63ab0534f22 | 0 | public Clinic(){
session[0] = new GregorianCalendar();
session[1] = new GregorianCalendar();
session[2] = new GregorianCalendar();
session[3] = new GregorianCalendar();
nonPeakHr[0] = new GregorianCalendar();
nonPeakHr[1] = new GregorianCalendar();
nonPeakHr[2] = new GregorianCalendar();
nonPeakHr[3] = ... |
3926e7f8-ff89-422e-8010-c9b4824df327 | 5 | @Override
public User findUserByUserIdAndGroupId(int userId, int groupId) {
User user = null;
Connection cn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
cn = ConnectionHelper.getConnection();
ps = cn.prepareStatement(QTPL_SELECT_BY... |
d1ece979-5c21-420f-b0fe-8dbaa8e3b325 | 9 | public void create(PypAdmAgend pypAdmAgend) {
if (pypAdmAgend.getPypAdmAsistConList() == null) {
pypAdmAgend.setPypAdmAsistConList(new ArrayList<PypAdmAsistCon>());
}
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
... |
2976d151-bed5-4c32-ba2d-19a36dde9ac3 | 9 | public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
if (args.length == 0) {
if (player == null) {
sender.sendMessage("This command can only be run by a... |
fedd0e60-cd79-4c6c-b0f0-de7d080d4252 | 2 | public boolean hasBlank(Object... values) {
int length = ArrayUtil.getLength(values, true);
do {
if (isBlank(values[--length])) {
return true;
}
} while (length > 0);
return false;
} |
b8166551-ecec-463d-b3fe-9ffd77d0b7f3 | 7 | public boolean promptPermissionsGood() {
if(badMods.getSize() > 0 || unknownMods.getSize() > 0) {
StringBuilder bldr = new StringBuilder();
if(badMods.getSize() > 0) {
bldr.append(badMods.getSize());
if(badMods.getSize() == 1) {
bldr.append(" mod has missing permission\n");
} else {
bldr.a... |
b597a571-6941-4923-99bf-b7e367a110ab | 2 | public void delete(String table, int id) throws Throwable {
try {
if(!table.equals("")) {
Statement st = con.createStatement();
String query = "DELETE FROM "+table+" WHERE id='"+id+"'";
// System.out.println(query);
st.executeUpdate(query);
st.close();
}
} ... |
5b32e49b-8c5b-4b6e-b0e7-3d89681a7a4c | 6 | private static int doRecurringEvents( int firedEvents, long startTime )
{
// fire all of the recurring events
for ( Event e : recurringEvents )
{
if ( TimeHelper.isOver( startTime, MaxTickTime ) )
{
return firedEvents; // we've run out of time for thi... |
8d09f7df-13ab-4b29-8c92-a1cd7e19e4dc | 1 | public boolean isSuperOrThis() {
ClassInfo clazz = getClassInfo();
if (clazz != null) {
return clazz.superClassOf(methodAnalyzer.getClazz());
}
return false;
} |
793a480d-b649-4efe-a5ba-f734ff470abe | 7 | public void removeObject(SimObject object) {
if (object instanceof Gate) {
boolean hasGate = false;
for (SimObject obj : this.allObjects) {
if (obj instanceof Gate && obj != object) hasGate = true;
}
this.myComponent.setGateCreated(hasGate);
this.myComponent.updateLevelButton();
}
else if (obje... |
4f0d580b-1c68-41b2-8bd1-35da1a7b4280 | 4 | private void afficherPageErreur(String erreur)
{
File fichierErreur;
switch (erreur)
{
case "ERREURREQUETE"://400
fichierErreur = new File("FichierServeur/400_Serveur_web.html");
break;
case "INTERDIT"://403
... |
5a91f0c4-e7e8-4381-9e20-3c163418b247 | 7 | public static void main(String[] args) {
int pnum, budget, hotels, weeks, pcost = 0;
Scanner inputScanner = new Scanner(System.in);
while (inputScanner.hasNext()) {
pnum = inputScanner.nextInt();
budget = inputScanner.nextInt();
hotels = inputScanner.nextInt();
weeks = inputScanner.nextInt();
int m... |
4c1bea14-688e-4c52-8535-9c214c427953 | 7 | public void toArgb(int[] dest, short r, short g, short b, int div) {
assert dest.length >= w * h;
for (int i = w * h - 1; i >= 0; --i) {
short sr = (short) (this.r[i] * r / div);
short sg = (short) (this.g[i] * g / div);
short sb = (short) (this.b[i] * b / div);
if( sr < 0 || sr > 255 ) sr = 255;
... |
5ee6b6c1-6606-4b07-ae10-978ab8b04b67 | 7 | synchronized public void computeNewToDosAndEnd(BlockTuple newBlocks,Block splitted,Block notSplitted){
//Füge zuerst in HashSet ein und vereinige died mit toDoList
//sonst iterator überschreiben
HashSet<BlockTuple> toAdd = new HashSet<BlockTuple>();
HashSet<BlockTuple> toDel = new HashSet<BlockTuple>();
Bloc... |
03ba2af2-26ee-4b3c-a0ec-5614dd982878 | 6 | public String nextToken() throws Exception
{
if( sToken.hasMoreTokens())
return sToken.nextToken().trim();
while(true)
{
String nextLine = reader.readLine();
//System.out.println(nextLine);
while( nextLine != null && nextLine.startsWith("#"))
nextLine = reader.readLine();
if( nextLi... |
c078f49e-24ce-421f-be51-ce0455b60f53 | 9 | public void keyPressed (KeyEvent e) {
int keyCode = e.getKeyCode ();
if (model.running) {
switch (keyCode) {
case KeyEvent.VK_UP:
model.changeDirection (SnakeModel.UP);
break;
case KeyEvent.VK_DOWN:
... |
b1d1b8df-90b9-4596-9ae3-1b78107cb4dc | 1 | public static S3Object[] listAllObjects(RestS3Service s3, String bucketName) {
S3Object[] s3Re = null;
try {
s3Re = s3.listObjects(bucketName);
} catch (S3ServiceException e) {
e.printStackTrace();
}
return s3Re;
} |
3dd4b669-5012-4b07-b092-a09c55ea59d4 | 9 | void readEnclosingMethodAttr(Symbol sym) {
// sym is a nested class with an "Enclosing Method" attribute
// remove sym from it's current owners scope and place it in
// the scope specified by the attribute
sym.owner.members().remove(sym);
ClassSymbol self = (ClassSymbol)sym;
... |
91e5d2e6-4204-4524-96be-23524b9bc1dd | 2 | public String mapToXml(Map<Object, Object> map, Element element) {
for (Map.Entry<Object, Object> entry : map.entrySet()) {
System.out.println(entry.getKey());
if (entry.getValue() instanceof Map) {
Element e = element.addElement(entry.getKey().toString());
mapToXml((Map<Object, Object>) entry.getValue... |
88589afa-185e-49d2-802e-b819d12b08b9 | 3 | @Override
public void decode(final ByteBuffer buf, final int available, final StringBuilder log) throws Exception
{
final int len = buf.get() & 0x7F;
if (len > available-1)
throw new Exception("String length of " + len + " exceeds remaining data (" + (available-1) + " bytes)");
final byte[] raw = new byte[le... |
ec6119db-fc9b-4955-b697-0944b0b4fd3f | 1 | private void manip(final StackExpr[] source, final StackExpr[] target,
final int[] s) {
for (int i = 0; i < s.length; i++) {
prop(target[i], source[s[i]]);
}
} |
a5086f89-9014-430f-a105-1d993826f1f8 | 8 | protected void changeRegistrySettings(boolean ensureCleanSession, boolean avoidProxy) throws IOException {
log.info("Modifying registry settings...");
HudsuckrSettings settings;
if (oldSettings == null) {
backupHudsuckrSettings();
}
if (!customPACappropriate) {
String proxyServer = ... |
68505505-77e6-4ac7-9ad9-e96b29fdd5df | 5 | private void refreshContestantCBs() {
GameData g = (GameData) GameData.getCurrentGame();
if (g == null) {
return;
}
List<Contestant> cons = g.getActiveContestants(true);
if (g.doesElimExist()) {
Contestant t = g.getElimCont();
if (!cons.contains(t)) {
cons.add(t);
Collections.sort(cons... |
4a106755-1cc5-4503-8871-73a8ddd1df09 | 1 | public void actionPerformed(ActionEvent e) {
Grammar g = environment.getGrammar();
if (g == null)
return;
hypothesizeLambda(environment, g);
} |
0eb0bf9e-b8a3-4539-8fef-a70cc56f0c9d | 5 | public void setNeighbors( int[] truckdrivin){
//System.out.println(truckdrivin.length);
//System.out.println(neighborstate.length);
for(int g = 0; g <= truckdrivin.length-1; g++){
switch(inmode){
case 0: break;
case 1: if(truckdrivin[g] > 0){neighborstate[g] = 1;}
else{neighborstate[g] = 0;} brea... |
b91e1e21-c9a9-4024-aee1-7eef4aa2b7e6 | 7 | public void update() {
List<Entity> entities = level.getallEntities();
for (int i = 0; i < entities.size(); i++) {
if (entities.get(i) instanceof Zombie) {
Zombie current = (Zombie) entities.get(i);
//creates 16x16 "hitbox"
if (x < current.getX() + 17 && x > current.getX() - 17 && y < current.getY() ... |
64cff58a-5b5a-4f95-bb33-e9636ad62446 | 8 | @Override
protected void doGet(Request request) throws ServletException, IOException,
SQLException, IllegalArgumentException, IllegalAccessException {
if (!request.getSession().isLoggedIn())
throw new LoginRequiredException();
request.printHeader();
final PrintWriter writer = request.getWriter();
writer... |
2f71d8f5-309a-4fa6-9c60-53e63dd9b98c | 8 | private void loadfromFile(String problemPath) {
try {
DataInputStream in = new DataInputStream(new FileInputStream(
problemPath));
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String line;
boolean firstLine = true;
int i = 0;
int j = 0;
while ((line = br.readLine()) != ... |
85e5e2c0-a4a6-46a4-8f04-5b68c5d36839 | 2 | public void testPropertyCompareToYear() {
YearMonthDay test1 = new YearMonthDay(TEST_TIME1);
YearMonthDay test2 = new YearMonthDay(TEST_TIME2);
assertEquals(true, test1.year().compareTo(test2) < 0);
assertEquals(true, test2.year().compareTo(test1) > 0);
assertEquals(true, test1.y... |
4c77be79-52c0-4efd-a18b-094ed6a2368c | 7 | public void paintComponent(Graphics g) {
super.paintComponent (g);
if (acList == null) {
return;
}
left = 0;
right = this.getWidth();
delta = (right - left - inset*2) / numIntervals;
// Background.
Dimension D = this.getSize ();
g.setColor (Color.white);
g.fillRect ... |
93e09dde-cf94-4bf5-8037-2e60c0dd4ac1 | 6 | public boolean checkIfJibberish() {
boolean suitCorrect = false;
boolean ctCorrect = false;
for (String s: SUITS){
if (s.equals(suit)){
suitCorrect = true;
break;
}
}
for (char c: CARD_TYPES){
if (c == cardType){
ctCorrect = true;
break;
}
}
if (suitCorrect && ctCorrect) {
r... |
c526f9b0-e561-4f51-b323-516579597bc8 | 6 | public void oneSpanningTree(mxAnalysisGraph aGraph, boolean forceConnected, boolean forceSimple) throws StructuralException
{
mxGraph graph = aGraph.getGraph();
boolean isSimple = mxGraphStructure.isSimple(aGraph);
boolean isConnected = mxGraphStructure.isConnected(aGraph);
if (!isSimple)
{
if (forceSim... |
5ae32cc4-27e9-41e3-a3c5-474c623cbd54 | 9 | public static void main(String[] args) {
////////////////////////////////////////////////////
/* GLOBAL VARIABLES */
int n=12; //12 by default
int m=4; //4 by default
int b=8; //8 by default
/* HANDLES CLI ARGUMENTS */
//Usage: java ProcessSimulation.java processes(n) cpu's(m)
if(args.length>2){
Sy... |
75bd10f0-4bcc-446c-9c88-8fff27c0f69c | 0 | public synchronized boolean[][] processImage(BufferedImage image, double threshold) {
return threshold(findEdges(graySmooth(image)), threshold);
} |
17b9c770-7e11-434a-867e-b3402c941afd | 9 | @Override
public void mouseClicked(MouseEvent e) {
if (e.getComponent().getName().equals("chatline")) {
inputChat.setText("");
} else if (e.getComponent().getName().equals("username")) {
userName.setText("");
} else if (e.getComponent().getName().equals("audio-toggle")) {
JToggleButton temp;
temp = (... |
49c2852d-457e-4385-bc09-c9e383ccc3cc | 3 | boolean matchesIgnoreCase(String seq) {
int scanLength = seq.length();
if (scanLength > length - pos)
return false;
for (int offset = 0; offset < scanLength; offset++) {
char upScan = Character.toUpperCase(seq.charAt(offset));
char upTarget = Character.toUppe... |
a24d7309-819f-4afb-9f0f-aab9350c2b3b | 5 | public int numTrees(int n) {
if (n <= 0)
return 0;
if (n == 1)
return 1;
int result = 0;
for (int i = 1; i <= n; i++) {
if (i == 1 || i == n)
result += numTrees(n - 1);
else
result += numTrees(i - 1) * numTrees(n - i);
}
return result;
} |
2ed5f5c8-769e-4812-8a94-a0aa9f057e12 | 8 | public ListNode detectCycle(ListNode head) {
if (head == null)
return null;
ListNode fast = head, slow = head;
while (true) {
slow = slow.next;
fast = fast.next;
if (fast != null)
fast = fast.next;
if (slow == null || fa... |
3ede0d9c-92ad-473c-a3c8-11b4622d95a2 | 0 | void go() {
callbackReference.increment();
} |
05e62e86-fde0-438f-b810-639e92ac0afa | 5 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
fillFactorial(20);
l = new int[27];
while ((line = in.readLine()) != null && line.length() != 0) {
int size = In... |
7f547be3-7431-4e29-a75a-d874de3138ed | 2 | public String[] getStartWords(){
String[] sw = new String[sentences.size()];
Iterator<String[]> it = sentences.iterator();
int index = 0;
while(it.hasNext()){//For each sentence
String[] sentence = it.next();
if(sentence.length > 0){
sw[index++] = sentence[0];
}
}
return sw;
} |
0b8ddd0e-a5eb-47c2-9cfa-acb6b95a8cf8 | 4 | @Override
public void keyPressed(KeyEvent e)
{
switch (e.getKeyCode())
{
case KeyEvent.VK_S:
{
downPressed=true;
}
break;
case KeyEvent.VK_W:
{
upPressed=true;
}
break;
case KeyEvent.VK_D:
{
rightPressed=true;
}
break;
case KeyEvent.VK_A:
{... |
6a2360b2-2d97-4c41-8401-47229827fd50 | 2 | public static boolean isFullHelm(int itemID)
{
for (int i=0; i<fullHelm.length; i++)
if (fullHelm[i] == itemID)
return true;
return false;
} |
95495b37-6ebe-48c5-9b31-dbc28f3a327e | 4 | public void removeObject(PhysicalObject paramPhysicalObject)
{
Vector localVector;
int i;
if (this.Loopers.contains(paramPhysicalObject))
{
localVector = paramPhysicalObject.getLoopList();
for (i = 0; i < localVector.size(); i++)
{
String str = (String)localVector.elementAt(... |
54a9a470-45f2-4342-a566-44ac33f3e9d4 | 7 | private static void testInvalidNode(ListNode p) {
System.out.println("p.isValidNode() should be false: " + p.isValidNode());
try {
p.item();
System.out.println("p.item() should throw an exception, but didn't.");
} catch (InvalidNodeException lbe) {
System.out.println("p.item() should throw... |
29205714-d0d8-4811-8976-8aadcf5c10c9 | 8 | public Stats getExamStats() {
Stats stats = new Stats();
checkField(baHead, stats, 12);
checkField(baChest, stats, 12);
checkField(baAbdomen, stats, 12);
checkField(baNeck, stats, 12);
checkField(baBack, stats, 12);
checkField(baGenitaliaGroinButtocks, stats, 12);
checkFi... |
4bfd4dc8-324a-4a2a-9cd5-7d9d32deb7ad | 4 | @Test
public void testFilterGreyScale() {
ImageFactory imageFactory = new ImageFactory();
IImage iim = imageFactory.createImage("/images/megaman.gif");
iim.filterGreyScale(1);
try{
PixelGrabber grab1 = new PixelGrabber(iim.getImageObject(), 0, 0, -1, -1, true);
grab1.grabPixels();
int[] data = (int[])... |
f90ce222-ccfc-4ec6-9fb8-170bc760e928 | 4 | private String nameOfType(Java7Parser.LocalVariableDeclarationContext ctx) {
// System.out.println(ctx.getText());
if (ctx.getChild(1).getChild(0).getChild(2) == null)
return "-1";
// System.out.println(ctx.getChild(1).getChild(0).getChild(2).getChild(0).getChild(0).getText());
String tmp = ctx.getChild(1).g... |
69c4ce28-d240-46ca-acbb-aff4df8b5788 | 5 | void putCharacter(int x, int y, ScreenCharacter character)
{
synchronized(mutex) {
if(y < 0 || y >= backbuffer.length || x < 0 || x >= backbuffer[0].length)
return;
//Only create a new character if the
if(!backbuffer[y][x].equals(character))
... |
7e6999b0-4f2f-4c28-98ed-d4522e635f48 | 1 | private AssociationList genAssocData(int aiNumOfRecs)
{
AssociationList laAssocList = new AssociationList();
for (int i = 0; i < aiNumOfRecs; i++)
{
// Build the Association
Association laAssoc = new Association();
laAssoc.setRegistrantNum("tst_" + i);
laAssoc.setEpc("epc_" + i);
laAssoc.setKill(... |
9544bad9-5816-4dc6-8a5a-bc6a26c959d9 | 8 | @Override
public void collectStats(SegmentEventRecoder recorder, StringBuilder builder) {
if (AFS) {
int[] freq = getFrequencySpectrum(recorder);
lastAFS=freq;
Util.arrayAdd(gloabalAFS, freq);
if (!onlySummary) {
builder.append("AFS: ");
for (int i = 0; i < freq.length; i++) {
builder.append... |
12daf448-2e69-4f4c-bb6d-2925252fd6a0 | 7 | public void addListeners() {
// event listeners added to buttons
// ------------------------------------------
// this method sets the description textArea to the generic info of the
// bird -----can add anything else we want in this area
// ------------------------------------------
descriptionButton.addA... |
1904b730-f5cc-41e8-b11f-d6f9834e3244 | 1 | public void printAuctions(){
for( int i = 0; i < this.getAuctionsList().size(); i++){
System.out.println(this.getAuctionsList().get(i).toString() + "\n\n");
}
} |
3eba980b-7913-42b5-b033-52d24b896063 | 1 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
List<Role> roles = rfl.findAll();
try (PrintWriter out = response.getWriter()) {
... |
33a4c26f-375f-495a-b523-3d105bfa5a64 | 5 | private void askForNewGame() {
int hor = 0;
int ver = 0;
while (hor < 10 || ver < 10) {
GridSizeDialog dialog = new GridSizeDialog();
int answer = dialog.show();
if (answer == JOptionPane.CANCEL_OPTION) {
System.exit(0);
} else if (answer == JOptionPane.OK_OPTION) {
try {
hor = dialog.get... |
8e5663e8-109f-47e2-92a8-e01cc422c349 | 7 | private Caption parseDialogueForASS(String[] line, String[] dialogueFormat, float timer, TimedTextObject tto) {
Caption newCaption = new Caption();
for (int i = 0; i < dialogueFormat.length; i++) {
String trimmedDialogueFormat = dialogueFormat[i].trim();
//we go through every format parameter and save t... |
94473525-f27b-4679-850e-90a526cad079 | 7 | public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double) o).isInfinite() || ((Double) o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
c93bc94d-f349-41bc-bf91-53e572b2b012 | 0 | public int getX() {
return x;
} |
f8869517-53ea-42da-864e-9bc3973aa2b0 | 1 | @GET
@Path("/v2.0/subnets/{subnetId}")
@Produces({MediaType.APPLICATION_JSON, OpenstackNetProxyConstants.TYPE_RDF})
public Response showSubnet(@PathParam("subnetId") String subnetId, @HeaderParam("Accept") String accept) throws MalformedURLException, IOException{
if (accept.equals(OpenstackNetProxyConstants.TYPE_R... |
251b91cd-904c-41d2-bc22-d112e51ecead | 9 | private void verificarSeleccionParametricasMedidor() {
if (puntoLuz.getMedidorEnergia().getFabricante().getId() == 0) {
puntoLuz.getMedidorEnergia().setFabricante(null);
}
if (puntoLuz.getMedidorEnergia().getTipoMedidor().getId() == null) {
puntoLuz.getMedidorEnergia().s... |
0aa30fd0-c032-49fb-b396-782ec228ad2c | 5 | private void endGame(boolean won)
{
for(int row = 0; row < rows; row++) {
for(int col = 0; col < cols; col++) {
JButton button = buttonGrid[row][col];
if(base.getSquare(row, col).getIsAMine()) {
button.setText("M");
if(won) {
button.setBackground(Color.green);
... |
4e38ec03-2958-4da3-8810-a459e8b975c2 | 1 | private void addDelta(int x, int y, Color newC) {
Delta d = new Delta(x, y, colorArr[x][y], newC);
if (!d.amUseless()) {
dMap.add(d);
}
} |
980725a8-0087-4ae3-987d-f3e9890b91dd | 6 | private void prepare()
{
int counter = 0;
for (int u = 0; u < 4; u++) {
for (int i = 0; i < 5; i++) {
colorCont = Greenfoot.getRandomNumber(2) + 1;
sizeCont = Greenfoot.getRandomNumber(2) + 1;
colorCont2 = Greenfoot.getRandomNumber(2) + 1;
... |
f28a9cfb-d0cd-4131-8560-bfd96eacd1c6 | 8 | private boolean loadItem(Collection<RobotSpecification> battlingRobotsList, RobotSpecification spec, IRobotSpecItem item, int teamNum) {
String teamId = String.format("%4d", teamNum);
if (item != null) {
if (item.isTeam()) {
teamId = item.getFullClassNameWithVersion() + "[" + teamId + "]";
final Collect... |
da917ed1-bb0c-4ee6-b596-bb776b4d3883 | 8 | @Override
public void moveInto(GameEntity target) {
if (target == GamePanel.get().getPlayer()) {
// Only attack the target if it's the GamePanel.get().getPlayer()
((Actor) target).applyDamage(attack((Actor) target), this);
} else {
// Else, try to move around the ... |
d754fe79-9076-46ae-a1b8-51fd02fcd23c | 7 | private List<Object> generateFactOrRule(Map<String, spindle.core.dom.Rule> factsOrRules) {
List<Object> factOrRule = new ArrayList<Object>();
Object obj = null;
for (spindle.core.dom.Rule rule : factsOrRules.values()) {
switch (rule.getRuleType()) {
case FACT:
spindle.core.dom.Literal headLiteral = rule... |
b631012d-b54c-4b6d-a552-a7b7d981f3b1 | 8 | static LinkedListNode addReverse(LinkedListNode a, LinkedListNode b) {
LinkedListNode resultHead = null;
LinkedListNode resultTail = null;
boolean hasCarrier = false;
int tmp, tmpa, tmpb;
while (a != null || b != null) {
if (a != null) {
tmpa = a.getVa... |
358069e9-0014-40ed-a8ef-d50404347846 | 1 | public void visit_isub(final Instruction inst) {
stackHeight -= 2;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 1;
} |
6a258841-6bd4-47f8-88ea-aefa1df8db3d | 1 | public static void main(String[] args) {
// Field[] fields = CompanyA.class.getDeclaredFields();
// for (Field f : fields) {
// Class t = f.getType();
// System.out.println("field name : " + f.getName() + " , type : " + t);
// }
//
List<String> list = getFieldNameWithListDataType();
for(String data ... |
41184e2e-d418-49c8-8259-c45bb97bd964 | 2 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] mas = new int[n];
in.nextLine();
for (int i = 0; i < n; i++) {
mas[i] = in.nextInt();
}
Arrays.sort(mas);
for (int i : mas) {
System.out.println(i);
}
} |
b17630c4-6c92-46d6-9dea-86ce7915c02c | 7 | public static void main(String[] args) {
String filename;
Scanner input = new Scanner(System.in);
System.out.print("Enter name of file/directory ");
System.out.print("or press <Enter> to quit: ");
filename = input.nextLine();
while (!filename.equals("")) {
File fileDir = new File(filename);
if (!fileD... |
82f1ff2c-5ed6-4af9-a871-728045e5712b | 9 | public BufferedImage redRGBFilter() {
this.redImage = originalImage;
Color actualPixel;
int actualRedValue;
int actualGreenValue;
int actualBlueValue;
float numberOfRedPixels = 0f;
for (int i = 0; i < originalImage.getWidth(); i++) {
for (int j = 0; j < originalImage.getHeight(); j++) {
actualPixel... |
1e11ec6f-380e-4bfa-bac8-b5d1beb8af65 | 8 | private void saveExperiment() {
int returnVal = m_FileChooser.showSaveDialog(this);
if (returnVal != JFileChooser.APPROVE_OPTION) {
return;
}
File expFile = m_FileChooser.getSelectedFile();
// add extension if necessary
if (m_FileChooser.getFileFilter() == m_ExpFilter) {
if (!e... |
37bbebbf-a070-40b3-a2ab-6670c80ad520 | 4 | public Reply fetchDataConnectionReply() throws FileNotFoundException,
IOException {
ReplyWorker worker = new ReplyWorker(getDataSocket(), this);
worker.start();
while (worker.getStatus() == ReplyWorker.UNKNOWN) {
try {
Thread.sleep(20);
} catch... |
d85dfd55-84dc-4838-91d3-5b0679aac0b0 | 2 | private void startFrame(final int offset, final int nLocal, final int nStack) {
int n = 3 + nLocal + nStack;
if (frame == null || frame.length < n) {
frame = new int[n];
}
frame[0] = offset;
frame[1] = nLocal;
frame[2] = nStack;
frameIndex = 3;
} |
c8c5d3cf-9438-4992-9cd3-b9df39733e1b | 7 | public void printLocalDictionaryInfo()
{
if (_localDictionary == null)
{
System.out.println(_className + ": Local dictionary is not available.");
return;
}
System.out.println(_className + ": Local dictionary from files: ");
String value = null;
... |
06b7acab-e0e5-4f73-bce3-ee371be4c146 | 3 | private void btnExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExcluirActionPerformed
if (existeOrdemServicoSelecionada() && super.exclusaoConfirmada()) {
try {
excluir();
} catch (ValidacaoException ex) {
JOptionPane.showMess... |
5302f2c2-2d34-49ed-9221-266284df4a8f | 0 | public static void main(String[] args) {
int x = 1, y = 1;
int a = 0, b = 0;
x++; ++y;
System.out.println("a = " + a + ", b = " + b + ", x = " + x + ", y = " + y);
//a = 0, b = 0, x = 2, y = 2
a = x++; b = ++y;
System.out.println("a = " + a + ", b = " + b + ", x = " + x + ", y = " + y);
//a = 2, b = 3, x = 3,... |
e9383757-8d66-48f5-b876-86ae4fcdbed7 | 6 | public static double [][] getDensityData(String input_file_name) {
Workbook wrk1;
try {
wrk1 = Workbook.getWorkbook(new File(input_file_name));
Sheet sheet1 = wrk1.getSheet(0);
int rows=sheet1.getRows();
double [][] data = new double [315][98];
for (int h = 0; h < 315; h++) {
for (int w = 0; w... |
bf8c0c35-9055-497d-b280-bb00592cef9a | 6 | int getNumOpenSets(Space space) {
int num = 0;
if (isOpenForPiece(board[space.pos[0]], space.piece))
num++;
if (isOpenForPiece(getColumn(space.pos[1]), space.piece))
num++;
if (space.diagID % 2 == 0
&& isOpenForPiece(getTopDownDiag(), space.piece))
num++;
if (space.diagID % 3 == 0
&& isOpenFo... |
db53aefc-f947-4a5f-bd64-92e4abec2e9d | 2 | public void testGetValue_int() {
LocalTime test = new LocalTime(10, 20, 30, 40, COPTIC_PARIS);
assertEquals(10, test.getValue(0));
assertEquals(20, test.getValue(1));
assertEquals(30, test.getValue(2));
assertEquals(40, test.getValue(3));
try {
test.getValue(-... |
6a18208a-655b-47e6-8ac7-20f3f8f67b8c | 5 | public int produceScore( User u , JobPosting jp ){
int totalScore = 0;
if(u.getFullTime() == jp.getFullTime())
totalScore++;
if(u.getAreaOfInterest().equals(jp.getJobType()))
totalScore++;
Set<String> userSet = u.getUserKeywords();
Set<String> jobSet = jp.getKeywords();
for(String use... |
1fd40ae7-3055-42fb-8a8c-d166cb604123 | 6 | private void hentSager() {
String cpr = cpr_textField.getText();
if (cpr.length() == 10) {
if (sLEHandler.checkPersonExists(cpr)) {
sager_table.setEnabled(true);
ArrayList<Sag> sager = sLEHandler.sogCPR(cpr, false);
if (!sager.isEmpty()) {
... |
e829eddb-5586-4cbb-9e47-6ce101679903 | 4 | private OptionDescriptor findAndRemoveNonOptionsSpec( Collection<? extends OptionDescriptor> options ) {
for ( Iterator<? extends OptionDescriptor> it = options.iterator(); it.hasNext(); ) {
OptionDescriptor next = it.next();
if ( next.representsNonOptions() ) {
it.remove... |
fd3b3ac2-6c5d-4dba-9c43-4f94928c76ad | 5 | @Override
public void render(Graphics g, Visibility visibility, float x, float y, float scale) {
if(visibility == Visibility.VISIBLE) {
Animation anim;
if(isMoving())
anim = moveAnim[toIndex(getFacing())];
else if(isCancelingMove() || isRecoveringFromCanceledMove())
anim = bumpAnim[toIndex(getFacing... |
f4ee05eb-cbe7-487c-9674-d427395f0476 | 0 | public File getBukkitDataFolder() {
return getDataFolder();
} |
599239b2-fad9-4ae9-936c-1da50e6c8fd0 | 5 | public String buscarClientePorDNI(String DNI){
//##########################CARGA_BASE DE DATOS#############
tablaDeClientes();
//##########################INGRESO_VACIO###################
if(DNI.equals("")){
DNI = "No busque nada";
return resultBusqueda =... |
7091e5cb-67fd-4a06-8ce0-2cc3443e551d | 4 | @Override
public void run() {
boolean interrupted = false;
while (!interrupted) {
try {
JSONObject data = connector.refresh();
users.clear();
JSONArray dataUsers = data.getJSONArray("users");
int i = 0;
while (i < dataUsers.length()) {
JSONObject dataUser = dataUsers.getJSONO... |
cbc14c60-8ee2-47e0-abdd-5adfec40a42e | 9 | public ArrayList<ArrayList<Integer>> zigzagLevelOrder(TreeNode root) {
ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
if (root == null) {
return result;
}
//if left to right order
boolean leftToRight = true;
//current level
... |
3669fc4f-8e63-44f8-9afa-3eded8664829 | 5 | public void start(BundleContext context) throws Exception {
// Query for all service references matching any language.
ServiceReference[] refs = context.getServiceReferences(
DictionaryService.class.getName(), "(Language=*)");
if (refs != null) {
try {
System.out.println("Enter a blank line to exit.")... |
6e42a454-ea73-48bf-a372-9b05110dd5df | 5 | private static String encode_base64(byte d[], int len)
throws IllegalArgumentException {
int off = 0;
StringBuffer rs = new StringBuffer();
int c1, c2;
if (len <= 0 || len > d.length)
throw new IllegalArgumentException ("Invalid len");
while (off < len) {
c1 = d[off++] & 0xff;
rs.append(base64_co... |
c4e36ade-f6d4-48c7-be22-e939892f7056 | 6 | public static int longestValidParentheses(String s) {
int max = 0;
Stack<Integer> stack = new Stack<Integer>();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if ('(' == c) {
stack.push(i);
} else {
if (!stack.isEmpty() && '(' == s.charAt... |
4f66af75-2055-4329-96db-5099046e79af | 3 | public static void writeFile(String theFileName)
{
try
{
File currentFile = new File("plugins/CraftHUD/Resources/"+theFileName);
@SuppressWarnings("static-access")
JarFile jar = new JarFile(plugin.crafthud);
JarEntry entry = jar.getJarEntry("resources/"+theFileName);
... |
79bb5d82-6e30-4875-9d39-6eee3360cdbd | 0 | public void driver() {
System.out.println("benz bus drive");
} |
1259eda6-6f7a-4f61-9bd2-a41848318759 | 3 | public static <VertexDataType> void foreach(int numVertices, String baseFilename, BytesToValueConverter<VertexDataType> conv,
ForeachCallback<VertexDataType> callback) throws IOException {
VertexData<VertexDataType> vertexData = new VertexData<VertexDataType>(nu... |
4224929a-84d3-4a57-b606-71660634b4f1 | 6 | public Locomotive(Integer grossWeight, String classification) throws TrainException{
super(grossWeight);
String powerClass = classification.substring(0, classification.length()-1);
String engineType = classification.substring(classification.length() - 1);
try{
this.powerClass = Integer.parseInt(powerClass);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.