method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d3f04f68-2ca7-46f9-ae7e-46041dc25217 | 8 | public Query combine(Query[] queries) {
HashSet<Query> uniques = new HashSet<Query>();
for (int i = 0; i < queries.length; i++) {
Query query = queries[i];
BooleanClause[] clauses = null;
// check if we can split the query into clauses
boolean splittable = (query instanceof BooleanQuery)... |
ce0676c4-4e8c-46ef-8c9a-c28335ff3686 | 1 | @Override
public int rowsY() {
return isNotPlayerInventory() ? 1 : 2;
} |
a571dccf-d8b2-4fa9-af9a-8eaea1849bfb | 3 | private void downloadNewPorts() {
FileOutputStream fos = null;
try {
URL website = new URL(
"http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml");
ReadableByteChannel rbc = Channels.newChannel(website.openStream());
fos = new FileOutputStream("service-names-port-... |
0ba448c2-9479-451c-adec-82c442e80bd4 | 4 | public void setBarPlayer2(JPanel panel) {
boolean test = false;
if (test || m_test) {
System.out.println("Drawing :: setBarPlayer2() BEGIN");
}
if (test || m_test)
System.out.println("Drawing:: setBarPlayer2() - END");
m_barPlayer2 = panel;
} |
286fced0-5751-4d39-93ee-b53db09bdfd0 | 9 | public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof CategoryDataset)) {
return false;
}
CategoryDataset that = (CategoryDataset) obj;
if (!getRowKeys().equals(that.getRowKeys())) {
return false;... |
c4aeda4e-d9fb-4df8-b0a3-de6131bc03aa | 6 | protected void verifySignature(RandomAccessFile randomaccessfile) throws IOException, InvalidLodFileException
{
randomaccessfile.seek(0L);
boolean matchedSignature = true;
for (int i = 0; i < SIGNATURE_NEW.length; i++)
{
int aByte = randomaccessfile.read();
if... |
33851d8b-5d97-47b4-80bc-954145727132 | 6 | @Override
/**
* Fügt dem Baum einen Wert hinzu
*/
public void addValue(Integer value) throws BinarySearchTreeException {
if (root == null) {
//Wenn es noch keinen root Knoten gibt, erzeuge diesen mit dem hinzuzufügenen Wert
root = new Node(value);
} else {
... |
8c775077-4176-4b38-b6dc-380b7487da31 | 1 | private void generateHardwareSetAlternatives() {
for (HardwareSet hws : project.getHardwareSets())
hws.generateHardwareSetAlternatives();
} |
eef83432-cd6c-4b9e-ac9c-0294e4d29983 | 0 | public void setA(float a) {
this.a = a;
} |
9b3a9396-4439-4959-b814-ebf7e8accd2c | 6 | public void setAusgewaehlt(boolean aktiv)
{
Color[] mitRaum = new Color[] { new Color(0.4f, 0.4f, 0.8f),
new Color(0.2f, 0.2f, 0.5f) };
Color[] ohneRaum = new Color[] { Color.lightGray, Color.gray };
Color[] startRaum = new Color[] { new Color(0.4f, 0.8f, 0.4f),
new Color(0.2f, 0.5f, 0.2f) };
Color[] e... |
46caa533-c5ed-414a-8d25-8d77fc47f5e2 | 0 | @Override
public void prepareSpecificMenu() {
menuPanel.setLayout(new GridLayout(100, 1, 0, 30));
JButton start = new JButton("Start");
start.setActionCommand(CMD_START);
start.addActionListener(this);
menuPanel.add(start);
} |
8a3fbd35-f754-473a-aa50-40dae2f0dfc4 | 6 | static void remakeZipEntry(String newName, File zipFile, String[] filesToDelete, String[] namesToAdd, String[] contents) throws IOException {
byte[] buf = new byte[1024];
ZipInputStream zin = new ZipInputStream(new FileInputStream(zipFile));
ZipOutputStream zout = new ZipOutputStream(new FileOutputStream(newName)... |
50e09c46-f0bf-46fd-81be-3bd6014ed87b | 0 | private static void createAndShowGUI() {
//Create and set up the window.
NodeGui frame = new NodeGui("Node Admin Console");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Set up the content pane.
frame.addComponentsToPane();
//Display t... |
8e915d97-6943-4f7d-b521-f1a3c63bc7f1 | 4 | private void memberRun() {
// setup time variables
double now = System.nanoTime(), then = now, delta = 0;
loops = 0;
double frameTimer = 0;
isRunning = true;
while(isRunning) {
now = System.nanoTime();
// We get time in a given amount of nanoseconds, we convert to seconds here.
... |
098c1b35-ed44-4a7e-86db-70d4035b22f3 | 0 | @Override
public <T extends PersistentObject> T read(Class<T> entityClass, Long id) {
return (T) dataStore.get(id);
} |
fbbceefc-375f-43c0-9c17-3b3aee14fbc2 | 9 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
String inputUsuario = textFieldIndex.getText();
int cantidadPartidasGuardadas = personajesJugables.size();
if(!(esNumero(inputUsuar... |
ef3b0de8-1d90-42b8-a306-e5f0470a75e3 | 5 | public void checkUtility(JObjective obj, JLabel lbl){
boolean has0 = false;
boolean has1 = false;
double wt[] = obj.getDomain().getWeights();
for (int j=0; j<wt.length; j++){
if (wt[j]==0.0) has0 = true;
if (wt[j]==1.0) has1 = true;
}
if (!(has0 && has1)){ //if not properly set
lbl.setForegroun... |
c10966d0-8618-4bc9-a6fb-b8e18012f92e | 2 | public String mapSignature(String signature, boolean typeSignature) {
if (signature == null) {
return null;
}
SignatureReader r = new SignatureReader(signature);
SignatureWriter w = new SignatureWriter();
SignatureVisitor a = createRemappingSignatureAdapter(w);
if (typeSignature) {
r.acceptType(a);
... |
66e05ad4-65e6-48c3-a20c-047a7bb8d5c0 | 4 | @Override
public boolean equals(Object o){
//set up a boolean to track if the objects are the same
boolean same = true;
//check if we a comparing a Chromosome object
if ( o instanceof Chromosome ){
//get the array of Genes from the object passed in
ArrayList<G... |
437908c0-88f5-407c-891b-3ebffb9cf5e8 | 0 | @Override
public boolean getIsUniqueAttribute() {
return this.isUniqueAttribute;
} |
82f59b61-7905-4b22-acdf-e3b3269e50c8 | 7 | public boolean setPlayerGroup(String world, String playerName, String group){
if(world == null || playerName == null || group == null){
return false;
}
if(!xm.getXworld().isWorld(world) || !xm.playerExists(playerName) || !xm.getXgroup().isGroup(group)){
return false;
}
xm.getUsers().get().set("users.... |
ecffbb8c-59b5-41b0-8791-6878cdb19285 | 9 | void processStereochemistry(Element subOrRoot) throws ComponentGenerationException {
List<Element> stereoChemistryElements = subOrRoot.getChildElements(STEREOCHEMISTRY_EL);
List<Element> locantedUnbrackettedEzTerms = new ArrayList<Element>();
for (Element stereoChemistryElement : stereoChemistryElements) {
if ... |
2f6ab06c-3a42-4548-8dbd-654e6bf2b59e | 4 | public void create(){
super.create();
ptclsToRemove = new ArrayList<>();
displayText = new ArrayDeque<>();
bodiesToRemove = new Array<>();
ptclsToAdd = new ArrayList<>();
particles = new ArrayList<>();
objsToAdd = new ArrayList<>();
healthBars = new HashMap<>();
objects = new ArrayList<>();
lights =... |
e9851906-48a7-42ff-b5dc-27e6fb59b832 | 6 | private void filAllFields(Component root, Class<?> clazz){
for(Field f: clazz.getDeclaredFields()){
try {
if (Modifier.isStatic(f.getModifiers()))
continue;
f.setAccessible(true);
String[] row = new String[2];
row[0]... |
8cc9fdc2-2af3-4bf1-a252-1730d050190a | 5 | public ArrayList<EndAndWeight<T>> BFSPath(T start,T end) throws EdgeVerticeNotFound{
Map<T,ArrayList<EndAndWeight<T>>> map=new HashMap<T,ArrayList<EndAndWeight<T>>>();
Queue<T> queue=new LinkedList<T>();
queue.add(start);
ArrayList<EndAndWeight<T>> startList=new ArrayList<EndAndWeight<T>>();
startList.add(... |
e0d457b7-2812-4264-a1ce-4d4aa7129452 | 6 | public static String stringPattern(String value){
String pattern = "";
for (int i = 1; i < Math.sqrt(value.length());i++){
StringBuilder strFirst = new StringBuilder("");
StringBuilder strSecond = new StringBuilder("");
StringBuilder strThird = new StringBuilder("");
for (int j = 1; j < 1*i+1;... |
633ad375-7834-4e26-a733-4f162f99813e | 4 | public Object getValueAt(int indiceLigne, int indiceColonne){
//System.out.println("ModeleListeClients::getValueAt()") ;
switch(indiceColonne){
case 0 :
return new Integer(clients.get(indiceLigne).getNumero()) ;
case 1 :
return clients.get(indiceLigne).getNom() ;
case 2 :
return clients.get(i... |
daf744e5-030a-413d-ab9b-13589ac117a6 | 6 | @EventHandler
private void onBlockBreak(BlockBreakEvent event) {
if(event.getBlock().getState() instanceof Sign) {
Sign sign = (Sign) event.getBlock().getState();
if(sign.getLine(0).equals(ChatColor.BLUE + "ColoredArmor")
&& sign.getLine(1).equals("")
&& sign.getLine(2).equals("")
&& sign.getLin... |
c36066d9-8a84-479b-8d7a-205531fb663b | 9 | public int solution(int[] A) {
if (A.length == 0) return 0;
long[] openIndexes = new long[A.length];
long[] closeIndexes = new long[A.length];
boolean[] timeLine = new boolean[A.length * 2];
for (int i = 0; i < A.length; i++) {
openIndexes[i] = i - (long) A[i];
closeIndexes[i] = i + (lo... |
a5657809-6be9-4b5c-ae34-8897a642605d | 7 | public boolean verificaCaminhoTorre(Posicao posicaoInicial,
Posicao posicaoFinal) {
/* movimento horizontal */
if (posicaoInicial.getLinha() == posicaoFinal.getLinha()) {
int colunaVariante;
int colunaInicial = posicaoInicial.getColuna();
/* verifica a po... |
46bdffbd-8338-4a16-9e8c-3dc3f93511c7 | 6 | public int[] solutionThree(int[] a, int k) throws IllegalArgumentException {
if (a == null || a.length < k) {throw new IllegalArgumentException();}
/* Define Min-PriorityQueue of Integers (MIN element always at top of Queue) */
Comparator<Integer> comp = new MinHeapComparator();
PriorityQueue<Integer> q ... |
10f6ce70-332f-4807-a386-254644af60a4 | 4 | @Override
public void setAccounting(Accounting accounting) {
journalTypes=accounting==null?null:accounting.getJournalTypes();
accountTypes=accounting==null?null:accounting.getAccountTypes();
accounts=accounting==null?null:accounting.getAccounts();
setJournals(accounting==null?null:accounting.getJournals());
} |
1aa2c5aa-19cd-4769-a6e6-3c089ee898db | 5 | public void getSuggestions(
ArrayList<ISuggestionWrapper> suggestionsWrappers,
int neededSuggestions,
double rankThreshold)
{
int numberOfUsedSuggestions = 0;
ArrayList<SuggestionCacheWrapper<IDocument>> suggestions = queryPosition.getCachedSuggestions();
... |
25a9e383-bad0-4bc7-97ca-9ae37c1d1d07 | 4 | @Override
public Object getValue(Method method, Map<Class<?>, ClassBuilder<?>> how) {
Class<?>[] parameterTypes = method.getParameterTypes();
if(parameterTypes.length == 1){
return how.get(parameterTypes[0]).build(how);
}
return null;
} |
687c323e-0eb7-4951-aecd-4d9a0b218ced | 3 | public static void paintVertexDebug(Graphics2D g, Color color, Point center, int d, int name, ArrayList<Integer> list, boolean isImportant) {
Ellipse2D.Double circle = new Ellipse2D.Double(center.x - d / 2, center.y - d / 2, d, d);
if (isImportant)
g.setColor(Color.GREEN);
else
... |
07ee0cec-dad7-4977-98d7-98295a458f31 | 5 | private static boolean validateValue(double startTime, int duration, int numPE) {
double currentTime = GridSim.clock();
boolean valid = true;
if (startTime < 0.0) {
logger.info("Error - start time should be greater or equals to zero.");
valid = false;
}
else if (dura... |
479e9a8a-60b6-4eaf-8e46-d27924b0ea6e | 8 | @Override
public boolean valid() {
if (makeSword == null) {
script.log.severe("SmithAnvil.makeSword is null!");
return false;
}
if (super.valid() && ctx.widgets.component(WIDGET_INSTRUCTION, WIDGET_INSTRUCTION_CHILD).valid()) {
if (!ctx.backpack.select().id(options.getIngotId()).isEmpty()) {
if (ctx... |
eb19359c-98ed-43c1-8aa9-089e16a07f67 | 0 | public Date getDateTo() {
return dateTo;
} |
ca41709f-4571-40c2-83b7-df332acc9f34 | 4 | public static FileFilter getFileFilter(){
return new FileFilter() {
@Override
public String getDescription() {
return "Cellular Automata Files";
}
@Override
public boolean accept(File f) {
if(f.isDirectory()) return true;
String name = f.getName();
String suffix = name.contains(... |
f56a8742-8407-428f-8c92-70715d863463 | 1 | public static double[] sub( double[] vec1, double[] vec2 )
{
int m = vec1.length;
double[] res = new double[m];
for ( int i = 0; i < m; ++i )
{
res[i] = vec1[i] - vec2[i];
}
return(res);
} |
0e3faf85-c2f8-4021-9a25-899447e8ba84 | 8 | @Override
public Object set(Context cx, Object value)
{
switch (type) {
case SPECIAL_NONE:
return ScriptRuntime.setObjectProp(target, name, value, cx);
case SPECIAL_PROTO:
case SPECIAL_PARENT:
{
Scriptable obj = ScriptRuntime.toObject... |
b6e9d35d-3732-489e-8f47-c9d985bb4d2a | 4 | public void close() {
try {
if (running) {
running = false;
if (selector != null && conn != null) {
selector.wakeup();
conn.close();
} else {
onClose(conn);
}
}
} catch (Exception ex) {
}
} |
cc0c4627-2212-4494-99c1-50fb3bb75d93 | 2 | public int getRowCount(int y) {
int count = 0;
for (int x = 0; x < width; x++) {
if (grid[x][y]) {
count++;
}
}
return count;
} |
bb6bec78-38e4-4ff8-8434-0650704bd3d1 | 5 | public static void HandleCommand(String command)
{
StringTokenizer st = new StringTokenizer(command);
try
{
if (st.hasMoreTokens())
{
String s = st.nextToken();
if (s.charAt(0) == '#')
{
return;
}
for (int i = 0; i < mGameVariables.size(); i++)
{
if (mGameVari... |
b62aa6ea-31e1-4e1d-8d5d-aa76665fdcd0 | 6 | public static void unzip(final String file, final UnzipListener callback)
throws IOException, InterruptedException {
final byte[] buffer = new byte[BUFFER_SIZE];
final File f = new File(file);
final File d = f.getParentFile();
if (!d.exists()) {
d.mkdir();
}
// Total number of entries.
final ZipFile... |
d5f45772-a8f0-42dd-af1b-b64dd436b2ca | 6 | public CjtElements getElementsPosicio(String dia, int hora){
int i;
if (dia.equals("dilluns")) i = 0;
else if (dia.equals("dimarts")) i = 1;
else if (dia.equals("dimecres")) i = 2;
else if (dia.equals("dijous")) i = 3;
else if (dia.equals("divendres")) i = 4;
else... |
1367081e-aca9-405d-81e4-c549705f1709 | 4 | private void checkForAsyncRollbackFailure(List<Future<?>> asyncs) throws ProcessRollbackException {
for (Future<?> async : asyncs) {
if (!async.isDone())
continue;
awaitAsyncRollback(async);
}
} |
6ebdc9d3-b959-434e-97df-5a873ee8d108 | 9 | public boolean checkForDoubleBooking(Room room, Date checkInDate, Date checkOutDate) {
boolean doubleBooking = false;
int i = 0;
while (doubleBooking == false && i < bookingList.size()) {
if ((bookingList.get(i).getRoomNo() == room.getRoomNo())) {
Date bookingStartDat... |
2e20509d-95f5-4aaf-b4ae-0f68098864a0 | 2 | public void print() {
// check if read in
if (!rpTreeHeader.isHeaderOK()) {
int badMagic = rpTreeHeader.getMagic();
log.error("Error reading R+ tree header: bad magic = " + badMagic);
return;
}
// print R+ tree header
rpTreeHeader.print();
... |
b3288836-c7c1-44c2-a215-e20389b70ff3 | 9 | public void writeStoreShelf( OutputStream out, StoreShelf shelf ) throws IOException {
StoreItemType itemType = shelf.getItemType();
if ( itemType == StoreItemType.WEAPON ) writeInt( out, 0 );
else if ( itemType == StoreItemType.DRONE ) writeInt( out, 1 );
else if ( itemType == StoreItemType.AUGMENT ) writeInt... |
21d6735f-0ed6-4a4c-9568-e6a19a8e918f | 2 | @DBCommand
public boolean vote(CommandSender sender, Iterator<String> args) {
if(!(sender instanceof Player)) {
sender.sendMessage("This command can be used only by player");
return true;
}
if(!sender.hasPermission("db.vote")) {
sender.sendMessage(RED + "Y... |
4c491800-27dc-431d-bc0e-78957557f7e2 | 4 | private boolean isPathValid()
{
boolean valid = true;
for ( int i=0;i<path.length-1;i++ )
{
if ( path[i].to == null
|| path[i+1].from == null
|| path[i].to.nodeId != path[i+1].from.nodeId )
{
valid = false;
break;
}
}
return valid;
} |
93b05ab2-0c6c-4eb1-b370-aa3a33955747 | 6 | private <T, R> void addToActions(StateHistory<TimeStamp, T> history, BiFunction<TimeStamp, T, R> toActionValue, Type type, int address, ArrayList<TimedAction> actions) {
TimeStamp curTimestamp = TimeStamp.MIN_VALUE;
while (true) {
T curValue = history.getValueAt(curTimestamp);
if (curValue != null)
... |
772eb384-8dcc-478d-9e08-8e646591635c | 8 | public ReportScreen(SwingView view) {
super(view);
JPanel panel = new JPanel(new GridBagLayout());
panel.setBorder(BorderFactory.createTitledBorder("Details"));
GridBagConstraints c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 0;
c.fill = GridBagConstraints.HORIZONTAL;
c.insets = new Insets(5, 5,... |
ebedc4e7-c531-4712-b786-5fd32a7d550c | 5 | private void initList(){
listModel = new DefaultListModel();
for (int i=0;i<checkedOutBooksInYear.size();i++){
Borrowing b = checkedOutBooksInYear.get(i);
BorrowingFrequency bfr = new BorrowingFrequency(b.getCallNumber(), countUniqueItems(b.getCallNumber()));
bf.add(bfr);
}
int count = 0;
for (... |
cc204705-86ea-480f-be0e-a91ca3483afa | 3 | public void setDestinos(String[] dests){
JLabel actual=null;
String[] destinos=new String[3];
if(dests==null){
for(String s:destinos){
s="Error";
}
}else{
destinos=dests;
}
for(int j =0; j<Interfaz.NUM_DESTINOS;j++)
{
actual=txtDestinos[j];
actual.setText(destinos[j]);
}
} |
53e2cf2b-2142-4968-b7ed-d7b490fc948a | 3 | @Override
public String getColumnName( int column )
{
switch( column )
{
case 0: return "料号";
case 1: return "描述";
case 2: return "其他";
default: return "Unknown";
}
} |
9e732eae-d4d5-486d-b560-1bb7cf9d4d53 | 6 | public void parseHCPout() {
in = new Scanner(System.in);
boolean success = false;
// Keep trying if file not found
while (!success) {
System.out.print("Awaiting NEOS output .txt file (or 000 to exit): ");
String NEOSfile = in.nextLine();
if (file.trim().equals("000")) {
System.out.println("Progra... |
7cf0b05f-eb1e-441e-b28e-2d9474b37819 | 7 | public void displayData() {
List<UnitType> unitTypes = getSpecification().getUnitTypeList();
ArrayList<UnitType> colonists = new ArrayList<UnitType>();
for (UnitType unitType : unitTypes) {
if (unitType.hasSkill()) {
colonists.add(unitType);
}
}
... |
38348a19-f5e2-4fe1-9738-5fb7d360839c | 0 | public Car driverCar() {
return new Benz();
} |
686adcc8-33e1-4675-ad8e-4c992a512687 | 8 | public AccountFrm() {
myframe = this;
mediator = ClassicSingleton.getMediator();
setTitle("Account Application");
setDefaultCloseOperation(javax.swing.JFrame.DO_NOTHING_ON_CLOSE);
getContentPane().setLayout(new BorderLayout(0, 0));
setSize(575, 310);
setVisible... |
6a4b6c3e-78ba-483e-b452-43e6c6507e70 | 0 | public void setParent(SymbolTable parent)
{
this.parent = parent;
} |
86dfc655-df32-4d28-aa94-101893d5d020 | 7 | private boolean r_Step_1c() {
int v_1;
int v_2;
// (, line 93
// [, line 94
ket = cursor;
// or, line 94
lab0: do {
v_1 = limit - cursor;
lab1: do {... |
7a85c481-e856-4ef5-a4e8-330cef317b14 | 8 | public void generateRandomNetworkStructure(int nNodes, int nArcs)
throws Exception
{
if (nArcs < nNodes - 1) {
throw new Exception("Number of arcs should be at least (nNodes - 1) = " + (nNodes - 1) + " instead of " + nArcs);
}
if (nArcs > nNodes * (nNodes - 1) / 2) {
throw new Exception("Number of arcs ... |
6eb0e9b9-f5cd-450c-a86d-b44116861bbf | 9 | boolean waitForConnections(String forWhom,
int requiredMinNumberOfConnections) {
if (this.connections.size() >= requiredMinNumberOfConnections) {
log.info("waitForConnections: called for " + forWhom
+ ": had right# of connections on entry, for call ID "
+ this.callID);
return true;
}
if (this... |
d83defa4-a991-4517-a097-7ea4842c246b | 4 | public JLabel getPlayer1Score() {
boolean test = false;
if (test || m_test) {
System.out.println("Drawing :: getPlayer1Score() BEGIN");
}
if (test || m_test)
System.out.println("Drawing::getPlayer1Score() - END");
return m_player1Score;
} |
a4521998-fd97-4629-85f0-072e7b7a5416 | 6 | public Secured_Notes(SingleFrameApplication app) {
super(app);
initComponents();
// status bar initialization - message timeout, idle icon and busy animation, etc
ResourceMap resourceMap = getResourceMap();
int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout"... |
39d90222-f921-4733-82ca-8b728f9db49c | 3 | @Override
public EntidadBancaria insert(EntidadBancaria entidad) {
PreparedStatement preparedStatement;
Connection connection = connectionFactory.getConnection();
try {
preparedStatement = connection.prepareStatement("INSERT INTO entidadbancaria(nombre, fechaCreacion, codigoEntid... |
f2bcfcb0-3688-466a-a455-20bf7b2b78bb | 0 | public void setActive(boolean state)
{
active = state;
} |
bec2459f-be46-451d-975d-e107ed1b84ff | 0 | public int getNumRsrces() {return resources;} |
1b52d167-fb58-4414-a98a-13ee90a09ef2 | 6 | public void fillTiles(int layer, int x, int y){
int tileSize = parent.tilePanel.getTileSize();
int mouseX = x;
int mouseY = y;
if(mouseX > 0) mouseX = mouseX/tileSize;
else mouseX = 0;
if(mouseY > 0) mouseY = mouseY/tileSize;
else mouseY = 0;
int choice = parent.tilePanel.getChoice();
i... |
ac583a0e-80d2-47ad-9cef-d664c582a25b | 1 | @Override
public String toString() {
String s="\"";
if(buf.length<15) {
s+=StringUtils.stripControlCharacters(new String(buf))+"\"";
} else {
s+=StringUtils.stripControlCharacters(new String(Arrays.copyOfRange(buf, 0, 12)))
+"...\" ("+buf.length+" bytes)";
}
return s;
} |
396a657b-58f6-4344-96f9-1704033cd24c | 0 | public Map getValues() {
return values;
} |
a159bdb8-ac90-4d01-9494-9358313fb199 | 8 | public void render(Map map) {
if (updateSenses) {
long startTime = System.currentTimeMillis();
playerSenses = map.getPlayerSenses();
long endTime = System.currentTimeMillis();
Log.print("Shadowcasting time: " + (endTime - startTime));
updateSenses = f... |
98cb870b-3f00-48e4-8b43-9d1d0da4e85c | 5 | @Override
public Component prepareRenderer(TableCellRenderer renderer, int row,
int column) {
Component c = super.prepareRenderer(renderer, row, column);
Color fg;
// ログレベルに応じて文字の色を変更
switch ((char) getValueAt(row, 0)) {
case LogPanel.LOGLEVEL_ERROR:
fg = Color.RED;
break;
case LogPanel.LOGLEVE... |
21fefdbc-78cd-4211-9177-a6a90fd3bcbc | 3 | @Override
public void insertString(int offset, String str, AttributeSet attr)
throws BadLocationException {
if (str == null) {
return;
}
if (iMaxLength <= 0) // aceitara qualquer no. de caracteres
{
super.insertString(offset, str, attr);
... |
448eb23d-ceb9-446f-95ff-ef0244f9a7d3 | 2 | public List preOrder() {
if ((preOrder == null) || (edgeModCount != preOrder.edgeModCount)) {
buildLists();
}
return preOrder;
} |
ebd4e587-1433-4083-875a-54b0a0de25d1 | 8 | private void verificarSeleccionParametricasLuminaria() {
if (puntoLuz.getLuminaria().getArrancador().getFabricante().getId() == 0) {
puntoLuz.getLuminaria().getArrancador().setFabricante(null);
}
if (puntoLuz.getLuminaria().getArrancador().getTipoArrancador().getId() == 0) {
... |
fc41a299-0e2b-4e7f-ad4d-77e1cc351f49 | 9 | public void findWeights(int row, double[][] mean){
double[] neww = new double[m_Dimension];
double[] oldw = new double[m_Dimension];
System.arraycopy(m_Change[row], 0, neww, 0, m_Dimension);
//for(int z=0; z<m_Dimension; z++)
//System.out.println("mu("+row+"): "+origin[z]+" | "+newmu[z]);
doubl... |
b6f5a819-2bfb-4238-9912-1eb8984a6d87 | 9 | @EventHandler
public void onRedstoneEvent(BlockRedstoneEvent event) {
settings = plugin.getSettings();
if (settings.getBooleanSetting("isPlaying") == true && settings.getStringSetting("gameMode").equals("redstone")) {
if (event.getBlock().getBlockPower() == 0)
return;
if (event.getBlock().getLocation().g... |
d570c580-b4cf-4898-805a-b620cade085b | 6 | public void validate(Secao secao, Evento evento){
if (secao == null || secao.equals("")){
throw new SaveException("Seção não pode ser vazia.");
} else {
if (evento == null || evento.equals("")){
throw new SaveException("Evento não pode ser vazio.");
} ... |
779907b6-4edb-4978-bf6e-966d125f53b6 | 7 | public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... |
9b8e00e8-9254-4ffa-879b-852e2a85055b | 4 | @Test
public void createEntityDataWrapper() {
Listener listener = new Listener();
simpleEntityManager.addEntityEventListener(listener);
ComponentData sampleComponentData = new ComponentData() {
@Override
public Class<? extends Component> getComponentClass() {
... |
847fd0cf-36fb-4d08-b636-c00d3a9f3ccf | 3 | private void select() {
if (currentChoice == 0){
gsm.setState(GameStateManager.GAME);
Save.readRandomParts();
Loading.startAtLastSavedLevel(gsm);
}
if (currentChoice == 1)
gsm.setState(GameStateManager.HELP);
if (currentChoice == 2)
System.exit(0);
} |
9f3b3c78-4b37-408b-93cc-f49afa5623ff | 8 | public JPanel setup() {
JPanel panel = new JPanel(new GridLayout(2, 2));
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
comboBox[0] = new JComboBox();
comboBox[0].setRenderer(new ComboBoxRenderer.LineThickness());
comboBox[0].setBorder(BorderFactory.createTitledBorder(LINE_THICKNESS));
comb... |
f446b92d-423f-482b-93ba-c76fcb1481e2 | 6 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label,
String[] args) {
if(cmd.getName().equalsIgnoreCase("combat")) {
if(sender instanceof Player) {
Player p = (Player) sender;
PlayerUtil pu = new PlayerUtil(p);
if(pu.hasPermission("Nostalgia.Command.combat", Permissio... |
eb29f86f-4251-4c89-908d-4ca4144d1b4c | 9 | public void keyPressed(KeyEvent kE){
int key = kE.getKeyCode();
if(key == KeyEvent.VK_UP) Player.getInstance().moveY(-speed);
if(key == KeyEvent.VK_RIGHT)Player.getInstance().moveX(speed);
if(key == KeyEvent.VK_DOWN) Player.getInstance().moveY(speed);
if(key == KeyEvent.VK_LEFT) Player.getInstance().... |
db4c2006-7633-4c77-b46c-8b9266ef9aad | 7 | public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... |
be0a3a53-e187-4214-882f-1f251ef1a517 | 5 | public double variance_as_double() {
boolean hold = Stat.nFactorOptionS;
if (nFactorReset) {
if (nFactorOptionI) {
Stat.nFactorOptionS = true;
} else {
Stat.nFactorOptionS = false;
}
}
double variance = 0.0D;
switch (type) {
case 1:
double[] dd = this.getArray_as_double();
variance = ... |
cd864aa7-155d-4830-9321-88ee12716850 | 8 | public Mot(){
alphabet=new int[26];
r=new Random();
dico=new LinkedList<String>();
listeMotsEnfants=new LinkedList<String>();
// construction de la liste "dico"
try {
b=new BufferedReader(new FileReader("ressources/dico.txt"));
} catch (FileNotFoundException e) {}
try {
tmp=b.readLine();
} ca... |
89df8bfd-6d43-481e-8195-cff3a6efe54f | 4 | public void shutdown() {
try {
service.shutdown();
boolean status = service.awaitTermination(5, TimeUnit.SECONDS);
if (!status) {
System.err.println("not all tasks reached the end");
}
} catch (InterruptedException e) {
error.addSuppressed(e);
}
synchronized (currentOpen) {
currentOpen.not... |
234fb85f-14c1-49a8-b275-c94393a32cef | 3 | public static void main(String[] args) throws Exception{
Class<?> c = Class.forName("Ted");
Method methods[] = c.getMethods();
Constructor constructors[] = c.getConstructors();
for(Method method : methods){
System.out.println(method.toString());
}
for(Constructor constructor : constructors){
System... |
eb1f579a-6ecd-4ff1-9431-8a23cf201db5 | 2 | public static void ChooseKevin ()
{
if (Game.characterChoice == 1)
{
Game.CharacterOne = "Kevin";
Game.CharacterOneHP = CharacterStats.KevinHP;
Game.CharacterOneAttack = CharacterStats.KevinAttack;
Game.CharacterOneMana = CharacterStats.KevinMana;
Game.CharacterOneRegen = CharacterStats.K... |
684ad4f4-5475-43a9-a579-1d6d90d65e06 | 4 | public void loadConfig() {
File f = new File("./filesystem_config.conf");
try {
//TODO: This might be a shitty way to create a DataInputStream
DataInputStream fi = new DataInputStream(new FileInputStream(f));
filesystem_config = new HashMap<String,String>();
while(fi.available()>0) {
//split on =
... |
a8d9a984-30b3-4636-b178-02bc71c745f3 | 4 | public void generateFakeDoc(_ParentDoc pDoc, File folder, int docLength, HashMap<Integer, Double>wordSstat, ArrayList<Integer>widList, int docIndex){
String fakeDocName = docIndex+".txt";
try{
PrintWriter pw = new PrintWriter(new File(folder, fakeDocName));
for(_SparseFeature sf:pDoc.getSparse()){
... |
043280a5-a086-419d-a4a0-e512d1506ec5 | 0 | public static void main(String[] args) {
// readers1 and 3 are interested in reading a specific newspaper
reader1.subscribe(GlobalTimes.getInstance());
reader3.subscribe(GlobalTimes.getInstance());
// Suddenly something happens in this world, which must be published as a news.
news = new News("News Headlin... |
72ccb91e-355d-452e-a5cc-2c6f2da51464 | 4 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getID() == ActionEvent.ACTION_PERFORMED) {
GuiButton button = (GuiButton) e.getSource();
if (button == continueGame)
Client.instance.activateMap(false);
else if (button == options)
Client.instance.setGuiScreen(new GuiOptions(this));
... |
f2327933-c82b-4655-8f56-98d0f8e564fa | 9 | protected void backfitHoldOutInstance(Instance inst, double weight,
Tree parent) throws Exception {
// Insert instance into hold-out class distribution
if (inst.classAttribute().isNominal()) {
// Nominal case
if (m_ClassProbs == null) {
m_ClassProbs = new double[inst.numClasses()];
}
... |
397d1e9f-f551-46e3-a7a9-61baa5d831a9 | 7 | private void initShutdownFontMenu(Color bg) {
this.shutdownPanel = new JPanel();
this.shutdownPanel.setBackground(bg);
this.shutdownPanel.setLayout(new VerticalLayout(5, VerticalLayout.LEFT));
String initFontTmp = this.skin.getShutdownFont();
int initFontSizeTmp = this.skin.getS... |
02982275-072e-453c-9d13-33ed7e432628 | 5 | public static boolean sentenceContainsLink(String sentence, MessageEvent<PircBotX> event) throws IllegalAccessException, SQLException, InstantiationException {
String[] splitted = sentence.toLowerCase().split("\\.");
System.out.println(splitted[1]);
for (int i=0; i< splitted.length; i++){
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.