method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ecaf965c-70c0-4adc-adab-0c2b5b6c5140 | 7 | public void doRequest() throws IOException, InterruptedException, ClassNotFoundException {
//for now, just assign work to the nodes with the files needed
int rep = Integer.parseInt(fSystem.filesystem_config.get("replication_factor"));
MapRequest mr = requests.get(0);
int fileLines = fSystem.getFileLineNum... |
8e12629d-b419-4be8-b4a3-6fe9e83ffa2d | 6 | public static void main(String[] args) {
try {
UIManager.LookAndFeelInfo[] installedLookAndFeels = UIManager.getInstalledLookAndFeels();
for (int idx = 0; idx < installedLookAndFeels.length; idx++) {
if ("Nimbus".equals(installedLookAndFeels[idx].getName())) {
... |
febf3c0c-99aa-4efc-8a46-52ff175489a3 | 8 | @Test
public void testCourse() {
// test each student
for (IPlace[] row : course.getStudents()) {
for (IPlace is : row) {
if (is instanceof Student) {
Student s = (Student) is;
for (int i = 0; i < s.getActualState().size(); i++) { // check correct actual state and change vector
if (s.getActu... |
45300a87-fc4f-4744-bae0-57fb4291bb11 | 0 | public void setVale(double vale) {
this.vale = vale;
} |
2c905958-7c82-4357-9a6a-dd9e8fe765c3 | 8 | public void resetRelation()
{
if(startBtn.getX()+startBtn.getWidth() < endBtn.getX())
{
double separation = (endBtn.getX()-(startBtn.getX()+startBtn.getWidth()))*App.currentDistance/20;
relDialog.relDesc.min = 0.0;
relDialog.relDesc.max = separation;
relDialog.relDesc.rel = RelationType.BEFORE;
r... |
8887d646-3b0b-4967-8158-a6bd0f1202fd | 9 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Option option = (Option) o;
if (idoption != option.idoption) return false;
if (surveyIdsurvey != option.surveyIdsurvey) return false;
i... |
828989be-3a5e-4740-8ed5-2ff9e5e59ad7 | 8 | String downloadURL() {
String line, result = null;
int code = 200;
boolean first = true;
do {
if (first) {
first = false;
} else {
sleep(1000);
}
try {
result = "";
URL url = formURL();
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty... |
34852271-6435-43c3-8e92-761d7f3977c7 | 6 | public boolean inside(int x, int y) {
if (type == TYPE_RECT) {
if (rect.contains(x,y)) return true;
} else if (type == TYPE_CIRCLE) {
int mr=(int)Math.sqrt( ( x - circle_center.x ) * ( x - circle_center.x ) +
( y - circle_center.y ) * ( y - circle_center.y ) );
if ... |
f8fd93a5-ca6c-4e57-a5bf-42e0daa84bd5 | 1 | @Override
public PreparedStatement getStatement() throws SQLException
{
Connection connection = getConnection();
if (connection != null)
return connection.prepareStatement("select QuestionId, ParentId, Number, TypeNum, Question, Answer, " +
"PassCriteria, Authors... |
0fe90627-0faa-4415-9030-0b4b79676c04 | 6 | @Get("json")
public Representation _get() {
String keyword = getAttribute("keyword");
String query = format(FIND_RSRC, keyword);
Map<?, ?> ns = $namespaces.findOne(query).as(Map.class);
if (ns == null) {
setStatus(Status.CLIENT_ERROR_NOT_FOUND);
return null;
... |
36057755-dbc6-4e38-8c59-39d03fc98dfa | 0 | @Test
public void runTestImplicitFlow3() throws IOException {
InfoflowResults res = analyzeAPKFile("ImplicitFlows_ImplicitFlow3.apk", true);
Assert.assertEquals(2, res.size());
} |
0dd247e9-bc79-4c11-b414-54119c32c050 | 1 | public void show() {
XYSeries series = new XYSeries("Amplitude Maxes");
for (int i = 0; i < maxes.size(); i++) {
series .add(new XYDataItem((Number) (i * granularity), (Number) maxes.get(i)));
}
LineChartFrame
frame = new LineChartFrame("Amplitude Maxes", "Ti... |
955bf9db-4d6e-44fe-a977-30996d9b5f3e | 2 | public static QcTestStatus fromValue(String statusText)
{
QcTestStatus status = null;
for (QcTestStatus st : QcTestStatus.values()) {
if (statusText.equals(st.toString())) {
status = st;
break;
}
}
return status;
} |
fff558ef-dd9c-4870-8eae-a19e02cb808b | 1 | @Override
public void includeFasls() {
for (File f : layout.faslFiles()) {
ExpressionBuilder builder = new ExpressionBuilder("load");
builder.addString(f.getPath());
this.addExpression(builder.getExpression());
}
} |
8bbb9bbe-b684-4a3d-b6e5-b5f2d97745fa | 7 | public static void main(String[] args) {
String trainPath = args[0];
String testPath = args[1];
if(trainPath.contains("=")) {
trainPath = trainPath.split("=")[1];
if(trainPath.startsWith("<") && trainPath.endsWith(">")) {
trainPath = trainPath.substring(1, trainPath.length() - 1);
}
}
i... |
db8b0f97-a942-4cbb-b676-cc418bb8d397 | 3 | @Override
public void onWin(WinEvent event) {
setAhead(0);
if (new Random().nextInt(3) == 2) {
while (true) {
setTurnRight(500);
setTurnGunLeft(500);
execute();
}
} else {
while (true) {
setTu... |
9ddd7830-2e58-4c9f-90ca-624c2cc0b7a5 | 3 | public void printHeader()
{
for (int i=0; i < (HEADER_SIZE-4); i++)
{
for (int j = 7; j>=0 ; j--)
if (((1<<j) & header[i] ) != 0)
System.out.print("1");
else
System.out.print("0");
System.out.print(" ");
}
System.out.println();
} |
c6946ba2-716e-4321-b6a6-2fcc220248e6 | 0 | public MooreTransitionCreator(AutomatonPane parent)
{
super(parent);
} |
efad7b15-0775-48f0-964f-d315f843be94 | 7 | private String prefixForward (int length) {
if (pointer + length + 1 >= buffer.length()) update(length + 1);
String buff = null;
if (pointer + length > buffer.length())
buff = buffer.substring(pointer, buffer.length());
else
buff = buffer.substring(pointer, pointer + length);
char ch = 0;
for (int i =... |
a7786086-6475-467a-b3a7-593221ad48e7 | 0 | @Override
public String toString() {
return "Praticien{" + "numero=" + numero + ", nom=" + nom + ", prenom=" + prenom + ", adresse=" + adresse + ", cp=" + cp + ", ville=" + ville + ", coef=" + coef + ", code=" + code + '}';
} |
6fe38fb4-c653-447b-89c1-e6aa97367589 | 8 | public static void main(String[] args) {
int numberOfTests = Integer.parseInt(args[0]);
int sequencesSize = Integer.parseInt(args[1]);
Random random = new Random();
Format format = new Pair();
try {
List<String> matrices = new ArrayList<String>();
for (I... |
34b9699c-f204-4204-a7ec-19f02ff4cd4b | 2 | public String className() {
if ((desc.charAt(0) == Type.ARRAY_CHAR) || this.isPrimitive()) {
return desc;
}
return desc.substring(1, desc.lastIndexOf(';'));
} |
bec12d03-32ea-4d20-ae18-bb03b35b22c4 | 7 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
final MOB mob=(MOB)affected;
if(mob==null)
return true;
if(mob==invoker)
return true;
if(invoker==null)
return true;
final Room room=invoker.location();
if((!mob.isInCombat())&&(room!... |
7498c9a0-6e37-44c8-81c5-64971c465447 | 6 | public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scanner = new Scanner(System.in);
String string=scanner.next();
int temp=0;
int multi=0;
if(string.length() <1)
{
System.out.println("-1");
return;
}
else{
if(string.charAt(0) == '0'){
if(str... |
f93c2b59-3400-4a59-9e9b-0c7b04bb4e1c | 3 | public double getTotalValue(ArrayList<Double> amounts) {
double total = 0;
if (amounts.size() < items.size()) {
for (int i = amounts.size(); i < items.size(); i++) {
amounts.add(0.0);
}
}
for (int i = 0; i < amounts.size(); i++) {
total... |
4c741667-eb0d-4cdd-94e4-996b9416056d | 7 | public static void main(String[] args) {
// Create a variable for the connection string.
String connectionUrl = "jdbc:sqlserver://localhost:1433;" +
"databaseName=AdventureWorks;integratedSecurity=true;";
// Declare the JDBC objects.
Connection con = null;
Stateme... |
97fffb14-565e-4256-911f-eae73986a64d | 5 | public static void main(String[] args) throws UnknownHostException {
if(args.length != 5) {
printUsage();
}
short srcPort = Short.parseShort(args[0]);
short desPort = Short.parseShort(args[1]);
int windowSize = Integer.parseInt(args[2]);
int timeout = Integer.parseInt(args[3]);
String filename = ar... |
663be193-a6d3-4a48-ac42-3504593718f2 | 5 | private void loadDirectory(File f){
if (f.isDirectory()){
File[] files = f.listFiles();
if (files == null){
return;
}
for (File f1 : files){
if (f1.isDirectory()){
loadDirectory(f1);
} else {
... |
817dcb04-a12c-4f50-80f8-0c7c7b4a1d1c | 1 | public String getUrl(String dbName) {
if (type.equalsIgnoreCase("mysql")) {
return String.format("jdbc:mysql://%s:%s/%s?useUnicode=true&characterEncoding=utf8", ip, port, dbName);
} else {
return "";
}
} |
1a8a3b27-a0ab-4121-baec-cf84871c74b5 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof ReinforcementKey)) return false;
ReinforcementKey key = (ReinforcementKey) o;
return x == key.x && y == key.y && z == key.z && world.equals(key.world);
} |
4f94fcfb-7506-4a89-87f2-a8bc67404461 | 0 | public ContactEntity() {
setId(System.nanoTime());
} |
59472c09-bed4-4daa-b72d-5c7031c4f414 | 2 | public void draw(){
for (int x = 0; x < mobs.size(); x++){
AbstractMob current = mobs.get(x);
if (isInSightRange(current.getX(), current.getY())){
int xDraw = 13 - (Boot.getPlayer().getX() - current.getX());
xDraw = xDraw * Standards.TILE_SIZE;
int yDraw = 13 - (Boot.getPlayer().getY() - cu... |
15e73c55-5acf-4325-9f60-e39de6e34ac7 | 7 | public static boolean assignDeptToProfessor(ProfessorBean professor)
{
ResultSet rs=null;
Connection con=null;
PreparedStatement ps=null;
boolean result=true;
try{
String sql="INSERT INTO professor(p_id,subjects,deptid) values (?,?,?)";
con=ConnectionPool.getConnectionFromPool();
ps=con.prepareState... |
72f07444-2c28-42de-8a9d-6526acd9a7e7 | 3 | public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
StringBuilder out = new StringBuilder();
while (in.hasNext()) {
int size = in.nextInt();
if (size == 0)
break;
blocks = new Point[size];
for (int i = 0; i < size; i++)
blocks[i] = new Point(in.next... |
6e064e3b-62b6-4d90-aabe-c992002d1f65 | 5 | public void removeTroop(int i) {
if (troop.getEffectif()<2){
troop=null;
}else{
switch(i){
case 0:
troop.rmToop(1,0,0,0);
break;
case 1:
troop.rmToop(0,1,0,0);
break;
case 2:
troop.rmToop(0,0,1,0);
break;
case 3:
troop.rmToop(0,0,0,1);
break;
}
... |
77bd4bf6-c963-4bce-ac27-7c68406623bf | 9 | private void button20ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button20ActionPerformed
if (order2code4tf.getText().equals("1001"))
{
o2c4destf.setText("Chicken Nugget");
}
if (order2code4tf.getText().equals("1002"))
{
o2c4... |
dce8c74f-4724-4829-be20-506fccc3e6d2 | 5 | public static void renderAll(float dt) {
// Theoretically should be faster due to fewer cache misses. At least according to a
// StackOverflow thread I once read:
// http://stackoverflow.com/questions/11227809/why-is-processing-a-sorted-array-faster-than-an-unsorted-array
//
// A... |
c06e3db2-44da-49b3-9fdf-2711b800463d | 5 | @Test
public void testExplicitConversions() {
for (int i = 0; i < typesToTest.length; ++i) {
for (int j = 0; j < typesToTest.length; ++j) {
boolean canImplicit = typesToTest[i].canConvertImplicit(typesToTest[j]);
boolean canExplicit = typesToTest[i].canConvertExplicit(typesToTest[j]);
String cast... |
2f6a1188-f2c5-4d9d-8215-e3c135445abe | 5 | private Solution recursiveDepthLimitedSearch(Node node, Puzzle puzzle,
int bound) {
if (puzzle.getGoalTest().isGoalState(node.getState())) {
return new Solution(node, getNodeExpanded());
} else if (bound == 0) {
return new Solution(null, getNodeExpanded());
} else {
LinkedList<Node> expansion = node.e... |
7eb17625-2199-4d18-baca-58e127ba9241 | 3 | public void run() {
new File("Game/").mkdir();
try {
String[] files = getFiles("Game/");
launcher.setFileNumber(files.length);
for (String s : files) {
if (s.endsWith("/")) {
launcher.append("Creating folder '" + s + "'");
new File(s).mkdir();
} else {
launcher.append("Downloading '"... |
7f45dbf5-ed57-47eb-aa89-0c1f79f66461 | 8 | public ByteBuffer readLengthAndData(SocketChannel ch) throws Exception {
if(bufs[0].hasRemaining() && ch.read(bufs[0]) < 0)
throw new EOFException();
if(bufs[0].hasRemaining())
return null;
int len=bufs[0].getInt(0);
if(bufs[1] == null || len > bufs[1].capacity(... |
4f616cf4-f1aa-4246-9f81-da52de1535e5 | 3 | public static String getFirstLetter(String oriStr)
{
String str = oriStr.toLowerCase();
StringBuffer buffer = new StringBuffer();
char ch;
char[] temp;
for (int i = 0; i < str.length(); i++)
{ // 依次处理str中每个字符
ch = str.charAt(i);
temp = new char[] { ch };
byte[] uniCode = new Stri... |
5167cbec-5a5f-415a-8f97-aa782c74cd86 | 6 | public void processEvent(Event event)
{
OMMMsg msg = ((OMMItemEvent)event).getMsg();
GenericOMMParser.parseMsg(msg, System.out);
if (msg.isFinal())
{
stopTest();
}
else if (!m_loggedIn
&& ((msg.getMsgType() == OMMMsg.MsgType.STATUS_RESP) ... |
c2e69aa3-2581-4cdc-b0fd-d58f72b96ee3 | 5 | public void senseDialDown() throws DialErrorException {
if(d.getDialPosition() == 1) {
System.out.println("Already on lowest setting");
throw new DialErrorException();
}
else {
d.setDialPosition(d.getDialPosition()-1);
if((l.getLeverPosition()).equals("INT")) {
switch(d.getDialPosition()) {
case 1: {
w.setW... |
319ebbad-51ca-4512-84a6-3d108b7a9c22 | 1 | public HBox buildDayRepeatButtons() {
dayRepeatButtons = new HBox();
Locale loc = Locale.getDefault();
for(final DayOfWeek day : DayOfWeek.values()) {
String label = day.getDisplayName(TextStyle.SHORT, loc);
final ToggleButton dayButton = new ToggleButton(label);
... |
e6826413-5c47-41af-b4cf-f15c2e5ded44 | 8 | @Override
public void run() {
while (isRunning) {
// Edible processing
if (this.deadly == false) {
this.edibleLifeRemaining--;
if (this.edibleLifeRemaining <= 0) {
this.deadly = true;
}
}
/... |
b13db4cc-608e-4f68-8b5f-d79c3f32eb4a | 2 | private String buildPotFxString(Collection<PotionEffect> effects) {
if (effects.size() < 1)
return null;
StringBuilder sbType = new StringBuilder();
StringBuilder sbDur = new StringBuilder();
StringBuilder sbAmp = new StringBuilder();
for (PotionEffect effect : effects) {
sbType.append(effect.getType(... |
6217e106-edb4-47e1-a1e0-6b7029e98f58 | 2 | public static Object extractFromDatagram(DatagramPacket datagram) throws IOException {
try(ByteArrayInputStream byteIn = new ByteArrayInputStream(datagram.getData())) {
try(ObjectInputStream ois = new ObjectInputStream(byteIn)) {
try {
return ois.readObject();
} catch(ClassCastException e) {
L... |
0778a9ed-ef13-431a-b754-55926ef070a0 | 8 | private void createJK(String in1, String in2, String out)
{
JKFlipFlop jk = new JKFlipFlop();
// Connect the first input
// Check if the in wire is an input
if (stringToInput.containsKey(in1))
{
Wire inWire = new Wire();
stringToInput.get(in1).connectOutput(inWire);
jk.connectInput(inWire);
}
/... |
253ae470-9e05-4ed1-9fec-96fa002bbb1d | 2 | @Override
public void onSpawnTick(SinglePlayerGame game) {
Set<Location> temp = new HashSet<>();
for (Location loc : toSpawn) {
if (!game.spawnEntity(loc, spawn())) {
temp.add(loc);
}
}
toSpawn = temp;
} |
b5456cb5-be46-4eb6-bcc9-51830d6eabd1 | 5 | public String getFormattedResult(boolean hasColors) {
try {
gson = new GsonBuilder().setPrettyPrinting().create();
} catch(IllegalStateException ex) {
ex.printStackTrace();
return "";
}
PirateBayJsonItem[] results = gson.fromJson(this.getJson(), PirateBayJso... |
ca28f1b5-1be4-488d-ae65-b2a1377e4406 | 2 | public HashSet<String> connectTo(String word) {
char[] wordChars = word.toCharArray();
HashSet<String> result = new HashSet<String>();
for (int i = 0; i < wordChars.length; i++) {
char before = wordChars[i];
wordChars[i] = (char) 0;
Str... |
4117d6ee-fce0-4d8f-a870-19ad52d37eea | 4 | protected ActorMind initAI() {
final Artilect actor = this ;
return new ActorMind(actor) {
protected Behaviour createBehaviour() {
final Choice choice = new Choice(actor) ;
addChoices(choice) ;
return choice.pickMostUrgent() ;
}
protected void updateAI(int... |
7ff8c387-7b7d-48ed-9433-1a44ecc77cd6 | 7 | public void run(String arg) {
// 1 - Obtain the currently active image if necessary:
ImagePlus imp = IJ.getImage();
if (null == imp) return;
int stackSize = imp.getStackSize();
// 2 - Ask for parameters:
boolean whiteParticles =Prefs.blackBackground, addTop = true, addRight = true, addBot... |
5667e732-5ac9-43a7-a6cf-4869be69748a | 8 | public static void main(String[] argv) {
if (argv.length == 2) {
if (argv[0].equals("rabbitmq"))
systemToCheck = "rabbitmq";
else if (argv[0].equals("sqs"))
systemToCheck = "sqs";
else if (argv[0].equals("both"))
systemToCheck =... |
689d8e1e-8c11-415d-93d3-c577ef436dfa | 1 | void heightChange(final Object inst) {
if (inst instanceof Instruction) {
((Instruction) inst).visit(this);
}
} |
d2a1500b-8b3f-4519-88a9-292b0f20be48 | 7 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!(affected instanceof MOB))
return super.okMessage(myHost,msg);
final MOB mob=(MOB)affected;
if((msg.amISource(mob))
&&(msg.targetMinor()==CMMsg.TYP_DRINK)
&&(msg.target() instanceof Drink)
&&(msg.target() instanceof ... |
65cf5577-ad2c-494a-b169-8e1c58e5e73c | 0 | public double getHeight(Graphics pen)
{
Graphics2D p = (Graphics2D) pen;
FontRenderContext frc = p.getFontRenderContext();
TextLayout layout = new TextLayout("b", FONT, frc); // use the same letter to determine the height
return layout.getBounds().getHeight();
} |
bdb4c0a6-b803-4db5-80af-73013a1bf2df | 7 | public static double trainAndTestCaseMatcher(Symbol className, Symbol slotName, int numTrain, int numTest, int cycles) {
className = ((Symbol)(className.permanentify()));
slotName = ((Symbol)(slotName.permanentify()));
{ Surrogate renamed_Class = Logic.getDescription(className).surrogateValueInverse;
... |
67cd51c0-83c0-44c7-9633-dec46bb60d5b | 8 | @Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
if(qName.equalsIgnoreCase("site")) {
mCurrentParsingInfo.put(DocumentHeaders.SITE_ID, attributes.getValue("id"));
mCurrentParsingInfo.put(DocumentHeaders.SITE_... |
799ece67-7363-4369-af2b-3c9b6298df06 | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0 &&
... |
571a355a-d79d-4c31-98f9-09bdbeeb3569 | 6 | public final void run() {
while (!aBoolean1738) {
FileIndexRequest request;
synchronized (requestQueue) {
request = ((FileIndexRequest) requestQueue.removeFirst());
if (request != null)
((FileIndexWorker) this).amountRequests--;
else {
try {
requestQueue.wait();
} catch (Interrupte... |
905f5811-ac86-42fa-a6b1-e1ee7e70c3cc | 9 | public static void main(String[] args) throws Exception {
in = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
stk = new StringTokenizer(in.readLine());
int zeroes = readInt();
int ones = readInt();
// Fail fast
if (zeroes - 1 > ones || ones - zeroes - 2 > ze... |
ed7d21af-6d2d-4d98-a30f-dceb4d033a32 | 5 | public Map<FieldDescriptorType, Object> getAllFields() {
if (hasLazyField) {
SmallSortedMap<FieldDescriptorType, Object> result =
SmallSortedMap.newFieldMap(16);
for (int i = 0; i < fields.getNumArrayEntries(); i++) {
cloneFieldEntry(result, fields.getArrayEntryAt(i));
}
fo... |
6e8ab291-1068-4cad-a3f4-5ef042bcdfa9 | 7 | public void purgeOnlineModsTable(){
if (purgedOnlineList) return;
for (int i = 0;i<mods.size();i++){
for (int o = 0;o<onlineModList.size();o++){
if (mods.get(i).name.equals(onlineModList.get(o).name)){
onlineModList.remove(o);
o--;
}
}
}
int i = 0;
int numFrameworks = 0;
while (i... |
fa9a74b3-bffd-4977-9dc8-f32c39bcc7c7 | 2 | public static void unbanIP( String player, String sender ) throws SQLException {
if ( !Utilities.isIPAddress( player ) ) {
player = PlayerManager.getPlayersIP( player );
}
SQLManager.standardQuery( "DELETE BungeeBans FROM BungeeBans INNER JOIN BungeePlayers ON BungeeBans.player = Bun... |
724d52af-4079-4f28-a1c0-bf943b4832c4 | 4 | public boolean isSolidTile(float xa, float ya) {
int x0 = (int) (x + xa + 3) / 16;
int x1 = (int) (x + xa + 8) / 16;
int y0 = (int) (y + ya + 2) / 16;
int y1 = (int) (y + ya + 8) / 16;
if (level.getSolidTile(x0, y0) != null) return true;
if (level.getSolidTile(x1, y0) != null) return true;
if (level... |
489c9ffb-bc76-49e3-ac60-a840c13db675 | 6 | public static Stella_Object walkStatement(Stella_Object tree, boolean warnonatomP) {
{ Stella_Object otree = null;
StandardObject unusedtypespec = null;
{ Object [] caller_MV_returnarray = new Object[1];
otree = Stella_Object.walkATree(tree, caller_MV_returnarray);
unusedtypespec = ((S... |
460c46f0-e78e-4bb2-8fa9-233c23582b93 | 1 | public boolean hasParentheses(){
Pattern pattern = Pattern.compile("[(][0-9¥+¥-¥*/]+[)]");
Matcher matcher = pattern.matcher(expression);
return matcher.find() ? true : false;
} |
e9ec8430-4b2b-4e28-ad72-36305c872b0b | 2 | public int depthOfNodeNoStorage(treeNode node) {
count2++;
if (node == null)
return 0;
int leftDepth = depthOfNodeNoStorage(node.leftLeaf);
int rightDepth = depthOfNodeNoStorage(node.rightLeaf);
return (leftDepth >= rightDepth ? leftDepth + 1 : rightDepth + 1);
} |
42eb6c55-5527-4ada-bc22-cf953d88531b | 6 | protected void updateEntityActionState()
{
this.despawnEntity();
EntityPlayer var1 = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
if (var1 != null)
{
this.faceEntity(var1, 10.0F, 20.0F);
}
if (this.onGround && this.slimeJumpDelay-- <= 0... |
94bccf7f-64a6-486e-82e4-7de151ff02c1 | 7 | public String read(){
data.readSettings();
data.checkOSType();
String readIn = "";
String line = null;
try{
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(data.getGamePath() + "/" + data.getGamePath().substring(data.getGamePath().lastIndexOf("/")) + ".json")));
w... |
def44a77-1bf6-45fd-987e-1fa38025301e | 0 | public BasicAxes(){
this.name = Constants.BASIC_SWORD;
this.attackScore = 2;
this.attackSpeed = 2;
this.money = 0;
} |
367509b0-a760-43be-9841-9a50d121e238 | 2 | public int getInt(String key) throws JSONException {
Object object = get(key);
try {
return object instanceof Number ?
((Number)object).intValue() :
Integer.parseInt((String)object);
} catch (Exception e) {
throw new JSONException("JSONObje... |
537e3f63-a8bb-478f-8e49-7d23402bde55 | 7 | @Override
public boolean onCommand(CommandSender sender, Command cmd,
String commandLabel, String[] args)
{
// See if any arguments were given
if (args.length == 0)
{
// Check if they have "karma" permission
this.displayHelp(sender);
}
else
{
final String com = args[0].toLowerCase();
if (co... |
9e6d58b4-63b5-411a-8f5c-9bd5831cf3b7 | 8 | public boolean updateId(long userId, DocumentUpdate changes) {
boolean r = false;
if (changes.isJobTitleChange()) {
r = jobTitleIndex.modifyIdKey(changes.getOldJobTitle(), changes.getNewJobTitle(), userId);
}
if (changes.isIndustryChange()) {
r = industryIndex.mod... |
a4ee6f91-2bbc-438f-b7c2-8e0d37dc76aa | 7 | public void fireEvent(ZWCmdClass cmd){
ZWEvent event = new ZWEvent(nodes.get((int)cmd.node),cmd.cmdClass,cmd.cmd,cmd.data);
switch(cmd.cmdClass){
case (byte)0x20: //basic
nodes.get((int)cmd.node).fireZWBasicEvent(event);
break;
case (byte)0x70: // ... |
55f081ba-b7e0-482e-85f5-ebcbfac7ee31 | 7 | public final void expr() throws RecognitionException {
try {
// Python.g:318:6: ( xor_expr ( VBAR xor_expr )* )
// Python.g:318:8: xor_expr ( VBAR xor_expr )*
{
pushFollow(FOLLOW_xor_expr_in_expr2611);
xor_expr();
state._fsp--;
if (state.failed) return;
// Python.g:318:17: ( VBAR xor_expr )*
... |
43bad30a-db38-4761-aa0f-4fb16f1f0324 | 4 | public void printTries(){
System.out.println("root");
LinkedList<Node> queue = new LinkedList<Node>();
queue.addLast(root);
int size = 1, next_size = 0;
while(!queue.isEmpty()){
Node x = queue.getFirst();
queue.removeFirst();
System.out.print(Arrays.toString(x.childs));
size--;
for(Node t : ... |
60a0da4c-8486-42b0-8ca7-ea27837e9dce | 2 | public AbstractMatter get(Class c){
for(AbstractMatter e : list)
{
if(e.getClass().getSuperclass() == c)
{
return e;
}
}
return null;
} |
d2d03849-c739-4a0d-b500-e0dcd3631d2b | 1 | public void borrarTabla(String nombreTabla)
{
try
{
this.bd.open();
this.bd.beginTransaction(SqlJetTransactionMode.WRITE);
// Esta función borra la tabla que le pasemos por la variable
this.bd.dropTable(nombreTabla);
// Esta función se u... |
fa4a97bc-22b8-4678-8277-554b161a2427 | 7 | private void finishReceivingFile(final boolean isSucceed) {
try {
this.writeChannel.truncate(receivedLength);
this.writeChannel.force(true);
this.writeChannel.close();
this.writingFile.close();
} catch (Exception e) {
e.printStackTrace(System.out);
}
if (!isSucceed) {
this.localReceivingFile.d... |
6a3210df-0682-4e88-8318-cdb8e59ed6e4 | 4 | public static int glLoadLinearPNG(String location) {
int texture = glGenTextures();
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, texture);
InputStream in = null;
try {
in = ClassLoader.getSystemResourceAsStream(location);
PNGDecoder decoder = new PNGDecoder(in);
ByteBuffer buff... |
a94531dd-9062-40ee-903c-a04826c3d08d | 2 | public synchronized void addSearchedSites(String url){
try{
String line = "";
while((line = in.readLine()) != null){
bw.write(line + "\r\n");
}
bw.write(url);
}catch (Exception ex){
System.out.println(ex);
}
} |
0b33543d-a459-4650-8280-bf4a6a24e8b3 | 0 | public DressCode getDressCode() {
return dressCode;
} |
af123fdd-bb6f-406c-b210-46dd7d30aea1 | 9 | private ArrayList<Integer> mergeSortedLists(ArrayList<Integer> first, ArrayList<Integer> second) {
ArrayList<Integer> ret = new ArrayList<>();
int fstIdx = 0;
int sndIdx = 0;
while (fstIdx < first.size() && sndIdx < second.size()) {
if (first.get(fstIdx) < second.get(sndIdx... |
9c66cf19-a04f-4a85-a0dc-806d8ed65f78 | 7 | public void displayGrid() {
displayEndBorder();
for (int x=0; x < sudokuGrid.length; x++) {
if (x%size == 0 && x != 0) {displayMiddleBorder();}
for (int y=0; y < sudokuGrid[x].length; y++) {
System.out.print((y==0 || y%this.size==0 ? "| " : ""));
System.out.print(sudokuGrid[x][y] + " ");
Sy... |
890dd772-ca62-47f1-80c3-9a05c18aaade | 5 | protected static Ptg calcTBillPrice( Ptg[] operands )
{
if( operands.length < 3 )
{
PtgErr perr = new PtgErr( PtgErr.ERROR_NULL );
return perr;
}
debugOperands( operands, "calcTBILLPRICE" );
try
{
GregorianCalendar sDate = (GregorianCalendar) DateConverter.getCalendarFromNumber( operands[0].getVa... |
a9a893de-1d8d-4879-b182-9c7086c5f5a9 | 1 | public byte[] removeAttribute(String name) {
if (unknownAttributes != null)
return (byte[]) unknownAttributes.remove(name);
return null;
} |
291d0a76-dbde-4352-a492-e8142b3dd17b | 7 | private static AttributeDomain parseDomain(Element domainElem) throws IOException {
if (domainElem == null) return null;
try {
if (domainElem.getAttribute("type").equals("continuous")) {
ContinuousAttributeDomain domain = new ContinuousAttributeDomain();
NodeL... |
c4529132-7a50-4b62-9ff2-1b9fabc082f3 | 0 | @Override
public void error(SAXParseException e) {
System.out.println("SAXParserException Error: " + e.getMessage());
this.errorOccurred = true;
} |
39fcb829-33a7-4b58-afa6-418d7cc6e6e4 | 9 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if(affected==null)
return false;
if(affected instanceof MOB)
{
final MOB mob=(MOB)affected;
if(mob.location().fetchEffect(ID())==null)
unInvoke();
}
else
if(affected instanceof Roo... |
77652b2a-5e9e-4df4-91d7-0b6d370d269d | 8 | public static List<String> getDepartments()
{
ResultSet rs=null;
Connection con=null;
PreparedStatement ps=null;
List<String> result=new ArrayList<String>();
try{
String sql="SELECT * FROM department";
con=ConnectionPool.getConnectionFromPool();
ps=con.prepareStatement(sql);
rs=ps.executeQuery();... |
537e6667-6b16-47ed-85a8-6b8e12cf956f | 9 | @SuppressWarnings("unchecked")
private void insert(HashElement<T> val)
{
insertedElements++;
boolean found_spot = false;
for(int i=0; i<this.table_hashes_used && !found_spot; i++)
{
// if it found an open available spot to place the element
if(m_table[val.getHashValue().hash(i, m_table.length)] == ... |
27213e58-1bac-4f8a-a466-9332d55ce6ee | 0 | public void destroy() {
// TODO Auto-generated method stub
} |
64ef8d3f-5ac3-484f-a056-9cf5c3a14807 | 4 | @Override
public void setDNA(int[] dna) {
this.dna = new int[boardLength];
int newDNASize = dna.length;
for (int i = 0; i < boardLength; i++)
this.dna[i] = (i < newDNASize && dna[i] > 0 && dna[i] < boardLength) ? dna[i] : 0;
fitnessScore = determineFitness();
} |
cd11c48d-cdcf-4d43-9a40-2ed752f970c1 | 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;
} |
663c66f6-cc8a-424c-aae2-ff4d3ddb2483 | 5 | @SuppressWarnings("unchecked")
private void loadModsFromConfigList() throws IOException {
ArrayList<?> newList = config.get(CONFIG_MODLIST, ArrayList.class);
if(newList != null) {
for(Object o : newList) {
if(!(o instanceof ExtendedModInfo)) {
newList = null;
break;
}
}
}
if(newLi... |
dba6cb99-160b-4005-983d-068b10fa2f45 | 1 | private void handleRun(CommandSender sender, String label, String[] args)
{
if(args.length != 0)
{
sender.sendMessage(ChatColor.RED + String.format("Usage: /%s run", label));
return;
}
sender.sendMessage(ChatColor.YELLOW + "Running all rules.");
mPlugin.runGroups(true);
} |
c52c2bca-0ab8-48b8-a4d5-8f0c5d882e63 | 0 | public List<PhpposItemsEntity> getItemsEntities(){
return getHibernateTemplate().find("from PhpposItemsEntity ");
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.