method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
8bc431f0-1087-4dee-a9e6-5c52f03eb913 | 8 | public static void main(String[] args) throws Exception {
SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
File schemaLocation = new File("schema/data/data-savedGame.xsd");
Schema schema = factory.newSchema(schemaLocation);
Validator saveGameValidat... |
81921ba1-d591-4bb4-a874-78d0141ce012 | 6 | public void createLife()
{
Random rand = new Random();
Animals tempA; Plants tempP;
//
if(ratioOfPredatorToAll==0)
{
for(int i=0;i<AmountAn;i++)
{//
tempA = new Animals(rand.nextDouble()*998, rand.nextDouble()*799);
if(tempA.species==1)
anP.add(tempA);
else
anH.add(tempA);... |
f36823aa-4650-476b-b161-d24a72d0ca8c | 6 | @Override
public void init(GameContainer gc, StateBasedGame arg1) throws SlickException {
//changing resolution
//AppGameContainer apgc = (AppGameContainer)gc;
//apgc.setDisplayMode(482, 600, false);
inGameMenu = new Image("res/inGameMenu.png");
Image [] movementWarrior = {new Image("res/warrior.png"),new... |
a93bbdb7-b463-4764-82de-368fa6821913 | 9 | private Object[] mergeSort(Object[] array)
{
if (array.length > 1)
{
int elementsInA1 = array.length/2;
int elementsInA2 = elementsInA1;
if((array.length % 2) == 1)
elementsInA2++;
... |
069e428e-90ae-4398-a25d-b4c2f0505eb1 | 6 | public void populateSkillMap() {
Connection connection = new DbConnection().getConnection();
ResultSet resultSet = null;
Statement statement = null;
try {
statement = connection.createStatement();
resultSet = statement.executeQuery(SELECT_ALL_SKILLS);
while (resultSet.next()) {
int skillId = resul... |
57c794b7-8012-4886-8c61-4c9e695fb6c7 | 5 | private void go()throws InterruptedException{
int i=1;
float dpercent = 0f;
String cc = c[0];
app.setEnabled(false);
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame fFrame = new JFrame("Please wait while updating.");
... |
5f598914-388f-4473-a4b1-8b4c79e70b28 | 3 | private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
if(null != jListExcluir.getSelectedValue()){
if(JOptionPane.showConfirmDialog(null, "Tem certeza que deseja excluir: "+jListExcluir.getSelectedValue()) == 0){
FachadaSistem... |
3e97545d-5116-43ec-bff4-b830ef1595ce | 8 | public static void discretizeNumericAttributesProcessClass(ArrayList<LearningObject> learningSet, ArrayList<Attribute> attributes){
for(int i=0; i<attributes.size();i++){
Attribute attr = attributes.get(i);
if(attr.type == Attribute.NUMERIC){
//apply discretization process
TreeMap<Inte... |
ba566347-3f03-427c-b62c-65d1aad10c03 | 9 | Space[] won() {
int n = numToWin - 1;
if (lastSpaceMoved == null)
return null;
int[] pos = lastSpaceMoved.getPos();
for (int i = 0, rowInd = pos[0]; i <= n; i++, rowInd = pos[0] - i)
for (int j = 0, colInd = pos[1]; j <= n; j++, colInd = pos[1] - j) {
boolean outOfBounds = rowInd < 0 || colInd < 0
... |
d82d7151-796d-4abb-9f55-eaa22d17f5c4 | 8 | @Override
public double calculateFractalWithoutPeriodicity(Complex pixel) {
iterations = 0;
Complex tempz = new Complex(pertur_val.getPixel(init_val.getPixel(pixel)));
Complex[] complex = new Complex[2];
complex[0] = tempz;//z
complex[1] = new Complex(pixel);//c
C... |
7d0b9ba4-c9cc-4cee-b87f-5bf7b3094b7e | 6 | public void connectGeneral(TreeLinkNode root){
LinkedList<TreeLinkNode> queue = new LinkedList<TreeLinkNode>();
if(root==null) return;
queue.offer(root);
while(!queue.isEmpty()){
int size = queue.size();
for(int i=0;i<size;i++){
TreeLinkNode curre... |
982e5704-1049-4d0c-9ff2-b0f07f41cbde | 8 | private static Icon getTexture(int textureType) {
Icon texture = null;
switch (textureType) {
case WINDOW_TEXTURE_TYPE: texture = windowTexture; break;
case BACKGROUND_TEXTURE_TYPE: texture = backgroundTexture; break;
case ALTER_BACKGROUND_TEXTURE_TYPE: texture = alte... |
c3d3d191-1c21-45f2-a035-7a248bf38597 | 1 | public GraphProblem(String fileName, int numNodes, int s_Index)
throws IOException {
totalNumNodes = numNodes;
startV = s_Index;
originalGraph = new HashMap<Integer, HashMap<Integer, Integer>>();
exploredNodes = new ArrayList<Integer>(totalNumNodes);
unexploredNodes = new ArrayList<Integer>(totalNumNodes);... |
bc2e8c42-90d0-4ad4-84b0-f0eefa234d16 | 8 | public static void main(String[] args) throws IOException{
formulas = new ArrayList<Vector<Object>>();
System.out.println("Welcome to Formulaic !");
boolean running = true;
br = new BufferedReader(new InputStreamReader(System.in));
String instruction = new String();
while(running){
instruction =... |
c23e7bbe-d0cf-4a4f-b635-3f7fc0ba6f61 | 2 | @Override
public Object transformMessage(MuleMessage muleMessage, String s) throws TransformerException {
try {
System.out.println(muleMessage.getPayloadAsString());
String payload = muleMessage.getPayloadAsString();
StringTokenizer tokenizer = new StringTokenizer(payl... |
523c07d9-77d6-4d0c-bba4-3acedf74d69b | 7 | final Class39_Sub2 method1069(byte byte0) {
if (anIntArray1881 == null) {
return null;
}
Class39_Sub2 aclass39_sub2[] = new Class39_Sub2[anIntArray1881.length];
for (int i = 0; ~i > ~anIntArray1881.length; i++) {
aclass39_sub2[i] = Class39_Sub2.method439(Traversal... |
2570e9a2-712b-4ffa-9838-3645e16a1361 | 7 | public static void main(String... args) throws IOException {
MyScanner sc = new MyScanner();
int n = sc.nextInt();
Group[] g = new Group[n];
for (int i = 0; i < n; i++) {
g[i] = new Group(sc.nextInt(), sc.nextInt(), i + 1);
}
Arrays.sort(g, (a, b) -> b.m - a.m... |
6adad8f4-cf00-4913-8b86-683e7aeac13c | 9 | @Test
public void test_DefaultConstructor() {
Grid g = new Grid();
// TEST FOR SIZE (SQUARE)
boolean ok = true;
if(g.getBoard().length != 5) {
ok = false;
}
int badSize =5;
int i = 0;
while(ok && (i<g.getBoard().length)) {
if(g.getBoard()[i].length != 5) {
badSize = g.getBoard()[i].length;
... |
357264f8-afbf-4b2c-8b15-55bb9bb6b5ba | 5 | public String toString(){
String text = "Consulta de " + getPaciente() + " as " + getData_inicio();
if(getData_fim() != null)
text += " ate " + getData_fim();
if(medicamentos != null){
int size = medicamentos.size();
if(size > 0){
if(size == 1){
text += " com o medicamento: " + medicamento... |
02242f29-f647-4474-af07-e8682f39d1ff | 2 | @Override
public void windowClosing(WindowEvent event) {
if (!hasOwnedWindowsShowing(this)) {
List<Saveable> saveables = new ArrayList<>();
collectSaveables(this, saveables);
if (SaveCommand.attemptSave(saveables)) {
dispose();
}
}
} |
dca8366c-d57b-45bb-9a90-b61f4cf1b61d | 3 | public static void printMap(){
//Makes HashMap Alphabetical
TreeMap<String, String> printMap= new TreeMap();
printMap.putAll(invertedIndex);
try {
PrintWriter writer = new PrintWriter("output.txt", "UTF-8");
// Used To Print Out map
Iterator it = printMap.keySet().iterator();
Object printS;
... |
91adbb3c-65ff-4485-984d-7438efb9abcc | 8 | @Override
public List<Map<String, ?>> lirtar_trabajor_Navidad(String mes) {
List<Map<String, ?>> Lista = new ArrayList<Map<String, ?>>();
try {
this.conn = FactoryConnectionDB.open(FactoryConnectionDB.ORACLE);
String sql = "SELECT * from RHVD_FILTRO_NAVIDAD ";
sql... |
0e29e98d-c329-4540-ac1b-5555c5b2eff1 | 7 | public void buildClassifier(Instances data) throws Exception {
// can classifier handle the data?
getCapabilities().testWithFail(data);
// remove instances with missing class
data = new Instances(data);
data.deleteWithMissingClass();
if (!(m_Classifier instanceof weka.classifiers.meta... |
56d1f2c0-e4db-471f-ad95-78f8daaf9e22 | 2 | public void changeCursor(char lettre) {
switch (lettre) {
case 'D':
this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
break;
case 'H':
this.setCursor(new Cursor(Cursor.HAND_CURSOR));
break;
}
}//fin de la m�thod... |
5c7fe2a4-4522-4b62-b059-98573a768e3e | 0 | @Override
public String getDesc() {
return "Default";
} |
ac15f351-6a20-416b-bb2f-6c532a4a6a19 | 2 | @Override
public boolean deleteSkin(Path skinPath) {
if (!FileUtil.control(skinPath)) {
IllegalArgumentException iae = new IllegalArgumentException("The skin is not existing!");
Main.handleUnhandableProblem(iae);
}
boolean ret = FileUtil.deleteFile(skinPath);
... |
0a0c26db-c551-4387-8f37-2c3630669adf | 9 | private void extractCircle(XMLEventReader xrd) throws XMLStreamException {
XMLEvent xev = xrd.nextTag();
if (xev.isStartElement() && xev.asStartElement().getName().getLocalPart().toLowerCase().contains("pos")) {
// skip attributes,comments and whitespace
do {
xev ... |
cbae0b7f-3885-408f-84c1-edbf84e96445 | 8 | public int compare(String o1, String o2)
{
String s1 = (String)o1;
String s2 = (String)o2;
int thisMarker = 0;
int thatMarker = 0;
int s1Length = s1.length();
int s2Length = s2.length();
while (thisMarker < s1Length && thatMarker < s2Length)
{
... |
fcd335a3-e86f-4117-977a-9271791c2e1e | 3 | @Override
public boolean onCommand(CommandSender sender, org.bukkit.command.Command cmd, String[] args) {
if (!Commands.isPlayer(sender)) return false;
//String arg2 = (args.length > 1 ? args[1] : null);
//String arg3 = (args.length > 2 ? args[2] : null);
Player p = (Player) sender;
ConfigurationSectio... |
743be63b-e83d-4b84-a08c-85d7748fe110 | 3 | private int[][] createPattern() {
int[][] squares = new int[NCELLS][NCELLS];
int n = RAND.nextInt(NCELLS);
if (RAND.nextBoolean()){ //make a column of ones
for (int i = 0; i < squares.length; i++) {
squares[i][n] = 1;
}
} else { //make a row of ones
for (int i = 0; i < squares.length; i++) {
... |
1d6d5ab9-05f4-4cf9-81d0-c5fc5bfe68fd | 1 | @Override
public void update(GameContainer container, StateBasedGame sbg, int delta) throws SlickException {
xpos = container.getInput().getMouseX();
ypos = container.getInput().getMouseY();
if(mousePress){
enterGameState(sbg);
}
} |
705ab23b-4395-4728-ae30-03ddb2eedd31 | 6 | * @return Proposition
*/
public static Proposition callDefproposition(Cons arguments) {
{ Cons definition = Cons.cons(Logic.SYM_LOGIC_DEFPROPOSITION, arguments.concatenate(Stella.NIL, Stella.NIL));
Symbol name = null;
Cons options = Stella.NIL;
Stella_Object conception = null;
Propositi... |
65ecf9f0-d639-4817-b47d-4c4a9d5b5eaa | 9 | public static final int typeIDObject(Object o) {
if (o instanceof java.lang.Boolean) return 0;
if (o instanceof java.lang.Byte) return 1;
if (o instanceof java.lang.Character) return 2;
if (o instanceof java.lang.Short) return 3;
if (o instanceof java.lang.Integer) return 4;
if (o instanceof jav... |
4a158d28-d82c-402c-bed9-5747d6b5760d | 2 | public void tick() {
if (isPressed) {
for (ButtonListener listener : listeners) {
System.out.println("Handling press");
listener.buttonPressed();
isPressed = false;
}
}
} |
d0191b1b-0102-46f0-ae24-efcf178f78e5 | 8 | public GameLayout(String locationsFile, String connectionsFile, String actionsFile) throws Exception, FileNotFoundException, IOException{
//Locations*************************************************************************************************
BufferedReader reader = new BufferedReader(new FileReader(locations... |
33fb9264-f8a9-4a49-b5a3-bd6b35ff44f6 | 6 | public static boolean decodeFileToFile( String infile, String outfile )
{
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try{
in = new Base64.InputStream(
new java.io.BufferedInputStream(
... |
ae627566-b07c-4f64-a039-6fd9501028d7 | 3 | public static boolean isEmpty(Board board){
boolean result = true;
for(List<Token> row : board.tokens()){
for(Token t : row){
if(t.isAvailable())result = false;
}
}
return result;
} |
81d29970-018d-435b-8adf-a3cbf553cf9d | 4 | public int calculateAttackValue() {
int actualAttackValue = attackValue;
if (Strength > 10) {
actualAttackValue += Strength - 10;
}
if (Agility > 10) {
actualAttackValue += Agility - 10;
}
if (Dexterity > 10) {
actualAttackValue += Dex... |
a3370be6-0a81-4677-bb32-92a864fb6362 | 4 | public List<Claim> getCounterClaimList(String oppositeFileName, String teamType) {
List<Claim> claimList = new ArrayList<Claim>();
Element claimE;
Claim claim = null, claimFlag = null;
ClaimDao parentClaim = new ClaimDao(oppositeFileName);
List<Claim> parentClaimList = parentClaim.getClaimAndSubclaimList(team... |
c58e47b7-d7c3-469f-a3ae-cb9908b7a0a1 | 8 | protected void updateStatsForClassifier(double [] predictedDistribution,
Instance instance)
throws Exception {
int actualClass = (int)instance.classValue();
if (!instance.classIsMissing()) {
updateMargins(predictedDistribution, actualClass, instance.weight());
// Determine the predicted c... |
25376f7b-9cbb-4a23-ae51-ef33247fc553 | 1 | public static void applyDamagePacks(Actor target, ArrayList<DamagePackage> packs) {
for (int c = 0; c < packs.size(); c++) {
DamagePackage pack = packs.get(c);
applyDamage(target, pack.damage, pack.type);
}
} |
6b181e21-141d-4e89-95bf-994eb7f88d52 | 7 | public void drawRespawnMenu(GL2 gl) {
this.gl = gl;
if(isRespawnOpen()) {
start2D();
if(selection == 0) {
respawnMenu = Texture.findOrCreateByName(FIGHTER);
if(respawnMenu != null) {
respawnMenu.bind(gl);
gl.... |
825762da-3b48-4e26-978d-afb532237f6e | 0 | public int getNumberPredators() {
return numberPredators;
} |
09776345-2d7b-4d35-b767-e5380962fce8 | 4 | public HealthPill() {
super((Math.random()*Board.getWIDTH()+1), (Math.random()*Board.getHEIGHT()+1), 0.0f);
switch(Board.getTheme()){
case "Desert": ii = new ImageIcon(this.getClass().getResource("/resources/images/scenarios/desertPill.png"));
br... |
1dcc7782-b0f4-4399-9cf5-3cd381221ecd | 5 | private void addHidden(int startIndex) {
// Find out what kind of pieces can move in this delta
int pieceType = ATTACK_ARRAY[move_to - startIndex + 128];
// If rook is one of types, call addSlider with the right delta and rook
// as piece type
// same if bishop is one of the types
switch (pieceType) {
ca... |
ab8fa669-33e1-42bf-8857-25700443b598 | 9 | public static void main(String[] args) throws IOException {
// Create a selector to multiplex listening sockets and connections
Selector selector = Selector.open();
// Create listening socket channel for PORT and register selector
ServerSocketChannel listnChannel = ServerSocketChannel.open();
listnChannel.so... |
4201953c-140e-42e7-9b60-8a9be8a77d0f | 6 | @Override
public void mutate() {
Population offspring = new Population();
for (int i = 0; i < population.getSize(); ++i){
double r;
synchronized (rng){
r = rng.nextDouble();
}
if (r < PROBABILITY){
HiffIndividual mutant ... |
772f35cf-5df5-4707-a526-cd44e0e61b5e | 9 | public static String keyBasedData(String addy, String[] keys) {
for (int i = 0; i < 10; i++) {// try 10 times to get html or else return
if (i > 0)
System.out.println("\nConnection Failure. Trying again: " + i);
String httpdata = getHtml(addy);
String yhdata = "";
String str = httpdata;
if (str.con... |
8c90eeb5-9b3f-4efe-9649-a84c152c0986 | 6 | private void addPosition(KrakenState state, ArrayList<KrakenMove> list,
XYLocation location, XYLocation kingLocation, XYLocation finalLocation) {
if (state.checkRange(finalLocation)){
if (state.distance(kingLocation, location, finalLocation)){
if (state.isEmpty(finalLocation))
list.add(new KrakenMov... |
0078fe9e-7182-4c79-88d1-c5eaae15424b | 6 | public void paintComponent(Graphics g){
super.paintComponent(g);
// fill bottom
g.setColor(new Color(238,238,238));
g.fillRect(0, 550, 1000, 150);
//draw state control
g.setColor(Color.black);
g.drawRect(350, 50, 300, 80);
g.setFont(... |
5347d241-cabe-4ccf-9ba0-68ed2eb1f963 | 5 | public static void main(String[] args) {
// TODO Auto-generated method stub
String id;
String pass;
String type = "student";
user_dao = DaoFactory.getInstance().getUserDAO();
while (true) {
System.out.print("Registration(r) / Login(l) / ChangePassword(c) / clearDb(clear) : ");
String mode = sc.nextLin... |
93f4fbf7-4f9a-4d95-9aa5-8ca1e7b7515f | 8 | static final void method1212(int i, int i_13_, int i_14_, int i_15_) {
anInt2059++;
i = ((Class348_Sub51) BitmapTable.aClass348_Sub51_3959)
.aClass239_Sub26_7260.method1838(-32350) * i >> -1161142392;
if (i_14_ == i_13_ && !EntityPacket.aBoolean1236)
Class104.method960(1);
else if (i_13_ != -1
&& (i_13_ !... |
7b1cae01-8a56-47e8-b203-9923487df8d7 | 4 | @Path("/database")
@GET
@Produces(MediaType.TEXT_HTML)
public String returnDatabaseStatus() throws Exception {
PreparedStatement query = null;
String myString = null;
String returnString = null;
Connection conn = null;
StringBuffer sb = new StringBuffer();
try {
conn = DB_Conn.getConnection();
//... |
72f513ae-3515-4582-b606-fab293780685 | 3 | private void loadOptions() {
try {
this.musicVolume = this.parseFloat(this.getProperty("music", "1.0"));
this.soundVolume = this.parseFloat(this.getProperty("sound", "1.0"));
this.mouseSensitivity = this.parseFloat(this.getProperty("mouseSensitivity", "0.5"));
thi... |
02289bfe-3904-47e1-bb77-4ff282804470 | 6 | private static synchronized Mixer mixer( boolean action, Mixer m )
{
if( action == SET )
{
if( m == null )
return myMixer;
MixerRanking mixerRanker = new MixerRanking();
try
{
mixerRanker.rank( m.getMixerInfo() );
... |
0cf23a06-3872-4929-b94b-d380c641dd81 | 6 | @Override
public void run() {
while(true){
synchronized (this) {
while(orderList.isEmpty()){
try {
wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
try {
obOut.writeObject(orderList.remove(0));
obOut.flush();
} catch (IOException e) {
e.... |
cb84e7f3-9eae-44c1-9d8e-cb094a02d3ba | 2 | public void paintComponent(Graphics graphics) {
try {
if (isMouseOver == false) {
graphics.drawImage(realVersion.image, 4, 4, (this.getWidth() - 6), (this.getHeight() - 6), this);
} else {
graphics.drawImage(scrapperVersion.image, 4, 4, (this.getWidth() - ... |
db03cc87-24cc-4c0d-acf4-e222a1fe4e3d | 8 | public int minimumTotal(List<List<Integer>> triangle) {
if(triangle==null || triangle.isEmpty()){
return 0;
}
int maxLength = triangle.get(triangle.size()-1).size();
int[][] f = new int[triangle.size()][maxLength];
f[0][0]=triangle.get(0).get(0);
for(int i=1; ... |
e889d59e-e1b5-473b-b6a8-891eb3fb43cb | 3 | public double getAngle()
{
if (leftNeighbour == null || rightNeighbour == null)
return -1024;
double leftAngle = getDirection(leftNeighbour);
double rightAngle = getDirection(rightNeighbour);
if (rightAngle < leftAngle) rightAngle += Math.PI * 2;
return rightAngle... |
72207fe3-f961-4ba4-a180-aea16124629b | 9 | private ByteMatcher createRandomByteMatcher() {
int matcherType = random.nextInt(9);
boolean inverted = random.nextBoolean();
switch (matcherType) {
case 0:
return AnyByteMatcher.ANY_BYTE_MATCHER;
case 1:
return OneByteMatcher.valueOf((byte... |
faa09ffa-7e69-4745-a24f-02f797c2077b | 0 | public void setCheckBox(JCheckBox checkbox) {
this.checkbox = checkbox;
} |
fa9f5c43-4fc0-4029-9312-28ab5e8334c2 | 0 | private synchronized int nextId() {
return ++next_id;
} |
8623b38b-a012-48e9-a3ad-67cfffdbd08c | 1 | public static <T> Set<T> hashSet(T... params) {
Set<T> result = new HashSet<T>();
for (T t : params) {
result.add(t);
}
return result;
} |
4ece8cb6-6134-4c0f-80a8-12f332e8b745 | 2 | @Override
public void update(Observable arg0, Object arg1) {
if (!(arg0 instanceof Timer)) return;
Timer timer = (Timer) arg0;
int s = timer.getTime();
if (s < 5) lblTime.setForeground(Color.red);
lblTime.setText(s + "");
validate();
repaint();
} |
c23914b8-ce93-4364-b467-26725f07ae53 | 3 | public RegularGrammar convertToRegularGrammar(Automaton automaton) {
/** check if automaton is fsa. */
if (!(automaton instanceof FiniteStateAutomaton)) {
System.err.println("ATTEMPTING TO CONVERT NON FSA TO "
+ "REGULAR GRAMMAR");
return null;
}
RegularGrammar grammar = new RegularGrammar();
/** ... |
684a59aa-82ca-487d-88cd-fa148f81ad21 | 7 | static private boolean jj_3R_9() {
Token xsp;
while (true) {
xsp = jj_scanpos;
if (jj_3R_23()) { jj_scanpos = xsp; break; }
}
if (jj_scan_token(ID)) return true;
if (jj_scan_token(LP)) return true;
if (jj_3R_21()) return true;
if (jj_scan_token(RP)) return true;
if (jj_3R_22(... |
780a244f-d097-45d4-9daf-4286e0407bff | 3 | public String toString() {
String input = ""+getBias();
for(Neuron key : dendrites.keySet()) {
if(key != this) {
if(dendrites.get(key) >= 0) input += "+";
input += dendrites.get(key) + "*" + key.toString();
}
}
return _function.toString(input);
} |
39dcb603-b910-4234-a909-b0f444b6c0e5 | 1 | public boolean type(char key, java.awt.event.KeyEvent ev) {
if(key == 27) {
clbk.result(false);
close();
}
return(super.type(key, ev));
} |
21ba3abe-2497-43aa-bc33-84ebed37ae81 | 4 | @Override
public void run() {
try {
while (true) {
@SuppressWarnings("resource")
Socket socket = mServerSocket.accept();
try {
Client client = new Client(this, socket);
client.setDaemon(true);
client.start();
synchronized (mClients) {
mClients.add(client);
}
} catch ... |
bb602479-9e5d-43e9-9673-735410fffe45 | 1 | @SuppressWarnings("unchecked")
public synchronized List<NodeOsm> getNodes(String key, List<Long> ids){
List<NodeOsm> nodes = new ArrayList<NodeOsm>();
for (Long l: ids)
nodes.add(((NodeOsm) getKeyFromValue((Map< String, Map <Object, Long>>) ((Object)totalNodes), key, l)));
nodes.remove(null);
return node... |
afe3ad36-5700-4d39-b77c-20969af32c8a | 0 | public int getSequenceID() {
return this.sequenceID;
} |
b683627b-93f3-4930-9c8f-a13452cbe9a7 | 9 | private boolean r_mark_suffix_with_optional_U_vowel() {
int v_1;
int v_2;
int v_3;
int v_4;
int v_5;
int v_6;
int v_7;
// (, line 159
// or, line 161
lab0: do {
... |
3eeded25-84a7-4c47-8aea-f89efb79957c | 2 | public User loadUser(String userid) {
File f = new File(users, userid + ".sav");
try {
ObjectInputStream in = new ObjectInputStream(new FileInputStream(f));
Object o = in.readObject();
if (o instanceof User) {
return ((User) o);
}
in.close();
} catch (Exception ex) {
ex.printStackTrace();
... |
08947542-0138-43e1-ab80-f5b647a02a8e | 9 | public static void main(String[] args) throws IOException {
if (args.length < 1) {
System.err.println("ERROR: Missing input file argument.");
System.exit(0);
}
// INPUT VARS
FileReader inputStream = null;
CharBuffer cbuf = CharBuffer.allocate(100000);
InputStream inputSentenceModel = null;
InputStr... |
c7d75566-0dea-4ae0-8ae3-e68ff7f9a827 | 8 | public void startMovingToTarget(float maxVelocity)
{
// LET ITS POSITIONG GET UPDATED
movingToTarget = true;
// CALCULATE THE ANGLE OF THE TRAJECTORY TO THE TARGET
float diffX = targetX - x;
float diffY = targetY - y;
float tanResult = diffY/diffX;
... |
49f29744-1468-41aa-82d8-eb81f40049b1 | 1 | public void setTexture(String texturePath){
try {
texture = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream(texturePath));
} catch (IOException e) {
e.printStackTrace();
}
} |
1e0b6ee4-8168-4b52-a740-e0bae97cc498 | 2 | public boolean isDone() {
int toDo = pToT.size() - alreadyDone.size();
String message = toDo == 0 ? "The conversion is finished!" : toDo
+ " more transition" + (toDo == 1 ? "" : "s")
+ " must be added.";
javax.swing.JOptionPane.showMessageDialog(parent, message);
return toDo == 0;
} |
a037c0e6-2bb5-4918-abc2-1dbd1a1686ce | 4 | public void usePotion(){
System.out.println("What type of potion would you like?");
System.out.println("Type 'mana potion' to use a mana potion");
System.out.println("Type 'health potion' to use a health potion");
String potionType = input.nextLine();
if(potionType.compareTo("mana potion") == 0){
if(this.g... |
b95bb931-0908-4196-925c-bf7999021f2f | 8 | public void readMsg() {
if (nUpdateRectsLeft == 0) {
int type = is.readU8();
switch (type) {
case MsgTypes.framebufferUpdate: readFramebufferUpdate(); break;
case MsgTypes.setColourMapEntries: readSetColourMapEntries(); break;
case MsgTypes.bell: readBell(); break;
... |
2923d4b2-73ee-4e30-8503-0f9e28ef5fbf | 0 | public double getLongitude() {
return longitude;
} |
606304ac-bfee-4a02-96cf-899e5fd38dff | 6 | public void execute() {
while(running){
try{
int idx = getProgramCounter();
String opcode = "0x" + Integer.toHexString(code.getOpcode(idx)).toUpperCase();
boolean imm = code.getImmediate(idx);
boolean ind = code.getIndirect(idx);
int arg = code.getArg(idx);
INSTRUCTION_MAP.get(opcode).execu... |
249874f5-6872-4a78-a1ce-feed910f0ac9 | 0 | public void setType(String type){
this.type = type;
} |
d2fc2803-3fb4-4974-ad08-6cb9830c9d01 | 5 | public void configure( JobConf job )
{
confJsonStr = job.get( "confJsonStr" );
if( confJsonStr == null )
{
LOG.warn( "confJsonStr is null" );
return;
}
LOG.debug( confJsonStr );
confMap = JSON.decode( confJsonStr );
try
{
if( confMap.containsKey( "rrd" ) )
{
Map rrdMap = ( Map )confMap.get( "rrd" );
if( rr... |
634de6e2-30a4-4a65-bb0c-4070c95dc022 | 1 | public int compareTo(Object o) {
if (o instanceof User) {
User other = (User) o;
return other._lowerNick.compareTo(_lowerNick);
}
return -1;
} |
4e041c2d-42a1-4b7f-8208-49ca844ea187 | 4 | public void friendsPortalEnter(Player player){
String invitedWorld = plugin.worldInvitation.get(player);
if (invitedWorld != null){
String worldN = plugin.getIfMainWorld(invitedWorld);
String invitingPlayerName;
if (worldN != null){
invitingPlayerName = invitedWorld.substring(worldN.length() + ... |
251671ef-0aa7-4af4-959b-4afede358b21 | 9 | public Board(BoardBuilder boardBuilder) {
width = boardBuilder.getWidth();
height = boardBuilder.getHeight();
cells = new Cell[getCellCount()];
cellsListView = Collections.unmodifiableList(Arrays.asList(cells));
int numberSum = 0;
final int maxNum = 0;
for (int x = 0; x < width; ++x) {
... |
5f2dbabd-168b-49f3-8aac-55dda5db510b | 5 | private final String getChunk(String s, int slength, int marker)
{
StringBuilder chunk = new StringBuilder();
char c = s.charAt(marker);
chunk.append(c);
marker++;
if (isDigit(c))
{
while (marker < slength)
{
c = s.charAt(marker... |
04dcd5de-b0cc-445f-8f78-a1c5f1b310d1 | 4 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
User other = (User) obj;
if (id != other.id)
return false;
return true;
} |
eabb690f-8625-4fa8-9adc-c873ccdebf81 | 5 | public static void main(String[] args) {
System.out.println(keyboard.length());
final GuitarString[] strings = new GuitarString[37];
for(int i = 0; i < strings.length; i++){
strings[i] = new GuitarString(440.0 * Math.pow(2.0, (i - 24.0) / 12.0));
// System.out.println(440.0 * Math.pow(2.0, (i - 24.0) / 12.... |
b741924e-640d-4643-8aeb-04aaf865e341 | 9 | public void run()
{
jTextArea.append("Starting Server Side Socket On Port 27331: ");
try{
sslserverSocket = (SSLServerSocket) javax.net.ssl.SSLServerSocketFactory.getDefault().createServerSocket(port);
//sslserverSocket.setEnabledCipherSuites(sslserverSocket.getEnabledCipherSuites());
} catch (IOException ... |
6fe83bd5-a0bf-43a1-8a9f-aaea7662cf43 | 4 | public boolean equals(Object other)
{
if(other == null) return false;
if(other == this) return true;
if(!(other instanceof Parameter)) return false;
Parameter otherParam = (Parameter) other;
return otherParam.key.equals(key) && otherParam.value.equals(value);
} |
2bd4c480-19fb-4c12-91a1-d4d1b8c08276 | 6 | public static void main(String[] args) throws IOException
{
logger = Logger.getLogger("MCListener");
logger.setUseParentHandlers(false);
Handler handler = new ConsoleHandler();
handler.setFormatter(new LogFormatter());
logger.addHandler(handler);
try
{
loadConfig();
}
catch(IOException e)
{
... |
8bb85755-75a2-483a-a929-2e765ee55e59 | 3 | public char readChar() throws java.io.IOException
{
if (inBuf > 0)
{
--inBuf;
if (++bufpos == bufsize)
bufpos = 0;
return buffer[bufpos];
}
if (++bufpos >= maxNextCharInd)
FillBuff();
char c = buffer[bufpos];
UpdateLineColumn(c);
return c;
} |
f7e4404f-7ccc-4641-8175-8f17ef00bde0 | 9 | @SuppressWarnings("static-access")
@Override
public void run(String[] args) {
Options options = new Options();
options.addOption(OptionBuilder
.withLongOpt("train")
.isRequired()
.withArgName("filename")
.hasArg()
.withDescription(
"Filename prefix with training dataset. It must "
... |
1cb69921-6206-416d-984b-6522f17f147d | 6 | public void test4() {
if (b)
;
else if (b || (new Integer(i)).toString().contains("Whatever")
&& new Double(d).compareTo(new Double(5.0)) > 55 || !(i >> 2 > 0)
&& (new String()) instanceof Object)
;
else
;
} |
0709b45c-e1ca-4417-a225-42d1aa624fed | 0 | public MessUndefined(int date, int id, int taille) {
super(date, id, taille);
} |
18e0034b-0c2b-4b48-a1c6-969d3489713a | 2 | private void handleUpdate() {
// We can simplify this when we move more methods into the Preference Interface.
if (pref instanceof PreferenceInt) {
PreferenceInt prefInt = (PreferenceInt) pref;
prefInt.setTmp(field.getText());
field.setText(String.valueOf(prefInt.tmp));
} else if (pref instanceof Prefere... |
28f4df24-6539-4834-a0b3-f5c4895a8e8e | 1 | private void resize(int capacity) {
Key[] temp = (Key[]) new Comparable[capacity];
for (int i = 0; i <= N; i++) {
temp[i] = pq[i];
}
this.pq = temp;
} |
8c77f92b-bc97-440f-bb99-1c441d7d2146 | 6 | public boolean isCellEditable(int row, int col) {
//Note that the data/cell address is constant,
//no matter where the cell appears onscreen.
if ((col > 0) && tableData[row][col]!=null && row < tableRows-1) {
return true;
}
else if(tableData[row][col] == null &... |
00fd5a33-e6ff-4e91-ad98-dd0a75033d2d | 4 | @Override
public void tick() {
ticks++;
x += r.nextInt(2);
y += r.nextInt(2);
if (x < -0 || y < 0 || x >= game.getScaledWidth() || y >= game.getScaledHeight()) {
x = r.nextInt(game.getScaledWidth());
y = 0;
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.