method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
796a73e5-c3a8-480c-938c-da38d7ae9131 | 9 | @Override
public final void addComment(String key, String... comment) {
if (containsKey(key)) {
if (comment != null && comment.length > 0) {
List<String> the_comments = comments.containsKey(key) ? comments.get(key) : new LinkedList<String>();
for (int i = 0; i < c... |
8d1fa681-e143-46a0-9ac9-4dbbf6e8628f | 3 | private boolean jj_3R_27() {
if (jj_scan_token(RETURN)) return true;
if (jj_3R_76()) return true;
if (jj_scan_token(SEMICOLON)) return true;
return false;
} |
95b89ec3-42b9-4618-89c6-70250c6a324d | 6 | private void overwriteCircleDefault(Attributes attrs) {
// loop through all attributes, setting appropriate values
for (int i = 0; i < attrs.getLength(); i++) {
if (attrs.getQName(i).equals("color"))
circleDef.setColor(new Color(Integer.valueOf(attrs.getValue(i),
16)));
else if (attrs.getQName(i).eq... |
5f0c66a9-d9ba-45eb-8d65-9393a5a059f6 | 6 | public void saveEndereco() {
switch (opcaoHeader) {
case "cadastrar cidade":
try {
genericDAO.save(cidade);
searchCidade();
} catch (Exception ex) {
Logger.getLogger(UnidadeMB.class.getName()).log(Level.SEVERE, null, ex);
}
... |
bc8726c4-2f98-4985-a85e-29a02b952e74 | 5 | public static void main(String[] args) {
int numeroActual = -1;
int num1;
System.out.println(args[0]);
num1 = Integer.parseInt(args[0].toString());
while (num1>numeroActual){
numeroActual++;
System.out.println(numeroActual);
}
if (num1%3==0){
num1++;
// si el numer... |
698e2c18-b2d0-42a7-877d-12f47d3f6c84 | 1 | public boolean searchFAT32Element() throws UnsupportedEncodingException {
//получение корневого элемента FAT32
byte[] rootBytes = new byte[32];
for (int i = BPB_RootClus * BPB_BytsPerSec; i < (BPB_RootClus * BPB_BytsPerSec + 32); i++) {
rootBytes[i - BPB_RootClus * BP... |
801ceb87-c0a9-4544-a9e0-3e4577c47617 | 2 | private void lireFichier(String chemin_ficher) throws FileNotFoundException, IOException {
contenu_fichier = new StringBuilder() ;
f = new File(chemin_ficher) ;
if(!f.getName().endsWith(".plic"))
throw new ArrayIndexOutOfBoundsException() ;
BufferedReader b = new BufferedRead... |
b533a21f-2ab1-4d92-8afe-e2d66419ffb9 | 4 | public static boolean isNumericSpace(String str)
{
if (str == null)
{
return false;
}
int sz = str.length();
for (int i = 0; i < sz; i++)
{
if ((Character.isDigit(str.charAt(i)) == false) && (str.charAt(i) != ' '))
{
... |
1f819535-c8a2-422d-aff8-3f730f8bb678 | 6 | public boolean shouldExecute()
{
if (this.targetChance > 0 && this.taskOwner.getRNG().nextInt(this.targetChance) != 0)
{
return false;
}
else
{
if (this.targetClass == EntityPlayer.class)
{
EntityPlayer var1 = this.taskOwner... |
3ac899e7-36a5-48b0-a480-736fbd6049bf | 8 | public void fillMemory(int[] memory) {
int xDimSize = model.getPanelWidth();
int xStart = model.getXnull() + model.getX() - model.getSize()/2;
int yStart = model.getYnull() - model.getY() + model.getSize()/2;
int xStop = xStart + model.getSize();
int yStop = yStart - model.getS... |
5c7db115-905a-41f9-84d4-ca66e60b077e | 0 | public ArraysDataBase getArraysDataBase(){
return arraysDataBase;
} |
34cdd66e-bdb3-4702-9f81-cdc87009a8b1 | 0 | private boolean isValidInput(final String s) {
return s.matches("[!-+--~]+[,][!-+--~]+");
} |
3d0d03db-4290-409d-a3ec-17bb499052ce | 1 | public void mouseMoved(MouseEvent me) {
meX = me.getX();
meY = me.getY();
if(mouseOverTab(meX, meY)){
controlCursor();
tabbedPane.repaint();
}
} |
9a974098-4326-4ba0-a22d-23d8d84f2f0a | 5 | @Override
public Types.MOVEMENT passiveMovement(VGDLSprite sprite)
{
if(sprite.isFirstTick)
{
sprite.isFirstTick = false;
return Types.MOVEMENT.STILL;
}
double speed;
if(sprite.speed == -1)
speed = 1;
else
speed = s... |
cf8cc87d-18f8-44c8-b02a-e56c24666894 | 3 | @DBCommand
public boolean start(CommandSender sender, Iterator<String> args) {
if(!sender.hasPermission("db.start")) {
sender.sendMessage(RED + "You don't have permission to use this command!");
return true;
}
if(!args.hasNext()) {
sender.sendMessage(
... |
93228d9a-102c-4d32-b4df-96282f53fb9a | 1 | @Override
public void valueChanged(ListSelectionEvent e) {
if ( !e.getValueIsAdjusting() )
delete.setEnabled(true);
} |
73bb92ed-dc85-4cc0-8128-aa1e6a16879c | 5 | private Person onCircle(double nx, double ny){
for (Person p : model.getPersons()){
Circle c = (Circle) p.getShape();
if(c.getCenterX()+2*c.getRadius()>nx && c.getCenterX()-2*c.getRadius()<nx
&&
c.getCenterY()+2*c.getRadius()>ny && c.getCenterY()-2*c.ge... |
019981ad-f8bc-4d23-abb7-4c4517e04d43 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Lendable other = (Lendable) obj;
if (file == null) {
if (other.file != null)
return false;
} else if (!file.equals(other.file))
retur... |
44c05cdb-2ba0-406a-83e7-b03d99dd254f | 7 | public void createEnemies(String mapName){
String thisLine;
Path mapPath = Paths.get(MAP_FOLDER, (mapName + TXT_FILE_END));
File inFile = mapPath.toFile();
// open input stream test.txt for reading purpose.
List<String> mapLines = new ArrayList<String>();
try {
BufferedRea... |
ea8ee10e-4753-4b55-b235-e1217c970b04 | 0 | public Configuration[] getInitialConfigurations(String input) {
Configuration[] configs = new Configuration[1];
configs[0] = new FSAConfiguration(myAutomaton.getInitialState(), null,
input, input);
return configs;
} |
863fa10c-aae8-48b6-be43-10bfb61a85aa | 6 | final ObjectDefinition getObject(int i, int i_0_) {
anInt3351++;
ObjectDefinition class51;
synchronized (aClass60_3350) {
class51 = (ObjectDefinition) aClass60_3350.method583((long) i_0_, i ^ 0x32);
}
if (class51 != null)
return class51;
byte[] is;
synchronized (aClass45_3343) {
is = aClass45_3343... |
680c4dba-0b63-471e-92ac-d93be9dc96fb | 7 | public int[] getLeastNumbers(Integer[] data, int length , int k){
if(data == null || length <= 0 || k<=0 || k > k){
throw new IndexOutOfBoundsException("input error!");
}
int[] result = new int[k];
int start = 0 , end = length -1 ;
int index = s.partition(data, length, start, end);
while(index != k... |
9f6a2150-0e48-44c8-bee6-c17b5cb0b782 | 4 | @Override
public Integer getNodeId(Integer playerId) {
Integer Position = null;
// loops through detectives and there is an ID match - returns the
// detective position
for (Detective a : listDetectives) {
if (a.getID().equals(playerId)) {
Position = a.getPosition();
}
}
// loops through Mr X's a... |
716ce3a9-33a5-425f-93eb-7a8c9c117e47 | 9 | public static List<Term> combineEntities(List<Term> sentence) {
List<Term> newSentence = new ArrayList<Term>();
int idx = 0;
StringBuilder builder = new StringBuilder();
while (idx < sentence.size()) {
Term term = sentence.get(idx);
if (isPerson(term)) {
builder.append(term.getText()).append("_");
... |
560343c6-d449-4da9-9687-2acde916129c | 9 | protected boolean CheckMousePositionRegion(int posX, int posY, int width, int height, boolean checkInside)
{
//Defining the result variable
boolean result = false;
//External check
if (checkInside == true)
{
//Checking inside the region
if (game.objInputManager.shortMouseX >= posX
&& game.objInp... |
99b1a0ec-cecb-4f04-8322-5cf8a800bb2a | 9 | private void processPlayer(int time) {
// TODO player death
player.tryRegen();
if (northPressed || southPressed || westPressed || eastPressed) {
player.setIsMoving(true);
Rectangle[] monsterBounds = new Rectangle[map.monsters.size()];
for (int i = 0; i < map.monsters.size(); i++) {
monsterBounds[i] ... |
e5cdcfe4-cfc9-4c18-bbc8-8f203f8e9cb3 | 5 | public static int[] intersectTwoSortedArrays(int[] array1, int[] array2){
// create a new array having the smallest size between the two arrays
final int newArraySize = (array1.length < array2.length) ? array1.length : array2.length;
int[] newArray = new int[newArraySize];
int pos1 = 0;
int pos2 ... |
da415379-1efe-401d-81ea-83e994e34476 | 9 | private void detectBlock() throws LangDetectException {
cleaningText();
ArrayList<String> ngrams = extractNGrams();
if (ngrams.size()==0)
throw new LangDetectException(ErrorCode.CantDetectError, "no features in text");
langprob = new double[langlist.size()];
... |
bf0bd83d-3588-48ee-89b5-dcf10ff2dbfc | 4 | public void addRecords() {
AccountRecord record = new AccountRecord();
Scanner input = new Scanner(System.in);
System.out.println("To terminate input, type the end-of-file indicator"
+ "\nwhen you are promted to enter input."
+ "\nOn UNIX/Linux/Mac OS X type <ct... |
c46fe4a4-0c83-4877-a0ea-c144cba8db7e | 2 | public static void main(String... args) throws Exception {
File file = new File("/Users/babyduncan/github/javanio/files/sourceFile.txt");
File disFile = new File("/Users/babyduncan/github/javanio/files/disFile.txt");
FileInputStream fileInputStream = new FileInputStream(file);
FileChann... |
b3849645-fd63-4002-ba53-99e3942d4dce | 3 | private void initHandler() {
mouseHandler = mouseEvent -> {
final Object SOURCE = mouseEvent.getSource();
if (MouseEvent.MOUSE_PRESSED == mouseEvent.getEventType()) {
MenuItem menuItem = items.get(SOURCE);
if (menuItem.isSelectable()) {
... |
dd061e6d-fe97-45ad-9a5f-c417c87ef4e0 | 3 | public void run(){
synchronized(this){
this.runningThread = Thread.currentThread();
}
openServerSocket();
while(! isStopped()){
Socket clientSocket = null;
try {
clientSocket = this.serverSocket.accept();
} catch (IOExceptio... |
a429879b-785a-4ed5-86c3-b5c6e0efc8b1 | 7 | private void test(String testPath) throws IOException {
int hit = 0;
int total = 0;
BufferedReader scanner = null;
try {
scanner = new BufferedReader(new FileReader(new File(testPath))); //new Scanner(new File(testPath));
} catch (FileNotFoundException e) {
... |
33b2fe76-3c74-4496-bf77-dab09def176c | 1 | public void setSelectionRange(SelectionRange selectionRange){
if (selectionRange != null){
this.selectionRange = selectionRange;
}
} |
79065351-105b-41b3-9f19-fd469dee0800 | 7 | public static boolean isValid(File f) {
if (f.isDirectory()) {
return false;
}
String extension = FileTools.getExtension(f);
if (extension != null) {
if (extension.equals(".zip") ||
extension.equals(".tar") ||
extension.equals(".ra... |
d8a48b89-d356-4c14-8e62-ccd05d82a393 | 5 | private static int Permutate(char[] workingSet, int workingIndex, HashSet<String> seenAlready, HashSet<String> toMatch) {
int result = 0;
if (workingSet.length - 1 < workingIndex) {
String permutation = new String(workingSet);
if (!seenAlready.contains(permutation) && toMatch.co... |
9f29c21c-d490-4121-bd55-b5bb1926da29 | 0 | private void addGame(Game game) {
games.put(game.getGameId(), game);
} |
c7c95d04-e6d9-4fe2-bfdd-616fcfc61b9d | 7 | @Override
public void paint(Graphics g) {
super.paint(g);
Graphics2D g2d = (Graphics2D)g;
g2d.scale(scale, scale);
int[] size = antWorld.getGridSize();
for(int i=0; i<size[0]; i++) {
for(int j=0; j<size[1]; j++) {
int x = (int) (i*64+(10*(1/scale)));
if(j%2!=0) { x += 32; }
int y = (... |
1cb38842-13a5-4741-9265-3059ba4fe28a | 6 | public boolean SurviveSingleVision(int inSeer, int inTarget, byte inVision){
boolean output = true;
if(this.playerTest(inSeer) == 2){
if(inTarget == 0) return true; // No vision was had, therefore no conflict.
output = ((playerTest(inTarget) <= (-3)) || (playerTest(inTarget) >= 3)); // output is now
// tr... |
70052cc6-ce1b-4a9d-b69b-3ee7eebd0b2d | 0 | public SimpleDoubleProperty wrapWidthProperty() {
return wrapWidth;
} |
2accd802-b314-4f27-86c2-d226d7f62b75 | 1 | protected void initView() {
this.add(new TooltipAction("Step", "Moves existing valid "
+ "configurations to the next " + "configurations.") {
public void actionPerformed(ActionEvent e) {
controller.step(blockStep);
}
});
this.add(new TooltipAction("Reset", "Resets the simulation to "
+ "start c... |
36b12997-d77b-4cc3-bb09-00a223339c32 | 6 | public void movePlayer(Point dir) {
Point destination = Point.add(player.world_position, dir);
int moveprior = Move.rate(destination);
int attackprior = Attack.rate(destination);
int entprior = Activate.rate(destination);
double ap_val = 0;
if (moveprior > attackprior && ... |
90782612-1ef2-4f16-964f-71a871d2a8e8 | 9 | @Override
public void run() {
while(repeat > 0){
ObjectOutputStream out = null;
ObjectInputStream in = null;
try {
long time1 = System.currentTimeMillis();
Command[] commands = new Command[inputs.length];
for(int i=0; i!=inputs.length; ++i){
commands[i] = Command.parse(... |
95b5d855-602f-40f3-b482-700fb8dcd728 | 4 | public void leaveState(MouseListenerHandler mouseListenerHandler) {
BoardDisplay bd = mouseListenerHandler.getBoardDisplay();
// Remove all listeners, both MouseListener and MouseMoitionListener
for (MouseListener ml : bd.getMouseListeners()) {
bd.removeMouseListener(ml);
}
for (MarkDisplay md : bd.getMar... |
ccabbf19-7811-4b65-a510-a03585527cfe | 4 | public boolean isValidField (char row, byte column)
{
if(row >= 97 && row <= 104 && column <= 7 && column >= 0)
{
return true;
}
return false;
} |
665345ba-7032-42cb-9175-ad6c60b7aa4a | 3 | private boolean callUpdateScore(String scheduleID) {
if (scheduleID==null) return false;
boolean result = false;
int m=0;
do {
result = APIRequest.getInstance().updateGameBoxscore(Sport.NBA, scheduleID);
} while (!result && ++m < tries);
return result;
} |
2534acb9-24ad-4676-a7ff-d23ffb493f47 | 7 | public void importArchive(Archive archive) {
dull = true;
CacheIndice indice = cache.getIndice(0);
try {
byte[] data = null;
String location = SwingUtils.getFilePath("Select Archive", Constants.getExportDirectory(), false, new JAGFileFilter());
if (location != null) {
data = DataUtils.readFile(locati... |
f8850e29-8b21-43e2-8bbb-d6619e0dbc41 | 0 | public static boolean isApplicable(Object object) {
return object instanceof LSystem;
} |
ba8fbf19-22d4-407a-b2cf-129c417b4b1e | 7 | private static String numberToString(int n) {
if (n < 1 || n > 1000) {
return "";
}
if (n <= 20) {
return numberMap.get(n);
}
if (n == 1000) {
return "onethousand";
}
String result = "";
if (n >= 100) {
i... |
d33f50c1-f98b-4c79-b7b0-add69d5e3912 | 5 | public int minDistance(String word1, String word2) {
int m = word1.length();
int n = word2.length();
int[][] distances = new int[m + 1][n + 1];
//insert
for (int i = 0; i <= m; i++) {
distances[i][0] = i;
}
//delete
for (int i = 0; i <= n; i+... |
ec0f5549-1638-4a7c-8713-aeb932c7c124 | 8 | public void handleBeingMobSniffed(CMMsg msg)
{
if(!(msg.target() instanceof MOB))
return;
final MOB sniffingmob=msg.source();
final MOB sniffedmob=(MOB)msg.target();
if((sniffedmob.playerStats()!=null)
&&(sniffedmob.soulMate()==null)
&&(sniffedmob.playerStats().getHygiene()>=PlayerStats.HYGIENE_DELIMIT)... |
5aab8ed2-9508-4512-bc3c-1b91acf46fbe | 7 | public static void startupXml() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$);
Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
if (Stell... |
a4909087-12d0-421b-87bc-39c829a10755 | 4 | public static boolean isAnagrams(String s,String t){
if( s== null || t == null){
return false;
}
if(s.length() != t.length()){
return false;
}
char[] u = s.toCharArray();
Arrays.sort(u);
char[] v = t.toCharArray();
Arrays.sort(v);
if(new String(u).equals(new String(v))){
return true;
}
el... |
8ec2e644-3717-4507-8547-fde9dfb6e253 | 0 | public void onScrubGeo(long userId, long upToStatusId) {
//System.out.println("Got scrub_geo event userId:" + userId + " upToStatusId:" + upToStatusId);
} |
6089ade2-2a1e-4af7-9a40-861de6f18804 | 5 | public static void main(String[] args) {
int n=10;
PolyominoGenerator.generatePolyomino(n);
ArrayList<boolean[][]> polys = new ArrayList<>();
boolean[][] poly = {{false,false,false},{false,false,false},{false,false,false}};
try {
PolyominoInputStream... |
0ec0cd7a-001c-4b0b-8d69-8f74355a4b61 | 3 | @EventHandler
public void onPlayerPickupItem(PlayerPickupItemEvent event) {
if (HyperPVP.getSpectators().containsKey(event.getPlayer().getName()) || HyperPVP.isCycling() && !event.getPlayer().isOp()) {
event.setCancelled(true);
}
} |
86708443-fc00-46fc-ba9f-f6e92f51db98 | 9 | public static void main(String[] args) throws Exception {
System.out.println("Main Harness");
final int lowestPower = 1;
final int highestPower = 7;
for (int expon = lowestPower; expon <= highestPower; expon++) {
final int rowCount = (int) Math.round(Math.pow(10, expon));
int[] source = readSource(rowCoun... |
ad995db6-8434-4107-b91e-5759439dd670 | 4 | public JSONObject toJSONObject(JSONArray names) throws JSONException {
if (names == null || names.length() == 0 || this.length() == 0) {
return null;
}
JSONObject jo = new JSONObject();
for (int i = 0; i < names.length(); i += 1) {
jo.put(names.getString(i), this.... |
6132103a-00c5-4f3c-ac02-ee9c76759c7b | 9 | private void process()
{
// Get the first command off the command queue and process it
if (m_oCommandQueue != null && m_oCommandQueue.size() > 0)
{
// TODO: Optimise this method
for (int i= this.getCommandProcessCount(); i>0 && m_oCommandQueue.size() > 0; i--)
... |
b6495747-ba55-4216-a698-9bee51276ef5 | 9 | static HashMap<IntPair, HashSet<AAAtom>> generateAll(int aCount, int archCount) {
HashMap<IntPair, HashSet<AAAtom>> result = new HashMap<>();
result.put(new IntPair(0, 0), new HashSet<AAAtom>());
HashSet<AAAtom> aSet = new HashSet<>();
aSet.add(new AAAtom());
result.put(new In... |
0b80b100-9ef3-4aca-aa0b-ebe86de4acfb | 5 | public static Tag<Map<String, Tag>> newCompound(Map<String, ?> data)
throws ClassNotFoundException, IllegalAccessException,
InvocationTargetException, NoSuchFieldException, NoSuchMethodException,
NBTLibDisabledException, UnknownTagException {
Map<String, Tag> map;
try {
for (final Object... |
65100fd6-7853-4b53-a80f-319c7aa44685 | 2 | private void editSensorEx(){
Form form = new Form();
form.add("unity", "mm");
form.add("name", "Capteur_Pluie");
form.add("statementFrequency", -1);
form.add("samplingFrenquency", 1234);
try {
ClientConfig clientConfig = new DefaultClientConfig();
clientConfig.getFeatures().put(JSONConfiguration.FEAT... |
2296f98a-5276-4643-8a7d-23cbebab5d14 | 0 | public boolean isEmpty() {
return size == 0;
} |
f0f6d11b-7717-43f6-9a22-2f3fe9aa1063 | 1 | public static int[] getPosition(PositionQueue queue, int[] prevPosition){
Position p = queue.poll();
if (p == null)
return prevPosition;
else{
return p.getPosition();
}
} |
8834fe09-0aaf-4471-9973-76e1b3881f8c | 2 | private void pushFile_fileManagerButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pushFile_fileManagerButtonActionPerformed
File source = null;
String dest = directoryLabel_fileManagerLabel.getText();
JFileChooser fileChooser = new JFileChooser();
fileCho... |
0c77d802-3351-42e0-a222-19b9245d4874 | 0 | @Test
public void testNoTestLinkAnnotationFailure() {
assertTrue(false);
} |
aee56806-3a11-40c3-b02b-35fb5f316f32 | 6 | public static void fillTable(ResultSet aResult, JTable aTable) throws SQLException {
((DefaultTableModel) aTable.getModel()).setRowCount(0);
((DefaultTableModel) aTable.getModel()).setColumnCount(0);
ResultSet results = aResult;
ResultSetMetaData metadata = results.getMetaData();
... |
e8292654-accb-4c35-98b2-b7cbb4c69317 | 8 | public void calculate(FibonacciHeapNode source) {
NotTreatedNodes = new FibonacciHeap();
distances = new HashMap<FibonacciHeapNode, Integer>();
predecessors = new HashMap<FibonacciHeapNode, FibonacciHeapNode>();
// set infinity to all other node than myself
for (FibonacciHeapNode... |
a12c8e47-6400-4981-ba46-e1829e66dc07 | 3 | public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof User)) {
return false;
}
final User user = (User) o;
return !(username != null ? !username.equals(user.getUsername()) : user.getUsername() != null);
} |
d0c0e5ed-5a04-4644-96b8-337dd955558f | 3 | @Test
public void testGetList() throws Exception {
Set<Product> products = new HashSet<Product>();
products.add(new Product(0, "desc0", "cat0"));
products.add(new Product(1, "desc1", "cat0"));
products.add(new Product(2, "desc2", "cat1"));
products.add(new Product(3, "desc3",... |
79c7482d-2da6-41b2-ae07-0f7eae6b2f9b | 7 | @EventHandler
public void WitherNightVision(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getZombieConfig().getDouble("Wither.Nig... |
d16c4e57-cbda-42a0-bb15-edfabf2d60f2 | 9 | @Override
public BasicValue newValue(final Type type) {
if (type == null) {
return BasicValue.UNINITIALIZED_VALUE;
}
boolean isArray = type.getSort() == Type.ARRAY;
if (isArray) {
switch (type.getElementType().getSort()) {
case Type.BOOLEAN:
... |
c5f2dcd1-8c9c-499f-b605-169dfcad785e | 9 | public void addSample(String sampleReference,
Distribution sampleDistribution, int sampleSize) {
if ((sampleSize > 0) && (sampleDistribution != null)) {
// if the sample is already contained in the list, we need to
// remove it first and subtract its size from the sum of sizes prior
// to replacing it.
... |
0f33c51f-48b8-46c0-8157-11a3329c3641 | 1 | public boolean colides(SchlangenKopf head) {
return getBounds().intersects(head.getBounds()) && this != head;
} |
ea50bdb3-f7f5-4be7-b6c5-1b8915e5d4fd | 7 | public void close()
throws IOException
{
try {
int bufferLength = this.buffer.length();
for (;;) {
String str = "";
char ch;
if (this.bufferIndex >= bufferLength) {
str = XMLUtil.read(this.reader, '&');
ch = str.charAt(... |
1c9d5d20-d63b-4b6b-9256-cf7fb940d61b | 4 | public void rMayusVerticesNoLocal()
{
Iterator elemFuente;
Elemento entrada,salida;
Iterator elemDestino = destino.listaElementos();
double sumaDistancias,sumaValores,distancia,ponderacion,rMayor;
double dist[];
int count;
while(elemDestino.hasNext())... |
37f68cd5-d1b6-4af3-83ef-ae012571517a | 2 | public Path2D drawablePath2D(Node to)
{
List<Node> nodes = dij.getRoute(to);
Path2D path = new Path2D.Double();
for (Node n : nodes)
{
if (n.equals(nodes.get(0)))
{
path.moveTo(n.getxCoord(), n.getyCoord());
} else
{
path.lineTo(n.getxCoord(), n.getyCoord());
}
System.out.println(n.g... |
e90df89b-4f68-48ac-bee3-3b63bd3b6a76 | 6 | public void MarketCannotFulfill(Market market, Map<String, Integer> provided){
Do(market.getName()+" cannot fulfill");
synchronized(marketOrders){
for(MarketOrder mo : marketOrders){
if(mo.market.equals(market.getName())){
mo.provided = provided;
}
}
}
for(String food : foodToOrder.keySet()){
f... |
5219e96a-b4f0-4027-833f-ac0250810026 | 1 | protected void listAll()
{
if(myCases.size() == myLemma.numCasesTotal())
myMessage.setText("All cases for m = " + myLemma.getM() + " are already shown.");
else
{
myLemma.doAll();
myMessage.setText("All cases for m = " + myLemma.getM() + " shown.");
... |
b62a2290-679d-446a-a0fe-efffabcb00e6 | 8 | public static void main(String[] args) throws Exception {
int i;
System.out.println("1: for train and predict");
System.out.println("2: for test");
System.out.println("3: for excute meta");
if (args.length == 0) {
System.out.println("input a method");
System.exit(0);
} else if (args.length == 1) {... |
04817401-4ca3-4098-b233-730de826b927 | 3 | @Test
public void recomTest1() {
userInput.add("hello");
userInput.add("hi");
userInput.add("luiz");
userInput.add("what can i eat with pork today");
//Covering approval
userInput.add("yes");
userInput.add("what can i eat with fish tomorrow");
//Covering different week days
userInput.add("beef monday... |
8008dc02-cfc2-479c-854c-9b736e79f3c2 | 0 | public void setjTextFieldLieux(JTextField jTextFieldLieux) {
this.jTextFieldLieux = jTextFieldLieux;
} |
41a04d43-519b-4653-a16d-9bc7e8cc190d | 5 | @Override
public Iterable<JavaFileObject> list(Location location, String packageName,
Set<Kind> kinds, boolean recurse) throws IOException {
//Special handling for Privateer classes when building with Maven
//Maven does not set the classpath but instead uses a custom
//classloade... |
118df187-4b2d-4f2e-ab5d-54fda53db386 | 7 | StunServerReceiverThread(DatagramSocket datagramSocket) {
this.receiverSocket = datagramSocket;
for (DatagramSocket socket : sockets) {
if ((socket.getLocalPort() != receiverSocket.getLocalPort()) &&
(socket.getLocalAddress().equals(receiverSocket.getLocalAddress())))
changedPort = socket;
if ((... |
52aa9460-ab71-496a-b299-149f363378bd | 1 | @Override
protected Integer compute() {
Integer ret = 0;
MyWorkerThread thread = (MyWorkerThread) Thread.currentThread();
thread.addTask();
for(int i = start ; i < end;i ++){
ret += array[i];
}
return ret;
} |
6d8377bd-c419-42c2-b523-230fbbadbaa3 | 4 | public Point minus(Point p) {
if (!(p == null || p.properties == null || properties == null)) {
for (int i = 0; i < properties.size(); i++) {
set(i, get(i) - p.get(i));
}
}
return this;
} |
1868a13e-4a45-4c35-b98f-1290320e0744 | 9 | @Override
public int reportFake(@Nonnull GamePlayer player, @Nonnull Status[] tweets) throws RemoteException
{
tweetsProvider.delay();
final GamePlayerData playerData = getGamePlayerData(player);
try {
if (tweets.length < MIN_FAKE_TWEETS_BATCH) throw new IllegalArgumentException("Invalid fake tweeets size");... |
acc07bc0-7344-44e7-ba58-fc4a6051c440 | 5 | @Override
public String encrypt(String plainText) {
String text = processInput(plainText);
int r = transpositionLevel;
int length = text.length();
int c=length/transpositionLevel;
char mat[][] = new char[r][c];
int k=0;
String cipherText="";
for(int i=0;i< c;i++) {
for(int j=0;j< r;j+... |
e67618f1-d394-4383-a24e-411eac396391 | 0 | public static void main(String[] args) {
int max = Integer.MAX_VALUE;
System.out.println("Overflow:");
System.out.println(max); // 2147483647
System.out.println(max + 1); // -2147483648
System.out.println(max + 2); // -2147483647
int min = Integer.MIN_VALUE;
System.out.println("Unceerflow:");
System.out.printl... |
d2828eed-d30e-4e67-be05-f8a7182c9da4 | 0 | public State(int id, Point point, Automaton automaton) {
this.point = point;
this.id = id;
this.automaton = automaton;
} |
8137c078-4f07-4b6a-94c1-9af188ee968d | 1 | public ShapeElempun(SimpleFeature f, String tipo) {
super(f, tipo);
shapeId = "ELEMPUN" + super.newShapeId();
// Elempun trae la geometria en formato Point
if ( f.getDefaultGeometry().getClass().getName().equals("com.vividsolutions.jts.geom.Point")){
Point p = (Point) f.getDefaultGeometry();
coor = p... |
111f2920-8044-4a20-89a4-805ed1cd38b8 | 5 | public Stub440 localise() {
Class<? extends Stub440> c = null;
try {
c = (Class<? extends Stub440>) Class.forName(remoteInterfaceName + "_Stub").asSubclass(Stub440.class);
} catch (ClassNotFoundException e) {
//TODO: Download .class file from code base
e.printStackTrace();
System.exit(-1);
}... |
2473cd01-26bb-49ad-8c34-1546b6e6c5c8 | 8 | @SuppressWarnings("unchecked")
@Test
public void testLastWeek() {
SimpleValidator simpleValidator = new SimpleValidator();
DateRangeBean bean;
Set<?> validations;
for (int days = -2014; days <= -14; days += 100) {
bean = new DateRangeBean();
bean.setDate4(util.add(new Date(), Calendar.DAY_OF_MONTH, day... |
d364504b-9772-440f-8341-ef3ffebd0395 | 5 | public void inferir(BaseReglas baseCon) throws IOException
{
baseCon.cargar();
Archivos a = new Archivos();
float min = 1,temp=1;
int i;
while(baseCon.tieneRegistros())
{
//Obtener regla
baseCon.siguienteRegla();
... |
cad68a9b-bf77-4870-8eda-1ed21ad57a64 | 6 | public void parseFile() {
LineNumberReader lnr = null;
try {
lnr = new LineNumberReader(new InputStreamReader(new FileInputStream(file)));
String s;
while ((s = lnr.readLine()) != null) {
if (!s.startsWith("[")) {
continue;
}
parseCell(s);
}
} catch (FileNotFoundException e) {
e... |
c2aa1b3a-1a21-4aab-8eca-766fbaaeaf97 | 9 | public void OperandBody(OperandTypeDecl td) throws ParseException {
jj_consume_token(LBRACKET);
label_8:
while (true) {
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case READ:
case WRITE:
case 81:
break;
... |
ef4d99e6-91bb-491a-86b4-5430e6aeb919 | 8 | public TreeNode build(int[] A) {
TreeNode root = new TreeNode(A[0]);
TreeNode last = root;
Stack<TreeNode> S = new Stack<>();
boolean left = false;
for (int i = 1; i < A.length; i++) {
if (last == null && S.isEmpty())
break;
last = last == null ? S.pop() : last;
if (A[i] != -1) {
TreeNode nod... |
9334586d-ff3d-4d2c-a68e-d14de3559316 | 3 | public final void testFall()
{
DiscogParser parser = new DiscogParser();
try
{
Record r = parser.parseDiscogRelease(DISCOG_FALL);
System.err.println("TRACKS = " + r.getTracks().size());
assert (r.getTracks().size() == 50);
// Check the last track has a correct ... |
7914f7aa-3ab5-444e-be0e-3d3456d49864 | 2 | public Enrolment(Student s, ClassGroup c) {
if (s == null || c == null)
throw new IllegalArgumentException();
this.enrolledStudent = s;
this.enrolledClass = c;
} |
69d35f8c-0d34-41df-91d9-2c9e1250e1f5 | 2 | public String toString()
{
String s = "";
for (int i = 2; i < a.length; i++)
s += (a[i] ? i + " " : "");
return s;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.