method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
03c14cd5-0b55-49e3-89f5-12a13dc68502 | 1 | private static int[] genPref()
{
int[] pref = new int[FRUIT_NAMES.length];
for (int i = 0; i != pref.length; ++i)
pref[i] = i + 1;
shuffle(pref);
return pref;
} |
00515dc3-e19c-46c7-81e9-43eb818a870d | 3 | public static int getPassengerCount(SimpleTrain train) {
if(train == null){
LOG.error("Train is null");
throw new IllegalArgumentException("Train is null");
}
int count = 0;
for (AbstractCarriage ac : train) {
if (ac instanceof AbstractPassengerCarriage) {
count += ((AbstractPassengerCarriage) ac).... |
3c4bfcbf-89e5-4a9a-b2df-e1fc1498a4d3 | 9 | public RegisterViewHelper getRegisterViewHelper(HttpServletRequest req)
throws UnsupportedEncodingException {
RegisterViewHelper registerViewHelper = new RegisterViewHelper();
if (req.getParameter("forename") != null) {
registerViewHelper.setForename(new String(req.getParameter("forename")
.getByt... |
76b18611-84f8-47aa-9ada-a4d08cd081ee | 0 | public String getFrameIdentifier() {
return frameIdentifier;
} |
e27d6d5b-1b87-479d-8d26-a2676976f8de | 1 | public void render(){
texture.bind();
int xChange = (change-1) % 2;
int yChange = (change-1) / 2;
if(!isDead()){
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2f(xChange * 0.5f,yChange * 0.5f + 0.5f);
GL11.glVertex2f(x, y);
GL11.glTexCoord2f(xChange * 0.5f + 0.5f,yChange * 0.5f + 0.5f);
GL11.glV... |
adf3fb4e-84d0-40f2-958b-a53977c39e3a | 5 | private void button7MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_button7MouseClicked
if(numberofpins < 4)
{
if(numberofpins == 0)
{
Login_form.setString1("6");
}
if(numberofpins == 1)
{
Login_form.setString2("6");
}
if(numberofpins == 2)
{
Login_... |
aa4152af-b032-4eff-b04a-8d4db2f06061 | 8 | @java.lang.Override
public boolean isValidMove(int MoveToX,int MoveToY,int MoveFromX,int MoveFromY) {
if (((MoveFromX-MoveToX)==1||(MoveFromX-MoveToX)==-1)&&((MoveFromY-MoveToY)==2||(MoveFromY-MoveToY)==-2)){
return true;
}
if (((MoveFromX-MoveToX)==2||(MoveFromX-MoveToX)==-2)&&((MoveFrom... |
f7ae65c6-0cb0-43ac-af3a-fbee1dab9e46 | 2 | public void reset() {
double[][] map = new double[_source.length][_source[0].length];
double scale = 1023.0 / (double) _maxValue;
for (int i = 0; i < map.length; i++) {
double[] row = map[i];
for (int j = 0; j < row.length; j++) {
map[i][j] = _source[i][j] * scale;
}
}
_map = map;
} |
55822223-2d2b-4428-bb83-f5a07776e1ba | 2 | public static boolean buyProduct(Integer id) {
Session session = HibernateUtil.getSessionFactory().openSession();
Query query = session.createQuery("from Product where id = :id");
query.setParameter("id", id);
Product product = (Product)query.uniqueResult();
if(product!=null && ... |
1d281304-2ae0-424c-b69b-8d7961ac57f2 | 0 | public void tick() {
} |
09001b52-07f6-4607-a320-39895eab2bd3 | 9 | private void write(Map<String,Map<String,SerAnnotatedElement>> output, Map<String,Collection<Element>> originatingElementsByAnn) {
for (Map.Entry<String,Map<String,SerAnnotatedElement>> outputEntry : output.entrySet()) {
String annName = outputEntry.getKey();
try {
Map<St... |
9582c911-38cb-448c-bb12-07f16d95ffc4 | 2 | @Override
public int compareTo(ValueIndexPair o) {
return sum < o.sum ? -1 : (sum > o.sum ? 1 : 0);
} |
d8bad654-d762-40ff-9dc9-f9d7482c8c13 | 4 | * @return The column, or <code>null</code> if none is found.
*/
public Column overColumn(int x) {
int pos = getInsets().left;
int count = mModel.getColumnCount();
for (int i = 0; i < count; i++) {
Column col = mModel.getColumnAtIndex(i);
if (col.isVisible()) {
pos += col.getWidth() + (mDrawColumnDivi... |
3c23cfd8-1c21-4b3d-9b68-ecddb3f09d81 | 0 | Errors(String name) {
this.value = name;
} |
fd4cfb8b-3d9d-45ad-9c5c-c12dc3e2d630 | 8 | @Override
public synchronized Message process(ClientState state, Message request)
{
String xmlString;
Model model = Model.getInstance();
Message response = null;
Node child = request.contents.getFirstChild();
String myKey = child.getAttributes().getNamedItem("key").getNodeValue();
// check the key and i... |
2090344a-31e0-4b79-a47c-c204a6a32541 | 3 | public static boolean eval(String expression) {
if (expression == null) return false;
String[] comparitors = new String[] {"<=",">=","<>","!",">","<","="};
int i;
for (i=0; i < comparitors.length; i++) {
if (expression.contains(comparitors[i])) {
String[] split = expression.split(comparitors[i]);
re... |
106e00c4-b742-451c-99ee-628f4958d247 | 1 | public void save() {
try {
file.openWr(dir + "\\" + getNick() + ".txt");
file.write(hpass);
file.write(getWins());
file.write(getLoses());
file.close();
} catch (Exception e) {
empty();
ExceptionLog.println("Ошибка: Не у... |
d88fa11e-626f-4777-b64d-e47af5e82725 | 0 | public Employee(String n, double s)
{
name = n;
salary = s;
hireDay = new Date();
} |
469fec59-d51e-4b08-9ce6-dac52873454e | 6 | private void populateCombos() {
String imgQuality = device.getProperty(Device.IMAGE_QUALITY);
String pollRate = device.getProperty(Device.POLLING_RATE);
int qualityPosition = 0;
int pollPosition = 0;
if (imgQuality == null) {
imgQuality = Integer
.toString(IConnectionConstants.DEFAULT_IMAGE_QUALITY);... |
04dd5509-7b81-4327-9311-2d61b20d1f1c | 1 | public List<String> getString() {
if (string == null) {
string = new ArrayList<String>();
}
return this.string;
} |
b0e7472e-da24-494e-ac9f-18e8f2bee71b | 0 | @Before
public void setUp() {
} |
31a63be5-19a0-4f85-8e2f-6916feb51e5e | 1 | @Override
public void run() {
Thread.currentThread().setName("Shutdown");
try {
LOG.info("The \"UCP and SMMP Proxy\" is shutting down");
// Do whatever has to be done here to cleanup the module before complete shutdown
LOG.info("The \"UCP and SMMP Proxy\" shutted ... |
6c23d6ff-2600-4866-8399-1bec54901df1 | 9 | private void renderFormalTypeParameters(JavaBytecodeSyntaxDrawer sd, Imports ia, List<FormalTypeParameter> typeParams) {
boolean displayExtendsObject = SystemFacade.getInstance().getPreferences().isSettingTrue(Settings.DISPLAY_EXTENDS_OBJECT);
if (typeParams != null && typeParams.size() > 0) {
sd.drawDefault("<"... |
69c78f46-c854-4f75-965f-8c9d7bff5627 | 0 | public void setDescription(String description) {
this.description = description;
} |
c57bbaf1-c0b1-4dab-b969-46fc82cf97f9 | 0 | public EntityServlet() {
super();
} |
5b9a898b-2f97-42da-a824-2b301e28afcf | 6 | public void combat(Unit attacker, Unit defender, int round) {
if (round < 100) {
if (attacker.range > defender.range)
// Prüfen ob der Verteidiger sich wehren kann
{
defender.setHP(defender.hp - r.nextInt(attacker.attack) * attacker.hp / 100);
// ranged Schadensberechnung wip
return;
} el... |
bc061fd0-7ada-4f8e-b251-e730fa4314cd | 6 | public static ArrayList<Book> checkBookReservation(ArrayList<BookCopy> bookList) {
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
ArrayList<B... |
07508e2b-77f3-4030-936b-e6bf5d24b7b4 | 0 | public ProblemList getProblemList() {
return problemList;
} |
3f178196-1899-412e-b38d-e3b1f50cf3cc | 8 | TermInfosReader(Directory dir, String seg, FieldInfos fis, int readBufferSize, int indexDivisor)
throws CorruptIndexException, IOException {
boolean success = false;
if (indexDivisor < 1 && indexDivisor != -1) {
throw new IllegalArgumentException("indexDivisor must be -1 (don't load terms index) o... |
461fa0f0-a478-4d7b-a1c9-18e822d89769 | 4 | @SuppressWarnings("unchecked")
public void add(int index, T theElement)
{
if(index < 0 || index > size)
throw new IndexOutOfBoundsException("index = " + index + " size = " + size);
if(size == element.length)
{
T[] old = element;
element = ( T[] ) new Object[2 * size];
System.arraycopy(old, 0, el... |
53ff43e4-a3ce-445a-b588-cfa02255a3a1 | 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... |
89befd03-fa60-451a-b544-2bdbcb2b3d08 | 3 | public int trimaLookback( int optInTimePeriod )
{
if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) )
optInTimePeriod = 30;
else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
return -1;
return optInTimePeriod-1;
} |
36e81fae-017e-45f3-8eca-8cec79e38c4c | 3 | public void close(){
try {
acceptthread.stop();
if (s != null) {
s.close();
for (Client c: clients) {
c.close();
}
}
gui.close();
} catch (IOException e) {
e.printStack... |
0ce20b74-ed68-473d-92ea-7dfd2a378b9e | 9 | public void renderTopFace(Block block, double d, double d1, double d2, int i) {
Tessellator tessellator = Tessellator.instance;
if (this.overrideBlockTexture >= 0) {
i = this.overrideBlockTexture;
}
int j = (i & 15) << 4;
int k = i & 240;
double d3 = ((doubl... |
6973d35c-0a32-4575-a9a7-25d22effb37f | 4 | private String sourceLastUpdated() {
XPath xpath = XPathFactory.newInstance().newXPath();
String updated = "";
try {
Document doc = DocumentBuilderFactory.newInstance()
.newDocumentBuilder()
.parse("service-names-port-numbers.xml");
updated = xpath.evaluate("/registry/updated", doc);
} catch (XP... |
58e45bca-feae-40a9-bca4-be1684762921 | 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... |
b2b2d70a-59e1-44b7-aab7-16b956f81f54 | 3 | public boolean allowScreenDownMode() {
if (!allowScreenOrPrintRenderingOrInteraction())
return false;
if (getFlagNoView() && !getFlagToggleNoView())
return false;
return !getFlagReadOnly();
} |
8a910d00-e13b-4e15-aef1-bf928c7fadf5 | 1 | @Test
public void testGreater2PowersExponent() {
logger.info("greater2PowersExponent");
int[] number = {0, 1,2, 3,4, 5,6,7,8, 9,10,11,12,13,14,15,16,17,18,19,20};
int[] expResult = {0, 0,1, 2,2, 3,3,3,3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5};
for (int i = 0; i < number.length; i++... |
0ac43331-8117-47d0-8a6c-ab5d42f541f1 | 5 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter number M: ");
int m = sc.nextInt();
System.out.println("Enter number N: ");
int n = sc.nextInt();
if (n < m) {
int helper = n;
n = m;
m = helper;
}
String numbersDivisibleBy3 = "";
St... |
2910b792-d944-44c9-b31e-9c7ec4c8f004 | 6 | public void setCurrentItemByPath(String relativePath){
File file = new File(ProjectMgr.getAssetsPath(), relativePath);
if(!file.exists()){return;}
List<File> files = new ArrayList<File>();
while(file.getParent() != null && !file.getParent().equals(ProjectMgr.getAssetsPa... |
2b48c1df-2743-473b-b008-08cb6a0f1e67 | 3 | @Override
public boolean tallenna() {
try {
FileWriter kirjoitin = new FileWriter(rekisteri);
for (int i = 0; i < tyopaivat.size() - 1; i++) {
kirjoitin.write(tyopaivat.get(i).tallennusMuoto() + "\n");
}
if (!tyopaivat.isEmpty()) { // viimeisen... |
30cca9d0-bdac-4cb0-b570-88787855a07e | 6 | public String getParamValue(String configKey, String paramKey) {
if (key.equalsIgnoreCase(configKey)) {//search own
for (Param param : params) {
String ret = param.get(paramKey);
if (ret != null) {
return ret;
}
}
... |
6a60d1f0-671c-4cf7-b14f-c836ee9d311d | 8 | @Override
public void checkPropertyAccess(String key) {
// allow access to some harmless properties
switch (key) {
case "line.separator":
case "user.dir":
case "file.separator":
case "java.class.version":
case "file.encoding":
case "java.compiler":
case "user.timezone":
case "user.country":... |
01f85eca-49ec-4016-b4cd-ad21eb6c94bc | 0 | public String getLabel() {
return label;
} |
3c5f24a4-4e27-49e6-836d-1ecdd2b77858 | 5 | public LookupSwitchInsnNode(final LabelNode dflt, final int[] keys,
final LabelNode[] labels) {
super(Opcodes.LOOKUPSWITCH);
this.dflt = dflt;
this.keys = new ArrayList(keys == null ? 0 : keys.length);
this.labels = new ArrayList(labels == null ? 0 : labels.length);
if (keys != null) {
for (int i = 0; i... |
5ec85644-302e-4e79-a80d-e61b6d96ae6f | 9 | public Object getValueAt(int rowIndex, int columnIndex) {
if (dados != null && rowIndex < dados.size()) {
Cad_Produto_TO e = (Cad_Produto_TO) dados.get(rowIndex);
if (columnIndex == 0) {
return e.getTxt_produto();
}
if (columnIndex == 1) {
... |
ae8fc116-1723-4b97-8366-34b8f0a683cc | 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 fe... |
e96e3b36-386a-430a-9e96-499c051aa24c | 7 | private CompanyCollection readAllCompaniesFromFile()
{
CompanyCollection allCompanies = new CompanyCollection();
try
{
CsvReader csvReader = new CsvReader(sourceFile);
if(csvReader.readHeaders() == true)
{
while(csvReader.readRecord()==true)
{
//apar_id,apar_name,address,place,province,Cou... |
eb1af88b-c94f-4a64-bfe7-d845a4cce7eb | 2 | public static void main(String[] args) {
List<Integer> list = new ArrayList<>();
for (int i = 0; i < 100; i++) {
list.add((int) (Math.random() * 100));
}
Collections.sort(list);
System.out.println("Sorted Array: " + list);
int testNumber = 10;
int index = Collections.binarySearch(list, testNumber);
... |
66c2ec0c-473a-4d31-84bb-1a8bbe357e14 | 8 | public void simular(){
int i=0;
do{
if(te[0]<tr){ //CASO 1
t=te[0];
r=r+1;
if(r==s+1){
T=t;
System.out.println("\nEl sistema FALLO en instante "+T);
Syste... |
99fc06bb-7b98-43ec-9dc8-3136b120956c | 1 | private float getValueAsFloat(String value, float defaultFloat) {
try {
return Float.valueOf(value);
} catch(NumberFormatException e) {
e.printStackTrace();
}
return defaultFloat;
} |
0df6e09d-196a-4579-bd69-9e7ee4853cc9 | 6 | public void searchRoundTripFlights() {
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
System.out.println("Where is your MySQL JDBC Driver?");
e.printStackTrace();
}
PreparedStatement ps = null;
Connection c... |
b2246ff7-c926-436b-b536-d604cb6e1e04 | 8 | public float unitize()
{
assert (vertices != null);
float maxx, minx, maxy, miny, maxz, minz;
float cx, cy, cz, w, h, d;
float scale;
/*
* get the max/mins
*/
maxx = minx = vertices[3 + 0];
maxy = miny = vertices[3 + 1];
maxz = minz... |
3eed1db1-e2c1-46e2-af75-dffb3dba904d | 7 | public void saveAsIco(OutputStream out) throws IOException {
byte[] buffer = new byte[16];
int count = 0;
int[] sizes = new int[] { 256, 128, 64, 48, 32, 16 };
for (int size : sizes) {
if (hasImage(size)) {
count++;
}
}
EndianUtils.writeLEShort(0, buffer, 0);
EndianUtils.writeLEShort(1, buffer, ... |
fa72b946-89a1-41fe-becc-e727d18190f5 | 0 | @Override
public String toString() {
return "fleming.entity.Sintoma[ idSintomas=" + idSintomas + " ]";
} |
4a66d8e9-6223-4272-8629-408e38c72978 | 1 | public int getIndexOfChild(Object parent, Object child) {
Iterator iter = ((TreeElement) parent).getChilds().iterator();
int i = 0;
while (iter.next() != child)
i++;
return i;
} |
1e6c0972-2f32-4d66-b123-5761b9e1e012 | 6 | public Chess1(String title){
super(title);
Dimension boardSize = new Dimension(800, 800);
layeredPane = new JLayeredPane();
getContentPane().add(layeredPane);
layeredPane.setPreferredSize(boardSize);
layeredPane.addMouseListener(this);
layeredPane.addMouseMotionListener(this);
chessB... |
87a94922-86b9-455a-b1c5-c306259b57ed | 0 | private int calculateNewDelay()
{
//core.setMessageDelay((long)(500/(1+500*Math.pow(2, messagesQueue.size() * 2))));
return (int)(500/(1+500*Math.pow(2, messagesQueue.size() * 2)));
} |
c292fab4-3274-4bbf-ba73-2cc50661d970 | 5 | public boolean disparar() throws ExceptionDisparo{
Logger.log(LogLevel.DEBUG, "Mina Retardad["+this.getPosicion().getX()+","+this.getPosicion().getY()+"]: turnos restantes: " + retardo);
if (this.retardo-- <= 0){
ArrayList<Posicion> posiciones = radioPosicion(posicion, this.radio);
ArrayList<Nave> naves;
i... |
2b89f5ac-bfe8-4330-9395-7ca90f2efa8b | 3 | @Override
public List<Funcionario> listAll() {
Connection con = null;
PreparedStatement pstm = null;
ResultSet rs = null;
List<Funcionario> funcionarios = new ArrayList<>();
try {
con = ConnectionFactory.getConnection();
pstm = con.prepareStatement(L... |
0c90d08b-e89d-4f82-b303-1a777f9255fe | 0 | StarSystem(Ticker ticker) {
super(ticker);
world.setAmbientLight(100, 100, 100);
world.getLights().setRGBScale(Lights.RGB_SCALE_2X);
adapter = new AdapterPhysics(world);
} |
553b9c1e-16ab-4125-9db0-d2e8c1597452 | 5 | public int getNumAreaAtPosition(int x, int y) {
if (y > 660) {
return -1;
}
int widthWindow = AppliWindow.getInstance().getWidth();
int heightWindow = AppliWindow.getInstance().getHeight();
int xMap = x * this.widthMap / widthWindow;
int yMap = y * this.heightMap / heightWindow ;
if(xMap<0 ... |
8556c2f4-0495-4535-b2f4-0abef6c2a7b8 | 0 | @Test
public void runTestAnonymousClass1() throws IOException {
InfoflowResults res = analyzeAPKFile("Callbacks_AnonymousClass1.apk");
Assert.assertNotNull(res);
Assert.assertEquals(1, res.size()); // loc + lat, but single parameter
} |
5705b7ed-d0df-4480-b27f-d302f05ffd95 | 7 | public static ArrayList<Polygon> getPolygonList()
{
try{
SAXBuilder sxb = new SAXBuilder();
try
{
// File reading
Document xmlFile = sxb.build("dbPattern.xml");
Element racine = xmlFile.getRootElement();
String patternName, position;
ArrayLi... |
c4242944-05b4-466a-a951-58ca556bc24d | 9 | public byte[] getConsensusSequence() {
if (consensusPos!=-1) getConsensusBreakpointPosition();
StringBuilder consensus = new StringBuilder();
int pos = matrixStart;
for (int[] vote : votingMatrix) {
if (((increment==-1) && pos > consensusPos) || ((increment==1) && pos < consensusPos)) {
pos += increme... |
e489adb5-6926-45df-96aa-f151a97d7e4d | 8 | public void draw(BufferedImage canvas, boolean drawEdge, boolean drawCorners)
{
for (int y = 2; y < _height-2; y++)
for (int x = 2; x < _width-2; x++)
{
if (_image[y][x] == FILLED)
{
canvas.setRGB(x + _left, y + _top, ImageSegmenter._drawColor[_type]);... |
a6416565-986f-4832-b1d7-13c65cec00a9 | 4 | public static void main(String[] args)
{
if (args.length > 1)
{
try
{
BufferedImage image = ImageIO.read(new File(args[0]));
if (image != null)
{
ASCIIfier asciifier = new ASCIIfier(image);
if (args.length > 2)
{
float fontSize = ... |
623ec23e-416c-40d7-8e0d-6938819fc140 | 9 | public List<T> getVoisinsNonNull(T[][] locations, int posX, int posY) {
List<T> voisins = new ArrayList<T>();
for (int i = ((posY - 1) < 0 ? 0 : posY - 1); i <= posY + 1
&& i < locations.length; i++) {
for (int j = ((posX - 1) < 0 ? 0 : posX - 1); j <= posX + 1
&& j < locations[0].length; j++) {
if ... |
51393243-0443-4593-a46f-7d19affd160d | 1 | private void jButtonClientAjouterMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButtonClientAjouterMouseClicked
String nom= jTextFieldClientNom.getText();
String prenom= jTextFieldClientPrenom.getText();
String email= jTextFieldClientEmail.getText();
Vil... |
9060cefc-f704-49f2-a9df-4c35f0dc85d1 | 5 | public static void main(String[] argv)
{
// Retrieve command line arguments
if (argv.length < 2) {
System.out.println("java DBEmployeeServer <EmployeeSurname> <EmployeeObjectName>");
return;
}
Connection db... |
d1ba9b5c-8504-470a-8f54-34d3671de71e | 5 | void processaDefunto()
{
int i, j;
for(i = 0; i < l; i++)
for(j = 0; j < c; j++)
if((mapa_atual[i][j].tipo == DEFUNTO)&&((mapa_prox[i][j].tipo == DEFUNTO)||(mapa_prox[i][j].tipo == NADA)))
{
//if(--mapa_atual[i][j].vida == 0)
// mapa_prox[i][j] = new Celula(NADA,0);
//else
mapa_prox... |
efe52901-8921-4c5d-908f-2addc54d8c38 | 2 | private void findMax() {
int m = 0;
for (int i = 1; i < array.length; ++i) {
if (array[i].getValue().compareTo(array[m].getValue()) > 0) {
m = i;
}
}
max = array[m];
} |
ccafe929-4824-4f55-899f-23d12e7089f0 | 5 | * @return True if it is, false if not.
*/
private boolean isEndingPunctuation(char input){
return input == '.' || input == '!' || input == '?' || input == ';' || input == ':' || input == '|';
} |
bd076614-7505-4ac0-9807-61552807f714 | 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... |
806b5488-8f28-42bf-ac95-96ae50e9c233 | 8 | public String toString() {
return (userID == null ? "" : userID + ", ") + (firstName == null ? "" : firstName + " ")
+ (lastName == null ? "" : lastName) + (klass == null ? "" : ", " + klass)
+ (institution == null ? "" : ", " + institution) + (state == null ? "" : ", " + state)
+ (country == null ? "" : ... |
b783fceb-fa19-40f0-8bc1-52fdca307981 | 2 | @Override
public PastMeeting getPastMeeting(int id) {
Meeting returnMeeting = getMeeting(id);
if(returnMeeting != null) {
if(returnMeeting.getDate().after(timeNow())) {
throw new IllegalArgumentException();
} else {
return (PastMeetingImpl) ret... |
50704651-52a4-49a2-86e3-9f51dcb6ddb7 | 9 | @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 Mark)) {
return false;
}
Mark other = (Mark) object;
if ((this.idMark == null && other.idMark != null) || (this... |
5a740525-cdf6-4b62-b43f-2b6058c8e765 | 6 | public static final void setMaximumPrecision(int p)
{
if(p == currMpipl)
return;
currMpipl = p;
mpmcr=MPMCRX;
mpird=1;
mpipl = currMpipl;
mpiou = 56;
mpiep = 10 - mpipl;
mpwds = (int)((mpipl / 7.224719896) + 1);
mp2 = mpwds + 2;
mp21 = mp2 + 1;
mpoud = mpio... |
9bc6e692-cd02-469d-a635-cf5b0ceb2e6a | 5 | private ArrayList<Operadores> getListaOperadores() {
int usados = NUMEROS.size() - 1;
ArrayList<Operadores> operadores = new ArrayList<>();
for (int i = 0; i < usados; i++) {
int operador = NumeroAleatorio.generaNumero(1, Operadores.values().length);
if (Operadores.SUMA.g... |
228ca073-1d1b-456b-9fa0-148af22d601d | 1 | void skipUntil(String delim) throws java.lang.Exception
{
while (!tryRead(delim)) {
readCh();
}
} |
756f08a6-447c-4451-98f5-2ad198d602ac | 1 | public void setupVertices(int width, int height) {
// We'll define our quad using 4 vertices of the custom 'TexturedVertex' class
VertexData v0 = new VertexData(); {
v0.setXYZ(0, 0, 0);
v0.setRGB(1, 0, 0);
v0.setST(0, 0);
}
VertexData v1 = new VertexData(); {
v1.setXYZ(0, height, 0);
v1.setRGB(0,... |
bfa12478-f04a-4e48-b7e6-b72d9babcbdf | 4 | private String getLabelString() {
// Assumes relocation labels at beginning of instruction (in first path)
String label = null;
boolean foundLabel = false;
for (ArrayList<String> path : legitAssemblyOpTreePaths) {
for (String term : path) {
if (term.equals("LABEL"))
foundLabel = true;
if... |
ef2ea814-6181-46c4-a8b7-b154fa267947 | 8 | public synchronized void FileReader(){
String filePath = "C:/JavaFiles/QuizManager/QuizMasterFile.csv";
String playerFilePath="C:/JavaFiles/QuizManager/Players.csv";
String resultFilePath = "C:/JavaFiles/QuizManager/Results.csv";
File file = new File(filePath);
File playerFile = new File(playerFilePath);
... |
420129be-d7dc-45d8-8535-ddfd458f1a63 | 1 | private static ArrayList<Character> rollCharacters()
{
// TODO create 100 Random Characters
// The Race's assigned should be pretty random
// Each Character's
// level must be 1-85
// strength, 0-100
// armour, 0-100
// find and fix the bug
ArrayList<Character> retval = new ArrayList<Cha... |
afb10a3b-23e0-437d-b93e-88c6df376d47 | 5 | private void distinguishTour(SessionRequestContent request) {
List<Tour> list = (List<Tour>) request.getSessionAttribute(JSP_TOUR_LIST);
String selectId = request.getParameter(JSP_SELECT_ID);
Integer idTour = null;
if (selectId != null) {
idTour = Integer.decode(selectId);
... |
f5a7fde4-6bd0-4bd2-a14f-6436359c95bd | 7 | final void addDisturbance(int radius, int chunkX, int chunkY, int chunkZ, double xVel, double yVel, double zVel)
{
// Limited to below the surface layer and above the thermocline layer
// For each depth in the range
for (int y = Math.max(1, chunkY - radius); y < Math.min(ySize - 2, chunkY + radius); y++)... |
75b46424-c935-483b-a159-00294200466a | 2 | private void afficherComptesRendus(){
if (ctrlMenu == null) {
VueMenu vueM = new VueMenu(ctrlA);
ctrlMenu = new CtrlMenu(vueM, vueA);
}
if (ctrlComptesRendus == null) {
VueComptesRendus vueCR = new VueComptesRendus(ctrlA);
ctrlComptesRendus = new C... |
cf7073dc-f151-40ee-a3a3-46b92baddcb8 | 1 | public void start() {
// 下面的代码都是可以直接在Netty的官网里看到的,不仔细注释
_factory = new NioServerSocketChannelFactory(
// TODO: 需要写性能测试用例已验证cached thread pool是否够用?
Executors.newCachedThreadPool(),
Executors.newCachedThreadPool());
ServerBootstrap bootstrap = new ServerBootstrap(_factory);
bootstrap.s... |
0301c44e-421f-44c8-84f7-cf67e77f5d0b | 1 | private static void allSizes(String name, int children, MonteCarloNpv npv, StopWatch sw) {
int[] chunkSizes = { 100, 500, 1000, 2000 };
for (int i : chunkSizes) {
oneSize(name, children, i, npv, sw);
}
} |
85ba31e8-b14e-45f5-8dd1-3fedd960cc26 | 3 | private List<IArticle> loadArticles(Reader articlesFile) throws IOException {
List<IArticle> result = new ArrayList<>();
BufferedReader in = new BufferedReader(articlesFile);
String line;
while ((line = in.readLine()) != null) {
if (!EMPTY_LINE_PATTERN.matcher(line).matches()... |
a7904974-a5d3-4ae5-91a8-81c1a3a12288 | 0 | public void setColsCount(int colsCount) {
m_colsCount = colsCount;
fitVectorsToSize();
} |
7a60f639-1fbb-4ed4-a429-c7065743060f | 7 | public void removeRunningTask(Task task) {
for(Task t:taskQueue){
if(t.getJob().getID() == task.getJob().getID() && t.getTaskID() == task.getTaskID()){
if(t instanceof MapperTask &&task instanceof MapperTask)
taskQueue.remove(t);
if(t instanceof ReducerTask &&task instanceof ReducerTask)
taskQueu... |
04d7719a-00f3-403a-a45b-dabc1e5f91f6 | 5 | public int getPaintImageIndex(int[][] currentBlockArray, BufferedImage[] images, int x, int z, int xMin, int xMax, boolean bottomLevel) {
int[][] pixels = null;
int i = -1;
int fit = 0;
int count = 0;
do {
i = Rand.getRange(0, images.length-1);
pixels = ge... |
c407c5e8-53c6-4d15-8107-8fea42615bbb | 6 | private static String filterToken(String s, int start, int end) {
StringBuffer sb = new StringBuffer();
char c;
boolean gotEscape = false;
boolean gotCR = false;
for (int i = start; i < end; i++) {
c = s.charAt(i);
if (c == '\n' && gotCR) {
// This LF is part of an unescaped
// ... |
b7ad6df5-1b94-4fcc-8eeb-6d1b5fe63263 | 0 | public boolean isEmpth()
{
return queueList.isEmpty();
} |
07e73bc7-491f-4018-ba45-b1af6dcd0e08 | 2 | private List<ProtectionEntry> listAllDependingEntries(ProtectionEntry entry, ConnectionWrapper cw) throws SQLException
{
List<ProtectionEntry> res = dependingCache.get(entry);
if (res==null)
{
res = new ArrayList<ProtectionEntry>();
StringBuilder statement = new StringBuilder(100);
statement.append("SE... |
e91f26fe-8448-4820-b25a-e18749ab96c6 | 0 | public TransitionExpanderTool(AutomatonPane view, AutomatonDrawer drawer,
ConversionController controller) {
super(view, drawer);
this.controller = controller;
} |
23540b07-08ff-4f03-afe5-a2e14c3a160a | 5 | public boolean hasAlias(String alias) {
if (alias.equalsIgnoreCase(cmdName))
return true;
if (aliases == null || aliases.length == 0)
return false;
for (String s : aliases) {
if (alias.equalsIgnoreCase(s))
return true;
}
return false;
} |
a43bf089-37e9-4515-8748-df415b06db4d | 8 | private void playGame(Player player, Dealer dealer) {
String inputVal = "";
System.out.println(Constants.WELCOME_MESSAGE);
while (true) {
if (player.getNumChips() >= Constants.MIN_BET_CHIPS) {
System.out
.println(Constants.BET_MESSAGE + player.getNumChips());
inputVal = inputScanner.nextLine();
... |
004af1dd-10e7-421f-aab9-1fede4a28389 | 8 | private void manageGameStartMessage(int senderID, GameStartMessage msg) {
if (gameServer == null) {
console.displayMessage("Got game start message but game server is null. Dropping message.");
return;
}
for (int i = 0; i < clients.size(); i++) {
if (clients.get(i).getID() == senderID) {
//Client has ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.