method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
30124653-b41d-4660-8ea6-2b2fab6ed8f3 | 3 | private void recordRenderer(Component c) {
if (c instanceof OutlineButton) {
textArea = ((OutlineButton) c).renderer;
} else if (c instanceof OutlineLineNumber) {
textArea = ((OutlineLineNumber) c).renderer;
} else if (c instanceof OutlineCommentIndicator) {
textArea = ((OutlineCommentIndicator) c).rende... |
d558bde1-1f8e-477e-98dc-5712f9bdce3f | 5 | @Override
public boolean isMouseWithin(double x, double y) {
//wspolrzedne wszystkich punktow
double a,b,c,d;
//3 punkty z face'a
Vertex q,w,e;
//zmienne dla rownania oglnego prostej
double A,B,C;
//wyniki czy punkty znajduja sie po tej samej stronie prostej
double Q,W,E;
for (ModelSubset sub : ge... |
aa8ad709-89cd-489f-87f7-31e8a869cb7d | 3 | public void login(Usuario usuario) throws SQLException{
if (usuarioDAO.getUsuarioActual()==null) {
if (usuarioDAO.exists(usuario)==true) {
if (usuarioDAO.match(usuario)==true) {
usuarioDAO.login(usuario);
}else{
throw new SQLExcep... |
bd8a9de8-b4fa-4fc6-939d-ba13ca50d25c | 5 | public void prepareWriting(GrowableConstantPool gcp) {
gcp.putUTF8(name);
gcp.putUTF8(typeSig);
if (bytecode != null) {
gcp.putUTF8("Code");
bytecode.prepareWriting(gcp);
}
if (exceptions != null) {
gcp.putUTF8("Exceptions");
for (int i = 0; i < exceptions.length; i++)
gcp.putClassName(excepti... |
fb406cc7-76d1-4308-9919-53052f28b03b | 0 | @Override
public String toString() {
return name;
} |
52ce7788-451a-4368-aa72-a7ef9f90fcf5 | 9 | public static void sendPlayerChannelInformation( String sender, String channel, boolean perm ) {
Channel c = getSimilarChannel( channel );
BSPlayer p = PlayerManager.getPlayer( sender );
if ( c == null ) {
p.sendMessage( Messages.CHANNEL_DOES_NOT_EXIST );
return;
... |
a3be9175-9c18-474f-91b5-8d96ca32d27c | 6 | public void run() throws TemplateException {
try {
// create html document
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder;
docBuilder = docBuilderFactory.newDocumentBuilder();
template.setHtml(docBuilder.ne... |
10a82327-c3c3-4efa-843d-dcc6988c682b | 9 | public void dependencyGraphToDot(String filename) {
// TODO this should be productions i.s.o. nonterminals
ShareableHashMap<NonTerminal, Set<NonTerminal>> dependencies = buildDependencyGraph(productions, nonTerminals.values());
BufferedWriter w = null;
try {
FileWriter fstream = new FileWriter(filename);
... |
2ffb6caa-5b3a-4118-b26b-2da0966f75b4 | 1 | public Class<?>[] getParams()
{
return this.parameters;
} |
008fe974-36f3-416d-b69d-f34775fd274c | 7 | private boolean validateConsumerDataBeforeSaving(final Consumer consumer) {
if(StringUtils.isNotBlank(consumer.getEmail()) &&
StringUtils.isNotBlank(consumer.getAddress().getCity()) &&
StringUtils.isNotBlank(consumer.getAddress().getGivenName()) &&
StringUtils.isNotBlank(consumer.getAddress().getSurname... |
0bdd06a7-827b-4aa9-8f0e-f3901c1eed2c | 2 | @Override
public void run() {
try {
System.out.println("I'm too fast for my partner. I'm waiting for him");
foreignThread.join();
for(long i = 0; i < 200; i++);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
Sy... |
0816b50b-6555-417b-b1b1-3d68f681c565 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Produto other = (Produto) obj;
if (this.IdProduto != other.IdProduto && (this.IdProduto == null || !this.... |
1a4ab9f5-a779-4d86-88ef-d1d83ff6b5df | 5 | public Set<Integer> getClusterMembers(Set<Integer> clusters, String clusterMembership){
Map<Integer,Integer> CM = readMap(clusterMembership, false);
Set<Integer> clusterMembers = new HashSet<Integer>();
Map<Integer,Integer> MemCount = new HashMap<Integer,Integer>();
for(int i : clusters)... |
2ef23e74-64f9-4784-a697-6f2004c4584e | 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-... |
b8697608-b7f3-43e5-bd90-443526e1eb63 | 7 | @Override
public void eatIfAble(MOB mob)
{
final List<Ability> spells=getSpells();
if((mob.isMine(this))&&(spells.size()>0))
{
final MOB caster=CMLib.map().getFactoryMOB(mob.location());
boolean destroyCaster = true;
for(int i=0;i<spells.size();i++)
{
final Ability thisOneA=(Ability)spells.get(i... |
de64dbdf-84e7-4f40-ac45-a6f0ed8cee14 | 3 | public static String decomposeToBasicLatin(String accentedString)
{
StringBuilder unaccentedString = new StringBuilder();
String normalizedString = Normalizer.normalize(accentedString, Normalizer.Form.NFKD);
CharacterIterator iterator = new StringCharacterIterator(normalizedString);
... |
128e6ee7-3952-4ef2-a769-d29eede63b3b | 7 | private StoreShelf readStoreShelf( InputStream in ) throws IOException {
StoreShelf shelf = new StoreShelf();
int itemType = readInt(in);
switch ( itemType ) {
case 0: shelf.setItemType( StoreItemType.WEAPON ); break;
case 1: shelf.setItemType( StoreItemType.DRONE ); break;
case 2: shelf.setItemTyp... |
d6c8780f-2a76-40ae-a518-1f6835adac6d | 6 | public static void main (final String[] args) {
if (System.getProperty("display") == null) { // Default is graphics mode.
System.setProperty("display", "graphics");
}
miner = getMiner(args);
if (miner == null) {
System.out.println("Please input correct Mi... |
756d1f24-20be-418c-b5f5-a0bcb00d2403 | 2 | public static ArrayList<ChallengeMessage> getMessagesByUserID(int userID) {
ArrayList<ChallengeMessage> ChallengMessageQueue = new ArrayList<ChallengeMessage>();
try {
String statement = new String("SELECT * FROM " + DBTable + " WHERE uid2 = ?");
PreparedStatement stmt = DBConnection.con.prepareStatement(stat... |
4fe34f6e-cbe3-4ba6-9fcb-3ccf8da4f5ba | 9 | public static void main(String[] args){
try {
GraphReader reader = null;
if(args.length == 2){
if(args[0].equalsIgnoreCase("rasp"))
reader = new RaspGraphReader(args[1], true);
else if(args[0].equalsIgnoreCase("raspxml"))
reader = new RaspXmlGraphReader(args[1], RaspXmlGraphReader.NODES_TOKENS... |
e43d9c33-a340-4efa-8668-4efbde07b7f2 | 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();
... |
2105dba6-74df-4f93-8167-2108ed260d97 | 1 | public PlayerInventory(int maxItems) {
if (maxItems < 0)
throw new IllegalArgumentException("The given inventory size is invalid!");
this.maxItems = maxItems;
} |
617b13ad-8069-4c7d-aaa8-27e19955183f | 7 | @EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerChat(AsyncPlayerChatEvent event) {
if (!event.isCancelled() && event.getPlayer() != null)
if (extraauth.DB.Contains(event.getPlayer().getName()))
if (!event.getMessage().startsWith("/auth")
&& !event.getMessage().startsW... |
2c640b43-d712-4dbe-aa1f-aba94dd5ff38 | 4 | public static String convertToHex(File file) throws IOException {
String outString;
InputStream is = new FileInputStream(file);
int bytesCounter =0;
int value = 0;
StringBuilder sbHex = new StringBuilder();
StringBuilder sbResult = new StringBuilder();
while ((v... |
01bb1496-2681-4fc6-b520-bcabf74cc81c | 2 | public void dump(){
int i=0;
try {
dumpout=new FileWriter(dumpFile);
for(i=0;i<65536;i++){
dumpout.write(new Integer(memnc[i]).toString());
dumpout.write(' ');
}
dumpout.close();
}
catch (I... |
2fd883c1-32a2-409f-8641-43f77bfb1e54 | 5 | private void fillInProjectsList(int userID){
try{
ResultSet projectsResultSet = null;
listOfUserProjects.clear();
Statement statement;
statement = connection.createStatement();
projectsResultSet = statement.executeQuery("SELECT User.userID... |
c6359014-f0ca-45c5-a9f9-a186a4fa017e | 8 | public static void main(String[] args) throws Throwable{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
for(;;){
StringTokenizer st = new StringTokenizer(in.readLine().trim());
int M = parseInt(st.nextToken()), W = parseInt(st.nextToken());
if(M==0&&W==0)break;
double[][] mAd... |
dbe2f696-a188-45fd-9db7-316bad112c8f | 0 | public String getPhoneW() {
return phoneW;
} |
511cead2-c03c-4e1c-a346-b601eeb26b47 | 4 | private void removeNodeWithOneChild(Node u)
{
Node n = (u.right == null) ? u.left : u.right;
if (n.isRed) n.isRed = false;
if (u == root)
{
root = n;
u.left = null;
u.right = null;
}
else
{
if (u.parent.left =... |
f3c28247-527a-4fdc-9de4-2b1ee6602a11 | 0 | public void setBookedSeats(int bookedSeats) {
this.bookedSeats = bookedSeats;
} |
5bde5f1a-a614-421d-9034-e3b5a34a84f3 | 7 | @Override
protected boolean doDecode(IoSession session, ByteBuffer in, ProtocolDecoderOutput out) throws Exception {
MapleClient client = (MapleClient) session.getAttribute(MapleClient.CLIENT_KEY);
DecoderState decoderState = (DecoderState) session.getAttribute(DECODER_STATE_KEY);
if (decoderState == null) {
... |
2b2f59ac-f235-4522-ba11-b89f549b7764 | 7 | private static boolean isStraight(Card[] cards) {
//Check for the 5 high special case (Where ace plays as 1 rather than 14).
if(cards[0].getValue()==2 && cards[1].getValue() == 3 && cards[2].getValue() == 4 && cards[3].getValue() == 5 && cards[4].getValue() == 14){
return true;
}
//Consider every other case.... |
ee8b56e3-3ae7-47b5-b396-58910f97f026 | 8 | public static ArrayList<OfflinePlayer> requestFilePlayers(String namepart) {
ArrayList<OfflinePlayer> requested = new ArrayList<OfflinePlayer>();
;
boolean found = false;
File dir = new File("plugins/" + AdminEye.pdfFile.getName()
+ "/players/");
for (File file : dir.listFiles()) {
PlayerFile playerFil... |
31af1921-c8b3-4f1b-bdf8-c4d751010cc7 | 0 | public String getLogin() {
return _login;
} |
6b67ec75-c133-4abb-9641-1852d3b7ad1d | 0 | public Float getYMin() {
return yMin;
} |
646a0422-d913-4e7a-ba2c-7ac6e2fdfd81 | 5 | static final void method2330(byte i) {
Class348_Sub3.method2739(0);
anInt3924++;
if (i == 86) {
Class348_Sub40_Sub25.currentPacketSize = 0;
Class348_Sub40_Sub36.aClass114_9456 = null;
((ByteBuffer) Class299.gameBuffer).position
= 0;
AbstractConnection.aClass114_3133 = null;
Class239.aClass... |
d28a4e2d-74e1-42f4-bfca-9abf6a322507 | 8 | public void decode(IoSession session, ByteBuffer in,
ProtocolDecoderOutput out) throws Exception {
boolean usingSessionBuffer = true;
ByteBuffer buf = (ByteBuffer) session.getAttribute(BUFFER);
// If we have a session buffer, append data to that; otherwise
// use the buffer r... |
d2955203-f902-42c3-bcf5-5713a3fff150 | 3 | private void checkConnection() {
if(conn != null) {
try {
if(!conn.isValid(0)) {
getConnection();
}
}
catch(Exception e) {
}
}
} |
fb25c27d-c552-4fdb-8ccc-5127eaf71baa | 6 | @Override
protected void readAttributes(XMLStreamReader in)
throws XMLStreamException {
super.readAttributes(in);
String extendString = in.getAttributeValue(null, "extends");
BuildingType parent = (extendString == null) ? this :
getSpecification().getBuildingType(extendS... |
c5d98b06-a671-4995-8ff5-046734276326 | 4 | public void reproduce0(PokemonTeam parent1, PokemonTeam parent2, int rankFit)
{
for (int i =0; i<rankFit; i++)
{
PokemonTeam child = new PokemonTeam();
child.removeAll2();
for (int x=0; x<6; x++)
{
int random = (int) (Math.random() *2);... |
3bf2ec15-3eba-414f-ad23-8d695fa5c26d | 3 | public static <T extends Service> Map<String, T> loadServicesByType(Class<T> clazz)
{
ServiceLoader<T> loader = ServiceLoader.load(clazz);
Iterator<T> it = loader.iterator();
Map<String, T> ret = new HashMap<String, T>();
while (it.hasNext())
{
T op = it.next();
... |
2af2a262-85f1-4f67-acba-f55e96685bd7 | 0 | @Override
protected int processAppInfo (byte[] appInfo)
{
// TBD
// if (Outliner.DEBUG) { System.out.println("\tStan_Debug:\tPdbBFReaderWriter:processAppInfo"); }
return SUCCESS ;
} // end method processAppInfo; |
99a28d15-f1dd-4ec3-9255-1bd3895d6f01 | 3 | public Task ChooseNewTask()
{
Task task = null;
boolean found = false;
int curPos = control.subtasks.indexOf(control.curTask);
while(!found)
{
if(curPos == (control.subtasks.size() - 1))
{
found = true;
task = null;
break;
}
curPos++;
task = control.subtasks.elementAt(cu... |
b1115017-b706-493b-98a7-8b6053868124 | 9 | public void paint(Graphics g)
{
if(debug)
System.out.println("selected="+split.list.selected);
g.setColor(Color.white);
g.fillRect(0,0,getWidth(),getHeight());
if(split.list==null)
return;
g.setColor(Color.black);
byte[] buf=split.list.getBuffer();
for(int x=0;x<screenWidth;x++)
{
if((x+1)*s... |
38a45faf-fea5-4aaf-bf98-34baff6cfca9 | 0 | public BinaryDate() {
date = new Date();
setLayout(new BorderLayout(0, 0));
timer.start();
JButton btnBack = new JButton("Back");
btnBack.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MainFrame.cardLayout.show(getParent(), "startScreen");
}
});
add(btnBack... |
865357aa-508b-450d-9f50-ffedf2a0c14c | 4 | public void order(List<List<Integer>> result, List<TreeNode> levelNode){
if(levelNode.size()== 0)
return;
List<TreeNode> newLevelNode = new ArrayList<TreeNode>();
List<Integer> levelVal = new ArrayList<Integer>();
TreeNode temp = null;
for (int i = 0;i < levelNode.si... |
8f2a3223-b02f-4d5a-a19f-e693d1f934d7 | 6 | public boolean checkIfSelectedHandles(int qx, int qy) {
if (selectedShape == null)
return false;
if (shapeManager.testInSquare((Square)upperLeft, qx, qy))
whichHandleSelected = 1;
else if (shapeManager.testInSquare((Square)upperRight, qx, qy))
whichHandleSelected = 2;
else if(shapeManager.testInSquare(... |
64d1524c-d3b6-4c33-87f7-861551569fe3 | 5 | public static HashSet<HashSet<Integer>> removeSubSet(HashSet<HashSet<Integer>> rawSet) {
HashSet<HashSet<Integer>> temp = new HashSet<>();
for (HashSet<Integer> set : rawSet) {
temp.add(set);
}
for (HashSet<Integer> block : rawSet) {
for (HashSet<Integer> block2 :... |
93d403fa-6c9c-4564-88c0-1f5df1505c9c | 6 | public static void main(String[] args) {
Random random = new Random(123999123L);
//Filling numbers[]
for(int i = 0; i < numbers.length; i++)
numbers[i] = random.nextLong();
//Filling choices[]
for(int i = 0; i < choices.length; i++)
choices[i] = random.nextInt(NUMBER_OF_NUMBERS);
//Filling unsorted[]
... |
0d1d575b-8234-4555-95e8-a9d9c6b2d015 | 0 | public static void main(String[] args) throws IOException {
ObjectMapper objectMapper = new ObjectMapper();
Map<String,Object> map = objectMapper.readValue(new File("D:\\Java SE\\src\\json\\object\\user.json"), new TypeReference<Map<String,Object>>(){});
System.out.println(map.get("name"));
... |
255434ad-0496-474d-8bdc-329e2673c874 | 3 | @Override
public List<Editor> ListByNome(String nome) {
Connection conn = null;
PreparedStatement pstm = null;
ResultSet rs = null;
List<Editor> editores = new ArrayList<>();
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(L... |
cb38b972-40c0-481b-be89-5770dee03ed2 | 1 | public void replaceCodeAt(final Object obj, final int i) {
if (this.isDeleted) {
final String s = "Cannot change a field once it has been marked "
+ "for deletion";
throw new IllegalStateException(s);
}
code.set(i, obj);
this.setDirty(true);
} |
24f09fdd-ac99-40be-9ff7-97924966bc7c | 0 | public SortedSet<TVC> getConnectionsSortedDown() {
return connectionsSortedDown;
} |
100d4789-dedc-4d64-9ab0-2cd701febe43 | 3 | @Override
public Ngram findNgram(String wordGroup) {
Connection conn = JDBC.createConnection();
Ngram ngram = new Ngram();
String sql = "select wordAttribute, frequence from ngram where wordGroup='"
+ wordGroup + "';";
PreparedStatement stat = JDBC.getSatement(conn, sql);
try {
ResultSet rs = stat.e... |
040d1c12-4d4a-43a6-8282-89c85a2ee881 | 5 | public static void createActivity(Activity activity) {
if (killCurrentActivity)
killCurrentActivity();
if (!stack.isEmpty()) {
Activity previousActivity = stack.peek();
stopActivity(previousActivity);
}
stack.push(activity);
activity.onCreate();
startActivity(activity);
if (activity.getVie... |
93723b9d-34cb-4c5d-a3ec-4d76a4073202 | 2 | @Override
public void mark(int boardPosition, Cell[] cellBoard, int rows, int columns) throws IllegalMark {
//Find the row.
int boardPositionRow = boardPosition / columns ;
//Find the column.
int boardPositionColumn = boardPosition % columns;
if (boardPositi... |
54ca15fb-f359-4e61-af12-2aa94033928e | 6 | @EventHandler
public void WitchHarm(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getWitchConfig().getDouble("Witch.Harm.DodgeCha... |
f6a59523-aa12-42da-9247-0a18f09854ab | 0 | public void setSundae(Sundae sundae) {
this.sundae = sundae;
} |
fd735848-36e4-4420-8095-33901064b3ac | 1 | public void testPlus_Hours() {
Hours test2 = Hours.hours(2);
Hours test3 = Hours.hours(3);
Hours result = test2.plus(test3);
assertEquals(2, test2.getHours());
assertEquals(3, test3.getHours());
assertEquals(5, result.getHours());
assertEquals(1, Hours.ON... |
489ce446-6965-4f44-998c-956cc0d84185 | 7 | public int ladderLength(String start, String end, HashSet<String> dict) {
if (dict.size() == 0)
return 0;
LinkedList<String> wordQueue = new LinkedList<String>();
LinkedList<Integer> distanceQueue = new LinkedList<Integer>();
wordQueue.add(start);
distan... |
158725a7-76e8-4cc1-a4c3-5533c95d2aa8 | 2 | public static GeoPointParser getParserFor(String coordinates) {
for (GeoPointParser parser : registeredParsers) {
if (parser.canParse(coordinates)) {
return parser;
}
}
throw new RuntimeException("Could not find a parser for the given input");
} |
3d8eba90-e3a7-4cd9-bb0c-32d87d3fac46 | 8 | private Carte lireCarte() throws ExceptionFormatDonnees {
ignorerCommentaires();
try {
int nbLignes = scanner.nextInt();
int nbColonnes = scanner.nextInt();
int tailleCases = scanner.nextInt(); /* en mètres */
Case[][] matrice = new Case[nbColonnes][nbLignes];
String temp = new String("");
System.... |
8136685c-7192-440b-9b84-b478aa4f8849 | 8 | public static byte packBits(boolean b0, boolean b1, boolean b2, boolean b3,
boolean b4, boolean b5, boolean b6, boolean b7) {
int val = 0;
if ( b0 ) val |= 0x1;
if ( b1 ) val |= (0x1 << 1);
if ( b2 ) val |= (0x1 << 2);
if ( b3 ) val |= (0x1 << 3);
... |
acde629b-b60c-442d-8e45-27906ad57771 | 3 | public void createBullet(boolean friendly, long birth, long life, float origin[], float offset[], int pattern[]) {
for(int i = 0; i < bullets.length; i++) {
// Try for safety!
try {
// Check if the bullet is living...
if(bullets[i].living == false) {
// And if it's not, then th... |
b35fc511-e1d5-4c26-9487-950e38255384 | 5 | public ArrayList<Integer> findSubstring(String S, String[] L) {
if (L.length == 0) {
return null;
}
int sLength = L[0].length();
int allsLength = sLength * L.length;
HashMap<String, Integer> allWords = new HashMap<String, Integer>();
for (String s : L) {
... |
b5d67ad4-c4de-478b-99dd-64a4e9c8ec11 | 0 | @Override
protected void setColoredExes() {
// TODO Auto-generated method stub
ParametricCurve bSplayn= new BSplaynCurve(allex);
coloredEx = bSplayn.Calculation();
} |
7f969337-e058-4c09-9d70-a45dfe11003d | 6 | public long nthPrime(long n){
if (n < 1)
return -1;
else if (n==1)
return 2;
else if (n==2)
return 3;
long primeCount = 2;
long nthPrime = 3;
boolean primeFound;
while (primeCount < n){
primeFound = false;
while(!primeFound){
nthPrime = nthPrime+2;
ProblemThree primeFinder = n... |
609b5fd3-7ec7-48b8-8a4a-5e68e16afd29 | 6 | public void remove(Device d) {
DeviceList temp = this.head;
if (d == null) {
return;
}
if (this.head != null) {
if (this.head.device == d) {
this.head = this.head.next;
} else {
boolean removed = false;
while (temp != null && !removed) {
if (temp.next.device == d) {
temp.next =... |
2165b365-040e-47a8-95e0-236108fc3f21 | 5 | public double getDifferenceFromVocherInATime(String beginTime,String endTime){
double totalDiff=0.0;
ArrayList<Object> receipts=this.show();
for (Iterator iterator = receipts.iterator(); iterator.hasNext();) {
SalesReceiptPO object = (SalesReceiptPO) iterator.next();
if(changeDateToInt(object.getTime(... |
19584b0c-e194-4cc8-802d-259f0957e59f | 6 | public Cell moveToAttack(Cell cell) {
ArrayList<Cell> moveableCells = this.getMoveableCells(map);
Queue<Cell> surroundingAttackedCell = cell.getSurroundingCells(map,
false);
ArrayList<Cell> nextToCells = new ArrayList<Cell>();
for (Cell c : surroundingAttackedCell) {
... |
a335a823-34fc-4a50-b1ed-17dee0664e75 | 1 | public void visit_dadd(final Instruction inst) {
stackHeight -= 4;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 2;
} |
d91bd868-dd5d-4607-b5d9-c2779855417b | 1 | private void devModeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_devModeButtonActionPerformed
if (DevConfirmationDialog.showConfirmDialog(parser) == DevConfirmationDialog.OPTION_CONFIRM_CORRECT)
new SDKMenu(new File(System.getProperty("user.home") + "/.androidtoolkit"), ... |
f5ffbba4-acb5-44c4-8155-783cb64fee49 | 6 | private int partition(int lo, int hi) {
System.out.println(this);
int i = lo;
int j = hi+1;
T pivot = elements[lo];
while (true){
while(less(elements[++i], pivot)){
if(i==hi) break;
}
while(less(pivot,elements[--j])){
... |
a507a6be-535e-4a62-8fe9-0cd815ec2d59 | 0 | @Test
public void runTestApplicationLifecycle2() throws IOException {
InfoflowResults res = analyzeAPKFile("Lifecycle_ApplicationLifecycle2.apk");
Assert.assertEquals(1, res.size());
} |
8aa0e4d3-f5fc-477a-a87a-ef0790c9ca0f | 2 | public static String replace(String... cols) {
StringBuilder sb = new StringBuilder();
for (int i=0; i<cols.length; i++) {
sb.append(",?");
}
return cols.length > 0 ? sb.substring(1) : "";
} |
08d0cb6b-6696-4dd0-ac64-dd71d4596b32 | 8 | static void system1_draw_bg(osd_bitmap bitmap, int priority) {
int sx, sy, offs;
background_scrollx = ((system1_scroll_x.read(0) >> 1) + ((system1_scroll_x.read(1) & 1) << 7) + 14) & 0xff;
background_scrolly = (-system1_scroll_y.read()) & 0xff;
if (priority == -1) {
/* opti... |
49798e40-5bef-4ed6-b03c-226dbd8fee82 | 2 | public LRUCache(int capacity) {
cache = new TreeMap<>(new Comparator<Key>(){
@Override
public int compare (Key k1, Key k2) {
if ( k1.time < k2.time ) {
return -1;
} else if ( k1.time == k2.time ) {
return 0;
... |
4f5081e3-fec5-4527-b011-7712184816b6 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Scale other = (Scale) obj;
if (this.id != other.id) {
return false;
}
if ((th... |
094d16d9-09ab-44d5-b38a-14451647582f | 2 | double gasdev() {
double R, v1, v2;
if (calculateGASDEV) {
// if we don't have an extra deviate handy
do {
// pick two uniform numbers in the square extending from -1 to +1
// in each direction
v1 = 2 * Math.random() - 1;
... |
f57d8550-41fa-4da0-beed-b41c792d26e7 | 1 | public DNode getFirst() throws IllegalStateException{
if(isEmpty()) throw new IllegalStateException("List is empty");
return header.getNext();
} |
3e80f91d-f9eb-46cd-a37a-ec545eb60724 | 7 | public KMeans(int clusterNumber, int maxIter, String path)
throws ClusterException {
if(clusterNumber <= 0)
throw new ClusterException("The number of clusters can't be negative!");
if(maxIter < 1)
throw new ClusterException("Must iterate at least once!");
if(path == null || path.equals(""))
t... |
f3deb594-6b88-4aef-aaa2-c98ff4b5ac03 | 8 | public BankBillet getBankBillet(Integer id)
throws CobreGratisBadRequestException,
CobreGratisUnauthorizedException, CobreGratisForbiddenException,
CobreGratisServiceUnavailableException,
CobreGratisInternalServerErrorException,
CobreGratisNotFoundException, CobreGratisTooManyRequestsException {
Client... |
6010af34-f7f2-4da0-8fe5-02849babda42 | 3 | public void visitOuterClass(final String owner, final String name,
final String desc) {
checkState();
if (outer) {
throw new IllegalStateException(
"visitOuterClass can be called only once.");
}
outer = true;
if (owner == null) {
throw new IllegalArgumentException("Illegal outer class owner");
... |
95b1f8ff-7a69-42ef-99f9-c1777254722b | 5 | public void putAll(Map<? extends K,? extends V> m) {
for (Entry<? extends K, ? extends V> e : m.entrySet())
put(e.getKey(), e.getValue());
} |
4f18093b-c629-4bd5-b785-33a1ce729dce | 3 | public String getShapeString() {
StringBuffer localStringBuffer = new StringBuffer();
localStringBuffer.append(this.shape.length);
localStringBuffer.append(",");
localStringBuffer.append(this.shape[0].length);
localStringBuffer.append("\n");
for (int i = 0; i < this.shape[0].length; i++)
{
... |
ea3e1c80-f278-46a3-bf1c-119667defa59 | 2 | void scoreDnaSequence(String seq1, String seq2, int start, int threshold, int result) {
// Overlapping with DnaSequence
DnaSequence s1 = new DnaSequence(seq1);
DnaSequence s2 = new DnaSequence(seq2);
DnaSubsequenceComparator<DnaSequence> compartor = new DnaSubsequenceComparator<DnaSequence>(true, threshold);
... |
021ab574-fb64-4b00-9f5e-900f797f378e | 4 | public void setLocation(SelectMode selectMode, Location location)
{
switch (selectMode)
{
case FirstBlock:
m_firstLocation = location;
break;
case SecondBlock:
m_secondLocation = location;
break;
}
... |
e2e976c8-9109-4b8d-9c5f-21c78bb7251c | 3 | @Override
public AbstractComponent parse(String string) throws BookParseException {
if (string == null) {
throw new BookParseException("String is null");
}
try {
TextComponent component = (TextComponent) factory
.newComponent(EComponentType.SENTENCE);
Pattern lexemPattern = Pattern.compile(LEXEM_RE... |
34fa30c4-6f94-493c-b71b-7fc36eb15641 | 6 | private void storyReader(Character hero) {
String nextLine = Qscan.nextLine();
while (!nextLine.startsWith("end")) {
// monster encounter
if (nextLine.equals("<>")) {
String monsterName = Qscan.nextLine();
String monsterStats = Qscan.nextLine();
Scanner Mscan = new Scanner(monsterStats);
M... |
033dae6e-d3ad-404f-b58f-26e90a15becd | 3 | private Object handleResult(Class<?> sourceType, Class<?> targetType, Object result) {
if (result == null) {
assertNotPrimitiveTargetType(sourceType, targetType);
}
return result;
} |
5c0bc937-3d1b-410d-9683-cd54f038f431 | 7 | void getMoves_B(Space last, SpaceList list) {
int n = numToWin - 1;
if (last != null) {
int[] pos = last.getPos();
for (int i = 0, rowInd = pos[0]; i <= n; i++, rowInd = pos[0] - i)
for (int j = 0, colInd = pos[1]; j <= n; j++, colInd = pos[1]
- j) {
boolean outOfBounds = rowInd < 0 || colInd <... |
7eac987b-488a-4ede-9688-78ac42c058bd | 3 | public Client(int callcount, String ip, boolean useEvents) {
this.callcount = callcount;
if (ip == null) {
conn = new RemoteClientConnection("localhost", 9090);
}
else {
conn = new RemoteClientConnection(ip, 9090);
}
/**
* Handler for call from server
*/
conn.setInvoke... |
c00313bd-d2a6-493d-9ee8-3bcc6022a89a | 6 | public String verifyAndCleanPath(String path) {
String[] paths = getAllDirectories(path);
//ugly use to handle duplicates.
LinkedHashMap<String,Integer> verifiedPaths = new LinkedHashMap<String,Integer>(){
@Override
public Integer put(String s, Integer i) {
... |
0cc86cea-9ed1-4e7b-9f11-06434ec7e96b | 9 | @Override
public void doAttack(Player player, TurnContext context) {
if (player.getHandSize() > 3) {
SelectCardOptions sco = new SelectCardOptions()
.to(getText("q1"))
.fromHand()
.exactly(3);
Card[] selectedCards = player.pickCards(sco, player.getHand());
boolean bad = false;
... |
6bd65a25-e431-4049-bc73-5236041dd72a | 6 | public static int getDiameter() {
// Find the largest connected component.
LinkedList<Person> nodes = new LinkedList<Person>();
for (LinkedList<Person> component : components)
if (component.size() > nodes.size())
nodes = component;
// Calculate its diameter (find the longest shortest path).
long start ... |
f13b8fe7-f588-4010-a85c-74444eac724f | 2 | public void validateIdPuesto(JTextField a) {
a.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent e) {
char c = e.getKeyChar();
if (c != '2' && c != '1') {
getToolkit().beep();
e.consume();
... |
54aab946-462c-442a-abd0-159bd0ad5d06 | 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... |
e2e79d60-f1dd-4570-b34e-c986f69affca | 8 | public void execute() {
if (oneshot) {
if (sim.getT() - lastchangetime > 0.005) {
if (position <= 8) {
GetNextBit();
}
lastchangetime = sim.getT();
}
}
if (pins[0].value && !clockstate) {
cloc... |
89c8cee0-aeb1-41e1-b1c2-79b2bd6309a3 | 5 | private Color genericDiagnol(int i, int direction) {
for (int j = 0; j <= board[0].length - 4; j++) {
Color current = board[i][j];
if (current.isNotNone()) {
boolean success = true;
for (int k = 1; k < 4; k++) {
if (board[i + k * direct... |
7eb0cfcf-9dc2-44f9-9cef-976870e3d0fb | 2 | protected Tetromino getCopy() {
Tetromino t = null;
try {
t = this.getClass().newInstance();
if (t instanceof Tetromino) {
t.setBase(this.base);
t.setRel(this.rel);
}
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
return t;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.