method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
55fe005a-4d78-4ea9-ad2b-d897af171d42 | 4 | public static OperationStrategy getStrategy(String operator){
if("+".equals(operator)){
return new AdditionOperationStrategy();
}else if("-".equals(operator)){
return new SubtractionOperationStrategy();
}else if("*".equals(operator)){
return new MultiplyOperationStrategy();
}else if("/".equals(opera... |
cf9dce8f-2eed-4ff6-ad8c-8b3e3d25640c | 6 | AbstractNode expr() {
AbstractNode node = simpleExpr();
if (test(EQ)) {
read(EQ, "=");
node = new BinOpNode(EQ_OP, node, simpleExpr());
} else if (test(NEQ)) {
read(NEQ, "#");
node = new BinOpNode(NEQ_OP, node, simpleExpr());
} else if (test(LO)) {
read(LO, "<");
node = new BinOpNode(LO_OP, n... |
033d47af-f60e-44a9-90fd-68292248c6b6 | 9 | public void writeReview(String id) {
// Create a new rno for the review
String rno = createNewRno();
int rating = -1;
String reviewText = "";
// Get reviewer email
User user = User.getInstance();
String email = user.getEmail();
// Boolean to check if the user has entered an int for rating
boole... |
7bc7f20a-1a95-401d-ae93-e8e8e51120ed | 1 | public static void main(String[]args)
{
int limit = 100;
int sumOfSquares = 0;
int squareOfSum = 0;
for(int i = 1; i <= limit; i++)
{
sumOfSquares += i*i;
squareOfSum += i;
//System.out.println("Sum of Squares : " + sumOfSquares +
// " | Square of Sums : " + squareOfSum);
}
squareOfSum =... |
12ff7877-6eb8-4e1f-acff-f2bbaef4cd9c | 6 | public static void main(String[] args) {
Connection con = null;
Statement st = null;
ResultSet rs = null;
String url = "jdbc:mysql://sqlserver.mhscs.org:3306";
String user = "java_client";
String password = "rRcNmJsHFfD7XEjn";
try {
con = DriverMana... |
470b0051-5ff8-42dc-8b3e-af422a21207f | 4 | public boolean checkPath(String path, boolean isExistingFile) {
File test = new File(path);
if (isExistingFile && !test.isDirectory()) {
if (test.exists()) {
return true;
} else return false;
} else {
File filePath = test.getParentFile();
... |
0314abad-661e-4173-9581-2807a3bccdeb | 3 | @Override
public boolean onCommand(CommandSender sender, org.bukkit.command.Command cmd, String[] args) {
if(!Commands.isPlayer(sender)) return false;
Player p = (Player)sender;
String pName = p.getName();
if(args.length != 0) return false;
if(PlayerChat.plugin.Chatspy.containsKey(pName)) {
PlayerChat.... |
6008a3a4-405d-41db-b4c2-25f94b13bf86 | 8 | public ArrayList<Employee> SingleEmployeeData( int EmpID)
throws UnauthorizedUserException, BadConnectionException, DoubleEntryException
{
/* Variable Section Start */
/* Database and Query Preperation */
PreparedStatement statment = null;
ResultSet results =... |
ac602e39-174e-4aaa-93b1-646bd4f7f9d0 | 6 | public static void main(String[] args) throws Exception {
Class.forName("net.sourceforge.jtds.jdbc.Driver");
if (args.length == 0) {
FormMain frm = new FormMain();
frm.setVisible(true);
} else {
Properties properties = comp.loadProps();
String so... |
dc7e0cd6-4436-453a-bcfe-9bd8a52ad724 | 6 | private boolean refreshPlaces(Section section) {
//
// First of all, check to ensure that an update is required. If so,
// generate new places for underlying tiles:
if (section == null) return false ;
final float time = world.currentTime() ;
Caching caching = allCached.get(section) ;
if (... |
e81d281d-e8a4-4673-b5f7-d1586ca07d82 | 8 | private void computeLater(final ExprInfo exprInfo) {
Iterator blocks = cfg.nodes().iterator();
// Initialize later to can be available...
while (blocks.hasNext()) {
final Block block = (Block) blocks.next();
final Phi phi = exprInfo.exprPhiAtBlock(block);
if (phi == null) {
continue;
}
phi.... |
6c851dae-de49-4508-a9c7-7a06eb9b4e61 | 0 | public Body(int upgradeCount, String name) {
super(upgradeCount, UpgradeType.Body, name);
} |
dcedf73b-c49c-4f5e-a241-ac064c69f88b | 5 | public void step() {
if (done) {
return;
}
yield = false;
while (!(yield || done)) {
if (index >= script.length) {
if (stack.size() == 0) {
done = true;
} else {
popState();
}
} else {
evalCommand((Object[]) script[index]);
index++;
}
}
} |
b7df09f3-6ec0-4684-9c76-798f74baff0e | 4 | @Override
public void run() {
while (this.isRunning) {
try {
// Tell model to update, send next key press.
// or 0 if no new keypress since last update.
if (updateSpeed > 0) {
Thread.sleep(updateSpeed);
this.gameModel.gameUpdate(nextKeyPress());
}
} catch (GameOverException e) {
... |
ce221d89-3e27-4b50-a6f3-7b1db11eab66 | 0 | public void setConsumerSecret(String consumerSecret) {
this.consumerSecret = consumerSecret;
} |
48677d53-5fd5-498c-b03f-65d61a236315 | 1 | public byte DecodeNormal(SevenZip.Compression.RangeCoder.Decoder rangeDecoder)
throws IOException
{
int symbol = 1;
do
symbol = symbol << 1 | rangeDecoder.DecodeBit(m_Decoders, symbol);
while (symbol < 256);
return (byte)symbol;
} |
06d0a6ee-ed1e-4fd9-9721-374e4f824593 | 1 | private void send(OSCMessage oscMessage){
try {
sender.send(oscMessage);
System.out.println("Sent message!");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
158c1755-5ce4-4bb0-a849-c81ff17a97ed | 6 | @Override
public int mknod(String path, int mode, int rdev) throws FuseException {
try {
fileSystem.createFile(path);
UnixPermissions perms = new UnixPermissions(mode);
if (options.isUnixOwnerImpersonateNewFiles() || options.isUnixOwnerImpersonateAllFiles())
{
perms.setUid(Environment.getUserId());
... |
68b9164e-8451-4177-96d6-3e07c4b6b71f | 9 | static private boolean jj_scan_token(int kind) {
if (jj_scanpos == jj_lastpos) {
jj_la--;
if (jj_scanpos.next == null) {
jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
} else {
jj_lastpos = jj_scanpos = jj_scanpos.next;
}
} else {
jj_scanpo... |
e63ce5cc-144d-4951-8f9c-907a05cd72ce | 8 | public Boolean BuildDataSet (File dataFile) {
boolean test = false;
if(!checkForValidFile(dataFile)){
return false;
}
try {
m_fileScan = new Scanner(dataFile);
} catch (FileNotFoundException e) {
}
m_attributes = new... |
b045eec5-511d-4045-b7f9-0202d389be0e | 1 | public void close() {
try {
output.close();
} catch (IOException e) {
e.printStackTrace();
}
} |
5078ed5b-0f8c-473a-8f1a-0e3842b6bbdd | 7 | public List<Map.Entry<String, Double>> psuedoRelevanceCalc(QueryPhrase query, int numResults , int numTerms){
Vector<ScoredDocument> results = runQuery(query, numResults);
// do the logic here
Map<String, Double> frequencyMap = new HashMap<String,Double>();
for(ScoredDocument scoreddoc : results){
Docume... |
d4b5e110-e48b-49e4-89fd-ae41048fbc03 | 9 | @EventHandler(priority = EventPriority.LOW)
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
DynamicClassFunctions.addNSH(player);
// Show disguises to newly joined players
plugin.showWorldDisguises(player);
// If he was a disguise-quitter, tell him
if (plugin.disg... |
502b2428-825f-498f-9f23-55fcc24e6c19 | 7 | private static void prettyPrintARound(Round r) {
String[][] table = new String[r.getPairs().size() + 1][4];
table[0][0] = "PROP/AFF";
table[0][1] = "OPP/NEG";
table[0][2] = "JUDGES";
table[0][3] = "ROOM";
for (int i = 1; i < table.length; i++) {
for (int j = 0; j < table[0].length; j++) {
Pair p = r... |
f895acf1-e383-4613-a593-08e0af069e95 | 9 | public TupleFour<String,String,List<Object>,List<TupleFour<String, List<Object>, String, Long>[]>> getDriveCollection() throws Exception {
String cid = getDriveCollectionId();
List<Object> goal = null;
List<TupleFour<String, List<Object>, String, Long>[]> priorities;
if (!match(new St... |
79dbc3b8-e199-474c-ae33-bcbf216f4f3a | 1 | public static String getPinyin(String word) {
String pinyin = "";
for (int i = 0; i < word.length(); i++)
pinyin += getPinyin2(getCode(word.charAt(i)));
return pinyin;
} |
991f389b-3e5a-407b-9f52-edda23c4e075 | 1 | protected void calcDIR_WrtTime() {
byte[] bTemp = new byte[2];
for (int i = 22;i < 24; i++) {
bTemp[i-22] = bytesOfFAT32Element[i];
}
Integer temp = byteArrayToInt(bTemp);
DIR_WrtTime = ((temp & 0b111110000000000) >> 10) + ":" + ((temp & 0b1111110000) >> 4) +... |
4c8910e1-74ea-46fd-ad97-4ebbd82b5082 | 0 | public static void main(String[] args)
{
MyBorderLayout exGui1 = new MyBorderLayout();
exGui1.go();
} |
c7abd608-c358-4017-b61c-a2c9fe12637e | 3 | public static List<String> keysByMeta(CSProperties csp, String mkey, String mval) {
List<String> l = new ArrayList<String>();
for (String key : csp.keySet()) {
if (csp.getInfo(key).keySet().contains(mkey)) {
String role = csp.getInfo(key).get(mkey);
if (role.e... |
c71fab31-165d-4291-8a9d-90c65680fcc1 | 9 | public String getParameterString(){
String retString = super.getParameterString();
try{
if(sourceText!=null) retString+="&sourceText="+sourceText;
if(showSourceText!=null) retString+="&showSourceText="+(showSourceText?"1":"0");
if(cQuery!=null) retString+="&cquery="+URLEncoder.encode(cQuery,"UTF-8");
... |
e111837a-0f83-41e7-ae39-e5f0ebee0503 | 9 | public BillNumTO generateBillNum(CounterTO counterTO){
PreparedStatement pstmt = null;
Connection con = null;
BillNumTO billNumTO = new BillNumTO();
int docNumId = ConstantValue.INTEGER_ZERO;
String billNum = ConstantValue.EMPTY_STRING;
int maxNum = ConstantValue.INTEGER_ZERO;
String docType = ConstantVal... |
988af589-deb8-4fa6-a0c1-d1d8a9ed3be8 | 0 | @Test
public void testLengthLast(){
int len = 10;
calc = new DataCalc(inData, numberOfPoints);
calc.createDataSet(0);
outData = calc.getStructureIn();
Assert.assertTrue(outData.getLength() == len);
} |
19e7eef1-ce21-46f7-9d01-0ca4ba56cc0d | 2 | @Test
public void testTargetLocationAlwaysSelected() {
ComputerPlayer player = new ComputerPlayer();
player.setLastVistedRoom('L');
int enteredRoom = 0;
board.calcTargets(6, 7, 4);
//pick location with at least one room as a target
for(int i = 0; i < 100; i++) {
BoardCell selected = player.pickLocation(... |
657f501f-0edd-4e59-9943-f053403c5308 | 4 | public boolean canPlaySoldier(int playerIndex, HexLocation hexLoc, int victimIndex) {
//Checks status, players turn, has player already played dev card, if the player has a soldier card,
//If the robber is not already in the designated HexLocation, and if the victim has cards to steal.
if (generalDevCardPrecondit... |
45123c63-8a24-4221-b4db-00659623d8cc | 1 | public void printPatientsBackwards() {
if (nextPatient == null) {
System.out.println("Patient: " + name + ", age: " + age + ", illness: " + illness);
} else {
nextPatient.printPatientsBackwards();
System.out.println("Patient: " + name + ", age: " + age + ", illness: "... |
1eaaa160-3df0-4e07-a75e-23f089679060 | 4 | public void shoot(){
if(currentLevel==2 || currentLevel == 3){
bullet = new StarBullet(this);
if(playerFacing == 1){
bullet.move(new Vec2(getPlayer().getPosition().x + -40, getPlayer().getPosition().y));
bullet.setAngularVelocity(12);
bullet.set... |
1547ee59-0c26-4b90-a865-68fd6d87b713 | 3 | public static Matrix readFromFile(String path, DataType dataType) throws MatrixIndexOutOfBoundsException {
Matrix matrix = null;
int rows;
int cols;
try {
Scanner in = new Scanner(new FileReader(path));
rows = in.nextInt();
cols = in.nextInt();
... |
b814ea08-4238-4a81-b6b1-cf3c3f4f1c0c | 4 | public void draggedMouse(Point p) {
int x = (int) (p.getX() / tileSize);
int y = (int) (p.getY() / tileSize);
int objLocX = (int) ((p.getX() - (x * tileSize)) / (tileSize / 3));
int objLocY = (int) ((p.getY() - (y * tileSize)) / (tileSize / 3));
int objLoc = (objLocY * 3) + objLocX;
int fenceLocX = (i... |
b73e4c2a-4155-4f24-8f87-15d03b102d3d | 3 | @Override
public Token parse() {
Token test = first.getNext();
if (test.isOperator()) {
Operator testOp = test.getOperator();
if (testOp.name().startsWith("ASSIGN")) {
variable = new Variable(first, scope);
variable.parse();
assignmentOp = testOp;
test = test.getNext();
assignmentExp = ne... |
be89e17e-dee3-49eb-ab65-88541d42d8c6 | 2 | public static Application valueOf(short id) {
for (Application application : Application.values()) {
if (application.getId() == id)
return application;
}
// same behavior as standard valueOf(string) method
throw new IllegalArgumentException("No enum const for id " + id);
} |
20adeb83-0f4c-4e00-8cd8-a27452060548 | 2 | @Override
public void update() {
p.update();
handleInput();
op.update();
if (op.health <= 1) {
endResult = "Player1 Wins !";
freeze();
} else if (p.health <= 1) {
endResult = "You Lost !";
freeze();
} else {
endResult = "";
}
} |
6e0a4e7d-f45f-448f-a2b7-6a9f2fb5f69d | 3 | public boolean pass(int[] bowl, int bowlId, int round, boolean canPick, boolean mustTake) {
float[] currentBowl = Vectors.castToFloatArray(bowl);
numFruits = Vectors.sum(currentBowl);
if (!canPick){
log("CANT PICK RETURNING EARLY");
return false;
}
log("|||||||||||||||||||||||||||||||||... |
703d00d8-6a25-4263-ad19-6ba7df108a2b | 6 | protected void createSubbands()
{
int i;
if (mode == Header.SINGLE_CHANNEL)
for (i = 0; i < num_subbands; ++i)
subbands[i] = new SubbandLayer2(i);
else if (mode == Header.JOINT_STEREO)
{
for (i = 0; i < header.intensity_stereo_bound(); ++i)
subbands[i] = new SubbandLayer2S... |
8477d96a-4fcb-4b34-a8e8-7d71e7450aaf | 2 | public void visit_ldc(final Instruction inst) {
final Object operand = inst.operand();
if ((operand instanceof Long) || (operand instanceof Double)) {
height += 2;
} else {
height += 1;
}
} |
5b796661-8f48-47b9-952e-7c2088f2f8bb | 6 | public static void displayMenu(String input)
{
if(menuNumber.equals("0") && input.equals("0"))
{
System.out.println("Goodbye!");
System.exit(0);
}
switch (input)
{
case "0":
{
System.out.println("What would you like to do?");
System.out.println("0) exit program");
System.out.prin... |
6653b230-15c7-4dfe-9112-056f18f53789 | 7 | private void intalize (){
if (initCounter == 1){
//x and y values
startX = 0; startY = 0;
endX1 = 10; endY1 = 12;
endX2 = 39; endY2 = 12;
endXf = 49; endYf = 24;
topSpace = 15; leftSpace = 12; //spaces from the top and left, hardcoded on e... |
2f6380a7-d7c1-4cfb-86ef-ba3713bbee69 | 8 | public void actionPerformed(ActionEvent e) {
try {
Object source = e.getSource();
if (source == menuItemFileOpen) {
fileOpen();
}
else if (source == menuItemHelp) {
help();
}
else if (source == buttonActivate) {
initWorkflow();
activateWorkflow();
}
else if (sour... |
261a004b-e324-4068-a87e-e2dde548e9ac | 6 | private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2)
{
switch(hiByte)
{
case 0:
return ((jjbitVec4[i2] & l2) != 0L);
case 48:
return ((jjbitVec5[i2] & l2) != 0L);
case 49:
return ((jjbitVec6[i2] & l2) != 0L);
case 51:
re... |
863f15df-754f-440a-9a0a-2452cc5c0e50 | 5 | @Override
protected void reactPressed(MouseEvent event) {
ProgramState curr = StateMachine.getState();
if (curr != ProgramState.ARR_PLAYING) {
if ((Settings.debug & 0b100000) != 0)
System.out.println("Move song " + moveAmt);
ObservableList<String> l = theStaff... |
9848745e-d2c4-4f78-a03c-ce122fc49533 | 9 | public static JSONObject getJson(final Entity result,
final String returnField) {
JSONObject jsonObject = new JSONObject();
if (result != null) {
try {
if (returnField == null || "ID".equals(returnField)) {
if (result.getKey().getName() != null) {
jsonObject.put("ID", result.getKey().getN... |
f1e66497-2bd6-455f-a95a-81f424b7e6a6 | 8 | public void setCurrentSquare(String square){
yCoord = Integer.parseInt(square.substring(1,2));
switch(square.charAt(0)){
case 'a':
xCoord=1;
break;
case 'b':
xCoord=2;
break;
case 'c':
xCoord=3;
break;
case 'd':
xCoord=4;
break;
case 'e':
xCoord=5;
break;
case 'f':
xC... |
393b2b77-5514-4dd7-9226-55bf360f032f | 3 | public WindowCastle(core.Player p, core.Castle c, core.Hero h)
{
super();
//setStyleSheet("background-color: #333; color: white;");
player = p;
castle = c;
hero = h;
Hero g = c.getGarission();
setLayout(layout);
buyWidget.setLayout(buyLayout);
buys[0] = new WidgetBuy(p, c, core.CastleBuil... |
5c21c738-15a4-4d1b-9019-10d32c8753ff | 0 | public static void main(String[] args) {
int numbers[] = {1, 2, 3, 5, 8, 13};
System.out.println("First member of this array is "
+ numbers[0]);
System.out.println("Last member of this array is "
+ numbers[numbers.length - 1]);
} |
a8d00c9e-c307-48bd-ad76-bceb26113cd3 | 2 | @Override
public Auction[] search(String criteria) {
ArrayList<Auction> temp = new ArrayList<Auction>();
for(Auction auc : search){
if(auc.getName() == criteria){
temp.add(auc);
}
}
return temp.toArray(new Auction[temp.size()]);
} |
7378afa3-a3fd-4566-8748-c8da4e310994 | 2 | public void enqueue (Animal a) {
a.setTime( time );
if (a instanceof Dog) {
dogs.addLast( a );
}else if (a instanceof Cat) {
cats.addLast( a );
}
} |
4eb8d80e-24f6-42a5-ab66-bbd2c46ab7b2 | 9 | private void decodeHeader(BufferedReader in, Properties pre, Properties parms, Properties header)
throws InterruptedException
{
try {
// Read the request line
String inLine = in.readLine();
if (inLine == null) return;
StringTokenizer st = new StringTokenizer( inLine );
if ( !st.hasMoreToken... |
2f9c5955-9e8a-4873-8c12-a9d8fe998476 | 3 | private static ImageIcon loadImage(String path)
{
try
{
InputStream stream = getResource(path);
if (stream != null)
{
ImageIcon icon = new ImageIcon(ImageIO.read(stream));
if (icon.getImageLoadStatus() ... |
6f173316-4421-42bc-9b48-b097b1c461c0 | 2 | public int compareTo(Object o) {
TreeElement other = (TreeElement) o;
if (leaf != other.leaf)
// files come after directories
return leaf ? 1 : -1;
return fullName.compareTo(other.fullName);
} |
ab270a6f-1325-4e5d-869d-c8aa09319ace | 8 | public int checkScore(int score){
if(m_scoreBoard.isEmpty()){
return 0;
}
else{
int index = -1;
//DEscobrindo a posiçao:
for(int i = 0; i < 5; i++){
if(score >= m_scoreBoard.get(i).getM_maxCoins()){
... |
7616311b-e791-4678-8735-1220d232d3ad | 6 | @EventHandler
public void BlazeHunger(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.getBlazeConfig().getDouble("Blaze.Hunger.Dodg... |
45de06ab-d3a0-4de3-a900-289518ab06ab | 6 | private void createPswEntry()
{
content = new Composite(shell, SWT.NONE);
content.setLayout(new FormLayout());
FormData fd_content = new FormData();
fd_content.top = new FormAttachment(0);
fd_content.left = new FormAttachment(0);
fd_content.right = new FormAttachment(100);
fd_content.bottom = new FormAtt... |
83d80ab4-b142-47e0-be14-67e70daffe2d | 5 | @Override
public <T extends AggregateRoot<?>> T loadOneBy(Class<T> type,
Specification<T> specification) {
T satisfied = null;
for (final Object aggregate : aggregates.values()) {
if (aggregate.getClass().isAssignableFrom(type)) {
if (specification.isSatisfie... |
d11cf7ca-83d6-4229-a785-8b15d8d12306 | 2 | public void renderHue(int xp, int yp, Sprite sprite, int hueColor) {
int w = sprite.getWidth();
int h = sprite.getHeight();
yp = this.height - yp;
yp-=h;
double hue = Color.getHue(hueColor);
double saturation = (hueColor >> 24 & 0xff) / 255.0;
for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++... |
04cb16a3-3678-48e6-9d7e-abdd4e89c417 | 7 | static int Pprime(int SMax, int O, int OCounter){
int S1 = 0;
int S2 = 0;
int S3 = 0;
int OTemp = 0;
while(S1 <= SMax){
S2 = 0;
while(S2 <= SMax){
S3 = 0;
while(S3 <= SMax){
OTemp = S1+S2+S3;
if(O == OTemp){
OCounter = OCounter + 1;
return OCounter;
}
if(... |
dfba5827-78a9-4caf-b8ce-5aaedc138208 | 9 | public static MouseAdapter dibujarcanvas(final Ventana d){
return new MouseAdapter(){
private Point point;
public void mousePressed(MouseEvent event){
Canvas c = d.getCanvas();
int selected = d.getSeleccionado();
if(!c.isDibujandoTmp()){
c.setDibujandoTmp(true);
if(Ventana.CIRCULO == s... |
b5dbfc38-4c2d-432e-a204-8317f55a834b | 5 | public static void drawHorizontalLine(int x, int y, int length, int color) {
if (y < startY || y >= endY)
return;
if (x < startX) {
length -= startX - x;
x = startX;
}
if (x + length > endX)
length = endX - x;
int total = x + y * width;
for (int index = 0; index < length; index++) {
pixels[to... |
beb0548d-d8e7-4e6d-a9a8-4eb29e78b1ed | 9 | public static void traceForwardRule(Proposition rule, Proposition trigger, Cons consequents) {
if ((consequents != null) &&
(!(consequents == Stella.NIL))) {
{ int indent = 11;
{
System.out.println("RUNNING FORWARD RULE:");
System.out.print(" TRIGGER: ");
}
;
... |
70a32443-6607-4303-ba07-684bf9b19867 | 9 | * @param depth
* depth of the node.
* @return node created.
*/
private static TreeNode createNode(List<LAB> LABValues, int k, int depth) {
// Check if the List is empty
if (LABValues == null || LABValues.size() == 0)
return null;
int axis = depth % k;
// Sort the values based on the AXIS
... |
93d7ec1c-dbd3-4029-9a50-fd02fa08604d | 3 | public JSONWriter array() throws JSONException {
if (this.mode == 'i' || this.mode == 'o' || this.mode == 'a') {
this.push(null);
this.append("[");
this.comma = false;
return this;
}
throw new JSONException("Misplaced array.");
} |
a4aa845b-29f3-44b2-b851-614f3a1595fb | 2 | protected void fireSupportException(final ISocketServerConnection ssc,
Exception exception, Long callId) {
try {
if (callId == null) callId = new Long(0);
// set that it is error-answer to server
IRemoteCallObjectMetaData meta = new RemoteCallObjectMetaData(null, RemoteCallObjectType.Res... |
ac1837db-2d6f-4fab-9bb8-ff7738e17742 | 8 | public static boolean createFile(String directory, String name, FileType type, String moduleName, boolean isPublic, boolean withTests, boolean withHeader, boolean withSource, IOutput output)
{
// initial checks
output.writeLine("Creating file '" + name + "'...");
if (!FileUtils.isNameOk(name... |
43b700c0-7ba9-49f6-86b3-bc326ec7115f | 3 | public void formBond(Molecule A, Molecule B, Molecule Asub, Molecule Bsub, int bondingSite1, int bondingSite2){
A.calculateMoleculeID(0,0,new int[0]);
B.calculateMoleculeID(0,0, new int[0]);
ArrayList<Molecule> molsA = A.split(Asub.getMolID());
A.unFlagAll();
ArrayList<Molecule> molsB... |
c9aabccb-9cf8-46a2-bc73-9152f03fdbb3 | 5 | private Module gfpProductionModule()
{
ComponentInstantiation pspaSPromoterComp_sig = new DnaComponentInstantiation(
URI.create("http://turingatemyhamter.co.uk/example#GFP_production_module/pspaS_promoter"),
"pspaS_promoter",
pspaSPromoterComp
);
Port pspaSPromoterComp_... |
910a29dc-5970-49b6-b4d4-0dffaee0f240 | 0 | @Override
public int delete(Integer idMetier) throws Exception {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
} |
116b5d17-eebd-4213-a48f-f3a28269e4f6 | 8 | @Override
public boolean execute(CommandSender sender, String[] args)
{
if(sender instanceof Player == false)
{
sender.sendMessage("You would have to be an online player");
return true;
}
if(!((Player)sender).getWorld().getName().equals(p.getWorld())) retu... |
3cb5dcd8-6339-47cf-b879-02b8a7946d20 | 1 | private String getLongValue(final Field field, final Object object) {
Object result = getRawValue(field, object);
if (result == null) {
result = "";
}
return result.toString();
} |
5ccae2eb-af5e-4c6c-90f4-91431f539195 | 3 | public void fireEvent(UIEvent e) {
if(e instanceof MouseEvent) {
processMouseEvent((MouseEvent) e);
} else if(e instanceof TimeEvent) {
processTimeEvent((TimeEvent) e);
} else if(e instanceof WindowEvent) {
processWindowEvent((WindowEvent) e);
}
} |
3577ff5e-311c-4e9f-8f2f-64c081f7c16a | 7 | private void parseTerm(Object cl_o, NVObject cl_r, String str_term) {
String lstr_methodName[] = str_term.trim().split(" ");
if(lstr_methodName.length == 0) {
BTLog.error(this, "parseTerm", str_term + " cannot be split for spaces");
return;
}
BTLog.debug(this, "parseTerm", "split term for method n... |
466c2bba-9398-46bb-9389-7f6286cb7c45 | 4 | public static ArrayList<Player> getAllPlayers() {
ArrayList<Player> players = new ArrayList<Player>();
if (blueMembers != null) {
players.add(blueMembers);
}
if (greenMembers != null) {
players.add(greenMembers);
}
if (orangeMembers != null) {
players.add(orangeMembers);
}
if (redMembers != nu... |
b79ebab6-0b1b-4ba8-ada4-ba322e31ba9d | 6 | public void visit_dup2(final Instruction inst) {
// 0 1 -> 0 1 0 1
// 0-1 -> 0-1 0-1
if (Tree.USE_STACK) {
saveStack();
final Expr[] s01 = stack.pop2();
if (s01.length == 1) {
// 0-1 -> 0-1 0-1
final StackExpr[] s = new StackExpr[] { (StackExpr) s01[0] };
manip(s, new int[] { 0, 0 }, Stack... |
29452031-1fb5-4003-b38f-d9927f52a9c0 | 8 | @Override
public int compareTo(Karte k)
{
if (farbe > k.gibFarbe()) {
return -1;
} else if (farbe < k.gibFarbe()) {
return 1;
} else if (farbe == k.gibFarbe() && nummer > k.gibNummer()) {
return -1;
} else if (farbe == k.gibFarbe() && nummer < ... |
7a034fac-25f3-4b92-8102-7aa380a908fd | 7 | private void handleClient(String command) throws Exception {
command = command.toLowerCase();
System.out.println(command);
if (command.equals("get information")) {
getCardsInformation();
} else if (command.equals("get statistics")) {
getStatsFile();
} else if (command.equals("post configuration")) {
... |
79896318-fc69-45c0-8fe8-701f72920ae9 | 3 | public void monitorFileDelete(Path file) {
try {
if(file.startsWith(sourceDir)){
Path subPath = sourceDir.relativize(file);
for(Path targetDir : targetDirs){
Path newPath = targetDir.resolve(subPath);
logger.info("rm "+newPath.toString());
Files.delete(newPath);
}
}
} catch ... |
ac8686d5-d4df-4247-8de6-433b3b61e5f8 | 5 | public void updateAllContents() throws SQLException, IOException {
Connection conn = (Connection) dbHandler.initiateSystemDBConn()[0];
ArrayList<Task> tasklisttemp = dbHandler.initiateTaskList(conn);
ArrayList<TimeSpentOnTask> tsotListtemp = dbHandler.initiateTimeSpentOnTaskList(conn);
... |
a8e34c16-28db-49b2-b289-4ff443020ea8 | 5 | private static String packGamesListPacket(Packet packet) {
StringBuilder res = new StringBuilder();
@SuppressWarnings("unchecked")
ArrayList<GameLobby> data = (ArrayList<GameLobby>) packet.getData();
res.append("\n");
for(int i = 0; i < data.siz... |
c08f4682-5ca8-4dde-ac34-be16972ebc83 | 5 | public static boolean areUserEqual(final User usr1, final User usr2) throws TestException {
if (!usr1.getLogin().equals(usr2.getLogin())) {
throw new TestException("Logins not equals");
}
if (!usr1.getFirstName().equals(usr2.getFirstName())) {
throw new TestException("Fi... |
9a6c7e6e-2a52-4458-8009-4cf9abc9b4b9 | 3 | private List<Raum> setRaumKoordinaten(List<XmlRaum> xmlRaumListe,
List<Raum> raumListe)
{
for(XmlRaum xmlRaum : xmlRaumListe)
{
for(Raum raum : raumListe)
{
if(raum.getId() == xmlRaum.getID())
{
raum.setKoordinaten(xmlRaum.getX(), xmlRaum.getY());
raum.setItems(xmlRaum.getItems());
... |
755b9185-c725-4abd-a2fa-389402fdb201 | 7 | @Override
public List<Homonym> getAllPTWords() {
List<Homonym> result = null;
String sql = "SELECT portugal, popis, popis2, slovak1, skratka1, skratka1b, slovak2, skratka2, skratka2b, " +
"slovak3, skratka3, skratka3b, slovak4, skratka4, skratka4b, slovak5, skratka5, skratka5b, " +
... |
9af7f64c-11bc-4462-94a4-3a4a9caca6e4 | 2 | public ArrayList<EmpresaBean> getPage(int intRegsPerPag, int intPage, ArrayList<FilterBean> alFilter, HashMap<String, String> hmOrder) throws Exception {
ArrayList<Integer> arrId;
ArrayList<EmpresaBean> arrEmpresa = new ArrayList<>();
try {
oMysql.conexion(enumTipoConexion);
... |
3c6f9113-1de6-4db3-90bd-c9ee0ff2f82c | 7 | public void nextState(String airplaneId) {
Query qCurrentState = em.createQuery("select e from airplane e where e.id = '" + airplaneId + "'");
if( qCurrentState.getResultList().size() > 0) {
Airplane airplane = (Airplane) qCurrentState.getResultList().get(0);
Airplane.State newState = State.IN_APPRO... |
28611b04-48ec-4693-b0b2-a0a4f37a759c | 0 | public OrderLine() { } |
e3bbff03-8a87-42c4-9223-a66881364cec | 2 | public void set_mode(short new_mode) throws IOException {
byte[] data=new byte[2];
data[0]=(byte)SET_MODE;
data[1]=(byte)new_mode;
byte[] result = this.sendAndReceive(data, COM_TIMEOUT, 1);
if (result.length==0) throw new IOException("no answer from device");
if (result[0]!=0) throw ... |
a615db8f-6e91-436c-b602-8b5748c94830 | 6 | * @param extensions
* @return String
*/
public static String findFileInLoadPath(String file, Cons extensions) {
{ String expandedfile = file;
if (extensions == null) {
extensions = Stella.$STELLA_FILE_EXTENSIONS$;
}
{ Stella_Object dir = null;
Cons iter000 = Cons.cons(Stri... |
6858bf5d-ba3e-4c27-9ee0-8e5141f0c46f | 0 | public static void main(String[] args) {
MyClass myClass = new MyClass();
} |
3e0f3a29-23b6-44a7-9b54-41fc4174ab02 | 7 | @Override
@SuppressWarnings("static-access")
public double kinship(Individual indi) {
if(this==indi) return 1;
if(fitness!=indi.fitness)return 0;
int hit = 0;
int miss = 0;
int n;
Sudoku oth = (Sudoku) indi;
for (int r=0; r<9; r++)
for(int c=0; c<9; c++)
if((n=rows[r][c])>0)
if(n==oth.rows[... |
a3240055-8d5c-4811-a1ff-1a044b835f9c | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Physical target=mob.location();
if(target==null)
return false;
if(target.fetchEffect(ID())!=null)
{
mob.tell(L("This place is already consecrated."));
return false;
}
if(!supe... |
a5bafad1-4e2b-46cb-8f7a-0477b0208ca4 | 2 | public static UUID fromString(String name) {
String[] components = name.split("-");
if (components.length != 5)
throw new IllegalArgumentException("Invalid UUID string: "+name);
for (int i=0; i<5; i++)
components[i] = "0x"+components[i];
long mostSigBits = Long.decode(components[0]).lon... |
b2291135-fdad-43f8-9981-f3c37aa4dc3e | 7 | public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double)o).isInfinite() || ((Double)o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
f6501c0a-b744-4c68-8423-62e590f28de3 | 4 | public boolean canUpdateUnit(int id) {
if (((id >= 21 && id <= 26) || id == 31) && candy >= candyTable.get(id))
return true;
else
return false;
} |
e3b7a299-796c-4745-9563-39468fc760a2 | 9 | private JPopupMenu createToolMenu() {
final JPopupMenu ret = new JPopupMenu();
ImageIcon publicImg = null, protectImg = null, privateImg = null, packageImg = null, upImg = null, downImg = null;
ImageIcon addItemImg = null, delItemImg = null;
try {
addItemImg = new ImageIcon(ImageIO.read(this.getClass()
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.