method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d3581e44-91fc-429f-a101-975196e69a96 | 9 | public void Update(Rectangle playerRect, double visibility)
{
// No need to update when not moving
// -> No collisions, no change of angles, no change of position
if (move != Move.IdleStand)
{
angle = (float) Math.toDegrees(Math.atan2(speed.X, -speed.Y));
Vector2 sign = new Vector2(1, 1);
sign.X = si... |
2277e4d0-4176-4ab9-95ac-5168e12f5210 | 7 | public void tick(int y) {
if ( y > 25000 ) {
} else if ( y > 17000 ) {
if ((y%100) == 0) {
this.generateWing(y);
}
if ((y%1499) == 0) {
this.generatePowerUp(y);
}
} else {
if (this.bossBattle == false) {
this.bossBattle = true;
this.boss = this.enemyGenerator.make... |
7f02eea5-a72e-4992-b2ea-b07b3410c319 | 4 | public GameControllerServerSide(Game g, List<PrintWriter> outWriters, List<BufferedReader> playerInputs) {
gameHistory = "";
this.game = g;
players = g.getPlayers();
String allPlayerReps = "";
for(int i = 0; i < g.getPlayers().size(); i++){
RemotePlayer player = (RemotePlayer) g.getPlayers().get(i);
pla... |
1579801d-23ad-4eb1-b122-edfdbb928ac2 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Method other = (Method) obj;
if (params == null) {
if (other.params != null) {
r... |
c5e04281-9778-4a6f-826a-8970ffc08835 | 5 | public ArrayList<Link> getPrevLinksForNode(Node node, ArrayList<Link> prevLinks) {
boolean found = false;
if (this.getP2() == node) {
for (Link link : prevLinks) {
if (link == this) {
found = true;
}
}
if (!found) {
... |
cd5f474b-0dba-4781-8dae-bd50c0214654 | 7 | private void setMatrix1Panel() {
int rows = Integer.parseInt(matrix1Rows.getText());
int columns = Integer.parseInt(matrix1Columns.getText());
if ((rows == 1 && columns == 1) || rows < 1 || rows > 10 || columns < 1 || columns > 10){
matrix1Rows.setText(matrix1R + "");
matrix1Columns.setText((input1.length /... |
5b794ef9-afb8-435b-9d42-3d4605f2f197 | 4 | @Override
public String execute() throws Exception {
try {
User user = (User) myDao.getDbsession().get(User.class, email);
if (user.getPassword().equals(password)) {
Map session = ActionContext.getContext().getSession();
if (!user.getUserType().equ... |
a84434d3-1f1b-461c-a86e-95854b370ca7 | 4 | public double computeSimilarity(int movie1, int movie2) {
double sim = 0;
// generate arrays containing ratings from users which rated both movies
List<Integer> sharedUsers = findSharedUsers(movie1, movie2);
if (sharedUsers.isEmpty()) {
return sim;
}
Double[] movieOneRatings = new Double[sharedUsers.s... |
f0ae608a-a370-4e09-bfb1-41a912c075a6 | 4 | private void bookingActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_bookingActionPerformed
{//GEN-HEADEREND:event_bookingActionPerformed
try
{
new BookingGui().setVisible(true);
} catch (SQLServerException ex)
{
Logger.getLogger(MemberGui.clas... |
18421dbc-d560-46b4-ae5a-afed73d9af16 | 7 | String longestCompound(String input) {
input.replaceAll(",", "");
ArrayList <String> list = (ArrayList<String>) Arrays.asList(input.split("\\s+/"));
MyQueue queuer = new MyQueue();
for(String word : list) queuer.offer(word);
while (!queuer.isEmpty()) {
String start = queuer.poll(); ... |
34d37fc7-8d13-4b79-8519-d4f352cac1cc | 5 | public ServerOperator(Monopoly monopoly, Loader loader) {
this.monopoly = monopoly;
destination = new HashMap<Integer, ClientOperator>();
FieldCircularList go = monopoly.getGo();
FieldCircularList currentField = go;
do {
//adds eventlisteners to every purchasable field and performs actions if needed
if... |
15968c8b-0019-4ddd-8159-ee12d7d0eaa4 | 9 | public static void loadFrameDesigns (int levelNumber) {
URL url = LevelDesign.class.getResource("/levels/level" + levelNumber + "/description");
BufferedReader reader = null;
int framesNum = 0;
int heroX = 0;
int heroY = 0;
try {
reader = new BufferedReader(ne... |
c5aa7183-d4a6-4bab-82f2-910ed00aea21 | 5 | @Override
public void actionPerformed(ActionEvent e) {
PanPara panelParam = (PanPara) ((Component)e.getSource()).getParent();
int StepNumber = 15;
try {
StepNumber = Integer.valueOf(panelParam.getTfStepNumber().getText());
} catch (Exception exp) {
}
int S... |
5774a57a-9de3-4d52-8108-60579459662d | 2 | public void setShutdownFont(String font) {
if ((font == null) || font.equals("")) {
this.shutdownFont = UIFontInits.SHDBTN.getFont();
} else {
this.shutdownFont = font;
}
somethingChanged();
} |
f5e62a9a-ebca-4906-9167-643facd1a1fe | 6 | @Override
public int loop() {
while (!isStarted) {
sleep(500);
}
while (isStarted) {
if (Players.getLocal().isIdle()) {
status = "Waiting";
}
if (container != null) {
final Node job = container.state();
if (job != null) {
container.set(job);
getContainer().submit(job);
job... |
fedac7cc-ac20-459c-9b6c-55f3359d529d | 1 | public List<String[]> getAttributes() {
List <String[]> l = new ArrayList<String[]>();
String[] s = new String[2];
s = new String[2];
s[0] = "CAT2OSMSHAPEID"; s[1] = getShapeId();
l.add(s);
if (ttggss != null){
l.addAll(ttggssParser(ttggss));
}
return l;
} |
48a1a5e9-9023-49b8-8593-2fc4b47d1225 | 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... |
8b5b76aa-5426-45bd-9c91-994f7aadfb52 | 8 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking, tickID))
return false;
seeEnabled = false;
if(!(ticking instanceof MOB))
return true;
final MOB mob=(MOB)ticking;
if(!mob.isInCombat())
return true;
if((!CMLib.flags().canBeSeenBy(mob.getVictim(),mob))
&&(CMLi... |
0d097e00-c7b5-4efc-80ee-fb964fef2a01 | 5 | public VideoOutputFile(File file, int w, int h, int qualityDefinitionId, File dashMediaPresentationDescriptionFile, File dashAudioChannelFile, File dashVideoChannelFile, File hlsPlaylistFile, File hlsSegmentFile) {
this.id = file.getId();
this.w = w;
this.h = h;
this.qualityDefinitionId = qualityDefinitionI... |
ea0c023c-582f-4b73-974f-08a696fe402d | 8 | public static void main(String[] args)
{
// *****************************************************
// The following tasks will be executed in the GUI
Circuit circuit = new Circuit(4, 4);
circuit.addBattery(new Battery(6), 1, 0, 2, 0, 1, 0); // Extra two arguments set the positive en... |
7e8418e7-b8a1-467b-a7fc-5edff1517245 | 1 | private double exptGreaterThan(double b) {
double sum=0,interval=(bowSize*12-b)/1000,val=b;
for (int i = 0; i <1000; i++) {
sum+=phi(val, mu, sigma)*val*interval;
val+=interval;
}
return sum/(1-probLessThan(b));
} |
f01f63a4-c8b5-4942-96fb-151952d95cd7 | 0 | public String getAlgorythmType(){
return algorythmType;
} |
4e4a0e58-1976-4db7-a0d2-3c3e8202fe3f | 8 | public static List<Integer> getIdList(CompatConfig cfg, String path){
List<Integer> out = new LinkedList<Integer>();
List<String> ref = cfg.getStringList(path);
if (ref == null) return out;
for ( Object x : ref){
Integer id = null;
if ( x instanceof Number){
// just in case
id = ((Number) x).intVa... |
2d6d796c-4806-4c85-9a2a-fe0d657bf5e3 | 7 | @Override
public boolean equals(Object o) {
if (o == null || !(o instanceof Record))
return false;
Record that = (Record) o;
return this.user_id == that.user_id
&& this.username.equals(that.username)
&& this.keyboardLayout.equals(that.keyboardLayo... |
79501f2d-3c18-41b6-ba67-6b9defba7ec5 | 4 | @SuppressWarnings("static-access")
public void drawHexes(int center, int radius, Graphics2D g, int lineThickness, Color color) {
this.centerHex.setHexagon(new Hexagon(center, center, radius));
this.centerHex.getHexagon().setRadius(radius);
String text=""+this.centerHex.getHexNumber();
this.centerHex.getHexagon... |
4f583ec6-cfde-48e8-8ed7-c1d79d19346b | 6 | public void go(String input, String outputdir){
// set location of config file
String config = "d:/warcraft data/config.cfg";
// Create data structure
MatchData M = new MatchData(input);
// Read the config file
processConfig(readConfig(config));
// Declare variabl... |
0a0a81bc-3c6b-4f29-891f-e216d86d7b9a | 9 | public static long getLongLE(final byte[] array, final int index, final int size) {
switch (size) {
case 0:
return 0;
case 1:
return Bytes.getInt1(array, index);
case 2:
return Bytes.getInt2LE(array, index);
case 3:
return Bytes.getInt3LE(array, index);
case 4:
return Bytes.getInt4L... |
13b10142-15db-4591-8559-12c062ff7dc4 | 8 | private void expand1(byte[] src, byte[] dst) {
for(int i = 1, n = dst.length; i < n; i += 8) {
int val = src[1 + (i >> 3)] & 255;
switch(n - i) {
default:
dst[i + 7] = (byte)((val) & 1... |
d434efb1-8695-4f8e-8de4-a17db90d61b3 | 4 | @Override
public void init(GameContainer gc, StateBasedGame sbg)
throws SlickException {
land = new Image("resources/images/ToxicWasteland.png");
chicken1= new Image("resources/images/chickun1.png");
chicken2= new Image("resources/images/chickun2.png");
fire1= new Image("resources/images/fure.png");
fi... |
fc2212c7-623b-4a2b-9a51-477469e42682 | 1 | private void postOrderRec(Position<T> node) throws InvalidPositionException {
if (node != null) {
BTPosition<T> BTnode = checkPosition(node);
postOrderRec(BTnode.getLeft());
postOrderRec(BTnode.getRight());
System.out.print(node.element() + " ");
}
} |
1165465d-91be-4383-aace-a924b34f9084 | 9 | public void visitMethodDef(JCMethodDecl tree) {
try {
// when producing source output, omit anonymous constructors
if (tree.name == tree.name.table.names.init &&
enclClassName == null &&
sourceOutput) return;
println(); align();
... |
12671c04-9152-4884-9397-84f0ff76384c | 2 | @Override
public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
Contexto oContexto = (Contexto) request.getAttribute("contexto");
//Parte para saber el tipo de usuario
UsuarioBean oUsuarioBean;
oUsuarioBean = (UsuarioBean) request.getSessi... |
4de8e07b-0f3d-42d1-bd30-ce0cfff2745d | 0 | @Test
public void findHandFromCardSet_whenOnePairExists_returnsOnePairPlusHighestKicker() {
Hand hand = findHandFromCardSet(twoEightsPlusQueenTenSevenKicker());
assertEquals(HandRank.OnePair, hand.handRank);
assertEquals(Rank.Eight, hand.ranks.get(0));
assertEquals(Rank.Queen, hand.ranks.get(1));
assertEqual... |
6a5456e4-550c-43b4-9882-10893479796b | 1 | public Element toElement(Cinema cinema) {
Element element = new Element("cinema");
element.setAttribute("name", cinema.getName());
Iterator<CashOffice> cashOffices = cinema.cashOfficeIterator();
while (cashOffices.hasNext()) {
element.addContent(new CashOfficeTranslator().toElement(cashOffices.nex... |
79a8789b-1688-4599-b0ce-804133474171 | 5 | public void death() {
do {
removeIsDead();
for (int index = 0; index < animalFactory.getQuantityOfPredator(); index++) {
for (int i = 0; i < animalFactory.getQuantityOfVictims(); i++) {
if (animalFactory.getVictim(i).position.getX() == animalFactory.ge... |
d4231ce9-f3aa-4b02-a873-9f9ad1195052 | 0 | @Override
public List<String> getInheritence() {
return inheritence;
} |
02380566-d7e6-4af3-b4c7-e2ee5d93e28d | 5 | void render(float[][] dest, int nsamples) {
float[] inbuf = inst.aux1buf;
for (int i = 0; i < nsamples; i++) {
float in = inbuf[i] * gainin + fcdcoffset;
for (int ch = 0; ch < 2; ch++) {
float cur = 0.0f;
for (int j = 0; j < 4; j++) {
/*float dv = combd[ch][j].fetch();
float nv = gainc[j]... |
b49999c4-eb8c-44a8-83f8-b627983f91c3 | 7 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
try{
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/library_management", "root", "welcome6" );
... |
99a0ce1e-f420-4cbe-94dd-9465f5315327 | 8 | private boolean search(char[] s,char[] p, int i1,int i2)
{
if (i1 == s.length)
{
if (i2 == p.length) return true;
if (p[i2] == '*') return search(s,p,i1,i2+1);
return false;
}
if (i2 == p.length) return false;
if (s[i1] == p[i2] || p[i2] == '?') return search(s,p,i1+1,i2+1);
if (p[i2] ... |
ad0d72da-9dea-4a91-90a5-2aa6f158f3fc | 5 | private long toSeconds() {
switch (type) {
case SECONDS:
return value;
case MINUTES:
return value * 60;
case HOURS:
return value * 3600;
case DAYS:
return value * 24 * 3600;
case MILLISECO... |
613f6099-53e2-4c5b-a348-ac3736ef1ac8 | 8 | @org.junit.Test
public void testLoadDirScan()
throws ClassNotFoundException, java.io.IOException, java.net.URISyntaxException, NoSuchMethodException,
IllegalAccessException, java.lang.reflect.InvocationTargetException
{
boolean hackflag = DynLoader.CLDHACK;
DynLoader.setField(DynLoader.class, "CLDHACK", Bool... |
ef3e4b66-ff2e-4983-8227-33e4408e1cc5 | 1 | @Override
public void run() {
while (true) {
System.out.println("Consumer gets " + buffer.get());
}
} |
070c7250-cc15-4b3a-ade9-eaaec5b12ef9 | 3 | private boolean save_css_prefs(Preferences prefs)
{
assert(prefs != null);
//
// css file preferences
//
// First, remove any old css files from the preferences.
try
{
Preferences md_prefs = prefs.node(CSS_FILES_NODE);
md_prefs.removeNode();
md_pr... |
d99e5165-9711-41f5-af58-e2bf94b251c6 | 7 | void answer(String s, int n, String cur, List<String> res)
{
if(s.length()>n*3 || s.length()<n) return;
if(n==0)
{
res.add(cur);
}
for(int i=0;i<3&&i<s.length();i++)
{
String temp = s.substring(0,i+1);
if(validate(temp))
{
if(n<4) temp ="."+temp;
answer(s.substring(i+1), n-1, cur+temp,... |
ca260b66-4809-481f-ac8e-3a0ceea504c1 | 8 | public void sendTeamAndScheduleInfo() {
sendCommand("clearSched");
if(control.teams != null) {
for(Team t : control.teams.toArray()) {
sendCommand("addTeam=" + t.number + "," + t.name);
}
}
if(control.schedule != null) {
String setTablesCMD = "setTables=";
for(String name : control.schedule.tabl... |
2037595d-6455-431e-ba76-9fba2b493285 | 5 | private void checkDead(){
for(int row = 0; row < ROWS; row++){
for(int col = 0; col < COLS; col++){
if(board[row][col] == null) return;
if(checkSurroundingTiles(row, col, board[row][col])){
return;
}
}
}
dead = true;
if(score >= highScore) highScore = score;
setHighScore();
} |
1ebb083e-2e81-4cc3-97a8-fa6d7d1b0f35 | 5 | public PossibleConnection engageIgnoringParagraphs(int i) {
/* Inicijalizacija */
// Slucaj spoja
mostProbable12.setconnectionCase(12);
// Pretpostavimo da je to nemoguc spoj
mostProbable12.setProbability(0.0);
// Ocistimo listu elemenata koji bi se ovim spojem spojili
mostProbable12.getkeysInConnection... |
0051ba82-4f86-4c5c-a44c-497898c7bbba | 9 | public void draw(Graphics g) {
if (state == 0) {
g.setColor(Color.white);
} else if (state == 1) {
g.setColor(Color.red);
} else if (state == 2) {
g.setColor(Color.yellow);
}
//RESERVED FOR WINNING CIRCLES
else if (state == 3) {
... |
dffa4283-5931-425f-93d1-fa841a3d0b5a | 2 | private void term(){
factor();
while( is(TK.TIMES) || is(TK.DIVIDE) ) {
gcprint(tok.string);
scan();
factor();
}
} |
8ab78bc7-cef9-46a5-869c-d4dcab2dff88 | 6 | void table2(){
for (int j = 1; j <= 10; j++) {
for (int i = 0; i < higherRows.length; i++) {
int result = higherRows[i] * j;
String mainCell = higherRows[i] + " x " + j + " = " + result;
int spacesNumber = symbolsInCell - mainCell.length();
... |
252d073a-ee6b-43d0-8390-86f90d040750 | 1 | public static boolean phone(String phone){
if(phone.matches("(\\d){10}"))
return true;
return false;
} |
1e55552b-588c-4f55-a0f0-bcfa136d2117 | 0 | public String getMiddleName() {
return middleName.get();
} |
a34614f1-fe99-49b7-acbd-4f6911086a15 | 5 | public void addwarps(CommandSender cs, Command cmd, String string,
String[] args) {
Player player = (Player) cs;
if (player.hasPermission("warpsandports.user.add") || player.isOp()) {
if (args.length == 4) {
Player target = player.getServer().getPlayer(args[2]);
if (!(MainClass.warps.contains("Warps.... |
c9830ee2-7997-48a4-a637-b1fa470c744a | 7 | public VetVisit remove(VetVisit visitX)
{
boolean visitHasBeenRemoved = false;
int count = 0;
if(!this.contains(visitX) || this.visitCount == 0)
{
return null;
}
Node<VetVisit> previousNode = null;
Node<VetVisit> currentNode = t... |
223baea3-ca9a-42b2-9f8d-aecfc6021af8 | 1 | @Override
public int hashCode() {
int hash = 3;
hash = 31 * hash + (this.version != null ? this.version.hashCode() : 0);
return hash;
} |
5d5012a2-b439-4e8e-af11-3db021cb556e | 0 | public GregorianCalendar getUitleenDatum() {
return UitleenDatum;
} |
b08d46ac-d13e-4296-adce-8fef288a0544 | 0 | @Override
public Object getClock() {
return (Object) this.clock;
} |
88c17394-fe83-424a-aa01-30de84077493 | 4 | public static String stripLeadingSeparators (String path) {
if (path.length() == 0) {
return path;
}
if (path.charAt(0) != '/') {
return path;
}
int ii;
for (ii = 0; ii < path.length(); ii++) {
if (path.charAt(ii) != '/') {
... |
1cdd1a51-fbd7-409b-9eab-f4035a00db15 | 7 | private void rebuild() {
removeAll();
setLayout(new GridLayout(skills.size() + 1, 7));
add(new JLabel("Class Skill"));
add(new JLabel("Skill Name"));
add(new JLabel("Key Ability"));
add(new JLabel("Skill Modifier"));
add(new JLabel("Ability Modifier"));
ad... |
807c4795-ed79-4df6-bc57-9ee83e629bf5 | 9 | public String traversePostorder(){
String result="";
Deque<Node> stack=new ArrayDeque<Node>();
Node node;
Node prevNode=null;
stack.push(tree.getRootNode());
while(!stack.isEmpty()){
node=stack.peek();
if(prevNode==null||prevNode.leftNode==node||prevNode.rightNode==node){
if(node.leftNode... |
733aeb82-b8c8-4ade-bee2-f14e01e24bc9 | 4 | public void run() {
while (true) {
// get the prices every 2 minutes and update them
myStocks = DataReader.getStocks();
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date date = new Date();
System.out.println("Last updated stocks at "
+ dateFormat.format(date));
if (mySto... |
76159424-08ae-4207-aa2e-15c3e639afc1 | 0 | private Graph(final String name) {
this.name = name;
} |
6336d1e5-b4f6-4c27-b076-2f87a0549767 | 1 | public String multiply(String num1, String num2) {
int length2 = num2.length();
int length1 = num1.length();
String[] list = new String[length2+1];
int total = length1+ length2;
int i;
//pre
for( i=0; i < length2;i++ ){
list[i] = zero(length2 -i)+ num1... |
7d4cadd1-07b6-4f9f-8908-ea8f914e8a9f | 9 | protected void initSpecialParameters() throws MaltChainedException {
if (getConfiguration().getOptionValue("singlemalt", "null_value") != null && getConfiguration().getOptionValue("singlemalt", "null_value").toString().equalsIgnoreCase("none")) {
excludeNullValues = true;
} else {
excludeNullValues = false;
... |
40634423-9d3e-4752-b4b0-66a5d69bef0e | 7 | private void updateRemote() {
if (remoteKeys[KeyEvent.VK_R]) reset();
if (ai.getY() >= 2)
if (remoteKeys[KeyEvent.VK_UP] || remoteKeys[KeyEvent.VK_Q]) {
ai.move(false);
}
if (ai.getY() <= (height - 50))
if (remoteKeys[KeyEvent.VK_DOWN] || remo... |
2e359f66-4ad3-4042-81c0-9efc166a405c | 8 | public void calculateEnergyConsumption() {
int i = 1;
System.out.println("EVALUATING SYSTEMS\n");
for (SoftwareSystem system : systems) {// was:validsystem
System.out.println("\tSystem " + (i++) + "\n\t\t" + system);
int j = 0;
Calculator calculator = new Calculator(this);
for (FunctionalRequirement f... |
f582e1ba-f710-411c-8933-31c6de869b10 | 1 | public void addActions() {
Play.addActionListener(new ActionListener() { // Add an actionListener to the Play button
@SuppressWarnings("static-access")
public void actionPerformed(ActionEvent e) { // Turn the action into a variable to be used
// dispose of the Menu
dispose();
// Create a... |
46cf93e0-7c2b-4e6e-9b9e-18797e6ef054 | 7 | public void find(String type1, String type2) {
int key1 = Math.abs(type1.hashCode() % size);
int key2 = Math.abs(type2.hashCode() % size);
DictNode list1 = null;
DictNode list2 = null;
if (typeTable[key1].size == 1) {
list1 = typeTable[key1].head;
} e... |
27467ba8-adf9-461f-8c7a-4cec7214d013 | 5 | @SuppressWarnings("unused")
public void buildPanel() {
this.setBounds(250, 250, widthPanelLose, heightPanelLose);
this.setVisible(false);
this.setBackground(Color.BLACK);
JLabel label = new JLabel("La partie est terminée, vous êtes éliminé !");
this.add(label);
//Nouveau bouton Relancer une partie
... |
ce97fcd1-11eb-45f3-911e-92f1c6efa415 | 8 | private String transImm(String immediate, int immLength)
throws BadImmFormatError, ImmTooLargeError, UndefinedLabelError, LabelTooFarAwayError
{
String imm = new String(immediate);
if (imm.endsWith("h")) {
if (imm.startsWith("-")) {
imm = "-0x" + imm.substring(1, ... |
81044919-5bfd-4f68-a395-f9619860d696 | 4 | public static Collection<? extends Bean> scanForBeansFromFields(Class baseType) {
Set<Bean> ret = new HashSet<Bean>();
Field[] fields = baseType.getDeclaredFields();
for (Field field : fields) {
org.frameworkdi.poc.annotations.Bean bean = field.getAnnotation(org.frameworkdi.poc.anno... |
749307be-80d6-4d29-9c53-6c514eaae275 | 9 | private static void processOrderBy(final DB db, final DatabaseMap dbMap, final Criteria crit, final Query query)
throws TorqueException {
UniqueList orderByClause = query.getOrderByClause();
UniqueList selectClause = query.getSelectClause();
UniqueList orderBy = crit.getOrderByColumns();
if (order... |
b982a3ef-66c0-4d1b-be08-7d09be1fbfd1 | 8 | public void setKeysStructure(ArrayList<LangFileElement> enFileStructure) {
ArrayList<LangFileElement> elementsToRemove = new ArrayList<>();
for (LangFileElement lfe: fileStructure) {
if (lfe.getType() != LangFileElement.HEADER && lfe.getType() != LangFileElement.STATEMENT) {
... |
59440e8b-02cd-49d1-93f0-1e422e343e23 | 3 | public static HashMap<Integer, String> getJdbcTypeName() {
HashMap<Integer, String> out = new HashMap<>();
for (Field sqlField : java.sql.Types.class.getFields()) {
try {
out.put((Integer) sqlField.get(null), sqlField.getName());
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (... |
169469c6-8a49-479c-ae7f-1be0b758e301 | 9 | @Override
public void spring(MOB target)
{
if(target.location()!=null)
{
if((!invoker().mayIFight(target))
||(isLocalExempt(target))
||(invoker().getGroupMembers(new HashSet<MOB>()).contains(target))
||(target==invoker())
||(doesSaveVsTraps(target)))
target.location().show(target,null,null,CMMs... |
e145595e-f8fd-4a43-8388-d6a66796bc04 | 3 | public void writeData(int len, byte[] to_send)
{
//get_lock();
currline=""; //reset the receive buffer
for(int i = 0; i < currbuf.length; i++)
currbuf[i] = 0x00;
logText = "--> ["+ dump(len, to_send)+"]";
trytolog(logText);
//startreader();
this.expected_len = -1;
t... |
c62e77cf-62b4-45ce-b666-3c4daf56dc0b | 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... |
a0ab2b61-ae4a-4a37-bcbc-cb353dff2785 | 7 | public Resource(Element secondlevel) throws Exception{
/** Contains all resources defined in config file **/
resourcen = new HashMap<String, Object>();
// There must be at least one childnode (the path to arff files) in resource node
if(!(secondlevel.getEnd() instanceof Longend)) {
throw new Exception("No... |
d113f58c-ce94-4e34-9ac5-48eea5975a69 | 2 | @Override
public void Handle(byte[] message, Server server, IOClient player) {
if (player instanceof Browser) {
String full = "";
try {
full = new String(message, "US-ASCII");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
String url = full.split("\\ ")[1];
((Browser)play... |
a8f6f766-bbe8-4909-937e-660646ec3505 | 9 | public void parseInput(String str) {
str.trim();
//if (!str.equals("")) postOutput(str);
if (str.startsWith("/")) {
// parse as command
str.toLowerCase();
if (str.indexOf(" ") > 0) {
switch (str.substring(1, str.indexOf(" "))) {
case "say":
Packet03Speech pack = new Packet03Speech("SERVER", ... |
340311ff-ec10-4835-8a04-54d62577854c | 1 | public boolean isEnabled() {
if(Universe.CHOOSER == null) return true;
return false;
} |
2949d86b-8517-4835-b4e6-7199bd2594f7 | 2 | public static void Cluster(String[] args)
throws IOException, InterruptedException, ClassNotFoundException{
Configuration conf = new Configuration();
String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
if (otherArgs.length != 6){
System.err.prin... |
7ce88f91-8a92-468c-be37-6f2c69b72837 | 1 | public void addObservation(float[] bowl){
for (int i = 0; i < NUM_FRUIT_TYPES; i++){
occuranceHist[i][(int) bowl[i]] += 1;
}
} |
c5ec9085-4268-43d4-9057-fc066559e008 | 1 | public AutomobileSalon() {
for (int i = 0; i < 3; i++) {
this.RacecarI.add(RacecarFactory.createCar("RacecarI"));
this.RacecarII.add(RacecarFactory.createCar("RacecarII"));
this.TruckI.add(TruckFactory.createCar("TruckI"));
this.Automobile1eI.add(AutomobileFactory... |
10e14510-31c1-4a0b-880e-a9b3b23a0437 | 9 | public void loadLevel() {
BufferedReader br = null;
try {
br = new BufferedReader(Gdx.files.internal("levels/lvl" + Integer.toString(level)).reader());
String line;
while ((line = br.readLine()) != null) {
Gdx.app.log("Crate", line);
char key = line.charAt(0);
String[] strs;
switch (key) {
... |
a8ca821c-adaa-43aa-936b-3168921d6ce7 | 9 | private void statements(String returnLabel) throws ParsingException {
String value = getcurrentValue(), stringValue;
ExpressionSimplifier simplify = null;
String identifier;
switch(value) {
case Constants.PRINTF:
incrementTokens(Constants.LEFT_PAREN);
stringValue = matchNextToken();
print... |
f2a09e38-a579-45f9-af9d-8863ec26d63c | 5 | public void setText(String paramString)
{
if (this.StreakThread != null) {
this.StreakThread.politeStop();
}
if (this.BurnThread != null) {
this.BurnThread.politeStop();
}
if (this.HardHeight > 0)
{
this.ScrollTranslation = new Point(0, 0);
}
if (paramString == null... |
0112d58e-7a2b-41ed-b354-d3bc2d7644b9 | 7 | public void joinWait(Client c, int team) {
if (c.playerEquipment[c.playerHat] > 0 || c.playerEquipment[c.playerCape] > 0) {
c.sendMessage("You may not wear capes or helmets inside of castle wars.");
return;
}
if (team == 1) {
if (saradominWait.size() > zamorakWait.size()) {
c.sendMessage("This team i... |
618e1da9-c44f-4487-aeee-abaf079f1962 | 8 | private int getInsertionMarkerPosition(TreeContainerRow parent, int insertAt) {
int y = 0;
int dividerHeight = getRowDividerHeight();
if (mRoot != parent) {
for (TreeRow one : new TreeRowViewIterator(this, mRoot.getChildren())) {
y += getRowHeight(one) + dividerHeight;
if (one == parent) {
break;
... |
eb548057-84e2-4f9b-bc50-2844b9d2b825 | 8 | public static int[][] calcScoreMatrix(char[] st1, char[] st2) {
int[][] score = new int[st1.length+1][st2.length+1];
long[][] count = new long[st1.length+1][st2.length+1];
// расстояния между одной строкой и другой пустой
for (int i = 0; i <= st1.length; i++) {
score[i][0] = i;
count[i][0] = 1;
}
for ... |
0a1a7774-e409-4dca-baa2-8fa9452f0d4b | 5 | public void habilitarFunciones(int perfil){
String consulta="select per_id_perfil,per_id_modulo,per_id_tarea from permiso where per_id_perfil="+perfil;
r_con.Connection();
ResultSet rs=r_con.Consultar(consulta);
Vector<Vector<Integer>>modulosTarea=new Vector();... |
5bfa9a8a-ce58-4ae7-aba5-d79d86283eb3 | 3 | public static int indexOfCI(String context, int from, String toFind) {
int toFindIndex = 0;
char l = toFind.charAt(toFindIndex);// char to match now
l = Character.toLowerCase(l);
for (int i = from; i < context.length(); i++) {
char c = context.charAt(i);
c = Character.toLowerCase(c);
if (c != l) {
... |
86875faa-0434-47e6-aa57-7d4cb5933dae | 7 | public static int getStat(boolean player, int statNum, boolean crit) {
if (PokemonUtil.isGen1() && statNum == STAT_SPCDEF)
statNum = STAT_SPCATK;
if (!crit)
return Util.getMemoryWordBE((player ? curGb.pokemon.fightBattleMonStatsAddress : curGb.pokemon.fightEnemyMonStatsAddress) + 2*statNum);
else {
int a... |
31ad58eb-6c96-471c-b367-0986f7a6b787 | 8 | public static Integer fromShortStringToSeconds(String arg) throws Exception {
if (StringUtils.isBlank(arg)) {
throw new Exception("No walltime string provided.");
}
int ivalue = 0;
try {
ivalue = Integer.parseInt(arg);
} catch (final NumberFormatException ex) {
final Pattern date = Pattern
.comp... |
a604ee07-f356-4844-9f7a-e3742c6f2661 | 7 | void number(int i){
num[i]=low[i]=++count;
stack.push(i);
int j = f[i];
if(num[j]==0){
number(j);
low[i]=Math.min(low[i], low[j]);
} else if(stack.contains(f[i])){
low[i]=Math.min(low[i], num[j]);
}
if(num[i]==low[i]){
... |
35bbf911-53fa-44a3-acef-85b63e933713 | 6 | private void updateNode(Node updateNode, Node prevNode, Node nextNode)
{
if(updateNode.equals(client.getThisNode())) //Node to update is own node
{
if(prevNode != null)
{
client.setPrevNode(prevNode);
}
if(nextNode != null)
{
client.setNextNode(nextNode);
}
}
else
{
try
... |
43f42bf8-504b-4a3a-8ee6-e652c3b8ba2c | 2 | public static User LoginUser(String username, String password)
{
try
{
String query = String.format("SELECT * FROM APPUSERS WHERE USERNAME = '%s' AND PASSWORD ='%s'", username, password);
User loginUser = new User();
ResultSet rs = getQueryResults(query);
if (rs.next())
... |
b42ae6e2-5a78-42fe-b0e9-eaf6a9dc79d6 | 7 | public Block()
{
// Default state of a newly created block
state = 1;
blockType = -1;
shape = Shape.None;
// Generate random block
blockType = rn.nextInt(7) + 1;
shape = Shape.get(blockType);
// Set block based on shape type
// Blocks represented as int arrays
int[][] zShape = { {0, 0, 0, ... |
7406111c-0f2a-49f0-af2b-2c462a0d2d78 | 4 | @Override
public boolean isValid() {
Position destination = getDestination();
if(!inRange(start) || !inRange(destination))
return false;
if (field.getPiece(start)==null)
return false; //casella di partenza vuota
if (field.getPiece(destination)!=null)
return false; //casella di arrivo non vuota
ret... |
fa9552a7-b758-43fa-91b3-15a07230d191 | 7 | public static Class[] findClassesOfType(String packageNameToSearch,
Class<?> typeDesired) {
ArrayList<Class<?>> classesFound = new ArrayList<Class<?>>();
String[] classNames = findClassNames(packageNameToSearch);
for (String className : classNames) {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.