method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
2caaab70-4b0f-49a1-b10c-5d72d432f7a8 | 2 | public FunDecl lookupFunc(String name, int len) {
FunDecl funDecl = funDecls.get(name);
if(funDecl==null) {
if(parent!=null) {
return parent.lookupFunc(name, len);
}
else {
throw new RuntimeException("Function <" + name + "> undefined")... |
1a8a239f-e866-4f26-b567-8434381663e7 | 1 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
protected void initComponents() {
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel1 = new javax.swing.JPanel();
btnNome = new javax.swing.JLabel();
jLabel... |
b71bcb8f-472e-4076-9420-0bb7ca98c698 | 4 | public static Object load(String nom, String version) {
// Controler la validité des paramètres
//
if (nom == null || version == null) {
// Indiquer l'erreur
//
System.err.println("ConfigXML : Param�tre null !");
return false;
}
//... |
8cc55343-17c5-4746-9eba-51f586658c81 | 4 | public double standardizedPersonStandardDeviation(int index){
if(!this.dataPreprocessed)this.preprocessData();
if(index<1 || index>this.nPersons)throw new IllegalArgumentException("The person index, " + index + ", must lie between 1 and the number of persons," + this.nPersons + ", inclusive");
i... |
8157bf16-d72f-479f-89a9-532859af1163 | 0 | public FrameDesc() {
pageNo = new PageId();
pageNo.pid = INVALID_PAGE;
dirty = false;
pin_cnt = 0;
} // end constructor |
4f2f8f89-85db-4336-b2d3-0bfbef0cff76 | 9 | public int[] OrdenSeleccion(int arreglo[], String ordenamiento) {
int indice = 0, indice2 = 0, menor = 0, posicion = 0, temporal = 0;
if (ordenamiento.equals(arreglo)) {
for (indice = 0; indice < arreglo.length; indice++) {
menor = arreglo[indice];
posicion = ... |
f2749cfd-4a88-4320-a2b7-f34086108168 | 4 | public static void main(String[] args) throws Exception {
if (args.length != 2) {
System.out.println("Usage: java " + RandomProjectionsAccuracy.class.getCanonicalName() + " train_file test_file");
System.exit(1);
}
String trainFile = args[0];
String testFile = ar... |
82a7c020-8b72-4e26-9ae5-9625dc6d2661 | 1 | public int getFuelTimer() {
if(isFuel())
return fuelTimer;
else
return -1;
} |
41ab3aaa-c828-48de-abb1-6d7dcf567df6 | 5 | private void cargar_Campos (int valor){
try{
this.vaciarCampos();
r_con.Connection();
PreparedStatement pstm = r_con.getConn().prepareStatement(
"SELECT *"+
" FROM "+name_tabla+
" WHERE prod_codigo = ... |
8669a59f-5ea6-4af3-9019-ee98891f0dbe | 8 | private void chosePotions() {
if (Bank.getItem(RSC.EXTREME_RANGING_FLASK_IDS[5]) != null) {
potionId = RSC.EXTREME_RANGING_FLASK_IDS[5];
} else if (Bank.getItem(RSC.EXTREME_RANGING_POTION_IDS[3]) != null) {
potionId = RSC.EXTREME_RANGING_POTION_IDS[3];
} else if (Bank.getItem(RSC.RANGING_FLASK_IDS[5]) != nu... |
5c12bd68-e828-49c3-8911-18129ea399cb | 6 | public double getAngle(double a,double b,double c, double d){
if((a>=c&&b>=d)||(a>=c&&b<=d))
return Math.asin((b-d)/
Math.sqrt(Math.pow((a-c),2)+
Math.pow((b-d), 2)));
else if(a<c&&b>=d)
return Math.toRadians(90.0)+Math.acos((b-d)/
Mat... |
fdbf9526-29c4-4507-97fd-55280f48fc61 | 6 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Connection c = null;
Statement stmt = null;
String sql;
PrintWriter out = response.getWriter();
response.setContentType("text/html");
String ID = request.getParameter("... |
e2acd74b-a183-471c-b906-a648d196a2df | 9 | public SetupFrame() {
super("Atoms Setup");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
try {
setLayout(new GridLayout(0, 4));
for (final Field fld : AtomSetup.class.getDeclaredFields()) {
add(new JLabel(fld.getName()));
if (fld.getType() == AtomSetup.Packing.class) {
final JComboBox cb = ... |
a5565349-55b0-4e02-87ba-0bce5f342584 | 7 | private synchronized void doFileTransfer() throws IOException {
try {
int lengthOfSenderName = dis.readInt(); //II
byte[] senderNameB = new byte[lengthOfSenderName];
dis.read(senderNameB); //III
String sender = new String(senderNameB);
int lengthOfFile... |
c7bdaff9-d5b2-4cc0-abcb-a3d6b13c4fb4 | 9 | public static String getSpellByAscii(int ascii) {
if (ascii > 0 && ascii < 160) { // 单字符
return String.valueOf((char) ascii);
}
if (ascii < -20319 || ascii > -10247) { // 不知道的字符
return "";
}
String spell = null; //key
Integer asciiRang; //value
String spellPrevious = null; //用来保存上次轮循环的key
int as... |
ec89fb52-a19a-4f14-a82f-1e2e167adfff | 2 | public BencodeTreeModel ( Value<?> root ) {
this.root = root == null ? null : new BencodeTreeNode( root, null, null );
System.out.println( root );
} |
7df1d8d1-3d4e-4f78-b1fb-259e8ac96680 | 4 | @Override
public boolean init(List<String> argumentList, DebuggerVirtualMachine dvm) {
functionLines = new LinkedHashMap<String, Boolean>();
if (argumentList.size() > 0) {
UserInterface.println("This command takes no arguments.");
HelpCommand.displayHelp(this);
r... |
e9003199-788a-42fb-97de-60d6f34a877d | 5 | public void draw(Graphics2D g)
{
for (int r = rowOffset; r < numberOfRowsToDraw + rowOffset; r++)
{
if (r >= numberOfRows) // Stop drawing if we run out of rows to draw
break;
for (int c = colOffset; c < numberOfColsToDraw + colOffset; c++)
{
if (c >= numberOfCols) // Stop drawing if we run out ... |
aa9f678a-7913-4ed2-908f-1b1da45820c0 | 1 | public final JSONObject getJSONObject(int index) throws JSONException {
Object o = get(index);
if (o instanceof JSONObject) {
return (JSONObject)o;
}
throw new JSONException("JSONArray[" + index +
"] is not a JSONObject.");
} |
fc573aa0-07df-4f70-855b-9cc664aac2e0 | 0 | public EncryptedKeyType createEncryptedKeyType() {
return new EncryptedKeyType();
} |
f0002f2f-70f8-4006-8420-11b70e938911 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null || this.getClass() != obj.getClass()) {
return false;
}
if (this == obj) {
return true;
}
if (obj.getClass() == this.getClass()) {
Wesen w = (Wesen) obj;// typecast Object zu
// Festkommazahl
if (this.lebenspunkte == w.lebensp... |
6b52768c-99e6-4203-90de-bd2901c50449 | 2 | public static void downloadBlob(String blobUri) {
String filePath = Connection.filePath;
try {
CloudStorageAccount storageAccount = CloudStorageAccount
.parse(Connection.storageConnectionString);
CloudBlobClient blobClient = storageAccount.createCloudBlobClient();
CloudBlobContainer container = blobCl... |
67a7bc20-731c-426f-9172-75b3d56a24dd | 9 | public void start(StreamLoader streamLoader, client client1)
{
String as[] = {
"model_version", "anim_version", "midi_version", "map_version"
};
for(int i = 0; i < 4; i++)
{
byte abyte0[] = streamLoader.getDataForName(as[i]);
int j = abyte0.length / 2;
Stream stream = new Stream(abyte0);
version... |
ae3b8d73-0c0e-402e-a2ed-05dcb2b55fa1 | 8 | private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
// TODO add your handling code here:
jList1.updateUI();
if (jList1.getSelectedIndex()>=0) {
Field f = Game.fields.get(fieldsR.get(jList1.getSelectedIndex()));
... |
8ca921e0-b720-4d57-879f-2916510bc45e | 2 | public int compareClock(Clock otherClock) {
LogicClock otherLocalClock = (LogicClock)otherClock;
// thisClock < otherClock
if (this.clock < otherLocalClock.clock)
return -1;
// thisClock > otherClock
if (this.clock > otherLocalClock.clock)
return 1;
// thisClock = otherClock
return 0;
} |
7fcec595-644c-48ea-bd92-270a807f07c3 | 1 | public boolean isExpired(SkiPass sp) {
Date currentDate = new Date(System.currentTimeMillis());
return (currentDate.before(sp.getExpirationDate()) ? false : true);
} |
0358af00-d28a-47b0-865e-5c794fadb5a1 | 5 | private static FileHandler getFileHandler(boolean devLog) throws IOException {
FileHandler handler = null;
Formatter formatter = null;
String suffix = "";
switch (commandLineOptions.getLogFormat()) {
case HTML:
if(devLog) {
formatter = new HTMLFormatter(false);
suffix = "-dev.html";
} else {
... |
e30bebdd-67af-4604-ac98-2b2f2b75e15b | 0 | @Override
public void setReceiveMessage(IReceiveMessage receiveMessage) {
this.receiveMessage = receiveMessage;
} |
b3cf7a53-6f89-45ae-b203-0f567a1afd7f | 1 | public CheckCreditForm(int clientId) {
//Fix clients id
this.clientId = clientId;
initComponents();
locateForm();
//Load to table all credita or credits for concrete user
if (clientId != 0) {
creditDAO.initTableModel(creditTable, creditDAO.ge... |
49e52c61-98da-4c75-a148-fceefc24267c | 5 | public void writeErrorReport(String folder) {
File dir = new File(folder);
if (!dir.exists()) {
dir.mkdir();
}
File file = new File(dir.getAbsoluteFile()+"\\readingErrors.txt");
if (file.exists()) {
file.delete();
}
FileOutputStream fos = null;
try {
fos = new FileOutputStream(file)... |
a55c69cc-9287-416a-9125-ea80bbcd2bcf | 0 | public void setUsed(Boolean used) {
this.used = used;
} |
1b1833fe-1d32-43f8-a132-dbab99448586 | 6 | public Brick(int xPos, int yPos, int width, int height, int hp, boolean powerUpsEnabled, int difficulty) {
this.xPos = xPos;
this.yPos = yPos;
this.width = width;
this.height = height;
this.hp = hp;
this.powerUp = new PowerUp(powerUpsEnabled, difficulty);
switch(hp) {
case -1: this.color = Color.gray... |
a8dff4b2-10c8-49de-99b6-bf6e88cf6479 | 4 | public static void main(String[] args){
routes[0][0]=1;
for (int i=0;i<21;i++){
for (int j=0;j<21;j++){
if (i==0 && j==0) continue;
routes[i][j] = sumOfPred(i, j);
}
}
System.out.println(routes[20][20]);
} |
770cef71-fc9d-4637-81ee-018a2fd84e7b | 1 | private void queueFile(int n) {
int index = mp3list.getIndex();
if (index >= 0) {
FramePanel fp = (FramePanel) tabbedPane.getComponent(n);
fp.getCon().add(mp3list.get(index), fp.getSearchPanel());
fp.getMp3List().update();
}
} |
1995d5ca-508a-4407-8c5e-5684b06b6dc7 | 7 | public static String getData(){
ObjectMapper mapper = new ObjectMapper();
List<Player> playersObj = new ArrayList<Player>();
for (Player player : plugin.getServer().getOnlinePlayers()) {
playersObj.add(player);
}
Map<String,Object> servers = new HashMap<String,Object>();
Map<String,Object> data ... |
f9d4cff1-b9f8-4ac6-9902-dd0bf0d0853f | 1 | private static JLabel getLabel(String string) {
JLabel label = new JLabel(string);
if (IMAGE != null)
label.setForeground(Color.black);
return label;
} |
369d6ebc-baf0-4ace-bcfc-cfeed3f517dc | 2 | private void DisplayLCS(int[][] b, char[] x, int max, int mIndex) {
if (max == 0)
System.out.println("no LCSubstring");
System.out.println("-----max: " + max);
System.out.println("-----maxIndex: " + mIndex);
int i = mIndex;
while (max > 0) {
System.out.print(x[i++]);
max--;
}
System.out.println... |
ce10512e-4f95-4f13-a597-c2c24b4cf9c8 | 8 | protected void createDefaultConfiguration(String name) {
File actual = new File(getDataFolder(), name);
if (!actual.exists()) {
InputStream input =
this.getClass().getResourceAsStream("/" + name);
if (input != null) {
FileOutputStream output = null;
try {
output = new FileOutputStream(act... |
31767173-24e4-4ba8-bc88-748afe6a7190 | 8 | public void setFieldValue(_Fields field, Object value) {
switch (field) {
case FIRST_NAME:
if (value == null) {
unsetFirstName();
} else {
setFirstName((String)value);
}
break;
case LAST_NAME:
if (value == null) {
unsetLastName();
} else {
... |
4ae98a89-1774-46a6-9113-ca7a015fa9ba | 6 | public void run() {
ajpacket msg = null;
try {
while (run) {
msg = (ajpacket) in.readObject(); // recieve messages
if (cdata != null) {
cdata.recv(this, msg);
}
}
} catch (IOException e) {
if (run) {
System.err.println("ajclient: connection error");
this.close();
}
} catch (... |
35548930-f9df-468a-96bf-45bfe8a7d007 | 1 | public static String SQLdecrypted (String decrypt) {
String decrypted = "";
try {
// Encryption used DES. We can also use AES
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
DESKeySpec keySpec = new DESKeySpec(secretSalt.... |
975e06e5-8f16-4949-8ce1-6bde7f2f8148 | 9 | public void func_40381_b(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase)
{
for (int var5 = 0; var5 < 16; ++var5)
{
for (int var6 = 0; var6 < 16; ++var6)
{
byte var7 = 1;
int var8 = -1;
byte va... |
913a1e14-cd04-473f-aea7-890bc2f97c42 | 7 | public static String getDescriptor ( byte multiplier, byte type ) {
switch ( type ) {
case 0:
switch ( multiplier ) {
case 1:
return "" ;
case 2:
return "Double Letter Score" ;
case 3:
return "Triple Letter Score" ;
default:
... |
3a4ebd0d-34ef-4b47-8f05-2c9856e3107b | 8 | public void handleWindow(Window window, int eventID) {
String setting = Settings.settings().getString("ExistingSessionDetectedAction", "manual");
if (setting.equalsIgnoreCase("primary")) {
Utils.logToConsole("End the other session and continue this one");
if (!SwingUtils.clickBut... |
515d353f-4c79-4c05-8443-3e65534c3b3f | 1 | public void printFund() {
int total = 0;
for(Konto k:accountList) {
total += k.getSaldo();
}
System.out.println("Total funds: " + total);
} |
ed639bbc-a62b-40ca-a7c4-8ec71397a22d | 8 | void loadResources() {
if (isEmpty())
return;
String address = null;
if (Page.isApplet()) {
synchronized (mdList) {
for (PageMd3d md : mdList) {
address = FileUtilities.removeSuffix(page.getAddress()) + "$" + md.getIndex() + ".mdd";
URL url = null;
try {
url = new URL(address);
... |
66c60d40-7efb-423c-8a75-fb49d11b2c9e | 6 | public void get(int key) {
HashPrinter.tryGet(key);
/** Run along the array */
int runner = 0;
int hash = (key % table.length);
while (table[hash] != null && runner < table.length) {
if (table[hash].getKey() == key) {
break;
}
runner++;
hash = ((key + runner * runner) % table.length);
... |
e0dbed66-1d95-4e86-9bbf-09cb809cbec1 | 4 | public void visitInsn(final int opcode) {
if (mv != null) {
mv.visitInsn(opcode);
}
execute(opcode, 0, null);
if ((opcode >= Opcodes.IRETURN && opcode <= Opcodes.RETURN)
|| opcode == Opcodes.ATHROW) {
this.locals = null;
this.stack = null;
}
} |
a67069d6-24b7-48af-8340-c866762927b1 | 9 | public boolean execute(CommandSender sender, String[] args, String label) {
FileConfiguration messages = plugin.getMessageConfig();
final String notPlayer = messages.getString("info.warnings.playerCommand");
final String usage = messages.getString("commands.unfriend.usage");
final Stri... |
6f13fbe1-709e-45bf-b992-99ba5fe98182 | 4 | public void hit() {
for (int i = 0; i < Game.missiles.size(); i++) {
if (hitBox.intersects(Game.missiles.get(i)) && Game.missiles.get(i).hit) {
health -= Game.missiles.get(i).getDamage();
atPl = true;
if (health < 1) {
dropMana(Game.missiles.get(i).getDamage() * 5);
Game.p.addXP(0.3);
}
... |
6efbbbee-bc94-4648-8e34-ffe2fc464741 | 3 | public void deleteHabitat(int id) {
if (id <= 0) return;
if (!existsHabitat(id)) return;
try {
PreparedStatement deleteHabitat = db.prepareStatement("DELETE FROM " + CuboidHandler.habitatTable + " WHERE cuboidid = '" + id + "';");
deleteHabitat.executeUpdate();
getHabitats().remove(id);
... |
f514e83c-dcb3-4d27-ac1b-1888661b1cd7 | 2 | public List<EntidadBancaria> findByCodigo(String codigo){
try{
List<EntidadBancaria> ListaEntidades;
Connection connection = connectionFactory.getConnection();
ListaEntidades = new ArrayList();
String buscarPorCodigo = "SELECT * FROM entidadbancaria where codigoEntidad = ?";
... |
e5104d2f-0684-406f-812b-3bd0e3da68d4 | 2 | public LocalVariable localAt(int index) {
LocalVariable local = (LocalVariable) locals.get(new Integer(index));
if (local == null) {
local = new LocalVariable(index);
locals.put(new Integer(index), local);
if (index >= maxLocals) {
maxLocals = index++; // Dangerous?
}
}
return (local);
} |
7d72d930-05b8-4972-b499-486bfda292f1 | 6 | private BufferedImage twistImage() {
double dMultValue = random.nextInt(7) + 3;// 波形的幅度倍数,越大扭曲的程序越高,一般为3
double dPhase = random.nextInt(6);// 波形的起始相位,取值区间(0-2*PI)
BufferedImage destBi = new BufferedImage(buffImg.getWidth(),
buffImg.getHeight(), BufferedImage.TYPE_INT_RGB... |
abc4cd7d-9ff8-4fe8-88d5-5d8f15652d98 | 9 | public static void main(String[] args) {
try {
BufferedReader br = new BufferedReader(new FileReader("addresses.list"));
String line;
ArrayList<String> lines = new ArrayList<String>();
while ((line = br.readLine()) != null) {
lines.add(line);
... |
c69d268f-179a-44bc-833b-2b4c57328b23 | 9 | @Override
public void parse() {
BufferedReader reader = new BufferedReader(new StringReader(getInput()));
String line;
Pattern nCount = Pattern.compile("n=(?<N>\\d+)");
Pattern person = Pattern.compile("(?<index>\\d+) (?<name>[a-zA-Z0-9-']+)");
Pattern preferences = Pattern.c... |
840654c0-9e0b-431c-8fc2-6b79b4e7df07 | 6 | public static void main(String[] args) {
Game g = new Game();
Scanner in = new Scanner(System.in);
while (true) {
// display the board
System.out.println(g.board);
System.out.println("Player " + g.getCurrentPlayerIndex());
// display the player's hand
Player p = g.getPlayer(g.getCurrentPlayerIndex... |
96e96195-61f0-4633-96f7-ffa86700c860 | 3 | public static void enregistrer_client(Client c)
{
SAXBuilder sxb = new SAXBuilder();
try {
document = sxb.build(fichier);
} catch (JDOMException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
... |
b940d6e8-6072-421f-8982-4bed185c6d71 | 9 | private boolean hasStraight() {
if (cards[4].getRank() == CardRank.ACE
&& cards[0].getRank() == CardRank.TWO) {
// Possible ace-low straight
if (
cards[1].getRank() == CardRank.THREE &&
cards[2].getRank() == CardRank.FOUR &&
cards[3].getRank() == CardRank.FIVE) {
return true... |
6bc6ea1d-8826-4f11-820b-c6e8ed1d0e96 | 4 | public void start() {
if(!(GameController.props.getProperty("os.name").contains("Linux") && GameController.props.getProperty("java.runtime.name").contains("OpenJDK"))) {
lastSong = null;
if(playList != null) {
if(currentSongIndex >= playList.size()) {
... |
4f500c09-eec0-4930-82ac-cf373076d78a | 8 | public static void main(String[] args) throws IOException{
BufferedReader bi = new BufferedReader(new InputStreamReader(System.in));
String line;
// while ((line = bi.readLine()) != null)
// for (String numStr: line.split("\\s"))
// sum += Integer.parseInt(numStr);
int n= Integer.parseInt(bi.... |
a4d2acb8-6463-4098-928c-271026e599eb | 5 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
BeanMa_train bm_train = null;
try {
bm_train = new BeanMa_train();
if("yahoo".equals(request.getParameter("datasource"))){
... |
d8d68828-764b-47ad-a5e7-0bd739ae16b2 | 9 | public void initialize(Subject newSubject, CallbackHandler newCallbackHandler,
Map<String, ?> sharedState, Map<String, ?> options) {
log.trace("Initializing HTTP OATH OTP LoginModule");
this.subject = newSubject;
this.callbackHandler = newCallbackHandler;
this.protectedUrl = options.get(OPTION_HTTPOATHOTP... |
f20ea0e0-7b71-4dab-9d00-bcfc15bca9ce | 1 | @Override
public int rowsX() {
return isNotPlayerInventory() ? 3 : 5;
} |
cb6f8dd7-e573-4853-aaf3-1ace786e282e | 8 | int alphabeta(int alpha, int beta, int depth, int player, FieldContainer fc) {
if (depth == 0) {
return estimateComplex(fc.getField(), player);
}
int best, score;
ArrayList<Field> moves = new ArrayList<Field>();
gen_moves(moves, fc.getField(), player);
if (player == 2) {
... |
64021882-db24-4f75-bd6c-15a2b702e0cc | 5 | @Override
public void run(){
if(bidderListeners.size() > 0){
timer.start();
for(IAllowedBidsEventListener e : bidderListeners) e.onAllowedToBid(new AllowedToBidEvent(this));
while(currentTime > 0){
try {
sleep(100);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
}
for... |
8bb7fbf2-5b86-47f1-9e5f-56f754d906a3 | 6 | public String readLine() throws IOException {
if (lookaheadChar == UNDEFINED) {
lookaheadChar = super.read();
}
line.clear(); //reuse
// return null if end of stream has been reached
if (lookaheadChar == END_OF_STREAM) {
return null;
}
/... |
8b54b1a0-4ec2-4dc1-9c56-fd3b573ae97e | 0 | public double getXCoordinate()
{
return xCoordinate;
} |
795a22c1-8661-48ba-a50d-eb641674be1d | 7 | @Override
public void enter(GameContainer gc, StateBasedGame game) throws SlickException {
if(!musicRef.equals("")) {
ResourceManager.getMusic(musicRef).setPosition(musicPos);
ResourceManager.getMusic(musicRef).loop();
}
System.out.println(musicRef);
gc.getInput().clearKeyPressedReco... |
9406da2a-46a0-4488-b6ca-dd921ed426be | 2 | public void setInterfaces(CtClass[] list) {
checkModify();
String[] ifs;
if (list == null)
ifs = new String[0];
else {
int num = list.length;
ifs = new String[num];
for (int i = 0; i < num; ++i)
ifs[i] = list[i].getName();
... |
8b74e0ec-5b39-449b-a1fa-72e4c3e0d79e | 8 | @SuppressWarnings ({ "unchecked", "rawtypes" } )
public static <T> Reflect<T> create( Object o )
{
if (o == null)
{
return (Reflect<T>)ReflectNull.INSTANCE;
}
else if (o instanceof Method)
{
return (Reflect<T>)addMethod( (Method)o );
}
... |
90719333-26fa-4beb-bd30-e8d85b072f18 | 4 | private void populateToolBar()
{
String[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment()
.getAvailableFontFamilyNames();
mButtons = new HashMap();
Action clear = new AbstractAction("Clear", null)
{
/**
*
*/
private static final long serialVersionUID = 1L;
public void actionP... |
a09102ec-03b8-4edf-bbcf-c758e5df281e | 0 | public DefaultComboBoxModel getModeleJComboBoxLabo() {
return modeleJComboBoxLabo;
} |
335a6977-8ee2-4ebc-a45e-b78bed2a80b7 | 9 | static boolean isVowel(char a){
return a=='A'||a=='E'||a=='I'||a=='O'||a=='U'||a=='a'||a=='e'||a=='i'||a=='o'||a=='u';
} |
2b380e33-d7dd-45eb-a86f-e2ff425c55ec | 5 | public int getQuantity(String str)
{
int lettersLength = getLetters(str).length();
if(str.length() == lettersLength) //if the string is too short for a quantity
return 1; //default quantity is 1
if(Character.isDigit(str.charAt(lettersLength))) //if there are numbers after the letters
{
int b... |
6d18fbe8-0ee1-428a-82ec-9df6aaf8fd8a | 9 | public void writeValue (final Value<?> value) throws IOException {
if (value instanceof StringValue) {
final StringValue sv = (StringValue) value;
stream.print(sv.getValueLength());
stream.print(':');
stream.write(sv.getValue());
} else if (value instance... |
40f726af-3666-4217-8da1-3aa4246447a3 | 5 | @Override
public Integer getIdFromDataBase() throws SQLException {
Integer id = null;
if(nameAnswer == null || nameAnswer.isEmpty()){
return id;
} else if(question == null || question.getIdTest() == null){
return id;
}
Statement statement = ua.edu.odek... |
dcd98fae-d585-4f54-aa87-448a903019a3 | 2 | public void test() throws Exception
{
MarketQuote quote = new MarketQuote( new Symbol("SIRI"));
for(MarketQuotesResponseField f: MarketQuotesResponseField.values())
{
if (quote.hasField(f))
{
System.out.println(f.name() + " " + quote.getField(f));
}
}
} |
8eb831b4-8304-439c-9932-cab7c536588b | 5 | public void run() {
while (true) {
String instruction = null;
try{
instruction = replicas.poll(1, TimeUnit.SECONDS);
if (instruction != null) {
Replica replica = ReplicaFactory.buildReplica(this.getLocation(), instruction); //Auto digested
if (replica.getOperations().name().equals("REPLY_CREA... |
007f2bf5-4a6a-49be-a1a1-0ff884f0cfec | 9 | @Override
public boolean importGroup27ReadingCO2(JSONObject toImport, String device_serial,String product_id) throws Exception {
String latitude = __jdbcProperties.getProperty("sql.latitude");
String longitude = __jdbcProperties.getProperty("sql.longitude");
String method = __jdbcProperties.getProperty("sql.meth... |
4c40e428-9eb8-4747-9c1c-9a3fe0a9d4fd | 2 | private EmailKontaktList readContacts() {
JAXBContext context = null;
if (!new File(EMAILCONTACTS_XML).exists())
return new EmailKontaktList();
try {
context = JAXBContext.newInstance(EmailKontaktList.class);
Unmarshaller um = context.createUnmarshaller();
EmailKontaktList emailContacts = (EmailKontak... |
ba60dc6c-58f6-4472-b389-4f06e70d411d | 6 | @Override
public void mousePressed(MouseEvent arg0) {
switch (arg0.getButton()) {
case MouseEvent.BUTTON1:
keymap.put(VK_MOUSE_1, true);
break;
case MouseEvent.BUTTON3:
keymap.put(VK_MOUSE_2, true);
break;
case MouseEvent.BUTTON2:
... |
471b0081-6caa-4acd-9546-1ad5776a4581 | 0 | public void setIsDeleted(Boolean isDeleted) {
this.isDeleted = isDeleted;
} |
26219625-49a9-4789-b2d9-2a3a8948e042 | 9 | public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[41];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 18; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
i... |
513a9ae0-721e-47ca-bc5b-3a3c3175c1b7 | 0 | private void placeIntegrationParameters() {
//Set layout to all internal panels
integrationParametersPanel.setLayout(gridBagLayout);
buttonsPanel.setLayout(gridBagLayout);
//Create GridBagConstraints
GridBagConstraints constraints = new GridBagConstraints();
constraints... |
413c747e-93bc-447d-ba59-2f751e935987 | 8 | private void setMethod(Method m) {
// Validate the method return
if (!m.getReturnType().equals(Void.TYPE)) {
throw new IllegalArgumentException("The target method must return null.");
}
// Validate the method modifier
if ((m.getModifiers() & Modifier.STATIC) != 0) {
throw new IllegalArgumentExcept... |
b54732ed-c4d1-4d81-82c9-5556aa5a84dc | 2 | private int getPosOfMinimumFromPos(int pos) {
int min = get(pos), minPos = pos;
for (int i = pos + 1; i < len(); i++) {
if(get(i) < min) {
minPos = i;
min = get(i);
}
}
return minPos;
} |
2aa9d3ec-9893-44e5-813e-1e86c712bbf4 | 7 | @Override
public void run() {
try {
long startTime = System.currentTimeMillis();
long currentTime = startTime;
Random r = new Random();
double amount = 1000.0;
double percent = 20.0;
while(isRunning()){
switch(operations){
case deposit:
executeOperationInMessageQueue();
myBank.mul... |
a443176b-03a7-4e8a-bccb-cca3fe36565a | 0 | @XmlElementDecl(namespace = "http://www.w3.org/2001/04/xmlenc#", name = "EncryptedData")
public JAXBElement<EncryptedDataType> createEncryptedData(EncryptedDataType value) {
return new JAXBElement<EncryptedDataType>(_EncryptedData_QNAME, EncryptedDataType.class, null, value);
} |
cff9bdee-1a5a-4fab-a381-268cab963f06 | 8 | public Frame1() {
try{
Class.forName(JDBC_DRIVER);
conn = DriverManager.getConnection(DB_URL,USER, PASS);
statement = conn.createStatement();
}catch(SQLException se){
se.printStackTrace();
}catch(Exception e){
e.printStackTrace();
}
setTitle("KutaRaya, 1 - 18");
setDefaultCloseOperation(J... |
06b71ae9-311e-43e8-8e98-4e109ea59934 | 4 | @Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (rotation % 2 == 1) {
g.drawOval(75, 75, 50, 50);
g.drawLine(0, 100, 75, 100);
g.drawLine(125, 100, 200, 100);
}
if (rotation % 2 == 0) {
g.drawOval(75, ... |
19d25758-5d1f-48fc-bf6d-01c40f540c59 | 7 | public String deleteMessage(String s) {
if (s != null) {
int count = 0;
int suchMessageNummer = Integer.parseInt(s);
File suchFile;
for (File box : dir.listFiles()) {
for (File file : box.listFiles()) {
if (file.isFile() && fi... |
0256e0e2-adc4-4119-8cdd-8f5a61e4ff29 | 5 | public Result download() {
Result back = Result.UPDATED;
File updateFolder = this.plugin.getServer().getUpdateFolderFile();
String url = (String) this.latest.get(this.DL_URL);
ReadableByteChannel rbc = null;
FileOutputStream fos = null;
try {
URL call = new UR... |
430eee48-fb31-4887-9c6f-8e1af1e5126a | 2 | private void getExams() {
try {
Exam_DAO exam_DAO = new Exam_DAO();
ResultSet rs = exam_DAO.getList("");
exams = new ArrayList<sols.Model.Exam>();
while (rs.next()) {
sols.Model.Exam examTemp = new sols.Model.Exam();
examTemp.setEx... |
a91dc26d-64a8-4991-baf2-8d103e09fb6a | 4 | @Override
public Operation simplify() {
Expression L = Simplify.mod(this.L);
Expression R = Simplify.mod(this.R);
if ( "0.0".equals(L.getString()) || "0.0".equals(R.getString()) ){
return new Number(0);
} else if ( "1.0".equals(L.getString()) ){
return R.operation;
} else if ( "1.0".equals(R.getString(... |
e298119a-4c92-45cd-8479-9bbc8ba0a531 | 0 | public home(int x,int y)
{
super(x,y);
URL loc = this.getClass().getResource("/karel/themes/LTTPHome.png");
ImageIcon iia = new ImageIcon(loc);
image = iia.getImage();
this.setImage(image);
} |
5aea3337-427a-4e3c-97eb-8fcc750aa920 | 4 | public synchronized void mouseClicked(MouseEvent me) {
if(me.getButton() == MouseEvent.BUTTON1) {
if(!player.getRelativeMouse()) {
player.setRelativeMouse(true);
canvas.hideCursor();
}
else {
ball.releaseBall();
Shooter shooter = player.getPaddleShooter();
if(shooter != null)
... |
31cc7aaf-3a28-4859-afd4-80dcb32821f3 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Course other = (Course) obj;
if (catalogNumber == null) {
if (other.catalogNumber != null)
return false;
} else if (!catalogNumber.equal... |
5ebbed40-b09c-4f5b-8cce-33e15d6db368 | 7 | private boolean jj_3R_51()
{
if (jj_scan_token(IF)) return true;
if (jj_3R_9()) return true;
if (jj_scan_token(THEN)) return true;
if (jj_3R_9()) return true;
if (jj_scan_token(ELSE)) return true;
if (jj_3R_9()) return true;
if (jj_scan_token(END)) return true;
return false;
} |
b5fdad38-d73b-4b5e-8d65-2de9388b2ed5 | 9 | public static BufferedImage parametrizedGaussBlur(BufferedImage input, double sigma) {
// build blur kernel
int size = (int) (((int) (Math.ceil(6 * sigma)) % 2) == 1 ? Math.ceil(6 * sigma) : (Math.ceil(6 * sigma) + 1));
double kernel[] = new double[size];
int sigmaIndex = size/2;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.