method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
447a3d91-cde2-44b8-b495-7dfc0b208910 | 4 | public void copyStateTo(RrdUpdater other) throws IOException, RrdException {
if(!(other instanceof Robin)) {
throw new RrdException(
"Cannot copy Robin object to " + other.getClass().getName());
}
Robin robin = (Robin) other;
int rowsDiff = rows - robin.rows;
if(rowsDiff == 0) {
// Identical dimensi... |
36cf8724-7382-44e0-a23e-14c930b834ab | 7 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
Command cmd;
String action = request.getParameter("action");
switch (action) {
case "saveUser":
cmd = new SalvarUsuarioCom... |
ec8e97fe-fc02-4804-81e8-337a9f4f7b89 | 3 | public void resolution() {
//temperature
double T = plat.getScore2();
//iterations a chaque pas de temperature
int Nt = 10;
//coef pour le recalcul de la temperature
double coef=0.6;
//generation d'un second plateau (pour comparaison)
Plateau plateau2;
while(plat.getScore2()!=... |
24914be8-34c7-4c1b-8111-34326e30d722 | 8 | @Override
public void onMessage(Message message) {
try {
TextMessage textMsg = (TextMessage) message;
String text = textMsg.getText();
System.out.println(text);
String mode[] = text.split("/");
if(mode.length ... |
3399a109-92bd-40bc-8643-f9074f81baba | 8 | public String returnBook(int isbn, int customerID) {
try{
String result = formattedTitle("Return Book");
// begin transaction
conn.setAutoCommit(false);
stmt = conn.createStatement();
// check the customer exists and lock
String sql = String.format("SELECT * FROM Customer WHERE CustomerID = %d FO... |
ba5126c2-63c3-442a-9a2f-4761d09f8e30 | 7 | public int getDegree(int node) {
assert (node < N);
int result = 0;
switch (getState()) {
case ARR_ADJ:
for (int i = 0; i < N; i++) {
if (arr_adj[node][i] != 0)
result++;
}
break;
case ARR_INC:
for (int i = 0; i < M; i++)
if (arr_inc[node][i] < 0)
result++;
break;
case LIST... |
a3499cbb-78b2-48d9-a571-fd30673dfe9a | 9 | public void actionPerformed (ActionEvent event) {
char turn=game.getTurn();
String nextTurn = "Black" ;
if(turn == 'W')
nextTurn = "Black";
if(turn == 'B')
nextTurn = "White";
... |
85c2c3a9-eafe-40c0-bc04-3666d6eb3995 | 8 | public void update()
{
this.Velocity.mult(0.975f);
if((this.Velocity.X() < 0.1f && this.Velocity.X() > 0f) || (this.Velocity.X() > -0.1f && this.Velocity.X() < 0f))
this.Velocity.X(0f);
if((this.Velocity.Y() < 0.1f && this.Velocity.Y() > 0f) || (this.Velocity.Y() > -0.1f ... |
ed4c5651-8471-48a9-8b3c-1d3535707ac2 | 5 | public static void printUsage(Class<?> resourceClass, String resourceName) {
InputStream is = resourceClass.getResourceAsStream(resourceName);
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
String line = null;
try {
while ((line = reader.readLine()) != null) {
Syste... |
3a4a1cc5-3b56-406a-a65e-75496da5499e | 1 | public void updateCurrentUser() {
try {
String statement = new String("UPDATE " + DBTable + " SET "
+ "username=?, password=?, url=?, permission=?, isblocked=?, isdead=?, practicenumber=?, highscorenumber=?"
+ " WHERE userid=?");
PreparedStatement stmt = DBConnection.con.prepareStatement(statement);
... |
b1effca1-4666-47e2-a64d-8efae0f3fd90 | 4 | @Override
public void keyReleased(KeyEvent e) {
switch(e.getKeyCode()){
case(KeyEvent.VK_W) : rocket.player.buttom[0] = false; break;
case(KeyEvent.VK_A) : rocket.player.buttom[1] = false; break;
case(KeyEvent.VK_S) : rocket.player.buttom[2] = false; break;
case(KeyEvent.VK_D) : rocket.player.buttom[3] = fal... |
b7ef5e18-1453-45bc-9caf-d074120d7995 | 5 | private void compute() throws EmptyStackException{
LinkedRBinaryTree<?> op=opStack.pop();
LinkedRBinaryTree<?> right=valueStack.pop();
LinkedRBinaryTree<?> left=null;
// Ni cos, ni sin
if(!(op.root().element().equals("sin") || op.root().element().equals("cos"))){
left=valueStack.pop();
op.setLeft(left)... |
cd259a70-f36a-4705-88db-847b2a82b4f0 | 3 | private static boolean hasAlpha(Image image) {
// If buffered image, the color model is readily available
if (image instanceof BufferedImage) {
BufferedImage bufferedImage = (BufferedImage) image;
return bufferedImage.getColorModel().hasAlpha();
}
// Use a pixel g... |
01411a9b-c7a9-4012-a557-74512feaa98f | 9 | public void exec(ILineConsumer out, ILineConsumer err) throws IOException{
logger.info("Command to execute :" + iCmd);
iSession = iConnection.getSession();
iSession.execCommand(iCmd);
// conditions for processing the streams. Such processing will not exit the call execu... |
6e0a4884-6d0b-4380-9a0b-e48d789863f1 | 7 | public SearchLayer(Dimension dim, GridLayer roadsLayer) {
setSize(dim);
this.roads = roadsLayer;
visInfo = VisInfo.getInstance();
initComponents();
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent me) {
... |
f79fc3ea-801c-4501-9ff1-3c863d056b1f | 2 | public String getValue(String key)
{
for(int i = 0; i < MAX_PROPS; i++)
{
if(keys_[i].equals(key))
{
return values_[i];
}
}
return "";
} |
ae2ae35c-0869-47fe-9e99-88e324324309 | 1 | private void btnSwitchProfileMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnSwitchProfileMousePressed
if (currentProfile.getUsername().compareTo("andersonmaaron") == 0) {
currentProfile = manager.getProfiles().get("orsobianco");
} else {
currentProfile = manage... |
07ad24e5-6b34-48db-b00e-85c794dc713d | 2 | public final void free() {
// reset the linkage between this edge and the edge in the other direction, if it exists
if(oppositeEdge != null) {
if(oppositeEdge.oppositeEdge == this) {
oppositeEdge.oppositeEdge = null;
}
oppositeEdge = null;
}
this.startNode = null;
this.endNode = null;
this.def... |
ead42637-6671-453a-82bc-01b67bd2d402 | 1 | public void moveIndexes(int i) {
index = i + 1;
if (nextElement == null) {
return;
} else {
nextElement.moveIndexes(index);
}
} |
88fb1127-88c8-4a9b-abf2-eff0ee4afd24 | 5 | public static List<Persona> consultaLicPer(ObjectContainer em) {
ObjectSet<Persona> listaPer = em.query(new Predicate<Persona>() {
private Map<String, List<LicenciaConductor>> licenciasPorCategoria = new HashMap<>();
private Set<Departamento> deptos = new HashSet<>();
@Over... |
2c39e895-02d8-44d0-a6bf-c4c9c3941757 | 4 | @Override
public void run() {
System.out.println("TCP Thread started.");
// falls Connection fehlschlägt, dann brich ab.
if (!connectionToServerSuceeded()) return;
// ask for name (mutltiple times).
// wird erfolgreich, oder bricht mit storageService.stop() ab.
regi... |
33ce6829-dee2-43da-9144-a40de4775674 | 0 | public int getY() {
return y;
} |
9742ae53-938f-4406-8e48-5213e34eaf15 | 4 | public void doGet(HttpServletRequest request, HttpServletResponse response) {
try {
CommunityDAO dao = CommunityDAO.get();
long id = Long.parseLong(request.getParameter("id"));
PublishedSwarm swarm = CommunityDAO.get().getSwarm(id);
Principal p = request.getUserPrincipal();
CommunityAccount acct =... |
f33b6795-1289-4d3c-bb0c-62bc9b395287 | 3 | public static int countMatches(String str, String sub)
{
if (isEmpty(str) || isEmpty(sub))
{
return 0;
}
int count = 0;
int idx = 0;
while ((idx = str.indexOf(sub, idx)) != -1)
{
count++;
idx += sub.length();
}
... |
f857527a-1af7-4a4c-aefa-9454ac10825f | 3 | public static List<File> getFolderInList(String path) {
List<File> list = null;
File file = new File(path);
if (file.isDirectory()) {
list = new LinkedList<File>();
File[] ary = file.listFiles();
for (int i = 0; i < StringUtil.size(ary); i++)
if (ary[i].isDirectory())
list.add(ary[i]);
}
re... |
093e0f5c-e7d8-4425-85d9-b0f4a139031b | 2 | public static void main(String[] args) {
Game.Builder b = new Game.Builder();
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
System.out.println("Welcome to the game 'The Traveler Problem'");
System.out.println("First, creat... |
066208cf-bd63-45c5-85c9-31f6bcc10939 | 2 | public int getID() {
System.out.println("test2");
this.waitForTurn = true;
while (!doneTurn) {
try {
Thread.sleep(200);
//System.out.println("waiting");
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
doneTurn = false;
ret... |
785d150b-40c9-436c-ae5c-091de65b2cae | 5 | @Override
public boolean execute(CommandSender sender, String[] args) {
if(!(sender instanceof CommandSender)
|| (sender instanceof Player && !sender.isOp())) {
sender.sendMessage("You don't have permission to perform this command");
return true;
}
Collection<Group> groups = groupManager.getAllGroup... |
a2343b22-e1b2-4e86-ab8f-7e66d2d99487 | 5 | public void send() {
String msg = msg_box.getText();
if (msg == null || msg.equals("") || msg.equals("\n")){
msg_box.setText("");
return;
}
if(enterIsSend){
msg = msg.substring(0, msg.length()-1);
}
if (msg.startsWith("@")) {
String to = msg.split(" ")[0].substring(1);
msg = msg.substring(... |
8b7f3a50-7dad-4fc1-9d77-7408e4cf0c8e | 7 | static void emitStringConstant(String str, PrintStream s) {
ascii = false;
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
switch (c) {
case '\n':
asciiMode(s);
s.print("\\n");
break;
case '\t':
asciiMode(s);
s.print("\\t");
break;
case '\\':
byteMode(s)... |
d9ade46f-9099-42d5-8d42-d1f84cc513bd | 5 | private void put(JsonElement value) {
if (pendingName != null) {
if (!value.isJsonNull() || getSerializeNulls()) {
JsonObject object = (JsonObject) peek();
object.add(pendingName, value);
}
pendingName = null;
} else if (stack.isEmpty()) {
product = value;
} else {
... |
396c912b-b37b-4479-a824-93f5d735b5c5 | 6 | @Override
public Result getRevision () {
List<Integer> parents = getParentsImpl();
if (parents.size() == 0) {
// new repository
return new Result(0, null);
}
final String branch = getBranchImpl();
// get all revisions that are not ancestors of the parent revisions
// i.e. all revisions not y... |
58bc6db8-0b02-48fe-9374-7b3477d4d694 | 7 | public void set(final long i, final Object value)
{
if (value instanceof Boolean) {
setBoolean(i, (Boolean) value);
} else if (value instanceof Byte) {
setByte(i, (Byte) value);
} else if (value instanceof Short) {
setShort(i, (Short) value);
} els... |
5b1790bb-8523-44bf-afdb-706225bec876 | 6 | public static NamedDescription getDescription(Stella_Object self) {
{ Surrogate testValue000 = Stella_Object.safePrimaryType(self);
if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_NAMED_DESCRIPTION)) {
{ NamedDescription self000 = ((NamedDescription)(self));
return (self000);
... |
2c1fedc0-805b-4825-9729-96d115ba7a83 | 4 | public static void withMeta(Response resp, JSONObject rootJsonObj) {
try {
resp.version = String.valueOf(rootJsonObj.get(Constants.VERSION));
resp.status = rootJsonObj.getString(Constants.STATUS);
if(rootJsonObj.has(Constants.RESPONSE)) {
JSONObject respJson = rootJsonObj.getJSONObject(Con... |
bc6eeca7-a0fe-4336-81fd-c21fc2c91eee | 5 | public synchronized void holdFinalMeeting(Employee em){
while(lastMeeting.size() < 13 && timer.getTimeOfDay() < 4950){
try {
em.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
String meetingTime = timer.getCurrentTime();
System.out.println(meetingTime + " The Manager is g... |
61c92091-925c-4720-ad2d-86df1f430c0f | 1 | private byte[] decrypt(byte[] data) throws InvalidKeyException,
IllegalBlockSizeException, BadPaddingException {
if (data.length > MAX_ENC_SIZE) {
System.err
.println("Data to long to decrypt. Reason: Possible cheating! Fix: Exit");
System.exit(1);
}
RSAKeyParameters kp = new RSAKeyParameters(tr... |
d97cac2c-150d-4f9a-ab06-17e215837986 | 4 | public static int executer_update(String requete) {
int key = 0;
if (BD_MySQL.debug){
System.out.println("DEBUG : REQUETE : "+requete);
}
try {
BD_MySQL.stmt.executeUpdate(requete, Statement.RETURN_GENERATED_KEYS);
} catch (SQLException ex) {
L... |
4df1bba4-7483-4df2-8ee4-a2a08e30333a | 8 | public static int spiralOrderHelper(int[][] matrix, int x, int y,
int[][] matrixHelper, int count) {
// if(x > matrix[0].length/2 || y> matrix.length/2 ){
// return newList;
// }
// top
for (int i = x; i < matrix[0].length - x; i++) {
if (matrixHelper[y][i] == 1)
return count;
matrix[y][i] = coun... |
3495064d-6e78-480c-b131-7e9d27445022 | 9 | public void createGUI() {
//initializing the game grid
gameButtonGrid = new JPanel();
gameButtonGrid.setLayout(new GridLayout(mmg.getMaxGuessAmt(),4));
gameButtonGrid.setPreferredSize(new Dimension(320,320));
Integer i = 1;
Integer x = 0;
Integer y = 0;
hintPanel = new JPanel();
hintPanel.setLay... |
4f2d747d-c72b-44df-aa22-ef087e325a7f | 2 | public void setDynamicAdjustment(boolean isDynamicAdjustment)
{
// May need to add or remove the TableModelListener when changed
if (this.isDynamicAdjustment != isDynamicAdjustment)
{
if (isDynamicAdjustment)
{
table.addPropertyChangeListener( this );
table.getModel().addTableModelListener( this ... |
c08454bd-af55-4ca6-8db7-0f88bd0fed8b | 6 | public void recursiveLight(float level, int[] loc, Color color)
{
if(level <= 0)
return;
int x = loc[0];
int y = loc[1];
if(x < 0 || x >= lightLevelGrid.length || y < 0 || y >= lightLevelGrid[x].length)
return;
if(lightLevelGrid[x][y].a > 1 - (Math.min(level, LightSource.maxStrength) / LightSource.... |
52e1bbde-2fd7-4767-b10e-e7c250163170 | 1 | public Polynomials(String str){
polynomial = new ArrayList<>();
Scanner scan = new Scanner(str);
for(Term t = Term.scanTerm(scan); t != null; t = Term.scanTerm(scan))
polynomial.add(t);
quickSortPolynomial(0, polynomial.size() - 1);
} |
40192d6c-3405-4155-ae99-b8bc0ae5ea7f | 7 | public boolean kaufeGebaeude( int auswahl, int gold, Land freiesLand )
{
switch ( auswahl )
{
case 0: // kein Kauf -> zurück zum Gebäude bearbeiten
break;
case 1: // Feld kaufen
if ( gold >= this.preisGebaeude )
{
Feld neuesFeld = new Feld();
this.aktiverSpieler.besetzeLandMitGebaeude( ... |
5f0cebd0-0558-4eae-9e32-9a56824e535d | 9 | private boolean validAddress(String s) {
if (s != null && (s.length() > 26 && s.length() < 35) && (s.startsWith("1") || s.startsWith("3")) && !s.contains("0") && !s.contains("O") && !s.contains("I") && !s.contains("l")) return true;
else return false;
} |
c8fccebc-1cfc-43d9-b59b-ac65584c496d | 2 | public String text()
{
if(subObjects.size() == 1)
if(subObjects.get(0) instanceof String)
return (String)(subObjects.get(0));
return null;
} |
519feafc-8bd5-4ba7-b51b-ad9816e22742 | 1 | private boolean fireAttemptClientConnectEvent(AttemptClientConnectEvent evt) {
ISocketServerConnection ssc = evt.getSocketServerConnection();
logger.debug(getName() +
" attempt client: " + ssc.getRemoteAddress() +
" <idconnection=" + ssc.getIdConnection() + ">");
if (attemptClientCo... |
77b455b7-0fb3-4b3c-9e41-a6ec8f550a61 | 2 | private String GetMessageToSend(){
String Message;
while(true){
if(!catalogue.MessageInUse){
Message = catalogue.GetClientMessage(Tabid);
break;
}
}
return Message;
} |
c5c620cd-beda-4c46-9f81-4bb9bcd09eab | 0 | public void setIdElemento(int idElemento) {
this.idElemento = idElemento;
} |
3ec3f8f4-1ef4-469b-9805-c2ca2978e7fb | 2 | public List<Utr5prime> get5primeUtrs() {
ArrayList<Utr5prime> list = new ArrayList<Utr5prime>();
for (Utr utr : utrs)
if (utr instanceof Utr5prime) list.add((Utr5prime) utr);
return list;
} |
d450945d-c6f6-47f5-bf14-2d07ae82c504 | 6 | public void soldatenVersorgen( int sold )
{
int benötigtesMehl = this.soldaten * 2;
int benötigtesGold = this.soldaten * sold;
int satteSoldaten = Integer.valueOf( Math.round( this.mehl / 2 ) );
int hungrigeSoldaten = this.soldaten - satteSoldaten;
int bezahlteSoldaten = Integer.valueOf( Math.round( this.g... |
219be36b-b132-4564-b071-9cbdcf801dc9 | 3 | public static Vertex at(Graph g, int x, int y) {
DynamicArray<Vertex> vertices = g.getVertices();
Vertex v = vertices.get(0);
Vertex closestVertex = v;
double closest = Integer.MAX_VALUE;
for (int i = 0; i < vertices.getSize(); i++) {
v = vertices.get(i);
... |
37665b3e-bfd6-472e-9590-864e9f405507 | 7 | public static void setMap(){
jPanel1 = new JPanel(new GridLayout(19,48,0,0));
JLabel labels[] = new JLabel[(19*48)];
String bufferMap = carte.lire("./ressources/map.txt");
for (int i = 0,j = 0; i < bufferMap.length(); i++)
{
if(bufferMap.charAt(i) =... |
f5645ca7-d3ab-484d-9df0-a5d36a7028f9 | 3 | @Override
public Class getColumnClass(int column) {
Class returnValue;
if ((column >= 0) && (column < getColumnCount())) {
if(getValueAt(0, column)==null)
return String.class;
returnValue = getValueAt(0, column).getClass();
... |
ccbb6b5b-2294-4767-9388-38e1426d5835 | 2 | public void deposit(BigInteger amount) throws IllegalArgumentException {
if ( (amount == null) || (amount.compareTo(BigInteger.ZERO) <= 0) )
throw new IllegalArgumentException();
setBalance(this.getBalance().add(amount));
} |
a8a80464-39a1-443b-8506-378d1245f141 | 0 | @Override
public void handlePeerChoked(SharingPeer peer) { /* Do nothing */ } |
fc1b1841-d6bb-4dbf-9e92-258ba2a1a35d | 4 | @Override
public void caseAParaComando(AParaComando node)
{
inAParaComando(node);
{
List<PComando> copy = new ArrayList<PComando>(node.getComando());
Collections.reverse(copy);
for(PComando e : copy)
{
e.apply(this);
}
... |
ae4a8989-b8a3-4114-82fa-0d035bc8654e | 3 | void resetColorsAndFonts () {
Color oldColor = foregroundColor;
foregroundColor = null;
setExampleWidgetForeground ();
if (oldColor != null) oldColor.dispose();
oldColor = backgroundColor;
backgroundColor = null;
setExampleWidgetBackground ();
if (oldColor != null) oldColor.dispose();
Font oldFont = f... |
57433ac3-8847-4e22-9fc5-513a7f673fa6 | 8 | public static void main(java.lang.String args[]) throws NullPointerException, IOException {
/**
* Starting Up Server
*/
System.setOut(new Logger(System.out));
System.setErr(new Logger(System.err));
System.out.println("Running Warlords of Hell...");
/**
* Accepting Connections
*/
acceptor ... |
3bd9e5f7-1243-4372-ac96-fc075943c183 | 7 | double getProfit(double predict, double result, double eps1, double eps2) {
if (Math.abs(predict - total) >= eps1) {
predict = -1;
} else if (Math.abs(predict - total) <= eps2) {
predict = 1;
} else {
return 0;
}
if (result == total) {
... |
0fa1dd1b-952a-4185-b8dd-eb455fa0a7d9 | 7 | public List get(String alias) {
List result = new LinkedList();
for (Iterator it = entries.iterator(); it.hasNext(); ) {
Entry e = (Entry) it.next();
if (e instanceof EnvelopeEntry) {
if (!((EnvelopeEntry) e).containsAlias(alias)) {
continue;
}
... |
c89bb83e-62f3-4ada-b269-0dcdb30329ff | 9 | public static void dumpXML(XMLStreamReader parser) throws XMLStreamException {
int depth = 0;
do {
switch(parser.getEventType()) {
case XMLStreamConstants.START_ELEMENT:
for(int i = 1; i < depth; ++i) {
System.out.print(" ");
}
System.out.print("<");
System.out.print(parser.getLocalNam... |
88aadf2f-b9b3-4a0b-a6e8-2dd90abdd0d7 | 6 | @Override
public void run() {
if (state == GameState.WAITING_FOR_PLAYERS) {
if (getPlayers(PlayerState.WAITING).size() >= battleground.getMinPlayers()) {
//TODO: broadcast message
state = GameState.COUNTDOWN;
currentCounter = new Counter(30);//TO... |
10c0778a-ec0c-4ae4-8c2a-4e9cd00aa8cd | 3 | public void addCatchPhi(final Block block) {
if (phis[cfg.preOrderIndex(block)] != null) {
return;
}
if (prototype instanceof LocalExpr) {
final LocalExpr target = (LocalExpr) prototype.clone();
final PhiCatchStmt phi = new PhiCatchStmt(target);
phis[cfg.preOrderIndex(block)] = phi;
if (SSA.DEBU... |
6a9ed6c9-95b3-4b3e-ae83-767d926f155b | 9 | private void processRingNumberingAndIrregularities() throws StructureBuildingException {
for (Element group : groupsInFusedRing) {
Fragment ring = group.getFrag();
if (ALKANESTEM_SUBTYPE_VAL.equals(group.getAttributeValue(SUBTYPE_ATR))){
aromatiseCyclicAlkane(group);
}... |
2e490bfa-53ae-4e55-9a7b-93c0d8e556d3 | 1 | public void dehoist() {
// Shorthand
JoeTree tree = hoistedNode.getTree();
tree.setRootNodeCommentState(oldTreeCommentState);
hoistedNode.setHoisted(false);
// Prune things
tree.setRootNode(oldNodeSet);
tree.getVisibleNodes().clear();
hoistedNodeParent.insertChild(hoistedNode, hoistedNodeIndex);
h... |
b3c56fea-bb4b-42dc-a73e-af79fb3f4a81 | 5 | public boolean pass(int[] bowl, int bowlId, int round,
boolean canPick,
boolean musTake) {
double expected;
double offset;
// Calculate Bowl Size
bowlSize = 0;
for(int i=0; i<bowl.length; i++)
bowlSize += bowl[i];
// Total Fruits
n_fruits = n_players*bo... |
080c50fb-36b2-4c3b-bdb0-463afac86296 | 9 | static private boolean jj_scan_token(int kind) {
if (jj_scanpos == jj_lastpos) {
jj_la--;
if (jj_scanpos.next == null) {
jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
} else {
jj_lastpos = jj_scanpos = jj_scanpos.next;
}
} else {
jj_scanpo... |
b22b8236-43c9-4007-ba80-302ca8a1e09b | 2 | @Override
public Object execute(Object obj, Object[] args) {
// 获取实际的PreparedSQL和调用参数
String actualSql = definition.getActualSql(args);
List<Object[]> paramArrays = ReflectionUtils.generateBatchQueryArguments(args, definition);
KeyHolder keyHolder = null;
if (definition.isReturnId()) {
keyHolder = dataAc... |
5af8fecc-007d-440e-8f3e-ccd6c1fed77c | 3 | public boolean mirarPal() {
int flush = 0;
for (int i=0; i < ma.size()-1; i++) {
if (ma.get(i).getPal().equals(ma.get(i+1).getPal())) {
flush++;
} else {
}
}
if (flush == 4) {
return true;
} else {
return false;
}
} |
42d0d681-a8f5-4ea7-abb0-a3961f65fedf | 8 | public void write(JsonWriter out, Map<K, V> map) throws IOException {
if (map == null) {
out.nullValue();
return;
}
if (!complexMapKeySerialization) {
out.beginObject();
for (Map.Entry<K, V> entry : map.entrySet()) {
out.name(String.valueOf(entry.getKey()));
... |
ed88af2e-b879-4b34-b36f-52cc04f2a061 | 6 | public static Growth getGrowth(int i) {
switch (i) {
case 1:
return Slow;
case 2:
return Medium;
case 3:
return Fast;
case 4:
return Medium_slow;
case 5:
return Erratic;
case 6:
return Fluctuating;
}
return null;
} |
61303088-0289-4236-8bea-b540ed52189d | 8 | private static ServerJoinInfo getDetailsFromDirectUrl(final String url) {
if (url == null) {
throw new NullPointerException("url");
}
ServerJoinInfo result = new ServerJoinInfo();
final Matcher directUrlMatch = directUrlRegex.matcher(url);
if (directUrlMatch.matches()... |
2656a75c-0cdb-4adc-b12c-ccd1ede79d67 | 8 | @Override
public void run() {
if (!stats)
return;
try {
ResultSet r = sql.query("SELECT * FROM ctt_stats");
HashMap<String, PlayerStats> p = new HashMap<String, PlayerStats>();
while (r.next()) {
p.put(r.getString("player"), new PlayerS... |
ef8368cf-a479-40f1-aa62-3fe6053232e5 | 0 | public RouterPacket GetRecentPacket()
{
return recentPacket;
} |
a0f63d3f-ca09-4663-a652-763fe69b53aa | 8 | public static void showSearchResultsTable(ResultSet rs, String searchQuery,
List<String> inputs) {
int numCols;
ResultSetMetaData rsmd;
JTextArea tableTitle = null;
JTable table = null;
try {
rsmd = rs.getMetaData();
numCols = rsmd.getColumnCount() + 2;
String columnNames[] = new String[numCols]... |
06d27379-cfbd-4bd0-99e2-090f36a52c60 | 5 | protected boolean objectShouldBeDrawn(DrawnObject d)
{
// If the drawnobject is collidingdrawnobject, checks the drawing more
// carefully
if (d instanceof CollidingDrawnObject)
{
CollidingDrawnObject cd = (CollidingDrawnObject) d;
DoublePoint[] collisionpoints = cd.getCollisionPoints();
// D... |
8f15849a-b868-49af-b5c9-b5f592a8b36d | 6 | public static void main(String[] args) throws EnrycherException, MalformedURLException {
// input document
String docString = "Tiger Woods emerged from a traffic jam of his " +
"own making to thrill thousands of fans with a six-under 66 at " +
"the $1.4 million Australian Masters on Thursday.";
// URL of E... |
fc8b620f-784e-4340-81f9-5e715dec00eb | 0 | public List<BranchLeader> getBranchLeaderList() {
return branchLeaderList;
} |
c36c97bb-7396-4490-bad5-0672c3036306 | 2 | public int assignPlayer(String name)
{
for(int i = 1; i <=4 ; i++)
{
if(players.get(i).isEmpty())
{
players.add(i, new Player(new Bat(new Point2D.Float(50, 400), new Point2D.Double(5,100), 2,new Point2D.Float(0, -4)), 0, name));
return i;
}
}
return 0;
} |
3f6cb22f-7411-4584-bf6f-42fa000d23ec | 5 | public void run() {
while (!isInterrupted()) {
String input = new String();
char ch;
try {
do {
ch = (char) s.getInputStream().read();
input = input + ch;
} while (ch != '\n' && !isInterrupted());
} catch (IOException e) {
e.printStackTrace();
}
if (!isInterrupted())
Syste... |
dd24d79d-6dfa-4807-aa17-10ea76ed1cd4 | 2 | public double frobeniusNorm(){
double norm=0.0D;
for(int i=0; i<this.numberOfRows; i++){
for(int j=0; j<this.numberOfColumns; j++){
norm=hypot(norm, Math.abs(matrix[i][j]));
}
}
return norm;
} |
2f92e754-12a9-451a-a73b-1fe47fe82736 | 4 | public boolean isBorder() {
boolean borderWidth = false;
Object border = getObject(BORDER_KEY);
if (border != null && border instanceof Vector) {
Vector borderProps = (Vector) border;
if (borderProps.size() == 3) {
borderWidth = ((Number) borderProps.get(2... |
8d74aa8e-f2ce-496f-9220-c429e1ae2fa9 | 1 | public Vehicule requestVehicule() {
if (!vehicules.isEmpty()) {
Vehicule v = vehicules.get(0);
vehicules.remove(0);
return v;
} else return null;
} |
f9ddcc99-f200-4627-a60f-f02d40603136 | 2 | public void printSum(File dir) throws IOException {
PrintWriter w;
if (file != null) {
w = new PrintWriter(new FileWriter(new File(dir, file), true));
} else {
w = new PrintWriter(new OutputStreamWriter(System.out));
}
w.println(out.toString());
w.... |
c1551f21-95eb-423b-acd4-cc7bc4e79006 | 3 | private StdImage getDisclosureControl(Row row) {
return row.isOpen() ? row == mRollRow ? mDownTriangleRoll : mDownTriangle : row == mRollRow ? mRightTriangleRoll : mRightTriangle;
} |
64310bc5-d806-4008-a286-235981d88f4c | 5 | public void run()
{
try
{
init();
}
catch (Exception Stacktrace)
{
Stacktrace.printStackTrace();
}
long lastTime = System.nanoTime();
double amountOfTicks = 60.0;
double nanoSeconds = 1000000000 / amountOfTicks;
double Delta = 0;
long Timer = System.currentTimeMillis();
... |
ebbed3b7-9ca0-4a5c-885c-1e332f71554d | 1 | public void fillObject(Credit credit, ResultSet result) {
//Заполняем кредит
try {
credit.setId(result.getInt("ID"));
credit.setDate(result.getDate("CREDITDATE"));
credit.setSum(result.getDouble("CREDITSUM"));
credit.setStatus(result.getInt("CREDITSTATUS")... |
baee53f1-60d1-48df-b344-60874aeb1b83 | 5 | public static int min(int[] element)
throws IllegalArgumentException{
if (element.length == 0){
throw new IllegalArgumentException ("tom samling");
}
int[] sekvens = element;
int antaletPar = sekvens.length / 2;
int antaletOparadeElement = sekvens.length % 2;
int antaletTankbaraElement ... |
c5601d2c-c4cd-40f2-9b84-efad0b9e4dcb | 2 | public ClassAnalyzer getClassAnalyzer(ClassInfo cinfo) {
if (cinfo == getClazz())
return this;
if (parent == null)
return null;
return getParent().getClassAnalyzer(cinfo);
} |
ba352d0d-2f8f-4d37-b111-f433e72ba4f7 | 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... |
7216b963-0d48-4988-9fce-beb855cf79fc | 0 | public TimeSlotHelper(long startOfDay, int nDay)
{
this.startOfDay = startOfDay;
this.nDay = nDay;
this.nSlot = nDaySlot * nDay;
this.aIsAvailable = new boolean[this.nSlot];
Arrays.fill(this.aIsAvailable, true);
} |
2a5fcd1e-1300-4349-8e50-c39d27fb982d | 2 | public void gravity(Collection<GameObject> objects){
for(GameObject gameObject : objects){
if(gameObject.getEffectedByGravity()){
applyForce(gameObject, 0, 1);
}
}
} |
5e6bbe1b-f3dd-4147-8736-6c44413551f6 | 8 | public static ArrayList<PokerHandEvaluation> getWinners(ArrayList<PokerHandEvaluation> potentialWinners) {
//we have a tie and we need the rank of the first player (the rank is the same for all players TIE)
PokerHandEvaluation firstPlayerEvaluation = potentialWinners.get(0);
int rank = firstPlayerEvaluation.ge... |
5bebf5c7-dbee-4e77-82b4-b1c97a5535f0 | 8 | public void setorderBy(int column)
{
/* if the users clicks on the same column again, flip the order */
if(lastClickedColumn == column)
{
order = !order;
}
lastClickedColumn = column;
switch(column)
{
case 0:
orderby = "Title";
break;
case 1:
orderby = "Artist";
break;
... |
5b7e02c2-b2d8-40a6-8dfc-d9acfdd6052d | 7 | public SMTPHostAuth(String unparsedServerInfo)
{
final List<String> info=CMParms.parseCommas(unparsedServerInfo,false);
if(info.size()==0)
return;
host = info.remove(0);
if((info.size()==0)||(host.length()==0))
return;
final String s=info.get(0);
if(s.equalsIgnoreCase("plain")||s.equalsIgnor... |
0d55f4af-43eb-435f-a202-4e8fe94f4a8a | 2 | @Override
public boolean evaluate(T t) {
if(firstSearchString.evaluate(t) || secondSearchString.evaluate(t)){
return true;
}
else{
return false;
}
} |
0c93b86f-f202-418e-86fc-5bd32daaa335 | 1 | public Audience updateAudience(String userName, String password, String firstName, String lastName,String email) {
Audience viewer = manager.find(Audience.class, userName);
if (viewer != null) {
viewer.setUserName(userName);
viewer.setPassword(password);
viewer.setFirstName(firstName)... |
37bffe41-4cf7-4bfa-96ea-cae0dca52e20 | 7 | public static Double getPrejudice(AllocationInfo allocationToTake,
AllocationInfo allocationToWin, List<AllocationInfo> allAllocations,
final Map<String, Double> balances) {
double totalAllocations = 0;
double totalPeerBalance = 0;
for (AllocationInfo info : allAllocations) {
totalAllocations += info... |
f9ecd568-c232-4f9d-8d70-ffef7dc1b7fa | 6 | public static int createStudent() {
System.out.println("=== Creation of a student ===");
Scanner scId = new Scanner(System.in);
System.out.print("Give a name: ");
String name = "";
while (name.equals("")) {
Scanner scName = new Scanner(System.in);
name = scName.nextLine();
}
System.out.print("Give a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.