method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e676ea76-d2bf-4be3-a365-3fd8bac93212 | 9 | public boolean compareResult(TruthType with) {
if (with == TruthType.UNKNOWN)
return false;
switch(result) {
case UNKNOWN:
return false;
case TAUTOLOGY:
case SATISFIABLE:
case CONTRADICTION:
return (w... |
9d59122e-3b20-43b0-bfa7-784dcd2fe917 | 7 | public static void main(String[] args){
HandEval he = new HandEval();
PrintWriter output =null;
try {
output = new PrintWriter(new FileOutputStream("tmp.txt"));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
for(int i=0;i<13;i++){
for(int j=0;j<13;... |
16866b4f-7f7a-4ec2-9935-5b7ddf491bcb | 6 | private void cargarSetPrueba(){
DefaultTableModel temp = (DefaultTableModel) this.tablaSetPruebas.getModel();
String csvFile = "dataset/iris_prueba.csv";
BufferedReader br = null;
String line = "";
String cvsSplitBy = ",";
try {
br = new BufferedReader(new FileReader(csvFile));
while ((line ... |
108592d8-0016-4e60-83ee-6a1eccdb56ea | 3 | @EventHandler
public void onPlayerInteract(final PlayerInteractEvent event)
{
final Block block = event.getClickedBlock();
if (block != null)
{
final int blockType = block.getTypeId();
if (blockType == 63 || blockType == 68)
{
final signInteract signInteract = new signInteract();
signInte... |
d2839bad-3477-4979-9255-3aa1550b1a9b | 1 | @Override
public void paint(Graphics g) {
for (Line l : lines) {
l.paint(g);
}
} |
08e6555e-e61d-4a52-bd40-02b248a1f5a2 | 7 | private void checkForMissingChannels() {
for (int chan = 1; chan <= NumChannels; chan++) {
int found = 0; // number of the Groups that contain the channel
for (Group g : GroupList) {
if (g.hasChannel(chan)) {
found++;
}
}
switch (found) {
case 0: // channel is missing from all gro... |
f3141101-8b83-4351-b812-11e30bf8a8b8 | 9 | * @param length
* @param padchar
* @param align
* @param truncateP
* @return String
*/
public static String formatWithPadding(String input, int length, char padchar, Keyword align, boolean truncateP) {
{ int len = input.length();
if (len == length) {
return (input);
}
els... |
14d55a22-650e-4afe-8346-e3ec4cec68e7 | 3 | @Override
public boolean equals(Object arg0) {
if (arg0 != null && arg0 instanceof Angle) {
Angle other = (Angle)arg0;
return (this.angle <= other.angle+EQUALS_PRECISION
&& this.angle >= other.angle-EQUALS_PRECISION);
}
return false;
} |
b3720fdd-9435-4aee-a0c8-782f2983b21a | 8 | @Override
public boolean okMessage(Environmental host, CMMsg msg)
{
if(affected instanceof MOB)
{
if((msg.source()==affected)
&&(msg.targetMinor()==CMMsg.TYP_WEAR)
&&(msg.target() instanceof Light)
&&(msg.target() instanceof Container)
&&(CMath.bset(((Item)msg.target()).rawProperLocationBitmap(),We... |
fdbb0177-0dfa-454d-8a14-c0a6d5a01e68 | 0 | public Queue GetDistributionQueue()
{
return q;
} |
07522200-134a-4296-9b97-50abe384128a | 2 | public ArrayList<User> blockUntilHaveUsersHands() throws IOException,
InterruptedException {
// 30 second timeout
for (int timeout = 0; timeout < 300; timeout++) {
if (usersHands.size() == currentGameMembers.size()) {
// return
waitHandsSub.remove();
return usersHands;
}
Thread.sleep(100)... |
4e7eb164-65e4-46f1-bb45-5667ac7df999 | 1 | @Override
public Component getListCellRendererComponent(JList<?> list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
return addPrefixBasedIcon(c, (User)... |
9b5b2138-0641-4f2a-a455-89989a240627 | 6 | private Texture createTexture(String texturePath) {
Texture result = null;
try {
if (textureCache.containsKey(texturePath))
result = textureCache.get(texturePath);
else {
result = new Texture(texturePath);
textureCache.put(texturePath, result);
if (LOGGER.isDebugEnabled() && result != null)
... |
25107d0b-ba8e-49ed-8b4a-883f6082e1a6 | 2 | public boolean isApiHost(HttpHost host) {
return ("http".equals(host.getSchemeName()) ||
"https".equals(host.getSchemeName())) &&
resourceHost.getHostName().equals(host.getHostName());
} |
516b4671-fc10-4c8e-9796-4137d9743400 | 0 | @Override
public void componentShown(ComponentEvent e) {} |
84fe828b-2e66-4398-8a15-85f855e50aa5 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Login other = (Login) obj;
if (password == null) {
if (other.password != null)
return false;
} else if (!password.equals(other.password)... |
298697ce-4152-4e76-9b8f-1ae45e9b7b73 | 7 | public boolean mergeStuck() {
// run this way because of the boundaries
for(int i=0 ; i<size-1 ; i++){
for(int j=0 ; j<size-1 ; j++){
if(board2048[i][j] == board2048[i][j+1] || board2048[i][j] == board2048[i+1][j]){
return false;
}
}
}
for(int j=0 ; j < 3 ; j++){
if(board2048[3][j] == boar... |
1d7f1884-7fde-4690-84c3-41ca433511d3 | 7 | public int candy(int[] ratings) {
if(ratings == null || ratings.length == 0) return 0;
if(ratings.length == 1) return 1;
int L = ratings.length;
// int [] candies = new int [L];
// Arrays.fill(candies, 1);
int res = L;
for(int i = 1; i < L; ++i){
if(r... |
f8742b26-9fa7-472c-be8e-7408b090711e | 6 | public void mouseUp(MouseEvent e, int x, int y) {
Position to = GfxConstants.getPositionFromXY(x, y);
if (to.getRow() >= 0
&& to.getRow() < GameConstants.WORLDSIZE
&& to.getColumn() >= 0
&& to.getColumn() < GameConstants.WORLDSIZE) {
if (isDraggingUnit) {
dragTracker.mouseUp(e, x, y);
game.m... |
23309416-d67b-4918-a380-636f47059a8b | 4 | public void meta(MetaMessage event) {
if (event.getType() == END_OF_TRACK_MESSAGE) {
if (sequencer != null && sequencer.isOpen() && loop) {
sequencer.setTickPosition(0);
sequencer.start();
}
}
} |
f65b425f-2f77-4931-aa27-cd22119aab8e | 3 | public void searchContacts(String name){
String first, last, num, email;
for(Contacts aContact:contacts){
first = aContact.firstName;
last = aContact.lastName;
num = aContact.phoneNum;
email = aContact.email;
Pattern pattern = Pattern.compile("("+name+")+");
Matcher matchFirst = patt... |
930e9b57-9561-4d8a-a7d7-af330ca45214 | 4 | public static int indexOfStylename(String style, String stylename)
{
if (style != null && stylename != null)
{
String[] tokens = style.split(";");
int pos = 0;
for (int i = 0; i < tokens.length; i++)
{
if (tokens[i].equals(stylename))
{
return pos;
}
pos += tokens[i].length() + 1... |
8991ce66-6bcf-4bfd-935a-b8fdff6360d1 | 3 | public static void main(String[] args) throws Exception {
if (args.length != 2) {
System.err.println("Usage: java FifteenServer <serverhost> <serverport>");
System.exit(0);
}
DatagramSocket mailbox = null;
try {
String host = args[0];
int port = Integer.parseInt (args[1]);
mail... |
9ab16163-ecf1-4d00-9c65-3ab8a21566c8 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Volume other = (Volume) obj;
if (this.hoogte != other.hoogte) {
return false;
}
... |
62858edb-494b-45ec-8589-8136f717afae | 7 | private void displayInfo(ChunkyChunk chunkyChunk, Player player) {
Language.CHUNK_MENU_TITLE.normal(player, chunkyChunk.getCoord().toString());
ChunkyObject owner = chunkyChunk.getOwner();
if (owner != null)
Language.CHUNK_MENU_OWNER.normal(player, owner.getName());
else
... |
34a4ccb9-e156-4a45-a7ff-57d785dcda75 | 5 | private int getCandidateTranscripts(ArrayList<String> cur_trList) {
ArrayList<String> new_trList = new ArrayList<String>();
Collections.sort(cur_trList);
String cur_tr = cur_trList.get(0);
int cur_count = 0;
String tr;
for (int i = 1 ; i < cur_trList.size(); i++){
... |
6af5ec8a-c353-4ade-92ad-b24d036d7ee5 | 2 | private Attributes.Attribute getAttribute(Attributes attributes, UUID id) {
for (Attributes.Attribute attribute : attributes.values()) {
if (Objects.equal(attribute.getUUID(), id)) {
return attribute;
}
}
return null;
} |
032b3601-e59c-43c0-93c6-ffe94474d682 | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Faculty other = (Faculty) obj;
if (!Objects.equals(this.name, other.name)) {
return false;
... |
23ce21fb-3940-4bd4-bd09-ba2211d46d27 | 0 | public void setStringArray(String[] stringArray){
this.stringArray = stringArray;
} |
e72458eb-242d-49d5-96ac-b2efd0e9820e | 5 | private long removeRefServerInfo(long lIndex) {
//
// loop through the elements in the actual container, in order to find the one
// at lIndex. Once it is found, then loop through the reference list and remove
// the corresponding reference for that element.
//
ServerInfo refActualElement = GetServerInfo(lIndex)... |
02b464c0-1181-4c17-8e90-078e8e3de975 | 4 | public void setOAuthConsumer(String consumerKey, String consumerSecret) {
consumerKey = Configuration.getOAuthConsumerKey(consumerKey);
consumerSecret = Configuration.getOAuthConsumerSecret(consumerSecret);
if (null != consumerKey && null != consumerSecret
&& 0 != consumerKey.len... |
5469500a-4f56-422b-a15d-91ded9b70dc4 | 7 | @Override
public void paintComponent(Graphics g){
g.setColor(Color.BLACK);
g.fillRect(0, 0, this.getWidth(), this.getHeight());
//adds background image
if (offScreenImage == null) {
offScreenImage = createImage(imageList.getImageBase(0).getWidth(), imageList.getImageBase(0).getHeight());
background = of... |
40aee69a-9cfd-4937-85c2-4b71e0d7bd1a | 8 | public StandardHand(final Deck cards) {
this.cards = cards;
if (isStraightFlush(cards)) {
bestRank = StandardHand.Ranking.STRAIGHT_FLUSH;
} else if (isFourOfAKind(cards)) {
bestRank = StandardHand.Ranking.FOUR_OF_A_KIND;
} else if (isFullHouse(cards)) {
... |
a1d58b23-ab9f-415f-b8a4-0237bab41222 | 5 | protected static Ptg calcFind( Ptg[] operands )
{
String instring = "";
String wholestr = "";
int start = 0;
if( operands.length < 2 )
{
return new PtgErr( PtgErr.ERROR_VALUE );
}
if( operands.length == 3 )
{
start = operands[2].getIntVal() - 1;
}
Object o = operands[0].getValue();
Object o... |
ea2f9d1f-80cd-4996-902e-eeed1ad7c561 | 4 | public static StringBuffer getLdapValue(Attributes oAttrs, String proname)
throws Exception {
StringBuffer result = new StringBuffer();
Attribute attrpro = oAttrs.get(proname);
if (attrpro == null) {
result.append("");
return result;
}
NamingEn... |
9162d3f5-e90b-49a8-98bf-cccb243975d9 | 7 | public ArrayList<ArrayList<String>> partition(String s) {
ArrayList<ArrayList<String>> rst = new ArrayList<ArrayList<String>>();
if (s== null || s.length() == 0) return rst;
Boolean[][] f = new Boolean[s.length()][];
for (int i =0 ;i<s.length();i++)
{
f[i] = new Boole... |
3dc32472-05fa-4aed-babe-d0f8805a4541 | 9 | public void showTrainList(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
/* TODO output your page here. You may use following sample cod... |
60639764-3f01-44c5-861d-1cbc8fba89ea | 5 | public ETile getTileAt(int x, int y) {
if (mazeFilled) {
if ((x >= 0) && (x < width) && (y >= 0) && (y < height)) {
return maze[x][y];
} else {
return null;
}
} else {
System.out.println("MAZE: UNABLE TO PERFORM THE -getTile... |
cba13b53-e76b-47b3-b35a-351a53a4e974 | 9 | @SuppressWarnings({ "unchecked", "rawtypes" })
private void initialize() {
frmNewDownload = new JFrame();
frmNewDownload.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
GUI.numberOfDownloads -= 1;
}
});
frmNewDownload.setTitle("New Download");
frmNewD... |
11cc5af2-92fa-4188-969a-7c239e0c1586 | 2 | public void Flush() throws IOException
{
int size = _pos - _streamPos;
if (size == 0)
return;
_stream.write(_buffer, _streamPos, size);
if (_pos >= _windowSize)
_pos = 0;
_streamPos = _pos;
} |
e5aba7a7-5342-47b3-b4f0-442126122fae | 9 | int insertKeyRehash(int val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look un... |
0e9187e2-c306-4dc8-a13e-4caae63136d9 | 0 | public void cancel() {
canceled = true;
} |
3e152b3f-2680-4419-807b-e034fd0f3069 | 8 | @Override
public void step() {
ticksAlive++;
xvel = speed * Math.cos(angle);
yvel = -speed * Math.sin(angle);
if (isSeeking && ticksAlive < trackingTime)
seekTarget();
else if (ticksAlive == trackingTime) {
sprites = new String[]{sprites[0]};
... |
a5d468fa-5c2d-4103-aac1-a1e4d3cbbd26 | 3 | public void updateFrame() {
int currentFrame = 0;
for (int y = 0; y < this.img.getHeight(null); y += this.frameHeight) {
for (int x = 0; x < this.img.getWidth(null); x += this.frameWidth) {
if (currentFrame == this.frame) {
this.frameX = x;
this.frameY = y;
return;
} else {
currentFra... |
53accde2-a4ec-4ad2-8c05-79d44486021d | 1 | public void setLabel(String label) {
this.label = label;
// if (GRAPHICS == null) return;
bounds = METRICS.getStringBounds(getLabel(), GRAPHICS);
boolean upsideDown = end.x < start.x;
float dx = (float) bounds.getWidth() / 2.0f;
float dy = (curvy < 0.0f) ^ upsideDown ? METRICS.getAscent() : -METRICS
.ge... |
e1cd1c8d-9c4d-4753-ae5b-328192843c47 | 5 | @Override
public void buttonWasPressed(ButtonRow sourceRow, Button sourceButton, int buttonIndex) {
if (sourceRow == buyTowerButtons) {
if(((TowerButton)sourceButton).isActive){
selectedTowerIndex = buttonIndex;
TowerType tower = buyTowerButtons.getTowerOfButtonWithIndex(selectedTowerIndex);
for(HUD_I... |
af2dcb67-dc6a-4814-8ffe-0269b53da1dd | 9 | public static void handleChannelJoinEvent(ChannelJoinEvent event)
{
Bukkit.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled())
{
ChatChannel chatChannel = event.getChatChannel();
String chatChannelCreator = chatChannel.getCreator();
Player player = event.getPlayer();
String pl... |
5bf92e64-6dcb-4b73-aabc-548ecf8ba143 | 8 | public static void main(String[] args) {
if (args.length < 1) {
System.err.println("Please specify the location of the registry");
return;
}
long seed = System.currentTimeMillis();
Random generator = new Random(seed);
int r;
Scanner scan = new Scanner(System.in);
final ArrayList<Process> pcluster... |
ee25aa84-55ef-45dd-9575-19551695faa8 | 9 | private void checkDown(int x, int y) {
boolean test = false;
if (test || m_test)
System.out.println("ConnectFour::checkDown() - BEGIN");
Grid grid = getGrid();
Game.PlayerTurn Player = grid.getCoordinate(x, y).getValue();
if (Player != Game.PlayerTurn.NONE) {
if (y < GAME_HEIGHT - COUNT3) {
if ((gr... |
85dad2f3-3910-4b82-b5ee-573f3348643a | 6 | public static void main(String[] args) {
sc = new Scanner(System.in);
Double maior = 0.0;
Double menor = 0.0;
Integer homens = 0;
Integer mulheres = 0;
Double somaAlturaMulheres = 0.0;
for (int i = 1; i <= 50; i++) {
System.out.println("Entre com o sexo. F:femenino ou M:masculino: ");
String sexo ... |
638722db-15d5-4c98-bc00-fcbd6b8013ff | 4 | public void run(){
try{
while(true){
String command = in.readLine();
if(command.equals("exit")){
break;
}
//System.out.println(socket);
... |
9e84fd98-bc06-4ffa-af32-201545cb761f | 6 | public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null || !(obj instanceof Vertrag))
return false;
Vertrag other = (Vertrag)obj;
if(other.getVertragsnummer() != getVertragsnummer() ||
!Helper.compareObjects(this.getDatum(), other.getDatum()) ||
!Helper.compareObje... |
e2c9a566-29c4-4080-96e7-f6f3aee0e51b | 5 | @EventHandler
public void rainEvent(CheckRainEvent event) {
if (state != 2) {
return;
//we only want this to happen if it's raining
}
PotionEffect frostbite = new PotionEffect(PotionEffectType.POISON, 100, 1); //poison 1 for 5 seconds
try {
for (Iterator<Player> playerlist = world.getPlayers().iterato... |
0daa9c3a-33e6-4b53-b0af-3a52c95f73fb | 5 | @Override
public Knapsack executeOnce(Knapsack knapsack) {
int neighbours = generateRandomNumberOfNeighbours();
Knapsack best = null;
for (int i = 0; i < neighbours; i++) {
Knapsack candidate = generateNeighbour(knapsack);
if (!isInTabuList(candidate)) {
if (best == null) {
best = candidate... |
00cf0686-1a36-4582-93ac-4f251ae9bab5 | 4 | public void getTermPaperIDBigThan5() {
String sql = "select distinct term from terminvertedindex order by term asc";
String insert = "insert into term5index (term) values(?)";
ResultSet rs = sqLconnection.Query(sql);
try {
PreparedStatement statement = sqLconnection.conn
.prepareStatement(insert);
in... |
a31d1cf0-b9c1-4f1c-946c-28dd718f2288 | 3 | private void acao142(Token token) throws SemanticError{
if (idAtual instanceof IdentificadorMetodo){
idMetodoChamado = (IdentificadorMetodo) idAtual;
if(idMetodoChamado.getTipo() == null){
if(idMetodoChamado.getParametros().size() == 0){
//Geração de código para chamada de método
} else {
thro... |
ddb49776-b625-4cdc-9970-4cdc88cb9993 | 5 | private void countryTextFieldKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_countryTextFieldKeyTyped
countryLabel.setForeground(Color.black);
int strLength = countryTextField.getText().length();
char c = evt.getKeyChar();
if (strLength == 30 || !(Character.isAlphabetic(c) || c ... |
a58002c6-13c9-4f01-a574-02e70b6a4009 | 8 | @Override
public void run() {
GameConfiguration conf = WDStack.get(WDStack.size() - 1)
.configuration();
if (!running) {
running = true;
while (running) {
try {
if (pause) {
synchronized (this) {
wait();
}
}
world.step();
if (world.getDead().size() == conf.getAg... |
2c0633ca-dff1-4c4e-8682-aae500675310 | 4 | protected Map<String, List<Object>> findParallels(Object parent)
{
Map<String, List<Object>> lookup = new Hashtable<String, List<Object>>();
mxIGraphModel model = graph.getModel();
int childCount = model.getChildCount(parent);
for (int i = 0; i < childCount; i++)
{
Object child = model.getChildAt(parent,... |
b0d80c3d-d78c-4f80-96be-728f0fa9c147 | 7 | public void inputEndOfHand(ActionList history, GameState gameState) {
int handStrength = gameState.knownCards.evaluateOpponentHand();
if(handStrength != -1) {
updateHistogram(history, gameState.gameInfo, handStrength);
}
try {
int numI = actionData.numInstances();
if(numI >= 1 && (numI < 200 || (num... |
3e0c4f83-4bdc-4174-a05e-edef97d45775 | 9 | public boolean isValid(String s) {
List<Character> stack = new LinkedList<>();
for (int i = 0; i < s.length(); i ++) {
char c = s.charAt(i);
if (c == '(' || c == '{' || c == '[') {
stack.add(0, c);
} else if (c == ')' || c == '}' || c == ']') {
... |
7d4085ba-7006-4253-882b-55f6b40b2330 | 9 | public static void assertInducedRules() {
{ Cons command = Stella.NIL;
Symbol name = null;
List vars = null;
Cons types = Stella.NIL;
{ Cons rule = null;
Cons iter000 = Logic.$INDUCED_DECISION_RULES$.theConsList;
for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
... |
77f5a71f-f7c2-42a5-bfce-0067ab251a0a | 1 | @Override
public int getRoll() {
if (Historical.getInstance().isEmpty()) {
return getRandomInt();
}
return getLastRollMaxResult();
} |
7d307603-72dd-4cf8-8704-69fe63c826c2 | 2 | void Main_crawler (String[] args) throws IOException{
Validate.isTrue(args.length == 1, "usage: supply url to fetch");
String url = args[0];
//String url = "http://www.vimalkumarpatel.blogspot.com/";
print("Checking for saved versions of the url:");
URL l... |
746b2f5c-4018-4195-b605-41dd68cf1ce6 | 8 | public static boolean intersect(BoundingBox a, BoundingBox b)
{
if(pointIn(a, b.p1) || pointIn(a, b.p2) || pointIn(a, b.p3) || pointIn(a, b.p4))
{
return true;
}
if(pointIn(b, a.p1) || pointIn(b, a.p2) || pointIn(b, a.p3) || pointIn(b, a.p4))
{
return true;
}
return false;
} |
62297588-0984-4bd5-a4ac-aa110991f07f | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Tile other = (Tile) obj;
if (door != other.door)
return false;
if (id != other.id)
return false;
if (sign != other.sign)
return fals... |
227d92ff-5f3f-4433-a01b-a1f6e741d5ac | 0 | public int compareTo(Item other)
{
return partNumber - other.partNumber;
} |
00a0370c-3dcb-4f86-9b27-3531339fcc73 | 9 | public static void cleanseTranslations(List<Homonym> homonyms) {
List<Integer> linesToRemove = new ArrayList<>();
//combine split lines
for (Homonym tr: homonyms) {
for (int i = tr.getWords().get(0).getMeanings().size() - 1; i >= 0; i--) {
Meaning se = tr.getWords()... |
95522c43-533f-4de8-b7c4-e45dae863210 | 6 | private boolean move(int row, int col, int horizontalDirection, int verticalDirection, Direction dir){
boolean canMove = false;
Tile current = board[row][col];
if(current == null) return false;
boolean move = true;
int newCol = col;
int newRow = row;
while(move){
newCol += horizontalDirection;
ne... |
34a91ab2-d034-490d-8235-1b515c4b1b71 | 8 | public static ArrayList<Entity> generateLevelEntities(Global global, Image gridTex){
System.out.println("Generating Level Entities");
ArrayList<Entity> ents = new ArrayList<Entity>();
//Each Block
for (int y = 0; y < 660; y += 30){
for (int x = 0; x < 990; x += 30){
... |
4143b4dd-c0e8-4d5c-896a-7e5a3996fd6a | 7 | public static Options getOptions(Object pojo) throws CLIOptionBindingException
{
Options options = new Options();
try{
Class<? extends Object> clazz = pojo.getClass();
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
if (field.isAnnotationPresent(CLIOptionBinding.class))
... |
2de14c47-a3dd-4471-8d0e-829eea42943b | 7 | public final boolean isBadOpponent(Opponent opponent) {
for (int i = 0; i < lowMoney.length; i++) {
if (lowMoneyPointer == i && lowMoney[i] == null) {
break;
}
if (lowMoney[i].equals(opponent)) {
return true;
}
}
for (Opponent o : bad) {
if (o != null && o.equals(opponent)) {
return t... |
94ea4520-b12d-463a-9c3a-d82ff9e2d3ca | 3 | public static void main(String[] args) {
try {
JsonFactory jfactory = new JsonFactory();
/*** write to file ***/
JsonGenerator jGenerator = jfactory.createJsonGenerator(new File(
"D:\\Java SE\\src\\json\\jackson_streaming_api_to_read_and_write_json\\fil... |
b87219c4-b97d-4af1-a755-4e770ac7a39e | 5 | public double getTotalCapacitance(){
if(!this.surfaceAreaSet){
System.out.println("Class: GouyChapmanStern\nMethod: getTotalCapacitance\nThe surface area has not bee included");
System.out.println("A value per square metre has been returned");
return this.diffCap;
}
... |
8accac4f-5920-4b47-85c2-6e9367c36e0a | 3 | public final void handleException(final ExceptionHandle handle,
final Exception exception) {
if (!handle.suppress()) {
if (!this.closed) {
exception.printStackTrace();
this.gui.printErrorMessage(exception.toString().replaceAll(
": ", "\n"));
}
if (handle.terminate()) {
close();
}
}
... |
15e1aec0-ed05-4591-bb77-1aa8a0d8237c | 4 | private List<IntPoint> parsePoints(String strPointList) throws JTMXParseException {
List<IntPoint> points = new ArrayList<IntPoint>();
String[] strPoints = strPointList.split(" ");
boolean error = false;
for (String v : strPoints) {
String[] pointCoords = v.split(",");
//System.out.println("Points = {"... |
b13131e3-3fdd-402c-8c4c-413a781e1e19 | 1 | private void drawBox(Graphics2D g, String string, Point2D point) {
if (string.equals(""))
return;
Rectangle2D rect = g.getFontMetrics().getStringBounds(string, g);
double x = point.getX() - rect.getWidth() / 2.0;
double y = point.getY() - rect.getY() - rect.getHeight() / 2.0;
g.fillRect((int) x - 2, (int... |
463be253-121b-4a8e-8395-2295f92f98e1 | 4 | public int MoveInternalMemoryPacket(int inputBufferNumber, int TIME)
{
//ONLY ONE BUS PRESENT IN THIS FABRIC
//if Active status was successful and the flag is true for having
//control of the bus
//set packet moved default
packetMoved = false;
//get the Rou... |
9dee7260-e6ce-4f80-bb14-ff366c8a89fb | 1 | public void setCatchBlock(StructuredBlock catchBlock) {
this.catchBlock = catchBlock;
catchBlock.outer = this;
catchBlock.setFlowBlock(flowBlock);
if (exceptionLocal == null)
combineLocal();
} |
8050735c-1be6-481f-afef-1beb814dd26c | 2 | public int getXMLTileNum(String xml){
String[] lines = xml.split("\n");
int numLines = 0;
for(int i = 0; i < lines.length; i++){
System.out.println("lines[i].length(): " + lines[i].replace(" ", "").replace("\t", "").length());
if(lines[i].replace(" ", "").replace("\t", "").length() > 10) numLines++;
}
... |
5164bfd2-4a52-449c-99ca-eb385f0934f4 | 4 | public static long kadane(long[] comp) {
long sum = 0, max = 0;
int startRow = 0;
for (int i = 0; i < m.length; i++) {
sum += comp[i];
if (sum != 0) {
sum = 0;
startRow = i + 1;
} else if (max < i - startRow + 1)
max = i - startRow + 1;
max = Math.max(max, comp[i] == 0 ? 1 : 0);
}
retu... |
f15ef4a9-0ee6-4f2d-bb5a-10bdbf6088fa | 3 | static void nesttry(int a) {
try { // nested try block
/* If one command line arg is used,
then an divide-by-zero exception
will be generated by the following code. */
if(a==1) a = a/(a-a); // division by zero
/* If two command line args are used
then generate an out-of-bounds exception. *... |
fdc99ea0-e4eb-42c3-ae22-fbd53c3dff25 | 8 | private String stringMe(int xValue) {
int zahl = xValue;
switch (zahl) {
case 1:
return "a";
case 2:
return "b";
case 3:
return "c";
case 4:
return "d";
case 5:
return "e";
case 6:
return "f";
case 7:
return "g";
case 8:
return "h";
default:
return null;
}
} |
bf4f714e-3f06-4360-b3ab-eb4c7e4b2772 | 4 | public void setExp(List<?> list)
{
for(PExp e : this._exp_)
{
e.parent(null);
}
this._exp_.clear();
for(Object obj_e : list)
{
PExp e = (PExp) obj_e;
if(e.parent() != null)
{
e.parent().removeChild(e);
... |
78ead148-a12a-4acd-a657-4ee6191caa24 | 7 | private static String getTextForValue ( BencodeTreeModel model, BencodeTreeNode node ) {
Value<?> value = node.getValue();
String prefix =
"<html><b>" + ( node.getParent() == null ? "(Root)" : "[" + node.getIndex() + "]" ) + "</b> => ";
if ( value instanceof IntegerValue ) {
return prefix + "Int: " + ( (... |
3c837084-8980-41e2-a55a-52b95497b076 | 7 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
if((activated)
&&(msg.targetMinor()==CMMsg.TYP_WEAPONATTACK)
&&(CMLib.dice().rollPercentage()<10)
&&(affected instanceof MOB)
&&(msg.amISource((MOB)affected))
&&((!(msg.tool() instanceof Weapon))||(((Weapon)msg.tool()).weaponC... |
c724e1e8-b0f1-41e9-a801-2016842869dc | 6 | protected int contest(int b, int g, int r) {
/* finds closest neuron (min dist) and updates freq */
/* finds best neuron (min dist-bias) and returns position */
/* for frequently chosen neurons, freq[i] is high and bias[i] is negative */
/* bias[i] = gamma*((1/netsize)-f... |
4363c0fc-78e2-49ef-81e0-2ad8c3ddc52f | 8 | private void checkCoordinateBounds(Location moveFromLocation, Location moveToLocation) throws StrategyException
{
//if the from coordinate is out of bounds, the move is invalid
if (moveFromLocation.getCoordinate(Coordinate.X_COORDINATE) >= boardWidth
|| moveFromLocation.getCoordinate(Coordinate.X_COORDINATE) <... |
2a32e4ed-4ebe-466b-9ce3-6568569019a6 | 8 | public boolean healing() {
if (healTimer == 0 && healing[0] == 1 && playerEquipment[playerWeapon] >= 0) {
OriginalShield = playerEquipment[playerShield];
OriginalWeapon = playerEquipment[playerWeapon];
playerEquipment[playerShield] = -1;
playerEquipment[playerWeapon] = -1;
//setAnimation(0x33D);
... |
5b2fac5f-2aa3-46cd-a768-988dafc80022 | 9 | public void mouseReleased(MouseEvent e) {
if (!playerTurn)
return;
int x = e.getX();
int y = e.getY();
if (x < NimGamePanel.this.getWidth() && x >= 0 &&
y < NimGamePanel.this.getHeight() && y >= 0) {
y = NimGamePanel.this.getHeight() - y;
// calculates the i in the array
int i = x / 50... |
efde8513-2ca5-4180-8c4e-997e9b1b7adb | 7 | public static boolean existeCodigo(String codigo) {
Connection conn = null;
PreparedStatement stmt = null;
ResultSet result = null;
boolean existe = false;
try {
conn = model.ConexionMySQL.darConexion();
stmt = conn.prepareS... |
a1991d5c-020e-48e4-8a14-65db7fc7b55b | 4 | public void draw(Graphics g){
int x = getX();
int y = getY();
int w = getW();
int h = getH();
int xPoints[] = {x, x + w/2, x+w, x + w/2};
int yPoints[] = {y, y + h, y, y - h};
int xPoints1[] = {x+4, x+4 + w/2, x+4+w, x+4 + w/2};
int yPoints1[] = {y+4, y+4 + h, y+4, y+4 - h};
if(w < 0){
x +=w... |
700f86a5-9c76-4e33-b067-77bb067b090c | 1 | public void addGroupOverride(StringTokenizer tokens) {
int tokenCount = tokens.countTokens();
String[] settings = new String[tokenCount+1];
String line = "";
for (int i = 0; i < tokenCount; i++) {
settings[i] = tokens.nextToken();
line += " " + settings[i];
... |
5af747b3-bff9-4445-b36f-43d6fa88f40a | 7 | public static void main(String[] args) {
// TODO Auto-generated method stub
String[] test = {"GET /reason=AUTHORIZEME$ HTTP/1.1",
"GET /?payload=2+1:abc:12:wintype2$&reason=STARTGAME$ HTTP/1.1",
"GET /reason=AUTHORIZEME$ HTTP/1.1",
"GET /?payload=3+1:abcd:12:wintype2$&reason=STARTGAME$ HTTP/1.1... |
071d7fb1-e495-45b1-8812-e6c5434782b2 | 4 | public void run() {
// Get the input stream
InputStream input = null;
try {
input = this.socket.getInputStream();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
BufferedReader reader = new BufferedReader(new InputStreamReader(input));
// In an infinite loop --... |
e96def05-5e0a-4524-b719-5e439329647a | 4 | public static void load()//Method that loads inventory from file
{
String input="savedata/"+JokemonDriver.getVersion()+".inventory";
try
{
BufferedReader in = new BufferedReader(new FileReader(input));
String test=in.readLine();
int runs=Integer.parseInt(in.readLine());
for (int i = 0; i<runs; i++... |
0ebc88a7-38d9-4872-b945-6703b40c09d5 | 9 | @Override
public boolean okMessage(Environmental myHost, CMMsg msg)
{
if(!super.okMessage(myHost, msg))
return false;
if(msg.amITarget(owner()) && (owner() instanceof MOB) && (!amWearingAt(Wearable.IN_INVENTORY)))
{
if((msg.targetMinor()==CMMsg.TYP_LOOK)&&(msg.source()!=owner()))
{
if((msg.tool() i... |
059489f8-902f-43db-a0b0-cc225b6895e8 | 4 | public static JMenu findMenu(JMenuBar bar, Class<? extends JMenu> type) {
if (bar != null) {
int count = bar.getMenuCount();
for (int i = 0; i < count; i++) {
JMenu menu = bar.getMenu(i);
if (type.isInstance(menu)) {
return menu;
}
}
}
return null;
} |
8bbcf300-fe6a-405d-bd5a-a6b337a6c24b | 1 | public static void asm_subwf(Integer akt_Befehl, Prozessor cpu) {
// Komponenten auslesen
Integer f = getOpcodeFromToBit(akt_Befehl, 0, 6);
Integer w = cpu.getW();
Integer result = cpu.getSpeicherzellenWert(f) - w;
// Speicherort abfragen
if(getOpcodeFromToBit(akt_Befehl, 7, 7) == 1) {
// in f Register ... |
5f1d016d-7de2-4f29-a4e6-869bbce29fc9 | 1 | protected final <T> void doBind( Multibinder<T> binder, Class<? extends T> type )
{
checkNotNull( type );
binder.addBinding().to( type );
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.