method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
28481711-79a9-4529-bf4d-b35d7c289757 | 4 | public AdminService() {
UserXMLHandler usXMLHandler = new UserXMLHandler();
BookXMLHandler bkXMLHandler = new BookXMLHandler();
userFactory = new ObjectFactory();
bookFactory = new com.model.book.ObjectFactory();
try {
userList = (UserListRoot)usXMLHandler.readFromFi... |
a259c5cd-4c8e-4768-92b9-bff0322f5bda | 0 | @Override
public void master() {
hello.master();
} |
325fb409-ace6-4088-a88c-9ecdeee04199 | 6 | @Override
public void run() {
if (Updater.this.url != null) {
// Obtain the results of the project's file feed
if (Updater.this.read()) {
if (Updater.this.versionCheck(Updater.this.versionName)) {
if ((Updater.this.versionLi... |
a121745e-d2b0-42b8-8726-b30987cdc897 | 7 | public void run() {
System.out.println("Client connected: " + client.getInetAddress());
while (true) {
String input = new String();
char ch;
try {
do {
ch = (char) client.getInputStream().read();
input = input + ch;
} while (ch != '\n');
if (input.length() < 3 && input.charAt(0) == '... |
2b0d0b37-d7f1-45a8-bb19-a43497b06489 | 8 | public boolean testTwoPair(Die[] combination) {
int i = 0;
int colorBis = 0;
int valueBis = 0;
Die[] pairNumber1 = new Die[2];
Die[] pairNumber2 = new Die[2];
for(int j = 0; j < 2; j++) {
pairNumber1[j] = null;
pairNumber2[j] = null;
... |
feab167e-6493-4d8a-9212-ad4a8fbb9fed | 1 | public String printPlaceholders() {
StringBuilder result = new StringBuilder();
result.append("Word: ");
for (int i = 0; i < getPlaceholder().size(); i++) {
char temp = getPlaceholder().get(i);
result.append(temp);
result.append(" ");
}
return result.toString();
} |
cc4eaf83-bc2a-4547-8779-a617539062bb | 5 | private void insertAVL(TreeNode currentNode, TreeNode newNode) {
if (currentNode == null) {
this.root = newNode;
} else {
if (newNode.key < currentNode.key) {
if (currentNode.left == null) {
currentNode.left = newNode;
newNode.parent = currentNode;
recursiveBalance(currentNode);
} el... |
01214cad-cd65-435b-9dc7-8e64c6815c0b | 9 | private static String fixNumberedParagraphs(String document) {
boolean hasDot = contains(document, "<p[^>]*>7\\. ") && contains(document, "<p[^>]*>8\\. ") && contains(document, "<p[^>]*>9\\. ");
boolean hasDash = contains(document, "<p[^>]*>7 - ") && contains(document, "<p[^>]*>8 - ") && contains(docume... |
56012601-5033-4e1d-abef-1d052859f2e6 | 8 | public void updContactSysState(InetAddress iaIn, int iState)
{
InetAddress iaTmp = this.normalizeAddressIfLocal(iaIn);
int iIdx = this.idxContact(iaTmp);
if (iIdx <= -1) return;
EzimContact ecTmp = this.getElementAt(iIdx);
if (ecTmp == null||! ecTmp.getAddress().equals(iaTmp)) return;
// post au... |
d7e3c8f1-0706-4584-a693-b2c12e5d0e0d | 3 | @Override
public boolean colides(SchlangenKopf head) {
if (super.colides(head) ? true : (nextGlied == null ? false : nextGlied.colides(head))) {
head.die();
return true;
}
return false;
} |
66cfdf8d-3f6a-4dc5-ab14-2d21ef0ea7b9 | 0 | public ProcessedCell getCell(int i){
return cells.get(i);
} |
be0a0054-e4b1-4ab0-a81d-80cf87086e6f | 8 | public boolean isNeighbour(Region r){
boolean neighbour = false;
if(this.x - this.width == r.x && this.y == r.y){ //left neighbour
neighbour = true;
// leftNeighbour = r;
neighbourMap.put("LEFT", r);
}
if(this.x + this.width == r.x && this.y == r.y){ //right neighbour
neighbour = true;
// right... |
7cf90bcd-608c-44f9-b6dd-fa2b8e483659 | 3 | public void render(GameContainer gc, StateBasedGame arg1, Graphics g)
throws SlickException {
for(DrawableGameComponent drawable : drawables) {
drawable.Render(gc, g);
}
g.drawString("Debug info: " + (GameInfo.SHOW_DEBUG_INFO ? "ON" : "OFF"), 10, 25);
if(currentDialogBox != null)
currentDialogBox.Re... |
525b2876-8311-456a-ae96-dab6bcc70769 | 5 | private void countClass(Class<?> type){
Integer quantity = get(type);
put(type, quantity == null ? 1 : quantity + 1);
Class<?> superClass = type.getSuperclass();
if(superClass != null &&
baseType.isAssignableFrom(superClass))
countClass(superClass);
} |
20fa7842-5d63-4698-bfa5-a04ee74e6ec5 | 2 | @Test
public void testEventsOrder() throws LogicViolationError {
EasyFlow<StatefulContext> flow =
from(START).transit(
on(event_1).to(STATE_1).transit(
on(event_2).finish(STATE_2),
on(event_3).to(STATE_3).transit(
on(event_4).to(STATE_1),
... |
978f8389-73ca-47f5-b077-4e17d23922f1 | 1 | public void testToLocalDate() {
MonthDay base = new MonthDay(6, 6, COPTIC_UTC);
LocalDate test = base.toLocalDate(2009);
assertEquals(new LocalDate(2009, 6, 6, COPTIC_UTC), test);
try {
base.toLocalDate(0);
fail();
} catch (IllegalArgumentException ex) {}
... |
c6732fa6-b394-49d3-a5c4-7e62044a2d7f | 2 | @SuppressWarnings("unchecked")
ArrayList new5() /* reduce AAmainclass4Mainclass */
{
@SuppressWarnings("hiding") ArrayList nodeList = new ArrayList();
@SuppressWarnings("unused") ArrayList nodeArrayList18 = pop();
@SuppressWarnings("unused") ArrayList nodeArrayList17 = pop();
@S... |
b3e5b23b-58d1-45a5-a6fa-d40ffeb24227 | 4 | private DragSource createTreeDragSource(final Tree tree){
DragSource dragSource = new DragSource(tree, DND.DROP_MOVE | DND.DROP_COPY);
dragSource.setTransfer(new Transfer[] { FileTransfer.getInstance() });
dragSource.addDragListener(new DragSourceListener() {
TreeItem[] dndSelection = null;
String[] sourceN... |
35e805f3-1916-4912-b519-732e6a2d099f | 2 | public void Strafe(double value){
if (!strafing){
start_pos = gyro[0];
}
strafing = true;
speed = (value > 0)?0.3:-0.3;//*value;
} |
a7612982-ae5a-4fde-835c-05209d3d3f4b | 3 | private void btnSelectActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int returnVal;
returnVal = fc.showOpenDialog(jMenu1);
if (returnVal == JFileChooser.APPROVE_OPTION) {
actualFile = fc.getSele... |
8a2f3b3d-d96d-4312-812d-f516419be373 | 7 | public void paintComponent(Graphics g)
{
BufferedImage spriteSheet = null,Weapon;
BufferedImageLoader loader = new BufferedImageLoader();
try {
spriteSheet = loader.loadImage("images/Ship_Shop/Weapon_Sprite_Sheet.png");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStack... |
03d77ea5-458a-4337-a32a-ed80a94e87b8 | 5 | public void resetEncodedMotorPosition(int motor)
{
if (!isConnected())
{
error("Robot is not connected!", "RXTXRobot", "resetEncodedMotorPosition");
return;
}
if (!getOverrideValidation() && (motor < ... |
c7dc65e3-07ac-45c5-9c37-a422346dd995 | 1 | public boolean inRange(int i)
{
return i >= min && i < max;
} |
ec4d89b9-0241-40ae-9f13-90f56929f973 | 4 | public static void main(String[] args) throws Exception {
String proto;
ModelBuilder builder;
try
{
// First look for parameters
if (args.length == 0) {
builder = new ModelBuilder("Krislet");
builder.buildAllModels();
}
else {
for (int c = 0 ; c < args.length ; c += 2) {
if (args... |
9610c1b9-420e-4fa5-a88b-ed4d6c3d19e7 | 3 | @EventHandler
public void blockPlace(BlockPlaceEvent event){
Player p = event.getPlayer();
if(event.getBlock().getType() == Material.BREWING_STAND || event.getBlock().getType() == Material.BREWING_STAND_ITEM){
if(!plugin.isInRegion("ThugHideOut", p.getLocation())){
event.setCancelled(true);
p.sendM... |
40b5a877-6581-4e17-9f76-649a51a6b226 | 8 | final public void BatchCommand() throws ParseException, IOException {
label_18:
while (true) {
if (jj_2_24(1)) {
Command();
} else {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case STOP:
jj_consume_token(STOP);
{if (true) return;}
break;
def... |
8058e576-4e0b-45a3-a2f0-ccaf2513bc1f | 4 | public int numOfBook() {
ArrayList<Card> list = getList();
HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
Integer bookNum = null;
for (int i = 0; i < list.size(); i++) {
int numb = list.get(i).getCardNum();
if (!map.containsKey(numb)) {
map.put(numb, 1);
} else {
int qty = map... |
c2a48b53-f2fc-4356-8fe3-1ed0797c8c3c | 8 | public Processor start(MainWindow wnd , DataSource ds , CaptureDeviceInfo cdi) {
try {
processor = Manager.createProcessor(ds);
} catch(Exception e) {
JOptionPane.showMessageDialog(wnd ,
e.getMessage(),
null ,
JOptionPane.ERROR_MESSAGE);
System.exit(-1);
... |
8996f6ca-10d1-4209-ac76-4d6952c15ef8 | 8 | int readCorner3(int numRows, int numColumns) {
int currentByte = 0;
if (readModule(numRows - 1, 0, numRows, numColumns)) {
currentByte |= 1;
}
currentByte <<= 1;
if (readModule(numRows - 1, numColumns - 1, numRows, numColumns)) {
currentByte |= 1;
}
currentByte <<= 1;
if (rea... |
dc4a5fe7-3c74-48d4-82fe-aa729cd05a6c | 6 | public void runMainActivityWithoutConsoleOutput(LinkedList<String> userInput) {
int inputCounter = 0;
boolean run = true;
Main.giveMain().setDmPhase(new DMPhase());
do {
if(Main.giveMain().getPhase() instanceof ASRPhase) {
Main.giveMain().setAsrResult(userInput.get(inputCounter));
inputCounte... |
9d504ccb-c1f3-414c-b3ee-91fdd6e7489f | 5 | private void drawols(GOut g, Coord sc) {
synchronized (map.grids) {
for (Coord gc : map.grids.keySet()) {
Grid grid = map.grids.get(gc);
for (Overlay lol : grid.ols) {
int id = getolid(lol.mask);
if (visol[id] < 1) {
... |
76626771-789f-404b-ad2f-8216b2797d96 | 4 | public static void printVampireNumbers() {
for(int k : CASES) {
for(int i = k; i < RESTRICT; i += 9) {
for(int j = i; j < RESTRICT; j += 9) {
if(i * j < RESTRICT * RESTRICT) {
checkVampire(i, j);
}
}
... |
fc2671f1-9d58-4dfc-b006-1dc99cf7e477 | 7 | public int singleNumber(int[] A) {
if(A.length==1) return A[0];
int count[] = new int[32];
int i;
for( i = 0;i<A.length;i++)
{
int j =0;
int temp = A[i];
while(j<32)
{
if((temp>>j & 1)==1)
count[j] = (count[j]+1)%3 ;
... |
b7c59d20-f957-450d-9f86-e1773436bbfb | 0 | @Override
protected void dragg(Excel start, Excel end) {
} |
6033c973-9639-4b3e-b1fd-5e944b7c4806 | 5 | public static NodeFlags swigToEnum(int swigValue) {
if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue) {
return swigValues[swigValue];
}
for (int i = 0; i < swigValues.length; i++) {
if (swigValues[i].swigValue == swigValu... |
cadd7068-35ab-4b1b-9c65-5915c8ddf8c3 | 7 | public String paint()
{
if (done) repaint();
g.fillRect(0, 0, width, height); // Fill the picture with white
long startTime = new Date().getTime();
if (words.size() == 0)
{
return "No Keywords Found!";
}
int drawn = 0;
setSize(); // Reset make is the size of the font
if (update) observer.imageUp... |
e41ea90b-efc5-4d94-9e37-94b8363a14fd | 9 | public String findCommmonAncestor(String[] commitHashes, String[][] parentHashes, String commitHash1, String commitHash2) {
//store nodes that already visited
Set<String> set1 = new HashSet<String>();
Set<String> set2 = new HashSet<String>();
Queue<String> q = new LinkedList<String>();
q.... |
920c7bb8-ee49-4570-be92-922648749c68 | 2 | public String getLeftName()
{
if (leftName == null || leftName.equals(""))
return "Левый";
else
return leftName;
} |
9c7aafc8-d934-41c0-ad49-70954274ccdd | 6 | public void paint(Graphics g){
for(SUIText text : texts){
if(text.shouldPaint())
text.paint(g);
}
if(number == 0){
number = height /(texts.get(0).getHeight());
texts.get(0).setY(texts.get(0).getY()+texts.get(0).getHeight()/2);
for(int i =1; i<number; i++){
SUIText sample = new SUIText(strings.... |
3034801e-b662-4c7d-9063-dc6a315ce859 | 1 | public static String censorPassword(String password) {
StringBuffer stringbuffer = new StringBuffer();
for (int i = 0; i < password.length(); i++) {
stringbuffer.append("*");
}
return stringbuffer.toString();
} |
c690b443-ed61-4a45-9181-bdc837915a9f | 9 | public String getMessage() {
if (!specialConstructor) {
return super.getMessage();
}
String expected = "";
int maxSize = 0;
for (int i = 0; i < expectedTokenSequences.length; i++) {
if (maxSize < expectedTokenSequences[i].length) {
maxSize = expectedTokenSequences[i].length;
... |
a84cc82a-e60f-4e33-bf2d-cee596a1f635 | 8 | @Override
protected String doGetSpecificCommandString(SingleCommand singleCommandToExec,Robot robot) {
Commands command=singleCommandToExec.getCommandInstruction();
int distance=singleCommandToExec.getDistance();
int degrees=singleCommandToExec.getDegrees();
int time=singleCommandTo... |
c8c26901-ec9a-482e-9475-2ddf26d7761f | 9 | public static void main(String[] args) throws Exception {
ArgParser inputParser = new ArgParser(args);
String trueSnpPath = inputParser.getStringArg("-T");
readTrueSnps(trueSnpPath);
Integer printPositions = inputParser.getIntegerArg("-p"); // 0: just print statistics, 1: print all ... |
08063200-7c66-4a91-b0f6-4b38a36fe065 | 3 | private static Set<String> getInjectedBeansName(Inject injectedBean, Class<?>[] parameterType){
Set<String> injectedBeansName = new HashSet<String>();
String injectedBeanName;
for (int i=0; i<parameterType.length; i++) {
injectedBeanName = parameterType[i].getSimpleName()
... |
d9f1b464-3928-4291-9c97-f646fd252c8e | 3 | private void processCharacter(char ch, List<String> stack, List<String> parsed) {
String newOperator = String.valueOf(ch);
if (stack.size() > 0) {
while (!stack.isEmpty() && newOperatorHasSameOrLowerPriority(newOperator, stack.get(stack.size() - 1)) ) {
parsed.add(stack.get(... |
417620e5-9891-4357-8343-66db44835250 | 8 | public String getArrowDotSvek() {
if (this == LinkDecor.NONE) {
return "none";
} else if (this == LinkDecor.EXTENDS) {
return "empty";
} else if (this == LinkDecor.COMPOSITION) {
return "empty";
} else if (this == LinkDecor.AGREGATION) {
return "empty";
} else if (this == LinkDecor.ARROW) {
ret... |
32f95bac-7e03-4f8d-b9fb-10d885adea64 | 4 | private void ajouterRelationActionVIP() {
if(radioBtnTypeRelation.isSelected() && !txtFieldDescriptif.getText().equals(""))
{
((DefaultTableModel)tableConsultVIP.getModel()).addRow(new Object[]{"Relation",txtFieldDescriptif.getText(),comboBoxProtagoniste1.getSelectedItem()});
}
... |
8da5efc1-67f6-4122-9e76-77780e048200 | 8 | public static boolean areAnagrams(String string1, String string2) {
if (string1 == null || string2 == null) {
return false;
}
int word1Length = string1.length();
int word2Length = string2.length();
if (word1Length == 0 || word2Length == 0 || word1Length != word2Length... |
437cb90c-b5b5-4cc7-a3e1-f9cfce3e9345 | 2 | public void run() {
while (running) {
sendKeyData();
try {
sleep(20);
} catch (InterruptedException ex) {
}
}
} |
a6151885-feb6-4b79-ba29-a71b555aaac8 | 8 | @Override
public void executeMsg(Environmental myHost, CMMsg msg)
{
super.executeMsg(myHost, msg);
if((msg.source()==invoker())
&&(msg.target() instanceof MOB)
&&(msg.targetMinor()==CMMsg.TYP_DAMAGE)
&&(msg.tool()==msg.source().fetchWieldedItem())
&&(((MOB)msg.target()).fetchEffect("Bleeding")==null))
{... |
341e164b-511d-4bb0-91f6-172d92e610e4 | 9 | @Override
public Object execute(TransitionSystem ts, Unifier un, Term[] terms) throws Exception {
WorldModel model = ((MartianArch) ts.getUserAgArch()).getModel();
Vertex myPosition = model.getMyVertex();
List<Entity> opponents = model.getActiveOpponentsOnVertex(myPosition.getId());
if (!opponents.isEmpty()... |
7263ebe2-db47-4283-b444-9be522de6d4e | 7 | protected boolean isVersionAnnotatable(String className) {
return Byte.class.getName().equals(className)
|| Short.class.getName().equals(className)
|| Integer.class.getName().equals(className)
|| Long.class.getName().equals(className)
|| Float.clas... |
cd055a28-7a66-46c2-bb23-717ef2927db0 | 8 | @Override
final public MoveResult makeMove(final HantoPieceType pieceType, final HantoCoordinate from,
final HantoCoordinate to) throws HantoException {
MoveResult result = MoveResult.OK;
if (from != null){
throw new HantoException("Moving not available");
}
if (gameManager.getCellManager().isEmpty()... |
00d21ea7-9465-4572-921e-e87cb8d5c7ac | 6 | @Override
public Buildable create(Object name, Object value) {
if (name.equals("parameter")) {
Params p = new Params();
params.add(p);
return p;
} else if (name.equals("resource")) {
res.addResource(value);
return LEAF;
} else if (name.equals("logging")) {
return l;
} else if (name.equals("co... |
156699f9-45a3-445a-aef5-f9f381083e87 | 1 | private byte[] readByteArray()
{
int handle = readInt();
boolean inline = ((handle & 1) != 0);
handle = handle >> 1;
if (inline)
{
byte[] ret = readBytes(handle);
objectReferences.add(ret);
return ret;
}
else
{
return (byte[])objectReferences.get(handle);
}
} |
0c643dc4-13bb-4095-93b7-b8519a699fab | 8 | @Override
MessageExoType getMessageExoType(String arrow) {
if (arrow.contains(">")) {
return MessageExoType.FROM_LEFT;
}
if (arrow.contains("<")) {
return MessageExoType.TO_LEFT;
}
if (arrow.startsWith("/") || arrow.startsWith("[/") || arrow.startsWith("\\") || arrow.startsWith("[\\")) {
return Mess... |
f3092007-4536-49e8-835a-33d812538e0a | 1 | public SAXClassAdapter(final ContentHandler h, boolean singleDocument) {
super(h);
this.singleDocument = singleDocument;
if (!singleDocument) {
addDocumentStart();
}
} |
2131e43b-3dc7-4947-a7ef-37c25ed737a2 | 7 | public Object nextValue() throws JSONException {
char c = nextClean();
String string;
switch (c) {
case '"':
case '\'':
return nextString(c);
case '{':
back();
return new JSONObject(this);
case '[':
... |
2465d60c-903c-4f71-a40b-208fc184116e | 9 | private boolean findSSSInstance() {
if (sss == null) {
ListIterator<Line> it = gct.getCodeLines().listIterator();
ArrayList<Line> code = new ArrayList<Line>();
ArrayList<Integer> skipCounts = new ArrayList<Integer>(3);
int pointInSkeleton = 0;
boolean keepLooking = true;
while (it.hasNext() && keepL... |
951e99a4-41f8-4016-a2ce-d3ff44c85d2a | 9 | private void addJob(Object job, boolean isPrefetch) {
if(job == null ||
(job != WorkerThread.TERMINATE && !(job instanceof Job))) {
// Programming error: deliberately no message.
throw new IllegalArgumentException();
}
LinkedList jobQueue;
synchronized... |
38644b07-47e2-4697-beb0-67198d891fa8 | 3 | @EventHandler(priority = EventPriority.HIGHEST)
public void onShear(PlayerShearEntityEvent e){
Player p = e.getPlayer();
animalUtility au = new animalUtility(plugin);
if(e.getEntity() instanceof Sheep){
if(au.isAnimalOwner(p, e.getEntity())){
Animals a = new Animals(plugin, e.getEntity().getUniqueId().toSt... |
4f239aad-9922-4717-8489-4253887ad724 | 0 | public BigDecimal getPrice() {
return price;
} |
af92a235-9185-4bc8-9639-8ae910e14e3d | 7 | public void setNumNameTablePages(int numNTPages){
if(numNTPages != nameTableTiles.length){
CHRTile newTiles[][] = new CHRTile[numNTPages][PPUConstants.NAME_TABLE_WIDTH * PPUConstants.NAME_TABLE_HEIGHT];
int max = numNTPages;
if(nameTableTiles.length < max){
max = nameTableTiles.length;
}
for(int i=... |
182e8728-02f0-42a4-949c-c0b864bb8882 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof Group))
return false;
Group other = (Group) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
... |
5883bfba-edab-4715-91b5-b1c1d2b2d26a | 1 | @Override
public void render(Graphics g, Visibility visibility, float x, float y, float scale) {
if(visibility == Visibility.VISIBLE)
PillarEntity.PILLAR_IMAGE.draw(x - 11.5f * scale, y - 22 * scale, 23 * scale, 32 * scale);
} |
af03dc7f-d021-446c-8fb1-481820c3d4d1 | 9 | @Override
public void update(GameContainer c, StateBasedGame game, int delta)
throws SlickException{
Input in = c.getInput();
if(checker){
gg.play();
if(player == 0){
playGameOver();
}
Date newTime = new Date();
if(newTime.getSeconds() > startTime.getSeconds() + 10){
c.exit();
}
}
... |
4e656428-3d43-4a2c-8c64-0a7bbc2022f8 | 8 | public boolean putFileToAWS(String parentPath, String fileName) {
try {
String filePath;
if (parentPath.length() == user.getUsername().length() + 1) {
filePath = parentPath + fileName;
} else {
filePath = parentPath + "\\" + fileName;
}
if(parentPath.length() != user.getUsername().lengt... |
73b86d02-773a-4829-98ff-306f8fb70658 | 5 | public static char[] replaceSpace(char[] str, int length){
int countSpace=0;
for(int i=0;i<length;i++){
if (str[i]==' ')
countSpace++;
}
/*Replace the char from backwards so that the operation does not require extra space*/
/*int finalLength = length + countSpace*2; */
for(int i=lengt... |
9a30c1c6-4050-4703-b591-9b1e375e2b18 | 5 | public void playerMoved(String direction, JLabel[][] labels) {
Player me = clientService.getMePlayer();
me.setDirection(direction);
int x = me.getXpos();
int y = me.getYpos();
me.setOldXPos(x);
me.setOldYPos(y);
if (direction.equals("right")) {
x += 1;
}else if (direction.equals("left")) {
x -= 1... |
d1671c07-3ebb-41ce-b13b-f52cda6fdfb3 | 1 | private void setBalance(BigInteger balance) throws IllegalArgumentException {
if (! this.canHaveAsBalance(balance))
throw new IllegalArgumentException();
this.balance = balance;
} |
d1c084b2-0f2b-4d82-97eb-d3af72879eee | 2 | public static String Date2Str(java.util.Date date, String formatString)
{
if(formatString!=null && !formatString.equals("")){
format = new SimpleDateFormat(formatString);
}
return format.format(date);
} |
469a2370-3aea-439d-8c1c-afe27771c559 | 7 | public boolean within(float x, float y, float[] polyX, float[] polyY)
{
if (polyX.length != polyY.length) return false;
int i, j = polyX.length-1;
boolean oddNodes = false;
for (i = 0; i < polyX.length; i++)
{
if (polyY[i] < y && polyY[j] >= y || polyY[j] < y && polyY[i] >= y)
{
if (polyX[i] + (... |
1f0e7ae7-3752-4018-9ab8-712cce0d52f8 | 3 | private static void printGridletList(GridletList list, String name,
boolean detail)
{
int size = list.size();
Gridlet gridlet = null;
String indent = " ";
System.out.println();
System.out.println("============= OUTPUT for " + name ... |
0d19f083-e80e-4c9a-b589-1d2dd6d63a0d | 6 | @EventHandler
public void PlayerSpeed(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.getPlayerConfig().getDouble("Player.Speed.Dod... |
da933e1a-db99-4fe8-82f8-662d9ace6616 | 6 | public static boolean functionalTermP(Stella_Object term) {
if (Stella_Object.safePrimaryType(term) == Logic.SGT_STELLA_CONS) {
{ Cons term000 = ((Cons)(term));
{ GeneralizedSymbol testValue000 = ((GeneralizedSymbol)(term000.value));
if ((testValue000 == Logic.SYM_LOGIC_SETOFALL) ||
... |
2349f5e7-aeca-4214-837e-77d0dff11c16 | 9 | public void DBUpdateRoomMOB(String roomID, MOB mob)
{
if((roomID==null)||(!mob.isSavable())||(mob.amDestroyed()))
return;
DBDeleteRoomMOB(roomID, mob);
if(Log.debugChannelOn()&&(CMSecurity.isDebugging(CMSecurity.DbgFlag.CMROCH)||CMSecurity.isDebugging(CMSecurity.DbgFlag.DBROOMS)))
Log.debugOut("RoomLoader"... |
5162ab70-a59a-4346-bf46-79f8d13006a1 | 2 | private void addDBRow(long startSecond, int duration, String title, String comment)
{
// allocate a statement object
Statement stmt = null;
try
{
stmt = conn.createStatement();
}
catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try ... |
754179b6-7274-4ee6-85b1-2baad422fa1e | 1 | public Set<String> getAllAvailableTableNames() {
Set<String> result = new HashSet<String>();
for (DataBase db : databases.values()) {
Set<String> namesOfAvailableTablesInCurrentDB = db.getTableNames();
result.addAll(namesOfAvailableTablesInCurrentDB);
}
return re... |
d676e6ba-3f75-4b69-beaa-94330fb96860 | 6 | private void buildMaze()
{
grids = new Grid[this.width][this.height];
ArrayList<Wall> walls = new ArrayList<Wall>();
for (int x = 0; x < width; x++)
{
for (int y = 0; y < height; y++)
{
grids[x][y] = new Grid(x, y);
}
}
// assign walls. When assigning walls, the grids at all sides of the... |
beaf4c1f-2708-4311-a42e-c89a415ac0b7 | 4 | public static ArrayList<BufferedImage> splitImage(BufferedImage bi, int width, int height) {
if (bi.getWidth() % width != 0 || bi.getHeight() % height != 0) {
DystopiaLogger.logSevere("It looks like there was a problem dividing up a tileset. :(");
DisplayCarrier.getFrame().dispose();
throw new IllegalArgumen... |
5d3dbfee-ecdb-401b-b108-112a558fae57 | 9 | @Test
public void testToByteArray_Image()
{
System.out.println("-----------------------------------------------");
System.out.println("toByteArray(Image)");
BufferedImage image = null;
// From file
try
{ image = ImageIO.read(new java.io.File("C:\... |
93e1bc4a-f140-4a6f-8644-423b633c3eab | 7 | public void startElement(String namespaceURI, String localName,
String qName, Attributes atts) {
if (localName.equals("TSeq_gi")) {
stack.push( new StringBuffer() );
isStackReadyForText = true;
}else if(localName.equals("TSeq_taxid")){
stack.push( new StringBuffer() );
isStackReadyForText = true;
}... |
eb9ff8a0-c024-40e5-9c01-165fbd1c62b2 | 7 | public static boolean objIsCarrying(int objId) {
synchronized (glob.oc) {
for (Gob gob : glob.oc) {
if (gob.id == objId) {
Layered lay = gob.getattr(Layered.class);
if (lay != null) {
for (Entry<Indir<Resource>, Sprite> ... |
25d935ae-2e1c-4b6c-b612-d777b02d903c | 2 | public IntervalList(List<Calendar> intervals) {
super(intervals.size());
int size = intervals.size();
if (size % 2 != 0) {
throw new IllegalArgumentException("Intervals parameter must be an odd number.");
}
Iterator<Calendar> it = intervals.iterator();
whil... |
c485513d-82dd-4919-9fc9-94144eec31df | 7 | private static Task createNewTask(String name, String description,
Date startDateTime, Date endDateTime, String location,
String priority) throws Exception {
if (name.equals(null) || name.equals("")) {
throw new Exception("Null task name");
}
Task newTask = new Task(name);
if (!(description.equals("... |
38845ab1-d89b-441c-8f5d-d0c4b1536f65 | 6 | public boolean isPermutation2(String s1, String s2) {
if (s1.length() != s2.length()) {
return false;
}
HashMap<Character, Integer> m = new HashMap<Character, Integer>();
for (int i = 0; i < s1.length(); i++) {
if (m.containsKey(s1.charAt(i))) {
m.put(s1.charAt(i), m.get(s1.charAt(i)) + 1);
} else... |
4c79c9f4-d1a9-49a4-b729-d171778149b7 | 8 | public Integer[] getPropertyIntegerArry(String key, Integer[] defaultValue) {
try {
if (containsPropery(key)) {
StringTokenizer stk = new StringTokenizer(getProperty(key), ",");
Integer ret[] = new Integer[stk.countTokens()];
for (int i = 0; stk.hasMor... |
735050f5-ea8a-41cc-abdc-e57eaa630440 | 1 | public static List parseXML(String filepath) {
PropertyContainerXMLParser parser = new PropertyContainerXMLParser();
try {
parser.process(filepath);
return parser.getPropertyContainerList();
} catch (Exception e) {
e.printStackTrace();
return null;
}
} |
f11ed879-30c2-438a-9022-4ce1d24230e4 | 9 | private DocumentWriter newFolderWriter(final String id, final File file,
final int offset) {
final boolean root = isRoot(id);
final DocumentWriter writer = newDocument(id);
writer.setPrimaryType(NT_FOLDER);
writer.addProperty(JCR_CREATED, factories().getDateFactory().create(
... |
2f2472bd-9696-45e7-a324-1d3e092789e4 | 3 | static void readXML(File f) throws Throwable {
XMLEventReader v = fact
.createXMLEventReader(new BufferedInputStream(new FileInputStream(f)));
while (v.hasNext()) {
XMLEvent ev = v.nextEvent();
if (ev.isStartElement()) {
StartElement s = (StartElement) ev;
s.getName();
@SuppressWarnings("un... |
f1279c3f-120a-44cc-85f8-bce76f00d427 | 3 | public Path getImgPath_PWBtn(Imagetype type) {
Path ret = null;
switch (type) {
case MOUSEFOCUS_KEYFOCUS:
ret = this.imgPWBtn_KFocMFoc;
break;
case PRESSED:
ret = this.imgPWBtn_Pre;
break;
case DEFAULT... |
6f874459-f46f-4c98-8261-2e6eaccdba80 | 6 | private static void
showProperties (XMLReader producer)
{
System.out.println ("PROPERTIES for "
+ producer.getClass ().getName ());
DefaultHandler2 handler = new DefaultHandler2 ();
// all properties are optional
checkProperty ("declaration-handler", producer, handler);
// To check the dom-node... |
b335a1c3-2fa0-41a9-b71d-349584fe09ec | 8 | public Token nextToken() throws LexicalError
{
if ( ! hasInput() )
return null;
int start = position;
int state = 0;
int lastState = 0;
int endState = -1;
int end = -1;
while (hasInput())
{
lastState = state;
stat... |
bf905578-51e2-4fd7-976b-2e99af670efa | 0 | public FSAToRegularGrammarConverter() {
} |
02f08ea4-d0e7-4502-875e-df506b21be48 | 0 | public YamlPermissionServer(String n, ConfigurationSection sec) {
super(n, sec);
} |
8acb740d-49b3-411e-b212-27d9c6c7ea2a | 6 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
switch (columnIndex) {
case 0:
return listStock.get(rowIndex).getId();
case 1:
return listStock.get(rowIndex).getLibelle();
case 2:
return listStock.get(ro... |
cf6b5e77-f717-4fba-aa52-7162058ca308 | 5 | private int getXIndex(GeoParams geoParams, STTPoint sttPoint) {
double delta_x;
if (geoParams.geoBoundNW.longitude > geoParams.geoBoundSE.longitude &&
geoParams.geoBoundNW.longitude > sttPoint.getLatLong().longitude) {
//Our point is wrapped around 180/-180
if (geoParams.geoBoundSE.longitude > sttPoint.... |
17571f11-6135-4592-9606-2f20860c1fc2 | 0 | public static void setEndTime(CallInfo ci, Date start){
ci.setStart(start);
} |
858ae0e4-da6b-42ff-afca-3ff016978b35 | 5 | public void run() {
while (continueRunning) {
// System.out.println("[PacketCacheThread] run "+ TimeUtilities.dateStampSimplerPrecise());
speedometer.pruneToFrame();
//each 10 millisecs... dispatch the cache, but don't go over volume limit
while( (cacheForClient.size() > 0) && (!isOverLimit... |
0cc94753-f25c-41c4-8df6-1d814e3790c4 | 4 | @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public int compare(T arg0, T arg1) {
if(arg0 == null && arg1 == null)
{
return 0;
}
else if(arg0 == null)
{
return -1;
}
else if(arg1 == null)
{
return 1;
}
else
{
return ((Comparable)arg0).compareTo(arg1);
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.