method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
1389207c-4da5-4674-9e7c-72f930cffac0 | 9 | public Integer criteriaBookmarkExistsInReport(String bookmarkTitle) {
//This method finds the associated bookmark
if (controller != null) {
//From: http://www.icesoft.org/JForum/posts/list/13433.page
//Get the bookmarks (icepdf calls them outline items)
if (outline... |
fa8d56c3-0852-4a4f-8cfe-d94be66f196d | 9 | public void runTest(int startinstancecount, int maxiterations, int extraruns)
{
// Checks the parameters
if (startinstancecount < 0 || maxiterations <= 0 || extraruns < 0)
{
System.out.println("The test parameters must be 0 or above");
return;
}
// Prepares the variables
int currentinstances = sta... |
4e885034-94c7-4085-8918-4e107afcc009 | 7 | public void update () {
for ( int i = 0; i < numUsed; i++ ) {
int p = ( (firstUsed+i) % MAX_PARTS ) * NUM_FIELDS;
if ( particles[ p + FIELD_L ] > 0 ) {
if ( particles[ p + FIELD_A ] <= 0 ) {
// Die if alpha <= 0
particles[ p + FIELD_L ] = 0;
} else {
// Update position
particle... |
1f997cfa-3ed1-4f20-bf85-e8c67bb3953c | 9 | protected static void set(PreparedStatement pstm,int poss,Object value,String query) throws DaoManagerException {
if (value instanceof String || value == null){
setString(pstm,poss,(String)value,query);
} else if (value instanceof Date){
setDate(pstm,poss,(Date)value,query);
} else if (value instanceof Boo... |
bd7f860b-7392-4b88-be78-d1d2bea0071d | 9 | protected Op.Pair<Boolean, Boolean> extractLocksOutputAndRange(String line) {
int index = line.indexOf(':');
if (index < 0) {
throw new RuntimeException("[syntax error] expected property of type "
+ "'key : value' in line: " + line);
}
boolean output, rang... |
bc127fb3-b010-49e5-a730-09baac9a72ad | 0 | @Override
public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub
} |
b8d3f2e7-b359-4684-944b-0e8488649f07 | 5 | public void printBoard() {
for (int i = 0; i < 9; i++) {
if (i % 3 == 0) {
System.out.println(" -----------------------");
}
for (int j = 0; j < 9; j++) {
if (j % 3 == 0) {
System.out.print("| ");
}
... |
45ed59ce-7335-44e4-93c0-3b52fc19a3b7 | 5 | private void merge(int low, int mid, int high){
for(int i=low; i<=high; i++){
temp.add(item.prizes.get(i));
tempWeight.add(item.weights.get(i));
}
int i=low;
int j=mid+1;
int k=low;
while(i <= mid && j <= high){
if(temp.get(i)/tempWei... |
2a15ae4c-f982-45ca-be95-7cd76e8373db | 3 | protected double getNextFailureNumResSample()
{
double sample;
if (failureNumResPatternDiscrete_ != null)
{
sample = failureNumResPatternDiscrete_.sample();
return Math.abs(sample);
}
else if (failureNumResPatternCont_ != null)
{
sa... |
e1e8af87-a198-4a8e-9ba8-716b91b2648b | 7 | private void jRadioViaDOMActionPerformed(
final java.awt.event.ActionEvent evt) {
switch (etat) {
case INIT_JSON_XML:
throw new RuntimeException("Bouton ViaDOM : "
+ "action interdite car "
+ "Etat INIT_XML_JSON");
case INIT_XML_JSON:
throw new RuntimeException("Bouton ViaDOM : "
+ "action... |
a7b753a5-4206-4eee-aba1-7dc9f073801c | 6 | public boolean sendMove()
{
isPossible=false;
chosenMovePiece=null;
//I get the piece that the user is trying to move
for(int i=0; i < arraySquares.size(); i++)
{
if(arraySquares.get(i).getRow()==rowY && arraySquares.get(i).getCol()==colX)
chosenMovePiece =arraySquares.get(i).getPie... |
22531716-1d24-49aa-839d-1b720223d590 | 0 | public Stats getConstStats() {
return constStats;
} |
f7cc3aa1-b4ae-45a1-9f1d-03ad0fb135f2 | 1 | private JPanel getJContentPane() {
if (jContentPane == null) {
jLabelMaxWords = new JLabel();
jLabelMaxWords.setText("Maximum words");
jLabel5 = new JLabel();
jLabel5.setText("Additional characters which are possible only inside a word:");
jLabel1 = new JLabel();
jLabel1.setText("Possible characters... |
615603d5-8fdc-4aa4-ad1c-19b85fbdb8cc | 2 | public Color getSpriteColor( SpriteSelector spriteSelector, JComponent sprite ) {
if ( sprite == null ) return null;
if ( isSpriteValid(spriteSelector, sprite) )
return validColor;
else
return invalidColor;
} |
c481a31e-4be8-4ee1-a83b-d3b4bb2c2084 | 4 | public boolean setGridObj() {
boolean test = false;
if (test || m_test) {
System.out.println("FileManager :: setGridObj() BEGIN");
}
m_gridObj = m_game.getGrid();
if (test || m_test) {
System.out.println("FileManager :: setGridObj() END");
}
return true;
... |
ae012442-5d84-436d-8e0c-927c7106b183 | 6 | public void incCredits(float inc) {
if (Float.isNaN(inc)) I.complain("INC IS NOT-A-NUMBER!") ;
if (Float.isNaN(credits)) credits = 0 ;
if (inc == 0) return ;
final int oldC = (int) credits() ;
super.incCredits(inc) ;
final int newC = (int) credits() ;
if (! venue.inWorld() || oldC == newC) r... |
511f8bda-26d3-47ed-a84c-3c4458e1a4c9 | 5 | public ViewCustomer(ModelShop model){
super("Käuferansicht");
this.model = model;
model.addObserver(this);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(600,450);
JPanel mainPanel = (JPanel) getContentPane();
mainPanel.setLayout(new GridBagLayout());
// Einkäufe
orderScrollList = new JLis... |
4c4c4962-7ab9-4350-803f-c5515d47b727 | 7 | private ProcessResult exec(List<String> argList,boolean strictErr) throws Exception {
for(String x:argList) {
System.out.print(x);
System.out.print(' ');
}
System.out.println("");
ProcessResult result=shell.exec(argList.toArray(new String[argList.size()]));
... |
60f2d9a6-afb8-4cc7-954f-a36dbca62212 | 2 | public byte[] getMPInt() {
int i=getInt(); // uint32
if(i<0 || // bigger than 0x7fffffff
i>8*1024){
// TODO: an exception should be thrown.
i = 8*1024; // the session will be broken, but working around OOME.
}
byte[] foo=new byte[i];
getByte(foo, 0, i);
return foo;
} |
6630d34e-bb51-4a0e-b73c-a19809b25f94 | 0 | public SignatureMethodType getSignatureMethod() {
return signatureMethod;
} |
089355f6-4f2b-4f85-bc45-7c84be54c878 | 3 | private Color calculateColour(PColorSpace colorSpace, Point2D.Float xy,
Point2D.Float point1, Point2D.Float point2,
float t0, float t1) {
// find colour at point 1
float xPrime = linearMapping(xy, point1, point2);
float t = para... |
88416250-509a-4172-908b-1dc422a68c29 | 8 | public String convertData(String s, int indexColumn) {
String r = "";
if (increasing.get(indexColumn) == -1) {
//TO DO: invert String
for (int i = 0; i < s.length(); i++) {
char ch = s.charAt(i);
char t;
if ('0' <= ch && ch <= '9') {
t = (char) ('9' - ch + '0');
} else if ('a' <= ch && ... |
c7854c18-eb1a-44b1-ac48-c9154493acbe | 8 | public void setChunkData(int var1, int var2, int var3, int var4, int var5, int var6, byte[] var7) {
int var8 = var1 >> 4;
int var9 = var3 >> 4;
int var10 = var1 + var4 - 1 >> 4;
int var11 = var3 + var6 - 1 >> 4;
int var12 = 0;
int var13 = var2;
int var14 = var2 + ... |
5f8902af-8885-4fb1-bfdd-73b1901ccdf0 | 4 | public synchronized Sprite getSprite(){
if(list.length==0){
return null;
}else{
if(totalTime==-1)
return list[0];
movieTime++;
if(movieTime>=spriteTime[sceneIndex]){
movieTime=0;
if(sceneIndex+1<list.length)
sceneIndex++;
else {
sceneIndex=0;
}
}
return list[scene... |
3e6d9356-adf6-4133-a872-99fdcaa7f07e | 6 | @Override
public void visitAssert(XTreeAssert _assert) {
XCodeGen code = getCode(_assert);
XCompiledPart part = visit(_assert.condition);
if (part.isConstValue()) {
if (part.isFalse() && !options.removeAsserts) {
code.addInstruction(_assert, XOpcode.LOADN);
code.addInstruction(_assert, XOpcode.IMPORT,... |
b28359f6-4e6f-4be1-aea9-393cd775be2b | 2 | public synchronized void start(HTSMsg msg, int clientId){
Subscription s = getSubscription((Long) msg.get("subscriptionId"), clientId);
HTSPServerConnection c = monitor.getServerConnection(s.serverConnectionId);
msg.put("subscriptionId", s.serverSubscriptionId);
try {
c.send(msg);
} catch (IOException e) {... |
a9d99e94-b9ea-4778-b365-afc9289d65f2 | 1 | public DeleteCommand(Composition document, int startFrom, int endAt) {
this.document = document;
this.startFrom = startFrom;
this.endAt = endAt;
this.buffer = new ArrayList<Glyph>();
for (int i = this.startFrom; i <= this.endAt; i++) {
this.buffer.add(this.document.getChildren().get(i));
}
} |
9aab5623-9048-423e-bc32-a1dabba9d189 | 1 | */
public void visit_multianewarray(final Instruction inst) {
final MultiArrayOperand operand = (MultiArrayOperand) inst.operand();
final Expr[] dim = new Expr[operand.dimensions()];
for (int i = dim.length - 1; i >= 0; i--) {
dim[i] = stack.pop(Type.INTEGER);
}
final Type type = operand.type();
fin... |
dcd58e2f-5ece-445e-8487-d228841cc9ea | 9 | private Gm createGmObj() {
String cPath=credPath();
if(StringUtils.isEmpty(cPath))
return null;
File f=new File(cPath);
if(!f.exists())
return null;
BufferedReader in;
try {
in = new BufferedReader(new FileReader(f));
String str;
while ((str = in.readLine()) != null) {
str=str.trim();
... |
6a0b7f40-7d57-4d2f-af9f-6e0f660d6d0a | 2 | public void testInit() {
ILoggerFactory factory = null;
try {
Class.forName("org.apache.log4j.Logger");
Class<?> log4jLoggerFactory = Class.forName("com.jfinal.log.Log4jLoggerFactory");
factory = (ILoggerFactory) log4jLoggerFactory.newInstance();
} catch(Exception e) {
assertTrue(false);
}
} |
65e7f512-b7c7-49b3-8ab9-51870f5c5708 | 1 | public static Jdbc creer(String pilote, String protocole, String serveur, String base, String login, String mdp) {
if (singleton == null) {
singleton = new Jdbc(pilote, protocole, serveur, base, login, mdp);
}
return singleton;
} |
0b176e15-770d-4e29-9a13-8ae136506892 | 1 | public SensesPackage shadowCasting(int cx, int cy, int radius) {
//Calculate lit squares from the given location and radius
currentSenses = new SensesPackage(sizex);
for (int oct = 0; oct < 8; oct++) {
castLight(cx, cy, 1, 1.0, 0.0, radius, mult[0][oct], mult[1][oct],
... |
b678bc48-d118-4d0f-92de-5a7c358db317 | 7 | private void createDialog(Component parent) {
dialog = new JDialog(JOptionPane.getFrameForComponent(parent), "Bookmark Manager", true);
String s = Modeler.getInternationalText("ManageBookmark");
if (s != null)
dialog.setTitle(s);
dialog.setResizable(true);
dialog.getContentPane().setLayout(new BorderLayou... |
be3ec8fe-1d45-43dc-b8b9-4bba52c31fdf | 9 | public static void badCharacter(ArrayList<StringSequence> database,String pattern)
{
Hashtable<Character,Integer> occuranceHash = new Hashtable<Character,Integer>();
occuranceHash = makeOccuranceHash(pattern);
int last;
for(int sequence = 0;sequence<database.size();sequence++)
{
ArrayList<Integer> foundIn... |
53d5a483-d184-4a25-b2bf-49308a1b777c | 2 | public static void omniSend(Message m){
rover = head;
while(rover!=null){
if(rover.status == 1){
rover.sendMessage(m);
System.out.println(m.header + " - " + rover.name);
}
rover = rover.next;
}
} |
56a3e028-3b23-4fb2-acee-3bd5c1341266 | 8 | public void run() {
while(running) {
try {
// Make sure we are still connected
if(socket.isClosed()) {
System.out.println("Socket was closed!");
this.cleanup();
running = false;
return;
}
// Read header
int size = -1;
try {
size = in.readUnsignedShort();
... |
4c6a259e-78c7-4251-ace1-ca324cf04464 | 4 | double rate(Board board)
{
// Count the holes, and sum up the heights
int mostHolesInAnyColumn = 0;
for (int x=0; x<board.getWidth(); x++)
{
final int colHeight = board.getColumnHeight(x);
int y = colHeight-2;
int holes = 0;
while (y>=0)
{
i... |
1f9fc89a-8d64-43e6-952c-73bf0fa8ee88 | 5 | public void addWindow(final Window<?> window) {
if (window.desktop != null) {
throw new IllegalStateException("Can't add window: Window already used elsewhere");
} else if (window.isClosed()) {
throw new IllegalStateException("Can't add window: Window already closed");
}... |
fc52faaf-2673-4ddb-895a-56f6497f3eca | 1 | public void skipLines(int n) throws IOException {
for (int i = n; i > 0; i--) {
in.skipUntil('\n');
in.skip(1);
}
} |
682bf1c4-89ad-4eeb-865d-403fe0796446 | 4 | @Override
void removeChild(@SuppressWarnings("unused") Node child)
{
// Remove child
if(this._identificador_ == child)
{
this._identificador_ = null;
return;
}
if(this._colcheteE_ == child)
{
this._colcheteE_ = null;
... |
b18c0be1-ee34-442c-a0e7-babd1d01f14c | 6 | public void switchToMenuScreen()
{
// CHANGE THE BACKGROUND
game.getGUIDecor().get(BACKGROUND_TYPE).setState(MENU_SCREEN_STATE);
// DISABLE DECORATIONS OR BUTTONS DEPENDING ON SCREEN FOR EFFICIENCY
if (game.isCurrentScreenState(SETTINGS_SCREEN_STATE))
{
g... |
18630ce0-838d-4b57-8cd6-f1aaf9737181 | 1 | public boolean setPasswordButtonHeight(int height) {
boolean ret = true;
if (height < 0) {
this.buttonPW_Height = UISizeInits.PW_BTN.getHeight();
ret = false;
} else {
this.buttonPW_Height = height;
}
somethingChanged();
return ret;
... |
94409eb9-8968-440a-9d86-398777091e87 | 3 | public JSONWriter object() throws JSONException {
if (this.mode == 'i') {
this.mode = 'o';
}
if (this.mode == 'o' || this.mode == 'a') {
this.append("{");
this.push(new JSONObject());
this.comma = false;
return this;
}
t... |
e8a61917-d79b-404c-9a8d-9fbf5d42b461 | 4 | private void evaluateRefs()
throws TokenCompileError {
Map<String, Integer> labelValues = getLabelValues();
boolean needDoOver = false;
int newWordPosition = 0;
for(PositionedResolvable pr : resolvablesList) {
int oldWordPosition = pr.getPosition();
pr.se... |
3a14279b-2fc6-47a9-bdec-418b905fa087 | 0 | public void setMsgID(String msgID) {
MsgID = msgID;
} |
30fabded-b4d2-4be5-bf02-0bd2b272fd53 | 8 | public static void main(String[] args) {
ConsistentGlobalProblemSetInitialisation starter = new ConsistentGlobalProblemSetInitialisation();
starter.initLanguage(new char[] { '0', '1' }, 10, "(0|101|11(01)*(1|00)1|(100|11(01)*(1|00)0)(1|0(01)*(1|00)0)*0(01)*(1|00)1)*");
int solutionFoundCounter = 0;
int noSolut... |
d6d73655-1ea6-45dc-a133-0b9364c07403 | 1 | private void repaintDivider(int index) {
if (index != -1) {
int x = getColumnDividerPosition(index);
repaintHeaderView(x - 1, 0, 3, Integer.MAX_VALUE);
repaintContentView(x - 1, 0, 3, Integer.MAX_VALUE);
}
} |
1e930b2b-5a16-406a-a8b4-1cc03757981a | 1 | public void stop() {
if (!running) {
throw new IllegalStateException("Simulation is stopped.");
}
running = false;
} |
6d761d22-1d31-4ded-b142-7f02f4586eb7 | 7 | @Override
public Parameter getParameter(final int parameterIndex) {
Parameter parameter;
switch (parameterIndex) {
case 0:
case 1:
parameter = super.getParameter(parameterIndex);
break;
case 2:
parameter = rate;
... |
62e1aa74-3e28-467f-ae63-8afc8fad4070 | 5 | private int maptype1_quantvals() {
int vals = (int) (Math.floor(Math.pow(entries, 1. / dim)));
// the above *should* be reliable, but we'll not assume that FP is
// ever reliable when bitstream sync is at stake; verify via integer
// means that vals really is the greatest value of dim f... |
4cbce8aa-4f65-4648-a3b3-64d81e65cc1e | 2 | private TVC generateTVC(int id) throws CloneNotSupportedException {
TVC tvc = new TVC(id, r.nextDouble());
int idx1, idx2;
idx1 = r.nextInt(NUM_FIREWALLS);
do {
idx2 = r.nextInt(NUM_FIREWALLS);
} while (idx2 == idx1);
tvc.setFirewallIndexes(idx1, idx2);
for (Environment e : en... |
0f8039c9-700b-4711-bb8f-49ea2a78b35b | 1 | public String toString() {
// code to display pizza name and ingredients
StringBuffer display = new StringBuffer();
display.append("---- " + name + " ----\n");
display.append(dough + "\n");
display.append(sauce + "\n");
for (int i = 0; i < toppings.size(); i++) {
display.append((String )toppings.get(i) +... |
b16882d7-e8ed-4131-960e-ac1f7c0d6ed1 | 4 | @Override
protected void execute() {
for(int i=0;i<numTexts;i++) {
seq(new EflTextSegment(confirmWithA ? Move.B : Move.A));
if (extraWait > 0)
seqEflSkipInput(extraWait);
seq(new MoveSegment(new EflPressButton(confirmWithA ? Move.A : Move.B), MoveSegment.MAX_DELAY));
}
} |
87f75966-6c3e-4fa6-8937-9721c7f938ba | 1 | private String randpwd() {
String charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
StringBuilder buf = new StringBuilder();
for (int i = 0; i < 8; i++)
buf.append(charset.charAt((int) (Math.random() * charset.length())));
return (buf.toString());
} |
37296302-f601-43f2-abf7-341b2810c469 | 7 | public int solution(int[] A) {
// write your code in Java SE 7
int length=A.length, startingNum,minValue=Integer.MAX_VALUE, missingNum=-1;
HashMap<Integer, Boolean> hMap=new HashMap<Integer, Boolean>();
//if(length==1)
//return 1;
for(int i=0;i<length;i++)
{
hMap.put(A[i], true);
if(A[i]<m... |
352fde24-6a89-471e-9ca6-df491688a923 | 7 | private static int getIntByClassNum(String classnum) {
if (classnum.equals("G06Q10/00")) {
return 1;
} else if (classnum.equals("G06Q20/00")) {
return 2;
} else if (classnum.equals("G06Q30/00")) {
return 3;
} else if (classnum.equals("G06Q40/00")) {
return 4;
} else if (classnum.equals("G06Q50/00"... |
11c939b3-9e24-4cfc-8fa0-5623c9dd5e99 | 7 | public String[][] nextTwo(String args) {
Random rng = new Random();
String[][] rt = new String[2][0];
if (args.compareToIgnoreCase("roulette") == 0) {
Double num1 = rng.nextDouble() * this.fitness[this.fitness.length - 1];
Double num2 = rng.nextDouble() * this.fitness[this.fitness.length - 1];
if (num2... |
93ff3a9d-ede6-4982-9f25-0059df29eb9c | 4 | public Quest assignQuest(Node holder) {
Quest quest;
String name;
try {
name = ((Interactable) holder).model.getUserData("Name");
}
catch (ClassCastException e) {
name = ((Npc) holder).model.getUserData("Name");
}
if (name.equals("Tester")) {
quest... |
cbcdb7f9-0b03-4f4b-9492-8a4232d93dcb | 2 | Schedule generateRandomSchedule(int x, int y, int i, int j){
Schedule s = new Schedule(new RoomScheme[x][y]);
for(int k=0; k<x; k++){
for(int m=0; m<y; m++){
s.schedule[k][m] = generateRandomScheme(i, j, d.subject);
}
} return s;
} |
2b2bccdc-cf18-43d7-9b52-bd46774fbd5e | 5 | public void paint(Graphics g)
{
// draw the walls
g.drawImage(map.get(player.getRoom()).image, 0, 0, null);
// draw the player
g.setColor(Player.COLOR);
// This is temporary. Player doesn't get drawn if hit
if (player.getHealth()>0)
g.fillRect(player.getPosition().x,
player.getPosition()... |
ec1247af-0d66-4c36-99ca-039d9be1401a | 0 | public ErmitForm (ArrayList<Excel> allEx)
{
allex = allEx;
setColoredExes();
} |
2340fd3d-dfc2-4bda-830e-6f6fdcc8cdd4 | 0 | public String getUsername() {
return this.username;
} |
945e62ca-5237-4eac-a02f-976ae9263415 | 5 | public static String decode(String data) {
String message = data;
char lastpo1 = '0';
char tempc = '0';
for (int pos = 0; pos < message.length(); pos++) {
if (message.charAt(pos) != '0') {
tempc = message.charAt(pos);
if (lastpo1 == message.charAt(pos)) {
message = message.substring(0, pos -... |
55468cdf-41da-4225-a8cc-6449b02fc655 | 4 | public Player getPlayer(Integer soundNumber) {
Player pl = null;
try {
pl = Manager.createRealizedPlayer(new URL("file:///" + baseDir
+ _filenames.get(soundNumber)));
} catch (NoPlayerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (CannotRealizeException e) {
//... |
0bec9d1e-297d-4e79-beef-f35b627a8ed3 | 5 | private void fireMouseMotionEvent(MouseEvent e) {
TextMouseEvent textMouseEvent = null;
Object[] listeners = listenerList.getListenerList();
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == TextMouseMotionListener.class) {
if (textMouseEvent ==... |
e206f4fb-8a31-4de0-8999-2da1bf66ac0f | 1 | @EventHandler
public void onKeyReleased(KeyReleasedEvent event) {
final Keyboard key = event.getKey();
final UUID ident = event.getPlayer().getUniqueId();
switch (key) {
case KEY_LSHIFT:
SHIFT_HELD.put(ident, false);
}
} |
774987fd-c52a-41de-8ce7-5875ea56eca0 | 3 | private void downloadJars(){
downloader = new FileDownloader();
for(URL url : urlList){
String paths[] = url.getFile().split("/");
String fileName = paths[paths.length - 1];
downloader.addFileDownloadItem(new FileDownloadItem(new File(dir, fileName), url));
}
if(Settings.useZipClient[frame.getCurrentSe... |
009a3017-493c-434e-86d4-6ed522c0bcc3 | 7 | public void renderOverlays(float par1)
{
GL11.glDisable(GL11.GL_ALPHA_TEST);
int var2;
if (this.mc.thePlayer.isBurning())
{
var2 = this.mc.renderEngine.getTexture("/terrain.png");
GL11.glBindTexture(GL11.GL_TEXTURE_2D, var2);
this.renderFireInFirs... |
3e9514a6-01e9-4e89-a8e0-b3338e415aef | 9 | private boolean checkAllStericsBBonly(int strandNum, int resNum) {
Residue res = m.strand[strandNum].residue[resNum];
Atom tmpAtm = null;
int resToCheck = 0;
for(int i=0;i<res.numberOfAtoms;i++) {
if (isBBatom(res.atom[i])){ //backbone atom
resToCheck = m.strand[strandNum].numberOfResidu... |
b19c9854-84b0-447a-bac5-8591fac0aaf2 | 2 | public static boolean hasRemainder(int n){
for(int i=1;i<=20;i++){
if(n%i !=0){
return true;
}
}
return false;
} |
237bbef6-04bf-4537-ac41-f1c7b3b20452 | 1 | public void handle(Throwable e) {
e.printStackTrace();
JTextArea area = new JTextArea(10, 40);
StringWriter writer = new StringWriter();
e.printStackTrace(new PrintWriter(writer));
area.setText(writer.toString());
area.setCaretPosition(0);
String copyOption = resources.getString("dialog... |
0cb07f21-4ef5-49e0-8808-040a59bbfcd6 | 2 | @Override
public void executeAll() {
try {
for(IGamesCommand c : _gamesCommandLog) {
c.setExecutor(games);
c.execute();
}
} catch (CommandException e) {
System.err.println("Error: Illegal/Invalid command was stored in GamesCommandLog");
e.printStackTrace();
}
} |
87fa432c-2ed0-409e-8438-302ce5b27940 | 4 | @Override
public String onTalk(L2Npc npc, L2PcInstance player)
{
String htmltext = "";
QuestState st = player.getQuestState(getName());
if (st == null)
newQuestState(player);
if (st != null)
{
if (player.isHero())
{
if (hasHeroWeapon(player))
{
htmltext = "already_have_weapon.htm";
... |
af2effe4-e8c5-4972-ac47-1c47ef401a7c | 2 | public MainPanel(Simulation controller) {
this.scape = controller;
xSize = scape.xSize;
ySize = scape.ySize;
setLayout(new GridLayout(xSize, ySize));
addMouseListener(this);
labels = new JLabel[xSize][ySize];
for(int y = 0; y < ySize; y++) {
for(int x = 0; x < xSize; x++) {
labels[x][y] = ... |
2626a1d0-2344-49e3-9f74-04a198005b69 | 9 | public int loadContestUsers() {
int count = 0;
try {
Scanner scan = new Scanner(Server_Loader.accounts);
int liner = 0;
boolean read = false;
count += 1;
names.put("D1", "Developer: Konstantin Shandurenko");
passwords.put("D1", Pass... |
266feb7a-e466-4d9a-b852-302b6e9e828b | 5 | public final boolean validate(int fbWidth, int fbHeight) {
List<Integer> seenIds = new ArrayList<Integer>();
Rect fbRect = new Rect();
if (screens.isEmpty())
return false;
if (numScreens() > 255)
return false;
fbRect.setXYWH(0, 0, fbWidth, fbHeight);
for (Iterator<Screen> iter = s... |
83781546-013e-4359-a12c-0d07ddb1499d | 7 | public void reglageJoueur()
{
boolean recommencer = true ;
System.out.println("Vous allez être un client du Casino Vegas \nNous allons choisir vos caracteristiques \nEntrez votre prenom :");
this.prenom = keyboard.nextLine();
System.out.println("Entrez votre nom");
t... |
ece79d73-6e65-4ded-a4fb-11f9949b3233 | 7 | private void jComboBoxNomeAparelhoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxNomeAparelhoActionPerformed
// TODO add your handling code here:
if (jComboBoxMarca.getSelectedIndex() == -1){
JOptionPane.showMessageDialog(null, "Desculpe mas você precisa selecion... |
808a4018-72a1-4876-9932-9485c7b53d0b | 3 | @Test
public void testreadLineByLine() {
fread = new FileRead();
prop = new Properties();
InputStream inStream = getClass().getClassLoader().getResourceAsStream("com/file/resources/file.properties");
Scanner scn;
int count = 0;
try {
prop.load(inStream);
String pathLocation = prop.getProperty("... |
92e5000e-107f-4835-9ca7-907100bd2c74 | 4 | private void incomingReader() {
String line;
SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy");
try {
BufferedReader reader = new BufferedReader(new FileReader(myWords));
while ((line =reader.readLine()) != null){
String[] resultStr... |
8d00c4c7-91be-472f-8dd5-aa7215741ddd | 5 | RegulationFileConsensus consensus(RegulationFileConsensus regCons, String cellType) {
if (verbose) Timer.showStdErr("Creating consensus for cell type: " + cellType);
ArrayList<Regulation> regs = regCons.getRegulationList(cellType);
if (verbose) Timer.showStdErr("Sorting: " + cellType + "\t, size: " + regs.size()... |
578cfd23-214d-4c22-aae1-f92dce999ac7 | 2 | public static int findMaximum(ArrayList <Employee> employee, int i)
{
int j, max = i;
for(j = i + 1; j < employee.size(); j++)
{
if (employee.get(j).getGrossPay() > employee.get(max).getGrossPay())
max = j;
}
return max;
} |
770c863d-4a9c-44cb-959f-146575be6161 | 9 | static int isInPolygon(Point p, Point[] polygon) {
int n = polygon.length;
boolean in = false;
for (int i = 0; i < n; i++) {
Point a = polygon[i].subtract(p);
Point b = polygon[(i + 1) % n].subtract(p);
if (approxEquals(a.cross(b), 0) && a.dot(b) < EPS) return... |
5a495c30-b4b1-4e3b-8e36-8140e552e7ef | 1 | public boolean addExportFormat(String formatName, SaveFileFormat format) {
if (isNameUnique(formatName, exporterNames)) {
format.setName(formatName);
exporterNames.add(formatName);
exporters.add(format);
// Also add it to the list of formats stored in the preferences
Preferences.FILE_FORMATS_EXPORT... |
4bddade0-31fc-42f3-b7e0-9e7b6cee55a3 | 5 | public void keyPressed(int k) {
if(k == KeyEvent.VK_LEFT) player.setLeft(true);
if(k == KeyEvent.VK_RIGHT) player.setRight(true);
if(k == KeyEvent.VK_UP) player.setUp(true);
if(k == KeyEvent.VK_DOWN) player.setDown(true);
if(k == KeyEvent.VK_Z) player.setPummeling();
} |
d3846e59-659d-4de6-9472-2804450b3030 | 5 | public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
String name = request.getParameter("toname");
String username = request.getParameter("username");
response.setContentType("text/html");
PrintWriter out = respo... |
c28c035e-bfe8-4113-a5e4-844a58c66f86 | 4 | @Override
public final boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Coordinate other = (Coordinate) obj;
if (this.x != other.x) {
return false;
}
... |
2b2c8d7c-c718-43b6-b6c2-52aad91ec6fc | 4 | public char getField(int axisX, int axisY) {
if (axisX<=FIELD_MAX_SIZE && axisY<=FIELD_MAX_SIZE && axisX>=FIELD_MIN_SIZE && axisY>=FIELD_MIN_SIZE) {
return fields[axisX][axisY];
}
else {
System.out.println("Такого поля не существует");
return ' ';
}
... |
f8fdbb13-d9ca-4bda-ab93-0019330ff37e | 1 | private MapLoader(){
mapMap = new HashMap<String, URI>();
biEx = new BinaryExporter();
biIn = new BinaryImporter();
ArrayList<File> al = searchTileFiles();
for(File f : al){
mapMap.put(f.getName(), f.toURI());
}
} |
7119dcd2-3e4e-43da-94d1-c868ee945deb | 3 | private boolean jj_3_48() {
if (jj_scan_token(LEFTPARENTHESES)) return true;
if (jj_3R_66()) return true;
if (jj_scan_token(RIGHTPARENTHESES)) return true;
return false;
} |
7383f0a8-19b6-4834-bedf-7fc93fb38a24 | 3 | @SuppressWarnings("unchecked")
public static <T> T getAncestorOfType(Component component, Class<T> type) {
if (component == null) {
return null;
}
Container parent = component.getParent();
while (parent != null && !type.isAssignableFrom(parent.getClass())) {
parent = parent.getParent();
}
return (T) ... |
daf8f40b-8c4d-41d4-903c-bdaade2a2dc1 | 9 | public static String escapeForJSON(String aText){
final StringBuilder result = new StringBuilder();
StringCharacterIterator iterator = new StringCharacterIterator(aText);
char character = iterator.current();
while (character != StringCharacterIterator.DONE){
if( character == '\"' ){
... |
5881929f-5e93-421d-9c66-0049e97dd750 | 1 | private static void findnextvertextotraverse() {
// TODO Auto-generated method stub
score = 100000000;
vertextotransverse =0;
int tailvertex = 1;
for(int j = 0;j<explored.size();j++){
tailvertex = explored.get(j);
findminimumgreedyscorefortailvertex(tailvertex);
}
} |
50ca43bd-fef9-4676-921f-77b3bef32dc5 | 1 | public boolean equals(Vector2f r)
{
return r.getX() == x && r.getY() == y;
} |
5e90ab04-d974-4e51-9be4-2714c75d227f | 5 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
precal();
while ((line = in.readLine()) != null && line.length() != 0) {
int ntest = Integer.parseInt(line.trim())... |
1305da96-6d25-4bbe-b2e1-c4515e17e2df | 4 | @Override
public void run() {
if (!this.isStale()) return;
FileWriter fileWriter = null;
try {
fileWriter = new FileWriter(this.output);
} catch (final IOException e) {
this.plugin.getLogger().severe("Error opening file: " + this.output + "; " + e);
... |
5bbcab7a-f763-4a5e-8045-fe4c818fc158 | 9 | private int jjMoveStringLiteralDfa9_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
return jjStartNfa_0(7, old0, old1, 0L);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(8, active0, active1... |
b8960ec7-a90f-418e-8f50-eb280a06160c | 0 | public int getReferenceID() {
return this.referenceID;
} |
3119dadd-9327-4935-a2f3-b0889d9e2f79 | 0 | public void setLeftBranch(ClusterNode leftBranch) {
this.leftBranch = leftBranch;
} |
61bb41e3-ae0e-44e5-9813-3320269c00da | 0 | public void readLocale(){
LoadLocaleConstants myLocale = new LoadLocaleConstants();
myLocale.ReadfromProperties();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.