method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
173c312f-9e4b-4b2b-8055-a79432d1db8f | 0 | public Rectangle getRect(){
return new Rectangle(x,y,WIDTH,HEIGHT);
} |
34468848-ed06-457d-b704-bb0b79d6e637 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Dungeon other = (Dungeon) obj;
if (connectedDunge... |
bf774f5c-3403-4d60-a904-84d58597fb27 | 6 | public byte[] getTransportBlocks(String path) {
InnerNode walk = (InnerNode) root;
ArrayList<Hash> neighbours = new ArrayList<>();
LeafNode leaf = null;
// Iteriert von der Wurzel bis zum Blatt
// Merkt sich alle Schwesterhashes auf dem Weg
for (int i = 0; i < path.length(); i++) {
Node needed = null;
... |
d8e6a1f6-4f72-41ed-9e5d-899bf43da4e4 | 8 | public void calcula () { //---------Reloj----------//
Calendar calendario = new GregorianCalendar();
Date fechaHoraActual = new Date();
calendario.setTime(fechaHoraActual);
ampm = calendario.get(Calendar.AM_PM)==Calendar.AM?"AM":"PM";
if(ampm.equals("PM")){
int h = calendario.get(Calendar.HOUR... |
864f5413-7bbf-4314-a83d-99203d83e861 | 5 | public void start() {
isServerRunning = true;
try {
ServerSocket serverSocket = new ServerSocket(port);
display("Server is listening on port " + port + ".");
while (isServerRunning) {
Socket socket = serverSocket.accept();
display("... |
198d5d77-e94b-46e0-a6bb-207c36ed534c | 1 | private void setPoints(TreeNode node, int depth, int thisDepth,
int[] width, int[] widthSofar, Map nodeToPoint) {
// Scale points along ([0,1], [0,1]).
float x = (float) (widthSofar[thisDepth] + 1)
/ (float) (width[thisDepth] + 1);
float y = (float) (thisDepth + 1) / (float) (depth + 2);
nodeToPoint.put(... |
351527fe-a5ef-4c2e-ac75-6697d56e1a23 | 0 | private void handleError(String message, Exception e)
{
MessageDialog.getInstance().showError(message);
LOGGER.error(message, e);
} |
dbd7f269-2dc8-4dce-bac2-3964cbcb3e3e | 0 | public static String getPrivateKey(Map<String, Object> keyMap)
throws Exception {
Key key = (Key) keyMap.get(PRIVATE_KEY);
return SecurityCoder.base64Encoder(key.getEncoded());
} |
8dc62dfb-8418-4d5d-a211-85d386f11431 | 2 | public int stringMatch(int start, int end, int ostart)
{
for (int i = 0; i < end - start; i++)
{
if (input.charAt(start + i) != input.charAt(ostart + i))
{
return i;
}
}
return -1;
} |
61121698-5527-4d52-a5f5-5789e91938e1 | 5 | @EventHandler
public void onBlockBreak(BlockBreakEvent event){
Player p = event.getPlayer();
Block block = event.getBlock();
if ((block.getType().equals(Material.SIGN) || block.getType().equals(Material.SIGN_POST) || block.getType().equals(Material.WALL_SIGN))) {
Casino.conf = Casino.plugin.getConfig();
St... |
bebad67a-a517-4580-a19c-4442ccb6e98c | 8 | @Override
public void run(int interfaceId, int componentId) {
switch(stage) {
case -1:
stage = (byte) (player.getQuestManager().getQuestStage(Quests.NOMADS_REQUIEM) != 2 ? 2 : 0);
sendNPCDialogue(npcId, 9785, "Is it out of foolish loyalty to your master, or is it merely stupidity that brings you here to face... |
61ccbbcc-bbf6-47b1-8370-2aada3b3ffac | 5 | public static synchronized String[] pollServer(String ip, int port)
{
Socket soc = null;
DataInputStream dis = null;
DataOutputStream dos = null;
try
{
soc = new Socket();
soc.setSoTimeout(3000);
soc.setTcpNoDelay(true);
soc.set... |
e0146ae1-e8da-464c-9796-b3391d39ad2f | 3 | @Override
public boolean equals(Object obj) {
Coordinate c1;
boolean result = false;
if(obj instanceof Coordinate){
c1 = (Coordinate)obj;
if(this.X == c1.X && this.Y == c1.Y){
result = true;
}
}
else{
result = false;
}
return result;
} |
9749df90-36f6-4088-992e-bf3ad3b2337a | 1 | private void startMetrics() {
try {
MetricsLite metrics = new MetricsLite(this);
metrics.start();
} catch (IOException e) {
Messenger.info("Why you no use metrics???");
}
} |
ea687589-f177-466f-a5e9-6736ed05465d | 4 | public void setMoodleFileFileField(String field, String value) {
setMoodleFileParentField(field, value);
if (field.equals("isdir") && !value.isEmpty()) setIsDir(Integer.parseInt(value)!=0);
if (field.equals("url") && !value.isEmpty()) setURL(value);
} |
71307034-bb65-4451-b109-11ecf9457df1 | 1 | private void jbAccederActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbAccederActionPerformed
Administrador admin = new Administrador(jtUser.getText().toString(), jtPass.getText().toString(), null);
AdministradorCRUD a = new AdministradorCRUD(MyConnection.getConnection());
if... |
f27251fb-de13-449d-8ff3-99c11377accf | 3 | public List<TreeItem> getItems(){
if(filter != null && filter.items != null){
return new ArrayList<TreeItem>(filter.items);
}
List<TreeItem> result = new ArrayList<TreeItem>();
Enumeration e = getRoot().breadthFirstEnumeration();
e.nextElement();
whil... |
f47d1d76-455d-4304-9330-7c09e8d1ec53 | 6 | public Double mostCommonValue(int col) {
boolean allUnknownValues = true;
Map<Double, Integer> frequencies = new HashMap<Double, Integer>();
for (List<Double> row : data) {
double val = row.get(col);
if (val != UNKNOWN_VALUE) {
allUnknownValues = false;
... |
c9260283-6b68-4c42-bdd8-1e333dbaeaae | 8 | public Matrix solve (Matrix B) {
if (B.getRowDimension() != n) {
throw new IllegalArgumentException("Matrix row dimensions must agree.");
}
if (!isspd) {
throw new RuntimeException("Matrix is not symmetric positive definite.");
}
// Copy right hand side.
double[][]... |
2b6acc3f-a6dc-4b2b-bf58-7b59a5b1fb9b | 0 | public Strategy getStrategy() {
return strategy;
} |
48bf0ce1-61ea-45ff-bec1-55af75296f7b | 8 | public static Matrix read(BufferedReader input) throws java.io.IOException {
StreamTokenizer tokenizer= new StreamTokenizer(input);
// Although StreamTokenizer will parse numbers, it doesn't recognize
// scientific notation (E or D); however, Double.valueOf does.
// The strategy here is to disable Stre... |
bfb1e54c-0b2f-4804-8f61-be41f5e82623 | 9 | public long getNext(EditorObjectType type)
{
switch(type)
{
case BLOCK:
blockN++;
return blockN;
case DEADLYBLOCK:
dBlockN++;
return dBlockN;
case DEADLYPLATFORM:
dPlatformN++;
return dPlatformN;
case DOOR:
doorN++;
return doorN;
case OMRU:
omruN++;
return omruN;
case PC:
... |
ae74f23e-8a1d-4167-b94a-b3628d91b309 | 1 | public void updateDrawAreaPrevious()
{
if (currentMonth.getNum()==1)//end of the year
{
updateLastYear();
}
else
{
ArrayList <Month> list = currentYear.getMonths();
currentMonth = list.get(CalendarFunctions.previousMonth(currentMonth.getNum())-1);
updateBoxes();
Day cursorDay = cursor.get... |
045ec336-fb84-4b8c-82a3-74127155875f | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Piece other = (Piece) obj;
if (curRotation != other.curRotation)
return false;
if (offsetX != other.offsetX)
... |
5b08e582-c959-4322-bdee-61f0a01ddd37 | 5 | public int[] minimax( Partida partida, EstatCasella estat_casella, int profunditat_maxima )
{
int[] millor_moviment = {
-1,
-1
};
int maxim_actual;
int maxim = Integer.MIN_VALUE;
Tauler tauler = partida.getTauler();
int mida = tauler.getMida();
int profunditat = 0;
EstatCasella fitxa_jugador = ... |
04fd8542-83e3-41f7-9101-067131ea7d3a | 4 | void onMouseButton(int button, int action, int mods) {
switch(action) {
case GLFW_PRESS:
for(MouseButtonEvent e : _mouseDown) { e.run(button, mods); }
break;
case GLFW_RELEASE:
for(MouseButtonEvent e : _mouseUp) { e.run(button, mods); }
break;
}
} |
ba8c85a9-1749-496f-b8cf-8832ad709e4a | 4 | public void getNewAbility() {
// TODO Auto-generated method stub
if(this.getLevel() == 2)
{
//calm
//gets rid of rage
addAbility(new Calm());
}
if(this.getLevel() == 4)
{
//mass heal
addAbility(new MassHeal());
}
if(this.getLevel() == 7)
{
//mass restore (heal + calm)
addAbility(n... |
17fdb065-0483-4744-a5cf-f60ed721b403 | 7 | public void WorkingElevator_exit() {
WorkingElevator_lastState = WorkingElevator_subState;
switch (WorkingElevator_subState) {
case EmergencyStopped:
{
EmergencyStopped_exit();
WorkingElevator_lastState = EmergencyStopped;
... |
c578ecf6-15c9-457e-9603-8ee4a510e2ec | 9 | private void registerToSubTree(boolean isRoot, WatchData parentWatch, File root, boolean fireCreatedEvents) throws JNotifyException
{
if (!parentWatch._user)
{
throw new RuntimeException("!parentWatch._user");
}
// make sure user really requested to be notified on this event.
// (in case of recursive lis... |
89d92c15-1f06-49df-a49c-38305743cc36 | 7 | private void ordering(Cashier cashier) {
try {
Thread.sleep(100);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
while(true){
int rand = MyRandom.nextRandom(100);
//System.out.format(this.toString()+"'s next move: %s%n", rand);... |
0c9e5e17-309b-46ce-8e97-b29300dfb1a6 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> <S-IS-... |
255761c2-05a4-4719-97fe-6f38b929b41a | 3 | public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) resp;
//1、获取页面中的访问的路径连接
String path = request.getServletPat... |
7784b2c2-5ce1-4fcf-a40c-f1d171504977 | 5 | public byte[] evaluateResponse(final byte[] response) throws SaslException {
if (state == 0) {
msgID = CramMD5Util.createMsgID();
state++;
return msgID;
}
final String responseStr = new String(response);
final int index = responseStr.lastIndexOf(" ");
final Stri... |
3af4b40f-49e6-401c-9649-3611af5894f0 | 4 | boolean endsWithBreakPoint()
{
for ( int i=0;i<rows.size();i++ )
{
Row r = rows.get(i);
if ( r.cells.size()>0 && r.versions.nextSetBit(base)==base )
{
FragList fl = r.cells.get(r.cells.size()-1);
if ( fl.fragments.size()>0 )
... |
1c5b7113-bedc-44dd-b553-679044fc1fd7 | 7 | public static List<List<String>> findLadders(String start, String end, Set<String> dict) {
dict.add(start);
dict.add(end);
List<List<String>> result = new ArrayList<List<String>>();
result.add(new ArrayList<String>());
List<String> path = new ArrayList<String>();
//Node
List<String> Node = new Array... |
df068ac1-1444-4eca-8e2e-c657199a7e28 | 7 | public void detectLang() {
if (loadProfile()) return;
for (String filename: arglist) {
BufferedReader is = null;
try {
is = new BufferedReader(new InputStreamReader(new FileInputStream(filename), "utf-8"));
Detector detector = DetectorFactory.crea... |
3efae7c6-1d3a-44d6-a99c-a7b95df62f8f | 7 | public boolean isSolid(double x, double y)
{
try
{
if (!inBounds(x,y)) return true;
return (ground.cellData[(int)x][(int)y]==GROUND||ground.cellData[(int)x][(int)y]==TREE||ground.cellData[(int)x][(int)y]==SAND||ground.cellData[(int)x][(int)y]==STONE||ground.cellData[(int)x][(... |
5a055ffc-2f6f-42db-bbb0-a9b707065369 | 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... |
3bf0288f-83dd-44de-9b07-c02189ee6666 | 0 | public void updateFile(File file){
this.file = file;
} |
a74c4199-b3f3-4f75-9814-7c8f2f64c573 | 4 | private static int getMostUsualValue(ArrayList<Integer> values)
{
HashMap<Integer, Integer> valuenumbers = new HashMap<Integer, Integer>();
// Calculates, how many of each value there are in the list (rounds down)
for (int value: values)
{
int roundvalue = value - value % 5;
if (valuenumbers.conta... |
f2812562-7701-49bc-b918-cdd0a094c601 | 9 | public int[] sort(int[] list) {
int oldLength = list.length;
int potenz = (int) Math.ceil(Math.log(oldLength) / Math.log(2));
int length = (int) Math.pow(2, potenz);
int[] listA = new int[length];
int[] listB = new int[length / 2];
int[] listC = new int[length];
int[] listD = new int[length / 2];
for ... |
d3bfad76-e738-4407-bb7b-668194451ac2 | 7 | protected Decision loseStrategy(GameInfo gi) {
List<Round> gameRounds = gi.getGameHistory().getRounds();
int numTurns = gameRounds.get(gameRounds.size() - 1).getTurns().size();
List<Die> myDice = gi.getMyDice();
if (numTurns < 2) {
//indicate with bid the dice you have
int freq = howManyOfValue(1, myDi... |
5f1caea6-6f2c-4298-bfc5-612dc052291b | 0 | public Radar(int x, int y, int width, int height, int widthDest, int heightDest, String texture, StarSystem world) {
super(x, y, width, height, widthDest, heightDest, texture);
this.world = world;
setNameGameWorld(world.toString());
createForm();
} |
58864e9a-e1b7-4927-adc7-305f319faa4d | 9 | private static void introspectSpreadsheetDateClass() {
Object o = new SpreadsheetDate(30, 6, 2012); // Some unknown object to investigate
Class<? extends Object> c = o.getClass(); // Get its type
System.out.println("\n\nIntrospect: " + c.getName());
// If it is an array, figure out its base type
while (c.is... |
a674689d-82d9-4e57-b741-48ab80d8b8e5 | 7 | public int compareTo( Object o )
{
int row1 = modelIndex ;
int row2 = ( ( Row ) o ).modelIndex ;
for ( Iterator it = sortingColumns.iterator() ; it.hasNext() ; )
{
Directive directive = ( Directive ) it.next() ;
int column = directive.column ;
Object o1 = tableModel.... |
41efed6a-61d4-4b3f-a091-9ea1d845ec98 | 7 | @Override
public void mouseClicked(MouseEvent e) {
BufferedImage image = canvas.getImg();
int replaceColor = canvas.getColor().getRGB();
int targetColor = image.getRGB(e.getX(), e.getY());
if (targetColor != replaceColor) {
Stack<Point> stack = new Stack<Point>();
stack.push(new Point(e.getX(), e.getY())... |
595dd958-c7f8-4729-9d96-5a43801fdd10 | 7 | private static String AnalizarGramatica() {
ArrayList<String> pila = new ArrayList();
pila.add("$");
pila.add(tabla[tabla.length - 1][1]);
MatrizCuadrada mat = new MatrizCuadrada();
ArrayList<Lexema> vectorFila = new ArrayList();
int x, y;
while (!ids.isEmpty()) ... |
8011179a-f544-4440-8042-1660b36df7d4 | 1 | private int parsePackageTable
(ResTable_Package packageTable,
byte[] data,
int offset) throws IOException {
packageTable.id = readUInt32(data, offset);
offset += 4;
// Read the package name, zero-terminated string
StringBuilder bld = new StringBuilder();
for (int i = 0; i < 128; i++) {
int curC... |
13d35dcb-0138-4a78-9c14-7079cd3988a1 | 6 | protected final Set<String> getList(String table, String column) throws DataLoadFailedException {
Connection conn = getConnection();
PreparedStatement statement = null;
ResultSet set = null;
try {
statement = conn.prepareStatement("SELECT ? FROM ?");
statement.set... |
e2ec05fb-e0b9-4783-96a8-16c95820182a | 5 | public void initializePart1(String[] args) {
if(args.length < 2) { System.out.println("Invalid Arguments."); return; }
PathingAgent.PathType type = null;
if (args[1].equals("breadth" )) { type = PathingAgent.PathType.BREADTH; }
else if (args[1].equals("depth" )) { type = Pathin... |
04fb8338-1176-418c-b5fc-c889c5836caa | 5 | private static void save()
{
synchronized (data)
{
if (!modified) return;
File prefFile = new File(PREF_FILENAME);
ObjectOutputStream out = null;
try {
out = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(prefFile)));
for (Map.Entry<String, Serializable> recordItem : data.... |
d361eb63-393a-4fe5-ba6c-c55033812afb | 9 | public String getMessage() {
if (!specialConstructor) {
return super.getMessage();
}
StringBuffer expected = new StringBuffer();
int maxSize = 0;
for (int i = 0; i < expectedTokenSequences.length; i++) {
if (maxSize < expectedTokenSequences[i].length) {
maxSize = expectedTokenSeq... |
3fe1664c-6380-4924-91c9-fc02019f9e0c | 4 | private long findAnswer(){
long found = 0;
String rev = "";
for(int digit : answerHold){
rev += digit;
}
String straight = reverseIt(rev);
int foundIndex = 0;
for(int index = 0;index<straight.length();index++){
if(straight.charAt(index) != '0'){
foundIndex=index;
break;
}
}
Strin... |
151c1528-5052-442a-a617-e034a932ed60 | 8 | void doNetworkIO()
{
try
{
if (selector.selectNow() > 0)
{
Iterator<SelectionKey> it = selector.selectedKeys().iterator();
while (it.hasNext())
{
SelectionKey key = it.next();
Session session = socChanMap.get(key.channel());
it.remove();
try
{
if (!key.isValid())
... |
7e756879-46cf-4721-912c-2cf40a7701cd | 0 | public static long getStartOfMonth(long t) {
Date d = new Date(t);
Date dayD = new Date(d.getYear(), d.getMonth(), 1);
return dayD.getTime();
} |
0680c7bc-dc60-496a-a886-b0227c79be76 | 7 | @Override
public void insert(Integer item) {
if (this.data == null){
this.data = item;
}
else if (left == null && item <= this.data){
left = new IntegerTree(item);
}else if (right == null && item > this.data){
right = new IntegerTree(item);
}else if (item <= this.data) {
left.insert(item);
}els... |
d992b78f-26b0-4cbf-9344-0850ddf63465 | 0 | public void setIsKey(String isKey) {
this.isKey = isKey;
} |
579634cd-4e9c-48e8-9ec8-70be4f2775ad | 8 | public static boolean isEntityEvaluated(BookmarkReader reader, int id, Integer minBookmarks, Integer maxBookmarks, boolean resource) {
if (reader == null || id == -1) {
return true;
}
List<Integer> entityCounts = (resource ? reader.getResourceCounts() : reader.getUserCounts());
if (id < entityCounts.size()) ... |
8e51d50b-de33-462e-abff-e493747d5095 | 1 | public CycVariable readCompleteVariable()
throws IOException {
final Integer hlVariableId = (Integer) readObject();
final String name = (String) readObject();
CycVariable cycVariable = new CycVariable(name, hlVariableId);
if (trace == API_TRACE_DETAILED) {
debugNote("readVariable: " + cy... |
6fa15fec-b282-4819-abf6-297adf3fec59 | 5 | public Writer write(Writer writer) throws JSONException {
try {
boolean b = false;
Iterator keys = keys();
writer.write('{');
while (keys.hasNext()) {
if (b) {
writer.write(',');
}
Object k = ke... |
a020a4c1-7c1b-4c01-924a-bd06d7d62605 | 8 | public ArrayList<Employee> DriversInAFranchise(int FranID)
throws UnauthorizedUserException, BadConnectionException, DoubleEntryException
{
/* Variable Section Start */
/* Database and Query Preperation */
PreparedStatement statment = null;
ResultSet results =... |
3870866e-ebdd-4cd5-8a77-8b66403d8b89 | 4 | public M_Combo_Box_Change_Account_Information() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException
{
//MAIN FRAME
super("Team J's Scheduler | Change Account Information");
setBounds(50,50,500,300);
setResizable(false);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE)... |
7dea4309-dfcf-45e4-8032-51d166ce8246 | 6 | public static void tryPickup(Player p){
if(p.lives < 1){
if(p.isHuman)
p.addNotification("No Lives.");
return;
}
currentState.state = GameState.GAME;
int max = Math.min(5, pile.size());
for(int i = 1; i < max + 1; i++){
int lookup = pile.size() - i;
if(lookup<0)
break;
i... |
2c368ff5-d2a7-444a-9124-c4c48ec151bf | 4 | private boolean checkFieldWinn(char cellValue){
for (int i = 0; i < fieldSize; i++){
if(checkFieldColumnWinn(i, cellValue) || checkFieldLineWinn(i, cellValue)){
return true;
}
}
if(checkFieldInclineWinn(cellValue)){
return true;
}
... |
e02c6743-ffba-4a66-a3e9-2d80f3cfe7a3 | 0 | public void setjTableOffre(JTable jTableOffre) {
this.jTableOffre = jTableOffre;
} |
7eaa8e70-6b56-4367-9fd4-69ad0c2cb7ef | 2 | private boolean checkTop(int x, int y, int z){
int dy = y - 1;
if(dy < 0){
return false;
}else if(chunk[x][dy][z] != 0){
return true;
}else{
return false;
}
} |
25b9b0f1-3ed9-4c6b-84bd-68673c2d4be9 | 0 | public void setChatGuiMinimizedToTray(Boolean chatGuiMinimizedToTray) {
this.chatGuiMinimizedToTray = chatGuiMinimizedToTray;
} |
fdfeaf27-dc2e-45c5-8574-e3c39c0b6b45 | 5 | private void gameLoop() throws GameException
{
long startTime;
long elapsedTime;
long averageTime = 0;
long frameTime;
while(gameRunning) // This double loop is made to be able to restart the game after it stopped.
{
while(gameRunning)
{
startTime = System.nanoTime();
repaint(... |
b95fff65-92e7-4ba6-b9e2-3508d764c702 | 2 | @Override
public void run() {
System.out.println("ServeurThread demarre");
try {
BufferedReader r = new BufferedReader(new InputStreamReader(this.ns.getInputStream()));
char[] cbuf = new char[100];
String v = new String(cbuf, 0, r.read(cbuf, 0, cbuf.length));
System.out.println("got: " + v);
int... |
262388b7-7f0e-4149-a0b5-d1426ff4b98b | 8 | public void remove(int key) {
int level = 0;
HashPrinter.tryRemove(key);
int hash = (key % TABLE_INITIAL_SIZE);
boolean found = false;
if (table[hash] != null) {
Node entry = table[hash];
Node previousNode = null;
do {
previousNode = entry;
if (entry != null && entry.getNext() != nu... |
b5be928a-34ba-4a88-8fdc-99f3f3a94c62 | 2 | public Custom(Marker parent, int start, int end, int strand, String id, String label) {
super(parent, start, end, strand, id);
type = EffectType.CUSTOM;
this.label = label;
if (label == null || label.isEmpty()) label = id;
} |
f4f94532-f27c-4a0e-b84f-ea04777c6359 | 1 | public JSONObject getJSONObject(int index) throws JSONException {
Object object = this.get(index);
if (object instanceof JSONObject) {
return (JSONObject) object;
}
throw new JSONException("JSONArray[" + index + "] is not a JSONObject.");
} |
0126bfe8-bfbe-4e68-b4c4-addefe3c204b | 4 | public void move(Rectangle2D bounds){
x += dx;
y += dy;
if(x < bounds.getMinX()){
x = bounds.getMinX();
dx = -dx;
}
if(x + XSIZE > bounds.getMaxX()){
x = bounds.getMaxX() - XSIZE;
dx = -dx;
}
if(y < bounds.getMinY(... |
500b9d5c-26ae-49ef-bb89-54ab5f71e933 | 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... |
49791b84-b49d-4470-ae6d-51f94bcbafab | 6 | public static boolean checkForSingleValuedGoalP(Description pattern, Cons iobindings) {
{ Cons iovariables = Stella.NIL;
Cons boundvariables = Stella.NIL;
{ PatternVariable vbl = null;
Vector vector000 = pattern.ioVariables;
int index000 = 0;
int length000 = vector000.length();
... |
1dfa3481-0f1b-46f8-8184-135cd47aea9e | 8 | @SuppressWarnings("FinallyDiscardsException")
String getTipoEvento() {
if (aEvento instanceof EventoRanqueamento) {
return "Ranqueamento";
} else if (aEvento instanceof EventoAnalise) {
return "Analise";
} else if (aEvento instanceof EventoProjeto) {
retur... |
98591e2a-098c-4dc5-a9c6-02d972bd8055 | 6 | private static Boolean nextOpIs(String str, String op){
String currentSub;
for(int i = 0; i < str.length(); i++){
currentSub = str.substring(i,i+1);
if(currentSub.equals("-") || currentSub.equals("+") || currentSub.equals("*") || currentSub.equals("/")){
if(curren... |
31c2f2f6-a868-44e1-bda6-7e76ebfc4542 | 3 | private boolean noLightGrenadeOnWall(Grid grid) {
List<LightGrenade> lightGrenades = getLightGrenadesOfGrid(grid);
for (LightGrenade lg : lightGrenades) {
final Position lgPos = grid.getElementPosition(lg);
for (Element e : grid.getElementsOnPosition(lgPos))
if (e instanceof Wall)
return false... |
40b749c4-3416-41dd-b06b-150acd6294d8 | 9 | public static void manualDescribeObject(Stella_Object renamed_Object, Stella_Object specification, OutputStream stream) {
if (renamed_Object == null) {
renamed_Object = Utilities.lookupObjectFromSpecification(specification);
}
if (((Keyword)(Utilities.$MANUAL_OUTPUT_LANGUAGE$.get())) == Utilities.KWD_... |
19b7e35f-4aad-44e4-a211-c236f662836f | 1 | public Game()
{
shader = BasicShader.getInstance();
Transform.setProjection(70f, Window.getWidth(), Window.getHeight(), 0.1f, 1000f);
for(int i = 2; i <= 27; i++)
playlist.add(ResourceLoader.loadMidi("WOLF" + i + ".mid"));
track = STARTING_LEVEL - 1;
levelNum = STARTING_LEVEL - 1;
loadLevel(1);
... |
a8100b3b-586a-412f-8c19-7f0c59740530 | 3 | @Override
protected void saveNBT(NBTTagCompound data) {
super.saveNBT(data);
// MiscTools.writeUUID(data, "uuid", uuid);
NBTTagList tagList = new NBTTagList();
for (Map.Entry<WorldCoordinate, WorldCoordinate> cache : trackCache.entrySet()) {
NBTTagCompound entry = new NBTT... |
a0876032-9dc9-4ae5-9d78-8cf2eb3d40d1 | 7 | @Override
public void executeMsg(Environmental host, CMMsg msg)
{
if((affected instanceof Armor)&&(msg.source()==((Item)affected).owner()))
{
if((msg.targetMinor()==CMMsg.TYP_REMOVE)
||(msg.sourceMinor()==CMMsg.TYP_WEAR)
||(msg.sourceMinor()==CMMsg.TYP_WIELD)
||(msg.sourceMinor()==CMMsg.TYP_HOLD)
|... |
a4d47195-61c5-4719-88dc-7a0b6aa86486 | 9 | public void setOrientation(int orientation) {
android.view.ViewGroup.LayoutParams params = null;
if (whiteBg != null) {
params = whiteBg.getLayoutParams();
}
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
if (people != null) {
people.set... |
4aa7a446-8a3a-4338-be38-4206c769e790 | 3 | public void checkRents() {
Date currenttime = null;
try {
currenttime = date.parse(date.format(new Date()));
} catch (ParseException e) {
e.printStackTrace();
}
if (currenttime != null) {
for (RentSign rent : rentsigns) {
this.checkRent(rent, currenttime);
}
}
} |
fb13beb5-6406-4019-bb6d-3afb8f6cc779 | 7 | private GameCoreInstruction interpretNetworkMessage( NetworkMessage nm )
{
if ( nm.getMessage().isEmpty() )
return GameCore.getInstanceOfGameCore().new EmptyGameCoreInstruction();
if ( nm.getMessage().equals("nextGameState") )
return GameCore.getInstanceOfGameCore().new NextGameStateGameCoreInstruction();... |
8988098a-eb81-4168-ae11-b1f4aae86d40 | 5 | private static void writeStreamsToConsole(final BufferedReader in, final BufferedReader err){
// Writing streams to the console can be done a Thread since their actions do not modify the return boolean
if(in != null && err != null){
new Thread(){
public void run(){
... |
123c4f7d-25a2-4088-9586-fef2ae56f188 | 4 | private static String toHex(final byte[] data)
{
final StringBuffer buf = new StringBuffer();
for (final byte element: data)
{
int halfbyte = (element >>> 4) & 0x0F;
int two_halfs = 0;
do
{
if ((0 <= halfbyte) && (halfbyte <= 9))
{
buf.append((char) ('0' + halfbyte));
}
else
... |
88fb8ad5-9ca8-488d-8590-8ad3f4e41d29 | 5 | static Type resolveTypeVariable(Type context, Class<?> contextRawType, TypeVariable<?> unknown) {
Class<?> declaredByRaw = declaringClassOf(unknown);
// we can't reduce this further
if (declaredByRaw == null) {
return unknown;
}
Type declaredBy = getGenericSupertype(context, contextRawType, ... |
5b8011b4-cd84-446b-b12d-12b6656747fe | 6 | public void check() {
if(chrlist == null)
return;
if(selbtn == null)
return;
if(chr == null) {
chr = chrlist.opts.get(0).name;
} else {
String nm = null;
for(Listbox.Option opt : chrlist.opts) {
if(opt.disp.equals(chr)) {
nm = opt.name;
break;
}
}
if(nm == null)
... |
8798511a-9bfc-4e9f-a398-20fef79fb02d | 1 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + data;
result = prime * result + ((next == null) ? 0 : next.hashCode());
return result;
} |
39c92c89-2ae6-4755-8c0a-6ee9f37df793 | 4 | public static String proper( String name )
{
if( name.equals( "" ) )
{
return "";
}
StringBuffer buf = new StringBuffer();
char[] chars = name.toCharArray();
buf.append( String.valueOf( chars[0] ).toUpperCase() );
for( int i = 1; i < chars.length; i++ )
{
if( chars[i] == ' ' )
{
buf.append... |
f9f67079-7f5d-4dd4-8603-89674bf2d1ee | 0 | public static boolean isApplicable(Object object) {
return true;
} |
34d6a8e5-6987-4d53-9382-deeeed1a0bb0 | 8 | public void update() {
player.update();
if (player.getyPos() > level.getHeight() * level.getTileSize()) {
player.setyPos(0);
}
xMovement += (player.getxPos() - (GamePanel.WIDTH / 2) - xMovement) * movementSpeed;
yMovement += (player.getyPos() - (GamePanel.HEIGHT / 3) - yMovement) * movementSpeed;
if (xMo... |
fdd84b8b-adf5-4b28-b218-04d7a463e0b8 | 7 | public boolean isPointInside(int x, int y) {
synchronized (this) {
//Check bounding box first
if (!getBoundingBox().isPointInside(x, y))
return false;
//Is point inside algorithm:
// (See http://www.codeproject.com/KB/recipes/geometry.aspx )
int j, inside_flag;
double dv0 ;
int ... |
6e9ddb66-80e6-4fcf-a3c6-1001d5482aba | 1 | public void postMessageToServer(String message)
{
// Attempt to write out to the server
// And receive the server's response.
try
{
outToServer.println(message); // Write data out to server
System.out.println("Received from server: " + inFromServer.readLine()); // And receive the server's reply.
}
/... |
e0f5f5ce-ea34-4fa7-85ec-f45f08df3a38 | 4 | public static ExecutionResult exec(String cmd) throws InterruptedException
{
Runtime runtime = Runtime.getRuntime();
try
{
java.lang.Process proc = runtime.exec(cmd);
InputStream in = proc.getInputStream();
InputStream err = proc.getErrorStream();
... |
fb3c0e9f-4d34-48c4-9438-fc1127101ee3 | 2 | @Override
public Auction[] search(String criteria) {
ArrayList<Auction> temp = new ArrayList<Auction>(searches.values());
for(Auction auc : temp){
if(auc.getName().equalsIgnoreCase(criteria)){
temp.add(auc);
}
}
return temp.toArray(new Auction[temp.size()]);
} |
42e4f3bc-61bb-4ea7-b314-3a957ae209b1 | 7 | public void keyPressed (KeyEvent e){
int key = e.getKeyCode();
for (int i = 0; i<objectHandler.object.size();i++){
GameObject tempObject = objectHandler.object.get(i);
if (tempObject.getId() == ObjectId.Player){
if(key == KeyEvent.VK_RIGHT) tempObject.setVelocityX(5);
if(key == KeyEvent.VK_LEFT) t... |
bc581c8e-d847-4b82-b3bd-c790242d938b | 6 | private Metabolism getUserData() {
// Get data from user
if(!femaleButton.isSelected() && !maleButton.isSelected()) {
JOptionPane.showMessageDialog(frame, "You must select a gender.", "Error", JOptionPane.ERROR_MESSAGE);
return null;
}
Gender gender = femaleButton.isSelected()? Gender.Female : Gender.Male... |
9f498489-f834-40d9-994f-4862bc23a69f | 8 | public void readCommandsFromFile(Path filePath, Path moveFilePath) throws IOException {
try {
CommandParser parser = new CommandParser();
buff = Files.newBufferedReader(filePath, Charset.defaultCharset());
do {
String line = buff.readLine();
Co... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.