method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
bc4544b5-e121-42b9-b979-5c22ec4d6f31 | 3 | private void loop()
{
Thread thTmp = Thread.currentThread();
byte[] arrBytes = new byte[EzimNetwork.inBuf];
DatagramPacket dp = new DatagramPacket(arrBytes, arrBytes.length);
while(! thTmp.isInterrupted())
{
try
{
this.ms.receive(dp);
final InetAddress iaAck = dp.getAddress();
final Stri... |
6a80f93c-7e98-4476-b1b9-9c98becfe8d9 | 6 | public static boolean isPrime(long n) {
if (n <= 3) {
return n > 1;
} else if (n % 2 == 0 || n % 3 == 0) {
return false;
} else {
for (int i = 5; i * i <= n; i += 6) {
if (n % i == 0 || n % (i + 2) == 0) {
return false;
... |
28424f1c-f6a7-420e-9406-561306e7d5ef | 8 | private HashMap<Block, HashSet<Integer>> calculateGlobalLiveSpan(ArrayList<Block> leafnodes) {
HashSet<Block> allBlocks = new HashSet<Block>();
Queue<AbstractMap.SimpleEntry<Block, HashSet<Integer>>> queue = new LinkedList<AbstractMap.SimpleEntry<Block, HashSet<Integer>>>();
for (Block node : leafnodes) {
que... |
f3ffca29-c52a-41ab-b216-97c797768457 | 0 | public FileEntryNotFoundException(Exception e, String name)
{
super(e, name);
} |
8c758a5e-9ccb-4003-862c-e825cd66e549 | 3 | public static boolean isInc(List<ObjFunc> ofs) {
if (ofs.isEmpty()) {
throw new IllegalArgumentException("No Objective function(s) defined. ");
}
boolean inc = ofs.get(0).getOF().positiveDirection();
for (ObjFunc of : ofs) {
if (of.getOF().positiveDirection() != i... |
a5cdf790-5e1e-4b56-88b7-80042ed5bd3f | 0 | @Override
public String getDef() {return String.valueOf(def);} |
d94e0961-6130-4478-919b-022ca9e03973 | 6 | public void combineUnaryInput() {
if (left instanceof LvalExpression &&
((LvalExpression) left).hasUnaryInput()) {
if (((LvalExpression) left).unaryInputIsNotResult()) {
// input is result of Not gate - combine in to this gate
op = ((PrimitiveOperator) op).negLeft();
}
// input is result of I... |
be0160eb-aebb-45e0-a4bf-e7ea168d5553 | 3 | public static Fichier genererImage(byte[] donnees, String type, int largeur, int hauteur) throws ChampInvalideException {
if (type != null && type.indexOf("image") == 0 && estUneImage(donnees))
return genererFichier(redimensionnerImage(donnees, largeur, hauteur), type);
else
thro... |
79eb8c57-0f88-448c-bda7-c96e7eb59382 | 6 | private final synchronized boolean applyDeletes() throws CorruptIndexException, IOException {
assert testPoint("startApplyDeletes");
flushDeletesCount++;
SegmentInfos rollback = (SegmentInfos) segmentInfos.clone();
boolean success = false;
boolean changed;
try {
changed = docWriter.applyDe... |
fe91904f-3577-40ff-a286-101468ebfc0c | 0 | @Override
public String[] getHelp() {
return new String[]{
"ttp world <worldname> [actions..]",
"World interface"
};
} |
5d1add7e-9ca7-4553-8e67-982a22651a31 | 9 | private void genProbMats(){
clsMap_cls.addAll(this.cls_map.keySet());
clsMap_count.addAll(this.cls_map.values());
ArrayList<cls_cls> keys1 = new ArrayList<cls_cls>(this.cls_cls_map.keySet());
for(int i = 0; i < keys1.size(); i++) {
clsClsMap_cls1.add(keys1.get(i).getCls1());
clsClsMap_cls2.add(keys1.ge... |
c8e651d0-37e1-42a8-83f1-eec965e4d12b | 5 | public void delete(T entity) throws Exception{
String sql = "delete from " + entity.getClass().getSimpleName().toLowerCase() + " where ";
//存放字符串为"id"的字段对象
Method idMethod = null;
//取得字符串为"id"的字段对象
List<Method> list = this.matchPojoMethods(entity, "get");
Iterator<Metho... |
c99493f7-2c95-497e-a12f-de6376375d1a | 6 | public static void removeFeatures(FeatureContainer fc, FreeColObject fco) {
FeatureContainer c = fco.getFeatureContainer();
if (fc != null && c != null) {
for (Entry<String, Set<Ability>> entry : c.abilities.entrySet()) {
Set<Ability> abilitySet = fc.abilities.get(entry.getKe... |
6f9fe360-7cc3-4414-852e-1d47affdaabc | 9 | public static void main(String[] args) throws IOException {
File inputFile = new File("entradaA");
if (inputFile.exists())
System.setIn(new FileInputStream(inputFile));
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder out = new StringBuilder();
String line;
while ((... |
3fc2594a-f082-4fad-b73a-1b7e6b41e444 | 8 | @Override
public void onCommand(POP3Session session, String argument1,
String argument2) throws POP3Exception {
// 检查会话是否合法
if (session.getState() != POP3State.TRANSACTION) {
throw new POP3Exception("-ERR auth first");
}
// 检查参数数量是否合法
if (argument1 == null || argument2 != null) {
throw new POP3Exce... |
9d01d030-4f3a-48b0-b49f-aed0b231944b | 4 | public static void main(String[] args) {
String unitName = args.length == 0 ? "jpademo" : args[0];
JPAQuery program = new JPAQuery();
// Do i/o initializations before JPA to fail fast
program.init();
System.out.println("JPAQuery.main() -- starting JPA " + unitName);
// This would be done for you
// ... |
6b5dcdfd-5673-4115-ae4e-3c2a55e1be37 | 6 | public void addProduct(Product p)
{
boolean categExists = false;
for(GenericPair<Category, HashMap<String, LinkedList<Product>>> itr : fullmap) {
if(itr.getFirst().getName().equals(p.getCategory().getName()))
categExists = true;
}
if(!categExists) {
HashMap<String, LinkedList<Product>> h = new Ha... |
606acf15-c184-48d9-a02d-6624c05bc18d | 2 | @Override
public void mousePressed(MouseEvent evt) {
if (evt.getSource().equals(slider)) {
if (evt.getButton() == MouseEvent.BUTTON1) {
startPointX = (int) (evt.getX());
}
}
} |
3848344d-6a9f-439f-a689-6211f015d81c | 3 | public void setCurrentState(final String name) {
for (final IGameState state : states) {
if (name.equals(state.getName())) {
if (currentState != null) {
currentState.stop();
}
state.start();
currentState = state;
return;
}
}
System.err.println("State not found : " + name);
} |
139853b8-033b-49de-9bff-4126149bb4df | 3 | private questionNode create(questionNode previous, questionNode current) { //recursive tree building method
try {
if(!fReader.hasNextLine())
return null;
if(fReader.nextLine().equals("Q:")) { //creates new questionNode for a question and it's children
current = new questionNode(fReader.nextLine(), previ... |
128c3ed5-58fc-4430-adce-52d714530c18 | 1 | private void doSpecialistStuff(Patient patient) {
HospitalPart part = random.getSpecialist();
LinkedBlockingDeque<Patient> q = doc_queues.get(part);
q.add(patient);
log("enter " + part + " Q", clock, patient, part.toString(), q.size());
if (q.size() > max.getMaxQ()) {
max.setMaxQ(q.size());
max.setHp(pa... |
31e90ed2-9f63-4d2e-8564-29d6d83493e4 | 7 | public boolean nextTurn() {
// before starting next turn, do the following
// update monuments to indicate if it was the first one built
for (int m = 0; m < getPlayer(0).getMonumentsPlayerHas().length; m++) {
if ((!(getPlayer(currentplayer).getMonument(m)
.getOtherPlayerHasFinished()))
&& (getPlayer(... |
6eb15db4-5a93-490d-ac7e-e3a8c135ea99 | 1 | public static MyConnection getInstance() {
if(instance==null)
instance = new MyConnection();
return instance;
} |
4736bd26-cf9e-413a-86a3-ed36821442c8 | 0 | public void setHeight(double _height) {
height = _height;
} |
afe75514-fb4c-409a-ba02-afc64700ed15 | 2 | public Object opt(int index) {
return (index < 0 || index >= this.length()) ? null : this.myArrayList
.get(index);
} |
199b52e9-62d9-4613-a5ce-96d5917df321 | 3 | @Override
public Class getColumnClass(int column) {
Class returnValue;
if ((column >= 0) && (column < getColumnCount())) {
if (getValueAt(0, column) == null) {
return Object.class;
}
returnValue = getValueAt(0, column).getClass();
} else {
... |
b476ebe3-ad31-47aa-b5c0-6cc155a41d57 | 6 | public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(args.length == 1)
{
if(sender instanceof Player)
{
Player player = (Player) sender;
if(plugin.token.contains("token." + args[0]))
{
if(player.hasPermission("MasterPromote.... |
93c8d9e8-d5c6-49b0-9e8c-025531dccc29 | 2 | public printDoc(JTextArea e){
try{
boolean complete = e.print();
if (complete){
JOptionPane.showMessageDialog(null,"Done Printing","Information", JOptionPane.INFORMATION_MESSAGE);
}else{
JOptionPane.showMessageDialog(null,"Printing","Printer",J... |
055f6ec2-a74f-4bfe-85db-eafd2868df75 | 8 | @Override
public void merge(MCUBlockHolder holder) {
int mcuCounter = 0;
while (mcuCounter < holder.yComponentsZZ.length){
int offsetX = 0;
int offsetY = 0;
int cy = 0;
if (x >= width) {
x = 0;
y += incrBlock;
... |
a62f2cf8-5b1f-4009-809a-f5629de6004e | 1 | public boolean isBST() {
int[] array = new int[this.nodeCount];
addToArray(this.root, array, 0);
if (arrayInOrder(array, 1)) {
return true;
}
return false;
} |
8ee50b1b-a465-4c32-bbed-1e48b4990a3b | 3 | public void act(){
if (show){
if (counter >= 2){
counter = 0;
frame++;
if (frame > maxFrame){
frame = 1;
}
this.setImage (cache[frame-1]);
}
else{
counter++;
... |
7698a222-4a84-47c9-a2b9-35647e08bf98 | 5 | private void loadConfig() {
if (!(new File(this.getDataFolder(), "plugin.yml")).exists()) {
for (String[] defaultSet : this.defaultConfigValues) {
if (isInteger(defaultSet[1]))
this.getConfig().set(defaultSet[0], Integer.parseInt(defaultSet[1]));
else
this.getConfig().set(defaultSet[0], defaultSe... |
d6a3bace-8efa-482e-9b29-21511b2066c5 | 6 | public HashMap<String, Double> getAccounts() {
HashMap<String, Double> accounts = new HashMap<String, Double>();
Connection conn = null;
ResultSet rs = null;
PreparedStatement ps = null;
try
{
conn = iConomy.getiCoDatabase().getConnection();
ps = conn.prepareStatement("SELECT * FROM ... |
499e10c5-6ab0-43d5-8a0a-0a560b02d976 | 5 | private PairNode<T> compareAndLink( PairNode<T> first, PairNode<T> second )
{
if( second == null )
return first;
if( second.element.compareTo( first.element ) < 0 )
{
// Attach first as leftmost child of second
second.prev = first.prev;
first.prev = second;
... |
5d96ecf0-34e0-4a25-b10d-d6f2146efe5a | 5 | @Override
public String decryptage(String texte)
{
String texteDecrypte ="";
int positionDansCle = 0;
int caractereAAjouter = 0;
int codeAsciiDeA = this.convertisseur.codeAsciiDuCaractere('A');
for (int lettreCourante = 0; lettreCourante < texte.length(); lettreCourante++)
{
int lettre = th... |
debe46bb-8b38-4753-b0a0-b1e80ff6ca09 | 2 | public boolean alterar() {
EntityManager em = conectar();
try {
System.out.println("Aqui: "+ dataHora + " - "+idExame + " - "+ idMedico +" - "+idPaciente);
AgendaPK agendaPK = new AgendaPK(dataHora, idMedico, idExame, idPaciente);
Agenda agenda = em.find(Agenda.class,... |
e0a4a6c5-ee10-4a39-8e02-dd54234f4190 | 9 | @Action
public void computersTurn() {
Player ComputerObject = GameObject.getComputer();
Player HumanObject = GameObject.getHuman();
if (HumanObject.getResult() >= 17) {
Object[] options = {"Close", "New game"};
int OptionIndex = 0;
Card ... |
b0bac44d-1a44-4b25-98c9-0a9ebaff1832 | 8 | public int run() {
reset();
draw();
boolean finished = false;
while(!finished){
String option = getInput();
if (option.equals("<")) {
finished = true;
}
if (option.equals("c")) {
listAllProducts = false;
listBox.setLine(1, " | | List all products (a)");
listBox.setLine(2, " |X| List ... |
35bcd91d-e0b3-4ab1-be14-67ae66161247 | 6 | public void endTestSuite(JUnitTest suite) throws BuildException {
rootElement.setAttribute(ATTR_TESTS, "" + suite.runCount());
rootElement.setAttribute(ATTR_FAILURES, "" + suite.failureCount());
rootElement.setAttribute(ATTR_ERRORS, "" + suite.errorCount());
rootElement.setAttribute(ATTR_TIME, ""
+ (suite.g... |
13c47787-94ca-40ba-9280-f37646971e6f | 4 | public int[][] getObsticleMap() {
if (obsticalMap == null) {
int[][] tmp = new int[map.length][map[0].length];
for (int y = 0; y < map.length; y++) {
for (int x = 0; x < map[0].length; x++) {
tmp[y][x] = map[y][x] != 1 ? 0 : 1;
}
}
obsticalMap = tmp;
}
return obsticalMap;
} |
920885cf-98d4-4ff4-af1a-5e8e5ddd3b04 | 4 | public void handleIConnectionEvent(IConnectionEvent event) {
log.log(Level.FINE,"Handling Event:"+event);
for(EventHandler<IConnectionEvent> iceh : IConnectionEventHandlerList) {
try {
iceh.HandleEvent(event);
} catch(NoSuchMethodException e) {
System.err.println("The IIConnectionHandlerEventHandler "... |
ef7ef642-ec95-4bf8-8961-06ec50961c86 | 1 | public void setHead(Head head) {
if(this.head != null){
this.head.setUsed(false);
}
this.head = head;
this.head.setUsed(true);
} |
348340e3-f76f-42be-aa14-f76bc49d6a24 | 5 | int roll(Token type, int count) {
int result = 0;
int number = get(type) - count;
if(number<=0)
return 0;
int succes = 5;
if(get(Token.Bless)!=0)
succes = 4;
if(get(Token.Curse)!=0)
succes = 6;
for(int i=0; i<number; i++)
{
int r = Roll.dice(1, 6);
if(r>=succes)
result++;
}
return... |
4697af78-e603-4e7b-bcd5-db38234de7b6 | 0 | @Override
public int attack(double agility, double luck) {
System.out.println("I tried to do a special attack but I haven't set it so I failed at this turn...");
return 0;
} |
3ef3819a-e961-4e98-b880-5a78a813f637 | 3 | private boolean validFirstMove(List<Location> wordPlayed){
for(Location loc : wordPlayed){
if(loc.getX() == CENTER.getX() &&
loc.getY() == CENTER.getY()){
return true;
}
}
System.out.println("First word must go through the center of the board.");
return false;
} |
69171c97-1f22-4f0d-b141-62eb9b4e12c0 | 9 | @EventHandler(priority = EventPriority.HIGH)
public void onGeneration(ChunkPopulateEvent event){
if (config.getBoolean("Features.extraDungeonLoot") == true){
BlockState[] tileEnts = event.getChunk().getTileEntities();
for (BlockState state : tileEnts) {
if (state.getType() != Material.CHEST){
continue... |
0ff03bd5-1979-45b5-867e-4c6537b4490e | 0 | public void disable() {
set(0);
_controller.disable();
} |
8a9cffee-cd09-4150-85d1-ca80269f0cbc | 9 | private void runOutput(Boolean outputCounts, Boolean outputDistances) {
// We must process the work in a separate thread to update the UI.
SwingWorker worker = new SwingWorker<Void, Void>() {
@Override
public Void doInBackground() {
Date started ... |
71293d23-48f6-4e5b-b946-0568beaa886c | 5 | public void updateTileRenderList(World world)
{
tilesToRender.clear();
for(Tile tile : world.getTileList())
{
Vector2f c = tile.getCoords().copy().scale(64);
if((c.x >= (cLoc.x - (cameraWidth / 2) - tileSize) || c.x <= (cLoc.x + (cameraWidth / 2) + tileSize))
|| (c.y >= (cLoc.y - (cameraHeight / 2) - ... |
58b40805-b9ed-4be4-a33f-6c47c71dedab | 2 | @Test
public void test() {
for(User user : users) {
if(!MongoHelper.save(user, "users"))
TestHelper.failed("save failed");
System.out.println("saved user id: " + user.getId() + " " + user.toString());
}
TestHelper.passed();
} |
3c1031b7-116f-46e8-b1d6-ac4d897bb4b3 | 9 | public void trainModel()
{
costHistory = new double[numIter];
double sum[] = null;
int k = 0;
// for(int k = 0; k < numIter; k++)
while(true)
{
sum = new double[theta.length];
for(int i = 0; i < numSamples; i++)
{
for(int j = 0; j < theta.length; j++)
... |
1b8019ff-7011-4373-8c14-a7c5cc7e8557 | 3 | public void commandAction(Command c, Displayable d) {
if (c == cmdParse) {
disp.setCurrent(loadingDialog);
Thread th = new Thread(this);
th.start();
}
if (c == cmdinfo) {
//form.append("Informations Voyage: \n");
form.append(showAnnonc... |
39bb1d3d-c155-4d96-8ca4-281e69e66601 | 5 | public String getFullTime12(){
int hourI = cal.get(Calendar.HOUR);
int amPm = cal.get(Calendar.AM_PM);
this.fullTime12 = (new Integer(hourI)).toString();
int minI = this.getMinute();
if(minI<10){
this.fullTime12 += ".0" + minI;
}
else{
thi... |
b94502f9-0d58-4ad7-84f2-1e2b1aa20d2d | 4 | @Test
public void askForExistingRecipeTest() {
userInput.add("hello");
userInput.add("my name is meng meng");
userInput.add("can you help me with hamburger");
userInput.add("which country is it from");
userInput.add("which ingredients do i need");
userInput.add("what is the first ingredient");
userIn... |
f475c3d2-53f4-447c-b9e9-9e2ae413ff8e | 6 | public void load() {
Frame frame = new Frame();
FileDialog fileDialog = new FileDialog(frame, "open", FileDialog.LOAD);
fileDialog.setVisible(true);
filePath = fileDialog.getDirectory();
fileName = fileDialog.getFile();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
Vector<Track> ... |
df1d4407-e9d4-4768-bbce-2623ac0dfb60 | 3 | @Override
public int compareTo(Command other) {
int result = getTitle().compareTo(other.getTitle());
if (result == 0) {
int hc = hashCode();
int ohc = other.hashCode();
if (hc > ohc) {
return 1;
}
if (hc < ohc) {
return -1;
}
}
return result;
} |
d2e2dd49-061c-47c6-947e-94b2e2b8816b | 7 | Point3f getFaceCenter(byte face) {
if (faceCenter == null)
faceCenter = new Point3f();
switch (face) {
case FRONT:
faceCenter.set(center.x, center.y, getMaxZ());
return faceCenter;
case REAR:
faceCenter.set(center.x, center.y, getMinZ());
return faceCenter;
case TOP:
faceCenter.set(center.x,... |
a7cac59c-3ae7-4e6a-b511-648b88876f3f | 2 | @Override
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
if (qName.equals("rowset")) {
contactList = new ContactList();
contactList.setName(getString(attrs, "name"));
}
if (qName.equals("row")) {
EveContact contact = new EveContact();
cont... |
f7724780-1627-48ca-b4ed-112709abdcf1 | 2 | public static void main(String[] args){
System.out.println("Calculate S from Theta and Radius. R < 0 to quit.");
while(true){
Scanner scanner = new Scanner(System.in);
System.out.println("Enter T:");
double t = scanner.nextDouble();
System.out.println("Enter R:");
double r = scanner.nextDouble();
... |
3aac482a-597c-4c16-807b-daa68d2ee049 | 0 | public Position() {
init();
} |
3e3c842f-61a2-4d6c-b41d-1c314defdbdb | 5 | final void method807(ByteBuffer class348_sub49) {
aClass197_1418 = new Class197();
aClass197_1418.method1452(class348_sub49);
aClass197_1408 = new Class197();
aClass197_1408.method1452(class348_sub49);
int i = class348_sub49.getUByte();
if (i != 0) {
((ByteBuffer) class348_sub49).position--;
aClass197_1... |
a27a0a51-ec33-458c-a82f-6cb1659494ed | 1 | public List stepBlock(TMConfiguration config){
EDebug.print("Inside StepBlock");
while (((TuringMachine)(config = (TMConfiguration) stepConfiguration(config).get(0)).getCurrentState().getAutomaton()).getParent() != null);
return Arrays.asList(config);
} |
16b6c478-c0cb-4615-a189-a40cca9f64b7 | 0 | private void setOpenHour(){
int a=0,b=0;
boolean c=true;
//Clinic.setOpenHour(a,b,c);
} |
d51de413-881c-4199-b5d9-174e35e03a3e | 3 | private Entry<K,V> getEntry(Object key) {
Entry<K,V> p = root;
K k = (K) key;
while (p != null) {
int cmp = compare(k, p.key);
if (cmp == 0)
return p;
else if (cmp < 0)
p = p.left;
else
p = p.right;
... |
d8578d5c-8355-43a1-b192-c2b9b3ec5e5f | 5 | static private void processDArray(DodsV dodsV) {
DArray da = dodsV.darray;
Enumeration dims = da.getDimensions();
while (dims.hasMoreElements()) {
DArrayDimension dim = (DArrayDimension) dims.nextElement();
dodsV.dimensions.add(dim);
}
dodsV.makeAllDimensions(); // redo
BaseType ele... |
ec5ba454-4d2e-4b22-84a8-a7c3e3e39f91 | 1 | private String closeAlertAndGetItsText() {
try {
Alert alert = driver.switchTo().alert();
String alertText = alert.getText();
if (acceptNextAlert) {
alert.accept();
} else {
alert.dismiss();
}
return alertTex... |
9367cd20-100d-4b40-8627-998d318192a2 | 1 | public String toString() {
return this.mode == 'd' ? this.writer.toString() : null;
} |
05997956-0e2d-4e76-ab8d-5c06e8abdb9c | 4 | @Test
public void testThrowExceptionOnReceiveIfClosed() {
try {
consumer = new AbstractMessageConsumer(mockTopic) {
};
assertNotNull("No subscription was made",
mockTopic.getTopicSubscriber());
FutureTask<Message> f = getMessageFuture(consumer);
consumer.close();
Message m = f.get(200, TimeUn... |
b2755f5f-36b4-4be5-a33f-356fc1cf1759 | 0 | public K getSymbol(final String code) {
return this.codes.get(code);
} |
97e2def4-e0ed-473f-b330-fbd837ea8c14 | 8 | public int candy(int[] ratings) {
int len = ratings.length;
if (len==0)
return 0;
int[] candys = new int [len];
for(int i =0;i<len;i++)
candys[i]=1;
for(int i =1;i<len;i++)
if(ratings[i]>ratings[i-1])
candys[i] = candys[i-1]+1;
... |
34897559-0c61-448d-9f03-1cabcf7bbf56 | 2 | public Board(int width, int height, MouseListener mouseListener) {
grid = new Tile[width][height];
super.setLayout(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
grid[x][y] = new Tile(x, y, mouseL... |
9a89210b-2ddb-40c4-b4d6-d5dbe6e70533 | 4 | @Override
public void tick(int i, int j, int k)
{
super.tick(i, j, k);
Vector2 mouse = getMouseInWindow(i,j);
textField.tick((int)mouse.x, (int)mouse.y, k);
if(!InsertableComponentList.containsComponent(textField.text) && !doneButton.getDisabled())
doneButton.setDisabled(true);
if(InsertableComponentL... |
155d8012-657a-4a6a-ba15-f6b5c948101e | 1 | @Test
public void assertBudgetBreakdownTotalCoreBudgetExceptionThrownWhenListIsNull() {
try {
budgetCalculation.processBudgetItemsCalculation(annualBudget, breakdown);
fail("CoreBudgetItemList is null.");
} catch(Exception e) {
System.out.println("CoreBudgetItemLis... |
ecdab470-ce1a-44d6-afff-ad9b0ae2f0d6 | 8 | @Before
public void setUp() throws Exception {
committed = false;
context1 = TestUtil.createContext("/META-INF/spring/node1.xml");
context2 = TestUtil.createContext("/META-INF/spring/node2.xml");
context3 = TestUtil.createContext("/META-INF/spring/node3.xml");
contextConfig = TestUtil.createContext("/META-I... |
ab0d2675-3030-4afb-b9ba-654b3ac282b7 | 9 | private void addToOpenRecentList(String newEntry) {
String recentROMFiles = EnvironmentUtilities.getStringEnvSetting(NES_EMULATOR_RECENT_ROM_FILE_PROPERTY, null);
boolean entryFound = false;
if(recentROMFiles != null && recentROMFiles.length() > 0) {
if(recentROMFiles.indexOf(newEn... |
85650977-3bf4-4793-8754-61031b8e02f4 | 2 | public void movePlayer() {
if(Listener.left) {
player.moveLeft();
}
else if(Listener.right) {
player.moveRight();
}
} |
b43381ff-22f5-4dab-9469-3c967326da81 | 4 | public void onPigZap(PigZapEvent e) {
if (Settings.world
|| WorldSettings.worlds.contains(e.getEntity().getWorld()
.getName())) {
if (Settings.getConfig().getBoolean("disabled.mobs.pig_zombie")) {
e.setCancelled(true);
e.getEntity().remove();
if (Settings.logging) {
writeLog("[EM] pigman... |
846897b5-95af-4b48-9e4b-ad82bdcaf1aa | 7 | public static void main(String args[]) throws Exception {
//process arguments
int arg = 0;
boolean weightedCost = false;
if (args[arg].equalsIgnoreCase("-cost")) {
weightedCost = true;
arg++;
}
String searchMethodString = args[arg++];
search.method searchMethod;
if (searchMethodString.equals("A-s... |
6eff4e5d-b129-42e4-b69f-bc6c74e419d7 | 6 | public boolean isEntityOnCoord(final int x, final int y){
out = false;
Game.get().level.getEntitys().doForAll(new editAction<Entity>() { @Override public void action(Entity e) {
if(e.onGrid())
if(e.getX()*Game.get().ppb_x == x && e.getY()*Game.get().ppb_y == y)
out = true;
if(!e.onGrid())
if... |
302df919-6164-4e0f-9945-f2da5cdecf5a | 7 | private long getInitialCrossReferencePosition(SeekableInput in) throws IOException {
in.seekEnd();
long endOfFile = in.getAbsolutePosition();
long currentPosition = endOfFile - 1;
long afterStartxref = -1;
String startxref = "startxref";
int startxrefIndexToMatch = start... |
5668452e-b31a-4471-8fe4-4a18c9f560bb | 3 | public static final void exampleGenericLispAPI() {
System.out.println("Starting Cyc connection examples.");
try {
System.out.println("Successfully established CYC access " + access);
CycConstant cycAdministrator = new CycConstant("CycAdministrator", new Guid("c0bf7a98-9c29-11b1-9dad-c379636f7270"));... |
9c0532a8-ca03-4714-8904-5e8a99d3baf6 | 2 | void handleDisconnection(Client c) {
for (Channel dis: getClientChannel(c)) {
dis.partUser(c);
dis.sendChannelMSGExclude(c, ":" + c.getName() + "!" + c.getName() + "@" + c.getIP() + " QUIT " + ":Client disconnected.");
}
if (clients.contains(c)) {
... |
75de44bf-60b3-411b-bf50-7ac6f96c739f | 4 | public void renderPixel(int x, int y, int col){
if(x < 0 || y < 0 || x >= width || y >= height) return;
pixels[x + y * width] = col;
} |
5c6d442b-fe8d-44ed-9410-c704523e3d54 | 3 | public AnnotationComponent addAnnotationComponent(Annotation annotation){
// initialize annotations
if (annotations == null){
annotations = new ArrayList<AnnotationComponent>();
}
// make sure we don't add the following types.
if (!(annotation.getFlagInvisible() ||
... |
4b2089a8-2786-42b2-88a5-67ee66e73664 | 4 | public ScreenColor(Object value){
if(Integer.parseInt(value.toString()) >= 0 && Integer.parseInt(value.toString()) < 20){
this.color = "Black";
}
else if (Integer.parseInt(value.toString()) >= 20 && Integer.parseInt(value.toString()) <= 255){
this.color = "White";
}
else
System.out.println("0����255... |
e8c00cf9-a5d0-47bb-936d-025e1aef13c8 | 9 | @Override
public Connection attach(String address, long attachTimeout, long handshakeTimeout)
throws IOException {
if (address == null) {
throw new NullPointerException("address is null");
}
if (attachTimeout < 0 || handshakeTimeout < 0) {
throw new IllegalArgum... |
9fe4f277-ca1f-4acc-92a2-9acfaf9209bd | 9 | private int process(String input) {
boolean isMirrored = true;
boolean isPalindrome = true;
StringBuffer aux = new StringBuffer(input);
aux.reverse();
String reverse = aux.toString();
int i = 0;
int tam = input.length();
while ( (i <= tam / 2) && (isPalindrome || isMirrored)) {
char iChar = input.cha... |
cb6da138-d9ec-4084-bef5-dfb55f993c27 | 1 | public RemoteControlWithUndo() {
onCommands = new Command[7];
offCommands = new Command[7];
Command noCommand = new NoCommand();
for (int i = 0; i < 7; i++) {
onCommands[i] = noCommand;
offCommands[i] = noCommand;
}
undoCommand = noCommand... |
2de2e67b-5f83-4e94-886e-8d0434c2c2cc | 2 | private void createCurrTour(SessionRequestContent request) {
Tour currTour = (Tour) request.getSessionAttribute(JSP_CURRENT_TOUR);
if(currTour == null) {
currTour = new Tour();
Direction currDir = (Direction) request.getSessionAttribute(JSP_CURRENT_DIRECTION);
if (cur... |
37288667-dd70-41ce-8471-fd9533ce9b73 | 1 | private void itmMnu_GerenteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itmMnu_GerenteActionPerformed
if (usuarioLogado.getTipo().equals("Diretor")) {
GerenciarGerenteForm gerenciarGerenteForm = null;
gerenciarGerenteForm = new GerenciarGerenteForm(usuarioLogado);
... |
07d1b240-bdd1-479d-9d73-5e1a7bba1f9d | 2 | public Player getPlayerByID(int id) {
for (Player player : players) {
if (player.getPlayerID() == id)
return player;
}
return null;
} |
68ead6d7-ab69-4b72-980f-ff58e7bbaebe | 9 | private void contractEdge(Vertex v, int group) {
Edge e;
Vertex t;
int i, j;
for (i = 0; i < v.adjEdges.size(); i++) {
e = graph.edges.get(v.adjEdges.get(i));
if (e.flag == false
&& groups.get(group).contains(e.head.id) == true) {
e.flag = true;
if (Debug.ON) {
System.out.println("Contr... |
45454633-a470-46ed-84b8-725f3b7d1439 | 4 | int search(ArrayList<student> arr,int key,int start,int end) {
if(start<end ) {
int mid=start+(end-start)/2;
if(key<arr.get(mid).age) {
return(search(arr,key,start,mid));
}
else if(key>arr.get(mid).age) {
return(search(arr,key,mid+1,end));
}
else if(key==arr.get(mid).age) {
return key;
}
}
... |
a39be530-b870-4868-8663-a9836525a492 | 3 | @Override
public double[] calculateExpectedBlockedOvershoot(AbstractStochasticLotSizingProblem problem,
AbstractStochasticLotSizingSolution solution)
throws ConvolutionNotDefinedException, SolvingInitialisiationException {
//Check the inputs
if (problem.getPeriods().length != solution.getAmountVariableVal... |
d33929d4-6b74-46e9-aa7a-420e1dffc1b2 | 0 | private List<String> findMatchedWords(String phoneNum) {
return dictionary.findWords(phoneNum);
} |
685033e3-d161-44c6-8d37-6feb61526292 | 3 | public static String readArg(String pPrompt, boolean pOptional){
String lArg = null;
int lTries = 0;
String lPrompt = pPrompt;
Scanner lScanner = new Scanner(System.in);
while(XFUtil.isNull(lArg)){
if(lTries > 0){
if(pOptional){
return null;
}
lPrompt = "[... |
0740db66-8988-45cf-b7f8-8ca5e58ae291 | 3 | public boolean unregister(final Channel channel) {
if (!this.channels.containsKey(channel.type))
throw new IllegalArgumentException("Channel not registered: " + channel.toString());
if (this.channels.get(channel.type).remove(channel.name) == null)
return false;
if (this... |
52bf5750-81b2-425c-a642-c64dae7de06b | 2 | @Override
public ArrayList<Object> show(int id) {
conn = new SQLconnect().getConnection();
ArrayList<Object> tns = new ArrayList<Object>();
try {
String sql = "select * from Eventnodes where display = 'true' and owner = "+ id + ";";
Statement st = (Statement) conn.createStatement(); // 创建用于执行静态sql语句的Sta... |
f9746a1c-314b-4e4f-af15-03e9c8178f24 | 9 | private static void importPrices() {
List<String> slist = new ArrayList<>();
try {
BufferedReader br = new BufferedReader(
new InputStreamReader(new FileInputStream("data"
+ File.separator + "prices.csv"), "UTF-8"));
String line = br.readLine();
slist.add(line);
while (line != null) {
l... |
74fa9a6f-154e-4554-8e1d-e27c76afb12a | 1 | public static Texture loadTexture(String fileName)
{
String[] splitArray = fileName.split("\\.");
String ext = splitArray[splitArray.length - 1];
try
{
int id = TextureLoader.getTexture(ext, new FileInputStream(new File("./res/textures/" + fileName)), GL_NEAREST).getTextureID();
return new Textu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.