method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
8a1c45da-996a-4eda-86b6-1574bd558ca4 | 0 | public final boolean isPruned() { return pruned; } |
0548bc7b-4745-4555-b79c-c7ba041a0eee | 3 | public static void main(String[] args){
int primeCount =0;
int i = 0;
while(true){
if(isPrime(i)){
primeCount++;
if(primeCount ==10001){
break;
}
}
i++;
}
System.out.println(i);
} |
44b2854f-761e-45da-b61c-bd91bb0e97b3 | 8 | public void start_run_single(int n){
Random ran = new Random();
jade.math.ExponentialDistribution disp = new jade.math.ExponentialDistribution();
disp.setFallOff(0.5);
jade.math.ExponentialDistribution ext = new jade.math.ExponentialDistribution();
ext.setFallOff(10);
double cur_disp = 0.5;
double cur_ext... |
a38b5012-dbf5-496e-b82e-46a1b1d35b37 | 0 | public static void main(String[] args)
{
SwingUtilities.invokeLater(new Kurs());
} |
2efde29f-2b9e-4916-95f7-8241be25a91f | 2 | public static void main(String[] args)
{
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= 10; j++)
{
System.out.print("Богдан" + " ");
}
System.out.println();
}
} |
cd766017-0d8c-42c5-9e15-fdb7bea3e78c | 0 | public void setCp(String cp) {
this.cp = cp;
} |
c937c509-8f42-4535-a1c0-e6becde7de55 | 9 | static int findASolution(double[][][] graph, int[] assigned) throws Exception {
//loop: while there are still tasks that need to be assigned
//1. pick new unassigned task randomly
//2. assign that task to an agent using "action choice rule"
// init capacities
double[] capacities = new double[NUM_AGENTS];
... |
8b2b4df4-bdc0-442b-84e6-d345e6d9c6e6 | 2 | private void openStream(final String param){
String appended = zybezUrl.concat(param);
try {
zybez = new URL(appended);
urlConnection = zybez.openConnection();
urlConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1... |
cd5aa87e-1fc4-4f7f-8ff1-8929a3620ddb | 8 | public void setType(int type) {
this.type = type;
//set color
switch (Math.abs(type)) {
case 1:
inner1 = new Color(215, 15, 55);
inner2 = new Color(254, 78, 113);
backgroundColor = new Color(247, 32, 57);
left = new Colo... |
be3b5ccb-b269-4253-be98-f232450d067d | 4 | @EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
Block b = event.getClickedBlock();
if ((b.getType() == Material.SIGN_POST) || (b.getType() == Material.WALL_SIGN)) {
... |
c6a0b3d3-3b60-4e4e-bb84-24631daf48ee | 1 | public boolean isWrapperFor(Class<?> iface) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
} |
743751bd-099d-4083-a395-4882a85e76c2 | 4 | private static String getISBNFromTitle(BufferedReader reader, VideoStore videoStore, String title) throws
SQLException {
int choice;
LinkedList<Pair<String, String>> whereClauses = new LinkedList<Pair<String, String>>();
whereClauses.add(new Pair<String, String>("Title LIKE ?", '%' +... |
cb43e4e8-39e4-44ed-bad1-dab179a00f0d | 0 | public static void main(String args[]) throws Exception
{
Socket socket = new Socket("127.0.0.1",6868);
//启动读写线程
new ClientInputThread(socket).start();
new ClientOutputThread(socket).start();
} |
f5a314fb-a2a9-4e2f-b6a2-b835559fe979 | 1 | private void markSubroutines() {
BitSet anyvisited = new BitSet();
// First walk the main subroutine and find all those instructions which
// can be reached without invoking any JSR at all
markSubroutineWalk(mainSubroutine, 0, anyvisited);
// Go through the head of each subrout... |
0e665c09-084a-481f-bb7e-0ac5ecb26d93 | 2 | @Override
public int compareTo(PrioritizedTask o) {
//复写此方法进行任务执行优先级排序
// return priority < o.priority ? 1 :
// (priority > o.priority ? -1 : 0);
if(priority < o.priority)
{
return -1;
}else
{
if(priority > o.priority)
... |
72b4f63f-3788-4d97-bd6b-4daabc18b3dd | 6 | public static void waitComment(String msg){
java.util.StringTokenizer st = new java.util.StringTokenizer(msg, " \t\n", true);
String sWrapped = "";
int lineLen = 0;
int crStop = 70;
while( st.hasMoreTokens() ){
String tok = st.nextToken();
if( lineLen == 0 && (tok.startsWith( " " ... |
42cdbd5f-61a2-48f6-b09e-383a3a122df5 | 5 | @Override
public void setString( String s ) {
if( s.length() == 0 )
s = "[]";
else{
if( Character.isWhitespace( s.charAt( 0 ) ) || Character.isWhitespace( s.charAt( s.length()-1 ) )){
s = "[" + s + "]";
}
else if( s.charAt( 0 ) == '[' &... |
e42a62c9-fa58-4eb2-9e86-fccfe95d632f | 0 | public String getCity() {
return City;
} |
f08e4dcf-da01-451c-92b2-68cb23dbcaee | 8 | public Player[] getWinners() {
int winner = -1;
Player players[] = this.players;
for(int i = 0; i < players.length && winner < 0; ++i) {
Player p = players[i];
if( p.equals( this.getBestPlayerBet() ) ) {
winner = i;
}
}
int winnerTeammate = 0;
int loser = 0;
int loserTeammate = 0;
if... |
40150676-f403-4673-ace8-98035e1f98a6 | 9 | public void addFamData(String entry, Family ind)
{
String delim = "[ ]+";
String[] tokens = entry.split(delim);
String tag = tokens[1];
int month = 1;
if(tag.equalsIgnoreCase("HUSB"))
{
ind.setHusb(tokens[2]);
}
else if(tag.equalsIgnoreCase("WIFE"))
{
ind.setWife(tokens[2]);
}
else if(ta... |
235bdf72-27f9-407c-9991-3f22725db006 | 2 | public void notifyUserListChanged() {
try {
for(String user : _userStore.keySet()) {
System.out.println("user: "+user);
_userStore.get(user).updateUserList(getBuddies(user));
}
} catch (RemoteException e) {
System.out.println("Error: " + e.getMessage());
}
} |
988da847-79af-425b-93bc-b50add13dea7 | 2 | public static ArrayList<String> readFile (String path) {
try {
BufferedReader reader = new BufferedReader(new FileReader(new File(path)));
ArrayList<String> contents = new ArrayList<String>();
String data = "";
while((data = reader.readLine()) != null){
... |
c17ad4d4-08aa-4daa-82b6-d42e0b346453 | 0 | public int getFormat() {
return format;
} |
ce96f9da-eea3-41af-8f50-393b613458f6 | 8 | public Tile[][] getNewWorld(int width, int height) {
MapGenerator g = new MapGenerator(seed);
int[][] mapData = g.generateWorld(width/10, height/10);
width = mapData.length * 10;
height = mapData[0].length * 10;
//Resets the spawn points.
this.resetSpawnPoints();
//Create grass everywhere.
Tile[][... |
87ef214d-24d1-4e09-90d3-8d49ed7eee0d | 5 | public static boolean setDebugging(String debuggingString) {
if (debuggingString.length() == 0 || debuggingString.equals("help")) {
usageDebugging();
return false;
}
StringTokenizer st = new StringTokenizer(debuggingString, ",");
next_token: while (st.hasMoreTokens()) {
String token = st.nextToken().i... |
5c828e40-1016-46ce-89bd-b22b899ca8de | 3 | public char nextClean() throws JSONException {
for (;;) {
char c = this.next();
if (c == 0 || c > ' ') {
return c;
}
}
} |
10af7c5d-c170-45ef-96d2-1931d7cc37a3 | 0 | @Test
@TestLink(externalId = "T1")
public void testSuccessExternal() {
assertTrue(true);
} |
2a457234-6796-4bb5-84f5-429e767d9a4a | 9 | public static void main(String[] args){
String str = "0123456789";
long w, sum = 0;
String temp = "";
while(true){
w = Long.parseLong(str);
//System.out.println(w);
if(Integer.parseInt(str.substring(1,4))%2==0){
if(Integer.parseInt(str.substring(2,5))%3==0){
if(Integer.parseInt(str.subs... |
40db2092-108b-4d06-bb58-2fecd858c6ac | 4 | private void addRoad(Tile temp, Point position)
{
MapObject obj = new Road(temp, sfap.objSize, this.TILE_SIZE, position);
if (Collision.noCollision(grid, obj.getStartPos(), obj.getEndPos()))
{
if (!Collision.intersects(obj.getPlace(), gridBoundary))
{
this.mapObjects.add(obj);
for (int index = 0; i... |
b5012ae8-157f-4caf-89f3-412b55bc0950 | 4 | protected List<Integer> getAllPrimes() {
boolean[] sito = new boolean[MAX_X];
for (int i = 1; i < sito.length; i++) {
sito[i] = true;
}
ArrayList<Integer> list = new ArrayList<Integer>();
for (int i = 0; i < sito.length; i++) {
if (sito[i]) {
int i1 = i + 1;
list.add(i1);
int x = 2;
in... |
cdd8a6e6-938e-4e69-ab82-7f00424df09e | 6 | protected BeardTemplateReferences extract(String tpl) {
BeardTemplateReferences result = new BeardTemplateReferences () ;
int len = tpl.length(), i;
String tag = null;
char character;
for (i = 0; i < len; i++) {
character = tpl.charAt(i);
if (tag != nul... |
90b4de86-00d8-45c2-bb4a-28340d1b3a02 | 4 | private OccurrenceReport getTotalOccurencesOnPage(String editorText,
boolean isCaseSensitive, String searchingText, int currentSearchingPosition) {
int lastSearchingPosition = -1;
int cnt = 0;
OccurrenceReport report = new OccurrenceReport();
if (!isCaseSensitive) {
editorText = editorText.toLowerCase... |
88f5cc82-37c8-4433-8603-1b97b1435688 | 1 | public void testWithPeriodAfterStart3() throws Throwable {
Period per = new Period(0, 0, 0, 0, 0, 0, 0, -1);
Interval base = new Interval(TEST_TIME_NOW, TEST_TIME_NOW);
try {
base.withPeriodAfterStart(per);
fail();
} catch (IllegalArgumentException ex) {}
} |
2c32d820-ca1b-4ccc-b46e-67fba0739f13 | 6 | private List<Cubie> getFaceCubies(Face face) {
List<Cubie> cubes = null;
switch(face) {
case FRONT:
cubes = this.getFrontFaceCubes();
break;
case LEFT:
cubes = this.getLeftFaceCubes();
break;
case TOP:
cubes = this.getTopFaceCubes();
break;
case RIGHT:
cubes = this.getRightFa... |
2a4047b6-1a69-4412-a188-a091baa4910a | 0 | protected void initDefaultCommand() {
// This command makes the shooter automatically time out if no command
// uses it for 5 seconds
CommandGroup timeout = new CommandGroup("Time out shooter");
timeout.addSequential(new DoNothing(),5);
timeout.addSequential(new SpinDown());
... |
bac28769-5b6c-471e-8243-9a5f2f84ee3e | 9 | private void checkCollision() {
Player p = null;
List<Minion> badguys = new ArrayList<Minion>();
for(Entry<Client, Entity> entry : clientEntityPairs){
Entity e = entry.getValue();
if(e instanceof Player){
p = (Player) e;
} else if (e instanceof Minion){
badguys.add((Minion) e);
}
}
for(... |
54f1fef5-27f7-4ca6-a5bb-60bc6461c7e2 | 1 | public boolean loadImage() {
try {
img = ImageIO.read(new File(filename));
}
catch (IOException e) {
img = null;
return false;
}
return true;
} |
68658557-41de-4807-9ea1-280098d44f8c | 2 | public URL find(String classname) {
if(this.classname.equals(classname)) {
String cname = classname.replace('.', '/') + ".class";
try {
// return new File(cname).toURL();
return new URL("file:/ByteArrayClassPath/" + cname);
}
catch ... |
dbecccc0-c028-4115-a0fb-016e4e69c85b | 3 | public final static void quietSleep(int milliSeconds) {
if (milliSeconds <= 0) {
return;
}
if (Config.getDebug()) {
int min = Math.round(milliSeconds / 60000);
int sec = Math.round((milliSeconds / 1000) % 60);
Output.println("Sleep for " + min + ":" + sec + " (" + milliSeconds
+ ")", Output.DEB... |
8c57c872-ea20-41c3-9849-bc704fcabef2 | 5 | @SuppressWarnings("unchecked")
String getStringValue(Object obj, int k) {
if ((obj instanceof ArgHolder<?>)
&& ((ArgHolder<?>) obj).getType().equals(String.class)) {
return ((ArgHolder<String>) obj).getValue();
} else if (obj instanceof String[]) {
return ((String[]) obj)[k];
} else {
... |
c1847f87-dd4d-4427-b140-5dd51a287f0e | 8 | public void actionPerformed(ActionEvent e) {
if(e.getActionCommand().equals(ok.getActionCommand())){
try {
String selectedType = (String) typeOfEdges.getSelectedItem();
Configuration.setEdgeType(selectedType);
String selectedTransModel = (String) selectedTransmissionModel.getSelectedItem();
if... |
838f77d7-761b-487b-b182-2850a25af521 | 7 | @Override
public void draw(Graphics g) {
g.setColor(Color.BLACK);
g.fillRect(0, 0, width, height);
g.setColor(new Color(50, 50, 50));
g.drawLine(100, 100, 400, 100);
g.drawLine(100, 250, 400, 250);
g.drawLine(100, 400, 400, 400);
for (int x = 0; x < 300; x++) {... |
11ae0bca-76c0-4a35-ac4f-d16bfe29e370 | 4 | public void startServer() {
while(!shutdown) {
try {
clientSocket = new SocketManager(serverS.accept());
if(serviceList.size() < userLimit) {
Service service = new Service(clientSocket, ip);
serviceList.add(service);
new Thread(service).start();
} else {
clientSocket.Escribir("599 E... |
86620945-8167-4c1d-acbd-255732b63f99 | 6 | public void keyPressed(KeyEvent key){
switch (key.getKeyCode()){
case KeyEvent.VK_UP:
player.moveY(-1);
break;
case KeyEvent.VK_LEFT:
player.moveX(-1);
break;
case KeyEvent.VK_RIGHT:
player.moveX(1);
break;
case KeyEvent.VK_DOWN:
player.moveY(1);
break;
case KeyEvent.VK_E:
coll... |
5ca55244-e85a-4211-8b58-3511ca95ef9f | 0 | @Override
public void valueChanged(ListSelectionEvent e) {
// TODO Auto-generated method stub
} |
96619b31-0da9-4baa-a4ad-4d6d9433bd22 | 0 | public FileSender(int packageSize, String destinationIpAddress,
String fileName, int destinationPort, int verbose) {
this.packageSize = packageSize;
this.destinationIpAddress = destinationIpAddress;
this.fileName = fileName;
this.destinationPort = destinationPort;
this.verbose = verbose;
} |
1ae7724a-6026-484e-b584-39b5eb12fbe6 | 3 | @SuppressWarnings("rawtypes")
protected boolean isEnum(Class clazz, Object obj) {
if (!clazz.isEnum()) {
return false;
}
for (Object constant : clazz.getEnumConstants()) {
if (constant.equals(obj)) {
return true;
}
}
return ... |
0e14331b-512f-47ac-beca-2c958dfabe93 | 3 | public void circle(double x, double y, double r) {
if (r < 0) throw new RuntimeException("circle radius can't be negative");
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2*r);
double hs = factorY(2*r);
if (ws <= 1 && hs <= 1) pixel(x, y);
else... |
95509465-3c72-420f-b7c1-c66bb867450c | 9 | @Test
public void MultiNOTTest() {
int num_bits = 4;
Node reg = new MultiNOT(num_bits);
ConstantNode in[] = new ConstantNode[num_bits];
for (int i = 0; i < num_bits; i++) {
in[i] = new ConstantNode(true);
in[i].connectDst(0, reg, i);
}
for (int i = 0; i < num_bits; i++) {
in[i].propagate();
}... |
5f9c5009-c8fc-4d6d-bab1-b78fb8794798 | 7 | private void go (Checker checker) {
if (dontScan) {
return;
}
if (init(checker)) {
if (checker != null) {
checker.enqueueNotify(25, null);
}
if (findBeans((checker))) {
if (checker != null) {
chec... |
ee74e685-ce12-4c87-8196-9de8594a3f95 | 8 | private byte[] readASCII(byte[] data, int start, int end) {
// each byte of output is derived from one character (two bytes) of
// input
byte[] o = new byte[(end - start) / 2];
int count = 0;
int bit = 0;
for (int loc = start; loc < end; loc++) {
char c = (c... |
1dcadf16-95cb-4b0d-bab4-ce5eb3dc8bc2 | 4 | @Override
public boolean remove(Object o)
{
if (o != null) {
int i = index(o.hashCode());
synchronized (table[i]) {
Node<E> p = table[i], n = p.next;
while (n != null) {
if (n.element == o || n.element.equals(o)) {
p.next = n.next;
return true;
}
p = n;
n = n.next;
... |
dee59fa0-890f-4a32-a096-4097144b47b3 | 8 | private String getHtmlForAction(WikiContext context, String action, String title)
throws ChildContainerException, IOException {
if (action.equals("view") || // editable
action.equals("viewparent") || // view parent version read only
action.equals("viewrebase")) { // view r... |
87b4d916-398f-49d0-a1d5-3a46edad9862 | 3 | public void writeMatchObjectSimple(MatchObject NEW) throws FileNotFoundException {
// Create a new TeamLabelObject and add the elements to it.
matchReader read = new matchReader();
ArrayList<MatchObject> NAME;
try {
NAME = (ArrayList<MatchObject>)read.readMa... |
3ded0108-7849-46fb-8c82-312b3c959f0e | 4 | public PowerUp(int type, double x, double y){
this. type = type;
this.x = x;
this.y = y;
if(type == 1){
color1 = Color.PINK;
r =3;
}
if(type == 2){
color1 = Color.YELLOW;
r =3;
}
if(type == 3){
color1 = Color.YELLOW;
r =5;
}
if(type == 4){
color1 = Color.WHITE;
r =3;
}
... |
bcd348d0-11f8-4e4b-a686-2e0bc9752e9d | 6 | private void throwExceptionIfNodeDoesntBelongToTree(Object node) {
boolean result = false;
if (node instanceof GenericTreeNode) {
GenericTreeNode<? extends PropertyChangeSupporter> ttn = (GenericTreeNode<? extends PropertyChangeSupporter>) node;
while (!result && ttn != null) {... |
73b42835-a48b-45e4-b8ec-529d6ab06ed2 | 0 | public static void main(String[] args) {
int x = 1;
x += 1;
System.out.println(x); // 2
x *= 2;
System.out.println(x); // 4
x -= 3;
System.out.println(x); // 1
x /= 4;
System.out.println(x); // 0
float y = 1f;
y += 1;
System.out.println(y); // 2.0
y *= 2;
System.out.println(y); // 4.0
y -= 3;
System.o... |
dcef80e1-eb26-426b-8170-6180817ad39c | 9 | private Set<Integer> findGivenValueInRow(int value, int startPoint, int numberOfFinds) {
Set<Integer> valueLocations = new HashSet<Integer>();
int foundNumber = 0;
int element = (this.getSize() * this.getSize());
if (startPoint < element) {
//startPoint--;
} else {
startPoint--;
}... |
95c8065e-f377-4615-ae7a-cd58501b67b2 | 5 | public void run(){
try{
boolean done = false;
while(!done){
done = true;
for(int y = 0 ; y < 9; y++){
System.out.println("");
for(int x = 0; x < 9; x++){
String value = this.field[y][x].toStr... |
e6530da9-94a4-4c05-b9ec-64aefb28261c | 0 | @Test
public void test_isGameOver() {
assertNotNull(game);
assertEquals(false, game.isGameOver());
} |
d3cc2b1d-f152-4865-8135-b1abed0c8a32 | 2 | public static StopPlaceTypeEnumeration fromValue(String v) {
for (StopPlaceTypeEnumeration c: StopPlaceTypeEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
68b9450e-aad6-44fb-afea-c0ad6719ba83 | 0 | @Column(name = "FES_ID_POS")
@Id
public Integer getFesIdPos() {
return fesIdPos;
} |
f55aba41-2400-4854-9380-49df24d74701 | 6 | public boolean getBoolean(int index) throws JSONException {
Object o = get(index);
if (o.equals(Boolean.FALSE) ||
(o instanceof String &&
((String) o).equalsIgnoreCase("false"))) {
return false;
} else if (o.equals(Boolean.TRUE) ||
... |
823b2a61-047e-4571-a329-7a2570f753ed | 4 | public static void main(String[] args) {
ArrayList<ArrayList<Integer>> lists = new ArrayList<ArrayList<Integer>>();
lists.add(new ArrayList<Integer>());
lists.add(new ArrayList<Integer>());
setReader();
int row = 1;
ArrayList<Integer> newList = lists.get(row%2);
ArrayList<Integer> oldList = lists.get... |
73f14318-51c8-4b5b-8535-5b06477c4fa8 | 3 | public void onBlockAdded(World var1, int var2, int var3, int var4) {
if(this != Block.stairSingle) {
super.onBlockAdded(var1, var2, var3, var4);
}
int var5 = var1.getBlockId(var2, var3 - 1, var4);
int var6 = var1.getBlockMetadata(var2, var3, var4);
int var7 = var1.getBlockMetadat... |
a8657f9b-cd04-49e7-a935-042708d19cd4 | 3 | public double[] backpropogate(double[] protosigma){
if (protosigma.length != neurons.size()){
throw new RuntimeException("Neurons size does not match!");
}
for (int i = 0; i < protosigma.length; i++){
neurons.get(i).backpropogate(protosigma[i]);
}
double[] result = new double[entryPoints.size()];
fo... |
e083b87d-c151-40e0-b95b-715eaade2300 | 2 | @Before
public void setUp(){
for(int i = 0; i < 20; i++){
if(i % 2 == 0){
solutionFitness.put(i, (double)i * 2);
}else{
solutionFitness.put(i, (double) i);
}
}
classUnderTest.setSolutionFitness(solutionFitness);
} |
af07f5fe-950b-4585-9ecd-c29111a043aa | 1 | SpecialistWorkType getSpecialistWorkType(){
double t = nextRand();
if ( t < 0.8 )
return SpecialistWorkType.PRESCRIBE;
else
return SpecialistWorkType.HOSPITALIZE;
} |
1fc5eb5f-10bd-43d5-99f9-4df06d390f94 | 6 | public static boolean markAsExplicitAssertionP(Justification self) {
if (((Keyword)(Logic.$EXPLANATION_STYLE$.get())) == Logic.KWD_BRIEF) {
if (self.inferenceRule == Logic.KWD_PRIMITIVE_STRATEGY) {
{ Keyword testValue000 = ((PrimitiveStrategy)(self)).strategy;
if ((testValue000 == Logic.KWD... |
91bc0189-e2db-4025-afc6-7c16f40c3fe7 | 2 | private String createId(ArrayList<Rod> currentRodList, ArrayList<Rod> possibilitiesLeft) {
StringBuilder id = new StringBuilder();
for(Rod rod : currentRodList) {
id.append(rod.getIndex());
}
id.append(":");
for(Rod rod : possibilitiesLeft) {
id.append(rod.getIndex());
}
return id.toString();
} |
2d607263-aff0-4113-b023-0d1762dddd36 | 9 | public List<Key> getSecretKeys()
{
try
{
Pattern keyIDPattern = Pattern.compile("sec\\s+\\w+/(\\w+)\\s+.*");
Pattern uidPattern = Pattern.compile("uid\\s+(\\S+[^<>]*\\S+)\\s+<([^<>]*)>.*");
List<Key> ret = new LinkedList<>();
List<String> list = new LinkedList<String>();
list.add("--list-secret-ke... |
7bf762b1-296b-4555-a22b-7a0ed17259f8 | 0 | @Test
public void testGetS2() {
System.out.println("getS2");
PickUp instance = new PickUp(6,9);
int expResult = 9;
int result = instance.getS2();
assertEquals(expResult, result);
} |
7747f1ab-f924-41cb-8688-8a2ff9e84b6a | 2 | public void doFlat() {
switch (ai.getDirection()) {
case LEFT:
setAnimation(new String[]{"goombaFlatLeft"});
break;
case RIGHT:
setAnimation(new String[]{"goombaFlatRight"});
break;
}
setDead(true);
} |
644d6b7c-5301-4eb1-8b44-6dde6e3127d6 | 3 | public void saveProperties() {
FileOutputStream outputStream = null;
try {
outputStream = new FileOutputStream(this.file);
this.properties.store(outputStream, "MaintenanceServer Properties");
} catch (IOException e) {
MaintenanceServer.LOGGER.warning("Failed ... |
7a5c9462-22db-4bd1-aaa0-2d5562c2a4e3 | 2 | private Matrix4f GetParentMatrix()
{
if(m_parent != null && m_parent.HasChanged())
m_parentMatrix = m_parent.GetTransformation();
return m_parentMatrix;
} |
e4029963-9d80-4080-a2ea-d26bfebfca16 | 4 | public static void main(String[] args) {
final int n = 9;
System.out.print("*| ");
for (int i = 1; i <= 9; i++){
System.out.print(i+" ");
}
System.out.print("\n-+-");
for (int i = 1; i <= 9; i++){
System.out.print("--");
}
for (int i = 1; i <= n; i++){
System.out.print("\n"+i+"|");
for (int ... |
881ed4cf-c972-4ff2-aa4b-861547ab3006 | 1 | private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
JFileChooser fichero = new JFileChooser();
int opcion = fichero.showOpenDialog(this);
if(opcion == JFileChooser.APPROVE_OPTION)
{
this.jTextField3.setText(fichero.g... |
4982983e-1f1c-4c19-a105-c6c3c09aa867 | 6 | public Map<String, Long> getCounterMap() {
return counterMap;
} |
049a7665-6867-4a9a-9250-d5f1a41bc9a4 | 4 | @Override
public void paintBorder(Component component, Graphics gc, int x, int y, int width, int height) {
Color color = gc.getColor();
if (mLeftThickness > 0) {
gc.setColor(mLeftColor);
gc.fillRect(x, y, mLeftThickness, height);
}
if (mRightThickness > 0) {
gc.setColor(mRightColor);
gc.fillRect(x ... |
eb2bb88f-f3a8-442c-b7bc-31444bfb892c | 7 | public void testRoot3() {
setTree(new TreeNode("dummy"));
Map refcounts = Collections.synchronizedMap(new HashMap());
refcounts.put(new TreeNode("leaf1"), new Integer(1));
refcounts.put(new TreeNode("root1"), new Integer(0));
refcounts.put(new TreeNode("leaf2"), new Integer(1));
... |
a65bfb70-a0ca-496d-9ba8-2fbd2030384c | 3 | public static double gammaMode(double mu, double beta, double gamma) {
if (beta <= 0.0D) throw new IllegalArgumentException("The scale parameter, " + beta + "must be greater than zero");
if (gamma <= 0.0D) throw new IllegalArgumentException("The shape parameter, " + gamma + "must be greater than zero");
double mo... |
b9de9011-5499-4280-8148-ac3d8e85f14b | 4 | public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_UP) { //Presiono flecha arriba 1
direccion = 1;
buenoMov = true;
} else if (e.getKeyCode() == KeyEvent.VK_DOWN) { //Presiono flecha abajo 2
direccion = 2;
buenoMov = true;
} els... |
baade63c-a36b-4b77-9c78-5f7c54cddc1f | 4 | private void deleteBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteBtnActionPerformed
try {
connectDb();
int selectedRow = questionTable.getSelectedRow();
rowID = (questionTable.getModel().getValueAt(selectedRow, 1).toString());
int e... |
16abcbd3-ded6-4799-a07b-b6452875aa74 | 2 | private void substracTrackButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_substracTrackButtonMouseClicked
// TODO add your handling code here: Resta una pista del calendario.
//Habilita o deshabilita el boton substract(<<)si el calendario esta vacio.
if (substracTrackButton.... |
9d8f50ba-0c6c-4aaa-98d5-b39c4fb887e0 | 8 | public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[15];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 4; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
if... |
103e2db4-3fd1-48a9-b522-4f7da88802f5 | 1 | @Test
public void unEnrollsStudentToActivity() {
Student s = null;
Activity a = null;
try {
s = familyService.findStudent(1);
a = activityService.find(1);
} catch (InstanceNotFoundException e) {
fail("Activity not exists");
}
activityService.enrollmentStudentInActivity(s, a);
activityService.un... |
96351cf7-a48b-45e3-be80-c502baf225bb | 4 | private void createMinimap() {
Graphics2D mapGraphics = null;
int mapWidth = (map.getWidth() * map.getTileWidth());
int mapHeight = (map.getHeight() * map.getTileHeight());
minimap = new BufferedImage(mapWidth, mapHeight, BufferedImage.TYPE_INT_ARGB);
mapGraphics = (Graphics2D) ... |
11c6bf88-7b09-4434-87d7-c9ab085ce456 | 1 | public boolean suspend(User toSuspend, Date until){
if(isSuspended(toSuspend)) return false;
Suspended sus = new Suspended(toSuspend, until);
this.suspendedUsers.add(sus);
save();
return true;
} |
826d52c1-ffce-4f64-806a-14fc1e9629e6 | 7 | private void fillTransitions() {
transitions = new int[template.getAnswerGroups().size()];
for (int i = 0; i < template.getAnswerGroups().size(); i++) {
AnswerGroup answerGroup = template.getAnswerGroups().get(i);
int j = i + 1;
if (j >= template.getAnswerGroups().s... |
f56f5774-2193-4e7a-91a3-ab9a1483cc07 | 3 | public static void removeSelected() {
if (Main.selectedId != -1 && !Main.getSelected().locked) {
RSInterface rsi = Main.getInterface();
if (rsi.children != null) {
int index = getSelectedIndex();
rsi.children.remove(index);
rsi.childX.remove(index);
rsi.childY.remove(index);
}
UserInterfac... |
a2c49b0c-c2d9-4e05-8de9-5594a6da96d2 | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0
... |
c1673e8c-f14b-4b57-af7d-1695c85a6fac | 2 | public UserlistPreview(SkinPropertiesVO skin, JPanel parent) {
if ((skin == null) || (parent == null)) {
IllegalArgumentException iae = new IllegalArgumentException("Wrong parameter!");
throw iae;
}
this.skin = skin;
this.parent = parent;
} |
5bf3d6cf-a370-4acd-8f9b-e118c81cf3cc | 3 | public void handleSlider(JSlider source){
if(source.getValueIsAdjusting()){
int delay = source.getValue();
if(delay > 0){
aTimer.setDelay(100*(11-delay));
if(aTimer.isRunning()){
aTimer.restart();
}
}
... |
b6e65d9b-1112-4ac0-bd58-7dfc5d7e6ca1 | 2 | public LRParseTableDerivationPane(GrammarEnvironment environment) {
super(new BorderLayout());
Grammar g = environment.getGrammar();
augmentedGrammar = Operations.getAugmentedGrammar(g);
if(augmentedGrammar == null) return;
JPanel right = new JPanel(new BorderLayout());
// right.setLayout(new BoxLayo... |
651135ad-3f2b-4fff-837b-7fc696b3ec2c | 7 | private boolean isOverridden(ProgramElementDoc pgmdoc, String level) {
Map<?,String> memberLevelMap = (Map<?,String>) memberNameMap.get(getMemberKey(pgmdoc));
if (memberLevelMap == null)
return false;
String mappedlevel = null;
Iterator<String> iterator = ... |
6d52f1a1-48a8-45dd-a3cc-48e51c93d7f4 | 7 | @Override
public int myResource()
{
if(lastResourceTime!=0)
{
if(lastResourceTime<(System.currentTimeMillis()-(30*TimeManager.MILI_MINUTE)))
setResource(-1);
}
if(myResource<0)
{
if(resourceChoices()==null)
setResource(-1);
else
{
int totalChance=0;
for(int i=0;i<resourceChoices(... |
b88ee905-bd0a-429d-b2a1-5d954b42bcad | 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... |
6f2bcb84-6fce-4ab2-adba-6915bbfacacd | 2 | public void setTipoInteres(float tipoInteres) {
if (tipoInteres > 100
|| tipoInteres < 0) {
return;
}
this.tipoInteres = tipoInteres;
} |
e895e557-82c0-4720-a4b5-824d73840137 | 1 | public String annaSeuraava(){
if (tila == KertausmaatinTila.TYHJA){
arvoSeuraavaKerrattavaRivi();
}
return kertaaTama(moneskoRivi);
} |
6f778596-bbce-458b-9948-5f5949844fde | 1 | public void map_click_ntf(int x, int y, int btn, int mod) {
Gob pgob;
synchronized (glob.oc) {
pgob = glob.oc.getgob(playergob);
}
if (pgob == null)
return;
Coord mc = pgob.position();
Coord offset = new Coord(x, y).mul(tileSize);
mc = mc.add(offset);
wdgmsg("click", JSBotUtils.getCenterScreenCoor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.