method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d2c9011f-5d8b-4b29-9dd7-bd1ba6f74420 | 2 | public ArrayList<Toppizzat> haeToppizzat() throws DAOPoikkeus {
//avataan yhteys
Connection yhteys = avaaYhteys();
try {
String sql = "SELECT TilauksenTuote.tuoteID, nimi, (count((TilauksenTuote.tuoteID))*kplmaara) AS pizzojenmaara "
+ "FROM TilauksenTuote "
+ "LEFT JOIN Tuote ON Tuot... |
8f996954-07df-4385-bd7e-6054220d3f3e | 2 | public static Client getClient(String username) {
for (Client client : getConnections()) {
if (client.getUsername().equalsIgnoreCase(username))
return client;
}
return null;
} |
c40d18c4-f26e-4fd3-b81c-9f67ac6e4a04 | 8 | public final void quant(final float[] lsp,
final float[] qlsp,
final int order,
final Bits bits)
{
int i;
float tmp1, tmp2;
int id;
float[] quant_weight = new float[MAX_LSP_SIZE];
for (i=0;i<order;i++)
qlsp[i]=lsp... |
f44fa40b-466f-4643-8b5f-7d6d3a52710d | 3 | public ChatClient(String hostName, String port)
{
super();
if (System.getProperty("os.name").contains("Mac")) {
System.out.println("The game knows that it is running on Mac OS.");
System.setProperty("apple.laf.useScreenMenuBar", "true"); //make JMenuBars appear at the top in ... |
c6024bd9-1413-4f69-a89b-ae9c69c0a249 | 6 | @Override
public PlainSentence doProcess(PlainSentence ps) {
String word = null;
StringBuffer buf = new StringBuffer();
StringTokenizer st = new StringTokenizer(ps.getSentence(), " \t");
while (st.hasMoreTokens()) {
word = st.nextToken();
/* repeated character */
if (word.length() > REPEAT_CHAR_ALLO... |
66a57ae2-2bdb-433f-8640-98c35b125fac | 6 | @Override
public double[] computeValue(char refBase, FastaWindow window, AlignmentColumn col) {
values[0] = 0.0;
int posInRead, readLength;
int count = 0;
double rd = 0;
if (col.getDepth() > 0) {
Iterator<MappedRead> it = col.getIterator();
while (it... |
844b7038-e9e8-455b-bbaa-2a64ac18a584 | 3 | public String version_string()
{
switch (h_version)
{
case MPEG1:
return "MPEG-1";
case MPEG2_LSF:
return "MPEG-2 LSF";
case MPEG25_LSF: // SZD
return "MPEG-2.5 LSF";
}
return(null);
} |
4f2c6bcb-94c6-4450-8658-501dc2786b2f | 7 | @Override
public void execute() throws MojoExecutionException, MojoFailureException {
assert baseDirectory != null;
assert targetDirectory != null;
assert includes != null && includes.length > 0;
assert excludes != null;
if (skip) {
getLog().info("[xml-format] Skipped");
return;
}... |
da07832e-a751-4575-a677-1ec198ae264f | 6 | @Override
public AsciiImage execute(AsciiImage img) throws OperationException {
Scanner scanner = new Scanner(data);
int lineCount = 0;
while (scanner.hasNext()) {
String line = scanner.nextLine();
if (line.length() == 0)
break;
if (line... |
d0ab46cf-0384-4bce-9f6a-0f2458c65014 | 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://... |
57c6bb11-2034-4fa0-b7e4-5f3d1143ce0c | 8 | private boolean check() {
if (N == 0) {
if (first != null) return false;
}
else if (N == 1) {
if (first == null) return false;
if (first.next != null) return false;
}
else {
if (first.next == null) return false;
}
... |
f3aa4de6-ebd3-4b17-a1e6-e2905d442497 | 9 | private String utilisateurTestValidite(Utilisateur utilisateur) {
String resultat = "";
if(utilisateur.getLogin().length()==0){
resultat += "Le login du nouvel utilisateur doit être renseigné. ";
}else if(dao.UtilisateurExisteDejaEnBase(utilisateur.getLogin())){
resultat += "Le login "+utilisateur.getLogin(... |
5ad9187c-58ec-4f05-b943-d87bc0ce8616 | 2 | public Shape rotateLeft() {
if (pieceShape == Tetrominoes.SquareShape)
return this;
Shape result = new Shape();
result.pieceShape = pieceShape;
for (int i = 0; i < 4; ++i) {
result.setX(i, y(i));
result.setY(i, -x(i));
}
return result;
} |
34801800-094c-45ea-9e44-322de19390a9 | 3 | private void CommandQuickPlay(boolean priority, boolean toStream,
boolean toLoop, String sourcename, FilenameURL filenameURL,
float x, float y, float z, int attModel, float distORroll,
boolean temporary) {
if (soundLibrary != null) {
if (filenameURL.getFilename().matches(
SoundSystemConfig.EXTENSION_... |
7b977929-9a3f-42a1-936a-9295f5770dd4 | 8 | public static String stripStart(String str, String stripChars) {
int strLen;
if (str == null || (strLen = str.length()) == 0) {
return str;
}
int start = 0;
if (stripChars == null) {
while (start != strLen && Character.isWhitespace(str.charAt(start))) {
start++;
}
} else if (stripChars.length()... |
0d5957a1-22a4-4bae-9f91-e8ae7c8ce91b | 9 | @SuppressWarnings("serial")
public EditorMenuBar(final BasicGraphEditor editor)
{
final mxGraphComponent graphComponent = editor.getGraphComponent();
final mxGraph graph = graphComponent.getGraph();
JMenu menu = null;
JMenu submenu = null;
// Creates the file menu
menu = add(new JMenu(mxResources.get("fi... |
547ef358-5c8e-4702-a9af-f550ea13109d | 6 | private LinkedList<String> checkForKeywordsConsistingOfSeveralWords(
LinkedList<String> possibleKeywords, LinkedList<String> result) {
LinkedList<String> output = new LinkedList<String>();
ArrayList<Keyword> keywordList = (ArrayList<Keyword>) dictionary.getKeywordList();
for(int i = 0; i < keywordList.si... |
f46864d5-b376-4ac8-bfb7-175d3162f037 | 4 | private void moveMob() {
Location loc = null;
if (p != null)
loc = p.getLocation();
else if (location != null)
loc = location;
if (p != null || location != null) {
EntityCreature mob = (EntityCreature) ((CraftCreature) c).getHandle();
PathEntity path = mob.world.a(mob, loc.getBlockX(), loc.getBlockY... |
ec87510b-0425-45bc-ae62-be35dcfad570 | 0 | @BeforeClass
public static void setUpClass() {
} |
d9588321-00dd-4cb7-b75b-0cf35252bd45 | 9 | synchronized public boolean handlecmd (BufferedReader din, DataOutputStream dout) {
String[] str;
int ret;
String getline = null;
boolean connectionClosed = false;
try {
getline = din.readLine();
if(getline != null)
{
//... |
7a687723-0c68-41c7-b800-65439b83d7d8 | 5 | private boolean jj_3R_27() {
if (jj_scan_token(TEMPORAL_START)) return true;
Token xsp;
xsp = jj_scanpos;
if (jj_3_35()) {
jj_scanpos = xsp;
if (jj_3_36()) return true;
}
xsp = jj_scanpos;
if (jj_3_38()) jj_scanpos = xsp;
if (jj_scan_token(TEMPORAL_END)) return true;
return f... |
3693de7b-6579-40b7-a2aa-9d48086aad36 | 2 | public String getfPago() {
if (fPago.length() > 4) {
if (fPago.substring(0, 2).equals("O/")) {
return fPago.substring(2, 6);
}
return fPago.substring(0, 4);
}
return fPago;
} |
b3883d02-f92f-4af3-92f6-c92e6355f1ce | 1 | public int getChanges() {
if (table != null) {
return ((DataBase) table).getNewKeys();
}
return 0;
} |
889fa166-ee81-404b-99d8-a53e7302eff0 | 3 | public void setFlying(boolean flying) {
if ((Byte) getValue(16) != (flying ? 1 : 0)) {
setValue(16, (byte) (flying ? 1 : 0));
sendData(16);
}
} |
4eb85f04-e2b6-42b7-a35a-0f24c671e932 | 4 | private void LisaaTyopaivaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LisaaTyopaivaActionPerformed
if (jDateChooser.getDate() != null && aikaValidi(Alku.getText()) && aikaValidi(Loppu.getText())) {
Calendar alku = new GregorianCalendar();
Calendar loppu = new Grego... |
700d9c16-efcd-413f-86ff-6c9bd8564376 | 0 | @Override
public void actionPerformed(ActionEvent e) {
Outliner.documents.getMostRecentDocumentTouched().getUndoQueue().redo();
} |
df9df55c-79ee-4a6d-9d4b-e5cf5bd4b8e4 | 4 | public static void save(String filename) {
File file = new File(filename);
String suffix = filename.substring(filename.lastIndexOf('.') + 1);
// png files
if (suffix.toLowerCase().equals("png")) {
try { ImageIO.write(onscreenImage, suffix, file); }
catch (IOExcep... |
6fbf5360-0caf-47bd-96f2-fcd2eaa4546c | 6 | protected static Ptg calcImConjugate( Ptg[] operands )
{
if( operands.length < 1 )
{
return new PtgErr( PtgErr.ERROR_NULL );
}
debugOperands( operands, "ImCongugate" );
String complexString = StringTool.allTrim( operands[0].getString() );
Complex c;
try
{
c = imParseComplexNumber( complexString ... |
2837780a-bdd4-4f25-835a-1d3eb5855bdd | 8 | public void render()
{
for(Interactable i: addons)
{
int [] image = i.getCurrentPixelArray();
for(int xx=0;xx<i.getWidth();xx++)
{
for(int yy=0;yy<i.getHeight();yy++)
{
if(i.getX()+yy>=0 && i.getY()+yy<height && i.getX()+xx>=0 && i.getX()+xx<width)
{
if(image[xx + yy* i.getWidth()]... |
1f4cbac7-b4d1-43d1-bf31-f48a5a97066b | 0 | public Order removeOrder(Order order) {
getOrders().remove(order);
order.setAccount(null);
return order;
} |
89326d5d-1303-497b-8754-bd62443a775a | 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... |
99b6bc5a-3c5a-4c4c-af15-4680e568c332 | 4 | private static boolean isGlobalIP4(InetAddress inet){
return ( (!inet.isAnyLocalAddress()) &&
(!inet.isLinkLocalAddress()) &&
(!inet.isLoopbackAddress()) &&
(!inet.isMulticastAddress()) &&
(inet instanceof Inet4Address) );
} |
95f01e5b-6776-401b-a792-09e4e99fe87e | 1 | public void testFactory_FromDateFields() throws Exception {
GregorianCalendar cal = new GregorianCalendar(1970, 1, 3, 4, 5, 6);
cal.set(Calendar.MILLISECOND, 7);
MonthDay expected = new MonthDay(2, 3);
assertEquals(expected, MonthDay.fromDateFields(cal.getTime()));
try {
... |
5470bca8-62c3-49fa-b4a8-5000d768ec28 | 3 | public Object load(String fqn) {
Object obj = null;
try {
obj = eu.anticom.eva.util.ClassLoader.load(fqn);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (Instantiatio... |
1d998c59-8a34-4a06-967d-5e85e9712691 | 9 | public void addToRaavareList(String r_id, String netto, String tolerance) throws DALException
{
boolean dataOk = true;
double net = 0.00;
double tol = 0.00;
try
{
net = Double.parseDouble(netto);
if(net < 0.05 || net > 20.0)
{
error+="Netto skal være mellem 0.05 og 20 kg.<br>";
dataOk = fals... |
4cf6258a-7f18-4840-8118-604820431937 | 3 | public LinkedList<Stock> qsort( LinkedList<Stock> a, int comparing ) {
LinkedList<Stock> d = a;
if (comparing == 0) // 0 means you are sorting by ticker name
qsHelpTick( 0, d.size()-1, d );
if (comparing == 1) // 1 means compare by price
qsHelpQuant( 0, d.size()-1, d );
if (comparing == 2) // 2 mea... |
f3772e17-3f8c-4d26-8435-ffe20716ab1a | 9 | Point moveSheep(int sheepId) {
Point thisSheep = sheeps[sheepId];
double dspeed = 0;
Point closestDog = getClosestDog(sheepId);
double dist = distance(thisSheep, closestDog);
assert dist > 0;
if (dist < RUN_DIST)
dspeed = RUN_SPEED;
else if (dist < WA... |
04c5ed9e-57c1-4bab-a6c3-9ad0e17fff5c | 6 | public double[] getSiteConcns(){
if(!this.psi0set && !this.sigmaSet)throw new IllegalArgumentException("Neither a surface potential nor a surface charge/density have been entered");
if(this.sigmaSet && !this.psi0set)this.getSurfacePotential();
if(this.psi0set && !this.sigmaSet)this.getSurfaceCha... |
5f70138f-5513-4c9e-85a9-b4b8f5a66d72 | 3 | public int read(byte[] buffer, int offset, int length) {
if (closed) {
return -1;
}
int totalBytesRead = 0;
while (totalBytesRead < length) {
int numBytesRead = super.read(buffer,
offset + totalBytesRead,
length - totalBytesRead);
... |
2d817835-2c78-4af5-912a-0c8b68b32bdd | 5 | @Override
public float setValueAt(int row, int column, float value)throws
ElementOutOfRangeException{
if(row<0 || column < 0){
throw new ElementOutOfRangeException(
" The value provided is smaller than Zero");
}
... |
9baa3488-ea07-4105-a144-620c44e6946e | 0 | public void addPopulation(ArrayList<Villager> newPopulation) {
this.population.addAll(newPopulation);
updateSizeRank();
} |
2fe8e8cb-5994-4c69-84cf-e9e822e3b551 | 8 | public int Open(String Filename, int NewMode)
{
int retcode = DDC_SUCCESS;
if ( fmode != RFM_UNKNOWN )
{
retcode = Close();
}
if ( retcode == DDC_SUCCESS )
{
switch ( NewMode )
{
case RFM_WRITE:
try
{
file = new RandomAccessFile(Filena... |
028552fa-f632-49d8-a52a-f0717c427594 | 9 | public void triggerSign(TriggerType type, Object data) {
InputState is = this.getInput(1, (BlockRedstoneEvent) data);
if (lastState != InputState.HIGH && is == InputState.HIGH) {
List<org.bukkit.entity.Player> players = getLocation().getWorld().getPlayers();
for (org.bukkit.ent... |
33846667-e137-4a58-ae1f-2da0d66a34cc | 2 | public static byte[] GenerateAuthenticatorClient(String clientid,
String key, String timestamp) throws NoSuchAlgorithmException {
int sharekeylen = 0;
if (key != null) {
sharekeylen = clientid.length() + key.length() + 17;
} else {
sharekeylen = clientid.length() + 17;
}
byte tmpbuf[] = new byte[shar... |
049ab05e-0d9b-4a92-ad74-31a9b5888ddc | 6 | public void generateProfile() {
File directory = new File(get("directory"));
for (String lang: arglist) {
File file = searchFile(directory, lang + "wiki-.*-abstract\\.xml.*");
if (file == null) {
System.err.println("Not Found abstract xml : lang = " + lang);
... |
eb49588d-f837-4a2a-8f12-1273e7d31d67 | 9 | public List<String> getAllComments(int pid){
PreparedStatement stmt = null;
Connection conn = null;
ResultSet rs = null;
List<String> comments = new ArrayList();
try {
conn = DbConnection.getConnection();
stmt = conn.prepareStatement(GET_COMMENT_STMT);
stmt.setInt(1, pid);
r... |
cfddd1e6-b185-411e-b757-cd7d84156898 | 1 | public int multiple (St st){
int x=0;
assert st.length==this.length;
for(int i=0; i<st.length; i++)
x+=st.get(i)*this.get(i);
return x;
} |
7494b833-0986-4c62-af24-67519ea17d77 | 3 | public void visitArithExpr(final ArithExpr expr) { // important one
expr.left().visit(this); // visit the left branch
if (!found) { // if a match isn't found yet
exchangeFactor++; // increase the exchange factor
if (expr.left().type().isWide()) {
exchangeFactor++; // twice if wide
}
if (exchangeFac... |
a0221abb-1511-444e-80c4-219841751d3f | 8 | Object getObject(double x, double y, Tool tool) {
Object o = null;
if (tool.type == ToolType.init && Vertex.randomInit.isOnPoint(x, y)) {
return Vertex.randomInit;
}
if (tool.compatible(ToolTarget.message) && (o = getMessage(x, y)) != null) {
return o;
}
... |
04be7c5f-a885-46db-9392-807840c0e957 | 4 | private ArrayList readingFiles(String nameFile) {
ArrayList listRowsFile = new ArrayList<>();
boolean notEmpty;
String lineFile;
int lineNumb = 0;
try {
BufferedReader readFile = new BufferedReader(new FileReader(DirectoryConfig.getInstance().getExtractDirectory() +... |
691f390b-9fb2-43a7-9634-10c18734c805 | 1 | private void skip(int num) throws IOException {
if (in != null) {
in.skip(num);
} else {
din.skipBytes(num);
}
} |
f17efa45-769f-45d1-b2be-d761e14610e9 | 7 | protected Point getMidEdge(Point cellCenter, Directions dir) {
int x1 = cellCenter.x - hexWidthInPixels / 2;
int x2 = cellCenter.x - hexWidthInPixels / 4;
int x3 = cellCenter.x;
int x4 = cellCenter.x + (hexWidthInPixels - 1) / 4;
int x5 = cellCenter.x + (hexWidthInPixels - 1) / 2... |
7e95de07-7c87-4a83-930c-3c58652e6d81 | 8 | @Override
public void registerClanForum(Clan clan, String allClanForumDefs)
{
if(clan==null)
return;
this.clanForums.remove(clan.clanID());
if(allClanForumDefs==null)
return;
final List<String> set=CMParms.parseCommas(allClanForumDefs,true);
final StringBuilder myForumList=new StringBuilder("");
for... |
14ea401b-9c86-49a4-813b-498a570015ee | 4 | public void sink(int k) {
while (2 * k <= N) {
int j = 2 * k;
if (j < N && isLesser(j, j + 1))
j++;
if (isLesser(j, k))
break;
swapArrayValues(j, k);
k = j;
this.comparisions += 2;
}
} |
07029760-3089-4fb4-8d7e-e6e546f41d42 | 7 | public static void startupShell() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/ONTOSAURUS", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$, ((M... |
e0f07f3a-15a5-4ed2-9309-f728f31e4aa6 | 9 | @Override
public Brain.Move bestMove(Board board, Piece piece, int limitHeight, Brain.Move move) {
// Allocate a move object if necessary
if (move==null) move = new Brain.Move();
double bestScore = 1e20;
int bestX = 0;
int bestY = 0;
Piece bestPiece = null;
Piece current = piece;
board.commit();
/... |
df620209-a53a-4b7f-b592-3cb489d17528 | 6 | public SusanDialog(final Panel panel) {
setTitle("Susan");
setBounds(1, 1, 300, 200);
Dimension size = getToolkit().getScreenSize();
setLocation(size.width / 3 - getWidth() / 3, size.height / 3
- getHeight() / 3);
this.setResizable(false);
setLayout(null);
JPanel pan = new JPanel();
pan.setBounds(... |
867ab567-74ff-4370-8fd6-9bd2df0d2386 | 3 | public int checkVal(String message) {
int num = -1;
boolean checkVal = true;
while (checkVal) {
num = getInt( message );
if ( num < 1 || num > 9 ) {
System.out.println("Oops that is not a valid number, enter a number from 1-9");
}
else {
return num;
}
}
return -1;
} |
f4e4f09c-93d7-48e1-aad8-2c57d435d1d2 | 8 | @Override
public void tableChanged(TableModelEvent e) {
if (e.getType() == TableModelEvent.UPDATE) {
int col = e.getColumn();
int row = e.getFirstRow();
Object newObj = locationTableModel.getValueAt(row, col);
Location location = getLocation(row);
switch (col) {
case 0:
if (newObj != null) {
... |
7ff75cb0-b1c6-43dc-bc7a-a8d17c6f3d65 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Item target=getTarget(mob,mob.location(),givenTarget,commands,Wearable.FILTER_ANY);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false... |
c133822f-509e-42b5-a434-615925dd03d6 | 4 | @Override
public void actionPerformed(ActionEvent e) {
String input = "";
while ((input != null) && (!input.matches("[0-9]{1,3}"))) {
input = (String) JOptionPane.showInputDialog(tabManager,
"Please input the number of list entries:", "Insert List",
JOptionPane.PLAIN_MESSAGE, null, null, "");
}
i... |
65daea71-e6de-44a2-9b29-e875bbbcfa6a | 8 | public int Open(String Filename, int NewMode)
{
int retcode = DDC_SUCCESS;
if ( fmode != RFM_UNKNOWN )
{
retcode = Close();
}
if ( retcode == DDC_SUCCESS )
{
switch ( NewMode )
{
case RFM_WRITE:
try
{
file = new RandomAccessFile(Filena... |
549bcb62-36db-4ee9-91f4-d92a38052583 | 6 | @EventHandler
public void onLaunch(ProjectileLaunchEvent event) {
Projectile projectile = event.getEntity();
if (event.isCancelled()) return;
if (!projectile.getType().equals(EntityType.SPLASH_POTION)) return;
if (plugin.getMainConfig().arePotionsAllowed()) return;
if (projectile.getShooter() == ... |
11ba1b04-1fa7-4b03-b414-6745518d16d8 | 2 | private Type typeFromDesc(String desc) throws BadBytecode {
CtClass clazz = null;
try {
clazz = Descriptor.toCtClass(desc, classPool);
} catch (NotFoundException e) {
throw new BadBytecode("Could not find class in descriptor [pos = " + lastPos + "]: " + e.getMessage());
... |
70529d0f-a064-4acf-b206-2dd384250dee | 2 | @Override
public void drawScene()
{
// Background color.
gl.glClearColor(1f, 1f, 1f, 0f);
// Clear background.
gl.glClear(GL_COLOR_BUFFER_BIT);
// Clear depth buffer.
gl.glClear(GL_DEPTH_BUFFER_BIT);
// Set color to black.
gl.glColor3f(0f, 0f, 0... |
bf686d14-bc28-4b21-80ed-b28bd99ce32c | 6 | public boolean solvable(){
@SuppressWarnings("unused")
int heads = 0;
float roomsRequired = 0;
boolean solvable = true;
/* for finding the hard constraints
For each person
If manager add 1 to rooms_required
If head add 1 to rooms_required
Else add .5 to rooms_required
If float(rooms) <... |
d9518f57-0e6f-4e21-8816-9f9b1c96e5d1 | 4 | private Canvas()
{
component = new CanvasComponent();
if (System.getProperty("com.horstmann.codecheck") == null)
{
frame = new JFrame();
if (!System.getProperty("java.class.path").contains("bluej"))
frame.setDefaultCloseOperation(JFrame.EXIT_ON... |
3016b636-d633-4398-9e6a-d1e57c89fa6b | 0 | public void setCode(String code) {
this.code = code;
} |
c5c10d1a-7d70-437b-b907-475f3bbcaf5e | 1 | public void testMinus_Years() {
Years test2 = Years.years(2);
Years test3 = Years.years(3);
Years result = test2.minus(test3);
assertEquals(2, test2.getYears());
assertEquals(3, test3.getYears());
assertEquals(-1, result.getYears());
assertEquals(1, Years... |
03744426-7a55-4686-b591-62bccb49b20b | 0 | public Technical() {
super();
espTitle= new ArrayList<String>();
TechTitles = new ArrayList<String>();
works= new ArrayList<String>();
} |
98f3c317-410b-4583-989c-052b9505d8ae | 6 | private void updateHealthPacks() {
ArrayList<HealthPack> deadHealthPack = new ArrayList<HealthPack>();
for(int i = 0; i < healthPacks.size(); i++) {
HealthPack hp = healthPacks.get(i);
hp.move();
if(CollisionDetector.isColliding(sc, hp)) {
sc.damaged(-2);
deadHealthPack.add(hp);
}
if... |
10d7db33-cd45-4bec-9528-304f04dbcd94 | 4 | public Patch getPatch (int x, int y){
if (x > getWidth()|| x < 0){
x=0;
}
if (y > getHeight()|| y< 0 ){
y=0;
}
return _grid[y][x];
} |
b67e506f-92fe-4808-99e2-720ed3c1dd6c | 0 | @Test
public void runTestExceptions4() throws IOException {
InfoflowResults res = analyzeAPKFile("GeneralJava_Exceptions4.apk");
Assert.assertEquals(1, res.size());
} |
e53d6c0b-c49e-460d-9522-a3d11895a6e2 | 9 | public String[][] agendaMedico (String id_medico, String mes,String ano ){
String sql_consult;
String fecha_ini, fecha_fin;
String [] [] resultado = null;
String dia_final;
int mes_entero = Integer.parseInt(mes);
switch (mes_entero)
{
case 2 : dia_fin... |
f6af4b28-88a0-4d34-822b-ad84e1e24552 | 6 | public void recuperar() {
FileInputStream fis = null;
ObjectInputStream stream = null;
try {
File arquivo = new File("arquivo.bin");
if (arquivo.exists()) {
fis = new FileInputStream(arquivo);
stream = new ObjectInputStream(fis);
persistencia = (Persistencia) stream.readObject();
}
} catch ... |
10a6a86f-160c-479e-817a-1ad23ed23937 | 1 | public int run(PrintWriter out, String[] args)
{
int numRings = Integer.parseInt(args[1]);
if (numRings<1) return(ILLEGAL_PARAMETER);
out.println(args[0]+ ": With " + numRings + " rings");
doTowers(out,numRings, 'A', 'B', 'C');
return SUCCESS;
} |
66d64fd0-5d7b-437d-8ca5-f519aec47dcb | 9 | static void setMenuItemWithoutNotifyingListeners(final JMenuItem mi, final boolean selected) {
if (mi == null)
return;
ItemListener[] il = mi.getItemListeners();
if (il != null) {
for (ItemListener x : il)
mi.removeItemListener(x);
}
ActionListener[] al = mi.getActionListeners();
if (al != null) {... |
f50b7736-0114-494e-b7c0-9e7e56f7b123 | 7 | protected void copy_cover_sets(CoverTreeNode query_chi, MyHeap new_upper_k,
Stack<Stack<d_node>> cover_sets,
Stack<Stack<d_node>> new_cover_sets,
int current_scale, int max_scale) throws Exception {
new_cover_sets.clear();
for (; current_scale <= max_scale; current_scale++) {
d_nod... |
851202a6-829f-4e66-bd3a-d1b74a2d9bf2 | 2 | public String getCarnumberByOrdernumber(Statement statement,String ordernumber)//根据订单号获取车牌号
{
String result = null;
sql = "select carnumber from ParkRelation where ordernumber = '" + ordernumber +"'";
try
{
ResultSet rs = statement.executeQuery(sql);
while (rs.next()) {
result = rs.getString("carnum... |
41ad21e0-c92c-4d30-a2da-c338077e91bc | 6 | @Override
public void update(int delta) {
checkforCollision();
if (Game.isShooting() && ((lastShoot > 25 * 1000 / SHOOTRATE))) {
lastShoot = 0;
SoundEffect.SHOOT1.play();
Game.addEntity(new Bullet(x - 11, y, -1));
Game.addEntity(new Bullet(x + 12, y, -1));
}
lastShoot += delta;
lastHurt += delt... |
2d362742-dfa0-4750-8ffa-5534bc63d65e | 1 | public String getString(int index) {
Object value = get(index);
return value != null ? value.toString() : ""; //$NON-NLS-1$
} |
97a251ba-2322-431f-a8fa-0ef6ebb0574d | 0 | public BDecoder(InputStream in) {
this.in = in;
} |
d0cb4dfb-6f96-4707-beb9-e70a42d2eda2 | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Sexo other = (Sexo) obj;
if (!Objects.equals(this.idSexo, other.idSexo)) {
return false;
... |
94d8c5ba-c62e-41d9-946b-d602ee4582f6 | 6 | private static int parse(char[] chars, int offset, int len, int radix,
boolean negative) throws NumberFormatException {
int max = Integer.MIN_VALUE / radix;
int result = 0;
for (int i = 0; i < len; i++){
int digit = Character.digit(chars[i + offset], radix);
if (digit ... |
8caed4b9-b0b2-4c8c-a73e-2ebac2e98772 | 0 | public void setSellerType(int sellerType) {
this.sellerType = sellerType;
} |
dca1632b-22ab-4e0c-8085-b8e5bb7c92da | 7 | void undo() {
switch (type) {
case SLIDE: {
base.dragY = dragY;
//if (east)
base.mouseHandler.setEastRollup(base);
/* else
base.mouseHandler.setWestRollup(base);*/
... |
2e5b6455-0208-461e-8ee3-2499866e07eb | 1 | @Override
protected void finalize() throws Throwable {
try {
close();
} catch (final IOException ex) {
LOGGER.warn("Problem trying to auto close file handles...", ex);
} finally {
super.finalize();
}
} |
1eb64523-a09a-448c-967b-575633808e93 | 7 | private SmartIconJButton findButtonAt(Point p) {
int start = otherIconsOffset;
if(otherIcons != null) { //2005/11/01
for(int i = 0; i < otherIcons.length; i++) {
SmartIconJButton btn = otherIcons[i];
if(p.x >= start && p.x < start + btn.getIconWidth()) {
if(p.y >= height / 2 - btn.getIconHeight()... |
87f7f5d9-a77d-4510-aa63-59f21efd5218 | 0 | public int getY(){return y;} |
7c96356b-bab1-486a-af98-00ca383662f7 | 2 | private void redrawDragHighlight(boolean forHeader, boolean forContents) {
if (forHeader) {
Rectangle bounds = getHeaderViewBounds();
int x = bounds.x;
int y = bounds.y;
int w = bounds.width;
int h = bounds.height;
paintHeaderViewImmediately(x, y, w, DRAG_FOCUS_WIDTH);
paintHeaderViewImmediately(... |
92814b56-2be3-4d3f-b4b8-af7450b3fd7b | 0 | public PaginationHelper(int pageSize) {
this.pageSize = pageSize;
} |
f81c2fdb-aa8e-49c8-9fcf-59b991f56311 | 9 | public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
... |
95a7afa0-3e1d-41d8-8bbf-8e0bf0b544f1 | 9 | private static Method getMethod(int requireMod, int bannedMod, Class<?> clazz, String methodName, Class<?>... params) {
for (Method method : clazz.getDeclaredMethods()) {
// Limitation: Doesn't handle overloads
if ((method.getModifiers() & requireMod) == requireMod &&
(me... |
8fdc2337-584c-443c-b211-c10cefab6ebc | 0 | private boolean isPlaced(long binPosition){
return ((binHasDisk & binPosition) != 0);
} |
89169c9f-4864-48b9-84ae-d5815dd1e423 | 8 | public static void cps1_render_scroll2_bitmap(osd_bitmap bitmap) {//not sure...
int sx, sy;
int ny = (scroll2y >> 4); /* Rough Y */
int base = cps1_game_config.bank_scroll2 * 0x04000;
int startcode = cps1_game_config.start_scroll2;
int endcode = cps1_game_config.end_scroll2;
... |
4b291b98-40b5-48a1-8b92-fd3b283e3f4c | 7 | private ListNode merge(ListNode head1, ListNode head2){
ListNode head = new ListNode(0);
ListNode p = head;
ListNode temp = null;
while (head1!=null && head2!=null){
if(head2.val < head1.val){
p.next=head2;
if(head2.next != null){
... |
95e991b6-cb02-4269-b0b9-19fcec11255a | 1 | public String getExceptions() {
return exceptions == null ? null : exceptions.toString();
} |
5f527337-fffe-4ef5-bfe4-fb8e1547ede9 | 1 | public boolean saveUserSettings(){
setUpUserSettings();
OutputStream outputStream = null;
Writer writer = null;
try {
outputStream = new FileOutputStream(this.fUserData);
writer = new OutputStreamWriter(outputStream, Charset.forName("UTF-8"));
this.xstream.toXML(userSettings... |
05475baf-ae08-4339-9f6e-981ed1540a5d | 4 | public void appendBytes(byte...datas){
this.isBuffered.set(true);
ByteBuffer buffer = this.getBuffer();
if(buffer.remaining() >= datas.length){// 缓冲区的空间大于数据的长度
buffer.put(datas);
log.info("the postion of the data: " + buffer.position());
}else{// 缓冲区的空间小于数据的长度
int offset = 0;// 初始相对位移为0
int length =... |
1d8b4fb8-5d29-43e8-94ed-25af6c690812 | 9 | private void initInputFromRegisters() {
final int REG_SEL_CNT = 3;
// FIXME fix indirect addressing (aka 110-register)
// Control byte format: xxDDDSSS or CCCCCSSS.
// Also 00DDD10X means inc/dec, so DDD==SSS.
/* Briefly: this code checks if opNOPs pattern
* is not 00XXX10X (not_incdec_comb).
* not_incd... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.