method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
8e7b8781-7bf7-4c1f-be82-8571f7fd54a9 | 2 | private String readFromFile() {
/**This Method Reads from a specific file **/
String sourceContents = "";
try {
URL fileLoc = new URL("http://www.digitalworlddevelopment.com/Java/content.txt");
String host=fileLoc.getHost();
URI fileName = fileLoc.toURI();
... |
0b3b4a63-941a-4d85-9aae-e911d3d65264 | 6 | public fightermakerView(SingleFrameApplication app) {
super(app);
current_move=null;
current_frame=null;
current_hitbox=null;
red_hitboxes=new ArrayList<Hitbox>();
blue_hitboxes=new ArrayList<Hitbox>();
listOfMoves_main_file=null;
... |
9ad17b38-0103-45b1-9108-945a7818537b | 8 | public int serve(HTTPServer.Request req, HTTPServer.Response resp) throws IOException {
synchronized (mApp) { // Only allow one thread to touch app at a time.
mApp.setRequest(new WikiRequest(req, mContainerPrefix));
try {
WikiContext context = mApp.getContext();
... |
389f1155-dd7e-440e-8c6c-e63d32aa138f | 7 | private void animateTexture(int textureId) {
if (!lowMemory) {
if (Rasterizer.textureLastUsed[17] >= textureId) {
Background background = Rasterizer.textureImages[17];
int area = background.imageWidth * background.imageHeight - 1;
int difference = background.imageWidth * animationTimePassed
* 2;
... |
0739bfee-7d3f-41c6-823a-b1ebc1971808 | 6 | public void encode_file(String filename)throws FileNotFoundException, IOException
{
//C:\Users\Manu\Desktop\Workspace\IntelliJ\HuffmanCoding\src\test.txt
//System.out.print("Enter the filepath: ");
BufferedReader br= new BufferedReader(new FileR... |
11ab20ba-c201-48aa-92b6-f0f94c7d830d | 1 | public static ObjectType toFieldSignature(String sig) throws BadBytecode {
try {
return parseObjectType(sig, new Cursor(), false);
}
catch (IndexOutOfBoundsException e) {
throw error(sig);
}
} |
54329ce2-e6d0-4b4b-ad3a-9a25d79ecf04 | 7 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if((affected!=null)
&&(affected instanceof MOB)
&&(msg.amISource((MOB)affected))
&&(msg.targetMinor()==CMMsg.TYP_DAMAGE))
{
final int damageType=Weapon.TYPE_NATURAL;
if(msg.sourceMessage()!=null)
msg.setSourceMessage... |
c4a63475-0b64-4c36-ac61-d23c67b6a7df | 7 | protected void buttonActionPerformed(ActionEvent evt) {
for(JTextComponent uiSource: uiSources) {
if(uiSource.isFocusOwner()) {
String text = uiSource.getText().trim();
JButton button = (JButton) evt.getSource();
String key = button.getText();
if(uiSource instanceof JFormattedTextField && (key.comp... |
9b914702-0241-4e6a-aa8a-bc9509912183 | 0 | public void matchesInterface()
{
Filter isInterface = isInterface();
assert !isInterface.matches( DummyAnnotation.class );
assert isInterface.matches( Matcher.class );
} |
7d382423-6e0e-4f3a-8341-87860b7def3f | 5 | @Override
public void handleEvent(ERGameEvent e) {
switch(e.eventType){
case ERGameEvent.EVENT_MESSAGE:
EmptyRoom.logMessage(e.data[0]+": "+e.data[0].toString());
break;
case ERGameEvent.EVENT_UPDATE:
if(this.objects.containsKey( (e.data[0])) ){
objects.get( (e.data[0]) ).updateFromServer(e);
}... |
daa9a7ae-e72d-443c-a959-d33a393fd7bf | 4 | void summary(String templateFile, String outputFile, boolean noCommas) {
try {
// Configure FreeMaker
Configuration cfg = new Configuration();
// Specify the data source where the template files come from
if (useLocalTemplate) cfg.setDirectoryForTemplateLoading(new File("./templates/")); // Use local 'te... |
6abaabae-8afb-4223-8c05-36f43e93ac27 | 2 | public static void addItemSomething(Item item){
if(item != null){
if(ItemStorageInventory.create().addItem(item)){
System.out.println("add "+ item.toString() + " successfully\n");
}else{
System.out.println("add "+ item.toString() + " failed\n");
}
}else
System.out.println("add item " + " fa... |
dcf114d7-d9a6-4960-b052-ad67791322a1 | 5 | public void setColor(int r, int c, char clr){
if(r >= size || c >= size || r < 0 || c < 0){
System.err.println("Invalid dimentions (" + r + "," + c + ") for size " + size);
System.exit(0);
}
if(clr != '.')
puzzle[r][c].color(clr);
else
puzzle[r][c].uncolor();
} |
7dde74a0-f499-4163-8312-2126b8cb8eac | 2 | public void InicializaVerticesDoColider() {
Colider colider = this.getColider();
getColider().setQuantDePontos(18);
for (int i = 0; i < colider.pontos.length; i++) {
colider.pontos[i] = new Point();
}
colider.pontos[0].x = pos.x + 7;
colider.pontos[0].y = pos.... |
8def5924-cd95-4391-a55e-d27a1d394ccb | 1 | public void setColor(Color c)
{
garisson.setColor(c);
if (WorldMap.getLastInstance() != null) {
WorldMap.getLastInstance().colorChanged(this, c);
}
color = c;
} |
e5bd1608-b8d9-485c-b31d-c09e3fb4ef4b | 0 | public Stat get(StatType s) {
return stats.get(s);
} |
a96b9fdf-608d-4d92-addf-c7de668bf069 | 5 | @Override
public void run() {
URLConnection conn = null;
try {
conn = prepareConnection();
prepareStream(conn);
response.setStatus(DownloadResponseImpl.Status.IN_PROGRESS);
try (InputStream inputStream = conn.getInputStream()) {
byte[... |
d3d97089-4f22-439e-b06a-6eaae221c658 | 7 | public Message RetrieveMessage(String value, Filter filter, Order order, boolean delete)
throws IOException, QueueInexistentException, ClientInexistentException, UnspecifiedErrorException, InvalidHeaderException {
this.sendMessage(new RetrieveMessageRequest(value, filter, order, delete));
ProtocolMessage messa... |
f51dd7b5-fe04-4453-8eca-9bc12e3b3b26 | 0 | public static List<Product> sort(List<Product> list) {
ComparatorProduct comp = new ComparatorProduct();
Collections.sort(list, comp);
return list; // 返回排序后的列表
} |
10e3e1e0-da9c-4245-9e56-d6004b334e7a | 1 | public int[] listadoExtracciones()
{
ArrayList devolver = new ArrayList();
String[] nombre,campos;
int[] solucion;
campos = new String[]{"id_proyecto","nombre_proyecto"};
devolver = BDextracciones.mostrarDatos("proyecto", campos);
solucion = new int[devolver.size()];
... |
232dff52-5615-4a8d-95cc-a149c19c3473 | 2 | private void setHeldRsrceType() {
switch (this.type)
{
case PROF_UNEMPLOYED: {
this.heldRsrceType = Chunk.RSRCE_NOTHING;
break;
}
case PROF_LUMBERJACK: {
this.heldRsrceType = Chunk.RSRCE_WOOD;
break;
}
}
} |
b46fdee6-e82b-42e1-8ecf-bd5f7055b6c6 | 9 | private String search(HttpServletRequest req) {
String queryStr = req.getParameter("query");
if (queryStr == null) {
queryStr = "";
}
String limitStr = req.getParameter("limit");
int limit = 10;
if (limitStr != null) {
try {
limit = Integer.parseInt(limitStr);
} catch (... |
648c9a8a-f913-4ddd-861c-98a2796e3ee3 | 5 | public double addPoint(Point p, double angle, double THRESHOLD2)
{
if (angle != ConnectedComponent.ANGLE_UNDEFINED)
{
// test point is not a corner
double diff = angleDiff(angle, prevAngle);
// if the sign of angle change is reversed
if (s... |
00ccc1fb-2c6d-45b0-a848-870106a94756 | 2 | public static void main(String[] args)
{
for (int i = 1; i <= 10; i++)
{
for (int j = 1; j <= 10; j++) {
System.out.print(i*j + " ");
}
System.out.println();
}
} |
07797af1-4c81-44f6-8d26-7e5b72e6a11f | 7 | public static void main(String[] args){
/*
//Test Helper by creating few player objects
Player p1 = Helper.generatePlayer("Canucks");
Player p2 = Helper.generatePlayer("Canucks");
Player p3 = Helper.generatePlayer("Canucks");
Player p4 = Helper.generatePlayer("Canucks");
p1.print();
p2.print();
p3.print... |
293e9a1c-0958-4056-b25d-4bf36240d525 | 0 | @BeforeClass
public static void setUpClass() throws Exception {
ctx = new AnnotationConfigApplicationContext(ConnectionConfig.class);
} |
aee16a80-1fbf-479e-9e9f-776414589975 | 0 | @Override
public int hashCode() {
return x + y;
} |
b5552b24-ed81-45a1-9d79-5adc85841d02 | 0 | private void draw() {
drawBackground();
drawWorld();
drawPlayer();
} |
ae342841-3e9d-457a-9a54-b1142fedc540 | 0 | public void testBase64() {
String source = "abcdefghijklmnopqrstuvwxyz";
String result = SecurityCoder.base64Encoder(source.getBytes());
byte[] data = SecurityCoder.base64Decoder(result);
assertEquals(source, new String(data));
} |
41bfa99d-fa50-4357-ac9a-c42665c2c6f6 | 4 | public static void safeClick(Selenium s, String path, UserSelection type) {
if (s.isElementPresent(path)) {
s.click(path);
if (type.equals(UserSelection.ENDORSING)) {
writer.write("Successfully ENDORSING for : "
+ safeGetText(s, "//*[@id='name']/h1/span/span[1]"));
} else {
writer.write("Succ... |
32d4f5ae-3907-46c3-a26f-4565d8b02ec7 | 4 | public void render() {
float x0 = x + Game.xScroll / 16;
float y0 = y + Game.yScroll / 16;
float x1 = x + 1 + Game.xScroll / 16;
float y1 = y + 1 + Game.yScroll / 16;
if (x1 < 0 || y1 < 0 || x0 > Component.width / 16 || y0 > Component.height / 16) return;
Texture.tiles.bind();
glBegin(GL_QUADS);
R... |
6436465d-982c-4c5f-acbd-5982e2b60eba | 3 | public boolean equals(Object other) {
if(other == null) {
return false;
}
if(other == this) {
return true;
}
if(!(other instanceof Artist)) {
return false;
}
Artist otherArtist = (Artist)other;
return (name.equals(otherArtist.getName()));
} |
1b4b99c5-7044-4537-872c-69c1d4e1c4f6 | 7 | public static String convertToJavaIdentifier(String string) {
if (string == null || string.isEmpty()) {
return new String();
}
char[] ca = string.toCharArray();
StringBuilder sb = new StringBuilder();
for (char c : ca) {
if (sb.length() == 0) {
if (Character.isJavaIdentifierStart(c)) {
sb.appen... |
43bce185-5de5-436e-b1a8-3d82eb59dcd4 | 6 | public String getDirectionStr() {
String dir = direction.name().toLowerCase();
switch(dir) {
case "northwest":
dir = "NW";
break;
case "north":
dir = "N";
break;
case "northeast":
dir = "NE";
break;
case "south":
dir = "S";
break;
case "southwest":
dir = "SW";
break;
cas... |
d76efc3b-7777-4afa-a3a5-c698ef38a511 | 5 | public static void display_alll(List<Map<TableArticle, Integer>> list) {
for(Map<?,?> m : list){
Entry<?,?> t = m.entrySet().iterator().next();
System.out.println( t.getKey().toString() + "\nx " + t.getValue().toString() );
}
} |
8d3deef2-df3c-472a-91bb-25a8d13029a6 | 2 | public Complex[] getData1i() {
for(int i=0;i<count;i++){
double im = -x[i].im();
x[i].setIm(im);
}
setData1(x, power);
fd1i = getData1();
for(int i=0;i<count;i++){
double re = fd1i[i].re();
double im = -fd1i[i].im();
fd1i[i].setRe(re/count);
fd1i[i].setIm(im/count);
}
return fd... |
009976e7-8970-43c9-8c9e-87e99691b0cf | 1 | public static void main(String args[]) throws InterruptedException {
String importantInfo[] = {
"Each thread is assoceated with a instace of Thread.",
"Thread can be created by Runnable object.",
"Thread can also be created by subclassing the Thead class.",
"Creat... |
eeaf4b51-e591-4472-ba85-bae9d6b8bef4 | 1 | public static void connection(String configfile)
{
ConfigGetDb getconfig = new ConfigGetDb(configfile);
String driver = getconfig.driver;
String url = getconfig.url;
String uesr = getconfig.user;
String password = getconfig.password;
try
{
Class.forName(driver);
logger.debug("Con... |
3727c1a9-4235-49cb-a0c6-19e3158663b4 | 8 | public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] a = new int[n];
for(int i=0;i<n;i++){
a[i]=in.nextInt();
}
int i = 0;
while(i<a.length-1 && a[i+1]>=a[i]) i++;
if(i==a.length-1){
System.out.println(0);
return;
}
int ans = a.le... |
f9b9c7cd-e671-4b07-9b1f-c5fd56c3a002 | 6 | public static void readMatrixBlocks(String path, HamaConfiguration conf,
int rows, int cols, int blockSize, int lastI,
List<Block> emptyBlocks) {
SequenceFile.Reader reader = null;
try {
FileSystem fs = FileSystem.get(conf);
VectorWritable row = new VectorWritable();
IntWritable i = new IntWritable()... |
31714d70-b691-4254-99d4-51298add7c3c | 6 | private byte saveFile(InputStream is, String fullPath, long fileSize,
long lastModifiedTime, boolean isDir, String realFileFullPath,
TextProcessor textProcessor) throws Exception {
byte message = DropboxConstants.NO_FILE_OPERATION;
try {
... |
9e4e1869-b0b1-401a-ba81-4da7c5c6d5fe | 9 | private long getDocCount(File file) {
System.out.println("Counting documents in file ...");
long startTime = System.currentTimeMillis();
FileInputStream localFis = null;
GZIPInputStream localGis = null;
InputStreamReader localReader = null;
BufferedReader... |
5d42fd61-e4bc-4a87-b0b3-5a1559fa31bc | 4 | public String getDataReg() throws SQLException, ClassNotFoundException {
String sts = new String();
Connection conPol = conMgr.getConnection("PD");
if (conPol == null) {
throw new SQLException("Numero Maximo de Conexoes Atingida!");
}
try {
Statement stmt ... |
40ea654d-fe2e-4e12-9882-de18fa406318 | 1 | public static void resetIDtoZero(Class<? extends BaseEntity> clazz) {
ID_MAP.put(clazz, new AtomicInteger(0));
} |
590dfccd-cc70-442f-9224-fb1c3422231f | 2 | public DHCPDetect(){
try {
this.localIpAddress = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
e.printStackTrace();
}
serverIdentifier = null;
// fill client identifier: HTYPE MACAddress
clientIdentifier = new byte[1+LocalMacAddre... |
b5e28eb8-1c99-4ec7-acab-41ebb6d02d80 | 0 | public void setLatitude(double latitude)
{
this.latitude = latitude;
} |
08adc053-bffa-4374-81df-1dcfe040659e | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... |
0b9a82c2-a9ae-4dac-abbf-bac29579294b | 3 | public void visitJumpInsn(final int opcode, final Label label) {
minSize += 3;
if (opcode == GOTO || opcode == JSR) {
maxSize += 5;
} else {
maxSize += 8;
}
if (mv != null) {
mv.visitJumpInsn(opcode, label);
}
} |
173ed998-d025-48fb-a028-ae817ae1a775 | 1 | public void dispose () {
try {
_disposed = true;
_socket.close();
}
catch (Exception e) {
// Do nothing.
}
} |
adbdc7c4-c0c3-4083-aaea-0dbed24c3657 | 7 | public void update()
{
// so it is adding 1 to sAngle only if it hits 0 ant it hits 360 too
//if (sAngle > 0 && fill < 270)
if (sAngle > one && fill <= FILL)
mM = 1;
else if(sAngle <= one)
mM = -1;
// takes -1 to 45 and +2 to fill until 0 and 360
sAngle -= mM;
// this keeps it 270;
//fill... |
bdfceb5d-8b06-49e4-a2d5-6a897fd21f46 | 7 | private boolean isPossibleBlock(int[][] game, int x, int y, int number) {
int x1 = x < 3 ? 0 : x < 6 ? 3 : 6;
int y1 = y < 3 ? 0 : y < 6 ? 3 : 6;
for (int yy = y1; yy < y1 + 3; yy++) {
for (int xx = x1; xx < x1 + 3; xx++) {
if (game[yy][xx] == number)
... |
a52dd24b-802a-47db-bfd2-78fb6f8415fe | 3 | private void backTrace(String word,String start,List<String> list){
if(word.equals(start)){
list.add(0,start);
results.add(new ArrayList<String>(list));
list.remove(0);
return;
}
list.add(0,word);
if(map.get(word) != null)
for(String s: ... |
b83d0b9f-49f6-4396-b93d-5f4b82ab525c | 6 | public void drawTail(Graphics g, GameObject front) {
Image img = null;
int x = getMotion().getX();
int y = getMotion().getY();
int fx = front.getMotion().getX();
int fy = front.getMotion().getY();
if (x == fx){
if (y < fy)
img = imgTailDown;
else if (y > fy)
img = imgTailUp;
} else if (y == ... |
5cc908b3-8707-421d-a428-51b781e13ae0 | 1 | public void sendObject(Object obj){
try{
b.writeObject(obj);
}catch(Exception e){
e.printStackTrace();
}
} |
76c34d26-77c3-4884-bffd-e9e2cd040ecb | 8 | public boolean similar(Object other) {
if (!(other instanceof JSONArray)) {
return false;
}
int len = this.length();
if (len != ((JSONArray)other).length()) {
return false;
}
for (int i = 0; i < len; i += 1) {
Object valueThis = this.ge... |
a6477b86-20ef-4e03-9618-6c7f03d52ad4 | 7 | @Override
public void run() {
long tc = 0;
Transaction tx = graph.beginTx();
Iterable<Node> nodes = GlobalGraphOperations.at(graph).getAllNodes();
HashSet<Node> set = new HashSet<Node>();
for (Node u : nodes) {
set.clear();
for (Relationship r : u.getRelationships(Direction.BOTH)) {
Nod... |
e09849a9-3d91-4bb2-b7d1-2aacebd5c84f | 2 | public Team getOpposite(){
if(this == RED) return BLUE;
else if(this == BLUE) return RED;
else return NONE;
} |
95990a29-b611-44de-957a-aa266f05211b | 7 | public void write(int bits, int width) throws IOException {
if (bits == 0 && width == 0) {
return;
}
if (width <= 0 || width > 32) {
throw new IOException("Bad write width.");
}
while (width > 0) {
int actual = width;
if (actual > t... |
45902e05-043d-4238-acaf-881b99839930 | 2 | @EventHandler
public void onEntityDeath(EntityDeathEvent event) {
// do not act when disabled TODO, use unregister when available
if ( !this.sheepFeedPlugin.isEnabled() ) {
return;
}
Entity entity = event.getEntity();
if ( entity instanceof Sheep ) {
this.sheepFeedPlugin.sheepDied((Sheep) entity);
... |
26036456-1dd8-48bc-83de-fb448154cb45 | 4 | public ArrayList<Prestamos> getPendientes(){
PreparedStatement ps;
ArrayList<Prestamos> rows = new ArrayList<>();
try {
ps = mycon.prepareStatement("SELECT DISTINCT Prestamos.*, Libros.nombre as lnombre, Usuarios.nombre as unombre FROM Prestamos, Libros, Usuarios WHERE Prestamos.id_... |
dab558cb-5672-4747-9960-4d070349f7a4 | 3 | public void pastCrowl(){
DatastoreService datastore = DatastoreServiceFactory
.getDatastoreService();
Entity past_string = null;
try {
Key key = KeyFactory.createKey("past_string", "onlyOne");
past_string = datastore.get(key);
} catch (Throwable t) {
}
past_string.setProperty("text",new Text(new P... |
659a8195-3d54-47f6-9b11-f115c4ff830f | 9 | @Override
public void onLoadStateChange(LatestVersionListEvent event)
{
switch (event.getSource().getLoadState()) {
case FAILED:
status = Status.FAILED;
break;
case IDLE:
status = Status.IDLE;
break;
case... |
a13e8c4e-73b1-4226-b992-ee5de686cbb4 | 9 | public static String unhtmlentities(String str) {
//initialize html translation maps table the first time is called
if (htmlentities_map.isEmpty()) {
initializeEntitiesTables();
}
StringBuilder buf = new StringBuilder();
for (int i = 0; i < str.length(); ++i) {
... |
7461a16b-164a-49ea-888d-4b897c794c48 | 1 | public void testIsMatch_Partial() {
// Year=2005, Month=7 (July), DayOfWeek=2 (Tuesday)
Partial test = createYMDwPartial(ISO_UTC, 2005, 7, 2);
LocalDate partial = new LocalDate(2005, 7, 5);
assertEquals(true, test.isMatch(partial));
partial = new LocalDate(2005, 7, 4);
... |
951f55e2-1710-4fde-b744-34bf97e86bb0 | 9 | public static void main(String[] args) {
//OLD
// List groceryList = new ArrayList();
// groceryList.add("Chocolate");
// groceryList.add("Milk");
// groceryList.add("Yogurt");
// groceryList.add("Graham crackers");
//
// //had to cast prior to JDK5:
// S... |
60daa333-1331-4aa3-b2b3-1cde85ca8218 | 4 | @Override
public int getInput() {
if(Keys.isDown(Keys.W)){return Keys.W;}
if(Keys.isDown(Keys.S)){return Keys.S;}
if(Keys.isDown(Keys.A)){return Keys.A;}
if(Keys.isDown(Keys.D)){return Keys.D;}
return -1;
} |
569fab7a-537b-4eb4-a5b2-600fe5547464 | 4 | public void paintComponent(Graphics g) {
super.paintComponent(g);
if (_image != null) {
if (!_autoSize) {
g.drawImage(_image, _x, _y, _image.getWidth(null), _image.getHeight(null), null);
}
else {
Graphics2D g2d = (Graphics2D) g;
Double scaleWidth = new Double(getWidth()) / new Double(_i... |
d868f956-1157-4a90-b703-ef0af76f5b30 | 0 | public MonitoredOutputStream(OutputStream target, OutputStreamListener listener)
{
this.target = target;
this.listener = listener;
this.listener.start();
} |
18e669cc-3899-4486-a158-223638079348 | 1 | private static void createBombers(IBomber[] bombers, Match m, String[] args) throws IOException {
ServerSocket socket = new ServerSocket(PORT_NO);
for (int i = 0; i < bombersCount; i++) {
String aiLocation = args[i];
bombers[i] = ProcessBotFactory.buildBomber(i, INITIAL_COUNT_OF_... |
5dc08aad-8592-4238-8738-62d8e2b3cd4b | 1 | public void method()
{
try
{
System.out.println("Try 块开始 !");
// return;
/**
*
* 如果这里是return时,运行结果如下:
* Try 块开始 !
* 程序即将结束... ... !
*
* 如果在try块中存在return语句,那么首先也需要将finally块中的代码执行
* 完毕,然后方法在返回
*/
System.exit(0);
/**
*
* System.exit(0);时
*
* 系统java... |
bbbc33dc-d6bf-42e7-97bf-dc823b5cd184 | 9 | public void incomingApdu(APDU apdu, Address address, OctetString linkService) throws BACnetException {
// if (apdu.expectsReply() != npci.isExpectingReply())
// throw new MessageValidationAssertionException("Inconsistent message: APDU expectsReply="+
// apdu.expectsReply() +" while NPCI isExpect... |
d3a975bf-3a79-4ea9-81b1-f450c1a57b5c | 9 | @Override
public void setAbilityComponentCodedFromCodedPairs(PairList<String,String> decodedDV, AbilityComponent comp)
{
final String[] s=new String[6];
for(int i=0;i<6;i++)
s[i]=decodedDV.get(i).second;
if(s[0].equalsIgnoreCase("||"))
comp.setConnector(AbilityComponent.CompConnector.OR);
else
comp.s... |
1c197f3d-0d38-4664-a37f-ca25477fd4d4 | 9 | public static Object[] getPropertyIds(Scriptable obj)
{
if (obj == null) {
return ScriptRuntime.emptyArgs;
}
Object[] result = obj.getIds();
ObjToIntMap map = null;
for (;;) {
obj = obj.getPrototype();
if (obj == null) {
bre... |
d8d49498-6d17-4b2b-af83-220c9085d0c0 | 6 | public Enemy(int type, int rank) {
ImageIcon i = new ImageIcon(this.getClass().getResource(zmbDown));
zombieDownImage = i.getImage();
ImageIcon i2 = new ImageIcon(this.getClass().getResource(zmbDown2));
zombieDownImage2 = i2.getImage();
ImageIcon i1 = new ImageIcon(this.getClass().getResource(zmbUp));
zomb... |
11a7857b-31ee-4365-bfca-bd5e018a1f4e | 6 | public void startElement(String namespaceURI, String localName,
String rawName, Attributes atts) throws SAXException {
String k;
if (insidePerson = (rawName.equals("author") || rawName
.equals("editor"))) {
//if start element is ed... |
a4f12721-c08b-4e48-ad4b-dd9e228ef0b7 | 2 | public void addHit(Card x){
if (hit)
{
addCardtoHand(x);
//Request card from dealer or dealer checks if player wants to hit I suppose.
//Add card to hand
runLogic();
}
else if (!hit)
{
System.out.println("Error: Can't call addHit() if !hit! I'm not supposed to run!");
}
} |
626fe696-e7cf-4a47-8c81-df9e6108abf7 | 7 | public MockFacesContextFactory() {
Class clazz = null;
// Try to load the 1.2 version of our mock FacesContext class
try {
clazz = this.getClass().getClassLoader().loadClass("org.apache.shale.test.mock.MockFacesContext12");
constructor = clazz.getConstructor(facesContex... |
6abb2ae4-aa52-4796-a226-cc09acf551df | 9 | private static final void handleDataDoubleEscapeTag(Tokeniser t, CharacterReader r, TokeniserState primary, TokeniserState fallback) {
if (r.matchesLetter()) {
String name = r.consumeLetterSequence();
t.dataBuffer.append(name.toLowerCase());
t.emit(name);
return;
... |
c02d4284-2a20-42ff-b797-f0590d950d3a | 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... |
214f907f-12e7-44a4-8428-7d97d447cec3 | 4 | @Override
public TileSet getBorderOf(int aX, int aY)
{
TileSet tiles = new TileSet(this);
if (getTile(aX - 1, aY) != -1) tiles.add(Tile.create(aX - 1, aY));
if (getTile(aX + 1, aY) != -1) tiles.add(Tile.create(aX + 1, aY));
final int y = (aY + aX) % 2 == 0 ? aY + 1 : aY - 1;
if (getTile(aX, y) != -1) ... |
d1974e72-9d27-4294-8fe3-4eab486d217a | 3 | protected Constructor<? extends ConfigurationSerializable> getConstructor() {
try {
return clazz.getConstructor(Map.class);
} catch (NoSuchMethodException ex) {
return null;
} catch (SecurityException ex) {
return null;
}
} |
91959178-e3a1-4fb6-80ec-fe92f982c3ec | 1 | public void loadComboBox() {
for (Disc disc : Manager.getInstance().getDiscs().getDiscs()) {
cbDiscs.addItem(disc.getName());
}
} |
aa65f9c8-6e25-41e0-8944-0de676172080 | 2 | public static String getCMD() {
String ret = SystemInformation.getOSPath() + CMD_x86;
if (!isX86() && FileUtil.control(SystemInformation.getOSPath().resolve(CMD_x64_wO_c))) {
ret = SystemInformation.getOSPath() + CMD_x64;
}
return ret;
} |
f5d0d859-82f5-425d-b218-f69b65ff47f9 | 5 | public void kidChanged(TreeNodePageWrapper kidWrapper, String message, long value) {
kidsInScanning = 0;
kidsToSave = 0;
for (@SuppressWarnings("unchecked")
Enumeration<DefaultMutableTreeNode> children = children(); children.hasMoreElements();) {
TreeNodePageWrapper kid = (TreeNodePageWrapper) children.ne... |
14ad71f7-ee4d-4016-9462-243393eb58d8 | 1 | private void firePlayerUpdate() {
this.currentPlayer = (this.currentPlayer == CellState.PLAYER_ONE) ? CellState.PLAYER_TWO : CellState.PLAYER_ONE;
this.eventSystem.queueEvent(new PlayerUpdateEvent(currentPlayer));
} |
bc82a2f0-09c7-447b-9d42-24def6fd4fdd | 7 | public String getColumnValue(String strColumnName,int intIndex){
int curColumnID=getColumnID(strColumnName);
if(curColumnID==-1){
System.err.println("ERROR-Column Name not found = "+strColumnName);
try {
throw new Exception();
} catch (Exception e) {
// TODO Auto-generated catch block
e.prin... |
4a38dbc4-2570-43e1-b946-9a21567cdbcd | 7 | void getAltLocLists() {
if (!hasAlternateLocations())
return;
String[] lists = new String[atomSetCount];
for (int i = 0; i < atomSetCount; i++)
lists[i] = "";
for (int i = 0; i < atomCount; i++) {
char id = atoms[i].alternateLocationID;
if (id == '\0' || lists[atoms[i].atomSetIndex].indexOf(id) >= 0... |
0ec6a73a-66f4-48ad-a9ee-e48cde08d1dd | 8 | public static BookStoreResult SendAndRecv(HttpClient client,
ContentExchange exchange) throws BookStoreException {
int exchangeState;
try {
client.send(exchange);
} catch (IOException ex) {
throw new BookStoreException(
BookStoreClientConstants.strERR_CLIENT_REQUEST_SENDING, ex);
}
try {
exc... |
0dbc5113-d324-475a-afed-3775642f4d4c | 9 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
out = response.getWriter();
try {
movieid = request.getParameter("movieid");
} catch (NumberFormatException ex) {
movieid = null;
}
if (movie... |
5eb1ab1f-50ad-45c6-872e-32cc56eb08d2 | 0 | public boolean isOp() {
return _prefix.indexOf('@') >= 0;
} |
59d37cb5-e047-4674-9836-c2094422935b | 8 | public static void saveScene(int[][] array){
int totle = 0 ;
File file = null ;
file = new File("source/stages/");
totle = file.list().length + 1;
String fileName = "stage" + totle ;
File current = new File("source/stages/" + fileName +".txt") ;
FileWriter out = null;
try{
if( !current.exists(... |
5610c6ce-54a0-460b-b988-6896d5a41059 | 3 | public void switchNode(int value1, int value2) {
if (value1 == value2) {
return;
}
Node node1 = this.getNodeByValue(value1);
Node node2 = this.getNodeByValue(value2);
Node parent1 = node1.parent;
Node parent2 = node2.parent;
... |
a821c017-7bb7-4188-bbef-9b4cd2d61951 | 2 | @Override
public void valueChanged(ListSelectionEvent e) {
if (e.getSource() == orderingList) {
// check if order list is empty
if (orderingList.getSelectedIndex() > -1) {
// separate the text in the selected list item
String[] values = orderingList.getSelectedValue().split("\\t");
// call method... |
898d487d-6f52-4def-93b0-df10fde484a4 | 8 | public static void main(String[] args) throws Exception {
if (args == null || args.length == 0) {
testLocale(Locale.getDefault());
} else {
String lang = null;
String country = null;
String variant = null;
for (int i = 0; i < args.length; i++) ... |
6aabccc7-23be-416b-a179-df8deeec9a5b | 5 | public ExtDecimal inc() {
if (type == Type.NUMBER) {
return add(ONE);
} else if (type == Type.POSITIVEZERO) {
return ONE;
} else if (type == Type.NEGATIVEZERO) {
return ONE;
} else if (type == Type.INFINITY) {
return INFINITY;
} els... |
45ecb863-d67a-4a76-82d5-4d1e9e7fe608 | 4 | @SuppressWarnings({"empty-statement", "CallToThreadDumpStack"})
private void miRecebimentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miRecebimentoActionPerformed
if (recebimento != null && !recebimento.isVisible()) {
deskPane.remove(recebimento);
recebimento =... |
3c24da45-0264-4a00-b572-cfbd81d299b3 | 9 | public MiniSplash()
{
start = new ImageIcon("art/buttons/start_btn.jpg");
skip = new ImageIcon("art/buttons/skip_btn.jpg");
exit = new ImageIcon("art/buttons/exit_btn.jpg"); //eventually will be removed
next = new ImageIcon("art/buttons/next_btn.jpg");
skipButton = new JButton(skip);
try {
b... |
3e53406c-2feb-4755-a167-ffd83f9bb600 | 9 | public static boolean isValidPosition(int i, int j){
if(i < 4) return (j > -1 && j < 4);
else if(i > 3 && i < 7) return (j > -1 && j < 3);
else if(i > 6 && i < 9) return (j > -1 && j < 2);
else if(i == 9) return (j == 0);
else System.out.println("invalid Position dected. i="+i+", j="+j); return false;
} |
9b769493-92e0-4642-a964-bbb819332f1b | 4 | private static float calculateDividendPre(String ticker) {
//DIVIDEND DUPLICATE COUNT NEEDS FIX HERE
ArrayList<Float> dividends = new ArrayList<Float>();
float sum = 0;
float dividend = 0;
int dividendId = 82;
for (Entry<Float, float[][]> ent : Database.DB_ARRAY.entrySet()) {
float possibleDividend = ent... |
dbbca72e-46e7-4ab9-9835-30beb046d971 | 6 | public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.