method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
fb1ae836-cf9c-46b1-b593-65f8d43f4a2f | 4 | static public DeferredConstruction getDeferredConstruction (Class type, YamlConfig config) {
ConstructorParameters parameters = config.readConfig.constructorParameters.get(type);
if (parameters != null) return new DeferredConstruction(parameters.constructor, parameters.parameterNames);
try {
Class constructorP... |
72e1fa58-a2f0-48e6-9656-2cf5ac1856ff | 8 | public static Set<String> getPairs(int[] nums, int diff) {
Set<String> results = new HashSet<>();
if(null == nums || nums.length == 0) {
return results;
}
boolean hasPair;
int numIdx, tmp;
for(int idx=0; idx < nums.length; idx++) {
hasPair = false;... |
86f1cf32-7f19-494e-9ab4-22cc268f4ba0 | 9 | public Object getProperty(String name,
Object opNode) {
validate(name, opNode);
if(opNode instanceof RenderedOp &&
name.equalsIgnoreCase("roi")) {
RenderedOp op = (RenderedOp)opNode;
ParameterBlock pb = op.getParameterBlock();
... |
fd68d140-8498-495d-a1ab-ecf852e357d3 | 1 | private List<Token<Colors>> getColors(String combi) {
List<Token<Colors>> colors = new ArrayList<Token<Colors>>();
for (int i = 0; i < combi.length(); i++) {
colors.add(new Token<Colors>(Colors.valueOf(combi.substring(i, i + 1))));
}
return colors;
} |
e232834f-5c32-48c0-a3dd-f1cb6f96cb49 | 8 | public String encodeSolution() throws EncodeException {
StringBuilder res = new StringBuilder();
if (this.solution != null && this.solution.length > 0) {
if (solution[0] instanceof Integer) {
res.append("int");
} else if (solution[0] instanceof Double) {
... |
532cf7eb-f830-4dcf-bd19-bd5f09c1a852 | 7 | public void load() {
File chestFile = new File(HungerGames.get().getDataFolder(), "chest.yml");
if (!chestFile.exists()) {
HungerGames.get().saveResource("chest.yml", false);
}
if (chestFile.exists()) {
FileConfiguration storage = YamlConfiguration.loadConfiguratio... |
8853b417-8883-472c-acd0-9daf71e4f753 | 5 | public static void deleteAllEmptyFiles(File file){
ArrayList<File> emptyFiles = new ArrayList<File>();
File[] flist = file.listFiles();
if(flist!=null){
for (File aFlist : flist) {
if (aFlist.isFile()) {
if (isEmpty(aFlist)) {
... |
df33cbe2-4e1b-42bc-90e0-529d0a6393c0 | 6 | public String nextCDATA() throws JSONException {
char c;
int i;
StringBuffer sb = new StringBuffer();
for (;;) {
c = next();
if (end()) {
throw syntaxError("Unclosed CDATA");
}
sb.append(c);
i = ... |
22c51175-f83b-43f0-ad25-fa5793c2a51f | 4 | private void fixBeforeRemove(Node removed)
{
if (removed.color == RED) { return; }
if (removed.left != null || removed.right != null) // It is not a leaf
{
// Color the child black
if (removed.left == null) { removed.right.color = BLACK; }
... |
1327c8fa-c57c-4b25-897b-94f1895f2914 | 5 | public static float calcCommission (float salesAmount){
double dcommission = 0;
float fcommission = 0;
if (salesAmount < 200) {
dcommission = salesAmount * 0.03;
fcommission = (float)dcommission;
} else if (salesAmount >= 200 && salesAmount < 500) {
dcommission = salesAmount *... |
6603e54c-14ea-4e38-910f-ac2c61f5a324 | 2 | protected WatchService preRun() throws Exception {
Path dir = Paths.get(this.path);
File folder = new File(this.path);
for (final File entry : folder.listFiles()) {
if(!entry.isDirectory()) {
detectedFile(DetectionType.ORIGINAL, entry);
}
}
WatchService watcher = FileSystems.ge... |
659ab45e-4b36-4d60-b934-36e404c04678 | 1 | public AnnotationVisitor visitArray(final String name) {
checkEnd();
checkName(name);
return new CheckAnnotationAdapter(av == null ? null
: av.visitArray(name), false);
} |
ffad1b09-2cf9-4acc-beaf-8e7eab25bce5 | 1 | public List<Problem> findKindPage(int page,int size,int kind) {
log.debug("finding page Problem instances");
try {
String queryString = "from Problem where kind=" + kind;
Query queryObject = getSession().createQuery(queryString);
queryObject.setFirstResult(page);
queryObject.setMaxResults(size);
... |
f6cde6b1-a9e7-41f1-9d34-414bf5e5a653 | 8 | public void putAll( Map<? extends Double, ? extends Double> map ) {
Iterator<? extends Entry<? extends Double,? extends Double>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Double,? extends Double> e = it.next();
this.put( e.... |
6d510e69-ff74-45a0-b62c-eb2e03acae8f | 7 | public void getContributor()
{
networkController.SendMessage("getPromotion#" + clientId + "," + clientType + "," + userContributor + "," + userName);
clientType = userContributor;
contributor = true;
cleanLabels();
if(observer)
getObserver.setVisible(true);
if(reporter)
getReporter.setVis... |
352f3d1f-e85c-49b8-85c7-11e8d8ea0e6e | 9 | public Queue<String> shamanXMLUnit (){
try {
path = new File(".").getCanonicalPath();
FileInputStream file =
new FileInputStream(new File(path + "/xml/papabicho.xml"));
DocumentBuilderFactory builderFactory =
DocumentBuilderFactory.newInstance();
Do... |
dd46c9ec-fa92-4ce7-9219-6c4f61f2ec7f | 2 | private void findMin() {
int m = 0;
for (int i = 1; i < array.length; ++i) {
if (array[i].getValue().compareTo(array[m].getValue()) < 0) {
m = i;
}
}
min = array[m];
} |
0ec70b51-516a-4ace-b4d3-76c4d1261996 | 7 | static final void method880(int i, byte[] is, byte[] is_0_, int i_1_,
int i_2_, int i_3_, int i_4_, int i_5_,
int i_6_) {
try {
anInt1575++;
int i_7_ = -(i >> -1209643998);
i = -(i & 0x3);
if (i_2_ != 13880)
method880(9, null, null, -128, 85, -75, 62, 85, -51);
for (int i_8_ = -i_3_;... |
a670573e-47cb-4011-85fe-03086a987021 | 7 | public boolean notifyImpl(ByteBuffer b, Object passthrough) throws IOException {
if (log.isLoggable(Level.FINEST))
log.log(Level.FINEST, id+"processing stream");
if(b == null)
throw new IllegalArgumentException(id+" evt cannot be null");
boolean notified = false;
while(b.remaining() > 0) {
switch(stat... |
58dd5f2e-eba9-4125-b1b6-f3df0847421a | 5 | public boolean isDraw(Counter lastPlaced, Board b) {
boolean full = true;
int x = Board.MINWIDTH, y = b.getHeight();
while((y >= Board.MINHEIGHT) && full) {
while ((x <= b.getWidth() && full)) {
if (b.getPosition(x, y) == Counter.EMPTY) {
full = false;
}
x++;
}
x = Board.MINWIDTH;
... |
3ac822f9-24a9-4cc1-9c49-09516d599966 | 5 | private Element parseSwitch() throws ParserException, XMLStreamException {
String expression = getAttribute("expression");
startElement("switch");
List<Labelled> cases = new ArrayList<>();
Labelled defaultLabelled = null;
while (look().isStartElement()) {
String name = getNameOfStartElement();
if (name.... |
5b258dc0-ac5c-486c-ab6a-acf0b7b43b04 | 6 | public void run() {
InputStreamReader reader = new InputStreamReader(this.process.getProcess().getInputStream());
BufferedReader buf = new BufferedReader(reader);
String line = null;
while (true) {
try {
while ((line = buf.readLine()) != null) {
... |
745734d8-0e91-4bb0-9fc9-0f2e25e24062 | 9 | public Queue<String> fuerzasEspecialesXMLUnit (){
try {
path = new File(".").getCanonicalPath();
FileInputStream file =
new FileInputStream(new File(path + "/xml/papabicho.xml"));
DocumentBuilderFactory builderFactory =
DocumentBuilderFactory.newInstance();
... |
38e5dfae-0cca-4b4c-b997-bdcdb63d116c | 9 | @Override
public JSONArray execute(String xmlFilePath, String... inputValueList) throws Exception {
JSONObject xmlVarParam = new JSONObject();
JSONObject databaseParam = new JSONObject();
JSONArray returnValueArray = new JSONArray();
Document xmlDocument = null;
XmlControll... |
7cc11e30-9b47-47c7-8282-d6405e0631f4 | 9 | private void jTxtItemKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTxtItemKeyPressed
int i = jLstItems.getSelectedIndex();
switch (evt.getKeyCode()) {
case KeyEvent.VK_ESCAPE:
result = jTxtItem.getText();
target.replaceSelection(result);
... |
9081b3b8-7393-41de-9bfd-3af8034c095e | 4 | public List<bank> retriveBankinfo() throws SQLException{
List<bank> bankInfo=new ArrayList();
try{
databaseConnector=myConnector.getConnection();
stmnt=(Statement) databaseConnector.createStatement();
SQLQuery="SELECT * FROM familydoctor.bank";
... |
6d008d98-cd09-440b-b3b9-08ad5e2251e3 | 8 | @Override
public boolean isValidClassDivider(MOB killer, MOB killed, MOB mob, Set<MOB> followers)
{
if((mob!=null)
&&(mob!=killed)
&&(!mob.amDead())
&&((!mob.isMonster())||(!CMLib.flags().isAnimalIntelligence(mob)))
&&((mob.getVictim()==killed)
||(followers.contains(mob))
||(mob==killer)))
return t... |
1e0236ff-44e3-4d5a-87ee-5831754a4a95 | 6 | public static void backtrackSolve(Board b) {
List<Point> prev = new ArrayList<Point>();
for (int x = 0; x < 9; x++) {
for (int y = 0; y < 9; y++) {
if (!b.isFilled(x, y)) {
for (int i = b.get(x, y) + 1; i <= 10; i++) {
System.out.println(x + "," + y + "," + i);
if (i == 10) {
b.setNot... |
862b0e71-1c11-4243-9f9e-29b9988da50a | 9 | public Point getLocation() {
if (layout == Port.RELATIVE)
return new Point(rx, ry);
if (layout == Port.NORTH)
return new Point(parent.getWidth() / 2, 0);
if (layout == Port.EAST)
return new Point(parent.getWidth(), parent.getHeight() / 2);
if (layout == Port.WEST)
return new Point(0, parent.getHeigh... |
e41c595f-b649-47f3-ac1a-e4c49b24dd42 | 3 | private void quit() {
// Send quit message
try {
Message msg = new Message(true, COMMAND.EXIT, 0, "", new byte[1][0]);
objectToServer.writeObject(msg);
objectToServer.flush();
// Check for success or failure
if(!receiveAck()) {
System.out.println("Client:>>>No acknowledgement received from Se... |
64d91d99-aebb-4ff6-8565-c53ad629c7ca | 3 | public static int getNth(int n) {
int counter = 0;
int foundDevilNumber = 0;
do {
counter++;
String s = Integer.toString(counter);
CharSequence cs = "666";
if (s.contains(cs)) {
if (++foundDevilNumber == n) {
break;
}
}
} while (true);
return counter;
} |
9393e371-d62d-4375-a23f-b3c766d9b748 | 0 | @Override
public int update(Integer idMetier, Labo objetMetier) throws Exception {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
} |
6729045a-42fc-4f50-bebc-8bba2c91c269 | 3 | public static HashMap<Character, Integer> countCharacters(Scanner input)
{
String s;
HashMap<Character, Integer> map = new HashMap<Character, Integer>();
while (input.hasNext())
{
s = input.next();
for(char c: s.toCharArray())
{
Integer value = map.get(c);
if(value == null)
value = new... |
bc08dbcd-9210-4719-82ea-8e81da5c17f7 | 0 | public void setList(List<Problem> list) {
this.list = list;
} |
61eab93f-3c47-453c-ba75-fca6ed3a193c | 1 | public void emailAllUsers(String msg){
for(int i = 0; i<accountsCatalog.size(); i++){
accountsCatalog.get(i).sendEmail(msg);
}
} |
3576a4be-da29-4223-84c8-46432921c831 | 3 | public static void main(String[] args){
Scanner reader = new Scanner(System.in);
char loop = 'y';
while (loop == 'y'){
int[] itemNumber = {1,2,3,4};
double[][] itemArray = new double[2][4];
double[] unitValue = new double[4];
double bagMaxWeight = 0;//Maximum weight bag can hold defined by user
... |
b2efcfe6-b4a0-448b-98f0-10c5524db8a3 | 9 | private void forward() {
if (diskModeWrite && (via2CA == 0xff) &&
currentByte != -1 && sectorPos >= 0) {
bytesWritten++;
if (DEBUG) {
System.out.println("#### Write byte: " +
Integer.toString(currentByte, 16) + " ("
+ Integer.toString(gcrSector[sectorPos], 16) +
... |
d8e93506-7b62-4cd8-8b26-6fdccba0f139 | 0 | public VirtualConcatenateNode(Property property, PropertyTree parent,
Property part1,Property part2,String separator) {
super(property, parent);
this.part1=part1;
this.part2=part2;
this.separator=separator;
} |
f5eed759-6b2f-42cf-92b4-e384b3ad0f24 | 7 | public static String insertSpaceAtCaps(String string){
int uppers = 0;
//first we count
for(int i=0; i < string.length(); i++){
if(Character.isUpperCase(string.charAt(i))) uppers++;
}
int[] indexes = null;
if(Character.isUpperCase(string.charAt(0))){
indexes = new int[uppers];
} else {
in... |
041845e9-f0de-40e3-95d3-cdbf32d8ad9d | 6 | public static boolean isContiguous(List<Partition> partitions) {
if (partitions.size() == 0) {
return true;
}
// DCI: copied from python. Why again?
Partition lastPartition = partitions.get(partitions.size() - 1);
if (lastPartition.getStart() > lastPartition.getEnd()... |
5805a51c-61aa-4fa4-aa5e-ae26df54f208 | 5 | private void removeDevices(String[] devices) {
EntityManager mgr = null;
// Skip removing devices that have been registered very recently
// as the request to remove them may be obsolete
Calendar removalThreshold = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
removalThreshold.add(Calendar.HOU... |
65ee8197-ed56-4d48-b8f8-59258e24f0dd | 5 | public static String[] parseArgs(String[] args) {
String[] words = null;
if(args.length < 1) {
printHelpAndExit();
}
if(args[0].compareTo("train") == 0 ) {
STATE = "train";
} else if(args[0].compareTo("test") == 0 ) {
STATE = "test";
... |
b21d243f-d714-4fd7-950d-e82f49187468 | 7 | public boolean move(int[] sourceLocation, int[] destLocation) {
int x = round.getTurn() ? 0 : 1;
if ((model.getTabellone()[sourceLocation[0]][sourceLocation[1]] % 2) == x) {
for (int k = 0; k < model.getTabellone().length; k++) {
for (int l = 0; l < model.getTabellone()[k].le... |
966f58a3-81d2-42f2-a16a-0c1b3a87f5d9 | 1 | public void setNextDL(IntegerNode n) {
if (this.next == null){
this.next = n;
this.next.prev = this;
} else {
this.next.setNextDL(n);
}
count++;
} |
58ecc0fd-9107-4a2e-bf38-d9dab2560328 | 1 | public void setShowHeader(boolean visible) {
if (visible != mShowHeader) {
mShowHeader = visible;
notify(TreeNotificationKeys.HEADER, Boolean.valueOf(mShowHeader));
}
} |
65111284-a20d-4b9a-8456-87bf17627aab | 0 | public String getFeeCode() {
return FeeCode;
} |
d3c60425-89bd-42e2-b98a-79ff8878c379 | 8 | public Object makeDefaultValue(Class type)
{
if (type == int.class)
return new Integer(0);
else if (type == boolean.class)
return Boolean.FALSE;
else if (type == double.class)
return new Double(0);
else if (type == S... |
c9843ce9-a5ad-4f7f-99bc-7fb6826f3bf7 | 2 | public static void serverCommands() {
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
try {
String command = r.readLine();
do {
switchCommands(command);
} while (!(command = r.readLine()).contains("killall"));
r.clo... |
25b121dd-d066-4643-9b4d-06ddf17def8c | 8 | public void animation() {
animationt--;
if (animationt >= 45) {
setImage(hai);
}
else if (animationt < 45 && animationt >= 30) {
setImage(hai1);
}
else if (animationt < 30 && animationt >= 15) {
setImage(hai);
}
else if ... |
ce10714b-2bf2-4d8a-b1e6-7fe6cb0cc21d | 8 | protected void calcWidth(ParserNode p) {
FontMetrics fm = g.getFontMetrics();
if (p.isVar()) {
// Ako je cvor varijabla, na sirinu slike se dodaje sirina varijable
// i razmak do sljedeceg znaka.
picWidth += fm.getStringBounds(p.getName(), g).getWidth()
+ symbolSize / 5;
}
if (p.isOp()) {
if ... |
296ee502-fc41-4dff-8a1b-8822c64db32d | 2 | private void addCallbackMethod(String layoutFile, String callback) {
addToMapSet(callbackMethods, layoutFile, callback);
// Recursively process any dependencies we might have collected before
// we have processed the target
if (includeDependencies.containsKey(layoutFile))
for (String target : includeDepen... |
d5b70208-c87e-4970-9521-4ee31fa5cc88 | 4 | public boolean checkMemory(int memoryNeeded) {
long beginTime = System.currentTimeMillis();
int count = 0;
// try and allocate memory, but quit after ten tries.
while (!canAllocate(memoryNeeded, count > 0)) {
// cache files on memory check
boolean reducedSomething... |
ee3e069c-c7f7-4f2a-8efa-75854fd58ae5 | 9 | protected void updateResources(int resourceTypeId) {
if (getConfiguration().isGetResources()) {
/* TODO we should consider moving the services into the appropriate extension instead
* of all in the agent module. It should now be possible to rewrite them as agent
* extensions
*/
// Applications... |
4c7e2f3b-cf3e-4104-ba51-b08a6c151630 | 6 | @Override
public String solve(Cube cube) {
for (int j = 1; j < OLL.length; j++) {
String alg = OLL[j];
for (int i = 0; i < 4; i++) {
Cube cubeClone = cube.clone();
cubeClone.doAlgorithm(alg);
boolean correct = true;
for (List<TileColor> list : cubeClone.faces.get(3)) {
for (TileColor c : l... |
671fc2b8-2f5d-4f83-8840-d3fcab877358 | 1 | public void visitVarInsn(final int opcode, final int var) {
buf.setLength(0);
buf.append(tab2).append(OPCODES[opcode]).append(' ').append(var)
.append('\n');
text.add(buf.toString());
if (mv != null) {
mv.visitVarInsn(opcode, var);
}
} |
5ef8780a-2fce-4b3d-81b1-d9beaf803d07 | 7 | @Override
public boolean equals(Object o) {
if (o == this) {
return true;
} else if (!(o instanceof HashDataMessage)) {
return false;
} else {
HashDataMessage h = (HashDataMessage) o;
if (hashes.length != h.hashes.length) {
return false;
}
for (int i = 0; i < hashes.length; i++) {
if (h... |
9babaca4-ca5c-47fa-bf35-88d699527750 | 1 | @Override
public boolean shouldSkipClass(Class<?> clazz) {
return clazz.getAnnotation(DoNotSerialize.class) != null;
} |
dbee086d-c5d8-437b-ad4d-b3dde3211e64 | 8 | public void mutate() {
// work on card basis
for ( int i = 0; i < ga.getCardList().size(); i++ ) {
if ( Math.random() < 0.1 ) {
// find a seller with available stock
ArrayList<Integer> poolOfSeller = new ArrayList<Integer>();
for ( int j = 0; j < this.genome.length; j++ ) {
if ( this.availableSt... |
55a47eff-9ab8-41df-8235-3584e06ff258 | 7 | protected TokenizeResult TokenizerNormalizeStemmer(String source){
String[] tokens = Tokenizer(source); //Original tokens.
TokenizeResult result = new TokenizeResult(tokens);
//Normalize them and stem them.
for(int i = 0; i < tokens.length; i++)
tokens[i] = SnowballStemming(Normalize(tokens[i]));
L... |
0946cde0-a9cb-46b0-90c0-bce878778ac7 | 4 | @EventHandler
public void onBlockBreak(BlockBreakEvent event) {
Block b = event.getBlock();
if (b.getType() == Material.STONE_BUTTON || b.getType() == Material.STONE_PLATE || b.getType() == Material.WOOD_PLATE) {
if (settings.isSpawnBlock(b)) {
settings.removeBlock(b);
... |
57fffc60-387d-442a-be02-a679d0c9306f | 4 | public Tank(int x, int y, int type, int imageCode) {
super(x, y, type, imageCode);
switch(type){
case GO_LEFT:
rect = new Rectangle(x, y, (DEFAULT_WIDTH_L*2), (DEFAULT_HEIGHT_L*2)+10);
colliBound = new Rectangle(x-10, y, (DEFAULT_WIDTH_L*2)+20, (DEFAULT_HEIGHT_L*2)+10);
break;
case GO_RIGHT:
rect = ... |
8c0adcee-7fea-4f9e-8b1d-32a22eb87dcd | 3 | public void saveScheduleVector() {
String savePath = new Control_GetPath().getStreamRipStarPath();
XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
try {
XMLEventWriter writer = outputFactory.createXMLEventWriter(
new FileOutputStream(savePath+"/Scheduls.xml" ), "UTF-8" );
XMLEven... |
d522f040-f947-4510-9229-7f2f71b5a7de | 0 | public static ArrayList <Year> getYears()
{
return years;
} |
f4e6467a-dc50-429f-a514-90fdb0bbd9d9 | 4 | private int[][] pasaArregloAMatrizBelow(int[] c0, int[] c1, int[] c2, int[] c3) {
int[][] res = new int[4][4];
int m = 0;
int k1 = 3;
while (m < 4) {
res[k1][0] = c0[m];
k1--;
m++;
}
int n = 0;
int k2 = 3;
while (n < 4) {
res[k2][1] = c1[n];
k2--;
n++;
}
int o = 0;
int k3 = 3;
... |
bc359c19-a97d-474f-976e-ff9e1a834f94 | 3 | void drawStageSelector(StageSelector stageSelector)
{
Graphics graphics = startGraphics();
//stageSelector.draw(graphics);
graphics.drawImage(stageSelector.getImage(), stageSelector.getX(), stageSelector.getY(), frame);
for (GameObject stageObjects : stageSelector.getStageSelectorOb... |
32579364-6603-4af6-9811-ad97993aa324 | 9 | public static List<File> copyFiles(final Set<File> files, String destinationPath)
throws Exception
{
_newFiles = new LinkedList<File>();
//Create directory if it doesn't exist
File directory = new File(destinationPath);
_path = destinationPath;
_files = files;
if(!direc... |
2025839d-ba77-4e1a-9f08-1cd61cd4c7bb | 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... |
fc4f97ee-1755-4fff-9a02-d085f18e411e | 2 | public Process find(long id) // Find process in the queue.
{
Process current = peek();
if(current != null){
if (current.getId() == id)
return current;
else
current = current.next;
}
return current;
} |
33cefb12-19e1-4379-b350-aa9d1ab23f2b | 7 | 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 fe... |
253f26f4-7818-455b-9f7c-a1228293b312 | 3 | public static Delegate defun(Object[][] args, DelegateBody body) {
final NonLocalClosure<Object[][]> arguments = closeOverNonLocal(args);
final NonLocalClosure<DelegateBody> fn = closeOverNonLocal(body);
return new DynamicDelegateBase() {
Hashtable<Integer, String> reference;
@Override
protected ... |
e427dee2-47a5-4847-a7e0-cc26c768eabb | 4 | public void remove(int i) {
if (i < length) {
Node<T> ele = _head;
if (i == 0)
_head = ele.getNext();
else {
for (int x = 0; x < i - 1; x++)
ele = ele.getNext();
if (i == length - 1) {
ele... |
0ecc18f5-d390-465f-b375-c4306f1442ca | 6 | public BookType getBookType(String typeName) {
BookType ret = null;
Connection conn = null;
Statement st = null;
ResultSet rs = null;
try {
conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/librarysystem?user=admin&password=123456");
st=conn.createStatement();
//Select the book type
r... |
9d639d96-7438-4443-99f9-56387c57a9c9 | 6 | private void actualizarLista() {
abrirBase();
tablaArtDefault.setRowCount(0);
Iterator<Articulo> it = listArticulos.iterator();
while (it.hasNext()) {
Articulo art = it.next();
Object row[] = new String[6];
row[0] = art.getString("codigo");
... |
9f08188b-7ba6-440c-bd4c-9332f0cce93b | 3 | private int getDefaultEvent() {
PreparedStatement st = null;
ResultSet rs = null;
try {
conn = dbconn.getConnection();
st = conn.prepareStatement("SELECT * FROM events order by start_date desc limit 1");
rs = st.executeQuery();
if (rs.next()) {
... |
8ba7c0d6-33c5-4bf7-b4e4-1513577f0c2f | 7 | public void step() {
final Map<Particle, Future<?>> futures;
futures = new HashMap<Particle, Future<?>>();
final AbstractModel model = this;
for (final Particle p : this.p) {
futures.put(p, pool.submit(new Runnable() {
@Override
public void run() {
p.interact(model);
}
}));
}
for(P... |
bc5ea466-bf1e-4e33-8f70-7228021c8217 | 5 | private void addFilterDatabase()
{
List<Name> names = getBuiltInNames();
Name n = null;
for( int i = 0; (i < names.size()) && (n == null); i++ )
{
if( (names.get( i )).getBuiltInType() == Name._FILTER_DATABASE )
{
n = names.get( i );
}
}
if( n == null )
{ // not present
try
{
n = n... |
926e834b-d10c-4523-8258-7a78be3c3460 | 2 | @Override
public int compare(Player a, Player b) {
return a.hand.highCard.value < b.hand.highCard.value ?
-1 : a.hand.highCard.value == b.hand.highCard.value ? 0 : 1;
} |
e25f671e-0673-4ba0-8c12-393918eef048 | 3 | public ReservationStatus queryReservation(int reservationId) {
Reservation reservation = getReservation(reservationId);
if(reservation == null) {
logger.info("Error querying reservation, ID is invalid");
return ReservationStatus.UNKNOWN;
}
int resId = reservation.getResourceID();
... |
e5707ff9-3b09-40c4-b661-3dac105f4a36 | 9 | protected static void parseStep(char[] chars, int charIdx, List<String> terms, StringBuilder token, int parenDepth) throws ParseException {
if (charIdx == chars.length) {
if (token.length() > 0) {
terms.add(token.toString());
}
return;
}
char c... |
b9442892-76c6-450d-98f7-392b6e326324 | 2 | public void writeNibbleArray(byte[] v) throws IOException
{
final int size = v.length;
final int byteCount = NBTInputStream.ceilDiv(size, 2);
final byte[] data = new byte[byteCount];
this.writeInt(size);
for (int nibbleIndex = 0, byteIndex = 0, bitIndex = 1; nibbleIndex < size; nibbleIndex++)
{
int k1... |
afe6e7ec-f6af-4f47-89e6-11954ff8c609 | 5 | public static Object unpack(final byte[] serializedObject) {
final ByteArrayInputStream bytesArrayInputStream = new ByteArrayInputStream(serializedObject);
ObjectInput objectInput = null;
/* Object after restoration */
Object object = null;
try {
objectInput = new O... |
301562d2-c26a-4b99-959d-a94752ab2ad0 | 6 | public static boolean registerIcon(String key, String path) {
InputStream image = Library.getWorkingClass().getResourceAsStream(path);
if (key != null && path != null && !key.equals("") && !path.equals("")){
try {
ImageIcon icon = new ImageIcon(ImageIO.read(image), path);
if (icon != null) {
keyToIc... |
d5bbefe7-7b3a-4819-a91f-32061afc3c2d | 8 | public double getRanking() {
double ranking = 0;
if (isStraightFlush() > 8.0) {
ranking = isStraightFlush();
} else if (isFourOfAKind() > 7.0) {
ranking = isFourOfAKind();
} else if (isFullHouse() > 6.0) {
ranking = isFullHouse();
} el... |
69898c9d-c8de-46f9-b8c1-41ce120029c5 | 4 | @Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
if(this._exp_ == oldChild)
{
setExp((PExp) newChild);
return;
}
for(ListIterator<PExpAux> i = this._expAux_.listIt... |
f4533089-5bb7-4a85-8c1d-ba7b579ab1e9 | 1 | private URL _getPath(String path) throws GongmingConnectionException {
URL queryURL = null;
try {
queryURL = new URL(this.protocol, this.host, this.port, path);
} catch (MalformedURLException e) {
e.printStackTrace();
}
return queryURL;
} |
256d0252-7e70-449e-9cd7-e02e8239c670 | 7 | public void write (Kryo kryo, Output output, Collection collection) {
int length = collection.size();
output.writeInt(length, true);
Serializer serializer = this.serializer;
if (genericType != null) {
if (serializer == null) serializer = kryo.getSerializer(genericType);
genericType = null;
}
if (seria... |
8ebe3dde-e741-4787-be63-5246e2288692 | 6 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder out = new StringBuilder();
int nCases = Integer.parseInt(in.readLine().trim());
for (int nCase = 0; nCase < nCases; nCase++) {
in.readLine();
if (nCase != 0)
... |
7e62ba24-6fad-47eb-939d-9e386294d7a5 | 5 | private void dataToMovie(String key, String value) {
if (key.toString().equals("title"))
movie.setTitle(value);
if (key.toString().equals("genre"))
movie.setGenre(value);
if (key.toString().equals("year"))
movie.setYear(value);
if (key.toString().equals("director")) {
String[] director = value.split... |
fb4664c0-be78-46a6-8a4c-83e329e75b17 | 1 | public List<String> generateLetters(){
List<String> letters = new ArrayList<String>();
for (Dice<String> die : shuffleDice()) {
letters.add(die.roll());
}
return letters;
} |
5df618fb-ff16-4fc2-81fd-f923232141d7 | 5 | public void tick() throws RemoteException {
ViewInfo currentView = service.ping(viewInfo.view, serverName);
if (viewInfo.primary.equals(serverName) && !currentView.backup.equals(viewInfo.backup) && !currentView.backup.isEmpty()) {
viewInfo.set(currentView);
try {
... |
d157da7e-2199-4c78-aa31-c35a77a60889 | 7 | @Override
void pack(Object i, Buffer opb) {
InfoFloor1 info = (InfoFloor1) i;
int count = 0;
int rangebits;
int maxposit = info.postlist[1];
int maxclass = -1;
/* save out partitions */
opb.write(info.partitions, 5); /* only 0 to 31 legal */
for (in... |
1b23613b-e407-4883-be2f-a4b7fca5e37b | 2 | private void drawTitleScreen() { // drawLogo
byte buf[] = titleArchive.get("title.dat");
Sprite sprite = new Sprite(buf, this);
leftFlameCanvas.initDrawingArea();
sprite.drawFlippedSprite(0, 0);
rightFlameCanvas.initDrawingArea();
sprite.drawFlippedSprite(-637, 0);
... |
26313e45-31f3-4835-89ea-0fbc8a3b9799 | 4 | private String[] getLeftPossibleWords(String origin){
List<String> result=new ArrayList<>();
// result.add(origin);
for(int i=1;i<origin.length();++i){
if(isPalindrome(origin.substring(0,origin.length()-i))){
result.add(origin.substring(origin.length()-i));
... |
cfc78f04-5000-46bc-a554-c92db30fa55c | 2 | private List<String> splitToList() {
List<String> split = new ArrayList<String>();
for (currChar = 0; currChar < toSplit.length(); currChar++)
if (toSplit.charAt(currChar) == splitAbout)
return nextIteration(split);
split.add(toSplit);
return split;
} |
6aa396a5-ed11-4a66-b948-ebfc5149e389 | 4 | private void checkRowOfNeighbours(Rectangle removedCardArea,
int rowCurrentlyChecking, int rowNumberOfRemovedCard) {
/*
* helper for Stage 7 (20 Marks)
*/
for (int i = 0; i < cards[rowCurrentlyChecking].length; i++) {
if (cards[rowCurrentlyChecking][i] != null
&& cards[rowCurrentlyChecking][i].getC... |
9cf2677f-9935-41cc-bca7-8193f91fe207 | 3 | public Hex getHexAt(int i, int j) {
for(Hex h: hexList)
if(h.getI() == i && h.getJ() == j)
return h;
return null;
} |
20a13488-74b7-46ea-a2a4-3386fd9675cf | 4 | public boolean isFlipH() {
switch (tileFlip) {
case H:
case HD:
case HV:
case HVD:
return true;
default:
return false;
}
} |
6015adf4-b7b9-4526-b9b3-a3ed2060d216 | 6 | @Override
public int hashCode() {
int result;
long temp;
temp = openPrice != +0.0d ? Double.doubleToLongBits(openPrice) : 0L;
result = (int) (temp ^ (temp >>> 32));
temp = closePrice != +0.0d ? Double.doubleToLongBits(closePrice) : 0L;
result = 31 * result + (int) (te... |
553ba58e-ea1c-4af1-b5e7-3a3449bdaa54 | 9 | protected void showAtMouse(int x, int y)
{
if (mainParentComp == null)
return; // Not showing
boxX = OFFSET_X + x;
boxY = OFFSET_Y + y;
// Remember for next time
mousePosAtWinShowX = x - parentX;
mousePosAtWinShowY = y - parentY;
// Goals:
// - Don't have ... |
18425b67-4cbe-43d3-ac97-e946ef1ca92f | 8 | public void run(){
Misc.println("[Socket] New client on IP " + RemoteIP + "! Thread ID: " + ThreadID + ".");
try {
inFromClient = new BufferedReader(new InputStreamReader(socket.getInputStream()));//Get Input
outToClient = new DataOutputStream(socket.getOutputStream());//Get Output
sendLoginInformation();/... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.