method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
aba654d0-0e5b-4f39-8e2f-791d0cf6a499 | 3 | public void cambiarPosicionJugado2(){
for(int x=0;x<8;x++){
for(int y=0;y<8;y++){
if(pd.mapa_jugador2[x][y].equals(codigo))
pd.mapa_jugador2[x][y]="";
}
}
int x=rd.nextInt(0)+7;
int y=rd.nextInt(0)+7;
cam... |
92519494-0638-4a36-be3b-1dc28163d506 | 1 | public static Model2D loadModel(String ref) {
Model2D model = models.get(ref);
if (model != null) {
return model;
}
model = new Model2D(new String[]{ref});
models.put(ref, model);
return models.get(ref);
} |
1b1e919a-9fda-4c86-b0e8-4446fc3e0752 | 0 | @Before
public void setUp() throws Exception
{
} |
d7837df4-7ab1-438b-b5de-49345921c816 | 0 | public String getMethodName(){
return "按姓名逆序";
} |
43a9f614-f288-4d33-ba98-e9f03d80dce7 | 3 | public static void main(String[] args) {
Population p = new Population(5,10);
Config g = new Config();
g=g.getInstance();
double[] insertChances = {1,0,0,0,0};
Mutation insert = new Mutation(insertChances);
double[] swapChances = {0,1,0,0,0};
Mutation swap = new Mutation(swapChances);
double[] ... |
e947c8b5-3249-434d-aa7b-89ac4be20767 | 0 | public void setNomcommercial(String nomcommercial) {
this.nomcommercial = nomcommercial;
} |
cb9f3109-c59f-431e-8a0e-22378e5b5713 | 1 | public PrintElementSetupPanel () {
super (new BorderLayout());
add (new JLabel ("Formularelemente"), BorderLayout.NORTH);
componentPanel = new JPanel (new GridLayout (0, 1));
for (int i = 0; i < PrintElementSetupList.PARA_COUNT; i++) {
componentPanel.add(new PrintElementPanel(MainWindow.setupData... |
a19f783d-c26c-4f54-874e-e6f6e6295f6f | 1 | public List<Actividad> ObtenerActividad(String consulta){
List<Actividad> lista=new ArrayList<Actividad>();
if (!consulta.equals("")) {
lista=cx.getObjects(consulta);
}else {
lista=null;
}
return lista;
} |
b3c04e55-b62e-4a95-8831-2f05e61c4710 | 9 | public static String validateDate(String date) {
if (date.toLowerCase().equals(TODAY_CHECK)) {
DateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
Date currDate = new Date();
return dateFormat.format(currDate);
} else if (date.toLowerCase().equals(TOMORROW_CHECK)) {
DateFormat dateFormat = new Si... |
65da65f8-8fb2-4449-b7a8-abbec9723241 | 3 | public boolean writeMsg (String sender,String message) {
DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
Calendar cal = Calendar.getInstance();
String date = " Sent on-" + dateFormat.format(cal.getTime());
String text = message;
String Msg = sender + ": " + text + date;
... |
acbf6020-41f4-4a4e-86bc-16eddc22e85e | 3 | private net.sf.ehcache.Cache doGetCache(String cacheName) {
net.sf.ehcache.Cache rawCache;
if (this.cacheManager.cacheExists(cacheName)) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("使用已有EHCache缓存[" + cacheName + "]");
}
rawCache = this.cacheManager.getCache(cacheName);
} else {
if (LOGGER.isDebu... |
62a53cc3-651e-4f79-845b-28a6f894491e | 6 | private void processTimeSeries(String itemName, byte[] rowbytes)
{
try
{
_series.decode(itemName, rowbytes);
if (_first)
{
_first = false;
String[] rics = _series.getRics();
int[] sampleCounts = _series.getSampleCoun... |
d4b2ff6c-388e-47e2-97c4-9d2010dba327 | 5 | protected Behaviour nextAssault() {
if (! (mind.home() instanceof Venue)) return null ;
final Venue lair = (Venue) mind.home() ;
final Batch <Venue> sampled = new Batch <Venue> () ;
world.presences.sampleFromKey(this, world, 10, sampled, Venue.class) ;
final int SS = World.SECTOR_SIZE ;
Ven... |
509187d8-e2ee-44be-b3dc-b5134bee5f66 | 4 | public void close ()
{
if (in != null) {
try { in.close (); } catch (IOException e) { }
in = null;
}
if (out != null) {
try { out.close (); } catch (IOException e) { }
out = null;
}
} |
15f61948-5536-4608-bab6-2fcd751aa34f | 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... |
bf07ddfc-6580-46d5-ae46-79f4e836457c | 9 | @Override
public void execute() throws CommandException {
if (args.size() <= 0) sendClickCommandUsage();
ClickParam param = null;
for (ClickParam p : ClickParam.values()){
if (p.name().equalsIgnoreCase(args.get(0))){
param = p;
break;
... |
d9bba20d-6581-45f7-8c93-a30cf620db66 | 3 | private void register(Path dir) throws IOException {
WatchKey key = dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE,
ENTRY_MODIFY);
if (trace) {
Path prev = keys.get(key);
if (prev == null) {
System.out.format("register: %s\n", dir);
} else {
if (!dir.equals(prev)) {
System.out.format("up... |
07e5bc1f-cbb4-48a5-897a-f2cc512f4262 | 8 | public void saveFile(TravelFileBean file) throws Exception{
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "insert into travelfile values(travelfile_fileid_seq.nextval,?,?,?,?)";
try {
conn = getConnection();
pstmt = conn.prepareStatement(sql);
pstmt.set... |
9eccbae4-a0c8-4c97-8d5f-8eb34f174cd2 | 8 | @Override
public void ancestorRemoved(AncestorEvent event) {
Integer numberOfRounds;
try {
numberOfRounds = Integer.parseInt(getNumberOfRoundsTextField().getText());
} catch (NumberFormatException e) {
numberOfRounds = null;
}
if (numberOfRounds != null) {
settingsManager.setBattleDefaultNu... |
4c6e09e1-5a26-4a36-9c4d-40aec7db78f5 | 2 | public List<Cliente> listarTodos()throws ErroValidacaoException, Exception{
try{
PreparedStatement comando = conexao
.getConexao().prepareStatement("SELECT c.id as idcliente, p.id as "
+ "idpessoa,p.nome,p.cpf,p.rg,p.data_nascimento FROM pessoas p INNER "
... |
ba729a85-15cd-4b31-88cf-4e628c7183f8 | 4 | public static void shuffleSubArray(int[] array, int subArrayLength) {
if (subArrayLength == 0) return;
int subArrays = array.length / subArrayLength;
for (int subArraysNum = 0; subArraysNum < subArrays; subArraysNum++) {
int subArrayEndIndex = (subArraysNum+1)*subArrayLength;
int subArrayStartIndex = su... |
2c0ff478-1032-4ada-ae45-82a2a76337ab | 8 | protected double calcPower(Enemy target,MoveType aimType, double distance){
double powerFromScore = 3.0*aimType.score/PERFECT_SCORE;
double powerFromDistance = 0.0;
if ( distance < 80 ) {
powerFromDistance = 3.0;
//@@@
}else if ( distance < 200 ) {
powerFromDistan... |
33afc409-0cb4-4c6f-aa20-c42f5dcf19fb | 5 | String alignmentString (int align) {
switch (align) {
case SWT.LEFT: return "LEFT";
case SWT.RIGHT: return "RIGHT";
case SWT.TOP: return "TOP";
case SWT.BOTTOM: return "BOTTOM";
case SWT.CENTER: return "CENTER";
}
return "DEFAULT";
} |
f3a09a9c-21d7-4d67-adb7-16795b7c71da | 0 | public JButton getjButtonDetails() {
return jButtonDetails;
} |
c6387458-8a08-4230-8092-859d22636569 | 4 | public static CSProperties fromTable(CSTable t) {
BasicCSProperties p = new BasicCSProperties();
Map<Integer, List<String>> table = new HashMap<Integer, List<String>>();
for (int i = 1; i <= t.getColumnCount(); i++) {
table.put(i, new ArrayList<String>());
}
for (St... |
c12499b0-7b3b-49e8-b0ac-e70bd4384ef3 | 3 | void readNum(char c) {
if (readN) {
if (n < 0) {
n = c - '0';
d = -1;
} else {
n = ((n * 10) + c) - '0';
}
} else {
if (d < 0) {
d = c - '0';
} else {
d = ((d * 10) + c) - '0';
}
}
} |
a39a0536-335a-4401-a7a1-7c08a402af79 | 5 | public void printTable() throws IOException{
System.out.println("printing the resulting expression table to " + outFile);
System.out.println("Normalize=" + normalize);
//BufferedWriter outReads = new BufferedWriter (new FileWriter(outFile));
TextFile outReads = new TextFile(outFile, true);
String cur... |
8a91533b-ca35-477b-aa66-8e2ffd3c7b2a | 2 | public List<ChatPerson> getChatPersonList() {
List<ChatPerson> list = new LinkedList<ChatPerson>();
for (ClientAgent a : handlers) {
if (a.isInChat())
list.add(a.getChatPerson());
}
return list;
} |
cba96684-0b0b-4bf1-842c-2ab94ca7b67d | 6 | public void testAvailabe(int H, int V, int A) { // H&V number want be bls of
// indH &indV A = index
if ((this.indexH + H) >= 8 || (this.indexV + V) >= 8
|| (this.indexV + V) < 0 || (this.indexH + H) < 0) {
this.availableCells[A] = null;
} // ok
else if (myBoard.bordaCell[this.indexH + H][this.indexV +... |
bf8af083-d969-41f9-9f02-33b422840852 | 1 | public void connect() {
try {
// get permit decrease the sem value, if 0 wait for release
sem.acquire();
//if doConnect throws and exception is still releases the permit
//so we use a separate method here to increase the connections count
doConnect()... |
462782d1-8bb4-4555-aa06-8c00c8db5e72 | 1 | private <C extends IContainer> C createInstanceOf(final Class<C> containerClass) {
try {
return containerClass.newInstance();
} catch (Exception e) {
throw new RuntimeException(e);
}
} |
388b6250-5477-4020-a30a-73354373f500 | 5 | public static String readPage(String url) throws MalformedURLException,
IOException {
int maxSize = 500000;
URL u = new URL(url);
URLConnection uc = u.openConnection();
if (!uc.getContentType().startsWith("text"))
return "";
InputStream is = uc.getInputStream();
BufferedReader br = new BufferedReader... |
db0d147b-8af1-4b75-ad6a-862071b78140 | 5 | @Override
public Iterable<Book> findBooks(SearchFilter filter) {
Statement stmt = null;
List<Book> books = new LinkedList<Book>();
try {
stmt = con.createStatement();
String constraints = "";
for (String attributeName : filter.getAttributeNames()) {
constraints += attributeName + " LIKE " + "'%"
... |
7baedd8d-5bf2-45ae-b842-668be2232879 | 9 | public returnTypes saveChunk(BackupChunk c) {
String recID = Packet.bytesToHex(c.getFileID());
for(BackupChunk chunk : backedUpChunks) {
String comID = Packet.bytesToHex(chunk.getFileID());
if(comID.equals(recID) && chunk.getChunkNo() == c.getChunkNo()) {
return returnTypes.FILE_EXISTS;
}
}
if(c... |
bd0a192e-cba8-4874-a0e5-4a5226679f18 | 8 | private static String escapeJSON(String text) {
StringBuilder builder = new StringBuilder();
builder.append('"');
for (int index = 0; index < text.length(); index++) {
char chr = text.charAt(index);
switch (chr) {
case '"':
case '\\':
... |
f1d28fd1-5fc1-46ab-9332-d83b56e5e2e3 | 1 | public JPanel getShortMsgChangesMenu() {
if (!isInitialized()) {
IllegalStateException e = new IllegalStateException("Call init first!");
throw e;
}
return this.shortMsgPanel;
} |
8b0cae1a-35dc-4572-91b9-8e33652fba73 | 7 | public ArrayList<String> CMBDepartamento(String CodDepartamento) throws SQLException {
ArrayList<String> Departamentos = new ArrayList<>();
Connection conexao = null;
PreparedStatement comando = null;
ResultSet resultado = null;
try {
conexao = BancoDadosUtil.getCo... |
600d81d7-51a2-4a43-850c-1153984aa68a | 3 | @Override
protected int onReadPacketHeader( ByteBuffer in )
{
if (in.remaining() < HEADER_SIZE)
{
return ON_READ_REWIND;
}
int magicNumber = in.getInt();
if (magicNumber != protocol.getMagicNumber())
{
return ON_READ_CLOSE... |
c3300781-bc8d-462b-bf94-2dee9955ec21 | 7 | public void draw(Graphics2D g2, int zoomFactor) {
float dash1[] = {4.0f};
Stroke oldStroke=g2.getStroke();
BasicStroke bs = new BasicStroke(1.0f, BasicStroke.CAP_BUTT,
BasicStroke.JOIN_MITER, 3.0f, dash1, 0.0f);
if (type == TYPE_RECT) {
int x=(int)rect.getX()*... |
bd2f615d-b7af-498f-aa69-9e72bb7af639 | 4 | public String urlparse(HashMap<String,String> items){
String data = "";
try {
for ( final Map.Entry<String, String> entry : items.entrySet() ){
final String key = entry.getKey();
final String val = entry.getValue();
if(data.equals("")){
data = URLEncoder.encode(key, "UTF-8") + "=" + URLEncoder.e... |
b1e3a31f-950a-4ed0-a1f6-e78b4201ad83 | 6 | public static <GItem> Comparator<Iterable<? extends GItem>> iterableComparator(final Comparator<? super GItem> comparator) throws NullPointerException {
if (comparator == null) throw new NullPointerException("comparator = null");
return new Comparator<Iterable<? extends GItem>>() {
@Override
public int compa... |
ca722928-6379-467a-9e73-69c4e74ce6ae | 0 | private Trees() {
} |
259e3eaa-f549-4be6-b297-27653af7ad87 | 0 | public void setOnline(String online) {
this.online = online;
} |
671b3d00-8022-4997-8799-35f1770b9082 | 6 | public void take(String[] split)
{
if (split.length != 5)
{
PrintMessage(TAKESYNTAX);
return;
}
Player receiver, giver;
receiver = getPlayer(split[2]);
if(receiver == null)
{
PrintMessage(split[2] + " does not exist");
return;
}
giver = getPlayer(split[4]);
if(giver == nul... |
cb313a71-ee6a-41e4-9734-f0aad2bf7556 | 8 | private void doSelection(int mode){
clipboard.setSetting(setting);
int mouseX1 = Math.min(mouseX, mouseInitX) - sequencePanel.getX();
int mouseX2 = Math.max(mouseX, mouseInitX) - sequencePanel.getX();
for(Component c : sequencePanel.getComponents()){
if(c instanceof ActionPanelFX){
ActionPanelFX panel =... |
bcca091f-e35a-4abc-8a0b-4ee37975ba8a | 0 | public void setKeyInfo(KeyInfoType value) {
this.keyInfo = value;
} |
d8a4b92f-0b25-4d95-a55b-726670ac6ff5 | 2 | public int mostConnections() {
int x = 0;
int biggest = 0;
for (int i = 0; i< n; i++) {
if (adj[i].size() > x ) {
x = adj[i].size();
biggest = i;
}
}
return biggest;
} |
59470de3-2d55-42c6-b4b0-e5029cb73548 | 9 | public void DBUpdateTheseItems(Room room, List<Item> items)
{
if((!room.isSavable())||(room.amDestroyed()))
return;
if(Log.debugChannelOn()&&(CMSecurity.isDebugging(CMSecurity.DbgFlag.CMROIT)||CMSecurity.isDebugging(CMSecurity.DbgFlag.DBROOMS)))
Log.debugOut("RoomLoader","Start item update for room "+room.ro... |
d4651def-bf7d-4c6c-9252-91845a796f24 | 1 | public BrandingPreview(SkinPropertiesVO skin, JPanel parent) {
if (skin == null) {
IllegalArgumentException iae = new IllegalArgumentException("Wrong parameter!");
throw iae;
}
this.skin = skin;
this.parent = parent;
} |
74229068-68b0-418b-88e3-bac928202f5f | 0 | @BeforeTest
public void setup() {
addressBook = "src/test/resources/address_book.csv";
} |
a80e7a2f-fac3-4c1d-854e-633e015fad6e | 1 | @Override
public List<ValidateException> validate(String parameter) {
final int maxLastNameLength = 30;
List<ValidateException> validateExceptionList = new LinkedList<>();
if (!ValidateUtils.stringMaxLengthValidation(parameter, maxLastNameLength)) {
String exMsg = "entered quite... |
33b1e04c-9b76-4e51-b9ac-75e835720621 | 9 | private void mapExecutable(ExecutableMemberDoc em) {
Parameter[] params = em.parameters();
boolean isConstructor = em.isConstructor();
List<Type> classArgs = new ArrayList<Type>();
for (int k = 0; k < params.length; k++) {
Type pcd = params[k].type();
// primitive... |
a041cee1-a3ea-4d3a-a6b8-9c39e9cb7739 | 4 | public void setPitch(String sourcename, float value) {
if (!midiSourcename(sourcename)) {
Source mySource = sourceMap.get(sourcename);
if (mySource != null) {
float newPitch = value;
if (newPitch < 0.5f)
newPitch = 0.5f;
else if (newPitch > 2.0f)
newPitch = 2.0f;
mySource.setPitch(new... |
e2d4c5a4-aa2b-4e50-a63d-c60b66d4607f | 7 | @Override
public AbstractComponent parse(String string) throws BookParseException {
if (string == null) {
throw new BookParseException("String is null");
}
try {
TextComponent component = (TextComponent) factory
.newComponent(EComponentType.TEXT);
String listing = null;
boolean isListing = false... |
f4d05085-dc38-4da1-a568-449c4ba01d74 | 1 | double normdistForBestPoint() {
double normalDistance = 0;
for (int i = 0; i < numOfParams; i++) {
normalDistance += Math.abs(pointsX[0][i] - initialPoint[i]) / bound[i];
}
normalDistance = normalDistance / numOfParams;
return normalDistance;
} |
cf27d497-beee-4707-b496-d448731dfd52 | 3 | @Override
public Map<Class<?>, String> getDatatypeMappings() {
Map<Class<?>, String> mappings = new HashMap<Class<?>, String>();
mappings.put(String.class, "VARCHAR");
mappings.put(Long.class, "BIGINT");
mappings.put(Integer.class, "INTEGER");
mappings.put(Boolean.class, "BOOLEAN");
mappings.put(Date.cl... |
7f6bd65d-03b7-4cf5-b287-0ac69a3f2c13 | 5 | @Override
public AbstractAction getNextAction() {
AbstractAction action = null;
if (!interruptAction.isEmpty()) {
action = interruptAction.remove();
}
if (action == null && !todoList.isEmpty()) {
action = searchIn(todoList);
action = pollAction(todoList, action);
}
if (action == null && !actionPoo... |
2d9e09b1-62f6-4007-ab01-24a2ef6b9e6a | 6 | static OptionParserState moreOptions( final boolean posixlyCorrect ) {
return new OptionParserState() {
@Override
protected void handleArgument( OptionParser parser, ArgumentList arguments, OptionSet detectedOptions ) {
String candidate = arguments.next();
... |
c152ce17-033c-4588-9112-334af022329b | 4 | public boolean placeNumber(int row,int col, int val) {
if(checkRow(row,val) && checkColumn(col,val) && checkSquare(row,col,val))
{
if(b[row][col] == 0)
this.filledFields++;
b[row][col] = val;
return true;
}
return false;
} |
27f0f8c3-b901-4fd8-a876-29908e5dc6a0 | 5 | private void setatime(int atime) {
int am;
String unit;
if (atime > (604800 * 2)) {
am = atime / 604800;
unit = "week";
} else if (atime > 86400) {
am = atime / 86400;
unit = "day";
} else if (atime > 3600) {
am = atime / 3600;
unit = "hour";
} else if (atime > 60) {
am = a... |
55a00b79-a881-41b8-aab4-f6d8edcd0e32 | 7 | @Override
public ParameterizedCompletionInsertionInfo getInsertionInfo(
JTextComponent tc, boolean replaceTabsWithSpaces) {
ParameterizedCompletionInsertionInfo info =
new ParameterizedCompletionInsertionInfo();
StringBuilder sb = new StringBuilder();
char paramListStart = getProvider().getParameterListS... |
844b2afb-dbd3-41ca-ae70-f3e1fcce3463 | 9 | @Override
public void marshal(Element e, Document doc) {
super.marshal(e, doc);
String xns = NS.XLINK.ns(); // to keep lines short.
if (this.xlinkType != null) {
Attr xtype = doc.createAttributeNS(xns, "xlink:type");
xtype.setNodeValue(this.xlinkType.value());
... |
ca6ffdec-58ec-4648-9ced-fc9e4d8d2481 | 7 | public boolean activeP() {
{ Slot slot = this;
return (((((BooleanWrapper)(KeyValueList.dynamicSlotValue(slot.dynamicSlots, Stella.SYM_STELLA_STORED_ACTIVEp, null))) != null) ? BooleanWrapper.coerceWrappedBooleanToBoolean(((BooleanWrapper)(KeyValueList.dynamicSlotValue(slot.dynamicSlots, Stella.SYM_STELLA_ST... |
a87be603-eab2-4c3e-a2f8-60b98d48bbb4 | 5 | public LinkedList<String> operatePhoenix(String input, String runParse, int extractFlag, File compile) {
LinkedList<String> phoenixOutput = new LinkedList<String>();
try {
Runtime rt = Runtime.getRuntime();
Process compileGra = rt.exec("tcsh compile", null, compile.getAbsoluteFile());
Buffere... |
3892421b-fdda-435e-8ece-29680af34e66 | 5 | @Override
public SoundBuffer read()
{
byte[] returnBuffer = null;
while( !endOfStream( GET, XXX ) && ( returnBuffer == null ||
returnBuffer.length < SoundSystemConfig.getStreamingBufferSize() ) )
{
if( returnBuffer == null )
returnBuffer = re... |
ac02d9fc-cd62-4af1-9f39-03da6fff79fb | 5 | public void addAll(DataModel model) {
for (Integer key : model.getKeys1()) {
String text = model.getElement(key);
int paragraph = model.getParagraphForElement(key);
Map<String, String> attributes = model.getAttributesForElement(key);
add1(text, paragraph, attributes);
}
for (Integer key : model.getKe... |
2ccfe61e-cc8e-4f02-8b2a-526b9592449b | 2 | public boolean existDijsktraNode(DijkstraNode node){//checks in the list of dijsktra node if the param is in it.
for(int i=0;i<grafo.getAllLinks().getLength();i++){
if(dijkstra_nodes.get(i).equals(node)){
return true;
}
}
return false;
} |
ce7031d3-d9e5-4b96-aa91-5440e3b30f47 | 2 | public static boolean isObjectMethod(Method method) {
try {
Object.class.getDeclaredMethod(method.getName(),
method.getParameterTypes());
return true;
} catch (SecurityException ex) {
return false;
} catch (NoSuchMethodException ex) {
return false;
}
} |
c9e70897-c2c3-48ce-994f-c2dbf8cb794e | 9 | private static void searchSubFolder( String name ){
File f = new File( name );
//Special handling for CustomObjectModule/designs/Scripts folder
String pathHandle = f.getAbsolutePath().toLowerCase();
String platformIndependent = "customobjectmodule" + File.separator + "designs"
+ File.separator + "scripts";... |
49290e74-eb44-4fad-96bc-c994571a2520 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Etat other = (Etat) obj;
if (this.id != other.id) {
return false;
}
if ((this... |
de09c842-979a-450e-aaca-ffc8b810d6ce | 5 | public void sortEmployees(String sortBy){
if (sortBy.equals("id")) {
Collections.sort(employees, new EmployeeIdComparator());
} else if(sortBy.equals("name")) {
Collections.sort(employees, new EmployeeNameComparator());
} else if(sortBy.equals("surname")) {
C... |
9c5ca2df-6a41-4f32-b379-e26c1d9cc696 | 0 | public void setUsername(String username) {
this.username = username;
} |
1e5aee62-976b-4d27-a2e9-12240452d6ef | 3 | public boolean match(FileAttribute attr) {
// check for errors first
if (attr == null || name_ == null) {
return false;
}
// check based on the file name
if (attr.getName().startsWith(name_)) {
return true;
} else {
return false;
... |
686e0d34-3ef8-4a68-8ba2-4b078c17e263 | 5 | private int randomNumber(){
Random r = new Random();
int ret = 0;
int max = 0;
if (gameValue == PLUSMINUS){
max = 3 * (maxNumber-1);
}
if (gameValue == MULITDIV || gameValue == PLUSMINUSMULTDIV){
max = (maxNumber-1) * (maxNumber-1) * (maxNumber-1);
}
for (int i=0; i < 10; i++){
ret = r.nextInt... |
60d0aa26-32b3-42a8-bd07-ba34d3356f2a | 4 | public void build() {
try {
service.build(true, true);
} catch(IOException e) {
e.printStackTrace();
}
for(ClassInfo info : service.getList()) {
if(info.isAbstract || !info.isPublic) {
continue;
}
robots.add(info);
}
} |
f0ffa32f-4ed3-465d-ad87-fa4fce3f2b88 | 7 | public void draw(Bitmap bitmap, int x, int y) {
int x0 = x;
int y0 = y;
int x1 = x + bitmap.w;
int y1 = y + bitmap.h;
if (x0 < 0) x0 = 0;
if (y0 < 0) y0 = 0;
if (x1 > w) x1 = w;
if (y1 > h) y1 = h;
int ww = x1 - x0;
for(int yy = y0; yy < ... |
eef2ebc2-46aa-4e33-b0d1-c7c1971e0c23 | 2 | public String getPhonenumberByOrdernumber(Statement statement,String ordernumber)//根据订单号获取手机号
{
String result = null;
sql = "select phonenumber from ParkRelation where ordernumber = '" + ordernumber +"'";
try
{
ResultSet rs = statement.executeQuery(sql);
while (rs.next()) {
result = rs.getString("ph... |
da9403ad-f7db-4d50-90f6-8d2c7ea898ec | 7 | protected Class<?> findImpl(final Class<T> iface) {
Package pkg = iface.getPackage();
String pkgName = (pkg != null) ? pkg.getName() : DEFAULT_PACKAGE_NAME;
String clsName = iface.getSimpleName();
Class<?> implClass = null;
// look up in the following orders
// 1. package.name.ClassNameImpl
// 2. packag... |
6e6fc8d0-f64e-4b92-8195-596eb18d2fc8 | 0 | @Basic
@Column(name = "FUN_ESTADO")
public String getFunEstado() {
return funEstado;
} |
22358c34-2bb6-4af4-bd77-079954ee6d97 | 6 | @Override
public boolean equals(Object obj)
{ if(obj instanceof List)
{ List that=(List)obj;
if(this.next==null && that.next==null)
{ return this.a.equals(that.a);}
else if(this.next!=null && that.next!=null)
{ return this.a.equals(that.a)&&this.next.equals(that.next);}
else
... |
21264155-45e3-4208-93ae-b8ddc99b1c0c | 2 | private void sendAuthors() {
for(Author author : authors) {
Response response = authorTarget
.request(MediaType.APPLICATION_JSON)
.post(Entity.entity(author, MediaType.APPLICATION_JSON));
if(response.getStatus() >= 300){
System.ou... |
a1eda3c3-0b92-454d-821f-df2c12252bbf | 1 | private void reset() {
for (int i=2; i<32; i++)
clear(i);
} |
2430df7d-8dd0-4b56-afce-047edb51f0e5 | 2 | @Override
public double[][] solve(double[] T_0, int n, double k, double u, double dt, double dx) {
double[][] ans = new double[n][];
int m = T_0.length;
ans[0] = T_0;
for (int layer = 1; layer < n; layer++) {
double[] T = ans[layer - 1];
double[] curLayer = new double[m];
for (int i =... |
28a7d2e2-d235-4701-a911-48d2f6c8aed4 | 4 | protected int parseToken(boolean eof_ok) throws ParseError {
int status;
int rc;
try {
status = st.nextToken();
} catch (Exception e) {
throw new ParseError("parseToken: st.nextToken failed");
}
s = "";
if (status == StreamTokenizer.TT_E... |
bc744357-efe7-4fd6-9452-0f1cb8f4e29e | 1 | public synchronized void start() //Use synchronized when starting thread
{
init();
if(!running)
{
running = true;
gameThread = new Thread(this);
gameThread.start();
}
} |
db7b7f25-3d05-432e-a6a8-c7462b84bc8a | 1 | private static void cleanUpChat(JTextPane box) throws BadLocationException {
StyledDocument doc = box.getStyledDocument();
String[] lines = box.getStyledDocument().getText(0, box.getStyledDocument().getLength()).split("\n");
if (lines.length <= 100)
return;
String firstLine... |
0a2f06f2-170f-4199-89d0-fa7319173dde | 9 | public String toString()
{
String s = "";
Node n = this;
while (n != null) {
s += "[Node type=";
s += nodeTypeString[n.type];
s += ",element=";
if (n.element != null)
s += n.element;
else
s += "null"... |
f81dd43a-8262-42ee-82d8-c9e376784064 | 4 | protected void disableGUI() {
buildFieldRef();
for (JComponent elem : editableElements) {
if (elem != null) {
elem.setEnabled(false);
}
}
for (JTextComponent elem : editableTextFields) {
if (elem != null) {
elem.setEditable(false);
}
}
cancelButton.setEnabled(true);
} |
06f74433-c118-4e7b-bd4c-49bd8c33d307 | 0 | public DataSet(String naam)
{
this.naam = naam;
this.categories = new ArrayList<Category>();
} |
71b69cbd-9755-4a70-a475-cdfc9a8e9d73 | 3 | public Types.ACTIONS act(StateObservation stateObs, ElapsedCpuTimer elapsedTimer) {
ArrayList<Observation>[] npcPositions = stateObs.getNPCPositions();
ArrayList<Observation>[] fixedPositions = stateObs.getImmovablePositions();
ArrayList<Observation>[] movingPositions = stateObs.getMovablePosit... |
a42e1faa-c656-4593-b80f-ca6cae0be56b | 1 | @Override
protected boolean doKeyExists(final String key) {
try {
return cache.isKeyInCache(key);
} catch (Throwable e) {
CacheErrorHandler.handleError(e);
return false;
}
} |
eeb8899f-7f27-402c-a256-59c6d3e64b4f | 4 | public static Calendar parse(String input) {
if (input == null || input.isEmpty()) {
return null;
}
Calendar result = GregorianCalendar.getInstance();
for (Entry<String, Pattern> entry : patterns.entrySet()) {
Matcher m = entry.getValue().matcher(input);
... |
de8b9d5c-753b-4220-a35a-5336f5a3ac8d | 2 | public boolean isPrimed()
{
return _redLauncher.isPrimed() || _blueLauncher.isPrimed()
|| _greenLauncher.isPrimed();
} |
16392c7e-89ed-4675-941d-36feef250339 | 4 | public void MySQLStructre(DatabaseAccess JavaDBAccess) {
Connection conn = null;
PreparedStatement ps = null;
Statement s = null;
ResultSet rs = null;
int MYSQL_QUERIES_ID = 0;
String SQL_COMMAND = "", SQL_COMMAND_STRUCTURE = "";
String[] SQL_COMMAND_STRUCTURE_VAR... |
ae1191b8-5c21-42d0-b05c-bc23074d19fc | 9 | @SuppressWarnings("unchecked")
public MemberAccessorFactory(final Class<? extends Annotation> anno_clazz) throws SecurityException, NoSuchMethodException {
Class<? extends MemberAccessor> clazz = null;
for (final Class<?> c : anno_clazz.getDeclaredClasses()) {
if (MemberAccessor.class.isAssignableFrom(c)) {... |
90380371-8ba0-4b16-9b69-bfa9aed49258 | 3 | private void remove(TileObjectDisplayData data){
if (data == selectedInfo.getDisplayData()){
unSelect();
}
TileObjectPanel panelToRemove = null;
for (TileObjectPanel panel : tileObjectPanels){
if (panel.getDisplayData() == data){
panelToRemove = panel;
break;
}
}
tileObjectPanels.remove(... |
6d6af7bc-9ad2-4aa4-a060-ab848c91d4ee | 3 | protected KeyPair createKeyPairInternal(boolean useAlgorithmSpec) throws NoSuchAlgorithmException,
KeyPairNotCreateException, InvalidAlgorithmParameterException {
KeyPairGenerator keyGen = KeyPairGenerator.getInstance(type.toString());
SecureRandom random = new SecureRandom();
if ((useAlgorithmSp... |
994023e5-1714-45d8-9ca1-7838d4928d66 | 1 | private void initComponents() {
this.setBackground(Color.black);
this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
jLabel1 = new JLabel();
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
JPanel panels[] = {jPanel1, jPanel2};
for (fina... |
cfb6f559-d3a0-4a2d-9b46-2b5bbb9bc010 | 1 | protected JPanel getFontStylePanel()
{
if (fontStylePanel == null)
{
fontStylePanel = new JPanel();
fontStylePanel.setLayout(new BorderLayout());
fontStylePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
fontStylePanel.setPreferredSize(new... |
31eb89a2-ce20-4c9d-bd9f-eec5d0d25965 | 3 | public static void main(String [] args) {
int sum = 0;
for(int i= 0; i < 1000; i++) {
if(i % 3 == 0 || i % 5 == 0) {
sum = sum + i;
}
}
System.out.println(sum);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.