method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
3101a353-b910-4aae-bd63-d6244840e8e1 | 3 | @Override
public boolean onMouseUp(int mX, int mY, int button) {
Iterator<IGameScreen> it = screens.iterator();
while(it.hasNext()) {
IGameScreen screen = it.next();
if(screen.onMouseUp(mX, mY, button)) {
return true;
}
}
... |
8be4c048-3201-4aff-9480-c5f926f6f830 | 1 | private boolean firstKeyIsDownAndOtherKeyIsNot(char firstKey, char secondKey) {
boolean firstKeyIsDown = keyIsDown(firstKey);
boolean secondKeyIsDown = keyIsDown(secondKey);
return firstKeyIsDown && !secondKeyIsDown;
} |
34e8900f-e4ec-4223-90d1-8cd83a4ba509 | 3 | void pass() {
gameListener.onPass();
nextPlayer();
if (contract == null) {
cancelGame();
} else if (contract.coincheCount > 0) {
startGame();
} else if (currentPlayer == contract.author) {
startGame();
}
} |
b1fe0d14-d02c-4287-add1-9280ccfef202 | 9 | public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
if (args.length == 0) {
if (player == null) {
sender.sendMessage(ChatColor.RED+"This command can o... |
91123b2f-f822-45b2-bffd-09356a605b50 | 0 | public void setAutomaton(Automaton auto) {
this.automaton = auto;
} |
80ad1654-4927-4409-be52-49ee4304df2b | 1 | public void removeMouseListener(MouseListener l) {
if(l == null) {
return;
}
this.mouseListener = null;
} |
fe49f69f-371c-4c5e-b824-61e88eef7df8 | 0 | public Updater(int time) {
this.time = time;
} |
c041b4ce-daeb-4f30-9cd9-f3bc2d66da83 | 2 | public void add(Comparable c)
{
int i = size;
list.add(i, c);
while (i > 0 && compare(i, parent(i), list) > 0)
{
swap(i, parent(i), list);
i = parent(i);
}
size++;
} |
3407e267-abc2-4e45-a0f3-f3105066b942 | 0 | public String getManufacturer_part_id() {
return manufacturer_part_id;
} |
a68a8c05-0b0b-40dc-8a03-7372b51ebefe | 7 | @Override
public boolean equals(Object obj)
{
if (obj instanceof DataTag)
{
final DataTag tag = (DataTag) obj;
Map<?, ?>[] mapsA = getMaps();
Map<?, ?>[] mapsB = tag.getMaps();
for (int i = 0; i < mapsA.length; i++)
{
if (!mapsA[i].equals(mapsB[i])) return false;
}
return true;
}
retu... |
613a975a-9044-476a-b5af-7c2e7f4556d4 | 1 | public void add(String part) {
if (mParts != null) {
mParts.add(part);
}
} |
4d806651-1953-43ea-9d18-1a66f0e9ae0b | 4 | public static int xls2pdf(String srcPath, String destPath) {
File file = new File(srcPath);
if (file.exists()) {
ComThread.InitMTA();
ActiveXComponent excel = null;
try {
excel = new ActiveXComponent("Excel.Application");
excel.setProperty("Visible", new Variant(false));
Dispatch workbooks = ex... |
d80ea959-7538-4b93-ba52-01ad066ba9bc | 2 | public void playSongNow(String song, float duration, boolean playOnce) {
if(playList != null) {
EIError.debugMsg("playSongNow "+song);
GameSong gs = playList.get(currentSongIndex);
playList.add(currentSongIndex+1, new GameSong(MUSIC_PATH+song+MUSIC_EXTENTION, currentMaxGain, ... |
ef6fcac7-6049-4b48-a1ca-732bfaa7723b | 5 | private static int subsequentCoins(int[][] board, int x, int y, int dx, int dy, int playerID) {
int newX = x + dx;
int newY = y + dy;
if ((newX >= 0 && newX < board.length) && (newY >= 0 && newY < board[0].length) && board[newX][newY] == playerID) {
return 1 + subsequentCoins(board, ... |
a8c80f4a-c44a-4c5f-8447-4cc86d27ccc6 | 5 | public static Section construktSection(int y,ch.spacebase.mc.protocol.data.game.Chunk data){
if(data == null)return null;
Section section = new Section(y);
if(data.isEmpty())return section;
int x = 0;
y = 0;
int z = 0;
ByteArray3d blocks = data.getBlo... |
6d4806e6-747e-4803-9879-ae24525e4def | 7 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(affected!=null)
{
if((CMath.bset(affected.phyStats().disposition(),PhyStats.IS_FALLING))
&&((!(affected instanceof MOB))
||(((MOB)affected).fetchAbility(ID())==null)
||proficiencyCheck((MOB)affected,0,false)))
{
activated... |
0202fa11-cd6a-42c5-8815-2d3089c10c87 | 7 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if((affected!=null)
&&(affected instanceof MOB)
&&(msg.amISource((MOB)affected)||msg.amISource(((MOB)affected).amFollowing())||(msg.source()==invoker()))
&&(msg.sourceMinor()==CMMsg.TYP_QUIT))
{
... |
f0d174d4-9936-4e75-b13f-7c5abeab830d | 5 | public static void main(String[] args)
{
int x, y, a = 0, n = -1;
x = Integer.parseInt(JOptionPane.showInputDialog("Ingrese un Valor Entero para 'X':"));
y = Integer.parseInt(JOptionPane.showInputDialog("Ingrese un Valor Entero para 'Y':"));
if ((x > 0) && (y > 0))
{
... |
8bdc1850-8f88-44da-bf2f-593c1b7527e7 | 3 | public String correct(String word) {
Preconditions.checkNotNull(word);
if (word.length() < CORRECTION_TRESHOLD || isKnown(word)) return word;
String res = getCorrection(word);
return res == null ? word : Dictionary.unpluralize(res);
} |
4a974b92-4ddb-4506-a9c8-efbc78e46976 | 2 | public boolean isFree() {
if (Cooldown <= 0)
return true;
else {
Cooldown--;
Action = 0;
for (int i = 0; i < 8; i++) {
X[i] = positionX;
Y[i] = positionY;
}
Action = 0;
return false;
}
} |
579909ba-f823-4701-ac84-b100c31a5a28 | 6 | public static void main(String[] args)
{
if (args.length > 3 || (args.length > 0 && args[0].equalsIgnoreCase("-h")))
{
System.out.println(USAGE);
System.exit(1);
}
String bankName = null;
if (args.length > 0)
{
bankName = args[0];
}
else
... |
5fa5a871-2d04-4ea0-baa6-f32251262b84 | 4 | public static void main(String[] args) {
parseCommandLine(args);
initLogger(); // --> logger
try {
logger.info( String.format(
"Starting to download%n from <%s>%n into <%s> %s%n",
baseURL, saveTo, forceTagging?"with retagging existing files.":""));
cache = new XMLCache(xmlFileName);
if (isI... |
9f965823-c4d7-4fa4-84a9-eb31cabd4726 | 2 | private boolean collision(int xa, int ya) {
int xt;
int yt;
for (int c = 0; c < 4; c++) {
xt = ((x + xa) + c % 2 * 12 - 7) >> 4;
yt = ((y + ya) + c % 2 * 14 + 3) >> 4;
if (level.getTile(xt, yt).solid()) {
return true;
}
}
... |
2b6eb317-e4e5-4663-a8f3-21aeed5839e0 | 7 | public Dfa(Rule[] rules)
{
productionMap = new HashMap<Token, ArrayList<Production>>();
//Calculate all of the possible productions
for(int i = 0; i < rules.length; i++)
{
ArrayList<Production> productions = new ArrayList<Production>();
if(rules[i].getTokens() != null)
{
for(int pos = 0; pos <... |
6b03d422-1549-4ac0-9795-1123c4a20511 | 8 | private void LeftButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LeftButtonActionPerformed
if (FocusOwnerIndex == 1) {
if (NumberField1.getCaretPosition() <= 0) { // do nothing
} else {
NumberField1.setCaretPosition(NumberField1.getCaretPosition()... |
569100a7-14d7-4a1d-ad6e-738626c42303 | 9 | private void connectForest() {
List forest = new ArrayList();
Stack stack = new Stack();
NodeList tree;
graph.nodes.resetFlags();
for (int i = 0; i < graph.nodes.size(); i++) {
Node neighbor, n = graph.nodes.getNode(i);
if (n.flag)
continue;
tree = new NodeList();
stack.push(n);
while (!sta... |
da84bf98-31fe-4662-8170-df40256073f2 | 5 | public static float drawString( Graphics2D gr, String s, float left, float top, float right, float bottom, boolean startAtTop )
{
String[] lines = s.split( "\n" );
FontMetrics metrics = gr.getFontMetrics();
final float cushion = 4f;
float fontHeight = metrics.getHeight();
float totalHeight = (fontHeight + c... |
40cfc09b-b9a0-47bd-a9de-3cc70722f71d | 7 | static public String getBlockTypeString(byte blockType) {
switch(blockType) {
case BLOCKTYPE_STREAMINFO: return "BLOCKTYPE_STREAMINFO";
case BLOCKTYPE_PADDING: return "BLOCKTYPE_PADDING";
case BLOCKTYPE_APPLICATION: return "BLOCKTYPE_APPLICATION";
case BLOCKTYPE_S... |
4aac89a9-2743-4a1c-ab88-0bfb3613d2df | 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... |
7192bfaa-6b17-4111-8d86-5e05d125cc57 | 2 | public void keyPressed(KeyEvent event) {
// println("You pressed: " + event.getKeyCode() + ", " + event.getKeyChar());
if (event.getKeyCode() == KeyEvent.VK_ESCAPE) {
System.exit(0);
} else if (event.getKeyCode() == KeyEvent.VK_ENTER) {
lab.genNewLab();
render();
}
} |
b7248a97-5cb6-43db-a241-a2b2d687bbab | 6 | public keyTypeValues enumTypeValue(String value)
{
keyTypeValues enumVal = keyTypeValues.STRING;
if (value.equals("boolean"))
{
enumVal = keyTypeValues.BOOLEAN;
}
else if (value.equals("double"))
{
enumVal = keyTypeValues.DOUBLE;
}
else if (value.equals("float"))
{
enumVal = keyTypeValues... |
c6476c44-bac1-4f35-a5d0-7fe9f6b68cb8 | 4 | @Override
public boolean add(int prenodeid,Object item) {
conn = SQLconnect.getConnection();
if(item instanceof Worldnode)
{
Worldnode newitem = (Worldnode) item;
ResultSet res;
int newid = 0;
String sql = "INSERT INTO `worlds` (`name`, `creator`, `creattime`, `display`,`time_headnode`) VALUES ('%s',... |
602f86bc-c02b-4090-8a51-3bc94b9ce5dc | 9 | public static String getDomainOfServerName(String host) {
if (isIPAddr(host))
return null;
String[] names = StringUtils.split(host, '.');
int len = names.length;
if (len == 1)
return null;
if (len == 3) {
return makeup(names[len - 2], names[len... |
6019dce5-d276-457e-86e1-52ba55359194 | 9 | public void addToNavHistory(SymitarFile file, int line){
if(SuspendNavRecording || file == null) // Do not record navigation when this flag is set to true
return;
// Switched tab
if(currNavFile == null || !file.equals(currNavFile) && !file.equals(navHistory.get(currHistoryStep-1))){
// Truncate the navHis... |
63d60cb0-50f8-4f0f-83ad-6389ed90a10d | 0 | public void setName(String name)
{
this.name = name;
} |
3ec35254-ec61-42ce-b824-07ed45e28566 | 5 | public ArrayList<Weight> getWeight(){
int poundTotal = 0;
int gramTotal = 0;
int kgTotal = 0;
int ounceTotal = 0;
ArrayList<Weight> totalWeights = new ArrayList<Weight>();
for (Item it: this.dataStorage){
Weight currentWeight = it.getWeight();
//Individual cases
if (currentWeight... |
5f62f669-03d4-4112-a31b-2ae1ad1f6c2e | 2 | public T get(int index)
{
if(index < 0 || index > size())
throw new ArrayIndexOutOfBoundsException();
return item[index];
} |
737ca096-65c0-4fdc-8f2b-ec13e6bce6ad | 4 | private int PNToAscii(String recieved)
{
// split the recieved code into 2 parts
String[] recieveds = new String[] {
recieved.substring(0, 8),
recieved.substring(8, 16)
};
// decode each part and join them to get the result byte
StringBuffer decoded = new StringBuffer();
for (String recievedi : ... |
161042d4-959a-407e-8083-eff996eb904b | 3 | @Test
public void testSlashes() {
int minSlash = insetMap.getMinSlash();
int maxSlash = insetMap.getMaxSlash();
int numSlashes = insetMap.countSlashes();
Assert.assertEquals(maxSlash - minSlash + 1, numSlashes,
"Expected " + numSlashes + " slashes.");
... |
01aab584-45e5-42ac-83e8-f9c2bf3d862f | 3 | @Override
public double evaluate(int[][] board) {
int r = 0;
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[i].length; j++) {
if(board[i][j] != 0) {
r++;
}
}
}
return r;
} |
8a258a9f-2cac-4014-8e1d-7f7b1588fdee | 0 | public AttributeTableModel(AbstractAttributesPanel panel) {
super();
this.panel = panel;
} |
6b78d71f-3d27-42e4-8e9d-14c4f05f6029 | 9 | public static void main(String args[]) {
if (args.length == 1 && args[0].startsWith("-h")) {
System.err.println(USAGE);
System.exit(0);
}
if (args.length != 2) {
System.err.println(USAGE);
System.exit(1);
}
String connection = args[0];
String query = args[1];
... |
b9abde42-563e-4fa7-8c1b-4236bc09b686 | 1 | public InputStreamSource(InputStream in)
{
if (in==null)
throw new NullPointerException("in");
this.in = in;
} |
27e99880-3d25-4f4d-8d39-f92b61a0b062 | 7 | private ColumnMapping buildColumnMapping(Node column){
Element column_ele = (Element)column;
String src_name = column_ele.attributeValue("name");
if(StringUtils.isBlank(src_name)){
return null;
}
String tar_name = column_ele.attributeValue("tar-name");
if(Stri... |
a2a07181-5633-4c7e-8ef1-190d8e9bfc9d | 0 | public void start() {
thread = new Thread(this);
thread.setName("Capture");
thread.start();
} |
491fc723-9a9f-42ad-b80a-9a045fabe2a7 | 9 | @Override
public void update() {
if (temporary) {
killTime--;
if (killTime <= 0 && !hasDec) { // abt is never null if the tower is temporary
hasDec = true;
abt.dec();
}
}
if (!isReloading()) {
Mob closestMob;
if (mode == 1) // closest to tower
closestMob = mh.nearestMob(loc, ... |
2890788b-652a-4ecf-9032-82a38d74436c | 5 | @POST
@Path("/postXTMData")
public Response getMsg(
@DefaultValue("4292") @QueryParam("jobId") String jobId,
@DefaultValue("tcd") @QueryParam("username") String username,
@DefaultValue("cngl1234") @QueryParam("password") String password,
@DefaultValue("18") @Query... |
404c6a06-dccf-4ffb-94d1-4e8d4863cd21 | 1 | public MatchList()
{
// initialise number of array elements to zero
elementsInArray = 0;
// create array of matches, initialise each entry to null
matchArray = new Match[MAX_MATCHES];
for (int i = 0; i < MAX_MATCHES; i++)
matchArray[i] = null;
} |
6a420183-2dad-4c0c-8022-b41e63db5d8f | 1 | @Override
public void setConfig (XmlRpcClientConfig config) {
if (config instanceof SPIConfigImpl) {
SPIConfigImpl spiConfig = (SPIConfigImpl)config;
gameid = spiConfig.getGameId();
apiKey = spiConfig.getAPIKey();
}
super.setConfig(config);
} |
07199e8b-072c-468b-990e-a9335a3004cd | 9 | @Override
public P2PMessage parseP2PMessage(String command, InputBuffer buffer) throws ParsingException, IOException {
switch (command) {
case VersionMessage.COMMAND:
return new VersionMessage(buffer, this);
case VerackMessage.COMMAND:
return new VerackMessage(buffer, this);
case AddrMessage.COMMAND:
... |
dacc5992-67f3-4c65-9caa-bf6e484ac135 | 4 | public void copyPolygon(Vertex v)
{
if (v == null) return;
if (v.getClass() != Point.class) return;
Point p = (Point)v;
double xDiff = draggedToX - draggedFromX;
double yDiff = draggedToY - draggedFromY;
Point q = p;
Point prev = null;
Point begin ... |
b463047a-51b9-487d-9920-344a39991814 | 7 | public void removeStock() throws RemoteException, InterruptedException
{
Random rand = new Random();
boolean bought;
int numberOfItems;
int itemID;
int itemQuantity;
numberOfItems = getNumberOfItems();
while(true){
itemQuantity = rand.nextInt(20) + 1;
itemID = rand.nextInt(numberOfItems) + 1... |
8f3f4e54-7999-4f3b-85cf-2791193fab1c | 2 | private void initGlobal() {
boolean globalInitDone = false;
if (!globalInitDone) {
try {
ctx = SSLContext.getInstance("TLS");
} catch(NoSuchAlgorithmException e) {
throw new ErrorException(e.getMessage());
}
globalInitDone = true;
}
} |
81b3bc80-f6ac-4e46-bd14-17b57d98da07 | 2 | public void testIllegalDates() {
try {
new DateTime(1582, 10, 5, 0, 0, 0, 0, GJChronology.getInstance(DateTimeZone.UTC));
fail("Constructed illegal date");
} catch (IllegalArgumentException e) { /* good */ }
try {
new DateTime(1582, 10, 14, 0, 0, 0, 0, GJChro... |
ebc2d46d-7d6a-4b6e-905e-c153251d2e56 | 7 | public void move(int xa, int ya) {
if(xa != 0 && ya !=0){
move(xa,0);
move(0,ya);
}
if(xa > 0) dir = 1;
if(xa < 0) dir = 3;
if(ya > 0) dir = 0;
if(ya < 0) dir = 2;
if(!collision(xa, ya)) {
x += xa;
... |
afa473ac-62b4-4d0a-85ed-5c5de909d51b | 1 | protected void emit(Event event) throws Exception {
if(eventBus == null) {
throw new Exception("EventBus not set");
}
eventBus.broadcast(event);
} |
44c2efe1-2eca-4c0b-b2e9-a2b5b7104da7 | 4 | public static void main(String[] args) throws IOException
{
try
{
final int port = 6066;
ServerSocket serverSocket = new ServerSocket(port);
System.out.println("Waiting for users...");
while (true)
{
Socket clientSocket = serverSocket.accept();
//connectionList.add(clientSocket);
... |
332d1a9d-e06b-4329-a63f-a1bc72d871d8 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Vector3 other = (Vector3) obj;
if (Double.doubleToLongBits(x) != Double.doubleToLongBits(other.x)) {
return false;
}
if... |
2a18f237-4b90-492d-b159-a4febab87adc | 6 | @EventHandler
public void teleportationMutation(PlayerInteractEvent e) {
Collection<PotionEffect> effects = e.getPlayer().getActivePotionEffects();
for (PotionEffect pe : effects) {
if (pe.getType().equals(PotionEffectType.SLOW) && pe.getAmplifier() >= 3) {
float pitch = e.getPlayer().getLocation().getPitch... |
a29352be-8408-4cd6-8401-3ed93937f50d | 7 | public void equipWeapon() {
// Get all available weapons
String[] playerItems = player.getInventory().getWeaponTexts();
if (playerItems.length == 0) {
log.println("You have nothing to wield.");
} else {
JPanel panel = new JPanel();
panel.setLayout(new GridLayout(0, 1));
final JRadioButton[] radioBut... |
3a93e723-2e79-4873-9af5-83848fa6fb5e | 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... |
84feb9c1-b0e6-4591-a040-94db03573c68 | 9 | public static ArrayList<String> wordBreak(String s, Set<String> dict){
if(s == null || dict == null){
return new ArrayList<String>();
}
if(s.length() == 0 || dict.size() == 0){
return new ArrayList<String>();
}
ArrayList<String> res = new ArrayList<String... |
1fefc7b3-f855-44e1-b3fe-b324476244bb | 3 | private void tryPropose(int id) {
if (leader && !proposed[id] && !(proposal[id] == null)) {
logger.info("leader: "+self +" ... I propose");
proposed[id] = true;
trigger(new AcPropose(id, proposal[id]), ac);
}
} |
9172a022-cf1d-4711-bed0-fb30d1be0e31 | 2 | public Expression addOperand(Expression op) {
for (int i = subExpressions.length; i-- > 0;) {
int opcount = subExpressions[i].getFreeOperandCount();
if (opcount > 0) {
subExpressions[i] = subExpressions[i].addOperand(op);
operandcount += subExpressions[i].getFreeOperandCount()
- opcount;
updat... |
371f646b-debe-4e30-b1b2-f0bf82982b69 | 4 | public String readit(String pattern, String kill) throws InterruptedException, IOException {
cnt=0;
char lastChar = pattern.charAt(pattern.length() - 1);
StringBuffer buffer = new StringBuffer();
char ch = (char) dataIn.read();
while (runner==1) {
buffer.append(ch);
S... |
6f45334a-0c6a-4842-b563-4e5af19df9b4 | 8 | @Override
public void mousePressed(MouseEvent arg0) {
try {
UMLButton selected_button = ButtonFinder.getSelectedButton(tool_buttons);
if(selected_button != null && selected_button.class_or_assoc == null) {
if(selected_button.getText().equals("Delete")) {
deleteAt(arg0);
}
else
return;
... |
736bfc91-76fb-420e-8eb1-7a51f67cf17f | 8 | private JLabel[] buildMatchHeaders(int match, JPanel panel, boolean blankOut, JLabel[] clabels) {
Vector columns = cdata.getColumnData(match);
JLabel matchNum = new JLabel(matchStr);
Color foreground = Color.blue;
if (blankOut) {
foreground = matchNum.getBackground();
matchNum.setMaximumSize(new Dimensi... |
7eb60d4e-5a1d-40ad-886a-02958f7e44b9 | 9 | void run(){
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
set = new boolean[5][500];
u = new boolean[500];
ref = new HashMap<Integer, Integer>();
n = 0;
int[] rev = new int[500];
for(;;){
char ch = sc.next().charAt(0);
int k = sc.nextInt();
if(ch=='R')break;
while(k--!=... |
2a87fed8-c1a1-478f-b1c0-6a213b58e6e6 | 6 | private void prepareTabs() {
tabPanel.addSelectionHandler(new SelectionHandler<Integer>() {
@Override
public void onSelection(final SelectionEvent<Integer> event) {
int selection = event.getSelectedItem().intValue();
if (selection == 0) {
... |
2f62f5ce-d8ad-40d4-bd11-c632d2028853 | 1 | public void infix(Node node)
{
if (node != null)
{
infix(node.left);
System.out.print(" " + node.value);
infix(node.right);
}
} |
ec97f06d-28b1-4f64-9fd7-46feecd6d063 | 3 | public static int chroma(int color)
{
int red = (color & RED_MASK) >> 16;
int green = (color & GREEN_MASK) >> 8;
int blue = (color & BLUE_MASK);
int max = red;
int min = red;
List<Integer> d = Arrays.asList(red,green,blue);
for(int c : d) {
if(c ... |
48823122-af87-4c0b-9b34-0d3cd64efe07 | 0 | @Override
public String getNationality() {
return super.getNationality();
} |
3b21e427-af8d-4923-b1b2-19929e79afc7 | 3 | public static ArrayList<Double> getDoubleConfig(String path) {
System.out.println("main: try to get: " + path);
ArrayList<Double> out = new ArrayList<Double>();
BufferedReader in;
String zeile;
try {
in = new BufferedReader(new FileReader(path));
while ((zeile = in.readLine()) != null) {
try {
... |
0e427497-1fb1-40ee-8075-6cd29e4d8636 | 8 | public Connection build() throws Exception {
if (this.host == null || this.host.isEmpty()) {
throw new RuntimeException("ConnectionFactory 'host' is null or empty");
}
if (this.databaseName == null || this.databaseName.isEmpty()) {
throw new RuntimeExc... |
49a75bfa-461f-4ef3-83f3-b2e178266ad9 | 4 | public boolean equals(Object other) {
if ( (this == other ) ) return true;
if ( (other == null ) ) return false;
if ( !(other instanceof TickettypesperfestivalId) ) return false;
TickettypesperfestivalId castOther = ( TickettypesperfestivalId ) other;
return (this.getFestId()==castOther.... |
82a1ee7a-d98a-490b-ae19-51518392f51c | 8 | public static void main(String[] args) {
//---------------------------------------
// boucle FOR
//---------------------------------------
System.out.print("FOR Simple: ");
for (int kk = 0; kk < 15; kk++) {
System.out.printf("%d, ", kk);
}
//-------------------------------------------------
// boucl... |
786ca618-7db9-4767-9a08-0ce77a5e9fbc | 7 | private void readBoard(int file, String type) {
int[][] board = checkType(type);
String filename = "Board" + file + "-" + type + ".sb2";
Path path = Paths.get("Sudoku Saves\\" + filename);
int[][] flippedGrid = new int[9][9];
if (Files.notExists(path)) {
System.out.pr... |
65d382e4-4506-46d3-847c-f4228126707a | 6 | @Override
public String toString() {
StringBuilder sb = new StringBuilder();
// start line
String name = GetBlockNameLinetxt();
if(null!=name){
sb.append(name);
}else{
// please set block name
return null;
}
for(int i=0;i<myElements.size();i++){
String sbinComment = myElements.get(i).getC... |
62cf5af5-be33-40d0-8860-864a47bd35b7 | 7 | @Override
public void run() {
for(;;) {
// Se o socke esta fechado então terminar Thread.
if(socketCliente.isClosed()) return;
try {
solicitacao = (TipoSolicitacao) entrada.readObject();
switch(solicitacao) {
case LIST... |
3d21b5b6-3aff-4031-885d-2911a76988f1 | 3 | public void ratchetSlice(int position, int end) {
// race conditions here but don't expect any problems for most cases
MusicDetails musicDetails = currentMusicDetails;
if (musicDetails.track == null || !SLICES.containsKey(musicDetails.track)) {
return;
}
float sliceProgression = ((float) musicDetails.slice... |
e59feda3-8246-49f7-914f-5228bc2ac37b | 3 | public void checkwildy2()
{
if ((absY <= 10112 && absY >= 3970) || (absY <= 3514))
{
inwildy2 = true;
}
else
{
inwildy2 = true;
}
} |
7941d695-d2da-4a0c-a30b-d3c4a5f1e7ca | 0 | public SaveFileFormat getDefaultSaveFileFormat() {
return defaultSaveFileFormat;
} |
e2d6967b-6cf1-487d-84ee-f92d6d32937f | 4 | @Override
public final String toString() {
String ret;
if (this.title == null) {
ret = "<title>";
} else {
ret = this.title;
}
ret += " ";
if (this.duration == null) {
ret += "<time>";
} else {
ret += this.duration;
}
ret += " ";
if (this.n == null) {
ret += "?";
} else {
ret +=... |
9f021c70-2624-4f91-a5a8-4b018592e64a | 5 | public void update() {
move();
if (walking) animSprite.update();
else animSprite.setFrame(0);
if (ya < 0 ) {
animSprite = up;
dir = Direction.UP;
} else if (ya > 0) { // else is here so we can't select both up and down at one time
animSprite = down;
dir = Direction.DOWN;
}
if (xa < 0) ... |
2ad6c2c2-d160-490d-a4f3-5af1923487d5 | 4 | protected int getClosestIndex(int xp)
{
int xHld;
int xHld2;
//Back
xHld = getTextWidth(text.length());
if(xp > xHld)
return text.length();
//Front
xHld = getTextWidth(0);
if(xp < xHld)
return 0;
int cPos = 0;
xHld2 = xHld;
while(cPos<text.length()-1)
{
xHld = xHld2;
xHld2 = get... |
3106f5ba-3b85-43b1-8ff9-54967b7d3fb7 | 9 | public boolean inicioInfijaAPosfija() {
//ENTRADA DE DATOS
//System.out.println("*Escribe una expresión regular: ");
//Scanner leer = new Scanner(System.in);
crearAlfabeto();
String entrada = getNotacionInfija();
//Depurar la expresion algebraica
/*Un depurador perm... |
de415a00-258e-43ff-b0f6-693c5f3004e8 | 6 | public static List<Point> mergeLists(List<Point> loc, List<Point> val) throws CorrelationErrorException
{
long deltaLoc = loc.get(2).getTimestamp() - loc.get(1).getTimestamp();
long deltaVal = val.get(2).getTimestamp() - val.get(1).getTimestamp();
// On se cale sur la plus grande granularite de mesure
// Co... |
e2380f4c-9a8b-4632-85cf-149a60d14734 | 4 | public void update(){
if(isOpening){
double time = (double)Time.getTime() /(double)Time.SECOND;
if(time < openTime){
float lerpFactor = (float)((time - openingStartTime) / TIME_TO_OPEN);
getTransform().setTranslation(vectorLerp(closePosition, openPosition,... |
fad30877-af94-4d2e-a7f4-909fd09a273b | 0 | public FileFilter getFileFilter() {
return fileFilter;
} |
545429d3-2a23-4c21-aec6-75ce086ddec8 | 1 | public final ItemStack getItemStack() {
if (icon != null) return icon;
return icon;
} |
32ed6c23-6786-4ca2-b08e-329d43957f8d | 7 | private int calculateWords(String s){
int count=0;
if(s.charAt(0)!=' '){
count++;
}else if (s.charAt(0)==' ') {
return count;
}
for(int i=1;i<s.length();i++){
if((s.trim().charAt(i)==' ' && s.charAt(i+1)!=' ') || (s.trim().charAt(i)==',' && s.charAt(i+1)!=',')){
coun... |
ccd65e08-ed4a-4af5-9dc5-3e6785446a62 | 9 | private void setDefaultDirection(World par1World, int par2, int par3, int par4)
{
if (!par1World.isRemote)
{
int var5 = par1World.getBlockId(par2, par3, par4 - 1);
int var6 = par1World.getBlockId(par2, par3, par4 + 1);
int var7 = par1World.getBlockId(par2 - 1, par... |
a300d69f-8cf8-4b48-8208-bdbc79364f1c | 3 | public void writeIndicator (String indicator, boolean needWhitespace, boolean whitespace, boolean indentation)
throws IOException {
String data = null;
if (this.whitespace || !needWhitespace)
data = indicator;
else
data = " " + indicator;
this.whitespace = whitespace;
this.indentation = this.indentati... |
75aadb29-dce4-473b-b4f7-e592355392fd | 2 | public boolean isCheckmate(Player player) {
if (this.window.board.inCheck(player)) {
if (!this.isStalemate(player)) {
return true;
}
}
return false;
} |
dd393fe1-090e-4e4c-ad62-77ad622101bb | 8 | public void execute(String[] args) throws Exception
{
processArguments(args);
if (objectName == null)
throw new CommandException("Missing object name");
log.debug("attribute names: " + attributeNames);
MBeanServerConnection server = getMBeanServer();
if (attributeNames.size(... |
55359042-0aa6-4b29-9f5f-6033cf0931e0 | 4 | @Test
public void test() {
User user = (User) MongoHelper.fetch(myUser, "users");
if(user == null)
TestHelper.failed("user not found");
user.setFirstName("Evan");
if(!MongoHelper.save(user, "users"))
TestHelper.failed("first name update failed... |
58f9d446-ab0f-4abe-8a5e-4a2ed4ba3634 | 1 | public void renderContents(Graphics2D g)
{
for(UIContent content : Contents)
{
content.renderContent(g);
}
} |
37e0d490-6efc-4a8c-bf48-1bf580a3d35d | 1 | public void testGet_DateTimeField() {
DateTime test = new DateTime();
assertEquals(1, test.get(ISO_DEFAULT.era()));
assertEquals(20, test.get(ISO_DEFAULT.centuryOfEra()));
assertEquals(2, test.get(ISO_DEFAULT.yearOfCentury()));
assertEquals(2002, test.get(ISO_DEFAULT.yearOfEra())... |
b30e52d2-7315-47e8-aa3b-a1239b94e56b | 1 | private void ccbBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ccbBoxActionPerformed
System.out.println(evt.toString());
Color c = ccbBox.getSelectedColor();
if (c != null) {
System.out.println("non null color");
this.gmlLayer.setColorBox(c);
... |
d7e1d888-50df-484b-8b88-8e41976696bd | 2 | private ArrayList<Integer> setCandidates() {
ArrayList<Integer> allowables = new ArrayList<Integer>();
for (int i = 1; i <= SIZE; i++) {
if (isLegal(i)) allowables.add(i);
}
return allowables;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.