method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e7e45d7e-46e3-461e-af09-66ee7fa53a33 | 1 | protected void createFrame()
{
MyInternalFrame frame = new MyInternalFrame();
ScribbleApplet pad = new ScribbleApplet();
frame.add(pad.getContentPane());
frame.setVisible(true);
desktop.add(frame);
try
{
frame.setSelected(true);
}
catch (java.beans.Pr... |
7561adb3-b0db-4f6f-9621-27d87c678301 | 1 | public boolean isValidProduction(Production production) {
try {
checkProduction(production);
return true;
} catch (IllegalArgumentException e) {
return false;
}
} |
44c52b46-52bc-4367-a9cd-40000cede585 | 2 | @Override
public void doLoopAction() {
if (hit) {
super.ai();
}
if (changeAni) {
setAnimation();
changeAni = false;
}
} |
498ed6ff-b75e-4696-a9e4-8d9a921df6fd | 9 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == startMissionButton) {
if(Board.getInstance().getTurn().getTurnType()==null){
Board.getInstance().initTurn();
}
TileContainerPanel.setBetable(true);
for (TilePanel panel : TileContainerPanel.getTilePanels()) {
panel.n... |
30e1ff11-7852-4ed5-9492-9554de4a7719 | 1 | @Override
public boolean Render3D(double _deltaTime) {
//TODO: Tighten the graphics on level 3.
//If the game is visible render your game.
if(application.isVisible()) {
}
return true;
} |
07e508f0-d15b-46c2-a671-07db68eb24d4 | 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... |
1f6373de-c5ea-4f7c-b59e-e9869095f5b8 | 9 | @Override
public void run() {
for (int i = 0; i < 4; i++) {
if (linesToBlow[i] != 99) {
for (int j = 0; j < 10; j++) {
tokens[linesToBlow[i]][j].flash();
}
}
}
refresh();
... |
47334237-be28-47c3-91e7-9554d16f9321 | 5 | @Override
protected void sort(final int[] a) {
index.set(0);
ArrayList<Callable<Void>> list = new ArrayList<Callable<Void>>();
for (final int i : a) {
Callable<Void> thread = new Callable<Void>() {
@Override
public Void call() {
... |
0c075f15-2c57-4192-ae6b-c2c0327bdaa0 | 7 | 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.");
... |
671edc6d-a47f-4fac-93a2-9c67fa368efd | 1 | public static void main(String[] args) {
try {
UIManager.setLookAndFeel("com.jgoodies.looks.plastic.PlasticXPLookAndFeel");
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
//ignored
}
SwingU... |
5b3ab789-303b-45ef-ad5a-b91c9e42d620 | 6 | private String getClusterTextNote(int index) {
String note = "...";
switch (index) {
case (1):
note = "Advanced: Questions with few answers appearing to be difficult.";
break;
case (2):
note = "FAQ: Frequently Asked Question!";
break;
case (3):
note = "3 Shots: Questions with low score, little ... |
0097fc7c-4e4e-4a6b-b017-738041571bb1 | 2 | private static void sendServerMessage( Server server, String message ) {
for ( ProxiedPlayer p : server.getInfo().getPlayers() ) {
for ( String line : message.split( "\n" ) ) {
p.sendMessage( line );
}
}
} |
a48b8014-94fd-4744-bd0e-5b8fc8d58fe4 | 9 | public void Run()
{
// make sure game started properly
if (Initialize())
{
while(mIsRunning)
{
// handles window events
Display.update(true);
mGameTime.Update();
while (Keyboard.next())
{
GameProperties.GetInputHandler().HandleKeyboardEvent();
gameStates.peek(... |
0f5d952f-15e1-4b47-a54e-9d1b92252b72 | 5 | private MenuItem createEditMenu(Menu menuBar) {
//Edit menu.
MenuItem item = new MenuItem(menuBar, SWT.CASCADE);
item.setText(resAddressBook.getString("Edit_menu_title"));
Menu menu = new Menu(shell, SWT.DROP_DOWN);
item.setMenu(menu);
/**
* Add a listener to handle enabling and disabling
* some items in ... |
61155a66-6c54-4a03-a2fc-cfafc8062c13 | 7 | private static void load(String[] argv)
{
int argCount = argv.length;
for (int cnt = 0; cnt < argCount; cnt++)
{
// current string must start with "-"
if ((argv[cnt] == null) || (!argv[cnt].startsWith(ArgumentPrefix)))
continue;
// strip o... |
22d46d2c-a66b-4fc6-aa7f-88039ce9e80f | 7 | public void createNewGame(Playmode playmode, User[] user) throws IndexOutOfBoundsException{
int i = 0;
for (Team team : playmode.getTeams()) {
while(team.getCurrentPlayerCount() < team.getTeamSize()){
team.addUser(user[i]);
i++;
}
}
Game game = new Game(playmode);
int matchType = Match.TEST;
i... |
0b48ab50-c231-4060-bffe-7c8cb7ff58aa | 0 | public void setPopFecmod(Date popFecmod) {
this.popFecmod = popFecmod;
} |
d98955c0-3f9e-4bfb-8bed-64a4ea73a44c | 8 | public void readDataBase() {
try {
//Class.forName("com.mysql.jdbc.Driver");
java.sql.Driver d = (java.sql.Driver)Class.forName("solid.jdbc.SolidDriver").newInstance();
String connectSQL = "jdbc:solid://localhost:2315/dba/dba";
connect1 = DriverManager.getConnection(connectSQL);
connect2 =... |
ae684a7f-e8de-4478-8805-54b8a6e770d1 | 8 | @Override
protected void map(Writable key, VectorWritable value, Context context)
throws IOException, InterruptedException {
omega.computeYRow(value.get(), yRow);
// compute outer product update for YtY
if (yRow.isDense()) {
for (int i = 0; i < kp; i++) {
double yi;
... |
177d390c-4051-4c7e-9a17-f8e03bb307e2 | 5 | @Override
public List<Framedata> translateFrame( ByteBuffer buffer ) throws InvalidDataException {
buffer.mark();
List<Framedata> frames = super.translateRegularFrame( buffer );
if( frames == null ) {
buffer.reset();
frames = readyframes;
readingState = true;
if( currentFrame == null )
currentFra... |
ebe14911-3291-4f1b-832c-6e8123387172 | 8 | public void processConnectRequest(ServerCnxn cnxn, ByteBuffer incomingBuffer) throws IOException {
BinaryInputArchive bia = BinaryInputArchive.getArchive(new ByteBufferInputStream(incomingBuffer));
ConnectRequest connReq = new ConnectRequest();
connReq.deserialize(bia, "connect");
if (LO... |
6dec991d-9806-47eb-a9e5-195dd8aa5f74 | 8 | public static void main(String[] args) {
EvolvingGlobalProblemSetInitialisation starter = new EvolvingGlobalProblemSetInitialisation();
starter.initLanguage(new char[] { '0', '1' }, 10, "(1(01*0)*1|0)*");
int solutionFoundCounter = 0;
int noSolutionFound = 0;
List<Long> cycleCount = new LinkedList<Long>();
... |
d07c69e6-5e67-4694-8f86-04c40768dd18 | 4 | final boolean needsMod() {
return this.elements.contains(this.MOD_DATE)
|| this.elements.contains(this.MOD_DAY)
|| this.elements.contains(this.MOD_MONTH)
|| this.elements.contains(this.MOD_MONTH_STRING)
|| this.elements.contains(this.MOD_YEAR);
} |
a4f86b6e-73e1-4940-9af3-40809e6c33f6 | 6 | @Override
public synchronized int calculatePlayerScore(PlayerQuizInstance quizInstance, Map<Question, Integer> guesses) throws RemoteException {
int playerQuizInstanceScore = 0;
//if guesses were not submitted, set quiz to not played to avoid blocking admin from closing it
if (guesses.isEmpt... |
9b2e9996-00c5-4599-ae3a-fe790746a24a | 2 | public void printAllFiles()
{
System.out.println("Printing out the database");
try {
ResultSet result = printAllFiles.executeQuery();
while (result.next())
{
String fileName = result.getString("FileName");
Timestamp start = result.getTimestamp("StartTime");
Timestamp end = result.getTimesta... |
b5e50ee5-ba5d-4eba-98a1-28a4125f722c | 2 | private void jTextFieldInterlocuteurCpRechercheKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextFieldInterlocuteurCpRechercheKeyReleased
try {
List<projetrf.model.Ville> vv1 = RequetesVille.rechercheVilleByCp(jTextFieldInterlocuteurCpRecherche.getText().trim());
... |
3cb256d2-5fab-49ba-92cb-844757ada153 | 2 | public static double avers(double a){
if(a<0.0D && a>2.0D) throw new IllegalArgumentException("avers argument (" + a + ") must be <= 2 and >= 0");
return Math.acos(1.0D - a);
} |
57a1e261-e83b-4585-9850-f413fa3b13ef | 2 | @Override
public void bid(String username, int itemId) {
for(Auction auc : search){
if(auc.getId() == itemId){
auc.currentBid++;
auc.owner = username;
}
}
} |
6bd124ff-c193-46f6-afa0-7896b31ea1cf | 7 | public void renderFilter()
{
image = loader.getImage();
raster = image.getRaster();
int[] pixels = new int[image.getWidth() * image.getHeight() * Constants.PIXEL_ARRAY_NO_ALPHA];
raster.getPixels(0, 0, image.getWidth(), image.getHeight(), pixels);
for(int i = 0; i < pixels.length; i += 3)
{
r = pixels... |
372530c2-31b6-4f8c-a88d-e37fedf4511e | 7 | @EventHandler
public void WitherSlow(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.getZombieConfig().getDouble("Wither.Slow.Dodge... |
cc4bcb42-8f58-4c09-81e2-f0bc9120d70e | 0 | protected Random getRandom()
{
return rand;
} |
401808c2-71e1-4497-ad80-d947a756d6d9 | 7 | private static String standardize(String line) {
for (int i = 0; i < line.length(); i += 1) {
if (Character.isWhitespace(line.charAt(i))
|| Character.isLetter(line.charAt(i))) {
continue;
} else {
System.exit(1);
}
}
... |
4a54e589-d696-4225-b949-b36be3c8d487 | 8 | protected Action updateAction(Action action, String name, String icon, String accel, Character mnemonic) {
Action result;
// did we already update that action for another component?
if (action == null) {
result = m_Actions.get(name);
return result;
}
result = action;
i... |
ef85b42f-b4be-404e-9ad5-a6a5a8eab7b6 | 8 | private void excuteAction(SeleniumNode node) throws Exception {
ElementAction e = node.getField().getAnnotation(ElementAction.class);
if (Exist.NOTSURE.equals(e.isExist())) {
try {
e.type().findElement(super.driver, node.getPath());
} catch (NoSuchElementException e1) {
logger.debug("this element is n... |
91ae8a75-c7af-476b-8985-8b57bfb98b55 | 8 | @Override
protected void cbThinking() {
super.cbThinking();
int round = getRoundNum();
if ( teammate.size() == 0 || round%3 == 2 ) {
setFireMode(ctx.MODE_FIRE_AUTO);
return;
}
if ( ctx.my.time > 100 ) {
if ( round%3 == 1 ) {
... |
231e2c05-46c5-4a93-8198-48c98f3a32ad | 0 | public ParsePane(GrammarEnvironment environment, Grammar grammar) {
super(new BorderLayout());
this.grammar = grammar;
this.environment = environment;
} |
db860fa9-d9a2-45b6-afdd-f1187e5be344 | 9 | private void checkDesyncAction(final Game serverGame,
final Player serverPlayer) {
Game game = freeColClient.getGame();
boolean problemDetected = false;
Map serverMap = serverGame.getMap();
for (Tile t : serverMap.getAllTiles()) {
if (server... |
0fb524f9-28d2-40af-8cbc-dcddcbac090f | 5 | private Token fetchValue () {
SimpleKey key = possibleSimpleKeys.get(flowLevel);
if (null == key) {
if (flowLevel == 0 && !allowSimpleKey) throw new TokenizerException("Found a mapping value where it is not allowed.");
} else {
possibleSimpleKeys.remove(flowLevel);
tokens.add(key.tokenNumber - tokensTake... |
f854cbd7-c584-4a59-9950-f509f8c34473 | 7 | public CtrnnPhenotype(List<Integer> attributes, int numHiddenNeurons, int sensors, int motorType){
Iterator<Integer> attributeIt = attributes.iterator();
hiddenLayer = new ArrayList<INeuron>();
motorLayer = new ArrayList<INeuron>();
this.motorType = motorType;
... |
19ebc919-2e33-48c3-b0d2-3835db0c02c4 | 9 | public final BufferedImage paintToImage(final BufferedImage _bi,
final PaintObjectWriting _o, final boolean _final,
final DPoint _p_start, final BufferedImage _g,
final DRect _rVisibleScope) {
//fetch list of points and go to the beginning of the list
List<DPoint> ls_point = _o.getPoints();
model.util... |
62516c22-fa8f-43f9-b375-2cb6fe72701d | 4 | public WorldControl(final WorldGUI view)
{
this.view = view;
view.getGame().addMouseListener(new MouseListener(){
public void mouseClicked(MouseEvent e) {
view.setNumOfPlayers(2);
view.showGame();
}
public void mouseEntered(MouseEvent e){
}
public void mouseExited(MouseEvent e){
}
pub... |
6cf494ad-9257-4af9-a552-86a36b0587f0 | 5 | public void onAction(String name, boolean isPressed, float tpf) {
if (name.equals("Izquierda")) {
izq = isPressed;
} else if (name.equals("Derecha")) {
der = isPressed;
} else if (name.equals("Arriba")) {
arriba = isPressed;
} else if (name.equals("Aba... |
554d7b31-7cb7-4ed4-9978-d3638c2679ad | 5 | private void loadData(byte[] data) throws SQLException, IOException {
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(data);
InputStreamReader inputStreamReader = new InputStreamReader(byteArrayInputStream);
reader = new BufferedReader(inputStreamReader);
try {
... |
8b56f5ea-4980-4737-96d2-f3f66bef2ba5 | 4 | public Sound(String event, URL sound_res){
this.event = event;
try {
AudioInputStream audio_in = AudioSystem.getAudioInputStream(sound_res);
AudioFormat format = audio_in.getFormat();
DataLine.Info info = new DataLine.Info(Clip.class, format);
this.audio =... |
3411683d-4778-4347-88cd-3124639c2f1f | 6 | public static MethodSlot helpDefineMethodFromParseTree(Cons inputtree, String stringifiedsource, Object [] MV_returnarray) {
{ Stella_Object nametree = null;
Cons parameterstree = null;
KeywordKeyValueList methodoptions = KeywordKeyValueList.newKeywordKeyValueList();
Cons bodytree = null;
Sy... |
53e508c4-1785-48b2-bf49-9469425696e1 | 3 | synchronized public void updateMessages() {
while (bornlist.size() > 0)
list.add(bornlist.pop());
while (list.size() > 0 && list.peek().state == DeliverState.delivered) {
list.pop();
messageCount--;
}
} |
75e54d58-6ed6-4d86-a22e-f8d412c0e6d7 | 0 | protected void setAge(int age)
{
this.age = age;
} |
bb184f4d-20e4-4aec-be93-47bfe623c9df | 9 | public void run() {
FcpMessage fcpMessage = null;
Throwable throwable = null;
while (true) {
synchronized (this) {
if (shouldStop) {
break;
}
}
try {
String line = readLine();
logger.log(Level.FINEST, "read line: %1$s", line);
if (line == null) {
break;
}
if (line.le... |
713771dc-c12d-4cfe-9629-14176cd5e12b | 5 | public boolean compPotions(PotionTypeAdv potion, Player play, String sAction, ArrayList<PaymentCache> aPayer) {
HashMap<String, ArrayList<PotionTypeAdv>> hType = _jobsdata.getPotHash();
if(hType.isEmpty())
return false;
for(Map.Entry<String, ArrayList<PotionTypeAdv>> e : hType.entry... |
45e2bb9e-c3f3-4cee-b8ba-b4e9690b894c | 8 | @Override
public String buscarDocumentoPorFechaPago(String fechapago1, String fechapago2) {
ArrayList<Venta> geResult= new ArrayList<Venta>();
ArrayList<Venta> dbVentas = tablaVentas();
String result="";
Date xfechapago1;
Date xfechapago2;
Date f;
... |
d80e4a3c-9604-4e9b-9bbf-0888548427f4 | 2 | public void update() {
Window window = device.getFullScreenWindow();
if (window != null) {
BufferStrategy strategy = window.getBufferStrategy();
if (!strategy.contentsLost()) {
strategy.show();
}
}
// Sync the display on some systems.
... |
341dddd4-3b56-4d09-a98e-1c57d5ec0a5d | 2 | public CommandHandler(LogOre plugin, String highlight, String normal) {
StringBuilder i = new StringBuilder();
i.append(highlight)
.append(plugin.getDescription().getName())
.append(normal)
.append(" v")
.append(highlight)
.... |
aedf352d-f87a-48f0-a135-b157b71f0854 | 6 | public void blinkparticle() {
if (untouchable > 0) {
if (blink > 15 && blink <= 30) {
setImage(invin);
}
else if (blink >= 0 && blink <= 15) {
setImage(empty);
}
}
else if (untouchable == 0) {
getWorld()... |
64265154-40cb-4e9a-b389-701298202f80 | 8 | public static int KMPmatch(String source, String target) {
if (source == null || target == null || source.length() < target.length()) {
return -1;
}
if (target.equals("")) {
return 0;
}
int[] next = KMP.CalNext(target);
int i = 0, j = 0;
while (i < source.length()) {
if (source.charAt(i) == targe... |
4efc90d7-ddf7-4ec5-baf5-c671148cca24 | 8 | public Set<Map.Entry<Byte,Short>> entrySet() {
return new AbstractSet<Map.Entry<Byte,Short>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TByteShortMapDecorator.this.isEmpty();
}
publ... |
00a7c5b4-edb9-4734-bfc7-6f3cbd55123e | 6 | public static List<FieldRegistration> getFields(Class<?> clazz) throws FieldRegistrationException {
final List<FieldRegistration> fields = new ArrayList<FieldRegistration>();
while (clazz!=null){
for (Field field : clazz.getDeclaredFields()) {
FieldRegistration fieldRegistration = getField(field);
if (fi... |
380f0897-2d34-47a9-80a4-87674c82951f | 4 | public ItemMapping(IClientContext ctx) {
super(ctx);
final WrapperLoader<ItemDefinition> loader = ctx.definitions.system().itemLoader;
// map of items ids to real id
//try (PrintWriter items = new PrintWriter(new File("items.txt"))) {
int id = 0;
while (loader.canLoad(id)) {
final ItemDefinition definiti... |
47909fa1-f70a-4886-af92-92558f694d13 | 3 | /*Delete User*/public boolean deleteUser(String where, String what) {
try{
if(where.length() > 40 || what.length() > 40)return false;
delete.setString(1, where);
delete.setString(2, what);
delete.executeUpdate();
return true;
}catch(Exception e){e.printStackTrace();}
return false;
} |
1cf6a5f1-c405-41ef-818f-016a227995c7 | 3 | public boolean contains(Object src) {
return ((src == this.slider) || (src == this.spinner) || (src == this.radioButton) || (src == this.label));
} |
3f537af3-bb10-4cc8-b716-7a9bd6cff2c6 | 4 | public static int search( byte[] text, int offset, byte[] pattern )
{
int[] next = initNext( pattern );
int i = offset, j = 0;
n = 1;
while ( i < text.length )
{
while ( j >= 0 && pattern[j] != text[i] )
{
j = next[j];
}
i++;
j++;
if ( j == pattern.length )
return i - pattern.le... |
2154cd3a-6bd3-4258-8837-09073df850cc | 0 | public void leaving(final String name, final Object o) {
// info(StringUtils.shortName(o.getClass()) + "-" + o.hashCode() + " leaving " + name + "()");
} |
9a988d5b-a429-4aa7-81a3-a1efb10b9091 | 3 | public void crearPedido(int ancho , int largo, int d , int m , int a) {
//tinee que validar que no haya pedidos creados
boolean pedidoExistente = false;
for (int x = 0; x < pedidos.size(); x++) {
Pedido aux = (Pedido) pedidos.get(x);
if (cActual.getClienteId() == aux.getC... |
fdd9b023-d63f-4032-ba3f-3ba9897ff358 | 9 | static boolean isDigit(char ch) {
switch(ch) {
case '1': case '2': case '3':
case '4': case '5': case '6':
case '7': case '8': case '9':
return true;
}
return false;
} |
0cff95c4-141f-48e1-bffa-5573691eaf56 | 1 | public void removePush() {
if (pushedLocal != null)
exceptionLocal = pushedLocal;
super.removePush();
} |
30b3060d-1781-4e85-ac1c-cc536a99b6ee | 7 | @Override
public void execute() {
Player receiver = getReceiver();
StringBuilder builder = new StringBuilder();
if (players != null && !players.isEmpty()) {
HashMap<String, String> values = new HashMap<String, String>(1);
builder.append(TerminalUtil.createHeadline("T... |
162baf2d-6b98-4a0e-923f-d3ad608e4a3f | 5 | public synchronized Serializable jvnInvalidateWriterForReader() throws JvnException {
System.out.println("invalidate writerforreader with state : "+STATE+" sur l'objet "+joi+" "+System.currentTimeMillis());
if(STATE != STATE_ENUM.RWC && STATE != STATE_ENUM.W){
STATE = STATE_ENUM.NL;
}
else{
wait_... |
2b9039dd-ffed-4a44-afb8-d0860e17c265 | 3 | private int sendImage(final String language, final String filePath, StringBuilder sb) throws ClientProtocolException, IOException {
final HttpClient httpclient = new DefaultHttpClient();
final HttpPost httppost = new HttpPost(SERVICE_URL);
final FileBody image = new FileBody(new Fil... |
b0af0809-ba8d-476d-8472-9fcd117b1ab1 | 5 | public void writePolyomino(boolean[][] polyomino) throws IOException{
assert polyomino.length == this.size;
assert polyomino[0].length == this.size;
int numBytes = (polyomino.length * polyomino[0].length + 7)/ 8;
byte[] bytesToAdd = new byte[numBytes];
byte currentByte=0;
... |
ad9b123c-78a6-4329-bcf7-48307805bfeb | 0 | public static void main(String[] args) {
// TODO Auto-generated method stub
} |
3d997b22-38c4-40fb-b2d3-dcc922ec43f0 | 4 | public void basicSetParcours(Parcours myParcours) {
if (this.parcours != myParcours) {
if (myParcours != null) {
if (this.parcours != myParcours) {
Parcours oldparcours = this.parcours;
this.parcours = myParcours;
if (oldparcours != null)
oldparcours.unsetWorkout();
}
}
}
} |
c01c68f8-7ec5-4eed-b3af-36253d5168ac | 6 | public boolean traiterAppelsExternes(Echeancier e, int date) {
if (this.getPriorite() == '^') {
//On parcourt les étages supérieurs
Etage et = this.getEtage();
while ((et = this.ascenseur.getEtageSuivant(et)) != null) {
//Si des gens attendent sur le palier
... |
2621ac17-5461-4bee-a3c3-4855f2d2610b | 2 | private PrivateMessagingListener getPrivateMessagingListener(String nickname) {
for (PrivateMessagingListener listener : privateMessagingListeners) {
if ( listener.getNickname().equalsIgnoreCase(nickname) )
return listener;
}
return null;
} |
e4b60a5f-f3b8-43ea-8a85-18556a860d66 | 8 | public double side(Box box) {
final Point2DInt corners[] = box.getCorners();
final double s0 = side(corners[0]);
final double s1 = side(corners[1]);
final double s2 = side(corners[2]);
final double s3 = side(corners[3]);
if (s0 > 0 && s1 > 0 && s2 > 0 && s3 > 0) {
return 1;
}
if (s0 < 0 && s1 < 0 && ... |
0e1989e8-ef06-40ef-aa2b-4e4976c94c41 | 2 | public void tick(int x, int y) {
this.x = x;
this.y = y;
if (timer.isDone()) {
frame++;
timer.start(tpf);
}
if(frame == 5) frame = 0;
} |
664773cf-b866-45d2-94bb-fda1386fdf94 | 9 | public List<Location> adjacentLocations(Location location)
{
assert location != null : "Null location passed to adjacentLocations";
// The list of locations to be returned.
List<Location> locations = new LinkedList<Location>();
if(location != null) {
int row = location.ge... |
5d8c2215-5a18-49a5-9748-b4c31adda2fa | 9 | public Location getLocation()
{
if (currentLocation == DINER)
{
return diner;
}else
if (currentLocation == POLICE_STATION)
{
return policeStation;
}else
if (currentLocation == MANSION)
{
return mansion;
}else
if (currentLocation == CAR)
{
return car;
}else
if (currentLocation == P... |
eed75d14-a6d3-41f3-bb97-92d13b1d5ffe | 6 | @Override
public void keyPressed(KeyEvent ke) {
int key = 0;
try {
key = ke.getKeyCode();
}
catch(UnsupportedOperationException e) { }
switch(key) {
case KeyEvent.VK_RIGHT : //Mouvement vers la droite
moves.set... |
02f2bd81-8597-40ff-aa12-3b7414041b1d | 1 | private boolean seuraavanaNegatiiviMiinus() {
return syote.substring(paikka, paikka + 1).equals("-")
&& lauseke.nykyinenLohko().onTyhja();
} |
a0198ce4-799f-4760-bf01-766bee5b70e2 | 8 | private void drawWorld(World world) {
// n.b. Z-ordering is decided by painter's algorithm
// draw the terrain
Stage stage = world.getStage();
for (int i = 0; i < stage.getHeightMap().size(); ++i) {
int height = stage.getHeightMap().get(i);
renderer.drawAtWithHeight(floorSpr, new Vector2(stage.getLeftP... |
9e3da6b5-9dc6-4d77-93c0-2a4f637c47c3 | 2 | private void removeAll(final boolean mark) {
if (mark) {
AbstractInsnNode insn = first;
while (insn != null) {
AbstractInsnNode next = insn.next;
insn.index = -1; // insn no longer belongs to an InsnList
insn.prev = null;
in... |
ed06defa-ebc7-4606-af89-b633a9fd9944 | 6 | static ArrayList<Field> getFields(Class<?> cls) {
if (cls == null) return new ArrayList<Field>();
ArrayList<Field> output = new ArrayList<Field>();
Field fieldlist[];
try {
fieldlist = cls.getFields();
output.addAll(Arrays.asList(fieldlist));
fieldlist = cls.getDeclaredFields();
for (int i = 0; i <... |
4bc2ad74-f559-46c7-bcdd-9924fb79f587 | 5 | public Document performFetch() throws SQLException {
//Output document
Document fetchData = null;
Dbhandle handle = new Dbhandle();
if (fetchAction == FetchAction.FETCH_USER) {
} else if (fetchAction == FetchAction.FETCH_MEETING) {
} else if (fetchAction == FetchAction.FETCH_EVENT) {
} el... |
f3923c20-91af-490d-90f1-5af6f0913b90 | 2 | private void fireServerStartEvent(ServerStartEvent evt) {
Object[] listeners = serverStartListenerList.getListenerList();
for (int i=0; i<listeners.length; i+=2) {
if (listeners[i]==ServerStartListener.class) {
((ServerStartListener)listeners[i+1]).OnServerStartEvent(evt);
}
}
} |
03bd18fd-c87c-4c7c-9828-f54664f0fcf0 | 1 | public static void main(String[] args) throws Exception
{
PrivateField p = new PrivateField();
Class<?> classType = p.getClass();
Field field = classType.getDeclaredField("name");
/**
* Exception in thread "main" java.lang.IllegalAccessException: Class reflection.ModifiedPrivateField can not access... |
d944b0e5-aa78-4733-899e-d58580739a6f | 8 | public SolverState solve(ProblemDefinition problem) {
OccurrenceSelection occurrenceSelection;
AllocationSelection allocationSelection;
try {
occurrenceSelection = (OccurrenceSelection)Class.forName(
properties.getProperty("solver.occurrenceSelectionClassName", "n... |
7c7a5150-662e-426d-abc3-7b0e8dcb09fe | 6 | private Integer readNumErrors(XMLStreamReader xmlsr) throws XMLStreamException {
Integer countNb = null;
// Compteur d'entrées dans un élément
int nbStart = 0;
// Type d'évemenement
int eventType;
// On est déjà dans l'élément, il faut récupérer l'attribut 'count'
int attCount = xmlsr.getAttributeCount... |
e1178ff2-ed36-4324-b78b-14b31af0d31e | 2 | public void clearThawed() {
// Avoid concurrent modification exceptions.
ArrayList list = new ArrayList();
list.addAll(configurationToButtonMap.values());
Iterator it = list.iterator();
while (it.hasNext()) {
ConfigurationButton button = (ConfigurationButton) it.next();
if (button.state != Configuratio... |
320b0c61-6ce6-46b3-88a2-a08b6dcf8eb4 | 7 | public synchronized Iterator<RecordInfo> iterator(int sortIndex, boolean descending)
{
Iterator iter = null;
if (sortIndex < 0)
iter = Arrays.asList(unsortedRecords.toArray()).iterator();
else
{
final List<RecordInfo>[] whichList = descending ? reverseSorted : forwardSorted;
if ((whichList == ... |
991491e4-4969-46a4-9065-10ae1431ed82 | 8 | private void jTextFieldSearchLivreKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextFieldSearchLivreKeyTyped
// TODO add your handling code here:
if (evt.getKeyChar() == KeyEvent.VK_ENTER) {
String toSearch = jTextFieldSearchLivre.getText();
if (jRadioButtonAllLivre.i... |
3316be58-4ea2-4459-b92f-886c38c036ae | 2 | public static String parseMsg(String data) {
String[] lines = data.split("\n");
for (String line : lines) {
String[] parts = line.split(":", 2);
if (parts[0].equals("msg")) {
return parts[1];
}
}
return null;
} |
089d035b-359d-42d6-b75b-e3cd147ca07b | 0 | public void deleteRoom(Scanner sc) {
System.out.println("Delete a room");
System.out.print("Enter Room Number: ");
String deleteRm = sc.nextLine();
shsmb.dummyType();
shsmb.deleteRoom(deleteRm);
System.out.println("Successfully delete a room");
} |
624070a2-1616-4962-93f9-51aebb6b292e | 1 | public static synchronized ViewHelperFactory getInstance() {
if (viewHelperFactory == null) {
viewHelperFactory = new ViewHelperFactory();
}
return viewHelperFactory;
} |
661caea2-5d5b-422b-981a-ab296ae9b7d8 | 8 | private void appendParser(final String title) {
try {
GenericParser panel2add = null;
if (title.equals(NeighborhoodParser.NAME)) {
panel2add = new NeighborhoodParser(jTabbedPane1);
} else if (title.equals(ClustersParser.NAME)) {
panel2add = ne... |
1b68d16f-1672-4292-b168-1df50dcef551 | 3 | public static Department returnDepartment(String deptName)
{
Session session = sf.openSession();
org.hibernate.Transaction tr = session.beginTransaction();
String strSql ="from Department o where o.deptName =:dn";
Query query = session.createQuery(strSql);
query.setPara... |
1d7c0b53-b747-46fa-b377-a2472ce11975 | 8 | @Override
public void playerGamePlay(RSAService rsaService, ComService comServ,
User gameUser, ArrayList<User> gameUsers, SigService sig,
SearchGamesTask jgt) throws InvalidKeyException,
InvalidKeySpecException, NoSuchAlgorithmException,
NoSuchPaddingException, NoSuchProviderException,
IllegalBlockSizeE... |
2ddfaa60-33f9-43d8-9bbf-2b233b7f9851 | 8 | @Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
Object msg = e.getMessage();
if (!(msg instanceof HttpMessage) && !(msg instanceof HttpChunk)) {
ctx.sendUpstream(e);
return;
}
HttpMessage currentMessage = th... |
7688fd16-6859-45f9-a29f-f97d53547cdd | 9 | private static void processLoadProject(String dataStr, Object key){
Project curProject = null;
ArrayList<Project> myProjs = new ArrayList<Project>();
String[] data = dataStr.trim().split("\n");
for (String line : data) {
String[] parts = line.split("\t");
parts[parts.length-1] = parts[parts.length-1].... |
248f622e-1126-4af3-8e2d-c834bd34b560 | 7 | public ItemStack transferStackInSlot(int par1)
{
ItemStack var2 = null;
Slot var3 = (Slot)this.inventorySlots.get(par1);
if (var3 != null && var3.getHasStack())
{
ItemStack var4 = var3.getStack();
var2 = var4.copy();
if (par1 < 9)
{
... |
392428af-6d9a-4abf-949a-fa5a23556c5c | 6 | public void startArena(String arenaName) {
if (getArena(arenaName) != null) { //If the arena exsists
final Arena arena = getArena(arenaName);
//Create an arena for using in this method
arena.sendMessage(ChatC... |
b9fc75dc-562d-4029-850a-50ba746dd6b2 | 7 | static int validateDay( int y, int m, int d )
{
if( d > 28 )
{ // m is 0-based
if( m == 1 ) // TODO: Get maximum for year
{
d = 28;
}
else if( ((m == 3) || (m == 5) || (m == 8) || (m == 10)) && (d == 31) )
{
d = 30;
}
}
return d;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.