method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
c87f7636-b996-4fa3-8e93-4795863b8d4f | 5 | public static void main(String[] args){
int i;
Scanner keyboard = new Scanner(System.in);
while (true) {
System.out.println("Please input an odd number:");
i = keyboard.nextInt();
if (i % 2 == 0) {
System.out.println("It's an even number! Try again.");
} else {
//calcute how many lines need to... |
9cd39fff-5709-4bfc-9d7e-6a9fa2afee6f | 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.");
... |
eaa133b5-09dc-4bee-996d-5ef775cc7024 | 3 | void setExampleWidgetAlignment () {
int alignment = 0;
if (leftButton.getSelection ()) alignment = SWT.LEFT;
if (centerButton.getSelection ()) alignment = SWT.CENTER;
if (rightButton.getSelection ()) alignment = SWT.RIGHT;
label1.setAlignment (alignment);
label2.setAlignment (alignment);
label3.setAlignme... |
f5a52a56-16f6-41c4-8e33-b61f152e05d8 | 8 | public boolean isDirectlyAccessible(Coordinate coord) {
int x = coord.getCoordX();
int y = coord.getCoordY();
Coordinate coordTemp;
if (y > 0) {
coordTemp = coord.copy();
coordTemp.moveNorth();
if (!isObstacle(coordTemp)) {
return true;
}
}
if (x < dimension - 1) {
coordTemp = coord.copy... |
e8fcea16-4403-4dcb-9b88-a72441c2eb6e | 6 | public Connection getConnectionWith(Neuron other){
for(int i=0;i<outputs.size();i++)
if(outputs.get(i).getGiveNeuron()==other||outputs.get(i).getRecieveNeuron()==other)
return outputs.get(i);
for(int i=0;i<inputs.size();i++)
if(inputs.get(i).getGiveNeuron()==other... |
3548352e-355a-48a2-bd98-f95f56ddbd74 | 4 | public LinkedList<Review> getOtherReviews(String reviewer, String isbn) throws SQLException {
LinkedList<String> select = new LinkedList<String>();
select.add("*");
LinkedList<String> from = new LinkedList<String>();
from.add("Reviews");
LinkedList<Pair<String, String>> whereClau... |
86d96c39-82aa-4c23-9215-7c8cebb88b28 | 7 | int bonuses(Token token) {
int r = 0;
if(right!=null)
{
r += Item.get(right,token);
if(right==Item.Axe && left==null)
r++;
}
if(left!=null)
r += Item.get(left,token);
for(Item e : items)
r += Item.get(e, token);
for(Token e : skills) {
if(e==token)
r++;
}
return r;
} |
b8a92c5f-17c0-4d32-b4ca-813498677993 | 1 | public Activity find(long id) throws InstanceNotFoundException {
Activity a = null;
try {
a = activities.get((int) id);
} catch (ArrayIndexOutOfBoundsException e) {
throw new InstanceNotFoundException(id, "Activity");
}
return a;
} |
0b807e1e-a808-4fcb-a14d-c221c6b6a0da | 1 | public void testWithField2() {
Period test = new Period(1, 2, 3, 4, 5, 6, 7, 8);
try {
test.withField(null, 6);
fail();
} catch (IllegalArgumentException ex) {}
} |
dd063367-b55f-451a-acda-510dc83f40f4 | 1 | public void testSoundThread() throws Exception {
System.out.println("playSoundThread");
MusicController mc = new MusicController();
Thread instance=new Thread (mc);
// instance.start();
for(int i=0;i<150;i++){
System.out.println(i+" Seconds passed ");
Threa... |
85b0e62e-e66f-471a-bbe1-824f7a275eba | 7 | * @param elements Elemente der Menge der Objekt-Typen
*
* @throws ConfigurationChangeException Falls die Menge nicht am Objekt gespeichert werden konnte.
*/
private void setObjectSetTypeObjectTypes(ConfigurationArea configurationArea, ObjectSetType objectSetType, String[] elements)
throws Configurati... |
d939eaa3-dd76-4d99-a1c0-3eb0323e6c65 | 0 | public CheckResultMessage checkE05(int day) {
return checkReport.checkE05(day);
} |
244f9c68-f6f9-4c0a-a254-4dd4939d3de5 | 0 | public void uninstallUI(JComponent c) {
super.uninstallUI(c);
c.remove(rendererPane);
rendererPane = null;
} |
c3843a46-9170-446c-ac28-ba59ddfff035 | 3 | public static Point getLayout(int numWindows, int maxX, int maxY) {
// Look for rectangular layout
Set<Integer> divisors = findDivisors(numWindows);
for (int x : divisors) {
int y = numWindows / x;
if (x <= maxX && y <= maxY) {
return new Point(x, y);
}
}
// No rectangular layout found. Use a ... |
a53c50b9-5ab9-423e-80e8-aaa501444254 | 1 | private int[] orderMerging(int[] a) {
if(a.length == 1) return a;
int leftLen = a.length / 2;
int rightLen = a.length - leftLen;
int[] left = new int[leftLen];
int[] right = new int[rightLen];
System.arraycopy(a, 0, left, 0, leftLen);
System.arraycopy(a, leftLen... |
946a840a-0eaf-4b56-99e7-b29ec68cdbf6 | 3 | public ListNode deleteDuplicates(ListNode head) {
if (head == null)
return null;
ListNode p = head;
ListNode t = head;
p = p.next;
while (p != null) {
if (t.val == p.val) {
p = p.next;
}
else {
t.n... |
17e88385-db83-4836-92a8-f998fb69c8e7 | 3 | private int getBonusMultiplier(Location loc){
Location toRemove = null;
for(Location bonus : bonusSquares.keySet()){
if(loc.sameCoord(bonus)){
toRemove = bonus;
break;
}
}
if(toRemove != null){
int multiplier = bonusSquares.get(toRemove);
bonusSquares.remove(toRemove);
return multiplier;
... |
e95af307-d637-481b-b125-11d9a7bd564e | 9 | @Override
public PokerAction makeDecision(Card[] table, int small, int big,
int amount, int potSize, int chipCount, int numPlayers, boolean allowedBet) {
double random = Math.random()/(this.aggressiveness);
if(table == null){
double winOdds = stats.getStat(numPlayers, currentHand);
if(winOdds > 0.5 && all... |
9f15a546-bbf1-476d-aba5-ba563679cdfe | 2 | public void areStreamsUp() {
if (!streamList.isEmpty()) {
for (;threadCount < streamList.size(); threadCount++) {
new StreamIsUp(streamList.get(threadCount), threadCount, streamName.get(threadCount)).start();
}
}
} |
88a37fdf-b8b1-4cef-9ec7-6a019cc4a540 | 5 | public void showPersonMenu() {
//Menüoptionen
final int NEW_PERSON = 0;
final int EDIT_PERSON = 1;
final int DELETE_PERSON = 2;
final int BACK = 3;
//Personenverwaltungsmenü
Menu maklerMenu = new Menu("Personen-Verwaltung");
maklerMenu.addEntry("Neue Person", NEW_PERSON);
maklerMenu.addEntry("Perso... |
8ec9d111-d9a7-47ae-a831-4d926baa0e36 | 5 | public boolean shouldStore(final LocalExpr expr) {
// We should store if there are more than 2 type 1 uses or
// any uses of type greater than one-- which will be indicated
// by type1s being greater than 2
// the parameter expr might be null, e.g., if this method is
// called from "dups" in "!shouldStore((... |
a2e3574c-1a81-4d9e-8430-c2240ecbf352 | 1 | public static JSONObject showUnauthorized() {
JSONObject jo = new JSONObject();
try
{
jo.put("rtnCode", "401 unauthorized");
} catch (JSONException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
return jo;
} |
9a3aa8d7-d3d5-4b25-b79d-b63fafde1e21 | 8 | public List<Integer> findMinHeightTrees(int n, int[][] edges) {
if (n == 1) {
return Collections.singletonList(0);
}
List<Set<Integer>> adj = new ArrayList<>(n);
for (int i = 0; i < n; ++i) adj.add(new HashSet<>());
for (int[] edge : edges) {
... |
7f2c614e-87d6-45e2-8ac1-2e0475c747eb | 5 | private String getPersistencyMethode() {
File file = new File("init.dat");
String juist = null;
if (file.exists()) {
try {
Scanner scanner = new Scanner(file);
int tel = 0;
while (scanner.hasNextLine()) {
tel++;
String fout = scanner.nextLine();
if (tel == 2) {
juist = ... |
57697e8d-5e91-4c12-8b28-cdad41c08a8a | 8 | public void setOptions(String[] options) throws Exception {
setDebug(Utils.getFlag('D', options));
String classIndex = Utils.getOption('c', options);
if (classIndex.length() != 0) {
if (classIndex.toLowerCase().equals("last")) {
setClassIndex(0);
} else if (classIndex.toLowerCase().equ... |
d1074053-085c-494c-91b7-15eccfedde51 | 6 | @Override
public ArrayList<Integer> findByType(String type) {
ArrayList list = new ArrayList();
try {
connection = getConnection();
ptmt = connection.prepareStatement("SELECT id FROM Task WHERE type=?;");
ptmt.setString(1, type);
resultSet = ptmt.execu... |
b7567d3c-67f7-4279-becc-1d02a91550e6 | 9 | public DataPair split(int feat){
HashSet<Integer> index = new HashSet<Integer>();
int[] examples = data.get(new Integer(feat));
if (examples == null)
return null;
for (int i=0; i < examples.length; i++){
index.add( examples[i] );
}
TreeMap<Intege... |
b5ed77dc-7a60-45bb-b78f-324b2dc8f2d9 | 0 | public void write(ByteBuffer block, int offset) throws IOException {
this.channel.write(block, offset);
} |
7a474ab4-df52-4504-8c39-1b298510bfd1 | 8 | public static String transformLabel(Tree<String> tree) {
String transformedLabel = tree.getLabel();
int cutIndex = transformedLabel.indexOf('-');
int cutIndex2 = transformedLabel.indexOf('=');
int cutIndex3 = transformedLabel.indexOf('^');
if (cutIndex2 > 0 && (cutIndex2 < cutIndex || cutI... |
84a8b2ba-ce77-407f-a2ac-73cfd3c8de9b | 3 | private static int[] EachPlayerIO(){
// This will take inputs of visions for each player in turn, and give them their
// visions immediately.
int[] randOrder = getRandomOrdering(NumPlayers);
// randOrder now contains a randomised ordering of indices.
boolean[] CanSee = RunningGame.CheckLiveSeers();
b... |
940424ac-015f-4da7-bcf5-5d0826576605 | 3 | private static <E> CycList<CycList<E>> combinationsOfInternal(final CycList<E> selectedItems, final CycList<E> availableItems) {
final CycList<CycList<E>> result = CycList.list(selectedItems);
if (availableItems.size() == 0) {
return result;
}
CycList<E> combination = null;
for (int i = 0; i <... |
11b68110-eb3f-4694-8e97-15e8bf0b1f62 | 5 | public static String[] readLgooFile(String path) {
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(
path));
} catch (FileNotFoundException e1) {
e1.printStackTrace();
System.out.println("file not found");
}
String line = null;
String[] tempArray = new String[get... |
a4d009c5-b983-4a18-a3bc-1859026af72e | 8 | public static String parseErrorMessage(String errorMessage) {
StringBuilder response = new StringBuilder();
Pattern pattern = Pattern.compile(".*?/series/(\\d*?)/default/(\\d*?)/(\\d*?)/.*?");
Matcher matcher = pattern.matcher(errorMessage);
// See if the error message matches the patt... |
a6486f8c-d7d3-494f-b1b2-b9bf817b3761 | 5 | public void Update(GameTime gameTime)
{
mMenu.Update();
if (!mMenu.IsMenuItemSelected())
{
mMenu.SelectMenuItem(new Vector2(mInput.GetMouseX(), GameProperties.WindowHeight() - mInput.GetMouseY()));
if (mInput.IsMouseHit(0))
{
switch(mMenu.GetSelected())
{
case 0:
{
gameTim... |
f52127dd-4a94-4a3a-8489-23723188c578 | 0 | protected JPanel buildSortPanel() {
JPanel ans = new JPanel();
GridBagLayout layout = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
ans.setLayout(layout);
//
c.fill = GridBagConstraints.HORIZONTAL;
nameSort = new JRadioButton("");
JRadioButton noSort = new JRadioButton("ѧ", tr... |
5d157581-cd21-4e50-9c85-2d9055d88d6d | 9 | public static <T> boolean equals(T[][] matrix, T[][] withMatrix)
throws NullPointerException {
if (matrix == withMatrix)
return true;
if (matrix == null && withMatrix == null)
return true;
if (matrix == null || withMatrix == null)
return false;
int width = getWidth(matrix);
int height = getHeig... |
0cb66f45-6c8d-4974-89e3-081665bf93e6 | 9 | public float priorityFor(Actor actor) {
if (storeShortage() <= 0) {
if (sumHarvest() > 0) return Plan.ROUTINE ;
else done = true ;
}
final float hunger = actor.health.hungerLevel() ;
if (store == null && hunger <= 0) done = true ;
if (done) return 0 ;
float impetus = 0 ;
imp... |
01e1e700-14d8-483b-bf8d-cf9e5346c26e | 4 | public EntityPlayer updateInput()
{
if (Keyboard.isKeyDown(Keyboard.KEY_W))
{
position.y -= speed;
currentY -= speed;
}
if (Keyboard.isKeyDown(Keyboard.KEY_A))
{
position.x -= speed;
currentX -= speed;
}
if (Keyb... |
0a5f4b76-a28a-4cc2-9c34-01238bfbf092 | 2 | public void testProperty() {
LocalDate test = new LocalDate(2005, 6, 9, GJ_UTC);
assertEquals(test.year(), test.property(DateTimeFieldType.year()));
assertEquals(test.monthOfYear(), test.property(DateTimeFieldType.monthOfYear()));
assertEquals(test.dayOfMonth(), test.property(DateTimeFie... |
65e0d770-8238-4342-aeaa-bfaaa6724877 | 0 | public void setPrice(float price) {
this.price = price;
} |
f2e160fe-0624-45db-bf10-e5fed6b83b33 | 0 | protected SchlangenGlied(Rectangle masse, IntHolder unit, Color color) {
super(masse, unit);
this.color = color;
} |
0807ce01-e997-4dc0-9f62-54597938e979 | 3 | public void deleteMessage(String sender, String receiver, String message, int sentBy) {
db.deleteMessage(sender, receiver, message);
if((sentBy == ServerInterface.CLIENT) && (backupServer != null)) {
try {
backupServer.ping();
backupServer.deleteMessage(sender, receiver, message, ServerInterface.SERVE... |
1a2dfe08-8e3c-4457-ae37-4e1b5d559a74 | 7 | public void accept(Visitor visitor) {
if (visitor.visit(this)) {
if (sour != null) {
sour.accept(visitor);
}
if (date != null) {
date.accept(visitor);
}
if (subm != null) {
subm.accept(visitor);
}
if (subn != null) ... |
d8557642-020b-4dd7-a555-bb0267334027 | 4 | public void draw(Graphics g) {
Image I;
boolean noBonus = false;
I = map.game.getImages().getBonusBomb();
switch(type) {
case 1:
I = map.game.getImages().getBonusBomb();
break;
case 2:
I = map.game.getImages().getBon... |
6463a75c-6ffb-4a15-90f1-e31010b4687e | 6 | boolean treeContains(CoreInterface ci){
if(ci.getClass() == Dvd.class){
if(dvdTree.contains(ci)){
return true;
}
return false;
}else if(ci.getClass() == Location.class){
if(locationTree.contains(ci)){
return true;
}
return false;
}else if(ci.getClass() == Genre.class){
if(genreTree.co... |
18744951-958a-421a-9dbf-763b926328d9 | 6 | public String updateDailyScheduleRequest(Sport sport, int year, String month, String day) {
String request = null;
switch(sport) {
case NBA: case NHL:
request = "http://api.sportsdatallc.org/" + sport.getName() + "-" + access_level + sport.getVersion() + "/games/" + year + "/" + month + "/" + day + "/schedul... |
44782683-ff5e-4ae8-a08a-6d33f8f7b56b | 3 | public HiloBean load(HiloBean oHilo) throws NumberFormatException, ParseException {
try {
if ((request.getParameter("nombre") != null)) {
oHilo.setNombre(request.getParameter("nombre"));
}
if ((request.getParameter("fecha") != null)) {
oHilo.se... |
1ff598ed-65c7-4f77-991b-b73e4dd1458d | 4 | @Override
public void paintComponents(Graphics g) {
if (this.skin.getLocaleButtonVisible()) {
Graphics g2 = g.create();
int x, y;
int w, h;
if (this.skin.isChanged() || (this.ground == null)) {
try {
String p = this.skin.g... |
0d2592b4-235d-4b3d-a553-e784c63cfc70 | 0 | public byte[] getG() {
return g;
} |
bac58047-49c1-46a1-9dab-c3deceb1108c | 0 | @Override
public void actionPerformed(ActionEvent e) {
repaint();
} |
aa87f9e2-9546-48bf-971d-a0500c20c74f | 0 | public static void main(String[] args) throws ClassNotFoundException, SecurityException, NoSuchMethodException {
SimpleInterface simpleInterface = new SimpleClass();
simpleInterface.method(3, new SimpleClass());
simpleInterface.method(3);
simpleInterface.someOtherMethod();
} |
8513aa67-1b8a-48e3-8496-178a9859b839 | 4 | public void extractConfig(final String resource, final boolean replace) {
final File config = new File(this.getDataFolder(), resource);
if (config.exists() && !replace) return;
this.getLogger().log(Level.FINE, "Extracting configuration file {1} {0} as {2}", new Object[] { resource, CustomPlugin... |
813a97e0-ce8f-4d00-b7bd-91b2aaf5f801 | 9 | public static void main(String[] args) {
int myPoint = 0;
Status gameStatus;
int sumOfDice = rollDice();
switch ( sumOfDice ) {
case SEVEN:
case YO_LEVEN:
gameStatus = Status.WON;
break;
... |
e4578272-d82d-4b7f-8703-c124ee65c62b | 3 | private Map<String, List> addStormsFromYear(DefaultMutableTreeNode root, String year) {
DefaultMutableTreeNode yearRoot;
try{
StormSet stormSet = new StormSet(new File("noaaStormCoords" + year + ".gpx"));
yearRoot = new DefaultMutableTreeNode(year);
root.add(yearRoot);
Map<String, List> storms = sto... |
9a70e52a-b55e-4726-bcf7-9c54811a424b | 7 | public int getVertical(int i, int j, int r) {
int sum = 0;
int imax = this.length;
int jmax = this.width;
for (int n = 0; n <= 2 * r; n++) {
int ii = topo.idI(i - r + n, j, imax, jmax);
int jj = topo.idJ(i, j, imax, jmax);
if (
(!(ii < 0) && !(ii >= imax)) &&
(!(jj < 0) && !(jj >= jmax)) ... |
6e16fa8d-6607-4914-a26b-ef173a2d189c | 0 | public void cancelTimer(The5zigModTimer timer) {
timer.cancel(getPlayer());
} |
c860b4c8-c607-4aec-a09e-ea6c4843d8d3 | 4 | public void keyPressed(KeyEvent e) {
if(e.getKeyCode() == KeyEvent.VK_A || e.getKeyCode() == KeyEvent.VK_LEFT);
velx = -5;
if(e.getKeyCode() == KeyEvent.VK_D || e.getKeyCode() == KeyEvent.VK_RIGHT);
velx = 5;
} |
f5a51118-e783-46f4-8fa3-d34e82bd1ea2 | 9 | private void addParserNoticeHighlights(ParseResult res) {
// Parsers are supposed to return at least empty ParseResults, but
// we'll be defensive here.
if (res==null) {
return;
}
if (DEBUG_PARSING) {
System.out.println("[DEBUG]: Adding parser notices from " +
res.getParser());
}
if (noti... |
dfc5ac9c-3fea-4705-b2f6-4ceabc3c40ee | 9 | public int typeCode() {
if (desc.length() == 1) {
switch (desc.charAt(0)) {
case BOOLEAN_CHAR:
return Type.BOOLEAN_CODE;
case CHARACTER_CHAR:
return Type.CHARACTER_CODE;
case FLOAT_CHAR:
return Type.FLOAT_CODE;
case DOUBLE_CHAR:
return Type.DOUBLE_CODE;
case BYTE_CHAR:
return Typ... |
781fbc2d-e64b-468d-b57b-cb868ca168e7 | 3 | public Collection<? extends Object> search(Object obj, Connection conn) {
if(obj instanceof Aluno){
return this.listAll(this.createSelectAlunoHistoricoCmd((Aluno)obj), conn);
}
else if(obj instanceof Turma){
return this.listAll(this.createSelectAlunosTurmaCmd((Turma)obj),... |
391f92d1-05d9-4010-b822-82471b2e4310 | 3 | public static void main(String[] args) throws IOException {
// file names : dealreport.txt and Serialized_Deals.dat
String fileNames[] = {"dealreport.txt", "Serialized_Deals.dat"};
try {
ZipOutputStream out_zip = new ZipOutputStream(
new BufferedOutputStream(
new FileOutputStream("out_zip.zip")));
... |
b55b1d79-5af5-44c2-a27b-e5e2e230663d | 8 | public double nextValue(int generatorID) {
long k,s;
double u=0.0;
if( generatorID>Maxgen) System.out.println( "ERROR: Genval with g > Maxgen\n");
s=Cg[0][generatorID]; k=s/46693;
s=45991*(s-k*46693)-k*25884;
if( s<0) s+=2147483647;
Cg[0][generatorID]=s;
u+=(4.65661287524579692e-10*s);
s=Cg[... |
adc60c70-1cd2-4871-a507-cb41687e192f | 2 | public static ArrayList<String> searchTicketProduct(Integer ID) {
Database db = dbconnect();
ArrayList<String> Array = new ArrayList<String>();
try {
String query = ("SELECT name FROM ticket_products WHERE TID = ?");
db.prepare(query);
db.bind_param(... |
364b92c2-30f8-4053-b773-6fa5b06034f3 | 2 | public void startServer(int port) throws CouldNotStartServerException {
logger.fine("Starting server on port " + port + "...");
synchronized(CONNECTION_LOCK) {
if(isRunning) {
logger.fine("Server is already started!");
throw new ServerAlreadyStartedException();
}
try {
socket = new DatagramSock... |
76de52b1-048c-4fe0-822c-1661d5eb8209 | 9 | private SlotState checkVerticalLines()
{
if(!((GridSlot)board[0][0]).isEmpty() && ((GridSlot)board[0][0]).getState().equals(((GridSlot)board[1][0]).getState()) && ((GridSlot)board[1][0]).getState().equals(((GridSlot)board[2][0]).getState()))
{
return ((GridSlot)board[0][0]).getState();
}
else if(!((GridSlot... |
fdb5b7dc-80cc-44c6-95cd-6ba0da47ebc1 | 0 | private JPanel getPanelOfComponents() {
JPanel panel = new JPanel();
toStringT = new JTextField(30);
toStringT.setFont(new Font("COURIER", Font.BOLD, 20));
panel.add(toStringT);
return panel;
} |
09e65583-b837-4b25-b8f4-bb240665b9f7 | 6 | public static void main(String[] args) {
//standard input
Scanner in = new Scanner(System.in);
int n = in.nextInt();
//if no temperatures provided
if(n <= 0) {
System.out.println(0);
in.close();
return;
}
//find the closest number to the zero
Integer closest = null;
for(int i = 0; i... |
6f8aaed4-8214-438e-81a6-2e499cb494d6 | 2 | @Override
public Action postAction(Action a) throws JSONException, BadResponseException {
Representation r = new JsonRepresentation(a.toJSON());
r = serv.postResource("intervention/" + interId + "/action", a.getUniqueID(), r);
Action action = null;
try {
action = new Action(new JsonRepresentation(r).get... |
1e2885fd-0b32-4c95-82fb-c913ceff2796 | 3 | @Override
public boolean equals(Object o)
{
if (o.getClass() != Tree.class) return false;
Tree t = (Tree)o;
LinkedList list = toLinkedList();
while (list.hasNext())
if (!t.contains(list.getNext())) return false;
return size == t.size();
} |
f2d9a6fd-2800-4843-97a1-579ed66cbdc7 | 5 | private void sendEventsToThem(Set<SimpleEntity> loadedEntities, int createdIfIdGreaterThan) {
for (SimpleEntity entity : loadedEntities) {
Map<Class<? extends Component>, Component> components = new HashMap<>();
for (Map.Entry<Class<? extends Component>, Component> originalComponents : e... |
7b26a4f2-6e82-4fac-8b03-dde7bcdcdb10 | 4 | public static boolean login(String userName, String password)
{
try {
String parameters = "user=" + URLEncoder.encode(userName, "UTF-8") + "&password=" + URLEncoder.encode(password, "UTF-8") + "&version=" + URLEncoder.encode(GlobalVar.Version, "UTF-8");
String result = Utils.excutePost(GlobalVar.AuthUR... |
a69cdcce-cd05-4d95-a93d-96d3e67d6917 | 1 | public Node getHeadNode(int linkedListLength){
if(linkedListLength==0){
return null;
}
Node node = new Node();
node.setData(count);
count++;
node.setNextNode(getHeadNode(linkedListLength-1));
return node;
} |
28193fe3-912b-44c2-a7d3-f3ed0eab8d84 | 2 | public static String combineStringArray(String[] words, String separator) {
String string = "";
for (String word : words) {
if (!string.isEmpty())
string += separator;
string += word;
}
return string;
} |
a4fa1588-90d4-4020-b78d-f5c60cf1e460 | 6 | public void addIntersectionAtCanvasLocation(int canvasX, int canvasY)
{
// FIRST MAKE SURE THE ENTIRE INTERSECTION IS INSIDE THE LEVEL
if ((canvasX - INTERSECTION_RADIUS) < 0) return;
if ((canvasY - INTERSECTION_RADIUS) < 0) return;
if ((canvasX + INTERSECTION_RADIUS) > viewport.leve... |
5405e1b6-6c7a-485f-b1af-6272438409d9 | 6 | public List<List<SetCard>> findMatches() {
//don't even bother if there aren't enough cards
if (cards.size() < 3) {
return null;
}
/*
* iterate through all of the cards, getting all possible permutations
* of SetCards...
*/
for (int i = 0; i < cards.size(); i++) {
SetCard card1 = cards.ge... |
ce56d7f0-60ba-4e7b-9fa9-45543a3aca61 | 2 | public void calcEffectiveRefractiveIndices(){
if(this.setMeasurementsTEgrating)this.calcTEmodeEffectiveRefractiveIndices();
if(this.setMeasurementsTMgrating)this.calcTMmodeEffectiveRefractiveIndices();
} |
0269d76a-aa47-41a3-92fd-b4e7297a730a | 7 | public Map getRecordByID(String table, String primaryKeyField, Object keyValue, boolean closeConnection)
throws SQLException, Exception {
Statement stmt = null;
ResultSet rs = null;
ResultSetMetaData metaData = null;
final Map record = new HashMap();
// do this in an... |
f664e337-9b77-467a-8fbf-2a53d463e19a | 1 | @Override
public void mouseWheelMoved(MouseWheelEvent e) {
float notches = e.getWheelRotation();
final double BY = 0.05;
if (notches > 0) {
vscale *= (1 + BY);
} else {
vscale *= (1 - BY);
}
setScale(vscale);
repaint();
} |
718f85c4-7e1a-4bef-9457-0e5ab3ff536a | 1 | public Map<String, String> getStyles() {
if (styles == null) {
styles = new HashMap<String, String>();
}
return styles;
} |
665477f1-1a49-4559-be03-c304be864407 | 4 | @EventHandler(priority = EventPriority.MONITOR)
public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
World world = player.getWorld();
String worldname = world.getName();
String playername = player.getName();
Boolean staff = false;
double x = (int) Math.floor(player.getLocati... |
41c5e114-a09d-41ad-b35f-d970592fd716 | 5 | public int saveContact(enmSavingMode aSavingMode, clsContactsDetails aContactDetails) throws SQLException {
//The creation id in the database.
int mIDContacts = 0;
//Create the entry in the Contacts table.
String mFormattedBirthdayDate = "";
if (aContactDetails.getBirthday() != n... |
664e2210-a7bb-4417-b674-2c6c6e5daa45 | 6 | public static void showGUI(TableModel tbl) {
final TableModel t = tbl;
/* 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.
... |
d5104b24-e3a7-4647-9569-f27c9dfdc0ba | 7 | public boolean hasPathSum(TreeNode root, int sum) {
boolean result1 = false;
boolean result2 = false;
if (root == null) {
return false;
}
if (root.val == sum && root.left == null && root.right == null) {
return true;
}
if (root.left != nul... |
e6cb04c2-2bbb-4c71-aabf-734a29a759ac | 0 | @Override
public void mousePressed(MouseEvent e) {} |
c59a32f0-fcbe-466b-9f4d-7baa57d3678e | 7 | public final boolean deleteAll()
{
if(!exists())
return false;
if(!canWrite())
return false;
if(CMath.bset(vfsBits, CMFile.VFS_MASK_NODELETEANY))
return false;
if(!mayDeleteIfDirectory())
return false;
if(demandVFS)
return deleteVFS();
if(demandLocal)
return deleteLocal();
final boolean... |
f5015d6d-c4b3-4adb-85e2-221db2752306 | 5 | public void GUI()
{
setUndecorated(true);
setSize(breite, hoehe);
setTitle(Read.getTextwith("installer", "name"));
setLocationRelativeTo(null);
setIconImage(new ImageIcon(this.getClass().getResource("src/icon.png")).getImage());
final Point point = new Point(0,0);
addMouseListener(new MouseAdapter(... |
23f16077-2f99-4c5d-9bd5-46d35f6255ac | 0 | public BSTNode(Term term){
this.term = term;
} |
86d7d764-e444-439f-bb30-4d8fd1db891c | 9 | public double[] distributionForInstance(Instance instance) throws Exception {
String stringInstance = instance.toString();
double cachedPreds[][] = null;
if (m_cachedPredictions != null) {
// If we have any cached predictions (i.e., if cachePredictions was
// called), look for a cached set ... |
6e922bb2-0931-4999-88cc-5f6e237abf0a | 8 | private void resolveValueGrid(Node parentNode) {
validateTagsOnlyOnce(parentNode, new String[]{"show_grid", "grid_step", "label_factor"});
boolean showGrid = true;
double gridStep = Double.NaN;
int NOT_SET = Integer.MIN_VALUE, labelFactor = NOT_SET;
Node[] childNodes = getChildNo... |
ce6de31f-d996-4dad-971f-bcfe7e5b6a8a | 9 | public boolean canMoveRight(){
int [][] temp = BlockInControl.getBlock();
int tempPosX = BlockPosX;
int tempPosY = BlockPosY;
for(int r = 0; r <4; r++){
for(int c = 0; c < 4;c++){
if(temp[r][c] == 1){
if(c ==3){
if(tempPosX+1 > MAX_COL-1)
return false;
if(board[tempPosY][tempPosX+1]==1)... |
07284cc9-62dc-4d0b-9f55-8e2cac274a96 | 4 | static void print(Poker[][] pers){
int len1 = pers.length;
for (int i = 0; i < len1 && i < 4; i++){
System.out.print(colors[i]+":");
int len2 = pers[i].length;
for (int j = 0; j < len2; j++){
if (pers[i][j] != null){
System.out.prin... |
4520f881-e436-42f8-a054-422cee98c56f | 0 | public User getUser() {
return user;
} |
24ef2490-05a5-4db4-a0c7-350a1f6e7e08 | 9 | private static Product getProduct(Serializable productID)
{
final Serializable productIDCopy = productID;
Product result;
synchronized (AutoAppro.products)
{
if ((result = AutoAppro.products.get(productID)) == null)
{
/* Try to find another that has a similar name */
for (Product p : AutoAppro.pr... |
867893d3-d950-4cbc-a630-adc9382c86a7 | 8 | public static void main (String[] args) {
// The pattern for generating a range of ranom numbers looks like so.
// (Math.random() * (Min - Max + 1)) + Min
// Here's what a basic ranom number looks like.
for (int i = 0; i < 100; i++) {
System.out.println( Math.random() );
}
/... |
0f7fcd5b-e28c-4035-83a1-222567a72aed | 4 | public static boolean canMove(){
IsoEntity other;
for (Iterator<IsoEntity> iie = PistolCaveGame.stop.iterator(); iie.hasNext(); ) {
other = iie.next();
if(secondPlayer){
if (PistolCaveGame.player2.collides(other) != null) return false;
}
else{
if (PistolCaveGame.player.collides(other) ... |
1b7f928f-cc92-48b4-b7c2-a9fa19d136a2 | 4 | public Object instantiate(String name) throws ClassNotFoundException {
String implementation = getProperty("me4se.implementation");
if(implementation != null) {
implementation += ";";
}
else {
implementation = "";
}
implementation += "o... |
bde1f9cc-4a81-469c-a4b8-c6fd2b8ba6ea | 4 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label,
String[] args) {
if (sender.hasPermission("bossbar.config")) {
if (args.length == 0 || args[0].equalsIgnoreCase("help")) {
getExecutor("help").onCommand(sender, cmd, label, args);
return true;
} else if (commandExist... |
24b71f2d-98fc-4697-97c3-ed956db67bf2 | 3 | private boolean checkTouchObject(int pos){
ArrayList<Line2D.Double> linies = this.getBoundLines();
boolean toca = false;
for (int i = 0; i < linies.size(); i++) {
for (int j = 0; j < Board.getObstacles().size(); j++) {
Rectangle r = new Rectangle((int)Board.get... |
26cb28a8-2e9d-4f59-bd65-4f267aea40b3 | 7 | public Object nextContent() throws JSONException {
char c;
StringBuffer sb;
do {
c = next();
} while (Character.isWhitespace(c));
if (c == 0) {
return null;
}
if (c == '<') {
return XML.LT;
}
sb = new Str... |
3465215d-46bc-43cf-8c8a-096309da25f8 | 9 | public final void setOptions(Map<String, ?> options) {
/* Is verification of YubiKey owners enabled? */
this.verify_yubikey_owner = true;
if (options.get(OPTION_YUBICO_VERIFY_YK_OWNER) != null) {
if ("false".equals(options.get(OPTION_YUBICO_VERIFY_YK_OWNER).toString())) {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.