method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e3049ec3-df5b-4836-98c2-cb7a798c55d1 | 3 | private void updated()
{
boolean ok = parseString(t.getText());
if (ok)
{
if (hasSavedBorder)
t.setBorder(savedBorder);
}
else
{
if (!hasSavedBorder)
{
savedBorder = t.getBorder();
ha... |
ce4e2759-e438-4ebb-b981-3bfab2a2f054 | 4 | public int compareTo(Object obj)
{
//makes sure the object is an instance of class Employee
if(obj instanceof Employee)
{
//cast the object to type Employee
Employee emp = (Employee)obj;
int answer = 5;
if(acctID > emp.g... |
61529b93-c9fe-4d37-8b87-d24ec996e570 | 5 | public static String capitalizeFully(String string){
boolean lastWasSpace = false;
char[] stringArray = string.toCharArray();
if(stringArray.length == 0){
return "-1";
}
for (int x = 0;x <= stringArray.length - 1; x++){
if(stringArray[x] == ' '){
lastWasSpace = true;
}
else if(lastWasSpace)... |
76157d33-6dc2-41bd-9ea5-a62a63f980f5 | 0 | public void setApplicationKey(String consumerSecret) {
this.applicationKey = consumerSecret;
} |
642632c3-bb4b-460b-a4ff-28e89aeeeb87 | 3 | @Override
public int calculateReadSize()
{
if (_isStaticSize)
{
return _readSize;
}
_readSize = 0;
ISerializer currentSerializer;
for (int i = 0; i < serializersCount; i++)
{
currentSerializer = serializers.get(i);
currentSerializer.setValue(output.get(i));
if(currentSerializer.isStaticSiz... |
4d1998ac-3963-4000-b88c-c563f9299d02 | 4 | public void listenerPerceptron(final PerceptronContainer perceptronGui){
perceptronGui.btnAgregarSetAprendizaje.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
DefaultTableModel temp = (DefaultTableModel) perceptronGui.tablaSetAprendizaje.getModel();
O... |
a6f6cb94-6f73-4cf8-9da1-6e4c59eefb34 | 7 | public void removeBlock( int x, int y, Block b ) {
int index = stackIndex(x,y);
Block[] stack = blockStacks[index];
if( stack == null ) return;
if( stack.length == 0 ) return;
for( int j=0; j<stack.length; ++j ) {
if( stack[j] == b ) {
Block[] newStack;
if( stack.length == 2 ) {
newSt... |
4c820a1d-e1b4-4397-86f1-c65d2fb1042c | 4 | public static double calculate_ndcg(String query, LinkedList<String> url_list)
{
HashMap<String,LinkedList<String>> google_resultmap=create_google_map();
Iterator<String> It = url_list.iterator();
LinkedList<String> google_querymap = google_resultmap.get(query);
if(google_querymap==null)return 1.0;
... |
cce547bd-e8f6-48df-8869-6ad6f18d7e4c | 7 | protected void _remove_(final int index, final int count) throws IllegalArgumentException {
final int from = this._from_;
final int index2 = index - from;
if (index2 < 0) throw new IllegalArgumentException("index < from");
final int size = this._size_;
if (index2 > size) throw new IllegalArgumentException("in... |
5bc8cfb1-83a3-4df1-8081-0afbdf3f4c32 | 8 | public void init(Client c) {
try {
client = new Socket(host, port);
System.out.println("Socket Initialized");
socketOut = new BufferedOutputStream(client.getOutputStream()); //When sending things from client to the server
socketWriter = new OutputStreamWriter(socketOut);
socketIn = new Buffered... |
ef07806c-126f-4fc9-abd0-0a9ded5226b5 | 8 | public String toString(){
String result = "";
if (isMastered()){
result = "✓ ";
} else {
result = " ";
}
result += "" + id + ". " + presentString;
if (kunyomiList.size()>0){
result = result + " | Kun: ";
for(int i=0;i<kunyomiList.size();i++){
if (i<kunyomiList.size()-1){
result = res... |
b460cc66-f72d-46f0-ac80-1108910f7288 | 5 | protected EncryptedBlobInfo findEncryptedBitprint( byte[] inputBitprint ) throws IOException {
byte[] key = hashKeyForMapKey(inputBitprint, 0);
if( !mapFile.exists() ) return null;
FileInputStream fis = new FileInputStream(mapFile);
final int hashSize = BitprintDigest.HASH_SIZE;
final int recordSize = hash... |
74a04bb3-80d5-4166-8afd-afca7795760d | 1 | public void drawPanel3() {
panel3 = new JPanel();
JPanel systemBusPanel = new JPanel();
systemBusPanel.setLayout(new BoxLayout(systemBusPanel, BoxLayout.Y_AXIS));//Add bus panels vertically
JPanel addressBusPanel = new JPanel();
addressBusPanel.setPreferredSize(new Dimension(175, 60));
addressBusPanel... |
2ba42aed-00a6-43f8-a370-9ce38dd30251 | 9 | public Expression optimize(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException {
final TypeHierarchy th = visitor.getConfiguration().getTypeHierarchy();
select = visitor.optimize(select, contextItemType);
action = action.optimize(visitor, select.getItemType(th));
k... |
524be9d3-b70b-4f10-a1c1-e71114c00220 | 6 | private void kingTopLeftPossibleMove(Piece piece, Position position)
{
int x1 = position.getPositionX();
int y1 = position.getPositionY();
if((x1 >= 1 && y1 >= 0) && (x1 < maxWidth && y1 <= 6))
{
if(board.getChessBoardSquare(x1-1, y1+1).getPiece().getPieceType() != board.getBlankPiece().getPieceType())
... |
1a2b88b8-e342-4696-a947-8bf6e533640e | 7 | public boolean isNatural(){
switch (value){
case 2:
return true;
case 0:
return true;
case -2:
return true;
case -4:
return true;
case -5:
return true;
case -7:... |
a7109d60-1494-47ec-bee3-8030d557262a | 0 | public void setDepartureStop(int value) {
this._departureStop = value;
} |
64507d59-d841-4712-aa29-e9b679bb0204 | 5 | public void printTopTerms(int n) {
List<String> seen = new ArrayList<String>();
for (int i=0; i<n; i++) {
double highest = 0;
String base = "";
for (Map.Entry<String, Double> e : termScore.entrySet()) {
if (!seen.contains(e.getKey()) && e.getValue(... |
e6d2ebc5-d174-4990-a530-46886139a328 | 7 | public static ArrayList<Double> runJacobiAlgorithm(Matrix originalMat, boolean sorted) {
Matrix mat = new Matrix(originalMat.rows, originalMat.columns);
for (int r = 0; r < originalMat.rows; r++) {
for (int c = 0; c < originalMat.columns; c++) {
mat.matrix[r][c] = originalMat.matrix[r][c];
}
}
... |
a2fd15d4-8aca-4d85-b693-82a8ce262d9c | 1 | public Object getValueAt(int row, int col) {
try {
return projectResultList.get(row).getColumnData(col);
} catch (Exception e) {
e.getMessage();
return null;
}
} |
4805c30f-1435-4574-923b-1013b62bd85f | 3 | public ArrayList<TreeRow> getExplicitlySelectedRows() {
ArrayList<TreeRow> selection = new ArrayList<>();
if (!mSelectedRows.isEmpty()) {
for (TreeRow row : new TreeRowViewIterator(this, mRoot.getChildren())) {
if (mSelectedRows.contains(row)) {
selection.add(row);
}
}
}
return selection;
} |
de0a8fee-27cc-433a-a4e8-68b40c3353af | 5 | public Player getPlayer2() {
boolean test = false;
if (test || m_test) {
System.out.println("Game :: getPlayer2() BEGIN");
}
if (m_player2 == null) {
System.out.println("Game::GetPlayer2 - "
+ "m_player2 has not yet been set");
throw new ... |
d5e201a8-6c62-47c3-bb83-44d0247f93ce | 8 | @Override
public void startElement(String uri, String localName, String qName,
Attributes attributes) throws SAXException {
if (localName.equalsIgnoreCase("node")) {
inNode = true;
CoastlineNode node = getNodeInformation(attributes);
if (node != null) {
... |
0ff21f09-8cd5-4664-b92c-808d25b6ca6f | 0 | public void setMoveDown(boolean a){
moveDown = a;
} |
9ca2b9e3-56fb-42bd-b293-d98930df75b4 | 1 | public final static double roundBidAsk(double number, double tick, boolean bid)
{
// get rid of trailing 00..001s and 99..99s
double raw = Math.round((number) * scale);
long recpTick = Math.round(1 / tick);
// get back to basis, tricky with the tick size due to floating issues
raw /= scale * 1 / recpTick;
// ro... |
3dc312b2-c6a1-4c18-805c-80acdc5eb6cf | 4 | private Token readInteger(Token token) throws ScriptException {
while (line != null) {
char ch = charAt(index);
index++;
if (Character.isDigit(ch))
token.append(ch);
else if (ch == '.' && Character.isDigit(charAt(index)))
return rea... |
58882275-1c9c-42a3-8b9c-9b42477829d3 | 1 | @Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
} |
87329304-591a-4ef7-8f62-5ae8262d73e0 | 7 | public String strStr(String haystack, String needle) {
if(needle.length()==0){
return haystack;
}
if(haystack.length()<needle.length()){
return null;
}
int[] ta = helper(needle);
int i=0,m=0;
while(i<needle.length()&&m+i<haystack.length()){... |
5c9b564e-152b-4eaf-a278-370f5cd054cd | 3 | private void doSomethingInWorkerThread()
{
//define and instantiate a worker thread to create the file
//----------------------------------------------------------------------
//class SwingWorker
//
workerThread = new SwingWorker<Void, String>() {
@Override
public Void doInBackgr... |
b0391009-a7ba-46b4-8246-3b67605fb42b | 0 | @Override
public Map toMap(String jsonString) throws IOException {
return objectMapper.readValue(jsonString, Map.class);
} |
81a001b3-d734-4235-874a-cf2e675c51cc | 3 | private void saveDir(File dir, JarOutputStream jos, File parent) throws IOException {
String replacement = parent.getPath() + File.separator;
for(File file : dir.listFiles()) {
if(file.isDirectory()) {
saveDir(file, jos, parent);
continue;
}
JarEntry je = new JarEntry(file.getPath().replace(rep... |
8fad6221-6420-4d8c-82cb-ec519480bbd2 | 9 | public boolean isPass(URL url) throws RobotsCheckerException {
boolean isPass = true;
try {
Set<String> disallowPatternSet = cache.get(url.getHost());
if (disallowPatternSet == null) {
//TODO: Load the path from configuration, convention over configuration
Process p = Runtime
.getRuntime()
... |
6ae4480d-d7cf-40b2-a156-e5019e88acfe | 0 | public TruncateHelper setTrimFirst(boolean trimFirst)
{
this._trimFirst = trimFirst;
return this;
} |
073e00a7-ea47-4fb7-8ab0-a87f2b19dd02 | 8 | private String showNode(TreeNode node, boolean[] hasBar){
StringBuffer text = new StringBuffer();
for(int i=0; i < (node.level - 1); i++)
if(hasBar[i])
text.append(" | ");
else
text.append(" ");
if(node.level != 0)
text.append(" |------ ");
text.append(node.value+"("+node.lev... |
4d6ded70-0976-499b-8207-60d1007871df | 0 | @Provides
@Named("marshalContext")
public JAXBContext getMarshalContext() throws JAXBException {
return JAXBContext.newInstance(clazzezToBeBound);
} |
7062e95d-ba71-4dce-8c1a-2b86e2a55c20 | 4 | public String texteDescription(Calendar heureDebut) {
if(this.etat == EtatLivraison.NON_CALCULE){
return null;
}
else{
String texte="\tLivraison " + this.id + " chez le client " + this.idClient+" � "+GestionCalendar.calendarToHeureString(this.heure);
String texteTmp = "";
if(this.etat == EtatLivrai... |
8e94ed3b-051a-46a4-b774-11358e034d19 | 7 | public void run() {
while(isRunning) {
synchronized(this) {
result = databaseConnection.getLocations();
clientThreads = server.getClientThreads();
for(ClientThread clientThread: clientThreads) {
for(SQLLocationResult res: result){
if(clientThread.getPhoneNum() != null && !res.getPh... |
d48ceb38-46c3-4b36-a539-37eb18fb6396 | 0 | public void setPieces(Reserve pieces) {
this.pieces = pieces;
} |
2c878c4b-8551-43f9-b4a7-a031a9d9a162 | 8 | private void setVocabStatByTrueClusters(TFIDF dist, MatchData data) {
// use the match data to reconstruct the true clusters
Map<String,HashSet<Token>> tokensById = new HashMap<String,HashSet<Token>>();
for (int i=0; i<data.numSources(); i++) {
String src = data.getSource(i);
... |
14a790f6-8e81-44b1-baf1-1eabbdab2af9 | 4 | public void muteMedia() {
if (Debug.video) System.out.println("VideoPlayer -> muteMedia called");
if ((null != player) && realizeComplete) {
gainControl.setMute(true);
if (Debug.video) System.out.println("VideoPlayer -> muteMedia set");
}
} |
173e42e2-6d5c-48e7-ba00-47a6a6095f04 | 5 | @Override
public ProgramCommandLine makeProgramCommandLine() throws RunBuildException {
List<String> cmd_args = new ArrayList<String>();
Map<String,String> params = this.getRunnerParameters();
final String task =
params.get(DeployerConstants.SETTINGS_TASK);
final String... |
062f1104-2022-464a-a52a-a70e81921904 | 7 | static String toXML(Document document, String separator) {
if (separator == null) {
separator = "";
}
String xml = "";
for (String key : document.keySet()) {
Object doc = document.get(key);
if (doc instanceof Document[]) {
Document[] do... |
16869bee-0bb9-4159-9037-c9f48f102c66 | 2 | public static boolean checkSorted(int[] array) {
for (int i = 1, s = array.length; i < s; ++i) {
if (array[i - 1] > array[i]) {
return false;
}
}
return true;
} |
e38b95a3-ae22-48f6-a8bb-c1e6415355f7 | 7 | private List<Class<?>> getTypeHierarchy(Class<?> type) {
if (type.isPrimitive()) {
type = primitiveTypeToWrapperMap.get(type);
}
Set<Class<?>> typeHierarchy = new LinkedHashSet<Class<?>>();
collectTypeHierarchy(typeHierarchy, type);
if (type.isArray()) {
typeHierarchy.add(Object[].class);
}
... |
1251d350-aa81-4307-9305-43c8012b51c9 | 5 | public byte[] verschluessele(String text) {
try {
// Verschluesseln
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.ENCRYPT_MODE, this.aesKey);
byte[] encrypted = cipher.doFinal(text.getBytes());
return encrypted;
} catch (NoSuc... |
c685abb4-1e54-45a9-8cb8-4c27ca36987d | 8 | public void setEditValue(int n, EditInfo ei) {
if (ei.value > 0 && n == 0) {
onresistance = ei.value;
}
if (ei.value > 0 && n == 1) {
offresistance = ei.value;
}
if (ei.value > 0 && n == 2) {
breakdown = ei.value;
}
if (ei.value... |
23f841e1-bce5-48e3-b3ea-d0b7a7920f5b | 0 | public UnknownCommandException() {
super();
} |
b5d57b7c-8568-4566-ac5c-8a2910691162 | 2 | private void init(int totalRecode, int curPageNum, int pageCount) {
// 设置基本参数
this.totalRecode = totalRecode;
this.pageCount = pageCount;
this.pageRecode = (this.totalRecode - 1) / this.pageCount + 1;
// 根据输入可能错误的当前号码进行自动纠正
if (curPageNum < 1) {
this.curPageN... |
6a12465c-094e-409c-90ac-66c64dfc018c | 5 | public boolean isInView(int marginx,int marginy) {
if (!getTileBBox(temp_bbox_copy)) {
temp_bbox_copy.x = (int)x;
temp_bbox_copy.y = (int)y;
temp_bbox_copy.width = 0;
temp_bbox_copy.height = 0;
}
if (temp_bbox_copy.x + temp_bbox_copy.width < viewxofs-marginx)
return false;
if (temp_bbox_copy.y +... |
7490d722-8216-409d-890e-beae90a55f01 | 0 | protected BusMatcher bindBus( final String identifier )
{
checkArgument( identifier != null, "Event bus identifier must be not null" );
return new BusMatcher()
{
public void toAnyBoundClass()
{
to( any() );
}
public void to( ... |
d902acfe-a344-4947-aae2-6eaa481e9c76 | 5 | private List<String> orphanCheck(String dataNodeName, List<String> chunkNameList_DataNode) {
Set<String> fileNameSet = this.fileTbl.keySet();
Set<String> chunkSet_NameNode = new HashSet<String>();
for (String fileName : fileNameSet) {
HDFSFile file = this.fileTbl.get(fileName); //Check if the fil... |
477224f7-7416-4129-9571-83c121b84bc1 | 7 | public ClipboardView(final AlphaForm model,
final ApplicationController controller) {
super(controller);
this.model = model;
model.createState("clipboardStart");
this.setLayout(new BorderLayout());
final JToolBar toolbar = new JToolBar();
toolbar.setFloatable(false);
final JButton button1 = new JBut... |
917d579a-3a37-4d0e-89f6-0905a8e789b0 | 7 | public Population getPopulation(TokenResolver tokenResolver) throws Exception {
population = new Population();
for (String line : lines) {
if (line.isEmpty())
continue;
int openIndex = line.indexOf("(");
if (openIndex == -1) {
throw new... |
2019d2c2-7efb-4e16-aa8a-26c74f13feef | 4 | private InfoNode dealWithPromote(InfoNode infoNode, Node node) {
if(infoNode == null){return null;}
node.add(infoNode.newKey, infoNode.rightChild);
if(node.getSize() <= maxDegree){return null;}
InternalNode sibling = new InternalNode();
int mid = (node.getSize()/2)+1;
int j = 1;
int loopTo = ((InternalNod... |
99fb447e-c4d5-4fee-8c13-0c7d3c7b3845 | 3 | public synchronized void loadMapSynch(String name) {
loadMap(name);
while(!isMapLoaded) {
try {
this.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
if (map.mapScript != null)
new Thread(new ScriptHandler(game, map.mapScript, null)).start();
} |
4afd48d4-a797-41b5-8ebc-94238ce70b89 | 3 | public static Point[] applyDynamism(final Point[] spline, final int msForMove, final int msPerMove) {
final int numPoints = spline.length;
final double msPerPoint = (double) msForMove / (double) numPoints;
final double undistStep = msPerMove / msPerPoint;
final int steps = (int) Math.floor(numPoints... |
c115be0e-cbfe-4a4d-b694-a44b0565e5c6 | 9 | @Override
public void moveTowards(MapLocation mapLocation) {
RobotController rc = robot.getRobotController();
if (rc.isActive()) {
Direction direction = rc.getLocation().directionTo(mapLocation);
int counter = 0;
if (!direction.equals(Direction.OMNI) &&
!direction.equals(Direction.NONE)) {
whil... |
e1013409-cb5f-422b-b8ad-b32673f960bd | 8 | protected void updateDrawableRect(int compWidth, int compHeight) {
int x = currentRect.x;
int y = currentRect.y;
int width = currentRect.width;
int height = currentRect.height;
if (CONSTVALUE._DEBUG_FLAG_LEVEL_5_) {
System.out.println("x =>" + x);
System.out.println("y =>" + y);
System.out.println... |
7495f421-cb42-4c4c-8200-be762e3691b4 | 7 | private void resize() {
size = getSkinnable().getWidth() < getSkinnable().getHeight() ? getSkinnable().getWidth() : getSkinnable().getHeight();
width = getSkinnable().getWidth();
height = getSkinnable().getHeight();
if (aspectRatio * width > height) {
width = 1 / (aspect... |
51a14995-3a68-49a6-bb18-41aa14ecf958 | 9 | private static HttpURLConnection getHttpURLConnection(String method, String urlPath, String contentType, String xml)
throws PagSeguroServiceException {
log.debug("method: " + method + ", Content-type:" + contentType + ", target URL: " + urlPath);
URL url;
HttpURLConnection connecti... |
12d427a6-66a8-47c7-8dba-003edbd20ebf | 0 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
tblListar = new javax.swing.JTable();
btnMostrar = new javax.swing.JButton();
bt... |
8375eefc-e988-49ea-81ac-413bc4dce762 | 0 | public OSCPacket[] getPackets() {
OSCPacket[] packetArray = new OSCPacket[packets.size()];
packets.toArray(packetArray);
return packetArray;
} |
d552bb8b-ecc8-42be-9cdf-23b47c4e7f6b | 8 | public void mouseDragged(MouseEvent mouse) {
/*Check if mouse is over weapon*/
if(mouse.getX()>520&&mouse.getX()<560&&mouse.getY()>680&&mouse.getY()<720 && !world.released &&!world.start)
{
world.weapon.add(new Weapon(mouse.getX(),mouse.getY(),1));
world.start=true;
}
/*Keep updating the weapon locati... |
30ff2baf-99d4-47ea-945a-511ae51220e0 | 8 | public void createParis(HttpServletRequest request, String userId) {
String sched_id = request.getParameter(FIELD_SHED_ID);
String paris_type = request.getParameter(FIELD_PARIS_TYPE);
String paris_vict = request.getParameter(FIELD_PARIS_VICT);
String paris_scor_eqp = request.getParameter(FIELD_PARIS_SCORE_EQP);... |
9db52a4f-12ea-431a-a225-8c1df6790d8a | 4 | public double[] extractDataDouble (int start,int length) {
try {
int count=0,a=circBufferCounter+start;
double outData[]=new double[length];
if (a>=MAXCIRC) a=a-MAXCIRC;
for (count=0;count<length;count++) {
outData[count]=circDataBuffer[a];
a++;
if (a==MAXCIRC) a=0;
}
return outData;
}... |
97eee7fd-8a6b-41b5-8c9e-57f0f9b14d98 | 3 | private void saveChanges(BufferedWriter out, List<SnapshotFile> files) {
for (SnapshotFile file : files) {
try {
DummyAction action = this.getActionFromSnapshotFile(file);
if (action != null) {
out.write(action.toString());
}
} catch (IOException e) {
logger.error("Error getting action f... |
1f71e324-2f21-4407-9de4-ee57f64df7e8 | 1 | public void render() {
BufferStrategy buffStrat = getBufferStrategy();
if (buffStrat == null) {
createBufferStrategy(3);
return;
}
Graphics graphs = buffStrat.getDrawGraphics();
graphs.setColor(Color.BLACK);
graphs.drawImage(image, 0, 0, getWidth(), getHeight(), null); // Background
/... |
520ec9c1-13c3-4adf-b0ef-7f78f9ad72c0 | 9 | boolean isAttributeDifferent(AttributeProperties attributeProperties, Attribute attribute, int position) {
// Attribut ist gar nicht vorhanden
if(attribute == null) {
_debug.finer("Attribut ist nicht vorhanden");
return true;
}
// Attribut auf Gleichheit prüfen
String name;
SystemObjectInfo info;
i... |
e3e1eb7f-06d2-4101-8365-4812f6784c34 | 5 | public DetectionFunction(AudioDecoder decoder, final int sampleWindowSize,
final int hopSize, final boolean isHamming) {
// TODO: ACEITAR HOPSIZE NULO E, NESSE CASO, N USAR SOBREPOSIÇÃO DE
// BANDAS
if (decoder == null)
throw new IllegalArgumentException("Decoder must be != null");
if (sampleWindowSize <... |
a9841ba8-e742-45dc-ba67-79ded71da2bb | 1 | public void execute(MinersSon son){
//if the miner is at the goldmine he digs for gold until he
son.increaseBored();
System.out.println(son.getName() + " DOING CHORES SUCKS!");
if (son.bored())
{
son.getFSM().changeState(PlayOutside.getSingleton());
}
//if eno... |
42996776-235b-418d-8c7f-59dee8495349 | 0 | public void setWeight(float weight) {
this.weight = weight;
} |
c598b27c-e7a1-4f16-8d39-bc08cc3f5cf9 | 0 | public StudentBean getStudentBean() {
return studentBean;
} |
c1fdbcba-1701-48fe-9fab-02693129a350 | 6 | public static void manageProfessors() {
System.out.print("Do you want to add (0) or delete (1) a professor ? ");
int res = -1;
while (res < 0 || res > 1) {
Scanner sc = new Scanner(System.in);
res = sc.nextInt();
}
switch (res) {
case 0:
createProfessor();
break;
case 1:
if (FileRead.pr... |
27dcebd7-f870-45bf-b004-79ab1066ad5f | 7 | private boolean versionCheck(String title) {
if (this.type != UpdateType.NO_VERSION_CHECK) {
final String version = this.plugin.getDescription().getVersion();
if (title.split(" v").length == 2) {
final String remoteVersion = title.split(" v")[1].split(" ")[0]; // Get the ... |
86551b6b-9072-4b52-a351-627e4963e7f7 | 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... |
4af96f7f-eedd-47ed-8bf0-dee7d91866a8 | 8 | private static void addSomeMetadata(BufferedReader reader,
BufferedWriter writer,boolean skipFirst, OtuWrapper originalWrapper) throws Exception
{
int rareficationNumber = originalWrapper.getCountsForSample(originalWrapper.getSampleIdWithMinCounts())-1;
writer.write("sampleID\treadNumber\tnumSequencesPerS... |
e2526f29-e63a-4512-b03b-93ae3f451510 | 8 | public static String qualifySheetname( String s )
{
if( (s == null) || s.equals( "" ) )
{
return s;
}
if( (s.charAt( 0 ) != '\'') && ((s.indexOf( ' ' ) > -1) || (s.indexOf( '&' ) > -1) || (s.indexOf( ',' ) > -1) || (s.indexOf( '(' ) > -1)) )
{
if( !s.contains( "'" ) ) // normal case of no embedded ... |
ab41d3d3-7add-40e5-a1e8-2ef98d614f52 | 4 | public static void main(String[] args) {
boolean[] sieve = EulerMath.getSieve(N);
boolean found = false;
for(int i = N-1; i > 1 && !found; i--)
if( sieve[i] && EulerMath.isPandigital(i, 1) ) {
System.out.println(i);
found = true;
}
} |
1c72c0f4-a0f5-4e81-8772-9113a25b016c | 0 | protected void onRemovePrivate(String channel, String sourceNick, String sourceLogin, String sourceHostname) {} |
1158e7bb-4731-4771-8557-01f32e00758a | 9 | private String getInsert() {
if (rdbtnmntmArea.isSelected()) {
return "INSERT INTO AREA(ID, NAME, TYPE) VALUES("
+ textArea1.getText() + ", '" + textArea2.getText()
+ "', '" + textArea3.getText() + "')";
}
if (rdbtnmntmArtist.isSelected()) {
return "INSERT INTO ARTIST(ID, AREA_ID, NAME, TYPE, GEN... |
40dfbeac-9a39-4cf4-bd27-1620bb925328 | 0 | public Land(int IDNumber, int xLocation, int yLocation, Fraktion f, int einheiten) {
this.xLocation = xLocation;
this.yLocation = yLocation;
this.IDNumber = IDNumber;
this.fraktion = f;
this.anzahlEinheiten = einheiten;
} |
8c22864a-c17d-4a5d-b9b9-8a555f3072bc | 4 | public static Pokemon randomEncounter(Pokemon.Species s1, int rare1, int lvl1, Pokemon.Species s2, int rare2, int lvl2,
Pokemon.Species s3, int rare3, int lvl3,
Pokemon.Species s4, int rare4, int lvl4, Pokemon.Species s5, int rare5, int lvl5)
{
int randy=(int)(Math.random()*100)+1;
if(randy<=rare1)
{
... |
3a8aab8f-07bb-4b65-bf0e-9fa59d6eb149 | 1 | public ModelChangedEvent(ModelProxy<?> modelProxy) {
super(modelProxy);
} |
ca7e88fa-cc83-4325-a6f2-7a0053ca95d7 | 2 | public static boolean isRestrictedOnLHS(Production production) {
String lhs = production.getLHS();
String[] variablesOnLHS = production.getVariablesOnLHS();
if (lhs.length() == 1 && variablesOnLHS.length == 1) {
return true;
}
return false;
} |
6a2d2a7a-b20e-4014-bce2-ee4e300190e7 | 3 | private void checarAltitud() {
if (fisicaPersonaje.getPhysicsLocation().y < -200) {
salud = 1;;
interfaz.checarVidas();
vidas--;
// Colocamos al personaje en la escena
if (nomEscena.equals("MonkeyLand")) {
fisicaPersonaje.setPhysicsLoca... |
c204565a-fd52-4d78-843a-baaf41a6db41 | 3 | public void setId(int id) {
if (currentId > ids.length - 1) {
int[] tmp = new int[ids.length];
for (int i = 0; i < ids.length; i++) {
tmp[i] = ids[i];
}
ids = new int[ids.length * 2];
for (int i = 0; i < tmp.length; i ++) {
... |
a60ac322-a80b-476f-b37b-fe573121faab | 6 | @Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Objects)) {
return false;
}
Objects that = (Objects) o;
if (this.name == null || this.type == null) {
return false;
}
... |
0985d563-8c12-4eb6-95a3-a0575c64306b | 6 | private <T> void updateStateAfterAction(Action<T> action) {
switch (action.type) {
case BGPALETTE:
case OBJPALETTE:
case HRAM:
case OAM:
return;
case TILE:
curVramBank = action.position / 0x180;
return;
case WRAM:
curVramBank = action.position / 0x800;
return;
... |
f5c2c482-b7c4-4532-85c2-70da52e85412 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Citizen)) {
return false;
}
Citizen other = (Citizen) object;
if ((this.citizenID == null && other.citizenID !=... |
87f20205-5868-45fb-aadc-1e9fb39533fb | 2 | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
@SuppressWarnings("rawtypes")
List users = getHibernateTemplate().find("from User where username=?", username);
if (users == null || users.isEmpty()) {
throw new UsernameNotFoundException("user ... |
750b0c2c-98f7-468e-b643-6aa6f0ba681c | 3 | @Override
public Object getValueAt(int row, int col) {
if (row > -1 && col > -1 && data != null) {
return data[row][col];
} else {
return null;
}
} |
47b6124d-4782-4833-a798-b96c950e30f3 | 2 | private static List<TestResultData> parseTestNgResultFromFilesOrUrls(List<String> urlsOrFiles) {
List<TestResultData> testNgResultData = new ArrayList<TestResultData>();
try {
for (String url : urlsOrFiles) {
TestNgResultFile testNgResultFile = new TestNgResultFile();
... |
baf6f703-f31c-4a43-8a4d-3f4f5ba9c92e | 3 | public boolean deleteChallenge(Challenge challenge) {
Element challengeE;
boolean flag = false;
for (Iterator i = root.elementIterator("challenge"); i.hasNext();) {
challengeE = (Element)i.next();
if (challengeE.element("id").getText().equals(challenge.getId())) {
challengeE.element("isDelete").setText(... |
f67f7221-9704-4453-b275-39285a85d4a1 | 1 | public void test_compareTo() {
assertEquals(0, iField.compareTo(iField));
assertEquals(-1, iField.compareTo(ISOChronology.getInstance().minutes()));
DurationField dummy = new PreciseDurationField(DurationFieldType.minutes(), 0);
assertEquals(1, iField.compareTo(dummy));
// try {
/... |
17504c02-a7ab-4d54-a659-d389fa724b48 | 7 | public void actionPerformed(ActionEvent e) {
if (e.getSource() == jbtHit) //When the hit button is pressed, gives the player another card
playerMove = "hit";
if (e.getSource() == jbtStay) //When the stay button is pressed, ends the players turn (on the current hand)
playerMove = "stay";
if (e.getSource... |
1d7d3dad-59fd-48b5-a5b5-1a676912003d | 5 | @Override
public void keyPressed(KeyEvent arg0) {
//press up key
if(arg0.getKeyCode() == KeyEvent.VK_UP){
upPressed = true;
downPressed = false;
shopkeepSays = POTION;
this.repaint();
}
//press down key
else if(arg0.getKeyCode() == KeyEvent.VK_DOWN){
downPressed = true;
upPressed = false;
... |
274717a4-1b51-4a71-b7ed-9fd7fd9fb8fb | 5 | protected boolean renderText(Box2D area, TextEntry entry, Clickable link) {
if (entry.letter == null || ! entry.intersects(area)) return false ;
//
// If this text links to something, we may need to colour the text (and
// possibly select it's link target if clicked.)
if (link != null && entry.lin... |
d1c003cf-e557-4625-a2d6-fc23c50cd6ed | 2 | String integerToString(int n, int len) {
StringBuffer sb = new StringBuffer();
while (sb.length() < len) {
sb.append(n % 2 == 0 ? 'a' : 'b');
n /= 2;
}
return sb.reverse().toString();
} |
ce2fd80e-1e99-4ca0-8954-99cd0b615954 | 0 | public Point getAutomatonOrigin() {
return new Point(-(int) transform.getTranslateX(), -(int) transform
.getTranslateY());
} |
2437a0c1-a9e0-4fec-b0ac-2cf854f2baed | 5 | public void expirationTask() {
long expiration;
long currenttime = System.currentTimeMillis();
List<IItem> toberemove = new ArrayList<IItem>(); // This is here to prevent deadlock.
for (MapleInventory inv : inventory) {
for (IItem item : inv.list()) {
expirati... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.