method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e4da258f-11ab-49e1-bb73-9d47e8b0e752 | 5 | private boolean fieldAvailable(int x, int y) {
boolean answer = false;
if(x >= 0 && x < b.length && y>= 0 && y < b.length)
{
if(b[x][y] >= 0)
answer = true;
}
return answer;
} |
73fa750f-2f5f-41d7-8e49-8550ee294712 | 9 | public static boolean argumentBoundP(Stella_Object argument) {
{ Surrogate testValue000 = Stella_Object.safePrimaryType(argument);
if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_PATTERN_VARIABLE)) {
{ PatternVariable argument000 = ((PatternVariable)(argument));
return (PatternVaria... |
92f4ba79-be17-4f41-b5c6-a201abc95860 | 6 | public static Class<?> parseClass(final String classText) throws NullPointerException, IllegalArgumentException {
try {
if (classText.endsWith("[]")) return Array.newInstance(Natives.parseClass(classText.substring(0, classText.length() - 2)), 0).getClass();
Class<?> result = Natives._parseClass_.get(classText);... |
eab6d81f-55fc-4722-856f-7bdd85dc0c1f | 8 | public void actionPerformed(ActionEvent event) {
File[] filesToChange = new File[m_model.getSize()];
for(int i = 0; i < filesToChange.length; i++) {
filesToChange[i] = m_model.getElementAt(i);
}
if (filesToChange.length == 0) {
fireError("There are no files to change.");
}
for(File file : filesT... |
c5427dab-2485-4406-9b75-70748bf5c82f | 3 | public void doGet(HttpServletRequest req,
HttpServletResponse res)
throws IOException, ServletException {
//first goal is to be able to receive and process
//a well formatted XML moveTwo piggybacked on a POST
//this gives me a raw stream to payload of Post requ... |
f08d7d0b-7580-4cec-8480-6de7537d1d48 | 0 | public int getIconHeight() {
return height;
} |
5f20c08f-d92e-4762-be39-76384fb76630 | 6 | public void start() {
//uncomment to preprocess
//preprocessMap(); //do the preprocessing for map 4
// start game steps
long lastStep = System.currentTimeMillis();
while (stepCount < totalSteps) {
// increase the step count
stepCount++;
// gamelogic steps
this.executeGameLogic();
while (
... |
410f2432-1cdf-40f0-99cb-2f9e7b4a5049 | 0 | public String getOpenEncoding() {
return (String) openEncodingComboBox.getSelectedItem();
} |
25b6e45f-24e6-40a7-a0e0-6184f1248c28 | 4 | public int getVisibleCards(int splitCard, boolean splitHigher){
int count = 0;
for (int i=0; i < cards.length; i++){
if (exposed[i] && (splitHigher ? cards[i] > splitCard : cards[i] < splitCard))
count++;
}
return count;
} |
e0c53174-7509-4ccb-b271-4baa1fbee23b | 1 | public void Update()
{
if(m_oldPos != null)
{
m_oldPos.Set(m_pos);
m_oldRot.Set(m_rot);
m_oldScale.Set(m_scale);
}
else
{
m_oldPos = new Vector3f(0,0,0).Set(m_pos).Add(1.0f);
m_oldRot = new Quaternion(0,0,0,0).Set(m_rot).Mul(0.5f);
m_oldScale = new Vector3f(0,0,0).Set(m_scale).Add(1.0f);
... |
68c8ef95-b906-481a-ad1c-346b6c9d8a92 | 7 | public void printStatistics() {
assert(!chance_node);
int count = 0;
double total = 0, min = Double.POSITIVE_INFINITY, max = Double.NEGATIVE_INFINITY;
for (Node n: children.values()) {
// expectedValue will be NaN
if (n.visit_count == 0)
continue;
double u = n.expectedValue();
... |
e6c50cf8-8bdb-4f0e-a014-92628bfefc9b | 1 | public boolean isOfType(Type type) {
return (type.typecode == TC_INTEGER && (((IntegerType) type).possTypes & possTypes) != 0);
} |
d4e1cd4c-cc6e-425c-9b51-2b98eebf5a5d | 4 | public void onKeyReleased(int key)
{
if(key == Input.KEY_A)
this.addFacing(new Vector2f(1.0F, 0));
else if(key == Input.KEY_D)
this.addFacing(new Vector2f(-1.0F, 0));
else if(key == Input.KEY_W)
this.addFacing(new Vector2f(0, 1.0F));
else if(key == Input.KEY_S)
this.addFacing(new Vector2f(0, -1.0F)... |
3509447e-e855-4fa8-a7a1-f58e1e79c0c3 | 0 | public final int getW() { return w; } |
1838b32f-cf7f-45ae-b55a-fbc57fb8062b | 3 | public void load(String filename) throws IOException {
props = new Properties();
URL url = ClassLoader.getSystemResource(filename);
if (url == null) {
throw new IOException("Could not find properties file: " + filename);
}
props.load(url.openStream());
// Create AIS sources
String sourcesStr = props... |
29026729-a8fa-415b-803f-771eb2875f80 | 1 | private void addAbilties(ArrayList<AbilityType> add) {
for (int c = 0; c < add.size(); c++) {
abilityTypes.add(add.get(c));
hotkeys[c] = add.get(c);
}
} |
31fdd1f8-3b5e-4e85-80c1-f599fa3d1058 | 9 | @Override
public void endElement(String uri, String localName, String qName) throws SAXException {
if (qName.equalsIgnoreCase(XMLTag.BANK)) {
tempList.add(deposit);
} else if (qName.equalsIgnoreCase(XMLTag.NAME)) {
deposit.setName(temp);
} else if (qName.equalsIgnoreC... |
bc96d193-9543-4877-b946-50b221d674f2 | 4 | @Override
public void run() {
logger.info("Publisher thread started.");
while (true) {
// Assume that outside PublisherThread messageSource's size can only
// be increased. No remove actions outside PublisherThread.
if (messageSource.size() > 0) {
// The first element is valid since messageSource only... |
16afa47b-5b70-4137-aff2-a8743f234fba | 6 | public ResultSet preencherTabelaAtividadeAtrasadas(String codDepartamento) throws SQLException {
Connection conexao = null;
PreparedStatement comando = null;
ResultSet resultado = null;
try {
conexao = BancoDadosUtil.getConnection();
comando = conexao.prepareS... |
acd9afc7-7b10-491b-abbf-d2fbf4ededda | 1 | public float getV() {
if(animation != null) {
return animation.getV();
}
return tex.getV();
} |
b12cf8f5-b7da-4ee7-8001-b89d6b243473 | 9 | public static void main(String args[]) throws Throwable {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();int caso=1;
for (StringTokenizer st;(st=new StringTokenizer(in.readLine()))!=null;caso++) {
int C=parseInt(st.nextToken()),S=parseInt(st.nex... |
994a39ff-25a3-4c31-a28a-e6fdad3de72c | 4 | public static void main(String[] args) {
final ItWillFail itWillFail = new ItWillFail();
ExecutorService executorService =
Executors.newCachedThreadPool(new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
Thread thread = new Thread(r);
thread.setUncaughtExceptionHandler(new Unc... |
f1b8540c-386d-477b-8fa2-6c3d16e7fc0a | 5 | @Override
void setUp(int width){
int edge = (int)(0.33 * width);
//Lower left
for(int i = 0; i < edge; i++){
getSquare(edge, i).setObstacle(true);
}
for(int i = edge; i > 0; i--){
getSquare(i, edge).setObstacle(true);
}
for(int i = edge; i < edge + edge - 1; i++){
getSquare(1, i).setObstacle(tru... |
5e4eeba5-426b-4d99-8b0c-076e6bb45320 | 8 | @Override
public void mouseEntered(MouseEvent event) {
if (drawType == 0 && !started) {
if (event.getSource() instanceof GridSquare && event.getModifiers() == MouseEvent.BUTTON1_MASK) {
GridSquare panel = (GridSquare) event.getSource();
(this.obstacles[panel.y])[panel.x] = true;
}
if (event.getSourc... |
99ac20a6-2812-4653-b15a-86de3566cd8a | 6 | private static boolean checkArgs(String[] args) {
int howManyArgs = args.length;
// If we have odd size for args that means that is not correctly
// initialized.
if(howManyArgs > 0 && (howManyArgs & 0x01) > 0){
printCorrectUsage();
return false;
}
try {
for(int i = 0; i < howManyArgs; i+=2){... |
920376ce-221e-41e2-a17b-7cb5932a8cdc | 5 | public void reloadAll() {
for (Integer key : keys1) {
firePropertyChange(ELEMENT_ADDED_IN_SET1, null, key);
}
for (Integer key : keys2) {
firePropertyChange(ELEMENT_ADDED_IN_SET2, null, key);
}
for (Integer leftKey : keys1) {
Element element = elements.get(leftKey);
for (Integer rightKey : elem... |
506f18c0-5901-42f8-9d4b-5bfacdc97042 | 0 | @Override
public String getDef() {return "" + def;} |
8ade6644-13f4-4b7e-8e08-8f307c9edaa8 | 9 | private void loadDataXM(RandomAccessFile fp) throws IOException
{
byte[] b = new byte[20];
// WHY THE HELL AM I DOING THIS
name = Util.readStringNoNul(fp, b, 20);
System.out.printf("name: \"%s\"\n", name);
fp.read(); // skip 0x1A byte
// THIS CAN'T BE HAPPENING
fp.read(b, 0, 20); // skip tracker na... |
01580625-9ca3-4e3d-8a5e-f583c4cb12f0 | 9 | private static String encrypt(String strToEncrypt, int ikey){
byte[] key = null;
if(ikey == 0){
key = thekey;
if(thekey == null){
return "ERROR: NO KEY";
}
}else if(ikey == 1){
key = the2ndkey;
if(the2ndkey == null){
return "ERROR: NO KEY2";
}
}else if(ikey == 2){
key = the3rdkey;
... |
11d916fa-e657-4fdb-afec-183c2e396645 | 3 | private void reply_if_isSYN(Packet packet)
{
TransportLayer tl = packet.getTransport();
if (tl instanceof TCP)
{
TCP transport = (TCP) tl;
if (transport.isSYN() && !transport.isACK())
{
this.buffer.remove(packet);
Packet synack_packet = new Packet("TCP");
synack_packet.setIP_source(t... |
57abe214-7419-4b0f-ac75-462542a9a4b4 | 7 | public static Rule_SEMICOLON parse(ParserContext context)
{
context.push("SEMICOLON");
boolean parsed = true;
int s0 = context.index;
ArrayList<Rule> e0 = new ArrayList<Rule>();
Rule rule;
parsed = false;
if (!parsed)
{
{
ArrayList<Rule> e1 = new ArrayList<Rule>();
... |
9a8b57b1-c809-4174-bc36-c7d89bb2df19 | 1 | public void dispose() {
this.spriteBatch.dispose();
for (Texture t : slides) {
t.dispose();
}
this.buttonTexture.dispose();
} |
d0b4e502-8904-4467-8a82-287f2d28ae0c | 6 | public static String numberToString(Number number)
throws JSONException {
if (number == null) {
throw new JSONException("Null pointer");
}
testValidity(number);
// Shave off trailing zeros and decimal point, if possible.
String string = number.toString();
... |
206fb604-75b5-4d10-82d2-0da8f3becbcf | 5 | public static boolean deleteRecursive(File path) throws FileNotFoundException{
if (path.exists())
{
boolean ret = true;
if (path.isDirectory()){
for (File f : path.listFiles()){
ret = ret && deleteRecursive(f);
}
}
... |
56512de3-3130-40a9-88a4-c3ad4d72aba7 | 6 | public int getAnswerIndex() {
if(answer == null || options == null || isSurvey || style != CHOICE_QUESTION){
return -1;
}
for(int i=0; i<options.length; i++){
if(answer.equals(options[i])){
return i;
}
}
return -1;
} |
dbe03f42-a0ff-4e13-9e09-1d8995248cd1 | 3 | protected Object find(int x, boolean isInserting){
if (isInserting) //for insertion uses of this method
this.numOfElements++;
for (int i=0; i < this.elements.size(); i++){ //scans the junction for the leaf's location
if (this.elements.elementAt(i).getElement() >= x)
return this.pointers.elementAt(i);
}
... |
30cdf575-46de-455f-a68e-a39ef33d24eb | 3 | public Connection getConnection()
{
try
{
if(connection==null||connection.isClosed())
connection =
DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/magazyn");
}catch(SQLException ex)
{
ex.printStackTrace();
}
return connection;
} |
3fb68a75-c421-41f1-9d84-9c1637ed7b76 | 9 | public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
ListNode l3 = null, next = null, current = null;
while(l1 != null || l2 != null) {
next = new ListNode(getVal(l1) + getVal(l2));
if(current != null)
current.next = next;
current = next;
... |
2cf21651-1e31-4f94-b7ac-00d332b1f153 | 4 | @SuppressWarnings("unchecked")
public void updateRenter(HashMap<String, Object> renter) {
if(renter.containsKey("PICTURE")) this.picture = (String)renter.get("PICTURE");
if(renter.containsKey("NAME")) this.name = (String)renter.get("NAME");
if(renter.containsKey("CONTACT")) this.contact = (String)renter.get("CON... |
3a53339a-e5fe-4c9d-a96a-ec49e036a6fd | 4 | @Override
public Map<UUID, String> call() throws Exception {
Map<UUID, String> uuidStringMap = new HashMap<UUID, String>();
for (UUID uuid : uuids) {
HttpURLConnection connection = (HttpURLConnection) new URL(PROFILE_URL + uuid.toString().replace("-", "")).openConnection();
J... |
2523705c-aa3c-453e-95b6-82cb2cfa8e98 | 0 | private void startRealServer() throws Exception {
// TODO: TpServer应该由Ioc创建,
// 现在为了定义API就直接创建新实例了。
_itpServer = new TpServer(TP_SERVER_PORT);
// 票池服务器应该启动disruptor event bus。
_itpServer.start();
} |
ee8c672d-55b7-409f-810f-225c5db71524 | 5 | public static void main(String [] args) throws IOException{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
int n = Integer.parseInt(in.readLine());
StringBuilder s = new StringBuilder("Slytherin:\n");
Strin... |
6fbde7fc-12a9-45bf-8de7-2a4071da0bf2 | 9 | static boolean fits(int[][] boxes, int bigLoc, int smallLoc)
{
boolean fits = false;
for (int a = 0; a < 3; a++)
for (int b = 0; b < 3; b++)
if (a != b)
for (int c = 0; c < 3; c++)
if (a != c && b != c)
if (boxes[bigLoc][0] > boxes[smallLoc][a] && boxes[bigLoc][1] > boxes[smallLoc][b] &&... |
9c5f6ac2-fe82-4523-812c-c6647024cb36 | 1 | public boolean updateByKey(String tableName, List<String> args) throws DataBaseTableException {
Table table = tableHashMap.get(tableName);
if (table == null) {
throw new DataBaseTableException("no such table");
}
return table.update(args);
} |
cc883a56-78b2-40ad-a172-d69e7ee45414 | 9 | public void run()
{
DNSOutgoing out = null;
try
{
// send probes for JmDNS itself
if (this.jmDNSImpl.getState() == taskState)
{
if (out == null)
{
out = new DNSOutgoing(DNSConstants.FLAGS_QR_RESPONSE | DN... |
60c24c57-a866-42f6-946e-585c90e1e467 | 0 | public PropertyContainerXMLParser() {
super();
init();
} |
83b080a0-368e-453d-ab2c-d41147e371c4 | 2 | private void accept(SelectionKey key,Boolean isClusters) throws IOException {
// For an accept to be pending the channel must be a server socket channel.
ServerSocketChannel serverSocketChannel = (ServerSocketChannel) key.channel();
// Accept the connection and make it non-blocking
SocketChannel socketChannel ... |
7114bcfc-55aa-4263-a41b-a90c74963e09 | 9 | @Override
public void run() {
System.out.println("Server MessageDispatchThread is running!");
while(true){
try {
Thread.sleep(1);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(ServerThread.outgoing.size() > 100) {
System.err.println("WAR... |
17326ed1-4bc9-4ba9-9cd9-a430afb9f58e | 3 | public RecentLaunchesPanel(ParameterSelectionPanel parameterSelectionPanel) {
this.parameterSelectionPanel = parameterSelectionPanel;
recentFlights = new ArrayList<FlightSummary>();
RecentLaunchScrollPane = new JScrollPane();
RecentLaunchJList = new javax.swing.JList();
listTitle... |
f30f3bf0-fae1-47f8-90c4-0e78f91b1976 | 9 | public static void main(String[] args) {
while(true){
System.out.println("Enter the file path of a file you want to encrypt or decrypt: ");
filePath = input.nextLine();
System.out.println("Now, enter the key for encrypting or decrypting the file.");
key = input.nextLine();
System.out.println("Processin... |
47d4f1cb-2992-4640-ab90-80e8db7a1f99 | 4 | protected long execute_timers ()
{
// Fast track.
if (timers.isEmpty ())
return 0L;
// Get the current time.
long current = Clock.now_ms ();
ArrayList <Long> removes = new ArrayList <Long> ();
// Execute the timers that are already due.
long ... |
9c8f0c0d-b579-4aeb-ab61-7ff9237a1d58 | 1 | public void add(ListItem items) {
if (this.head == null) {
this.head = items;
this.tail = items;
} else {
this.tail.setNext(items);
this.tail = items;
}
this.length = this.length + 1;
} |
8236d7d1-285a-42cf-9d4f-39aeec473408 | 5 | private static boolean addFolderContentToZip(File folder, ZipArchiveOutputStream zipOutput, String folderFromRoot){
FileInputStream fileInput;
try{
for(File currFile : folder.listFiles()){
ZipArchiveEntry entry = null;
if(currFile.isDirectory()){
//as defined by ZipArchiveEntry:
//Assumes the e... |
2ec266b1-b7d3-4c97-8e67-14ae2dcac9aa | 6 | public long getLong(int bits) throws IOException {
if(bits>64) {
throw new IllegalArgumentException("Argument \"bits\" must be <= 64");
}
long res=0;
if(endian==LITTLE_ENDIAN) {
for(int i=0; i<bits; i++) {
if(getBit()) {
res|=(1L<<i);
}
... |
67bbd81a-6d8b-4865-a968-6254f8c66bd9 | 9 | public static Poly3Transform corrPointsToPoly3Transform( double[] fromPoints,
int fromPointsOff,
double[] toPoints,
int toPointsOff,
... |
c695a8e1-58ba-4f29-9887-9445242e680f | 0 | public File getInputFile() {
return inputFile;
} |
20a65b2a-ac94-4a35-a1b4-0b79a44202d6 | 8 | public void visitConstantExpr(final ConstantExpr expr) {
if (expr.value() instanceof String) {
final StringBuffer sb = new StringBuffer();
final String s = (String) expr.value();
for (int i = 0; i < s.length(); i++) {
final char c = s.charAt(i);
if (Character.isWhitespace(c) || ((0x20 <= c) && (c <... |
d7fcb769-e97f-417d-8a35-b7017c19b659 | 6 | public LinkedList<Ant> getConflictAnts() {
LinkedList<Ant> result = new LinkedList<Ant>();
for (Field field : this.getAttackBorder()) {
Ant ant = field.getAnt();
if (ant != null && (ant.getOwner() == 0 ^ this.getOwner() == 0)) {
result.add(ant);
}
}
for (Field field : this.getAttackBorder2()) {
... |
f217ca27-35ab-4878-8854-ba2871e6cd82 | 8 | public void putAll( Map<? extends Long, ? extends Short> map ) {
Iterator<? extends Entry<? extends Long,? extends Short>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Long,? extends Short> e = it.next();
this.put( e.getKey(),... |
d0949263-befc-4253-8318-0a9403e2523a | 2 | public static void main(String[] args){
BigInteger top = new BigInteger("3");
BigInteger bot = new BigInteger("2");
int count = 0;
for(int i=1;i<1000;i++){
top = top.add(bot);
BigInteger temp = top;
top = bot;
bot = temp;
top = top.add(bot);
if(top.toString().length() > bot.toString()... |
2411f9c3-7820-4328-8ae4-f50badc5f404 | 5 | public boolean purge() {
Connection conn = null;
PreparedStatement ps = null;
try
{
conn = iConomy.getiCoDatabase().getConnection();
ps = conn.prepareStatement("DELETE FROM " + Constants.SQLTable + " WHERE balance = ?");
ps.setDouble(1, Constants.Holdings);
ps.executeUpdate();
... |
86e04225-6669-46f1-9523-922afd5c1900 | 5 | private void updateOffsets(int moveQuad)
/*
* xOffset and yOffset are pixel offsets for drawing the top-left corner of
* the floor image (and all of its contents) relative to the top-left corner
* (0,0) of the JPanel.
*
* The offsets change in the _opposite_ direction to the player's apparent
* movement. ... |
4b775734-06a9-43ed-a65c-cb5ebf09d492 | 6 | @Override
public boolean buyTicket(Ticket ticket, User user) {
//проверяем, что каждый SingleTicket можно купить
for (SingleTicket sTicket : ticket.getRoute()) {
if (!isSTicketAvailabale(sTicket))
return false;
}
//добавляем общий билет
Map<Strin... |
a2281384-8c03-4d63-bf31-c43164862292 | 2 | public String generate(){
Map<String,String> jsonMap = new HashMap<String,String>();
try{
for (Entry<String,String> e: schemaMap.entrySet()){
String fullCall = e.getValue();
String methodName = fullCall.substring(0, fullCall.indexOf("("));
String paramString = fullCall.substring(fullCall.ind... |
5eef8305-f1a9-49c4-95c3-c758b7a02356 | 4 | private BombermanGame() {
initializeDisplay();
generateLevel();
// create the players
Player player1 = new Player("Player 1", 0, SCREEN_Y - BOX_SIZE, "player1");
Player player2 = new Player("Player 2", SCREEN_X - BOX_SIZE, SCREEN_Y - BOX_SIZE, "player2");
players.add(p... |
f69ddad3-a3e1-438b-a6d7-f898c50a4224 | 3 | public void listenSocket()
{
try
{
socket = new Socket( "localhost", 80 );
out = new PrintWriter( socket.getOutputStream(), true );
in = new BufferedReader( new InputStreamReader( socket.getInputStream() ) );
String line = in.readLine();
System.out.println( "Text received :" + line );
if( line.co... |
e542d196-6b30-404e-b79c-378078311ec8 | 1 | private void decreaseScore() {
state.setScore(Integer.parseInt(state.getScore()) - 100);
if (Integer.parseInt(state.getScore()) <= 0) {
//если очки кончились - завершаем игру
state.setEndOfTheGame(true);
}
} |
29119402-c643-4fe8-804d-fbc2c08570c9 | 4 | public void selectGroup(Drawing model, Rectangle rubberBandRectangle,
boolean toggle) {
Iterator<Figure> i = model.iterator();
while ( i.hasNext() ) {
Figure figure = i.next();
Rectangle r2 = figure.displayBox();
if (rubberBandRectangle.contains(r2.x, r2.y) &&
... |
8f691995-2dbe-45da-92d4-e58928a208f4 | 0 | @Override
public void keyReleased(KeyEvent arg0) {
// TODO Auto-generated method stub
} |
5af92cf2-afa5-4c63-b886-610882c9e277 | 9 | public void body()
{
// wait for a little while for about 3 seconds.
// This to give a time for GridResource entities to register their
// services to GIS (GridInformationService) entity.
super.gridSimHold(3.0);
LinkedList resList = super.getGridResourceList();
// in... |
92a78db7-58de-4df7-8393-283c360c66f1 | 2 | public Collision find(Entity firstEntity, Entity secondEntity) {
for (Collision collision : collisions) {
if(collision.is(firstEntity, secondEntity)){
return collision;
}
}
return defaultCollision;
} |
9d57c798-8134-49b8-ab22-6e9ca58e8103 | 3 | @Override
public String getColumnName(int columnIndex) {
switch (columnIndex) {
case 3:
return "Target";
case 4:
return "New value";
case 5:
return "Old value";
}
return null;
} |
0aec16b4-720d-497b-9794-68f8e992a21e | 8 | @Override
public Class<?> getColumnClass(int columnIndex)
{
switch (columnIndex)
{
case 0:
return Integer.class;
case 1:
return Order.class;
case 2:
return Date.class;
case 3:
return D... |
e38bdd77-afe2-4948-87b5-f31972ee5a86 | 4 | public Character checkWhoIsNear() {
for (Character character : characters.values()) {
if (character.getLocation() == player.getLocation()) {
return character;
}
for (Room neighbour : player.getLocation().getNeighbours()) {
if (character.getLoca... |
88867348-9ff6-4eb7-bac3-41e3345b647e | 1 | public ShellLink setName(String s) {
if (s == null)
header.getLinkFlags().clearHasName();
else
header.getLinkFlags().setHasName();
name = s;
return this;
} |
9fceec59-a2fb-48d6-a376-043040f58a0b | 4 | public void initializeModel(Documents docSet) {
// TODO Auto-generated method stub
// 文档个数
M = docSet.docs.size();
System.out.println("文档个数" + M);
// term个数
V = docSet.termToIndexMap.size();
System.out.println("term 个数" + V);
// 文档-主题矩阵,其中行(hang)为文档,列为主题
nmk = new int[M][K];
// doc-topic参数矩阵
theta... |
8bb1ce34-21e6-415b-b140-f7032c0bc7bf | 4 | private void normalizeContrast() {
int[] histogram = new int[256];
for (int i = 0; i < data.length; i++) {
histogram[data[i]]++;
}
int[] remap = new int[256];
int sum = 0;
int j = 0;
for (int i = 0; i < histogram.length; i++) {
sum += histogram[i];
int target = sum * 255 / picsize;
for (int k ... |
01a49082-ce7d-4510-b41d-dd29dbdc93e5 | 3 | private static void doVariantsTest()
{
try
{
System.out.print("Testing variants command ");
String folderName = TEST_DATA+File.separator+BLESSED_DAMOZEL;
File folder = new File( folderName );
String mvdName = createTestMVD( folder );
File mvdFile = new File( mvdName );
MVD mvd = MVDFile.internali... |
56dc0d56-ec65-4562-8c8e-0be831295b9d | 8 | public String getInnerClassString(ClassInfo info, int scopeType) {
InnerClassInfo[] outers = info.getOuterClasses();
if (outers == null)
return null;
for (int i = 0; i < outers.length; i++) {
if (outers[i].name == null || outers[i].outer == null)
return null;
Scope scope = getScope(ClassInfo.forName(... |
be8b7451-319c-40a3-9e4d-60f91387a17c | 1 | private void appendProfile(StringBuilder profile) {
for (int i = 0; i < DBLabels.labels.length; i++) {
int textSize = DBLabels.labels[i].length();
}
} |
c5075c9f-70b9-4f84-9a2b-df7176bc28e7 | 8 | private ObjectLayer extractObjectLayer(Node layernode,
String layername, float opacity, boolean visible,
Properties layerProperties, int layerwidth, int layerheight,
RGBColor color)
throws XPathExpressionException, JTMXParseException {
NodeList objectnodes = (NodeList) xpath.evaluate(
"./object", ... |
23c36341-d802-4896-92f6-9de39badac0b | 7 | @Override
public boolean equals (Object o){
if (this == o){
return true;
}
if (o == null || getClass() != o.getClass()){
return false;
}
UserItemsID that = (UserItemsID) o;
if (userDetail != null ? !userDetail.equals(that.user... |
aa75d409-9e0b-484d-ad69-774eabdbf49a | 2 | private void recursiveAddingClousereElementsFromState(List<String> elements, String state, String epsilonSymbol) throws Exception{
List<Transition> results = content.getTransitionsByStateAndSymbol(state, epsilonSymbol);
for(Transition result : results){
if(!elements.contains(result.getResult... |
bf406832-9437-492e-9c8d-0645ba5b2c46 | 0 | private void setAquarium(Scanner scanner) {
lengthDesert = Input.getPositiveNumber(scanner, "Enter length of desert:");
heightDesert = Input.getPositiveNumber(scanner, "Enter height of desert:");
} |
3d9b6bad-602f-49ac-8ada-21056d205e82 | 7 | public void renderPiston(TileEntityPiston par1TileEntityPiston, double par2, double par4, double par6, float par8)
{
Block var9 = Block.blocksList[par1TileEntityPiston.getStoredBlockID()];
if (var9 != null && par1TileEntityPiston.getProgress(par8) < 1.0F)
{
Tessellator var10 = T... |
c905e3df-0e28-4b0d-8ee7-72920a16cfca | 3 | public JSONObject putOnce(String key, Object value) throws JSONException {
if (key != null && value != null) {
if (this.opt(key) != null) {
throw new JSONException("Duplicate key \"" + key + "\"");
}
this.put(key, value);
}
return this;
} |
bf8cef49-0b7c-491d-9c20-dc0397b31da1 | 4 | boolean kollisionsabfrage(float x, float y, float height, float width) {
//Auf X-Achse innerhalb der MovableEntity
if (!(this.x > x+width ||
x>this.x+this.width)
) {
//Auf Y-Achse innerhalb der MovableEntity
if (!(y+height<this.y ||
y>this.y+this.height)) {
return true;
}
}
return false... |
b4c99cfb-77bb-47f9-a174-caf35e8a82fb | 4 | public static void sendPrivateMessageToPlayer( BSPlayer from, String receiver, String message ) {
BSPlayer rec = getSimilarPlayer( receiver );
if ( from.isMuted() && ChatConfig.mutePrivateMessages ) {
from.sendMessage( Messages.MUTED );
return;
}
if ( rec == null ... |
c1b0ac38-6b38-45b8-a5d6-fee67531ba64 | 4 | public boolean simulateInput(String input) {
/** clear the configurations to begin new simulation. */
myConfigurations.clear();
Configuration[] initialConfigs = getInitialConfigurations(input);
for (int k = 0; k < initialConfigs.length; k++) {
FSAConfiguration initialConfiguration = (FSAConfiguration) initia... |
b085e1e1-7593-42ab-b1e6-0e91428734f3 | 8 | @Override
public SetMultimap<Position, Position> getAllAvailableCaptures(
Player activePlayer, Board board) {
SetMultimap<Position, Position> allCaptures = HashMultimap.create();
for (int i = 1; i < board.getSize(); i++) {
for (int j = 1; j < board.getSize(); j++) {
... |
85261ae0-1f57-4081-a64e-7b4334b48077 | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Message other = (Message) obj;
if (data == null) {
if (other.data != null)
return false;
} else if (!data.equals(other.data))
return ... |
45046698-d00d-4793-aa8b-61f6b030f037 | 7 | public void run() {
// Declarations
char[] CharacterValue = new char[1];
// char array is required to turn char into a string
String LineOfText = "";
// string is required to look for the language code
int IntegerCharacter; // the integer value read from the pipe
try {
Done = false;
while (!Don... |
a50118c2-d38b-4218-9f25-d92d4903d91f | 9 | private void evaluateSingleKeyword(String s) {
// back
if ("back".equalsIgnoreCase(s)) {
if (EventQueue.isDispatchThread()) {
page.getNavigator().getAction(Navigator.BACK).actionPerformed(null);
}
else {
EventQueue.invokeLater(new Runnable() {
public void run() {
page.getNavigator().get... |
8894d700-75e9-4c7b-9728-babb7d237cfa | 2 | private void removeLosses() {
if (lossPerTick > 0.0)
if (charge >= lossPerTick)
charge -= lossPerTick;
else
charge = 0.0;
} |
9a90db5b-cd7b-4b4b-9052-ba7382714a00 | 8 | @Override
public void setRacialStat(final int abilityCode, final int racialMax)
{
if((!CharStats.CODES.isBASE(abilityCode))||(getStat(abilityCode)==VALUE_ALLSTATS_DEFAULT))
setPermanentStat(abilityCode,racialMax);
else
{
final int baseMax=CMProps.getIntVar(CMProps.Int.BASEMAXSTAT);
int currMax=getStat(... |
b0b233df-a8b6-4f66-ba69-54bf6616aa68 | 4 | private String getValueAnnotationClient(String parse)
{
String anno = "";
int startIndex1 = parse.indexOf("@remoteClient");
int lastIndex1 = parse.trim().indexOf("function");
anno = parse.substring(startIndex1, lastIndex1);
if(anno.contains("public"))
{
a... |
22f1cb08-bb58-4f53-a48a-16e90b5f1c71 | 9 | public static String getType(int id, int type) {
switch(type) {
case 0:
return "parent";
case 1:
return "";
case 2:
return "item group";
case 3:
return "pixels: " + RSInterface.getInterface(id).width + "x" + RSInterface.getInterface(id).height;
case 4:
return "text: " + RSInterface.... |
f988b1c8-b229-49f6-9dce-8880b96bc091 | 7 | public void printSubGraph(HashMap<String, Node> subGraph){
Stack<ArrayList<String>> qf = new Stack<ArrayList<String>>();
System.out.println(subGraph.size());
for (String name: subGraph.keySet()){
char student;
if (subGraph.get(name).data.school != null){
... |
d98fc0ea-c676-4b3d-b4ad-393a42e0bdcd | 2 | public String getTextAround() {
int begin = position - 10;
if (begin < 0)
begin = 0;
int end = position + 10;
if (end > maxlen)
end = maxlen;
return input.substring(begin, end);
} |
f21c4413-910c-4e8e-a21e-a8d9fb9e7ccf | 0 | public final void setVerbose(boolean verbose) {
_verbose = verbose;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.