method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
70ba70de-b71b-4033-be76-2354d4a69d71 | 3 | public void getAllTranscripts() throws FileNotFoundException, IOException{
System.out.println("Getting all transcripts from " + annotationFname);
TextFile in = new TextFile(annotationFname, false);
allTranscr = new ArrayList();
String line = in.readLine();
int len = 0, cnt = 0;
... |
2420da9a-26dc-4199-b961-2ed984e1b592 | 8 | @Override
public void run(CommandSender sender, String maincmd, String[] args)
{
if (sender instanceof Player && !sender.hasPermission("mobmanager.abilitysetlist") && !sender.hasPermission("mobmanager.spawn") && !sender.hasPermission("mobmanager.pspawn"))
{
sender.sendMessage(ChatColor.DARK_RED + "You do not h... |
ec7d7fdf-4e96-433c-9471-12d6a4aa478e | 2 | private void jTextFieldModiefieVilleNomKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextFieldModiefieVilleNomKeyReleased
// TODO add your handling code here:
try {
List<projetrf.model.Ville> vv1 = RequetesVille.selectVilleByName(jTextFieldModiefieVilleNom.getText(... |
f2b415c2-651c-41b9-824f-9152fe55d31a | 2 | private int getAddress(String operand)
{
for(SymbolAddress element:FirstPhase.symTab)
{
if(element.label.equalsIgnoreCase(operand))
return element.address;
}
System.out.println("!---------- ERROR: Label "+operand+" invalid ----------!");
System.exi... |
8b402754-5630-48cf-9950-ccf18c733f11 | 8 | private boolean imaSusjednih (int a, int b)
{
boolean result = false;
if (valid (a+1, b))
if (tabela [a+1][b] == 0)
result = true;
if (valid (a, b+1))
if (tabela [a][b+1] == 0)
result = true;
if (valid (a-1, b))
if (tabela [a-1][b] == 0)
result = true;... |
8b99ba3d-c387-4032-87be-036d90c66cfe | 4 | private void buttonCreateTaskActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCreateTaskActionPerformed
try {
control.createNewTask(tableAllTask,
listUsersOnTask,
CheckBoxSub,
textFieldTaskName,
... |
7b5bcf8a-d132-43b4-8b71-2a8fcdac4284 | 1 | public static String urlLastElement(String url) {
// index.html対策
int lashSlashIndex = url.lastIndexOf("/");
if (lashSlashIndex == url.length() - 1) {
return "index.html";
}
String[] strings = url.split("/");
return strings[strings.length - 1];
} |
5f242446-3e74-4783-8e24-f6b146203671 | 2 | public void run() {
shell.open();
while(!shell.isDisposed()) { //while shell is not disposed
if(!display.readAndDispatch()) { // if there is no event on the event queue
display.sleep(); //return the resources to the cpu and sleep
}
}
display.dispose(); //Dispose the display
} |
9eb99d6d-8920-453e-b0a6-19a2083ed673 | 4 | protected static void setupTypes() {
initCategory(TYPE_MILITANT ) ;
initCategory(TYPE_MERCHANT ) ;
initCategory(TYPE_AESTHETE ) ;
initCategory(TYPE_ARTIFICER) ;
initCategory(TYPE_ECOLOGIST) ;
initCategory(TYPE_PHYSICIAN) ;
for (Class baseClass : LoadService.loadPackage("src.game.base")) {
... |
946e6451-0002-4ea5-ab94-40a51b6194df | 4 | public static Session getSession() throws HibernateException {
Session session = (Session) threadLocal.get();
if (session == null || !session.isOpen()) {
if (sessionFactory == null) {
rebuildSessionFactory();
}
session = (sessionFactory != null) ? sessionFactory.openSession()
: null;
thr... |
c95eb434-977f-44e6-bdb1-336ace3b05a5 | 7 | private void initialize()
{
frmMcpMappingViewer = new JFrame();
frmMcpMappingViewer.setIconImage(new ImageIcon(MappingGui.class.getResource("/bspkrs/mmv/gui/icon/bspkrs32.png")).getImage());
frmMcpMappingViewer.addWindowListener(new WindowAdapter()
{
@Override
... |
bde68a29-b346-4532-9579-d62d3ffff91e | 6 | private void setFrame() {
getContentPane().setLayout(new GridBagLayout());
getContentPane().setBackground(panelcolour);
setTitle("Preferences");
fontPanel = new JPanel();
ButtonGroup bg = new ButtonGroup();
small = new JRadioButton("Small");
small.setFont(frame.FONT_SMALL);
small.setFocusable(true);
s... |
e31faa8a-37a0-4415-a082-1c5e7ce6cf3a | 2 | private static Node mergeSort(Node n){
if(n==null || n.next==null) return n;
Node[] first_second = splitInHalf(n);
Node firstHalf = mergeSort(first_second[0]);
Node secondHalf = mergeSort(first_second[1]);
return merge(firstHalf, secondHalf);
} |
c2dc3ea3-b94f-4aba-96ec-2d5e47b13ae5 | 8 | @Override
public List<V_Ficha_Trab_Num_C> Buscar_Trabajador_Requerimiento(String iddep, String dni, String nom, String ape_p, String ape_m, String id_req) {
this.conn = FactoryConnectionDB.open(FactoryConnectionDB.ORACLE);
String sql = "select d.*, ES_PROCESO_TRABAJADOR(d.id_trabajador,'" + id_req +... |
a10103dc-7af4-4e60-93c1-8e87fbbaf71e | 8 | @EventHandler(priority=EventPriority.LOWEST)
public void onEntityDamagedByEntity(EntityDamageByEntityEvent event) {
if(event.getDamager() instanceof Player && event.getEntity() instanceof Player) {
Player player = (Player) event.getEntity();
Player damager = (Player) event.getDamager();
if(!isPlay... |
7d590035-7e20-4245-a26b-c45ae916d339 | 1 | public void makePlayers(ArrayList<String[]> decks) {
int playerIndex = 0;
Player nextPlayer;
for (String[] deck : decks) {
nextPlayer = new Player(deck, this);
nextPlayer.setPlayerNumber(playerIndex);
players.add(nextPlayer);
playerIndex++;
}
} |
c68d6a93-fc87-485a-919f-7eebcb940d27 | 3 | */
private static void displayCurrContext(LoopADT<List<String>> msgLoop) {
if (msgLoop.size() == 0)
System.out.println("no messages");
else if (msgLoop.size() == 1) {
System.out.println(printSpecialString(10, "*"));
System.out.print(printList(msgLoop.getCurrent()));
System.out.println(printSpecialStrin... |
7540cb62-2b24-4c7f-9336-ce99d2551e02 | 9 | @SuppressWarnings({ "unchecked", "rawtypes" })
public static Object invokeStaticSubroutine(Object classInstance, String methodName, CalcValue... args) {
// ~ Public Invokation
try {
Class clazz = classInstance instanceof Class ? (Class) classInstance : classInstance.getClass();
// Invoke Subroutine with par... |
de86dc19-5bd1-42c6-ace8-1238c350885e | 2 | public ArrayList<Pesquisador> listar(String condicao) throws Exception
{
String sql = "SELECT * FROM pesquisador " + condicao;
ArrayList<Pesquisador> listaPesquisador = new ArrayList<Pesquisador>();
try
{
PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql);
ResultSet rs = ... |
f397495b-78f2-4b32-8fbd-3189711442f6 | 7 | @Override
public int castingQuality(MOB mob, Physical target)
{
if(mob!=null)
{
final Room R=mob.location();
if(R!=null)
{
if((R.domainType()!=Room.DOMAIN_OUTDOORS_WOODS)
&&((R.myResource()&RawMaterial.MATERIAL_MASK)!=RawMaterial.MATERIAL_WOODEN)
&&(R.domainType()!=Room.DOMAIN_OUTDOORS_JUNGLE... |
6033923d-e579-41ae-a2e4-445b92228a43 | 2 | public boolean mouseup(Coord c, int button) {
if(dm){
Config.setWindowOpt("minimap_pos", this.c.toString());
}
if (rsm){
ui.grabmouse(null);
rsm = false;
Config.setWindowOpt("minimap_sz", mm.sz.toString());
} else {
super.mouseup(c, button);
}
return (true);
} |
84abf04f-a893-4159-8211-af490275f9a0 | 7 | public static List<NearbyPlace> addDefaultImages(List<NearbyPlace> nearByPlaces,
String contextPath) throws CitysearchException {
if (nearByPlaces != null && !nearByPlaces.isEmpty()) {
List<String> imageList = Utils.getImages(contextPath);
if (imageList != null && !imageList.... |
64aea368-1155-475e-a192-8e2818f460e2 | 0 | public double[] getView()
{
return new double[]
{
left, right, top, bottom
};
} |
7e43ba92-2bc4-49d9-9747-de381752eb66 | 9 | public static void main(String[] args) {
if(args.length!=2){
System.out.println("Inappropriate arguments");
System.exit(0);
}
String sname = args[0];
int port = Integer.parseInt(args[1]);
if(args[1].length()!=4){
System.out.println("Port Number Should be 4 digits");
System.exit(0);
}
Soc... |
c1d7c537-2580-4295-b7c3-fdf82102538b | 4 | public double characterHitpoint()
{
if (P1character.equals("White"))
{
return whiteKnight.characterHitpoint();
}
else if (P1character.equals("Bond"))
{
return jamesBond.characterHitpoint();
}
else if (P1character.equals("Ninja"))
... |
53dbe9aa-4001-4811-9a8c-be20266e435e | 8 | public void checkCollisions(GameObject p) {
if(!alive) {
onPlatform = false;
return;
}
if (y+height < p.y) return;
if (y > p.y+p.height) return;
if (x+width/2 < p.x) return;
if (x > p.x+p.width/2) return;
if(p instanceof Platform) {
... |
d6924c66-c991-45a5-932b-8d0dfaef0eef | 5 | private void solve() {
Node node1 = new Node(origBoard, 0, null);
Node node2 = new Node(twin, 0, null);
minPQOrig.add(node1);
minPQTwin.add(node2);
Node currentNode = node1;
Node twinNode = node2;
while (!currentNode.board.isGoal() && !twinNode.board.isGoal()) {
if (minPQOrig.isEmpty()... |
ad805a9f-0c2b-4010-855c-d46c92205a4b | 3 | @Override
public void run()
{
while(true)
{
try
{
Thread.sleep((random.nextInt(agent.getNumAgentsConnected()) + 1) * 1000);
if (!Agent.getConflictExists())
Agent.testValues(agentId, agentType);
else Thread.sleep(10000);
} catch (InterruptedException e) {
System.out.printl... |
5142fc46-a24c-4e06-9ab5-1ad3e47e90c6 | 7 | @SuppressWarnings("deprecation")
@Override
public boolean onCommand(CommandSender sender, org.bukkit.command.Command cmd, String[] args) {
if (args.length < 1)
return false;
if(!(Commands.isPlayer(sender)))
return false;
Player s = (Player) sender;
Player p = (Player) PlayerChat.plugin.getServer().g... |
5601042d-3b06-4144-8d02-7a66a90b8afb | 6 | private void makeDropTarget( final java.io.PrintStream out, final java.awt.Component c, boolean recursive )
{
// Make drop target
final java.awt.dnd.DropTarget dt = new java.awt.dnd.DropTarget();
try
{ dt.addDropTargetListener( dropListener );
} // end try
catch( ... |
feefadde-b359-4fad-8697-114aea8ff764 | 6 | private boolean versionCheck(String title)
{
if(type != UpdateType.NO_VERSION_CHECK)
{
String version = plugin.getDescription().getVersion();
if(title.split(" v").length == 2)
{
String remoteVersion = title.split(" v")[1].split(" ")[0]; // Get the ... |
ce434519-12e6-4686-bc4c-20ec264333e9 | 6 | private void handleNetServerInput(Client client, NetMessage message) {
switch(message.getCommand()) {
case WRITE:
fsuipcInterface.write(message.getOffsetItems());
break;
case MONITOR:
for(NetMessageItem item : message.getItems()) {
... |
0a2c07d5-a8e6-4485-922e-fc44a7c973c5 | 5 | public void delete() {
String message = getMessageForDelete();
if (!message.equals(CHOOSE_MORE_THAN_ONE_STOCK_OWNER)) {
int choise = JOptionPane.showOptionDialog(frameDBView, message,
DELETING, JOptionPane.YES_NO_OPTION,
JOptionPane.PLAIN_MESSAGE, null, new String[] { YES, NO },
null);
if (choi... |
9f1a3526-19f9-4348-9d4a-69947e3e19e0 | 4 | public static String uploadSimpleFile(String url, String path,
Map<String, String> urlParam, Map<String, String> reqParam)
throws MalformedURLException, IOException {
FileInputStream file = null;
file = new FileInputStream(path);
StringBuilder fullUrl = new StringBuilder(url + "?");
for ... |
c208181f-e7f4-4fad-a5e4-570eaa945dd6 | 3 | private void add_all_members(JSONObject obj) {
RoomInfo roomInfo = RoomInfo.getRoomInfoFromJson(obj);
RoomInfo currentRoom = roomMap.get(obj.get("id_room"));
System.out.println("parsed room info: "+roomInfo.toJSONObject().toJSONString());
if (currentRoom != null) {
currentRoom.setTeams(roomInfo.getTeams()... |
f56cfe51-a1e4-4460-80a1-f8336c161c0a | 2 | public Set<MCDObjet> removeObjets() {
Set<ZElement> selectionAvantEffacement = new LinkedHashSet<ZElement>(selectionCourante);
Set<MCDObjet> observersAEffacer = new LinkedHashSet<MCDObjet>();
for (ZElement element : selectionAvantEffacement) {
removeObjet(element);
if (el... |
07bab140-5e4f-4c94-9747-86adc49f6221 | 6 | public void tick() {
//asks all turtles to perform their action
if (!locked.get() && !cutscene) {
for (int i = 0; i < images.size(); i++) {
_display.remove(images.get(i));
}
System.out.println("Ticking");
locked.set(true);
for (... |
19df8f25-338b-413b-91c0-81c29c3f2f30 | 5 | @SuppressWarnings("deprecation")
public void actionPerformed(ActionEvent e) {
if (e.getSource().equals(go)) {
setCursor(Cursor.WAIT_CURSOR);
try {
c = new Competition(htmlField.getText());
parseHTML(HTMLUtils.getMatchbitHTML(htmlField.getText()), c);
rankbits = HTMLUtils.getRankbits(HTMLUtils.getRa... |
9091fa92-5e14-415f-bce0-cfeb8d389562 | 3 | public void load_to_disk(HDD d) throws IOException, NumberFormatException
{
String bufRead;
BufferedReader in;
//declares the attributes of the job
int id = 0;
int priority, jobSize;
ArrayList<Job> newJList = new ArrayList<Job>();
in = new BufferedReader(new FileReader("resources/ugradPart1.txt"))... |
2e6c4f0f-1cb4-4d87-baba-1644d365ae6f | 9 | public ItemClasse() {
this.tablemap = new HashMap<String, Method[]>();
try {
Method[] ids = new Method[]{
ItemClasse.class.getMethod("getIdItemClasse", new Class<?>[]{}),
ItemClasse.class.getMethod("setIdItemClasse", new Class<?>[]{Integer.class})
... |
ad36929f-a54e-4991-8a1a-d64c74d7b169 | 2 | public static ArrayList<Integer> splitIntoDigits(int number) {
ArrayList <Integer> digitsInNumber = new ArrayList <Integer>();
do {
digitsInNumber.add(0, number % 10);
number /= 10;
if (number / 10 == 0 & number % 10 != 0)
digitsInNumber.add(0, number % 10);
} while (number / 10 != 0);
return... |
16f1e96e-2fc9-4c0c-940d-ad9fb0e68ca1 | 3 | String usage() {
try {
InputStream is = this.getClass().getResourceAsStream("/ngmf/ui/calc/Functions.txt");
if (is == null) {
return "";
}
int c;
StringBuffer b = new StringBuffer();
while ((c = is.read()) != -1) {
... |
a2dcfb65-8c07-47d7-9fbb-45cc389732e4 | 2 | public void testMillisProviderSecurity() {
if (OLD_JDK) {
return;
}
try {
try {
Policy.setPolicy(RESTRICT);
System.setSecurityManager(new SecurityManager());
DateTimeUtils.setCurrentMillisProvider(new MillisProvider() {
... |
a92283b1-1e3f-422e-ab30-61cd1d5d9213 | 8 | void output(int code, OutputStream outs) throws IOException {
cur_accum &= masks[cur_bits];
if (cur_bits > 0)
cur_accum |= (code << cur_bits);
else
cur_accum = code;
cur_bits += n_bits;
while (cur_bits >= 8) {
char_out((byte) (cur_accum & 0xff), outs);
cur_accum >>= 8;
... |
6620f76e-87e1-4761-8e8d-aa1257113f0f | 6 | public static String equilibrer(String contrainte)
{
if(contrainte.contains("<") || contrainte.contains("<="))
{
compteur++;
return contrainte.replace("<","+e"+compteur+"=").replace("==", "=");
}
else if(contrainte.contains(">") || contra... |
5c57c2d5-4d8c-4546-9ea4-31fffb66d3e8 | 4 | private void permuteHelper(int[] num, int left) {
if (left == num.length - 1) {
ArrayList<Integer> list = new ArrayList<Integer>();
for (int i = 0; i < num.length; i++) {
list.add(num[i]);
}
if (set.add(list))
result.add(list);
... |
09f17c7d-3833-423d-b63d-e07468ff15a3 | 8 | public static void dropWall(ClanWars clanWars) {
List<WorldObject> objects = clanWars.getWallObjects();
Animation animation;
switch (clanWars.getAreaType()) {
case CLASSIC_AREA:
case PLATEAU:
animation = new Animation(10368);
break;
case FORSAKEN_QUARRY:
animation = new Animation(10369);
break;
... |
29085d12-77f9-41e6-ada4-4727a5eb7ef1 | 0 | @Test
public void test_isBonusSquare(){
assertNotNull(board);
assertFalse(board.isBonusSquare(2,2));
assertTrue(board.isBonusSquare(4,4));
} |
b4e8fc17-b9e9-46ee-95ae-a20a2c949163 | 7 | protected void doGet(HttpServletRequest request, HttpServletResponse response) {
try {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
Document xmlDoc = DocumentHelper.createDocument();
Element root = xmlDoc.addElement("SpiderConfig"... |
c2409a4d-8efd-418b-ac0a-eda2c3c34db7 | 5 | public void afterInvocation(IInvokedMethod method, ITestResult result) {
Reporter.setCurrentTestResult(result);
if (method.isTestMethod()) {
List<Throwable> verificationFailures = ErrorCollector.getVerificationFailures();
//if there are verification failures...
if (verificationFailures.size() >... |
ce7a6a86-36bc-4c2b-97b3-3a577e400dc8 | 9 | protected void pushedButton(){
String id = gui.getDriverID();
String[] times = Time.makeTimeList();
if (gui.getDriverID().length() == 0) {
try {
String driverID = JOptionPane.showInputDialog(null,
"Den registrerade tiden är : " + times[0] + "."
+ times[1] + "." + times[2]
+ " \n Föra... |
d5c14789-759b-462d-97ee-4e4f3cd01294 | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if(super.checkStop(mob, commands))
return true;
verb=L("bandaging");
bandaging=null;
final MOB target=super.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if((targe... |
56bada1b-7deb-475e-9037-606c17b1b2ba | 3 | private void initMenu() {
// Mini menu!
JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu("File");
if (Universe.CHOOSER != null) {
MenuBarCreator.addItem(menu, new OpenAction());
}
try {
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkExit(0);
Men... |
3ce6f8f7-676d-4f36-aa1a-1fb681fdda83 | 0 | public JLabel getjLabel9() {
return jLabel9;
} |
f6cd65ce-0074-40d6-9882-af3431b8d591 | 9 | public Exit[] getParmExits(MOB monster)
{
if(monster==null)
return null;
if(monster.location()==null)
return null;
if(getParms().length()==0)
return null;
final Room room=monster.location();
if(dirs!=null)
for (final Integer integer : dirs)
{
final int dir=integer.intValue();
if(room.g... |
afd60457-774b-4036-bda5-2e22c1f18083 | 7 | public void add(ActionPair pair) {
XmlAction dcDo = Tools.deepCopy(pair.getDoAction());
XmlAction dcUndo = Tools.deepCopy(pair.getUndoAction());
long currentTime = System.currentTimeMillis();
if ((actionPairList.size() > 0)
&& (actionFrameStarted || currentTime - timeOfLa... |
45f85288-14ed-4372-a3d0-cb0612e1990e | 8 | public void handleROD() {
if (c.getItems().playerHasItem(2552, 1)) {
c.getItems().deleteItem(2552, 1);
c.getItems().addItem(2554, 1);
}
else if (c.getItems().playerHasItem(2554, 1)) {
c.getItems().deleteItem(2554, 1);
c.getItems().addItem(2556, 1);
}
else if (c.getItems().playerHasItem(2556, 1)) {
c... |
167e7a79-9626-4ff0-806c-b209f10f6bf3 | 0 | public void setTrainNumber(String value) {
this._trainNumber = value;
} |
c2fb3502-ec57-461a-a3ef-e908b7875137 | 6 | @Override
public void run() {
for(int i = 0; (!handshakeReceived) && (i < 900000); i++) {
try {
synchronized(obj) {
obj.wait(10);
}
} catch(InterruptedException e) {
e.printStackTrace();
}
}
if(!handshakeReceived) {
stop();
log.fine("Shutting down : No Handshake!");
... |
1793144a-4267-4fb1-abfa-7d8006c9c519 | 8 | public final static byte[] decode(final String text) {
int posChars = 0;
int posKey = 0;
final char[] chars = text.toCharArray();
final byte[] key = new byte[chars.length / 2];
while (posKey < key.length) {
final int[] bytes = new int[] { chars[posChars++],
chars[posChars++] };
int byteValue = 0;
... |
1cc27ee3-422f-4b79-9487-8ec4e9fff098 | 1 | public static byte[] generateMagicPeerId() {
boolean notFound = true;
Random random = new Random(System.currentTimeMillis());
byte[] peerId = new byte[20];
while (notFound) {
random.nextBytes(peerId);
notFound = !Peer.isMagicPeerId(peerId);
}
return peerId;
} |
abcd303f-a78f-40bf-ad94-a0bf768f5835 | 3 | private void assertIn(ReadResponse resp, String field, String... elems) {
for (String val : resp.mapStrings(field)) {
for (String elem : elems) {
if (elem.equals(val)) {
return;
}
}
fail(val + " was not in " + Joiner.on(", ").join(elems));
}
} |
aab50ac4-620f-4dc6-8fd7-cdbb1d6fec4c | 3 | public static void main(String[] args){
Scanner in = new Scanner(System.in);
String s = in.next();
String t = in.next();
String result = "need tree";
if(checkAuto(s, t)) result = "automaton";
else if(equalArrays(sortChars(s), sortChars(t))) result = "array";
else if(checkAuto(new String(sortCh... |
f19aa4d4-f601-48d8-adbe-eaa8f60aebe9 | 8 | public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[30];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 15; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
i... |
5003cbcb-3076-4216-b6a6-4368e4d028f6 | 8 | public int[][] makeTileMap(ArrayList<GameEntity> entities){
int width=1;
int height=1;
startX=entities.get(0).getStartX();
startY=entities.get(0).getStartY();
int tileSize=GlobalSettings.tileSize;
// get the dimensions of the tileMap
for(int i=1;i<entities.size();... |
8dc0ff7d-c4ac-4a87-bc59-b5f26a9f44f3 | 2 | public int Obtener_Secuencia() {
try {
int id1 = 0;
String sql = "select count(*) from recordatorios";
ResultSet rs;
if ((rs = conn.consultar(sql)).next()) {
id1 = Integer.parseInt(rs.getString(1));
}
return id1;
} c... |
322d132e-c393-4a23-b7cf-62da8b16e105 | 1 | @Override
public void rollback() throws DaoException {
try {
mysqlConn.rollback();
} catch (SQLException ex) {
throw new DaoConnectException("Rollback failed.");
}
} |
9168e66e-fa69-4724-b980-900794efce8d | 2 | public void send(String text) {
try {
if (conn != null) {
conn.send(text);
}
} catch (Exception ex) {
}
} |
0762c4ca-0697-47ce-b622-1e46600731e0 | 5 | public static void delete( File... paths )
throws IOException
{
IOException exception = null;
for ( File eachPath : paths ) {
if ( eachPath.exists() ) {
if ( eachPath.isDirectory() ) {
delete( eachPath.listFiles() );
}
... |
c8aa0f23-6cec-4a3c-ac7c-efd226ae3f3c | 7 | public GameClient () {
client = new Client();
client.start();
Network.register(client);
client.addListener(new Listener() {
public void connected (Connection connection) {
Network.RegisterName registerName = new Network.RegisterName();
registerName.name = name;
client.sendTCP(registerName);
... |
07309b8f-4714-4561-bf3f-885db95fa6df | 6 | * @param localP
*/
public static void upclassifyInstances(Module module, boolean localP) {
{ Object old$Classificationsession$000 = Logic.$CLASSIFICATIONSESSION$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Logic.$CLASSIFICATIONSESSION$, Logic.getClassifi... |
71fdabbc-e357-4acf-934d-032a39f4bcfd | 5 | @Override
public void run() {
// while (true) { //interrupt can't stop endless cycle
for (int i = 0; i <= 100000000; i++) {
if (Thread.currentThread().isInterrupted()) {
return;
}
if (i % 10000 == 0) {
System.... |
8a1a3dfa-08d8-4ae1-8876-09c1f135bfe7 | 7 | * @param localP
*/
public static void upclassifyNamedDescriptions(Module module, boolean localP) {
{ Object old$Classificationsession$000 = Logic.$CLASSIFICATIONSESSION$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Logic.$CLASSIFICATIONSESSION$, Logic.get... |
d4c0ea8c-70d1-4b7c-89be-d83e2fd4209f | 0 | public void writeToLogAndConsole(String msg) {
System.out.println(msg);
write(msg);
} |
249c06f7-5fef-4da5-a7c5-a933cb5db4e4 | 7 | public static void main(String[] args) throws IOException{
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int n;
boolean add = false;
while((n = Integer.parseInt(r.readLine())) > 0){
int act = 1;
... |
fa7e7cd2-d1de-49d7-b2b4-b9904991573c | 3 | public static Food getNearestFood(Critter self, Environment envi){
synchronized(envi.lock_food){
List<Food> food = getViewableFood(self, envi);
if(food.isEmpty()){
return null;
}
Food closest = null;
double min = 10000000;
Iterator<Food> iter = food.listIterator();
while(iter.hasN... |
41c123a3-8b21-4db9-81bf-78a03525ec10 | 9 | public Class<?> getObjectClass() {
if (_wrapperObject instanceof Boolean)
return boolean.class;
else if (_wrapperObject instanceof Integer)
return int.class;
else if (_wrapperObject instanceof Float)
return float.class;
else if (_wrapperObject instanceof Double)
return double.class;
else if (_w... |
54787720-ce08-4d7f-8793-47f8fd96b685 | 5 | public static void print(int[][] m, char GS) {
// Print the matrix header
String row= "";
for (int r= 0; r < m.length; r= r+1) {
if (r < 10)
row= row + " " + GS + r;
else if (r < 100) row= row + " " + GS + r;
else row= row + " " + GS + r;... |
c721374e-1de6-4377-b55b-e1e1b68efc0b | 4 | public static ArrayList<String> finiteQueue(ArrayList<Double> parameters, int type)
{
ArrayList<String> output = new ArrayList<String>();
double lambda = parameters.get(INFINITE_LAMBDA);
double s0 = parameters.get(S0);
double w = parameters.get(W);
double mu = 0.0;
if(type != MU)
mu = 1/s0;
else
... |
313abbc1-9cd3-4abc-a145-ec479230133e | 6 | public int bestMeleeDef() {
if(c.playerBonus[5] > c.playerBonus[6] && c.playerBonus[5] > c.playerBonus[7])
return 5;
if(c.playerBonus[6] > c.playerBonus[5] && c.playerBonus[6] > c.playerBonus[7])
return 6;
return c.playerBonus[7] <= c.playerBonus[5] || c.playerBonus[7] <=... |
0b0599a5-cc5a-4d82-ba35-18dd99f0927f | 1 | private static FullTicket FullTicketObject(ResultSet rs) {
FullTicket newfullTicket = null;
try {
newfullTicket = new FullTicket(rs.getInt(rs.getMetaData().getColumnName(1)),
rs.getString(rs.getMetaData().getColumnName(2)),
... |
46781af5-2d35-4fc3-b6f7-a9f32082dd62 | 7 | public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the s... |
01c968f7-2e89-4748-89be-ce4b707da19f | 7 | private void updateParticlePositions() {
for(int i = 0; i < velocities.length / 2; i++){
for(int k = 0; k < velocities[i].length; k++){
if(Math.abs(velocities[i][k] - 1.0) <= epsilon){
double exchange = personalBest[i][k];
for(int n = 0; n < positions[i].length; n++){
if(Math.abs(positions[i][n... |
43820103-b634-4822-bd31-173a18ab8fa4 | 1 | public static void main(String[] args)
{
int capacity = 17;
int w[] = { 3, 4, 7, 8, 9 };
int v[] = { 4, 5, 10, 11, 13 };
BU01Knapsack td = new BU01Knapsack(5, capacity, w, v);
for (int i = 0; i <= capacity; i++)
System.out.println(i + " : " + td.knap[i]);
} |
401750c0-73a4-49c8-ba05-8917a500c888 | 0 | public static void main(String[] args) throws IOException {
// System.out.println("\u682A\u6D32\2CZZQ");
// if(1==1)return;
UserEntity user = new UserEntity();
user.setUsername("289048093@qq.com");
user.setPassword("lichao258");
String[] data = ConnectionUtil.getRandCode();... |
be704bad-9443-4b07-8ed7-48b65e47edb9 | 3 | private void disableVoiceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_disableVoiceActionPerformed
// TODO add your handling code here:
String dest = myList.getSelectedValue().toString();
dest = dest.trim();
if ( dest.equals( client.frame.getTitle() ) )
{
... |
cf1c9cee-d991-40f7-a802-e28176a01bc4 | 4 | @Override
public void eventDispatched(AWTEvent event)
{
if (event.getID() == MouseEvent.MOUSE_PRESSED)
{
if (!(event.getSource() == this || event.getSource() instanceof JComponent &&
((JComponent) event.getSource()).getTopLevelAncestor().e... |
d5ae0ec8-3504-46d6-8cef-c81782a5119a | 7 | public void method464(Model model, boolean flag) {
anInt1626 = model.anInt1626;
anInt1630 = model.anInt1630;
anInt1642 = model.anInt1642;
if (anIntArray1622.length < anInt1626) {
anIntArray1622 = new int[anInt1626 + 10000];
anIntArray1623 = new int[anInt1626 + 10000];
anIntArray1624 = new int[anInt1626... |
066118bd-2fb1-49ba-ae5d-7b13cf90e4cc | 5 | public static AbstractResponse deserializeResponse(String json)
throws APIException, PermissionException,
RequestNotPracticableException, InternalErrorException {
Object data = deserialize(json, packagePrefixResponse,
packagePrefixException);
// NOTE the possible types for data are ... //TODO specify
if ... |
2c22f07d-d454-4306-9149-7bcec0b29f2a | 3 | @Override
public void onBlockPlacedBy(EntityLivingBase entityliving) {
if (entityliving == null)
return;
if (this instanceof ITrackReversable) {
int dir = MathHelper.floor_double((double) ((entityliving.rotationYaw * 4F) / 360F) + 0.5D) & 3;
((ITrackReversable) th... |
e8a71a0f-b16a-47da-baa9-df7dd5d14006 | 2 | public BacklogBean loadId(BacklogBean oBacklog) throws ServletException {
try {
if (request.getParameter("id") != null) {
oBacklog.setId(Integer.parseInt(request.getParameter("id")));
} else {
oBacklog.setId(0);
}
} catch (NumberFormatE... |
297da6b9-8e17-4bf7-b23e-2351555ef0ed | 5 | private synchronized void processFlowPacket(Sim_event ev, int tag)
{
Packet pkt = (Packet) ev.get_data();
PacketScheduler sched = getScheduler(pkt);
//System.out.println("Packet id is " + pkt.getID());
// if a packet scheduler is not found, then try reschedule this packet
//... |
f8a250a6-9f39-4ffc-b81e-093fe0e4f9ae | 9 | public int getNbLecture(int row)
{
int cpt = -1;
try {
Class.forName("org.sqlite.JDBC");
} catch (ClassNotFoundException e1) {
e1.printStackTrace();
}
Connection connection = null;
try{
// create a database connection
connection = DriverManager.getConnection("jdbc:sqlite:" + "ressources/mp3dat... |
0afc6689-1cbe-4421-a33f-24c1e0e2f456 | 0 | public void mouseEntered(MouseEvent e) {
} |
79740223-aef2-4a46-8b16-1a5c02d2fe92 | 2 | @Override
public TLValue evaluate() {
TLValue a = lhs.evaluate();
TLValue b = rhs.evaluate();
// number + number
if(a.isNumber() && b.isNumber()) {
return new TLValue(a.asDouble() * b.asDouble());
}
throw new RuntimeException("illegal expression: " + this);
} |
a1535252-a9eb-4b6e-999e-d7c1a16e75f6 | 8 | public Set<Map.Entry<Short,Character>> entrySet() {
return new AbstractSet<Map.Entry<Short,Character>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TShortCharMapDecorator.this.isEmpty();
}
... |
302ef992-97cb-4574-8b53-8eef0c854474 | 8 | public static Keyword continueCachedBindingsProof(ControlFrame frame, Keyword lastmove) {
lastmove = lastmove;
{ Proposition goal = frame.proposition;
Iterator iterator = ((Iterator)(KeyValueList.dynamicSlotValue(frame.dynamicSlots, Logic.SYM_LOGIC_CACHED_BINDINGS_ITERATOR, null)));
if (iterator ==... |
44c95f9b-bd1c-4825-a85e-629a479180f0 | 4 | public static String humanReadableInt(long number) {
long absNumber = Math.abs(number);
double result = number;
String suffix = "";
if (absNumber < 1024) {
// nothing
} else if (absNumber < 1024 * 1024) {
result = number / 1024.0;
suffix = "K";
} else if (absNumber < 1024 * 1024 * 1024) {
result... |
1544e684-7a4c-4046-b815-6d0ce5691721 | 3 | public void setLeft(PExp node)
{
if(this._left_ != null)
{
this._left_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
... |
67404eb3-820d-4f97-80d7-3bca0c3547fd | 5 | private boolean jj_3R_39() {
Token xsp;
xsp = jj_scanpos;
if (jj_3_27()) {
jj_scanpos = xsp;
if (jj_3_28()) {
jj_scanpos = xsp;
if (jj_3_29()) {
jj_scanpos = xsp;
if (jj_3_30()) {
jj_scanpos = xsp;
if (jj_3_31()) return true;
}
}
}
}
return false;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.