method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e3b1606a-8a93-4485-907c-ac9d5234356f | 5 | public void newPacket(DataPacket packet) {
if(monitor != null || client != null) {
if(packet.getData().length > 0)
System.out.println(packet.getSource() + "-" + new String(packet.getData()));
if (packet.isKeepAlive()) {
this.monitor.messageReceived(packet);
}
else if (packet.isRouting()) {... |
a93f16d0-02ba-4f05-9281-4472756719b7 | 0 | @BeforeTest
public void setup() {
addressBookData = "src/test/resources/address_book.csv";
data = Data.getDataAsList(addressBookData);
addressBook = new AddressBook(data);
} |
032f1caa-57a3-4759-98d8-21dabc0bc6d5 | 2 | private void setConfigs(Matrix new_m, int[] start, int[] vector, int[] start_vector) {
assert start.length == 2;
assert vector.length == 2;
assert start_vector.length == 2;
m = new_m;
starting_point[0] = (start[0] < 0) ? m.width-start[0] : start[0];
star... |
70f14a42-fa7f-412f-963b-593444b3f3b3 | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Node<?> other = (Node<?>) obj;
if (data == null) {
if (other.data != null... |
67183684-5816-4856-8b79-f751b8d10a6b | 7 | public static boolean isMuted(String player){
if (player == null) return false;
else {
Double mute = config.getDouble("mute.".concat(player.toLowerCase()).concat(".time"), 0);
if (mute == -1){
return true;
} else if (mute == 0){
... |
d68a54a4-5c87-4202-a276-e2eba229ade2 | 8 | public void copyResource(DocPath resource, boolean overwrite, boolean replaceNewLine) {
if (exists() && !overwrite)
return;
try {
InputStream in = Configuration.class.getResourceAsStream(resource.getPath());
if (in == null)
return;
Output... |
085d3eb4-fa87-4a38-b851-d907e15fcbef | 8 | static final boolean method2510(IndexLoader class45,
Class348_Sub16_Sub3 class348_sub16_sub3,
IndexLoader class45_5_, boolean bool,
Class279 class279, IndexLoader class45_6_) {
try {
Class318_Sub1_Sub4.aClass279_8764 = class279;
Class98.aClass348_Sub16_Sub3_1564 = class348_sub16_sub3;... |
d7bfee50-ad90-43e6-b01d-2636ae0fd5e3 | 4 | public int minusDILookback( int optInTimePeriod )
{
if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) )
optInTimePeriod = 14;
else if( ((int)optInTimePeriod < 1) || ((int)optInTimePeriod > 100000) )
return -1;
if( optInTimePeriod > 1 )
return optInTimePeriod + (this.unsta... |
db21fa90-6268-4f3d-8431-c3ec04bca953 | 6 | public void onAction(String binding, boolean isPressed, float tpf) {
if (binding.equals(KeyMapper.MOVE_LEFT)) {
left = isPressed;
} else if (binding.equals(KeyMapper.MOVE_RIGHT)) {
right = isPressed;
} else if (binding.equals(KeyMapper.MOVE_FORWARD)) {
up = i... |
f60ca004-d92f-4f8d-babf-6c71523db47b | 8 | public static Program parseASM(String text, String defaultLabel) throws ParserException{
// break into lines
String[] lines = text.split("\n");
// Create an alias map to keep track of redundant labels
AliasMap aliasMap = new AliasMap();
// Create a new program
Program prog = new Program();
// Cre... |
63c08e69-a693-4731-ba37-bd1dc65909ad | 8 | public static List<Edge> dijkstraShortestPath(Graph g, int sourceVertex, int destinationVertex) {
Set<Integer> mould = new HashSet<>();
Set<Integer> universe = new HashSet<>();
universe.addAll(g.getAllVertex());
Map<Integer,List<Edge>> shortestPath = new HashMap<>();
final Map<I... |
18d90a5b-14f3-4e0e-b668-34b7f28dc246 | 8 | private void generateCallMethod(ClassFileWriter cfw)
{
cfw.startMethod("call",
"(Lorg/mozilla/javascript/Context;" +
"Lorg/mozilla/javascript/Scriptable;" +
"Lorg/mozilla/javascript/Scriptable;" +
"[Ljava/lang/Ob... |
107b32c8-f576-451e-abe8-f25d9d47a92c | 2 | public static boolean propertyEqualsAsInt(PropertyContainer container, String key, int test_value) {
if (container != null) {
try {
int value = getPropertyAsInt(container, key);
return value == test_value;
} catch (NullPointerException npe) {
return false;
}
} else {
throw new IllegalArgumen... |
7a5809fc-3a63-499d-b6c7-a706adc980f8 | 6 | @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onDropLockedItemOnDeath(PlayerDeathEvent event) {
if (event.getEntity().getWorld().isGameRule("keepInventory")) {
return;
}
final Player player = event.getEntity();
if (player.hasPermission... |
52bdc822-1d10-4bef-b3f8-30a9decbb081 | 7 | public HashMap<String, Vector<Vector<Integer>>> generateSocaialFeature(String fileName){
String[] handPickRelevantUser = null;
if(fileName.equalsIgnoreCase("NUS1")){
handPickRelevantUser = new String[] { "NUSingapore",
"NUSLibraries", "nusmba", "NUS_MENA", "NUSCFA", "nusosa",
"yalenus", "NUSHistSoc",... |
beddd371-4935-4364-a82d-cf233e4b05ec | 1 | @Override
public void addMessageToDB() {
try {
String statement = new String("INSERT INTO " + DBTable +
" (uid1, uid2, time, isConfirmed, isRejected) VALUES (?, ?, NOW(), ?, ?)");
PreparedStatement stmt = DBConnection.con.prepareStatement(statement);
stmt.setInt(1, fromUser);
stmt.setInt(2, toUser);... |
5b9e03f2-7c12-4af2-8039-55d1fdc252be | 6 | private void moveElevator() {
if ((elevator.wasTargetOfLastCollision()&&elevatorCountdown--<=0)||
(elevatorPosition!=-90f&&elevatorPosition!=-180f)) {
float tempElevator=elevatorPosition+elevatorOffset;
float tempOffset=elevatorOffset;
if (tempElevator<-180f) {
... |
35a12c71-01bd-4402-8996-de526596ee39 | 3 | public void writeToFile() throws IOException {
String path = "C:\\Users\\lenovo\\Desktop\\1.txt";
File f = new File(path);
if (f.exists()) {
f.delete();
f = new File(path);
}
if (f.createNewFile()) {
BufferedWriter output = new BufferedWriter(new FileWriter(f));
while (current != null) {
Sy... |
bbee0482-fe78-4fe8-8c1d-987a75130c0f | 3 | public static int searchInsert(int[] A, int target) {
// Note: The Solution object is instantiated only once and is reused by each test case.
int ss=0, ee=A.length-1;
int middle;
while(ss<=ee) {
middle=(ss+ee)/2;
if(A[middle]==target) return middle;
el... |
b42c28c2-5cbc-44e4-8f2f-8d8fb5a0d4c4 | 8 | public static List<TradFile> readTransitive(InputStream in) throws FileNotFoundException{
List<TradFile> list=new ArrayList<>();
Scanner scanner=new Scanner(in);
TradFile tFile=null;
while(scanner.hasNextLine()){
String line=scanner.nextLine();
if(line.startsWith(FILE_DELIMITER)){
i... |
8a2a9110-f9f2-4c68-b8f0-00cf4750d1a4 | 5 | @Override
public void executeInternal(int minValue) {
seqUnbounded(new EflTextSegment(Move.A)); // player mon uses attack
// System.out.println("EflHitMetricSegment: size=" + sb.size());
seq(new CheckMetricSegment(new EflCheckMoveDamage(isCrit, effectMiss, 0, minDamage, maxDamage, false),GREATER_EQUAL, minDamag... |
8b02c821-5dd4-4513-8e71-5b7c97d9cfe0 | 9 | public boolean isBalanced(String input){
Stack<Character> stack = new Stack<Character>();
for(int i=0;i<input.length();i++){
// push
if(LEFT_BRACES.indexOf(input.charAt(i) ) != -1){
stack.push(input.charAt(i));
}
// pop & validate
else{
Character lastElement = stack.pop();
if( lastElem... |
ce42c6f5-83d6-4161-9446-8b434bf5d58b | 6 | public int deserialize(BinarySearchTree<String, String, String> tree) {
Properties prop = new Properties();
InputStream istream = getClass().getClassLoader().getResourceAsStream("com/file/resources/additionalsearchtree.properties");
List<BinaryNode<String, String,String>> li = null;
try {
... |
a5a400e6-136f-4f40-8b3e-3a7ed81f0f6c | 1 | public DbScoreboard() {
try {
Class.forName("org.sqlite.JDBC");
ensureStructure();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
} |
2db120ff-8aa0-4d74-8f0f-a4881a1b4919 | 0 | @Override
public String toString(){
return "id= "+this.getId()+", " +this.getName()+"\n"+
getTime()+"\n"+
"Ребро: "+this.getHig()+"\n"+
"Сумма рёбер: "+this.getSum()+"\n"+
"Длина диагонали: "+this.getDiag()+"\n"+
"S=: "+this.getArea()+
" V=: "+this.getVolume()+"\n"... |
dc6683dc-2716-4f61-846c-f04857be97d9 | 1 | public Key min() {
if (isEmpty())
throw new java.util.NoSuchElementException();
return pq[1];
} |
a9900b30-1262-458b-b234-c3029b80f7e2 | 8 | @Override
public void createPreview(JTextArea ContentBox) {
String nLine = String.format("%n");
ContentBox.setText("");
boolean toolsInitFlag = false;
boolean pointsFlag = false;
for (int i = 0; i < fileLength; i++) {
if (tools_init[i] != null) {
if (!toolsInitFlag) {
toolsInitFlag = true;
C... |
83cbb360-8f93-4c93-9d63-ae203c644169 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof TransactionEntity)) return false;
TransactionEntity that = (TransactionEntity) o;
if (identificationCode != that.identificationCode) return false;
if (name != null ? !name.equals(that... |
4bc98171-aa65-453f-8c01-e122593db914 | 9 | private void parseRegex(String regex) //a-z, ^0, A-Z
{
int strLen = regex.length();
if(regex.startsWith("^")) //is a not
{
for(int i = 1; i < strLen; i++)
{
if(regex.length() > i + 2 && regex.charAt(i+1) == '-') //fits a-z pattern
{
for(int j = regex.charAt(i); j <= regex.charAt(i+2); j++)... |
9fcf593a-1b2d-49c5-8b1e-2e14c91436e7 | 3 | public static void main(String args[]) {
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
... |
2caaf604-84a8-485d-bc4f-86eceb9912d4 | 9 | int insertKeyRehash(long val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look until FREE slot or we start to loop
... |
218622b9-c324-4201-8ac7-35827a429b07 | 3 | public PanelOptions() {
JPanel content = new JPanel();
content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
lblGeneration = new JLabel("Génération #0,00");
content.add(lblGeneration);
content.add(new JLabel());
content.add(new JLabel("Algorithme utilisé"));
... |
607ac27d-591b-4714-9e9b-3cbf036e90ec | 1 | @Override
public String toString() {
String toString = "[\n";
for (Rule rule : this.rules) {
toString += rule.toString() + "\n";
}
toString += "]";
return toString;
} |
47fa56c6-d41e-4802-96c3-3c9672ae12ae | 3 | public static List<Zaposlenik> dajZaposlenike(String pretraga)
{
Session session = HibernateUtil.getSessionFactory().openSession();
Query q = session.createQuery("from " + Zaposlenik.class.getName());
List<Zaposlenik> sviZaposlenici = (List<Zaposlenik>)q.list();
List<Zaposlenik> zaposlenici = new ArrayList<Zap... |
e23cb465-633b-4d37-a4be-f07ec8d94ff0 | 0 | private void createPanelStructure() {
JPanel mainPanel = new JPanel();
//Set main panel layout
mainPanel.setLayout(gridBagLayout);
GridBagConstraints constraints = new GridBagConstraints();
//Add groupboxes
equationParametersPanel.setBorder(BorderFactory.createTitledBord... |
9ab825b8-abbe-4893-b803-b402d8a79884 | 1 | public void validate(){
if( key == null ){
throw new IllegalStateException( "key is null" );
}
} |
2d1db1c1-2fae-4dda-baa7-20cf9933ad0f | 4 | @Test
public void test3() {
System.out.println("Test avec l'init avec 2 arguments et tous les états possibles");
System.out.println("Tests de couverture des post-conditions d'init");
for(BlocType b : BlocType.values()) {
for(PowerUpType p : PowerUpType.values()) {
bloc3.init(b,p);
assertTrue("type ini... |
3f6d231c-b3ab-4527-8590-dad79960f5d5 | 4 | @Test
public void testBatchBuy() throws EasyPostException, InterruptedException {
List<Map<String, Object>> shipments = new ArrayList<Map<String, Object>>();
Map<String, Object> shipmentMap = new HashMap<String, Object>();
shipmentMap.put("to_address", defaultToAddress);
shipmentMap.put("from_address"... |
aae2552b-2b79-4f94-9016-0c09ea0422a7 | 4 | private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
int index = estrategyT.getSelectedRow();
if(index>=0){
String nombre = (String)estrategyT.getModel().getValueAt(index,0);
for(int i=0;i<contenedorEstrategia.ge... |
61acd7ab-8f53-4264-8752-248e10c79747 | 8 | private ArrayList<CardPattern> hasBomb(ArrayList<Card> cards){
ArrayList<CardPattern> bombCardPatterns = new ArrayList<CardPattern>();
CardPatternFactory factory = new CardPatternFactory();
Collections.sort(cards);
int i=0;
int sameCardsCounter=0;
int size = cards.size();
int value=0;
while(i<size){
... |
1cb2dfc9-f5de-40a7-b96e-a29f5aecfb1f | 4 | public void EliminaMedio (int Posicion)
{
if ( VaciaLista())
System.out.println( "Nada");
else
{
NodosProcesos Aux =null;
NodosProcesos Actual = PrimerNodo;
int i =1;
while (( i != Posicion) & (Actual.siguiente != PrimerNodo))
{
i++;
Aux =Actua... |
aaad9563-292d-4cb3-9b60-102046241161 | 8 | private int readValidityPeriodInt()
{
// this will convert the VP to #MINUTES
int validity = readByte();
int minutes = 0;
if ((validity > 0) && (validity <= 143))
{
// groups of 5 min
minutes = (validity + 1) * 5;
}
else if ((validity > 143) && (validity <= 167))
{
// groups of 30 min + 12 hrs... |
48439f83-a6ae-44c1-a7b3-e958dac38f1b | 1 | protected void setBufferManager( BufMgr mgrArg ) {
mgr = mgrArg;
int numBuffers = mgr.getNumBuffers();
// These are the C++ code which we ignored
//char *Sh_StateArr = MINIBASE_SHMEM->malloc((numBuffers * sizeof(STATE)));
//state_bit = new(Sh_StateArr) STATE[numBuffers];
for ( int i... |
1e1e249c-e1d1-4ea3-a834-719b86326c86 | 1 | private void init() {
for (int i = 0; i < CAPACITY; i++) {
arr[i] = null;
}
} |
2e5734aa-237d-48ee-9cf8-0267fad3f603 | 1 | private boolean empate(int numero1,int numero2){
if(numero1 == numero2){
return true;
}else{
return false;
}
} |
8aca4a47-43c8-4bca-a095-81d153a3d13d | 7 | public int edmons_karp(int s, int t) {
int u, e;
this.s = s;
mf = 0;
Arrays.fill(p, -1);
while (true) {
f = 0;
Queue<Integer> q = new LinkedList<Integer>();
int[] dist = new int[V];
Arrays.fill(dist, INF);
dist[s] = 0;
q.offer(s);
Arrays.fill(p, -1);
while (!q.isEmpty()... |
5c97f397-3572-463e-818d-2a44c739c1f1 | 7 | @Override public void layoutContainer(Container parent) {
int cardOverflow = fieldCardComponents.size() % 4;
int cardsPerSide = fieldCardComponents.size() / 4;
boolean even = true;
Dimension point = new Dimension();
//calculates where to start drawing the the field cards
if(cardOverflow != 0) {
point.wi... |
25692cf1-d329-4866-8ddf-962b2fba1520 | 2 | public static void saveConfig() throws IOException {
File current = new File(System.getProperty("user.dir") + "/config");
if(current.exists()) {
current.delete();
}
current.createNewFile();
BufferedWriter writer = new BufferedWriter(new FileWriter(current));
writer.write("<AUDIO>");
writer.newLin... |
17716259-7d5e-429f-939c-f65f70b11162 | 9 | public void tick() {
ticksleft--;
if (pressedUp) { pressedUp = false; currentblock.tryRotate(); }
if (pressedRight) { pressedRight = false; currentblock.tryMoveRight(); }
if (pressedLeft) { pressedLeft = false; currentblock.tryMoveLeft(); }
if (ticksleft <= 0) {
if (currentblock == null) {
... |
7c5dd16f-d816-4b94-aab0-1af89f291d1f | 6 | protected String InferLangFromReferralUrl(HttpServletRequest httpRequest, String parseLangQueryParams)
{
// Examine the referer header that came with this request to see if we can infer the user's language.
// If we find a query string paramater that matches the list provided, return the content of that... |
d2184d7e-5aab-49f1-925a-f5c4ab1e4502 | 8 | private void volume_slide() {
int up, down;
up = ( volume_slide_param & 0xF0 ) >> 4;
down = volume_slide_param & 0x0F;
if( down == 0x0F && up > 0 ) {
/* Fine slide up.*/
if( effect_tick == 0 ) {
set_volume( volume + up );
}
} else if( up == 0x0F && down > 0 ) {
/* Fine slide down.*/
if( eff... |
f8fa6289-d852-44a5-99c0-db0bc219641a | 2 | public void idToValue() {
int valueList[] = { 11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 11, 2,
3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 11, 2, 3, 4, 5, 6, 7, 8,
9, 10, 10, 10, 10, 11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10 };
for (int i = 0; i < 52; i++) {
if (id == i) {
value = valueList[i];
brea... |
3a2a23a2-cb1f-4a0c-bbb1-aeaf8219b4c9 | 1 | public long[] decodeLongs() {
long[] res = new long[decodeInt()];
for (int i = 0; i < res.length; i++) {
res[i] = decodeLong();
}
return res;
} |
96c84a6e-590a-4885-92b5-af7b882ddc53 | 7 | public double calculateDistance() throws IllegalStateException,
ArithmeticException {
double U1, U2, w, sigma, ssig, csig, salp, c2alp, c2sigm;
double u, A, B, C, dsig, b;
double lambda, dlam = 0.0, lastdlam = 0.0;
double p, q;
int nIters = 0, nMaxIters = 10;
double a = ellipsoid.getSemiMajorAxis();
d... |
8e6dfd4c-ccd5-4265-865a-6249c2d9daf0 | 0 | boolean isObjectAlreadyInDB() {
return objectAlreadyInDB;
}//isObjectAlreadyInDB |
0289a902-0dd8-47ff-a08b-634d00e646d0 | 3 | @Override
public void deleteMedicine(MedicineDTO medicine) throws SQLException {
Session session = null;
try {
session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.delete(medicine);
session.getTransaction().com... |
4c914e9f-9cd0-4af4-b893-2e89f2bafcd3 | 3 | private synchronized void deuce (String v) throws JMSException {
QueueConnection qc =null;
QueueSession qs =null;
///prova mess
try {
qc = qcf.createQueueConnection();
} catch (JMSException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
qs = qc.createQueueSession... |
956bb43a-688f-4322-ac5c-a54bb81972cf | 5 | private void
build_function_structure()
{
if(log_level >= 4) log.log(4, key, "build_function_structure called.", "\n");
TreeMap<Integer,Variable> temp = new TreeMap<>();
HashMap<Integer,Variable> helper;
int count = 0;
for (... |
ee663806-4751-4974-91c2-2b1e998fa0b5 | 4 | public List<ItemType> getAllRandomItems(){
List<ItemType> itemsToReturn = new ArrayList<>();
for(ItemType item : items.keySet()){
double d = new Random().nextDouble();
if(d < items.get(item)){
itemsToReturn.add(item);
}
}
for(ExclusiveItems exclusive : exclusiveItems){
ItemType exclusiveItem ... |
6009d42c-ad08-4db3-b8ac-a9c9b3c0ef89 | 1 | public void testConstructor_RI_RP8() throws Throwable {
DateTime dt = new DateTime(TEST_TIME_NOW);
Period dur = new Period(0, 0, 0, 0, 0, 0, 0, -1);
try {
new MutableInterval(dt, dur);
fail();
} catch (IllegalArgumentException ex) {}
} |
03e02764-6077-42d5-9692-c1a894304218 | 5 | @Override
public void execute() {
if (Game.getClientState() != Game.INDEX_MAP_LOADED) {
ItemCombiner.stop = 1000;
}
if (Game.getClientState() != Game.INDEX_MAP_LOADED && ItemCombiner.stop == 1000) {
ItemCombiner.stop = 50;
}
if (ItemCombiner.client != Bot.client()) {
WidgetCache.purge();
Bot.... |
1927c871-3f9e-4177-9a28-6c079befbed5 | 5 | public void addCard(String s) {
// Correspondance entier-carte : 0 = chevalier ; 1 = monopole ; 2 = route ; 3 = decouverte ; 4 = victoire.
if (s.equals("chevalier")) cards[0]++;
else if (s.equals("monopole")) cards[1]++;
else if (s.equals("route")) cards[2]++;
else if (s.equals("decouverte")) cards[3]++;
e... |
640f208c-13ad-4b5c-9d3b-c6759b1d2219 | 2 | public String log() throws Exception
{
ArrayList<LogItem> toLog = new ArrayList<LogItem>(data.length);
LogItem toAdd;
for (int i = 0; i < data.length; ++i)
{
if (dataSwitch[i])
{
toAdd = new LogItem();
toAdd.barID = AutoAppro.products.get(data[i].supplierID).barID;
toAdd.price = data[i].price... |
766441dd-c290-4e92-9407-cc1faf84fbed | 8 | private void setMatrixArray(int[] readBuffer) {
//1st report
if (readBuffer[0] == 0x1a) {
oldMatrix[4] = matrix[4];
oldMatrix[5] = matrix[5];
oldMatrix[6] = matrix[6];
oldMatrix[7] = matrix[7];
/*deb*/
System.out.println("setting m... |
1ac70385-ae0e-448f-bad0-610a910c52f3 | 3 | @Override
public void handleMessages(Inbox inbox) {
// TODO Auto-generated method stub
while (inbox.hasNext()) {
Message msg = inbox.next();
if (msg instanceof PackHelloOldBetHop) {
PackHelloOldBetHop a = (PackHelloOldBetHop) msg;
handlePackHello(a);
}else if (msg instanceof PackReplyOldBetHop... |
1c09f94b-7f2b-4323-b142-a83e88d040d8 | 8 | public Spit(String dir, TileMap tm){
super(tm);
if(dir.equals("right")){
facingRight = true;
facingUp = false;
facingDown = false;
} else if(dir.equals("up")){
facingRight = false;
facingUp = true;
facingDown = false;
} else if(dir.equals("down")){
facingRight = false;
facingUp = fals... |
69949df7-5320-442a-a89d-5bb7b4844750 | 7 | public void storeSMS(HttpServletRequest req)
{
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
String msg="";
String disease, age, location, riskgroup, vaccine;
disease=age=location=riskgroup=vaccine=null;
Entity en=new Entity("inboundSMS");
en.setProperty("number", req.get... |
27f69151-6fd2-46dc-b332-1f858a69c388 | 9 | public static String display(Object object) {
if (object == null) {
return null;
}
try {
// Invoke toString if declared in the class. If not found, the
// NoSuchMethodException is caught and handled
object.getClass().getDeclaredMethod("toString");
return object.toString();
} catch (NoSuchMethod... |
a30843eb-28de-44d0-9bdc-26ab0633509c | 9 | private String makeCode(){
String c=((ComboText)command.getSelectedItem()).getValue();
if(c.equals("MAKE")){
String code=objName.getText()+"=addons.canvas2d("+makeW.getValue()+","+makeH.getValue()+");\n";
code+=objName.getText()+".autoUpdate="+makeUpdate.isSelected()+"\n";
... |
bd3adbc7-19c5-4216-b533-fbb9a3be728f | 9 | public static Map<String, Vector<String>> getCuratedCategories() throws PluginNotFoundException {
final Map<String, Vector<String>> identities = new HashMap<String, Vector<String>>();
final SimpleFieldSet sfs = new SimpleFieldSet(true);
sfs.putOverwrite("Message", "GetOwnIdentities");
SyncPluginTalker spt = ... |
06cdba48-add9-4b3e-b5bc-0ec913dd77a0 | 1 | public ArrayList<Integer> getValidMoves(int player) {
ArrayList<Integer> playerPieces = findPlayerPieces(player);
ArrayList<Integer> legalMoves = new ArrayList<Integer>();
for (Integer playerPiece : playerPieces)
legalMoves = findLegalMoves(playerPiece, player, legalMoves);
C... |
ac318519-53bd-4b61-b41d-2dc2864c927a | 0 | public int getValidRxCount() {
return validRxPackets;
} |
09ca3a78-7edf-4f0f-958d-4a14a11ebaf1 | 5 | public void setFullScreen(DisplayMode displayMode) {
final JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setUndecorated(true);
frame.setIgnoreRepaint(true);
frame.setResizable(false);
device.setFullScreenWindow(frame);
... |
ba959924-ee67-44d4-9970-01474cb8531a | 4 | @Override
public void keyReleased(KeyEvent e) {
//only checks for user input if the game has started
if(gameFrame.gameStarted()){
// if the user presses W
if (KeyEvent.getKeyText(e.getKeyCode()).equals("W")) {
// attempt to move the player forwards
player.moveForward();
}
else if (KeyEven... |
9c4c8863-fccb-4474-9212-437b185383bc | 5 | private Result _evaluate(EvaluationCtx context) {
// evaluate
Result result = combiningAlg.combine(context, parameters,
childElements);
// if we have no obligations, we're done
if (obligations.size() == 0)
return result;
... |
aadc11f4-e7ce-4018-89e9-1f7d02f163b3 | 8 | public static Iterator<Position> get8NeighborhoodIterator(Position center) {
ArrayList<Position> list = new ArrayList<Position>();
int row = center.getRow(); int col = center.getColumn();
int r,c;
for (int dr = -1; dr <= +1; dr++) {
for (int dc = -1; dc <= +1; dc++) {
r = row+dr; c = col+d... |
912a1cb3-42f9-4184-bd25-f18b131e3af1 | 3 | @WebMethod(operationName = "ReadProduct")
public ArrayList<Product> ReadProduct(@WebParam(name = "prod_id") String prod_id) {
Product prod = new Product();
ArrayList<Product> prods = new ArrayList<Product>();
ArrayList<QueryCriteria> qc = new ArrayList<QueryCriteria>();
... |
7bdd8abc-1f12-4093-bdcf-fea9abdbfb89 | 7 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (hashCode() == o.hashCode()) return true;
Asteroid asteroid = (Asteroid) o;
if (dangerousToMankind != asteroid.dangerousToMankind) return fal... |
5c9d8e00-a41c-4887-8b3a-60100971c1ea | 8 | public static boolean argumentMatchesListHelperP(Stella_Object argument, List theList) {
{ Surrogate testValue000 = Stella_Object.safePrimaryType(argument);
if (Surrogate.subtypeOfP(testValue000, Units.SGT_LOGIC_PATTERN_VARIABLE)) {
{ PatternVariable argument000 = ((PatternVariable)(argument));
... |
ab973675-12ed-435f-a02e-279f05386d93 | 2 | private void activate() {
if (isActive())
throw new IllegalArgumentException("Forcefield was already active, something went wrong");
this.active = true;
for (Element e : getGrid().getElementsOnPosition(getGrid().getElementPosition(this)))
collideWith(e);
} |
f84bb352-d43b-43bb-95c6-ed28605310d7 | 3 | public void mightyMode(boolean isOn){
this.player= new MightyPacman(this.player.getX(), this.player.getY(), this, this.player.getFacing(), this.player.getSavedDir());
this.playerStateTimer.stop();
this.playerStateTimer.start();
for (int i=0; i < 4; i++)
if (this.ghosts[i].getIsAlive())
if (i%2 == 0)
... |
95d7af89-46db-445b-ae15-d4064182cf7e | 8 | public int compare(String o1, String o2)
{
String s1 = (String)o1;
String s2 = (String)o2;
int thisMarker = 0;
int thatMarker = 0;
int s1Length = s1.length();
int s2Length = s2.length();
while (thisMarker < s1Length && thatMarker < s2Length)
{
... |
cb7bed96-db3b-415a-8962-065cc790c788 | 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://... |
49c54db3-d650-4161-aebc-aa6e82d1873c | 8 | @Override
public void option() {
int cores = Runtime.getRuntime().availableProcessors();
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
if (this.operand.equals("random"))
{
Random r = new Random(new Date().getTime());
int tasks = r.nextInt(15) + 1;
Config.getInstance().th... |
738ca03f-f450-4d51-a0ce-dbf4c8e48072 | 1 | public double[] meanColumns() {
int nRows = getRowDimension();
int nCols = getColumnDimension();
double[] result = sumColumns();
for (int c = 0; c < nCols; c++) {
result[c] = result[c] / nRows;
}
return result;
} |
b0b0199a-911f-4cc4-8160-fbfc506c4824 | 7 | public LinkedList<FaultsStore> getFaults(){
LinkedList<FaultsStore> psl = new LinkedList<FaultsStore>();
Connection Conn;
FaultsStore ps = null;
ResultSet rs = null;
try {
Conn = _ds.getConnection();
} catch (Exception et) {
System.out.println("No Connection in Faults Model");
return null;
}
... |
0009b59c-be52-492f-9bde-a03e2b9d1312 | 7 | private void printString(TypeList list1, TypeList list2) {
String inputedType = list1.type();
if (list2 != null) {
inputedType = inputedType + "/" + list2.type();
TypeNode current2 = list2.head();
while (current2 != null) {
list1.modType(... |
f9aab11f-12ed-410a-971e-6b3c92f2c33c | 1 | public static void main(String args[]){
System.out.println("The value of 12 is");
R1Dot9IsOdd r=new R1Dot9IsOdd();
if(r.isOdd(12)){
System.out.println("Odd");
}else{
System.out.println("Even");
}
} |
44873bec-7f46-4007-958f-707e810f8746 | 4 | private boolean isFourCardBadugi()
{
if (isColour() || isStreet() || isThree() || isPair())
{
return false;
}
else
{
return true;
}
} |
d7ee0f16-7c9d-4647-9a69-7cb0fe447569 | 5 | public boolean postMortem(PostMortem pm) {
JSONzip that = (JSONzip) pm;
return this.namehuff.postMortem(that.namehuff)
&& this.namekeep.postMortem(that.namekeep)
&& this.stringkeep.postMortem(that.stringkeep)
&& this.substringhuff.postMortem(that.substring... |
80e22b34-c090-44ed-86de-b630574c2adc | 9 | public void reinit(){
switch(loadingCount){
case 0:
updateMapProgress(0.10f, "Reloading");
break;
case 1:
this.setPaused(true); // ensure it's paused
//stateManager = new AppStateManager(this); bulletAppState.cleanup();
initStates();
updateMapProgress(0.10f, "Create Ship");
break;
c... |
888ab46f-487e-4ae6-b9a3-1f344869f7af | 7 | @Override
public void delScript(ScriptingEngine S)
{
if(scripts!=null)
{
if(scripts.remove(S))
{
if(scripts.size()==0)
scripts=new SVector<ScriptingEngine>(1);
if(((behaviors==null)||(behaviors.size()==0))&&((scripts==null)||(scripts.size()==0)))
CMLib.threads().deleteTick(this,Tickable.TI... |
b4d2dcc6-06ff-4ca5-87df-435fd97c7347 | 9 | public void checkHit(){
setBounds((int)x, (int)y, 20, 20);
for(Enemy enemy : board.getEnemies()){
if(this.intersects(enemy) && enemy.inGame()){
if(ammoAbility != null && ammoAbility.equals("glue")) enemy.slowDownEnemy();
enemy.setLives(damage);
// add splash damage to missiles
if(ammoType.eq... |
775e9e9c-d9d0-4e8a-9885-a7f408e02a53 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Rectangle other = (Rectangle) obj;
if (Float.floatToIntBits(x) != Float.floatToIntBits(other.x))
return false;
if (Float.floatToIntBits(y) !... |
5b656d10-d588-46ce-8f0f-3437b7315b12 | 0 | @Override
public String getCity() {
return super.getCity();
} |
cd3dbb17-4653-473b-93b9-49ad4eddb20f | 3 | boolean isAttackPlaceDiagonallyBelowRightNotHarming(int position, char[] boardElements, int dimension, int attackPlacesOnTheRight) {
int positionRightBelow = 1;
while (attackPlacesOnTheRight > 0) {
if (isPossibleToPlaceDiagRightBelow(boardElements.length, position, dimension, positionRightB... |
8ff5970e-3215-49f3-b336-8c8b839d51b1 | 7 | public boolean setInputFormat(Instances instanceInfo) throws Exception {
if ((instanceInfo.classIndex() > 0) && (!getFillWithMissing())) {
throw new IllegalArgumentException("TimeSeriesDelta: Need to fill in missing values " +
"using appropriate option when class inde... |
fe6e2ea5-1388-47e0-844e-be490be4552c | 3 | public PassengerCarChoice(Frame owner, DepartingTrain theTrain) {
super(owner, true);
this.theTrain = theTrain;
setBounds(100, 100, 270, 203);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
conte... |
06a12dd8-0bfe-4e36-bdef-2c4984b4a65e | 6 | private static String write(int c, String l) {
switch (c) {
case 0:
return "NAME:" + NAME;
case 1:
return "MONEY:" + MONEY;
case 2:
return "POS:" + POS;
case 3:
return "MAP:" + MAP;
case 4:
return "GENDER:" + GENDER;
case 5:
return "MUSIC:" + MUSIC;
}
return null;
} |
b27a94c0-1ea6-473b-8ba4-7c6ad8386974 | 6 | public static CategoryDataset timeCreateDataset2(String t0, String t1, String t2, String t3, Map<String,Integer> timemap, String user_name)
{
DefaultCategoryDataset dataset=new DefaultCategoryDataset();
//System.out.println(t0+t1+t2+t3);
int a0 = Integer.parseInt(t0);
int a1 = Intege... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.