method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
c2afdfa0-0995-4d39-957e-e9cd19ba2e20 | 5 | @Override
public void preform(int source) {
if(source == 0) {
openNewGui(References.GUI_LOBBY);
}else if(source == 1) {
Object ip = JOptionPane.showInputDialog("Set IP address to join.");
if(ip != null && ip instanceof String) {
Rocket.getRocket().properties.IP = (String) ip;
}
}else if(source ==... |
177e53e5-07ec-4152-89d2-f08fd7094778 | 7 | private Region createRegion(Attributes atts) {
String abbyyType = null;
int i;
if ((i = atts.getIndex(ATTR_blockType)) >= 0) {
abbyyType = atts.getValue(i);
}
RegionType primaType = RegionType.UnknownRegion;
if ("Text".equals(abbyyType))
primaType = RegionType.TextRegion;
else if ("Table".equals(... |
de1efc02-30bc-4ad7-bad3-5fca6bc13acb | 7 | public int readB(int bits) {
int ret;
int m = 32 - bits;
bits += endbit;
if (endbyte + 4 >= storage) {
/* not the main path */
ret = -1;
if (endbyte * 8 + bits > storage * 8) {
ptr += bits / 8;
endbyte += bits / 8;
... |
3affe512-ce5a-4948-a231-c67616ef92f4 | 8 | public static void main(String[] args) {
Random rand = new Random(47);
for(int i = 0; i < 100; i++) {
int c = 'a' + rand.nextInt(26);
System.out.print((char)c + ", " + c + ": ");
switch(c) {
case 'a':
case 'e':
case 'i':
case 'o':
case 'u': System.out.println("vowel");
break;
c... |
9bb7fcb8-a2c6-4756-95d6-8a2cbc632c0f | 9 | public void printUrkunden() {
if (table.getSelectedRowCount() == 0)
return;
List<EinzelWettkampf> lewk = new Vector<EinzelWettkampf>();
List<MannschaftsWettkampf> lmwk = new Vector<MannschaftsWettkampf>();
for (int i : table.getSelectedRows()) {
Wettkampf w = (Wettkampf) table.getValueAt(i, -1);
if (w ... |
a341170a-d46b-4f15-9055-f60569ece3bf | 3 | public static String toString(JSONObject o) throws JSONException {
boolean b = false;
Iterator keys = o.keys();
String s;
StringBuffer sb = new StringBuffer();
while (keys.hasNext()) {
s = keys.next().toString();
if (!o.isNull(s)) {
... |
69245e08-4f11-4aa9-864c-54648ffcb465 | 1 | public void mouseDragged(MouseEvent event) {
if (myTrapState == null)
return;
myTrapState.setPoint(event.getPoint());
getView().repaint();
} |
78a9cec9-e207-4fe4-b26a-90140fd11200 | 5 | protected void save() {
ImageSettings imageSettings = null;
IndexerState indexerState = null;
WindowSettings windowSettings = null;
for (SaveSubscriber s : subscribers) {
if (imageSettings == null) {
imageSettings = s.saveImageSettings();
... |
9959b724-c14a-40af-8a15-4d5eb81be510 | 9 | public static void main(String[] args) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int n = Integer.parseInt(st.nextToken());
int m = Integer.parseInt(st.nextToken());
int mod ... |
dbfda627-38a4-4d08-9ca9-8713889527ff | 8 | public final void startElement(java.lang.String ns, java.lang.String name, java.lang.String qname, Attributes attrs) throws SAXException {
dispatch(true);
context.push(new Object[]{qname, new org.xml.sax.helpers.AttributesImpl(attrs)});
if ("edge".equals(qname)) {
handler.start_edge... |
cd11ae10-e6e2-445d-9cd8-215c8d9192c7 | 7 | @Override
public void ParseIn(Connection Main, Server Environment)
{
Room Room = Environment.RoomManager.GetRoom(Main.Data.CurrentRoom);
if (Room == null)
{
return;
}
if((Room.Flags & Server.rmAllowPets) != Server.rmAllowPets && !Room.CheckRi... |
12b53d37-b19e-4b80-9805-798b254ba1b1 | 3 | *@param nick
* @return resultado
**/
public beansMiembro buscarDentroDownline(beansMiembro miembro, String nick){
for(beansMiembro busquedaInterior : miembro.getListaInterna() ){
if(busquedaInterior.getNick().equals(nick)){
return busquedaInterior;
}else{
resultado = buscarDentroDownline(busquedaInte... |
894ba0a5-de15-4f02-ac4f-0e5424d305db | 6 | @Test
public void toolsTest2() {
userInput.add("hello");
userInput.add("daniel");
userInput.add("can you help me with cooking");
userInput.add("tell me the tools");
userInput.add("hamburger");
userInput.add("tools");
runMainActivityWithTestInput(userInput);
assertTrue(nlgResults.get(2).contains("what")... |
c8250088-9f5e-4dfb-b833-3a9b92cee688 | 7 | public boolean supprimerRessource(String typeRessource, int nombre) {
if (nombre > 0) {
if(typeRessource.equals(Constantes.RESS_NOURRITURE)) {
if (nbNourriture - nombre < 0) {
return false;
}
nbNourriture -= nombre;
return true;
}
if(typeRessource.equals(Constantes.RESS_PIERRE)) {
if... |
8931790e-3edd-446e-973d-258c3a1f2532 | 3 | public static PathwayElement createState(
double relX, double relY, double width, double height,
Color color, int lineStyle, int lnThickness,
Color fillColor, IShape shapeType, int zOrder,
DataSource database, String ID, List<String> bioPaxRefs,
String graphId, String graphRef, String textLabel, String s... |
0553b018-eb11-44c1-a41b-e0b225baa178 | 5 | public byte[] delete(InputStream is, int fStart, int fEnd) throws Exception{
int cont = 0;
Manager reader = new Manager(is);
if( fStart > fEnd ){
throw new Exception("fStart can't be greater than fEnd!!");
}
FrameData fd ;
fina... |
f338a369-047a-4c34-8519-ee92a73ccd8b | 4 | private String getRemoteRecipe(long ID, String Title, String Brewer, int iteration) {
try
{
String baseURL = Options.getInstance().getProperty("cloudURL");
if (!baseURL.startsWith("http://")) {
baseURL = "http://" + baseURL;
}
URL url = new URL(baseURL+"/recipes/"+ID);
... |
df9fbb8f-0fbf-4c8a-8daa-38812b54e80a | 8 | @SuppressWarnings("unchecked")
private Map<MarketQuotesResponseField, String> getMarketQuotePaths(Document doc) throws UtilityException
{
Map<MarketQuotesResponseField, String> toReturn = new HashMap<MarketQuotesResponseField, String>();
for (MarketQuotesResponseField f : MarketQuotesResponseField.values())
{
... |
36d7f2ee-aaa7-481d-aa09-8f4d65eb6992 | 8 | 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... |
5a99649d-9c0c-455f-984b-3d02cda0a807 | 4 | @Override
public UserDetails getValue(HttpContext context) {
UserDetails userDetails = null;
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
if (!(auth instanceof AnonymousAuthenticationToken)) {
userDetails =
(UserDetails)SecurityContextHolder.get... |
e0191f42-7ae7-466d-8806-9ec7dfceac54 | 1 | public DataOut getData(int index){
if(listDataOut != null)
return listDataOut.get(index);
else return null;
} |
c0393cbb-a180-431a-b2d6-1df18eb1631e | 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... |
23299d75-aca0-45d5-add8-e0f9d2acea29 | 3 | public SpriteSheet(String path, int tileWidth, int tileHeight, int gid) {
this.firstGID = gid;
Image img = null;
try {
img = new Image(path);
} catch (SlickException e) {
e.printStackTrace();
}
int imgWidth = img.getWidth();
int imgHeight = img.getHeight();
numTilesX = (int) Math.floor(img... |
d074b7f1-8025-438e-8b49-461812d133ba | 6 | public static int position(Byte[] jeu, byte player){
int val=0;
byte opponent=0;
Byte empty = 0;
if (player == 1) opponent = 2;
else if (player == 2) opponent = 1;
else System.out.println("erreur IA");
/* POSITION IA */
int [] tabIA = {50, 15, 50, 1000,
40, ... |
c60173da-e7b0-41f6-8ae4-461526600635 | 3 | public static ArrayList<bConsultaCompo> getPesquisaCompoAt(String prod, String data_in) throws SQLException, ClassNotFoundException {
ArrayList<bConsultaCompo> sts = new ArrayList<bConsultaCompo>();
Connection conPol = conMgr.getConnection("PD");
ResultSet rs;
if (conPol == null) {
... |
447ee9ed-2188-48bb-9416-79d4088f9fd8 | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final WorkPlace other = (WorkPlace) obj;
if (!Objects.equals(this.workPlaceId, other.workPlaceId)) {
... |
0cdc38cc-2b1b-473b-af9d-337fe3a44ff0 | 0 | public CarBuilder setTintedGlass(boolean tintedGlass) {
delegate.setTintedGlass(tintedGlass);
return this;
} |
f9a3bbb3-fd8f-4875-9aae-40fbc09dbe1d | 1 | public void removeRange(int fromIndex, int toIndex) {
int numMoved = size - toIndex;
System.arraycopy(attributeLists, toIndex, attributeLists, fromIndex, numMoved);
int newSize = size - (toIndex - fromIndex);
while (size != newSize) {
attributeLists[--size] = null;
}
} |
cae4ed70-60ce-4a9f-865e-bba107e2e412 | 6 | public static GRESCAnswer fromText(String text) {
GRESCAnswer gAnswer = new GRESCAnswer();
if (text != null && text.length() > GRE_ANSWER_INDICATOR.length()) {
int answerIndex = text.indexOf(GRE_ANSWER_INDICATOR);
if (answerIndex != -1) {
String[] answers = text.substring(answerIndex + GRE_ANSWER_IN... |
7eeb7314-6dca-439d-bdf3-a0e06fe51169 | 6 | public void gen_where(final Map<String, Object> context, final QLSelect select, final PrintWriter out) {
final Class<?> clazz = (Class<?>) context.get("class");
if (clazz == null) {
throw new IllegalArgumentException("context not contains 'class'");
}
final QLExpr where = s... |
74022f07-f2cc-445e-912c-1c6cc66b1239 | 7 | public static final void write(final Define define, final File directory) {
if (define == null || directory == null) {
return;
}
OutputStream outputStream = null;
try {
String fileName = define.getProxyClassName().replace('/', File.separatorChar).concat(".class");... |
bac97245-1cb5-484c-91a0-556626650701 | 2 | public boolean replaceSubBlock(StructuredBlock oldBlock,
StructuredBlock newBlock) {
for (int i = 0; i < 2; i++) {
if (subBlocks[i] == oldBlock) {
subBlocks[i] = newBlock;
return true;
}
}
return false;
} |
901ee9a1-9909-42ea-b59e-6fd5d0b0e1d6 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ConsultantSales)) {
return false;
}
ConsultantSales other = (ConsultantSales) object;
if ((this.salesId == null... |
c5498eab-d091-44f6-8638-dd6ea715525c | 4 | private Point getPoint(int x, int y){
if (x < 0|| y < 0 || x >= FIELD_SIZE || y >= FIELD_SIZE){
return null;
}
return points[x][y];
} |
69f9a311-064a-4eff-9cc8-87813e517907 | 5 | public ArrayList<Integer> getNeighbors(int position)
{
ArrayList<Integer> neighborIndexes = new ArrayList<Integer>();
int x = position % columns;
int y = position / columns;
ArrayList<Point> neighbors = new ArrayList<Point>();
neighbors.add(new Point(x - 1, y - 1));
... |
2cfec8e5-321d-4d03-881f-ba2ea4f5b518 | 4 | @Test
public void testCardTypes() {
// make new sets (since they wont store repeats)
Set<Card> personCards = new HashSet<Card>();
Set<Card> weaponCards = new HashSet<Card>();
Set<Card> roomCards = new HashSet<Card>();
// store all cards in correct set
for(Card c : game.getCards()) {
if (c.getType() == C... |
6e0e2542-e72d-4774-9b80-401c27b7dca6 | 2 | @Override
public void mousePressed(MouseEvent e) {
if (e.getButton() != MouseEvent.BUTTON1) {
System.out.println(e.getButton());
return;
}
ptPress = e.getPoint();
final Panel screen = (Panel) e.getSource();
try {
win.getModel().add(getNewEl... |
569da99f-8401-4ec7-b5ab-e39509eb7078 | 3 | public static void generate(int[] result, int N, ArrayList<String[]> a) {
if (result.length == N) {
a.add(print(result));
}
else {
for (int i=0; i<result.length; i++) {
result[N] = i;
if (isConsistent(result, N))
generate(result, N+1,... |
f3b6135a-122e-4633-a3cb-18319c3a956e | 0 | public void setRegEx(String regex) {this.regex = regex;} |
c908fd4f-cdab-4f69-85d8-f9e0779314b8 | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Position other = (Position) obj;
if (this.x != other.x) {
return false;
}
ret... |
c8c075cf-4cdd-4bbc-ba4f-f56751637115 | 1 | public int getPosition()
{
int position = lastPosition;
AudioDevice out = audio;
if (out!=null)
{
position = out.getPosition();
}
return position;
} |
676a0e38-b3a7-4ff3-9995-8c6e37a794b2 | 8 | synchronized protected void negotiate() throws IOException
{
if(this.input != null)
try { this.input.close(); } catch(IOException f) { }
if(this.output != null)
try { this.output.close(); } catch(IOException f) { }
if(this.socket != null)
try { this.socket.close(); } catch(IOException f) { }... |
f77b5a67-285f-4cf3-8b08-3990ad8fa1bf | 1 | public static void convert_to_binary(Integer n) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 32; i++) {
sb.append(n >> i & 1);
}
sb.reverse();
System.out.println(sb.substring(sb.indexOf("1")));
} |
a3fdac4e-8c1d-4742-87f6-77b10a6c36e1 | 8 | public void triggerSubscribe(final boolean isSource, final TransactionDataDescription dataDescription, final Collection<InnerDataSubscription> subscriptions) throws OneSubscriptionPerSendData {
if (_attributeGroup == null || _receiveAspect == null || _sendAspect == null) {
throw new IllegalStateException("Das verw... |
526f6c73-c841-438e-baa6-5b7722554ffd | 1 | public static void setField(Field field, Object target, Object value) {
try {
field.set(target, value);
} catch (IllegalAccessException ex) {
handleReflectionException(ex);
throw new IllegalStateException(
"Unexpected reflection exception - "
+ ex.getClass().getName() + ": " + ex.getMessage());... |
32e5044a-44de-436f-a41a-c91edef7f5c3 | 2 | public void changeDelimiter(char newDelim) throws BadDelimiterException {
if (newDelim == delimiter) return; // no need to do anything.
if (!charIsSafe(newDelim)){
throw new BadDelimiterException(newDelim + " is not a safe delimiter.");
}
updateCharacterClasses(delimiter, newDelim);
// keep a record of the... |
b9f1a3fa-65d0-47fb-ba51-340afeb9134b | 7 | public static void main (String str[]){
//Ready Set Go!
initialize();
//Trololololol
int kappaX = -100;
final int kappaY = EZ.getWindowHeight()-550;
EZImage kappa = EZ.addImage("resources/kappa.png", kappaX , kappaY);
//The object for the ball and paddle
PongBall ball = new PongBall(Color.WHITE, Pon... |
50cc5601-b029-4aba-9d88-0ef8618f4e08 | 1 | public void draw(Graphics g) {
if (nextGlied != null) {
nextGlied.draw(g);
}
Rectangle masse = getAbsoluteRect();
g.setColor(color);
g.fillOval((int)masse.getX(), (int)masse.getY(), (int)masse.getWidth(), (int)masse.getHeight());
} |
b24ce261-3fd6-43a2-adf1-47c450d304fd | 6 | public void generater(int x, int w, byte type)
{
/* for (int i = 0; i <= 30; i++)
{
ClearCircle(x+random.nextInt(w),y+random.nextInt(h),random.nextInt(w/2));
}
generateSandAndWater();*/
float vs = -random.nextInt(12... |
5cd54549-805a-4c3d-8d7a-d3298c42a592 | 3 | @Test
public void test()
{
try
{
MarketQuote quote = new MarketQuote(new Symbol("SIRI"));
for(MarketQuotesResponseField f: MarketQuotesResponseField.values())
{
if(quote.hasField(f))
{
System.out.println(f.name()+"="+quote.getField(f));
}
}
assertTrue("Expected Field not in respons... |
f5427fb2-d140-49d4-b580-0a38c8755f0a | 4 | protected String compressJavaScript(String source) {
//set default javascript compressor
if(javaScriptCompressor == null) {
YuiJavaScriptCompressor yuiJsCompressor = new YuiJavaScriptCompressor();
yuiJsCompressor.setNoMunge(yuiJsNoMunge);
yuiJsCompressor.setPreserveAllSemiColons(yuiJsPreserveAllSemiColo... |
8b21efa2-491d-4f77-abca-48b5fd450b71 | 3 | public static boolean isPrimitive(Object obj) {
Class[] primitives = new Class[] { boolean.class, byte.class, char.class, short.class,
int.class, long.class, float.class, double.class };
for (Class<?> c : primitives)
if (c.isAssignableFrom(obj.getC... |
dba84d19-8819-4145-945a-d93d93bf7bea | 5 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
LeverandoerDTO leverandoer = leverandoerList.get(rowIndex);
Object value = null;
switch (columnIndex) {
case 0:
value = leverandoer.getLeverandoerId();
break;
case 1:
value = leverandoer.getFirmaNavn();
break;
case 2:
value ... |
75d77bfb-acfd-4111-a1e9-3b55f7d3b68b | 1 | private double f(double b) {
double PrB=1, p=probLessThan(b);
for (int i = 0; i < futureBowls; i++) {
PrB*=p;
}
double PrA=1-PrB;
double ExA=exptGreaterThan(b);
double ExB=exptLessThan(b);
double Ex2=PrA*ExA+PrB*ExB;
return Ex2;
} |
f474b471-5dd1-4d3b-812c-cb8bd5c3c058 | 3 | public static Data getDataFromJson(String json){
ObjectMapper mapper = new ObjectMapper();
Data data = null ;
try {
data = mapper.readValue(json, Data.class) ;
} catch (JsonGenerationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JsonMappingException e) {
// TOD... |
82c199a8-cade-4f29-8a23-0c56acd18af5 | 9 | static final void method3060(byte b, boolean bool, boolean bool_1_, Node_Sub2 node_sub2) {
anInt3073++;
int i = node_sub2.interfaceId;
int i_2_ = (int) node_sub2.aLong2797;
node_sub2.method2160((byte) 55);
if (bool_1_) {
Node_Sub15_Sub6.method2571(i, false);
}
Class150_Sub3_Sub1.method1665((byte) -102,... |
3632c95d-b944-41e8-903f-63ad5b0dc098 | 7 | public View render(View convertView, Context context, FeedView webFeedView) {
this.context = context;
if (convertView == null) {
convertView = getInflater(context).inflate(layout, null);
holder = new ViewHolder();
holder.wrapper = (FrameLayout) convertView.findViewB... |
658cac22-8677-423f-ad3a-4eb27c85a60e | 7 | public void move(int dx,int dy){
if(x+dx>=Level.SIZE || y+dy>=Level.SIZE || x+dx<=0 || y+dy<=0 || (l.world[x+dx][y+dy] != TileType.AIR && l.world[x+dx][y+dy] != TileType.FIRE && l.world[x+dx][y+dy] != TileType.TORCH)){
}else{
x+=dx;
y+=dy;
}
} |
2ebacdd3-71b0-4d34-9e15-0d1c0ec119c7 | 3 | private boolean rosterExists (Roster r) {
for (Roster mr: getRosters()) {
if ((r.getFamilyName().equals(mr.getFamilyName())) &&
(r.getGivenName().equals(mr.getGivenName())))
return true;
}
return false;
} |
545e9233-3cc9-429e-bd0d-743e500d395f | 6 | public static void maxProductII(int[] input){
int max[] = new int[input.length];
int maxStart[] = new int[input.length];
int minStart[] = new int[input.length];
int min[] = new int[input.length];
max[0] = min[0] = input[0];
maxStart[0] = minStart[0] = 0;
int ... |
e3d3fd99-0c9f-46e7-8b28-7a0ae6994bad | 6 | public void adjustBeginLineColumn(int newLine, int newCol)
{
int start = tokenBegin;
int len;
if (bufpos >= tokenBegin)
{
len = bufpos - tokenBegin + inBuf + 1;
}
else
{
len = bufsize - tokenBegin + bufpos + 1 + inBuf;
}
int i = 0, j = 0, k = 0;
int nextColDiff = ... |
e13c8b95-aa3a-497d-9380-2628d7b920b8 | 6 | public void beginUpgrade(Upgrade upgrade, boolean checkExists) {
int atIndex = -1 ;
for (int i = 0 ; i < upgrades.length ; i++) {
///I.sayAbout(venue, "Upgrade is: "+upgrades[i]) ;
if (checkExists && upgrades[i] == upgrade) return ;
if (upgrades[i] == null) { atIndex = i ; break ; }
}
... |
b9d26579-333f-489e-a8d7-a1c054d65998 | 7 | public void calculateBasicScore(ROB_entry entry) { // the baseline score, based only on instruction type (+mispredicted branch)
if (entry.theUop.type == UopType.insn_CBRANCH){ // score for conditional branch
entry.score += BRANCH_SCORE;
if(heuristic.type != HeuristicType.heuristic_BASE_S... |
ba27152b-09b3-431d-86cf-962d37646193 | 8 | public void actionPerformed(ActionEvent evt) {
String Action = evt.getActionCommand();
String last_line = null;
String tmp = "";
if (Action.equals("answer")) {
if(state == -1) {
return; //Unexpected notification
}
last_line = serial.readline();
Logtext = "<-- ["+last_line+"]";
caller.mylog(L... |
0e98db16-b30e-4710-b8a5-3f299b3e615d | 9 | public void refresh(){
if(!canrun)
return;
CGroupNode newDelete = dispCache;
CGroupNode newDisp = Renderer.paintDialog(currentSeq, parent.gui.getBounds());
CGroupNode fadeGroup = new CGroupNode(fadeGroupName);
for(ACItem item : newDisp.getChildrenCopy()){
if(!(item.getName().endsWith(bgsuffix) || item.g... |
9aa45fc5-2eb0-4c09-9b7f-bab0b67b73d0 | 1 | public SettingsDlg(Joculus j)
{
super();
app_instance = j;
// read the settings from the preferences, or use defaults.
dialog_settings = new Settings();
dialog_settings.load();
// set up the dialog.
this.setLayout(new BorderLayout());
default_border = new EmptyBorder... |
1a174c6f-36bb-4c00-88ba-f7f5527bbf5e | 9 | private void destroy(int x, int y) {
int mouseX = x;
int mouseY = y;
int rowCount = genX / blockSize;
int startY = (Math.round(mapY / blockSize))* rowCount + 1;
int endY = (Math.round((mapY + screenHeight) / blockSize) - 1)* rowCount;
if(startY < 0) startY = 0;
if(endY > map.length) endY ... |
6170fa54-91ad-43e0-9560-2fa9ec22041f | 5 | public void movePlayer (int playerID, Location l) {
Player p = playerIDs.get(playerID);
if (board.canTraverse(l) && p != null && this.isFree(l)) {
if (p.move(l)) {
for (int id: playerIDs.keySet()) {
server.queuePlayerUpdate(new MoveEvent(playerID, l), id);
}
}
}
} |
3d8bc317-cd69-45ac-87c6-d4416b0dfefc | 9 | public void update(double timestep) {
if (this.state.equals("flipping")){
if(endPoint.getCenter().x()==flippedSpot.getCenter().x() && endPoint.getCenter().y()==flippedSpot.getCenter().y()){ //we are already in the flipped position
state = "flipped";
} else {
double deltaAngle = timestep*angularVelocity;... |
d57cdae4-70d1-4d53-9d18-40ea064a2d32 | 0 | public void windowDeiconified(WindowEvent e)
{
// TODO Auto-generated method stub
} |
d275396d-721e-4188-a16f-6d1a6267ed23 | 7 | public static void spielen() {
int i;
int versuche = Ratespiel.versuche;
boolean erraten = false;
char[] eingabe = new char[6];
char[] loesungswort = Ratespiel.woerter[Ratespiel.zufall(0, Ratespiel.woerter.length)].toCharArray();
while (!erraten && versuche>0) {
System.out.println((Ratespiel.versuche-ver... |
6012e0c8-2f29-43ff-8712-971eab2e3719 | 3 | private void store_granule_info(){
//
// for(int ch = 0; ch < max_gr; ch++){
// for(int gr1 = 0; gr1 < channels; gr1++){
// format.store_in_array(gr[gr1].ch[ch].part2_3_length, 12);
// format.store_in_array(gr[gr1].ch[ch].big_values, 9);
// format.s... |
11d014e1-6b4f-4e0a-908e-7374c0645366 | 8 | public static void main(String[] args) throws Exception {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
String linea;
while(!(linea=bf.readLine()).equals("0 0")){
String[] numeros = linea.split(" ");
tam = (numeros[0].length() > numeros[1].length()) ? numeros[0].length(): numeros... |
6e57ba41-230a-4623-99cb-d9ffc53fa3fb | 2 | public void schemeEditorDelContact() {
if(ce_circuit2.getSelectionIndex() == -1 || ce_drain.getSelectionIndex() == -1) return;
String circuitName = ce_circuit2.getText();
String contactName = ce_drain.getText();
scheme.getCircuits().get(circuitName).getContacts().remove(new Cont... |
3e696ce3-d680-4c9b-b209-93a1b259a02c | 8 | public static void decompressFile(String input, String output){
byte[] data = new byte[0];//All the bytes from the input
//Read the input
try{
data = Files.readAllBytes(Paths.get(input));
}catch(Exception e){
e.printStackTrace();
}
ArrayList<Character> unique = new ArrayList<Character>();//Local uniq... |
fba12658-a54b-4ba7-aab9-89dad376b4e6 | 8 | public void searchByName (LYNXsys system, String query, int page) { // search for students by by name
for (int i = 0; i < system.getUsers().size(); i ++) { // loop through arraylist of students
if ((system.getUsers().get(i).getFirstName().equalsIgnoreCase(query)) || (system.getUsers().get(i).getLastName().equalsIg... |
6049cdad-26b7-404d-98fc-af4624660e7a | 4 | @Override
public synchronized Object read() throws NetworkException
{
if(toAppStream != null) {
throw new NetworkException(this, "Receiving is done via input stream. Do not call Connection.read.");
}
if(toAppBuffer != null) {
if(!toAppBuffer.isEmpty()) {
// return data from buffer although the con... |
d2263e90-c7aa-40c7-bae9-a22b5e7e1293 | 2 | public GuiDriver()
{
createGui();
imageChooser = new JFileChooser();
imageChooser.addChoosableFileFilter(new ImageFileFilter());
imageChooser.setAcceptAllFileFilterUsed(false);
imageChooser.setCurrentDirectory(Paths.get(".").toFile());
loadImageButton.addMouseListen... |
48dad373-75b8-47a2-8deb-e7babddb8846 | 3 | public Environment<K,V> createChild( String name ) {
//System.out.println( "Creating new child: "+name );
// First: locate the container
List<Environment<K,V>> tmpList = this.children.get( name );
// Create new container if none exists
if( tmpList == null ) {
tmpList = new ArrayList<Environment<K,V>>( 1... |
bae66723-598b-4f07-ab99-d9788b52a95c | 5 | final void method2439(int i, AnimatableToolkit class64) {
try {
anInt10205++;
int i_115_ = ((Class264) aClass264_10315).anInt3370;
if (i >= -110)
((Mob) this).anInt10325 = 90;
int i_116_ = ((Class264) aClass264_10316).anInt3370;
if (i_115_ != 0 || i_116_ != 0) {
int i_117_ = class64.fa() /... |
705994f9-fe2f-426e-8133-e21d620233eb | 9 | private final void timeOutStrayHandlers()
{
List<HTTPIOHandler> handlersToShutDown = null;
synchronized(handlers)
{
// remove any stray handlers from time to time
if(handlers.size() == 0)
return;
final Iterator<HTTPIOHandler> i;
try
{
i=handlers.iterator();
}
catch(java.lang.IndexOut... |
d8b7ff07-61f1-4b01-b3cf-10ca15756599 | 0 | public void addDoctor(Doctor doctor){
this.doctor.add(doctor);
} |
0f541d41-78bd-437d-b578-005421d82e3d | 0 | public static void main(String[] args) {
new Circle(5);
} |
e3686498-0a8f-45f6-b051-b8ab26f8146a | 0 | public ArrayList<PersonApplication> getPersonApplicantions() {
return PersonApplications;
} |
c9785741-c69a-4177-befa-6298e3501d2f | 9 | public Component getRendererComponent(GraphColoring coloring) {
final GraphColoring myColoring = new GraphColoring(coloring.graph);
myColoring.vertexColors = new HashMap<Vertex, Integer>(coloring.vertexColors);
myColoring.edgeColors = new HashMap<Edge, Integer>(coloring.edgeColors);
myCo... |
19ccf606-3213-462d-82fc-54eb2c21666b | 8 | private boolean displayModesMatch(DisplayMode mode1, DisplayMode mode2) {
if(mode1.getWidth() != mode2.getWidth() || mode1.getHeight() != mode2.getHeight()){
return false;
}
if(mode1.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && mode2.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI
&& mode1.getBitDepth()... |
b22fff3a-a280-4009-b611-7254fdb74b73 | 7 | public boolean exists(String name)
{
Connection conn = null;
ResultSet rs = null;
PreparedStatement ps = null;
boolean exists = false;
try
{
conn = iConomy.getiCoDatabase().getConnection();
ps = conn.prepareStatement("SELECT * FROM " + Constants.SQLTable + " WHERE username = ? LIMI... |
48ed1bef-66be-4be3-aa3a-3f3b527e9d19 | 4 | public void gainXP(int exp){
_xp += exp;
while (_xp > 100){
_level++; //ding!
_xp-=100;
_health*=1.3;
_damage*=1.3;
_shield++;
if (_level == 2) learnSkillOne();
if (_level == 5) learnSkillTwo();
if (_level ==... |
f2471b5b-fbc6-4c1d-9c9d-af0d939e7d4b | 9 | /* package private */ ShallowTrace(final String name,
final boolean hidden,
final boolean systemHidden,
final ResultType resultType,
final String value,
... |
a2630c85-fe12-4ddf-998a-53a9b0fe985f | 0 | public int getEventId() {
return eventId;
} |
2abc7891-f471-4184-b096-64384ad982dd | 5 | @EventHandler(priority = EventPriority.NORMAL)
public void onSignChange(final SignChangeEvent event) {
if (!event.isCancelled())
{
if (ChatColor.stripColor(event.getLine(1)).equalsIgnoreCase(
"[KarmicLotto]"))
{
boolean valid = false;
if(plugin.getPerm().has(event.getPlayer(), Permission.CREAT... |
187cac2c-6202-4187-9a30-f40f16976e1a | 9 | public ArchiveData take() throws ClosedChannelException, InterruptedException, ProtocolException {
// Das ArchiveData Objekt ist in dem Byte-Array kodiert.
byte[] dataByteArray = _streamDemultiplexer.take(_indexOfStream);
if (dataByteArray != null) {
// Es wurde ein Datensatz empfangen
InputStream in = ne... |
7c9f8734-54a1-4588-b2a9-b002056fde49 | 4 | private void reset() {
synchronized (sequenceQueueLock) {
if (sequenceQueue != null)
sequenceQueue.clear();
}
// Check if we have a sequencer:
if (sequencer == null) {
// nope, try and get one now:
getSequencer();
} else {
// We have a sequencer. Stop it now:
sequencer.stop();
// rewind... |
721c8230-209e-46ef-a77c-3d5cfb0ad57e | 8 | private boolean safeAdd(Token token) {
//end{check}
Token last = tokens.empty() ? null : tokens.peek();
boolean safe = true;
if (last !=null && (last.isNumber() || last.isOperator(')'))) {
safe = token.isOperator('+') || token.isOperator('-') ||
t... |
03282736-e7cb-414d-8232-0dae729a3576 | 3 | public OutputStragegy getOutputStrategy(String simName) {
OutputStragegy st = null;
if (scheme == SIMPLE) {
st = new SimpleDirectoryOutput(getDir(), simName);
} else if (scheme == NUMBERED) {
st = new NumDirectoryOutput(getDir(), simName);
} else if (scheme == TIM... |
21a66e91-9682-435e-9520-f8b4408a1e2f | 1 | @Test
public void getAllRecipesTest() throws Exception {
Recipe recipe = new Recipe();
recipe.setName("borscht");
recipe.setCategory(CategoryEnum.chicken);
try {
recipe.canSave();
} catch (SaveError e) {
e.printStackTrace();
}
} |
d5f3c0b0-2e97-4fef-afea-7683a0cb0380 | 6 | private int sumValue(ArrayList<Piece> thePieces) {
int answer=0;
for(Piece p : thePieces)
{
if(p instanceof Pawn)
{
answer+=1;
}else if(p instanceof Knight|| p instanceof Bishop)
{
answer+=3;
}else if(p instanceof Rook)
{
answer+=5;
}else if(p instanceof Queen)
{
answer+=9;... |
fa2231e4-7bdb-4063-bf5d-bc06933b4e09 | 0 | public int GetInputBuffer()
{
return inputBuffer;
} |
a6d1797e-e2f2-433c-8c67-444af9e008ee | 8 | private boolean readFiretrap(Element element, int houseNumber) {
//declare variables
int x = -1;
int y = -1;
//check for non-specified attributes
NamedNodeMap trapAttr = element.getAttributes();
for(int i = 0; i < trapAttr.getLength(); i++)
{
Node attr = trapAttr.item(i); //get attribute
//check i... |
357362c0-b5da-4e2d-9ff1-0b8c4dd984ff | 0 | public String getTitle() {
return this.title;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.