method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
44842b87-6107-4ec9-8819-a7ef3918e3d1 | 4 | @Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
if(this._avalie_ == oldChild)
{
setAvalie((PExpLogica) newChild);
return;
}
for(ListIterator<PEstrCaso> i = this._... |
8c192b2d-dd15-4895-98f9-9d7cbfda8c48 | 0 | @Override
protected ConvertController initializeController(ConvertPane pane,
SelectionDrawer drawer, Automaton automaton) {
// TODO Auto-generated method stub
return new TuringConvertController(pane, drawer,
(TuringMachine) automaton);
} |
921707d2-26c7-4122-8062-282c0ca17c35 | 2 | public static boolean checkDone(boolean[] doneArray) {
boolean done = true;
for (int i = 0; i < doneArray.length; i++) {
if (doneArray[i] == false) {
done = false;
break;
}
}
return done;
} |
e8f34d09-d92d-4187-95df-abf055d1fb32 | 0 | String getPassCriteria()
{
return passCriteria;
} |
06794cc1-ad24-41f5-bf69-6baafd6807fc | 5 | final void method2471(byte i, int i_0_, int i_1_, int i_2_, int i_3_) {
if (!aBoolean10407) {
double d = (double) (i_3_ + -((Class318_Sub1) this).xHash);
double d_4_ = (double) (i_1_ + -((Class318_Sub1) this).anInt6388);
double d_5_ = Math.sqrt(d * d + d_4_ * d_4_);
aDouble10408 = ((double) ((Class... |
088d50b0-9b77-4957-a3b2-01a576f79132 | 9 | public void threadPreempt() {
int n = getMenuCount();
if (n == 0)
return;
PopupMenuListener listener = new PopupMenuListener() {
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
if (model == null)
return;
if (model.getJob() == null)
return;
if (model.getJob().isStopped())
... |
7197fe4e-9006-481e-aebd-4964f9087bd3 | 5 | public static double[][] readOtherData(Kattio io){
String tmp;
double[][] points=null;
int N=0;
//read until reached the EOF line
while(!(tmp=io.readLine()).equals("EOF")){
// System.out.println(tmp);
String sarr[]=tmp.split(" ");
// System.out.println(Arrays.toString(sarr));
//try to read th... |
c2a0a72b-6574-48f8-bfbf-ed550e2ecf5e | 5 | public static boolean sessionWrite(SessionState session, Server server) {
try {
DatagramSocket RPCSocket = new DatagramSocket();
RPCSocket.setSoTimeout(1000);
String callID = UUID.randomUUID().toString(); // A unique id for this call
String tempSend = callID + "^" + SESSIONWRITE_CODE + "^" + session.... |
e889d233-2395-4695-b814-68a9bc8ab222 | 4 | public double rollOut()
{
StateObservationMulti rollerState = state.copy();
int thisDepth = this.m_depth;
while (!finishRollout(rollerState,thisDepth)) {
//random move for all players
Types.ACTIONS[] acts = new Types.ACTIONS[no_players];
for (int i = 0; ... |
df53c9cc-81f4-452e-9fcc-a7478ed42cb6 | 4 | protected double getHitDirection (Rectangle bounds) {
// double angle = Vector.angleBetween(myCenter, new Location(bounds.getCenterX(), bounds.getCenterY()));
// BUGBUG: FIX ME --- this is very imperfect, but sort of works for now
if (bounds.contains(new Location(getLeft(), getY()))) {
... |
37d64f55-3c65-40a8-b561-4faa03e43639 | 7 | public LocalImage(File f) {
name = f.getName();
imageStack = new ArrayList<BufferedImage>(1);
//Handling of ACR file types
if(name.endsWith(".acr")){
FileImageInputStream imageFile = null;
try {
imageFile = new FileImageInputStrea... |
0b571859-bbdd-4b92-97b3-474b3939f16a | 0 | @Test
public void runTest1() throws IOException {
InfoflowResults res = analyzeAPKFile
("testAPKs/9458cfb51c90130938abcef7173c3f6d44a02720.apk", false, false, false);
Assert.assertTrue(res.size() > 0);
} |
4cf68e46-a185-48e7-8158-90fe1d47131b | 2 | @Override
public void run() {
while(!Thread.currentThread().isInterrupted()) {
int i = new Random().nextInt(10);
queue.put(i);
System.out.println("Put: " + i);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} |
531011ad-14ba-4768-8e50-87b5040c1bea | 7 | protected void eatCombinationThree() {
int magenta = 0;
int yellow = 0;
for (Iterator<Plant> it = plants.iterator(); it.hasNext();) {
Plant pl = it.next();
if (pl.getType() == Plant.MAGENTA_PLANT && magenta < 1) {
it.remove();
magenta++;
}
if (pl.getType() == Plant.YELLOW_PLANT && yellow < 1... |
82acab65-c329-4947-a2d8-5fa1d3eb1ece | 0 | public UUID getGameId() {
return gameid;
} |
d110b730-252f-4051-966d-5817beca48be | 7 | public void act(XmlAction action) {
if (action instanceof AddArrowLinkXmlAction) {
AddArrowLinkXmlAction arrowAction = (AddArrowLinkXmlAction) action;
MindMapNode source = modeController.getNodeFromID(arrowAction
.getNode());
MindMapNode target = modeContr... |
d7cf6968-ed2d-4811-bf0d-c89a11aeb562 | 6 | public void performAction() {
if (isConnected()) {
boolean first = getOutput()[0].getStatus();
if (this.isTurnedOn() && (getInput()[0].getStatus() || getInput()[1].getStatus())) {
getOutput()[0].setStatus(true);
}
else {
getOutput()... |
6bf80f3a-09d0-4bba-b4aa-3c98cd28129d | 4 | public String[] getImage() {
switch (state) {
case EATING:
return getEatImage();
case PLAYING:
return getPlayImage();
case SLEEPING:
return getSleepImage();
default:
case DEFAULT:
return getDefaultImage();
}
} |
ad678317-06b2-48f1-a3b1-71b891ee1238 | 3 | @Override
public void assignValue(Designator d, BasicBlock cur, BasicBlock join, Environment env, Value newVal)
throws Exception {
if(global) {
used = true;
}
if(!(d instanceof ArrayDesignator)) {
throw new Exception("Array accessed as a variable");
}
... |
0870d750-894f-4e42-a658-96ee686ecf4e | 1 | public void dump(String line) {
if (startPos == -1) {
pw.print(line);
} else {
pw.print(line.substring(0, startPos));
dumpRegion(line);
pw.print(line.substring(endPos));
}
} |
0d093322-34a5-4a9d-b595-5f9f31502b62 | 0 | public void setFaultString(String faultString) {
this.faultString = faultString;
} |
69d7d5e9-1ce7-4659-b912-40e867a99dd3 | 5 | public void setConsulta(String[] param, String tabla, String clave, String condicion, String valor){
switch(tabla){
case "miembros":
ManejadorMiembros.getInstancia().mostrarDatosDownline(param, clave, condicion, valor);
break;
case "productos":
ManejadorProductos.getInstancia().mostrarDatoDelProducto... |
632397bf-1e17-48fb-b343-bc1251cc7353 | 8 | public Element deserializeFromFile(String fileName) {
root = null;
curr = null;
try {
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser saxParser = factory.newSAXParser();
DefaultHandler handler = new DefaultHandler() {
@Ove... |
a25ee6f2-53fd-4593-b08c-f9f5dbe1fed5 | 3 | @Override
public boolean isOK() {
if (! super.isOK() ) return false;
for (String p: XMLCacheDataKeys)
if (getProperty(p) == null)
return false;
return true;
} |
197ac233-063a-4365-8c9f-c96ebc669800 | 2 | @Override
public ByteBuf serialize(O_01_CallInput ucpOperation) {
ByteBuf bb = Unpooled.buffer();
Serialization.serializeString(bb, ucpOperation.getAdc());
Serialization.serializeString(bb, ucpOperation.getOadc());
Serialization.serializeString(bb, ucpOperation.getAc());
char mt = ucpOperation.getMt();
S... |
c339c6df-a62f-4b91-948b-9394ac73106a | 6 | public static Boolean setBlockAt(float x, float y, float z) {
for (Chunk chunk : ChunkManager.LoadedChunksList) {
if (chunk.x == x * 6 && chunk.z == z * 6) {
for (float i = 0; i < 8; i += 1) {
for (float k = 0; k < 8; k += 1) {
for (float ... |
21c917fe-4fea-48af-9230-f2d12849ecf4 | 5 | public static boolean checkUpdatesUpdater() {
double currentVerison=0;
double version=0;
//Nastavi trenutno verzijo posodobljevalnika na verzijo, ki
//je zapisana v datoteki "version.txt"
try {
BufferedReader in=new BufferedReader(new InputStreamReader(new FileInputS... |
b9c40284-5311-4b3f-80a8-1720925202fc | 1 | public void draw(Graphics graphics) {
graphics.drawImage(background, 0, 0, null);
for (Entity entity : entitiesToSprites.keySet()) {
Image image = entitiesToSprites.get(entity);
Vector2f position = entity.position();
graphics.drawImage(image, position.x(), position.y... |
b51d506d-4fbc-4009-b7e6-599ccbd249ac | 4 | public static Entity genEntity(World world, int ID, Vector2f loc) throws SlickException
{
switch(ID)
{
case 0:
return new EntityDummy(world, loc, "res/textures/entity/TestEntity.png");
case 1:
return new EntityMelee(world, loc, "res/textures/entity/SlowEnemy.png", new float[] {32, 32}, 128, 0.6F, 320.0F,... |
c01566bc-97cd-461c-a4bd-5bfcef4ea298 | 1 | public final EsperParser.elseif_return elseif() throws RecognitionException {
EsperParser.elseif_return retval = new EsperParser.elseif_return();
retval.start = input.LT(1);
Object root_0 = null;
Token ELSEIF34=null;
EsperParser.statements_return statements35 =null;
... |
1dcaeba0-e9c1-4744-9467-25f6bd1a6918 | 5 | public static void simpleCommand(String string) {
switch (string) {
case "help":
ChatHandler.log("You can use commands: " + "/ping, " + "/stop, " + "/toggledebug and " + "/walkspeed=value");
break;
case "ping":
ChatHandler.log("pong");
break;
case "hp":
ChatHandler.log(Realm.player.getLives() + "... |
9a544c5a-23d1-481f-9da0-a45111f74107 | 8 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
BookstoreGenreEntity that = (BookstoreGenreEntity) o;
if (genreid != that.genreid) return false;
if (description != null ? !description.equals(... |
3e41b4c0-afa2-4b30-99ff-f483bae4f730 | 9 | public void connectToDatabase() throws Exception {
if (m_Debug) {
System.err.println("Connecting to " + m_DatabaseURL);
}
if (m_Connection == null) {
if (m_userName.equals("")) {
try {
m_Connection = DriverManager.getConnection(m_DatabaseURL);
} catch (java.sql.SQLException e) {
// T... |
232868ba-b0f7-4ba8-926f-7d7d6fca498a | 0 | public static void f() throws Exception {
System.out.println("originating the exception in f()");
throw new Exception("thrown from f()");
} |
a1cae04b-4676-4248-a904-a93c6d1dda0d | 8 | @Override
public int strstr(char[] pattern, char[] string) {
if (pattern == null || string == null) {
return -1;
}
int pat = 0;
int start = 0;
boolean isMatching = false;
int index = -1;
int cnt = 0;
while (start < string.length) {
if (pattern[pat] == string[start]) {
if (!isMatching) {
... |
a105c534-c23b-4dd4-a1d6-96a239507f5c | 8 | public static List getWhynotJustifications(QueryIterator query, String label, KeyValueList mapping) {
{ List justifications = null;
if (query == null) {
query = Logic.$MOST_RECENT_QUERY$;
}
if (mapping == null) {
mapping = ((KeyValueList)(Logic.$MOST_RECENT_EXPLANATION_MAPPING$.ge... |
850948dd-1a87-4ad3-a317-b5c467a9b123 | 1 | public void method326(Stream buffer) {
anInt535 = buffer.getUnsignedByte();
anIntArray536 = new int[anInt535];
anIntArray537 = new int[anInt535];
for (int i = 0; i < anInt535; i++) {
anIntArray536[i] = buffer.getUnsignedShort();
anIntArray537[i] = buffer.getUnsignedShort();
}
} |
14cc5fd5-1f08-4143-8f1d-27e42ea89bdf | 0 | public VertexSet getLaenderList() {
return this.laenderList;
} |
87ac6b40-857b-45da-999d-d56d5df4320b | 7 | @Override
public HandshakeState acceptHandshakeAsClient( ClientHandshake request, ServerHandshake response ) {
if( failed ) {
return HandshakeState.NOT_MATCHED;
}
try {
if( !response.getFieldValue( "Sec-WebSocket-Origin" ).equals( request.getFieldValue( "Origin" ) ) || !basicAccept( response ) ) {
ret... |
7508e5a4-b5fb-4202-8f8f-a29133cedd7a | 2 | public void draw() {
if (useShader)
ARBShaderObjects.glUseProgramObjectARB(program);
// Coloring the box
GL11.glLoadIdentity();
GL11.glColor3f(red, green, blue);
GL11.glBegin(GL11.GL_QUADS);
GL11.glVertex2f(x - width / 2, y - height / 2);
GL11.glVertex2f(x + width / 2, y - height / 2);
GL11.glVertex2... |
00f86752-ec4f-4cb0-9d95-681e9adbcf09 | 9 | public int maxArea(int[] height) {
int max = 0;
if (height == null || height.length < 2) {
return max;
}
int left = 0;
int right = height.length - 1;
while (left < right) {
int tmax = (right - left) * Math.min(height[left], height[right]);
... |
87374445-0b12-443c-902c-888d9b3af472 | 0 | public double getExpected()
{
return p5;
} |
6a289c20-9ec8-40b2-9959-d7ab6526182c | 6 | public static String unescape(String string) {
int length = string.length();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < length; ++i) {
char c = string.charAt(i);
if (c == '+') {
c = ' ';
} else if (c == '%' && i + 2 < length) {
... |
68d1b789-fb2b-448c-af63-52c5aed6849e | 0 | public TakeWhileIterable(Iterable<T> source, Predicate<T> predicate)
{
this._source = source;
this._predicate = predicate;
} |
7ab7ef8b-96e6-4e8b-86f1-9342d3aa0263 | 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 fe... |
4c47afdb-f32f-4489-93cb-8bbf82e0e8b7 | 0 | @Override
public boolean isEmpty() {
return plays.isEmpty();
} |
51c5fcba-9573-4e63-b93a-4505e58ad031 | 2 | public JSONArray names() {
JSONArray ja = new JSONArray();
Iterator keys = keys();
while (keys.hasNext()) {
ja.put(keys.next());
}
return ja.length() == 0 ? null : ja;
} |
ddff4eb9-aad9-4f75-bd52-88053200a77e | 7 | protected void undanceAllByThis(MOB mob, MOB invoker)
{
if(mob!=null)
for(int a=mob.numEffects()-1;a>=0;a--)
{
final Ability A=mob.fetchEffect(a);
if((A instanceof Dance)
&&(!A.ID().equals(ID()))
&&((invoker==null)||(A.invoker()==null)||(A.invoker()==invoker)))
((Dance)A).undanceMe(mob,inv... |
f40846c6-a206-4a9c-a4bc-d3d0d5d5c403 | 5 | public static Data getDataFromFile(File input) throws FileNotFoundException {
Data data = new Data();
Scanner s = new Scanner(input);
String row = null;
String relation = null;
while (s.hasNext() && (relation = getRelation(row)) == null) {
row = s.nextLine();
}
data.setRelation(relation);
while (s.... |
92d2fde8-58bf-428f-af29-72db5cc60e23 | 3 | private synchronized void updateGridletProcessing()
{
// Identify MI share for the duration (from last event time)
double time = GridSim.clock();
double timeSpan = time - lastUpdateTime_;
// if current time is the same or less than the last update time,
// then ignore
... |
be1fedd1-921f-4efb-93e4-36ee7bd52934 | 9 | private void btFiltrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btFiltrarActionPerformed
//Modelo de tabela
DefaultTableModel tableModel = (DefaultTableModel)this.tbPesquisa.getModel();
//Setar imagem do lblImg para null
this.lblImg.setIcon(null)... |
e6b8a5e1-b13e-4d88-ae4b-171cf191285c | 5 | public void paint(Graphics g) {
super.paint(g);
if (ingame) {
Graphics2D g2d = (Graphics2D)g;
if (craft.isVisible())
g2d.drawImage(craft.getImage(), craft.getX(), craft.getY(),
this);
ArrayList ms = craft.getMissiles()... |
25a21cd8-f192-482d-b2f1-a071fb91497e | 6 | @Override
public boolean runTest(){
return (!parrotTrouble(true, 7) &&
!parrotTrouble(false, 6) &&
parrotTrouble(true, 21) &&
!parrotTrouble(false, 21) &&
parrotTrouble(true, 23) &&
!parrotTrouble(false, 23)&&
!parrotTrouble(true, 20));
} |
64bc8878-c3b7-4ac3-a182-69fec25aadee | 9 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
while ((line = in.readLine()) != null && line.length() != 0) {
int size = Integer.parseInt(line.trim());
if(size ... |
39194c93-1c7c-46f6-bcd1-df70fa387d3f | 7 | public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new FileReader(args[0]));
String l;
while ((l = br.readLine()) != null) {
String[] z = l.split("\\ ");
int a = Integer.parseInt(z[0]);
long n = Long.parseLong(z[1]);
Map<String, Integer> m = new Hash... |
1ed2374a-5cc2-48b6-89b9-38292d1fb54b | 7 | public void readAndInitialize() throws IOException {
HashMap<String,ArrayList<Task>> taskMap = data.getTaskMap();
ArrayList<String> autoWords = data.getAutoWords();
try {
BufferedReader br = new BufferedReader(new FileReader(data.getFileName()));
int totalLabel = Integer.parseInt(br.readLine());
for(int ... |
d15c9ff0-38a4-4fd3-a905-c8af411868ed | 0 | public Callback getCallback() {
return callback;
} |
e6138306-d72d-4e12-bb31-b15ddf9e5f6c | 4 | public ArrayList<MapEdge> getRoads(double x1, double y1, double x2, double y2) {
if (nw.canZoom(x1, y1, x2, y2)) return nw.getRoads(x1, y1, x2, y2);
if (ne.canZoom(x1, y1, x2, y2)) return ne.getRoads(x1, y1, x2, y2);
if (sw.canZoom(x1, y1, x2, y2)) return sw.getRoads(x1, y1, x2, y2);
if ... |
24ab9156-d6b3-4c34-bc2f-82316b824ac0 | 0 | public SpriteSheet(File path) {
this.path = path;
load();
} |
30bad696-df3e-4cbe-8795-4f92bff41199 | 1 | public static void main(String[] args) throws InterruptedException {
new Thread(new MyRunnable()).start();
new Thread(new MyRunnable()).start();
new Thread(new MyRunnable()).start();
new Thread(new MyRunnable()).start();
try {
Thread.sleep(1000);
} catch (Inte... |
8ec8f12d-f6cf-4776-b001-705887b0b67e | 4 | private void streaming()
{
// Number of milliseconds in sleep.
long sleep = _configuration.getLongValue(SNConnectorKeys.CONF_SLEEP_KEY.getId(), DEFAULT_SLEEP);
// Sets how many events must have received to start sending the data.
int eventsThreshold = _configuration.getIntValue(SNConnectorKeys.CONF_EVENTS_THRE... |
6c350468-5803-4702-b5e6-52f880a9f475 | 2 | @Test
public void testResolveSimpleFacts() throws Exception {
final UnificationStrategy unifier = new RobinsonUnificationStrategy();
KnowledgeBase knowledgeBase = new KnowledgeBase();
knowledgeBase.registerRule(new Rule(new Predicate("father_of", new Constant("john"), new Constant("mark")))... |
f0eaa9a0-1a4e-409f-9a24-29e4e02ec20e | 4 | public String tag(String text, String token, String type) throws Exception {
String[] textSplit = text.split(token);
String textFomat = "";
String close = "";
boolean tag = false;
try {
for (int x = 0; x < textSplit.length; x++) {
if (tag) {
... |
99b9b946-fb3e-4242-a7e0-659f52e23b12 | 3 | public void initialize(String rootDirPath)
throws ParserConfigurationException, SAXException, IOException {
if (rigidBodiesBranchGroup.numChildren() != 0
|| lightsBranchGroup.numChildren() != 0
|| wireframeRigidBodiesBranchGroup.numChildren() != 0) {
clear();
}
assetLibrary.clear();
assetLibrary.... |
67d39100-89ec-449c-88b4-46944728aebf | 9 | private int jjMoveStringLiteralDfa8_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(6, old0, 0L);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(7, active0, 0L);
return 8;
}
switch(curChar)
{
ca... |
98861981-2e32-458c-bba8-e782b5f8d12b | 8 | protected void modeOne(MouseEvent e, MainMenu mm, Main m) {
int tx = mm.getTx();
int ty = mm.getTy();
int tw = mm.getTw();
int th = mm.getTh();
int gx = mm.getGx();
int gy = mm.getGy();
int gw = mm.getGw();
int gh = mm.getGh();
if (e.getX() > tx ... |
8e68de86-27ec-485a-84a3-2b1e7b2d6a03 | 1 | public static void main(String args[]) throws InterruptedException{
//RejectedExecutionHandler implementation
RejectedExecutionHandlerImpl rejectionHandler = new RejectedExecutionHandlerImpl();
//Get the ThreadFactory implementation to use
ThreadFactory threadFactory = Executors.defaultT... |
b45113e4-fae6-40ed-83ca-a20922ca724a | 3 | public CycList<E> flatten() {
final CycList<E> result = new CycList<E>();
final Iterator<E> i = this.iterator();
while (i.hasNext()) {
E obj = i.next();
if (obj instanceof CycList) {
result.addAll(((CycList) obj).flatten());
} else {
result.add(obj);
}
} //end whi... |
8393c38f-191b-4ebf-ad31-b59ec120b58e | 7 | @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 = t... |
2a71bfa8-173c-4eb4-a28e-32b57a960ef1 | 1 | public String getCode(){
String str = this.printLineNumber(true) +
this.operand.getCode() + this.place + " := ";
if(!this.isPostFix){
str += this.operator.getValue() + this.place;
}
else{
str += this.place + this.operator.getValue();
}
return str + "\n";
} |
076cd3e8-9eee-4ec5-89a3-66f2bd3759be | 4 | public void addBoats(int posXB1, int posYB1, String orientationB1, int sizeB1, int posXB2, int posYB2, String orientationB2, int sizeB2, int posXB3, int posYB3, String orientationB3, int sizeB3) {
try {
playerBoatList.add(new Boat(game, sizeB1, player, posXB1, posYB1, orientationB1));
pl... |
1dac3382-7015-4468-843a-3ddb52b8e153 | 7 | public void setMinMaxValue(double minValue, double maxValue, boolean filterArchivedValues) throws IOException {
if (!Double.isNaN(minValue) && !Double.isNaN(maxValue) && minValue >= maxValue) {
throw new IllegalArgumentException("Invalid min/max values: " + minValue + "/" + maxValue);
}
... |
c7f693be-c493-4c3f-bf49-c9fca67453ae | 2 | @Override
public void selectGame(String gameName) {
currentgame = null;
// Find spil
for (int i = 0; i < games.size(); i++) {
if (games.get(i).getName().equals(gameName)) {
// Vi har fundet spillet
currentgame = games.get(i);
}
... |
0b8b15c7-0d02-4a40-a81b-023c0c78e672 | 6 | private void affichage_messages(int i){
int ID_message = filemessages.get(i).getId();
//System.out.println("ID=" + ID_message);
switch (ID_message) {
//deplacement1
case(0x100):
int positionX = 0;
int positionY = 0;
int anglesign = 0;
chaine_affich = chaine_affich + "[" + i + "]" + filemessages.ge... |
8ebbf40d-d902-487e-9dc9-9cbe16373591 | 0 | private void loadAllCardImagesAndSetUpCardDimensions() {
Dimension d;
CardImageLoadUp.loadAndSetUpAllCardImages(this);
d = CardImageLoadUp.getDimensionOfSingleCard();
cardWidth = d.width;
cardHeight = d.height;
} |
ed31da77-14f1-449a-85af-0e1456d8d196 | 8 | private void openMenuButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openMenuButtonActionPerformed
if(openFC.showOpenDialog(this) == javax.swing.JFileChooser.APPROVE_OPTION)
{
File file = openFC.getSelectedFile();
String str = "";
try{
... |
a92f70dd-a852-4a45-86f3-db0b6c8bc595 | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final CarteTroupe other = (CarteTroupe) obj;
if (!Objects.equals(this.troupe1, other.troupe1)) {
re... |
a6d58b0f-76b9-4313-b838-73dfe3a18ab8 | 3 | private void init() {
// 在内存中创建图片
int width=85, height=20;
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
// 获取图片上下文
Graphics g = image.getGraphics();
// 生成随机类
Random random = new Random();
// 设定背景色
g.setColor(getRandColor(200,250)); ... |
375ff26e-7de8-47c1-ba7a-0b77cea212f8 | 5 | public static void main(String[] args)
{
KlassenDAOImpl k = new KlassenDAOImpl();
LehrerDAOImpl l = new LehrerDAOImpl();
UnterrichtDAOImpl u = new UnterrichtDAOImpl();
Lehrer l1 = new Lehrer(1, "Gustav", "Zimmerer");
Lehrer l2 = new Lehrer(2, "Peter", "Maurer");
Lehrer l3 = new Lehrer(3, "Thomas",... |
aaffafa9-20a4-4784-94aa-96f79eeade85 | 3 | private int rightGenerateX(Object obj)
{
if (obj.getClass().equals(DynamicImagePanel.class))
{
int X = ((DynamicImagePanel)obj).getX();
X = X + ((DynamicImagePanel)obj).getParent().getX();
return X;
}
else if (obj.getClass().equals(TickerPanel.class))
{
int X = ((Tic... |
b905641e-2a65-4400-972b-4a7e3037df37 | 8 | public boolean isPalindrome(int x) {
if (x < 0) {
return false;
}
String s = String.valueOf(x);
if (s.length() == 1) {
return true;
}
char[] allDigits = s.toCharArray();
int begin;
int end;
if (s.length() % 2 == 0) {
begin = s.length() / 2 - 1;
end = s.length() / 2;
} else {
begin = s... |
1ba518e1-fb7a-40d3-a17b-e52214631238 | 5 | public void jouerEnRoyaumeDuFeu(JFrame page, Sac sac, RoyaumeDuFeu rdf) {
partieRestanteAjouer--;
if (this.getNom().compareTo("Freyja") == 0) {
Freyja f = (Freyja) this;
f.setaJouerEnRoyaumeDuFeu(f.getaJouerEnRoyaumeDuFeu() + 1);
}
aJouerEnRoyaumeDuFeu = true;
... |
fb25f30b-3de9-4c4f-8a03-5a4ed1d2d152 | 9 | int getKeyFlag(int code){
switch(canvas.getGameAction(code)){
case Canvas.UP: return GameCanvas.UP_PRESSED;
case Canvas.DOWN: return GameCanvas.DOWN_PRESSED;
case Canvas.LEFT: return GameCanvas.LEFT_PRESSED;
case Canvas.RIGHT: return GameCanvas.RIGHT_PRESSED;
case Canvas.... |
0cbd560c-da5a-4a4d-aca7-b1019bb4b927 | 6 | @EventHandler
public void CreeperFastDigging(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getCreeperConfig().getDouble("Creeper.... |
1becb51d-9ad4-4887-a85a-7fc9240e7008 | 3 | @Override
public void validarSemantica() {
try {
Tipo izquierdo=id.validarSemantica();
Tipo derecho=valor.validarSemantica();
if(!izquierdo.esEquivalente(derecho)){
try {
StringBuilder message=new StringBuilder("Err... |
fe2d6fa0-b81f-4900-a1c3-ad8ecddcbc8b | 1 | public static Connection getConnection(){
if(MyConnection.instance==null){
MyConnection.instance = new MyConnection();
}
return instance.con;
} |
ba2c08ff-d786-4ad0-aa25-6d32205511f6 | 3 | public void cancelOrder(java.lang.String orderID) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[6]);
_call.setUs... |
90efdf35-5c5d-4dd1-a35a-3c49eba2cef3 | 2 | public void compute() {
// Fire as continuously as gun heating will allow.
if (getGunCurrentTemp() < getGunUnjamTemp() && fires)
fire((float)(Math.random() * 360.0));
// Might as well wait the gun can be reloaded
Utility.delay(getGunReloadDurationMillis());
} |
a0924b54-8f35-4b42-81f4-3c8b22b7ef80 | 1 | public static String getFileExtName(String path) {
path = getFileName(path);
if (path.lastIndexOf(".") > -1)
return path.substring(path.lastIndexOf(".") + 1);
return path;
} |
5d91002a-c249-4e5b-a115-421e65533d80 | 5 | public void triggerNote(World var1, int var2, int var3, int var4) {
if(var1.getBlockMaterial(var2, var3 + 1, var4) == Material.air) {
Material var5 = var1.getBlockMaterial(var2, var3 - 1, var4);
byte var6 = 0;
if(var5 == Material.rock) {
var6 = 1;
}
if(var... |
8ff89711-c9f7-4ccc-83e6-0a0773d8a1b6 | 2 | @Override
public void run() {
while (true) {
try {
Socket s = ss.accept();
DataInputStream din = new DataInputStream(s.getInputStream());
data = din.readUTF();
repaint();
din.close();
s.close();
... |
d88d8c27-0a03-4f30-bc1d-35676a15f160 | 0 | public Customer getCustomer(Long id) {
return this.em.find(Customer.class, id);
} |
b5f3fb52-3f42-48b2-aba2-40b5e42ee1eb | 8 | @Override
public int loop() {
methods.resetTimer();
if (methods.checkBurn()){
vars.need_to_burn = true;
}
if (methods.stopBurn()){
vars.need_to_burn = false;
}
if (methods.animation_timer.getRemaining() > 0){
return (50);
... |
dfa8a84e-8d36-4b4a-ad1a-a9a6043c5342 | 0 | @Override
public void setNachname(String nachname) {
this.nachname = nachname;
} |
46f6a50e-c3b5-4628-a724-a0c1ef8f997a | 1 | public static void createXml(List<WordWithCount> sortedList, Writer outputWriter, int maxListSize) throws IOException {
final int wordsCount = Math.min(maxListSize, sortedList.size());
XmlWriter writer = new XmlWriter(outputWriter, false, 0, true);
writer.writeEntity("wordlist");
for (i... |
0d0556c0-4f4c-48ee-8e5c-516927079044 | 2 | public static Version get(Object obj)
{
if(obj instanceof String)
{
return new Version((String)obj);
}
if(obj instanceof Double)
{
return new Version((Double)obj);
}
return null;
} |
cf045344-5ae6-47f3-a2a3-1a32603e132a | 9 | public void acceptOffer(Offer offer, News news) {
sellNeg.remove(offer);
offer.getBuyer().getTransfer().buyNeg.remove(offer);
if (offer.isImmediately()) {
offer.getPlayer().setMinFee(false);
offer.getPlayer().getMotivation().reset(offer.getPlayer());
if (offer.getTrade() != null) {
offer.getTrade().s... |
28452e43-0ad7-48b2-8982-f1a8e0e28349 | 9 | public void tick() {
if (input.up.clicked) selected--;
if (input.down.clicked) selected++;
int len = options.length;
if (selected < 0) selected += len;
if (selected >= len) selected -= len;
if (input.attack.clicked || input.menu.clicked) {
if (selected == 0) {
Sound.test.play();
game.resetGame(... |
46a90609-3a2b-4441-a35c-1a65247ca95d | 6 | public static int[] getLocationOfAdjacentCell(int x, int y, int direction) {
int[] pos = {x, y};
switch(direction) {
case 0:
pos[0]++;
break; //(x+1, y)
case 1:
pos[0]+=y%2;
pos[1]++;
break; //if even(y) then (x, y+1) else (x+1, y+1)
case 2:
pos[0]+=y%2-1;
pos[1]++;
... |
01659286-af73-41a3-8fb1-1df6cdd2ae67 | 3 | public Object getValueAt(int row, int col) {
if (row > -1 && col > -1 && data != null) {
return data[row][col];
} else {
return null;
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.