method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
9d3aa23c-a343-4278-bcd1-c5c33e9bb70b | 7 | Table selectClause() {
ArrayList<Condition> conditions = new ArrayList<Condition>();
ArrayList<String> columnNames = new ArrayList<String>();
Table table2 = new Table(new String[]{});
Table result;
_input.next("select");
String column = columnName();
columnNames.... |
f63b4f56-c0d0-4704-bbb5-d8f111fe6897 | 6 | @Override
public void printResult() {
System.out.println("----------------------");
System.out.println("---SERPENTINE TWIST---");
System.out.println("----------------------");
System.out.println("\nINPUT:");
System.out.println("------");
for (Player p : pCon)
if (!p.getName().equals("Dummy: odd amount o... |
2cdad9c7-4119-44a3-9ba6-381122e227cd | 9 | public void gerar(String ip, String banco, String usuario, String senha, String tabela, JEditorPane classe, JEditorPane insercao, JEditorPane remocao, JEditorPane cargaobjeto, JEditorPane leituraObjeto, JEditorPane metodoBuscar) {
ResultSet rs = null;
ResultSetMetaData rsmd = null;
Connection co... |
bbdb27e5-120f-4ce6-99d0-acf4a617feea | 1 | public void showWindow() {
frame = new JFrame("Welcome to YAMG!");
centerPanel = new JPanel();
centerPanel.setLayout(new BorderLayout());
image = new ImagePanel();
centerPanel.add(BorderLayout.CENTER, image);
frame.getContentPane().add(centerPanel);
frame.setResizable(false);
frame.setDefaultCloseOpe... |
bca60ef9-d3fd-458c-ac22-25322403e5e6 | 6 | public long userAuthentication(String username, String password) {
if (username == null || password == null || username.isEmpty() || password.isEmpty()) {
return -1;
}
User user = userDAO.getUserByUsername(username);
if (user != null && BCrypt.checkpw(password, user.getPassw... |
4f2a8857-2a8d-4e17-9929-c80042bcbe0b | 9 | private void generateAppend(Expression expr, int estimate) {
if (!(expr instanceof ConcatenateExpression)) {
generate(expr);
return;
}
ConcatenateExpression concat = (ConcatenateExpression)expr;
Expression left = concat.getLeftExpression()... |
9ec477fb-9a82-4f27-b6a0-ccb53fe65911 | 6 | public static void openEnchantmentTable(Player player) {
//has to have the use permission
if (!permission.has(player.getWorld(), player.getName(), "portables.enchant.use")) {
return;
}
//has to be holding the material
if (permission.has(player.getWorld(), player.getName(), "portables.enchant.has")) {
//... |
c929f036-a1fd-491d-8c15-0ae91e88069c | 3 | public void setNumInt(TNumInt node)
{
if(this._numInt_ != null)
{
this._numInt_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
... |
ec76f38b-0677-490c-9f83-7919628afd2a | 7 | public static String convertToString(long t){
t = t / 1000;
long s = t % 60;
t /= 60;
long m = t %60;
t /=60;
long h = t % 24;
t /=24;
long d = t;
if (d < 1 && m < 1 && h < 1){
return s +" seconds";
}
if (d < 1 && h < 1 && s == 0){
return m + " ... |
4214edf4-075a-4e3e-b1f3-ffbebcaf8f10 | 7 | private synchronized Map<String, HashMap<String, Queue<Integer>>> createInvertedIndex() {
Map<String,HashMap<String,Queue<Integer>>> myMap = new HashMap<String, HashMap<String, Queue<Integer>>>();
File resources = new File("resources");
BufferedReader br = null;
for (File inputFile : resources.listFiles()) {
... |
e0484d2d-cc90-4b93-92e6-c5f805e90149 | 0 | public static RawEntityStore getInstance() {
return instance;
} |
91498cd9-8248-4e56-ac4e-9984f250ca44 | 7 | public static void addModsFromTextFile(File modList, boolean firstTime) {
String modListName = modList.getName();
if (modListName.endsWith(".txt")) {
try {
BufferedReader bufferedReader = new BufferedReader(new FileReader(modList));
String line;
... |
90daa7ff-91de-461c-9754-3b8c282eb1a4 | 2 | public void removeQuery(String name) {
try {
Node setting = Utilities.selectSingleNode(this.doc, "/c:settings/c:queries/c:query[@c:name='" + name + "']", this.namespaces);
if(setting != null) {
setting.getParentNode().removeChild(setting);
save();
}
} catch (XPathExpressionException e) {
logger.... |
f5745b11-b9aa-4211-9558-50100417c771 | 2 | public String getListaNomesDisciplinas(List<Disciplina> lista) {
String listaNomes = "";
for (int k = 0; k < lista.size(); k++) {
Disciplina d = lista.get(k);
listaNomes += d.getNome();
if (k != lista.size() - 1) {
listaNomes += ",";
}
}
return listaNomes;
} |
7124614c-4ad4-4d39-ba74-54e0ae23d1f3 | 6 | public void recordCorpusData (Corpus c, Learner l){
if (!isRecording) return;
this.c=c;
Vocabulary v = c.getVocabulary();
Set<Map.Entry<String, Integer>> entrySet = v.getWordIndicesEntrySet();
Set<Map.Entry<Integer, Word>> wordSet = v.getWordEntrySet();
StringBuilder s = new StringBuilder(v.getNumOfWords()*... |
bec8c2b6-4e0e-4f79-8df3-c04f94f131b5 | 4 | public List<ProductInfoDto> getProductInfos(){
List<ProductInfoDto> productInfos=null;
PreparedStatement stmt = null;
ResultSet rs = null;
try {
stmt = conn
.prepareStatement("select proName,investManager,proInfo from ProductInfo");
rs = stmt.executeQuery();
String proName = "";
String i... |
aa8c8088-1ab7-40c7-802f-006197869399 | 0 | public void setContrindic(String contrindic) {
this.contrindic = contrindic;
} |
e7602d44-ee61-43eb-89bb-5c040f65bc98 | 6 | @Test
public void testGetAndPutByteFiles() {
System.out.println("Put Plaintext, get Plainfile, encrypt and decrypt Byte Files");
for (int i = 1; i < 100; i += 3) {
String filePathPlain = "target/test.txt";
String filePathEnc = "target/test.cty";
String filePathDec... |
ecb70b7b-7133-4721-b2b3-df822fb3ada7 | 5 | public void parseDays(
String[] cleanedTimetable,
int index,
Section currentSection)
{
//possible Days are M,T,W,R,F
String days = cleanedTimetable[index];
if (days.contains("M"))
currentSection.addDay(Day.MONDAY);
if (days.contains("T"))
... |
a4a972f1-bebc-4335-92eb-e2b5aace8946 | 7 | @SuppressWarnings("unchecked")
@Override
public <E extends Serializable> void handle(Transport<E> unwrappedRoot, Set<String> includesPath, Method setter, Serializable value)
throws SerializationProcessingException {
if (includesPath==null || includesPath.isEmpty()) {
return;
}
String fieldName = createFi... |
f6a28bef-af83-4c9d-855e-7be8babafbe9 | 3 | public static Packet readPacketFromStream(BufferedReader in) throws IOException {
StringBuilder sb = new StringBuilder();
String line;
while(true) {
line = in.readLine();
if(line.isEmpty()) {
sb.ap... |
3af0ed9e-56db-464a-a61b-d78b3870ec97 | 2 | public static void remove(Object o){
if(o instanceof Client){
synchronized(map){
map.remove((Client)o);
}
}
if(o instanceof SocketChannel){
synchronized(map){
map.inverse().remove((SocketChannel)o);
}
}
} |
b7f9d72d-bd69-49bf-b9da-56fbec9e195c | 1 | public static synchronized Connection getConnectionFromPool() throws Exception
{
Connection newConnxn = null;
if(availableConnections.size() == 0)
{
newConnxn = getConnection();
usedConnections.addElement(newConnxn);
}
... |
bba067ad-b6f3-44af-9e4c-a3b54c1dc03e | 5 | private static GregorianCalendar getDateFromPtg( Ptg op )
{
Object o;
if( op instanceof PtgStr )
{
o = calcDateValue( new Ptg[]{ op } ).getValue();
}
else if( op instanceof PtgRef )
{
o = op.getValue();
if( o instanceof String )
{
o = calcDateValue( new Ptg[]{ new PtgStr( o.toString() ) } )... |
2f91b1bf-570d-476a-809d-4a4df8fea719 | 9 | public void initialize(FlowChartInstance flowChartinstance, ChartItemSpecification chartItemSpecification) throws MaltChainedException {
super.initialize(flowChartinstance, chartItemSpecification);
for (String key : chartItemSpecification.getChartItemAttributes().keySet()) {
if (key.equals("id")) {
idName... |
c4813114-760a-4848-bbea-673f6065fc02 | 1 | public E second() {
if (size() < 2) {
throw new RuntimeException("Second element not available");
}
return this.get(1);
} |
c5c82034-d13c-4f39-9ef3-a64daabab8df | 9 | public static void main(String args[]) throws Throwable {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
mem=new int[5][1<<20];
for (int t=0,T=parseInt(in.readLine().trim());t++<T;) {
StringTokenizer st=new StringTokenizer(in.readLine());
... |
59d69683-3ad5-454f-b9a4-0589af0809c5 | 7 | public void onPlayerInteract(PlayerInteractEvent event){
Player player = event.getPlayer();
if(event.hasBlock()){
Block bloc = event.getClickedBlock();
event.setCancelled(CuboidsList.checkBlock(player, bloc));
}
if(player.isOp() || player.hasPermission("xoliocraft.pos")){
/*if(Tools.getTool() == 2){
... |
9bd30ec8-b314-43fb-b60d-ec95e0fbe7de | 0 | public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
} |
cef6b047-1878-48cb-abbf-db8e57298a39 | 6 | public void floyd(){
for(int k=1;k<(n+1);k++){
for(int i=1;i<(n+1);i++){
for(int j=1;j<(n+1);j++){
if(A[i][j][0] <= (A[i][k][0]+A[k][j][0])){
A[i][j][1]=A[i][j][0];
}else{
A[i][j][1]=A[i][k][0]+A[k][j][0];
}
}// end j
}// end i
// copy the array
for(int p=1;p... |
9b28b455-3f03-4ea3-b3bf-542d60a0c0dc | 1 | public boolean fatigued() {
if(iFatigue > TirednessThreshold){return true;}
return false;
} |
73f06d08-7066-4c5c-82b1-42c0333fe1a8 | 5 | public static void putLong(ByteBuffer out, long x)
{
long value = (x < 0 ? -x : x);
int sign = (x < 0 ? BYTE_SIGN_NEG : BYTE_SIGN_POS);
long a = (value & 0x3F);
int more = (value >>= 6) != 0 ? BYTE_MORE : 0;
out.put( (byte)(more | sign | a) );
while ... |
8cfb3aa4-ed97-4e11-952f-87af9fedd9f9 | 5 | public boolean matches(String s, String t, HashMap<String, TreeSet<String>> m) throws Exception {
if (!defs.containsKey(s))
throw new Exception("Error: symbol <" + s + "> not defined.");
//remove all non-word characters 0-9, a-z, A-Z, then split into tokens
Vector<String> tTokens = new Vector<Str... |
5c641a20-dbee-4224-a2bc-fb75673224f9 | 4 | public void load(){
try {
File dir = new File("stage");
if(! dir.exists() || !dir.isDirectory()){
dir.mkdir();
}
File stageData = new File(dir,"stage.data");
if(!stageData.exists()){
throw new RuntimeException("未找到stage文件");
}
ObjectInputStream oos = new ObjectInputStream(new FileInpu... |
f71df34c-54ab-4f3e-aaba-e9ffe6bd5459 | 3 | private final DbRow readRow(XMLStreamReader sr)
throws XMLStreamException
{
expectTag(FIELD_ROW, sr);
DbRow row = new DbRow();
while (sr.nextTag() == XMLStreamReader.START_ELEMENT) {
String elemName = sr.getLocalName();
String value = sr.getElementText();
... |
961f50ad-57a8-43a0-9339-a03fc7d16489 | 7 | @Override
public void actionPerformed(ActionEvent e) {
// Only JButtons are registered to this listener
String action = ((JButton) e.getSource()).getActionCommand();
if (action.equals(ViewFrame.ACTION_START_SHOPPING)) {
mViewFrame.setButtonsForShopping(true);
mViewFrame.showProducts(mProductCatalogue);
... |
b3785daf-76a6-4715-9460-939e935ea0a3 | 9 | public void paint(Graphics g){
if( environment != null && ((Labyrinth)environment).structure != null ){
Labyrinth env = (Labyrinth)environment;
int n = env.structure.length;
int m = env.structure[0].length;
g.setColor( Color.lightGray );
int GRID_SIZE = CELL_SIZE * DIMENSION;
f... |
13f32ba1-2dde-4408-b0c3-aad459eee0db | 8 | public int compareTo(FloorCell fc) {
if (fc.alreadyCleaned() && !this.alreadyCleaned()) {
return -1;
} else if (!fc.alreadyCleaned() && this.alreadyCleaned()) {
return 1;
}
else { if (fc.getVisited() > this.getVisited()) {
return -1;
} else if (fc.getVisited() < this.getVisited()) {
return 1;... |
ed577e15-df1c-46da-bd12-2b592de6d446 | 4 | public void mousePressed(MouseEvent e) {
//get the current player
Player p = model.playerList.getCurrentPlayer();
//get the coordinate that the mouse is clicked on
int x = screenToTile(e.getX() + p.getCamera().x, model.world.getWidth());
int y = screenToTile... |
e883045b-8306-4b50-8e32-2415f1a81f2e | 9 | private boolean r_vowel_suffix() {
int v_1;
int v_2;
// (, line 170
// try, line 171
v_1 = limit - cursor;
lab0: do {
// (, line 171
// [, line 172
ket = cursor;
if (!(in_grouping_b(g_AEIO, 97, 242))) {
cursor = limit - v_1;
break lab0;
}
// ], line 172
bra = cursor;
// call ... |
dfb46da3-1e6b-478c-af6f-61f2a91e0be0 | 1 | private void addBoundaries( BoxData<?> box, XElement xparent ) {
XElement xbounds = xparent.addElement( "bounds" );
xbounds.addElement( "x" ).setInt( box.getX() );
xbounds.addElement( "y" ).setInt( box.getY() );
xbounds.addElement( "width" ).setInt( box.getWidth() );
xbounds.addElement( "height" ).setInt... |
f4129509-b275-4bfd-9045-347149302094 | 2 | public JTextField getTfMensaje() {
if (tfMensaje == null) {
tfMensaje = new JTextField();
tfMensaje.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent event) {
if (event.getKeyCode() == KeyEvent.VK_ENTER)
enviarMensaje();
}
});
tfMensaje.setColumns(10);
}
... |
9103bb77-bd55-42f8-b2a5-b9349996625a | 3 | public static TestLinkId<?> fromDescription(Description description) {
final TestLink testLink = description.getAnnotation(TestLink.class);
final String externalId = testLink.externalId();
final long internalId = testLink.internalId();
if (!externalId.equals(TestLink.NOT_AVAILABLE)) {
... |
c668fad6-f80f-4c30-b904-1a87aa9cfddc | 4 | private void tick() {
if(tickCount > 500){
tickCount = 0;
spawnTimer -= 10;
System.out.println("Spawn rate increasing!");
if(spawnTimer < 20) spawnTimer = 20;
}
if(spawnCount > spawnTimer){
spawnCount = 0;
EntityHandler.addE... |
8ca5fb61-eb1e-41d1-aa37-9bdf38d581ed | 1 | public BlockFace getSignBack(Block sign) {
BlockFace front = getSignDirection(sign);
if (front != null) {
return front.getOppositeFace();
}
return null;
} |
2e85fb3c-2d92-4a47-a5cf-ed082959d671 | 5 | public void solve() {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
if (n == 0) {
System.out.println(1);
System.exit(0);
}
int low = 0, high = 5 * n;
while (low + 1 < high) {
int mid = low + (high - low) / 2;
int cnt = countTailingZero(mid);
// System.ou... |
a8cdd0dd-2146-4d20-9bce-e56cf6755dfc | 9 | public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
... |
f04cb3b3-4320-48db-8a29-84577fd80569 | 1 | public Color getColor(RGB rgb) {
Color color = (Color) fColorTable.get(rgb);
if (color == null) {
color = new Color(Display.getCurrent(), rgb);
fColorTable.put(rgb, color);
}
return color;
} |
5879dd15-c2ce-4b31-bbbe-b9f4561780d3 | 4 | public static List<String> getUsersList() {
ArrayList<String> users= new ArrayList<String>();
File folder = new File(Settings.getAppDatasPath());
if(folder.exists()) {
File[] listOfFiles = folder.listFiles();
for (int i = 0; i < listOfFiles.length; i++) {
if(listOfFiles[i].isFile()) {
if(listOfF... |
56deec77-3bc5-4059-aa7e-b061a5133500 | 9 | public void assignAlligatorTickets(int day) {
// List to store interested clients and their respective values
List<ClientValuePair> aligatorInterest = new ArrayList<ClientValuePair>();
// Find each customer that could use an alligator ticket that day
for (int ii = 0; ii < 9; ii++) {
if (ii < 8) {
Client... |
b7bc9309-1f59-454e-a225-3d0b4c055eed | 0 | @Override
public void focusLost(FocusEvent e) {
handleUpdate();
} |
49772c59-5985-4b1d-b4fd-361d28fb92a5 | 4 | private int getPrecedence(TokenOperator token) {
int precedence = 0;
String original = token.getOriginal();
if (original.equals("*")) {
precedence = 1;
} else if (original.equals("/")) {
precedence = 1;
} else if (original.equals("+")) {
precedence = 2;
} else if (original.equals("-")) {
preced... |
0608816e-18bb-4c7c-a882-f084183e7373 | 0 | public void IncrementTotalPersonsWaited()
{
totalPersonsWaited += 1;
} |
b9e42e1e-2807-4072-936e-fdc816f6c19e | 1 | @Override
public int wordCount() {
if(realInstruction == null)
return 0;
return realInstruction.wordCount();
} |
0c7ec9a1-5036-4238-9bfb-e2320525ec23 | 0 | @Test
public void testSearchName() throws Exception {
MyUnit.testFindFieldsbyName();
} |
e3e31ba9-bb24-4956-aaa4-1e4278c66eaf | 4 | public void setPosition(Position position) {
super.setPosition(position);
if(this.getWorld() != null) {
for(Food food : this.getWorld().eatableFood(this.getPosition(), this.getRadius())) {
this.setRadius(Constants.FOOD_RADIUS_GROWTH*this.getRadius());
food.setToEaten();
}
if(!this.getWorld()... |
49b71df0-306f-400f-8ead-2071fc97f121 | 1 | public int hashCode() {
return (int)(3 *((figured == null) ? 0 : figured.hashCode()));
} |
f8124e29-309f-4d85-8af4-7b08d5547ff1 | 4 | public void updateUnits()
{
name1.setText(hero1.getName());
name2.setText(hero2.getName());
list1.clear();
list2.clear();
for (core.GroupOfUnits u: units1) {
if (u != null) {
list1.addItem(u.type.name + "("+u.getNumber()+")");
}
}
for (core.GroupOfUnits u: units2) {
if (u != null) {... |
1a1a429b-e8e7-47f3-8f2d-f4b5229f22ab | 1 | public DataList readList(String tag){
if(!data.containsKey(tag)){
System.out.println("The tag "+ tag + " did not exist.");
return null;
}
DataList list = new DataList((JSONArray)data.get(tag));
return list;
} |
864b3884-9099-4477-814d-fd299e042cb6 | 7 | private boolean changeCheck(Object component, boolean box) {
String group = getString(component, "group", null);
if (group != null) {
if (getBoolean(component, "selected", false)) { return false; }
for (Object comp = get(getParent(component), ":comp");
comp != null; comp = get(comp, ":next")) {
if (c... |
a46a9f0d-742b-4e46-8af8-131810d07cce | 7 | public void lookUpPLayer(String ln){
if(root == null){ // this is for first node
System.out.println("there's no player in the roster");
}
else{
Node compare = root;
while(true){
if(ln.compareTo(compare.getPlayer().getName().getLast()) < 0){
if(compare.getLeft() == nul... |
c4c7df79-dba5-4c2e-a47b-55c0ffcc5a63 | 5 | public void remove(){
if (current == null)
throw new NoSuchElementException();
if (current == first){
first = first.link;
current = (LinkedListNode<T>) first;
previous = null;
if (first == null)
l... |
1ceb4cd6-d98f-4a1f-91c6-4e342ff18247 | 4 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String name, String[] args) {
String cmdName = cmd.getName().toLowerCase();
if (!(sender instanceof Player)) {
sender.sendMessage("no console usage");
return false;
}
Player player = (Player) sender;
switch(cmdName) {
case "bala... |
c6a14f46-53a9-4bd9-94c2-fbfe8d4bbdbf | 6 | public Browser(Socket client, PacketManager pm, byte opcode) {
super(client, pm);
writer = null;
try {
writer = new PrintStream(client.getOutputStream(), false, "US-ASCII");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
... |
ad0b276c-7e06-4dd0-bbc0-ec6b4e07f0d9 | 6 | @Override
public EvaluationCommand parse(EvaluationContext context) {
final MathExpressionReader mathExpressionReader = context.getMathExpressionReader();
if (mathExpressionReader.isEndOfMathExpression())
return null;
final String symbolPresentation = MathExpressionSymbols.CLO... |
cd3987d2-9b87-4983-a5c4-13dd9296721c | 5 | private static int discard(LinkedList<Fragment> src, int cut, int poffset) {
int offset = poffset;
int postend, c, l;
// i think this discards everything up to "cut"
// a fragment may have to be split if it
// overlaps "cut"
for (Iterator<Fragment> iter = src.iterator();... |
3e8ec883-289f-4f3c-ab75-4b5aa48a1fde | 6 | public static void main(String[] args){
deck.shuffleDeck();
distributeDeck();
// GAME LOOP
do{
System.out.println(hand1.element() + " vs " + hand2.element());
System.out.println("Hand_1:"+hand1.size()+" Hand_2:"+hand2.size()+"\n");//Show Current Stats
if( hand1.element().compareTo(hand2.element()) =... |
c74dfe6d-fe0c-4eb6-9810-53eb7eff0dd5 | 6 | public static double real(double value, double lessFactor,
double moreFactor, double randDouble)
throws IllegalArgumentException
{
String errorMsg = "GridSimRandom.real(): Error - ";
if (value < MIN_VALUE)
{
throw new IllegalArgumentException(error... |
c1bafa09-1f39-4035-971f-6d3e1c1dafa7 | 4 | private double[] calculateMemoryConsumption(Component component, HardwareAlternative hardwareAlternative) {
double consumption[] = { -1, -1 };
consumption[0] = component.getUsageMemory().getEnergyPoints();
for (HardwareComponent memory : hardwareAlternative.getHardwareComponents()) {
double temp = Utils.consum... |
1ae7e2b6-b23b-4f89-8e3c-be3f9cd14748 | 7 | @Override
public void repaint(Graphics2D g) {
if (font == null)
font = g.getFont();
if (scheme != null)
g.setColor(scheme.text);
g.setFont(font);
String largestString = "";
int offset = 0;
for (String str : leftColumn) {
if(str == n... |
0363240e-5406-468c-84ee-49351822c9b1 | 2 | public String getTypeSignature() {
if (topType.isClassType() || !bottomType.isValidType())
return topType.getTypeSignature();
else
return bottomType.getTypeSignature();
} |
86a8bf4b-7c6f-4213-a3d3-22de4774e0e1 | 2 | public DronePop(int rows, int cols){
this.pop = new HashMap<Point, Drone>();
this.numRows = rows;
this.numCols = cols;
for(int i = 0; i < this.numRows; i++){
for(int j =0; j < this.numCols; j++){
this.pop.put(new Point(i,j), new Drone(0, new Point(i,j)));
}
}
} |
ae210305-9d56-4fa3-8d34-b852823f8d05 | 4 | public void run() {
long start = System.nanoTime();
long elapsed;
long wait;
final int minTimeBetweenFrames = 5;
while (running) {
//Timing
//elapsed is the number of nanoseconds since last frame
elapsed = System.nanoTime() - start;
... |
53a0218b-3fb6-45ac-b74d-d75fd3f94b3a | 3 | public final void des_set_strkey(String str, int schedule[]) {
byte key[] = new byte[DES_KEY_SZ];
int i;
for (i = 0; i < 8 && i < str.length(); i++)
key[i] = other_odd_parity[str.charAt(i) & 0x7f];
for (i = str.length(); i < 8; i++)
key[i] = other_odd_parity[0];
des_set_key(key, schedule);
} |
f9411760-3bfb-4dc2-bce3-1d327a281cbb | 7 | public Object removeWait(long timeout) throws QueueClosedException, TimeoutException {
synchronized(mutex) {
if(closed)
throw new QueueClosedException();
final long end_time=System.currentTimeMillis() + timeout;
long wait_time, current_time;
/*if... |
3a9ffbb9-c20c-4dad-a681-bc614f249635 | 8 | private boolean pasteMoleculeAt(int x, int y) {
Molecule oldMol = (Molecule) pasteBuffer;
int oldNOA = nAtom;
Molecule mol = oldMol.duplicate();
if (mol == null)
return false;
nAtom += mol.size();
mol.translateTo(x, y);
if (mol.isOutside(boundary)) {
errorReminder.show(ErrorReminder.OUT_OF_BOUND);... |
657d5fa9-ea6f-4f02-81f1-e0d6b3a635dd | 1 | public synchronized void add(User element) {
if ( model.add(element) )
contentChanged();
} |
5ac82a03-4e11-48ac-b570-9e4436fb393e | 5 | private Location besmetKonijntjes(Location location) {
Field field = getField();
List<Location> adjacent = field.adjacentLocations(getLocation());
Iterator<Location> it = adjacent.iterator();
while(it.hasNext()) {
Location where = it.next();
Object ... |
d80cb611-c880-421b-9437-69887c23d0b2 | 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://... |
550fc0bf-b16d-4c12-b669-0a7f71df56bb | 9 | public static String[] tokenize(String commandLine) {
List<String> resultBuffer = new java.util.ArrayList<String>();
if (commandLine != null) {
int z = commandLine.length();
boolean insideQuotes = false;
StringBuffer buf = new StringBuffer();
for (int i ... |
d76ba12c-bf40-424c-b6ee-5c14b6c51543 | 7 | public static QuestionCalculation decode(String encodedQuestionCalculation) throws DecodeException {
QuestionCalculation res;
if (encodedQuestionCalculation.substring(0, 19).compareTo("#QuestionCalculaion") == 0) {
res = new QuestionCalculation();
int i = 19;
if (enco... |
a8cdcef6-657f-479b-a412-9e9d67edf775 | 1 | public static void main(String s[])
{
Character a[] = {'S', 'H', 'E', 'L', 'L', 'S', 'O', 'R', 'T', 'E', 'X', 'A', 'M', 'P', 'L', 'E'};
sort(a);
for (char ch : a)
System.out.print(ch + " ");
System.out.println();
} |
527d4757-8898-4e3d-b55d-516fb4da324a | 4 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
VCNTreeItem other = (VCNTreeItem) obj;
if (id != other.id)
return false;
return true;
} |
734668f6-6252-4e51-8015-57260e31db0e | 3 | *
* @throws IOException if a communications error occurs
* @throws UnknownHostException if the Cyc server cannot be found
* @throws CycApiException if the Cyc server returns an error
*/
public CycList canonicalizeList(CycList cycList)
throws UnknownHostException, IOException, CycApiException {
... |
41cbe499-4ae7-4c4c-aebf-fc8aadccf148 | 7 | public static void execute(Player p, String[] a) {
if (a.length!=1) {
p.sendMessage(CTF.TAG_BLUE + "Usage: /ctf leave");
} else {
if (CTF.gm.isPlaying(p)) {
PlayerInventory inv = p.getInventory();
inv.setHelmet(new ItemStack(Material.AIR, 1));
... |
ff85b8a8-fbb1-40f3-b653-069f6e2e1c46 | 1 | public JPanel getStandardBtnChangesMenu() {
if (!isInitialized()) {
IllegalStateException e = new IllegalStateException("Call init first!");
throw e;
}
return this.standardBtnPanel;
} |
c07af68c-4102-4fcc-bc09-0841b7714adc | 4 | public static List<FileData> parse(String[] entries) {
List<FileData> data = new ArrayList<FileData>();
for (String s : entries) {
s = s.trim();
String[] infos = s.split(" ");
if (infos.length > 0) {
FileData fd = new FileData(infos[0]);
infos = Arrays.copyOfRange(infos, 1, infos.length);
for ... |
83578882-5dd1-4985-89a6-9eef5e228fe0 | 8 | private ArrayList[] parseLibrary() {
JSONParser jsonParser = new JSONParser();
ArrayList<Song> songsArray = new ArrayList<Song>();
TreeSet<Album> albums = new TreeSet<Album>();
TreeSet<Artist> artistsSet = new TreeSet<Artist>();
try {
JSONObject result = (JSONObject) ... |
bd64f800-a83b-4706-93eb-a8746294c39a | 7 | public int open() {
final Shell dialog = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.RESIZE | getStyle());
dialog.setText(GraphicsExample.getResourceString("Gradient")); //$NON-NLS-1$
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
gridLayout.marginHeight = 10;
gridLayout... |
c5ced1dd-2ac6-4ac1-b787-5c524e037a30 | 1 | private void playSploosh() {
try {
AudioInputStream audioIn = AudioSystem.getAudioInputStream(Game.class.getResource("sploosh.wav"));
Clip clip = AudioSystem.getClip();
clip.open(audioIn);
clip.start();
}
catch (Exception e){
System.out... |
47e49d67-e9ae-490e-acfe-f1a889aa8f8c | 9 | public void setBuffer()
{
int tagHeaderSize = ID3V2_3_TAG_HEADER_STANDARD_SIZE + (extendedHeaderPresent ? ID3V2_3_TAG_HEADER_EXTENDED_HEADER_DEFAULT_SIZE : 0) +
(CRCDataPresent ? ID3v2_3_TAG_HEADER_EXTENDED_HEADER_CRC_DATA_SIZE : 0);
h... |
f3955d81-9217-4e53-8b5f-cabd26519677 | 7 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if((affected!=null)
&&(affected instanceof MOB)
&&(msg.amISource((MOB)affected)||msg.amISource(((MOB)affected).amFollowing())||(msg.source()==invoker()))
&&(msg.sourceMinor()==CMMsg.TYP_QUIT))
{
... |
ed222e8e-4d7c-4c67-9589-3b26eba9259b | 3 | private Node moveRedLeft(Node h) {
assert (h != null);
assert isRed(h) && !isRed(h.left) && !isRed(h.left.left);
flipColors(h);
if (isRed(h.right.left)) {
h.right = rotateRight(h.right);
h = rotateLeft(h);
// flipColors(h);
}
return h... |
e408a35c-8ff6-497c-8d45-291d30c2bfc8 | 2 | @Override
public boolean reachesDestination(Packet p) {
// TODO Auto-generated method stub
Iterator<Edge> edgeIt = p.origin.outgoingConnections.iterator();
EdgeBetRate e;
while(edgeIt.hasNext()){
e = (EdgeBetRate) edgeIt.next();
if(e.endNode.equals(p.destination)){
etxLink = e.getEtx();
}
}
... |
ab06923a-6cd0-495b-9ec9-8af1775598a7 | 4 | private static void drawText(Graphics g, Coord position, String content, Coord offset, Dimension maxSpace) {
g.setColor(Color.black);
int textHeight = g.getFontMetrics().getHeight();
int offsetX = offset.getX();
int offsetY = offset.getY() + textHeight/2;
String[] lines = content... |
d406d808-61e4-4bc7-80b2-6c34016e78f6 | 4 | public boolean equals(Object o) {
if (!(o instanceof Information))
return false;
Information<T> information = (Information<T>) o;
if (this.nbElements() != information.nbElements())
return false;
for (int i = 0; i < this.nbElements(); i++) {
if (!this.iemeElement(i).equals(information.iemeElement(i)))
... |
854cc541-682f-487b-a36f-02cfc0a1d9cb | 0 | public void setStatus(String status) {
mStatus = status;
} |
5574711c-d065-4505-b719-6de5addf9bb6 | 5 | public DummyDebuff(int id){
this.id = id;
if (id == 0){ //stun
bg = new GreenfootImage ("Debuff/stunned.png");
}
else if (id == 1){
bg = new GreenfootImage ("Debuff/lightning.png");
}
else if (id == 2){
bg = new Gr... |
935f5652-f1cd-443b-883c-5142683b5d5c | 9 | public int parseCryptInfo(RdpPacket_Localised data)
throws RdesktopException {
logger.debug("Secure.parseCryptInfo");
int encryption_level = 0, random_length = 0, RSA_info_length = 0;
int tag = 0, length = 0;
int next_tag = 0, end = 0;
int rc4_key_size = 0;
rc4_key_size = data.getLittleEndian32(); // 1 ... |
c5b2b159-e167-4f5e-80c1-37ea21a595df | 4 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ZoneID other = (ZoneID) obj;
if (id != other.id)
return false;
return true;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.